Category: Uncategorized
-
Smart Radios
For a couple of years I have been running mpd (music player daemon) on an Alix, connected to a stereo in the office. The Alix runs headless, but I have a variety of options to control it: gmpc on the notebook, Droid MPD client on the phone and fookebox in the browser. Over the years I read a multitude of articles about home built jukeboxes based on something like a RaspberryPi, a simple display and some buttons. I thought, that’s cool, but I didn’t have the requirement for this in the office.
Some time last year, I thought it would be cool, if my wife could access our full music collection from the kitchen. As her old radio started to disintegrate, I had an idea for christmas. So the first idea was to build something myself. But the kitchen is not the ideal place for something thrown together with loose wires, and I couldn’t expect her to reboot it in case something locks up. So I was looking for something pre-made and a bit more consumer friendly. I didn’t want to loose freedom though, so the ideal would be if it was also based on mpd. I didn’t find the device I was looking for, but the device that came up most in my searches was the UE Smart Radio from Logitech. It seemed to cost a lot more than a RaspberryPi with some additional components, so I looked further and went to several shops. The selection in this area is very sparse, which surprised me a lot. All the other devices in the shops, except the insanely expensive ones, sounded like through a long cardboard tunnel. But the UE (Ultimate Ears) one, although mono, sounded really good. Another feature that made it stand appart from much of the competition is, that in addition to the WIFI, it also offered connectivity through an ethernet port. This one was a must, since my Wife is very concerned about electro smog.
So I went for the UE Smart Radio from Logitech. It was received well by my wife. At first we only used it to listen to live streams of radio stations around the world. It worked perfectly for that. But connecting it to our music library didn’t work out so well. I assumed, It could just access the files over a network share. So I set up a samba share on the server that contained all the music files. After all, that’s how the media players fetch the movies as well. I just couldn’t figure out how to find the music from the radio. All it said was to install some proprietary software on the computer and the phone. I don’t particularly like such proprietary stuff, and always try to find ways around, but this time I had to bite the bullet. The android app gave some additional configuration and remote control options, but insisted on installing also something on a computer to be able to stream the private music collection. So I had a look at http://www.uesmartradio.com. It offers the download only for Windows and Mac. Now this is where I started to question the purchase. I agree that some clueless managers might be familiar with only these two options on the desktop. But do they really insist on everybody having their desktop computer running just to listen to their music in another room? No way!!! I think by now at least a NAS system if not a small server is in most households that care to have their music available electronically for devices like this radio. And what operating system do they usually run? Windows? MacOS? They must be joking!
At first, I wanted to dissect the Windows package in the hopes to being able to reverse engineer it to get something workable. But all information I found about that package on the internet, indicated that it is an unholy mess consisting of a multitude of dlls and executables. So I checked on the MacOs package. The information I found indicated something perl based and much cleaner than the Windows version, but I had no tools readily available to decompress it. Luckily I found a forum thread where other people already complained about the very same issue. One pointed out that there are unofficial nightly builds for a range of other targets, one of them being a debian package. That solved the problem for the moment. Installation was smooth, and so was setup and operation. The only soar point that remains was also confirmed by the Logitech support: The packages for the more useful platforms are not officially supported and they don’t know if they will continue to build them at all.
K810 Bluetooth Keyboard
With a keyboard also from Logitech I had a similar issue. I have always preferred standards such as Bluetooth over proprietary protocols such as Logitech’s Unifying. So I was delighted when I spotted a slim, nice looking bluetooth keyboard in a store some years ago. It was meant for the iPad, but I thought, if it’s bluetooth, it should work with my computer and phone too. Pairing was no problem, as was operation under Android. The problem arose when I wanted to use it with the Computer. The keys that were there, worked perfectly, but the problem was the missing function keys (F1 – F12). Without them it’s very hard to operate just about any debugger in an IDE that I know of.
So, I was even more delighted, when I discovered the K810 in a store last year. It can pair with three devices, and easily switch between them. So I could for example use it with the workstation, the notebook and the phone without having to re-pair each time. The first one I bought was for the office. And I became a huge fan of this keyboard. So I bought also one for at home. I noticed in the office, that the default mapping of the function keys is awkward to say the least. By default, the alternative functions like the brightness of the key back light or the multimedia controls are activated, and to use the regular function keys, you have to press the FN key. It’s hard to guess what they smoked when they decided to make this the default. Imagine your mother wants to refresh the page in her browser by hitting F5 and instead the keys get brighter. Or imagine she wants to rename a file by hitting F2, and instead the keyboard disconnects from the computer and sends subsequent key-presses to the phone. Let alone operating a debugger. Luckily this setting is easy to change with the Logitech SetPoint software….. unless …. there is no SetPoint software for everything but Windows and MacOS.
Luckily somebody already reverse engineered the relevant information, and compiled a small utility program, that corrects this setting. Thanks Mario for sharing. Your utility saved my day.
-
Mountain Wagas
Every season has its virtues. What I like to do during the winter season is Wagas games, and the Fronalpstock is perfectly suited for that. Wagas are usually performed by flying close to sand dunes in the constant sea breeze, but powder snow is just as soft as sand. Instead of the constant sea breeze for soaring, we have some altitude difference in the mountains. Well, to be honest, the snow didn’t look particularly soft last Sunday, hence my Wagas games ended up being even more cautious.
-
vim meets VisualStudio
There are two camps of neckbeards: Those who use emacs, and those who use vi or vim. I can’t tell which is better, and most of the arguments seem to be rhetoric. Until about three years ago, I perceived both as insufferable. I was however curious to learn either of them. The question was which one to pick. During my uncertainty, vim was praised more on hacker news. So I gave it a try. At first, it was awkward to work with, but after a while I managed to get along. People often tell how blazingly fast you are editing with vim. But for a long time, I was not nearly as efficient as with other editors. At the moment I’m reading the book “Practical vim” which has a ton of good tips. It seems the flood of shortcuts is never ending. In a way memorizing more commands and shortcuts is like having more keys. That kind of reminds me of an article, I once read. It compared working with a GUI vs on the console to listening radio vs playing piano. I can’t find the article right now, but it had similar reasoning as this one.
So I’m constantly improving my vim skills. In the meantime I’m about on par with how efficient I am at using the style of editors, that I have been using for two decades. To improve further, I thought I would need to practice more. So the natural progression was to use it on the job. For work we use VisualStudio, and unless I could easily compile and debug out of vim, switching back and forth would be counter effective. So I was thrilled to find out that there is a plugin to bring vim style editing to VisualStudio. I only just started using it, but it certainly looks promising.
-
We have been using passwords for too long
Every time I have to register to a website using a password, I grow more annoyed. Passwords were fine when you only had one, to log in to your corporate mainframe. But these days, computers are better at cracking passwords than humans at remembering them.
It only gets worse with the more sites you maintain profiles. You shouldn’t use the same password all over. If it was hacked, your entire online identity could be compromised. And nobody can remember good strong passwords for every site he visits. Password managers are no solution. You need to have them with you all the time. They are protected by a master password. So if an attacker can get hold of your database and your master password, which is easily attainable with a trojan, then good luck. He even gets a list of sites to visit.
OpenId and OAuth are a step in the right direction. In theory, you could maintain your identity with a central entity, and use it as a proxy to authenticate you. You have to choose that central entity that manages your identity well, as is can now track your every move. Hence, It would be best, if you could host it yourself. But it is usually still only protected by a password. Since you now only have to remember one, it’s easier to choose a strong one. But again, if an attacker gets hold of your password, he can impersonate you.
So, we need hardware based two factor authentication (something you have and something you know). For about one and a half years I’ve been using a CryptoStick for said two factor authentication. It works great for email, files, ssh, package signing, full disk and disk image encryption, but I couldn’t figure out so far how to use it for web authentication. They mention a service for a SmartCard backed OpenId. That would be just what I want, but I couldn’t figure out how to make it happen. (more…)
-
an ultrabook for developers
My old netbook still runs, but it shows signs of senility. I have been thinking of a replacement for a while, but as it still worked, that was constantly postponed. When I first read about project sputnik, I thought this is great news and I want one. The device that followed looked very nice, but was a little bit over my budget. Only when the value of BitCoin rised to new hights, I ordered a Dell XPS13 developer edition. The dell representative told me that they don’t YET accept BitCoin for payment, but he was well aware of what it is. Apparently the device shipped from Asia. Since I didn’t know that, I waited eagerly and checked the status every day. After it was in delivery already three days after ordering, I didn’t understand why UPS didn’t even receive the box more than two weeks after that.
The device is really slick. I had no issues so far, not even with the graphics driver. That is also why I wanted this device that comes with ubuntu, and fully supports it. All the drivers are in the vanilla kernel. The graphics card drivers were always the culprit with my previous netbooks. They both had binary drivers when they came out, no 3D acceleration, and the situation degraded gradually. After the second OS upgrade I usually even lost 2D acceleration. Now that I have an ultrabook with a GPU that is apparently fully supported, I wanted to see how well the GPU performed. So I grabbed my very first OpenCL program to give it a try. I was glad to see, that the intel OpenCL driver was already packaged in the ubuntu repository, and that the 4400 GPU support was recently added. This situation is much better than when I started with OpenCL. But I soon realized that this GPU or it’s driver doesn’t support the kind of memory sharing that I used in the example. So, I had to slightly rewrite the host program, no big deal. On the other hand, it would support double precision floats which my geforce in the workstation doesn’t. But after that, I found out that this tiny ultrabook outperforms my five year old workstation by a big margin on CPU and GPU. And that is by using only a fraction of the power. Then I applied the same changes to my GPU accelerated ray tracer. The ultrabook ran the homework image in 15 minutes. So this one was a bit slower than the workstation.
In general, the experience with the XPS13DE is just great. Everything is so responsive, totally different than with the Atom based netbook. The only thing I would have ordered differently if I had a choice was a bigger SSD. Although I was lucky already, If I had ordered a month earlier, It would have come with 128 instead of the 256GB SSD.
The setup was about as follows:
- OS install with smart card backed full disk encryption
- setup smart card authentication for ssh
- checkout of my git home repo.
- software install with my setup script that adds ppa repositories and apt-get installs everything I need
- Checking out all source repositores (git and hg) that I usually work with that are not already submodules of my home repo
- integrate the plasma-desktop into unity so that I could still use the bitcoin plasmoids. But the experience with this integration was not so good, so I reverted that. I will look into writing a screenlet for gnome.
- syncing the git repos for photos and music. They are why I would have wished for a bigger SSD.
- syncing the BitCoin block chain
I’m grateful that the BitCoin price surge gave me the opportunity to “vote with my wallet“. Otherwise I would maybe ended up doing the same as last time: buying a cheaper model with a mediocre operating system that I don’t want. That would send the wrong signals, and reinforce the vicious circle. At least Dell has realized that people want good hardware with good linux support. Yes, people are willing to pay a premium for good hardware support for a free and open operating system.
-
Pimp my miner
For a while now, I thought about mounting a simple display somewhere that shows the most important parameters of my BitCoin miner. First I started with an AtMega equipped with an Ethernet module. But parsing json without any library support became too cumbersome quickly. So I copy pasted together a small python script, and used a nokia display that I already equipped with an i2c interface. If I knew how easy it is, to use those json interfaces, I would have implemented this display project earlier. The code is at the bottom. It is specific to my setup with p2pool and CHF, but it is so easy to change that you can adapt it to whatever your setting is. The python script now runs on an Alix on the same i2c bus as my simple home automation transmitter. Now all that is left to do, is adding a line to /etc/crontab to execute the script once a minute.
As you can see on the image below, the hash rate is too hight for a stock Saturn. That is because I recently added an extension module. So it has now three instead of two hashing modules. All of a sudden, KncMiner announced they had 200 extension modules for the October batch, and that future modules would be incompatible. So, that was pretty much the only chance for an upgrade. My existing power supply should have room for one more module, and they were moderately priced. The demand was high enough that they were sold out in three minutes. The i30 cooler that was recommended was not available at the time, so I had to use an Xtreme rev2. I had a fun time finding out how to correctly mount it. Even for the original, there was no manual or description how to mount it. Just look at the existing modules said someone in the forum.

-
chording bluetooth keyboard
Wearable computing is much older than Google glass, and even head mounted displays were around for a while. Personally, I’m looking forward to affordable devices of that type. The display seems to be a very good solution, while voice entry can be awkward. The Hak5 podcast aired an episode last year about a guy that has walked around with a head mounted display and a computer in his backpack for a long time. While the display is certainly cool, what was most intriguing to me was the keyboard. He uses a one hand device with key press combinations that he can operate while walking around.
I didn’t find his exact model when searching the Internet, and while there are some devices around in this category, the selection is very sparse. They are called chorded keyboards, and were first introduced in 1968 at what is often called “The Mother of All Demos“. Then I found out that there is an open standard for this sort of thing. It’s called GKOS and stands for Global Keyboard Open Standard. They experiment in lots of different directions, but no commercial product seems to have come out of this so far. Amongst the different experiments, there is an Arduino project to build a GKOS keyboard, but I considered an Arduino with custom buttons too bulky for practical use.
A while ago, I ordered a cheap 6-key HID device that I wanted to use to try GKOS myself. I tried a while with key remapping but to no avail. And I strongly suspected, the device could not handle key combinations at all.
Last week, I somehow remembered my failed past attempts, and thought that a bluetooth device would be cool. I quickly confirmed that all the DIY bluetooth modules that I had were not capable of HID but only UART. Then I found a simple to use bluetooth HID module, that was apparently released just two months ago. What a coincidence!
The first test with the GKOS Arduino code on a breadboard was successful. So, I disassembled the USB device, and re-soldered the buttons to an AtMega8 and added a lithium battery from a defunct tiny quadrocopter. But after I soldered everything together, only some keys would work. I was sure, an AtMega8 would be able to handle this simple task with ease, but I had to use an Atmega328 to make it work. It costs a few bucks more, but much less than the time for finding out what the problem with the AtMega8 was. I didn’t inspect the code throughly enough yet, but maybe the AtMega8 is just missing some hardware interrupts.
So far, I’m very slow at typing, and I have to peek at the cheat sheet for most characters, but with a bit of training that should improve. My prototype works well for two handed operation, but I think one handed operation would be the way to go, although I don’t know if GKOS is really suited for that.


-
BitCoin mining pools
As stated in an earlier post, after I was mining for a few days, the 50btc mining pool was hacked. A month later, I’m still waiting for my coins. So I tried some other pools. As advised in many places, I avoided the biggest pools, thus mitigating the risk of a 51% attack. I mined for about three days each with 50btc, slush, bitminter and eligius. Like 50btc, slush and bitminter required registration and payed for the submitted work to an account on the site. You could manually cash out, or define automatic payouts with a threshold. These pools are good for ease of mind when you start mining, or have underpowered hardware, as you get a predictable, steady flow of income. Because these pools pay for submitted work, they have to absorb the risk of bad luck periods. Thats when the pool doesn’t find as many blocks as it statistically should. Because of that, they naturally need to collect higher fees.
The eligius pool has an entirely different strategy. As happened to 50btc, the pools above accumulate funds for payouts, and are thus exposed to hacks. You don’t have to register for eligius. Instead, you just provide your payout address as user name. When a block is found, it is split amongst the miners, and no funds are kept on the server. This manifested in a different action in my bitcoin client. Rather than an usual transaction with an originating address, it showed two hammers, indicating that this came directly from mining. Though not vulnerable to hacks as the other pools, it is still attackable by DDoS. And yes, the BitCoin world is more hostile than the broader OpenSource community. That’s what money does to people.
Then I found what I consider much more in line with the bitcoin spirit: p2pool. It is decentrally organized as peer to peer network, just as bitcoin itself. Having no single point of failure, it is save from both hacking and DDoS attacks. It is very clever how it works: (more…)
-
revisiting enable_if
It was roughly 2008, when I wanted to make a template function for serialization, only available to container types. Template stuff can become complicated at times, and from reading the documentation boost::enable_if seemed to be just what I needed. I didn’t get it to work, and I blamed Microsoft Visual Studio 2005 for not being standards compatible enough. And somehow I remembered enable_if as being difficult and hard to get to work, despite highly desirable if it would work. I ended up providing explicit template overloads for all the supported container types.
Fast forward to five years later, enable_if made it into the C++11 standard, and I didn’t even notice until reading “The C++ programming language” by Barne Strousup. In the book the facility is presented as a concise template that is easy to use and even to implement. To understand it’s value, let’s start with an example. Suppose, I want to implement a template function to stream the contents of containers to stdout.
#include <iostream> #include <vector> #include <list> template<class ContainerT, class StreamT> StreamT& operator<<(StreamT& strm, const ContainerT& cont) { strm << '{'; for(const auto& element : cont) strm << element << " "; strm << "} "; return strm; } int main() { std::vector<int> ints{8, 45, 87, 90, 99999}; std::list<float> floats{3.14159, 2.71828, 0.57721, 1.618033}; std::cout << ints << floats; return 0; }So far so good, this does the trick. And the output is just what we expected: {8 45 87 90 99999 } {3.14159 2.71828 0.57721 1.61803 } But now we also write an output stream operator for some user defined interface type. (more…)

