PHOBOSLAB

Blog Home

Posts for 2009/07

Colemak

Two years ago I asked myself if there isn't any better keyboard layout for programming than the German keyboard layout. Many keys that are essential for programmers, like curly braces and square brackets, are only reachable through extensive use of the ALT key on the German QWERTZ. This is hardly ideal and makes QWERTZ much less usable for programming than the English QWERTY.

I did consider switching to QWERTY for some time. Sure, I'd miss the German Umlauts (ä, ü, ö) but that was a sacrifice I was willing to make. I asked a German programming board how they are dealing with the cumbersome QWERTZ layout – many of them are using the English QWERTY layout as their default and are happy with it. They also mentioned Dvorak, which I largely ignored, as it seemed incredibly hard to learn and had no apparent benefit.

However, I stumbled over a new, totally different, keyboard layout that sounded promising. It's name: Colemak. Colemak is designed to be efficient and ergonomic. You can type whole sentences with it, without your hands ever leaving the home row. Yet, it is fairly easy to learn. The keys for the widely used shortcuts for undo cut, copy and paste all stay at the same place and the layout of all special characters is identical to the English QWERTY. Furthermore, I can type all the German language specific characters with Colemak and it also adds many special characters like the ellipses, en- and em dashes, typographic quotation marks and many, many more. These would otherwise only be reachable with complicated ALT combinations on Windows (e.g. ALT+0151 for the em dash).

I've been using Colemak for almost two years now, and I can't imagine switching back to QWERTZ. Typing with Colemak feels so much more fluent than it ever did with QWERTZ, especially when programming. I can now keep my 10 fingers on the keyboard at all times, as all the special characters are easy to reach. I don't mind the somewhat more complicated to type Umlauts since I don't write that much German anyway.

Another nice side effect of having Colemak installed on my Windows Desktop PC and my Macbook Air is that it flattens out the differences between their QWERTZ layouts – that's right, Windows and Mac OS have a slightly different Keyboard layout for the German language. Especially annoying is the different positioning of the curly braces, square brackets, the pipe and the at sign – characters you'll need frequently when programming. With Colemak the layout is exactly the same on all systems.

Of course, while the layout itself is close to perfect, switching to Colemak also has it's downsides. For one, if someone wants to use your PC/Mac she'd first have to switch back to QWERTZ or QWERTY. This is not a problem at all on Mac OS, where you can switch the layout with two clicks. On windows however, you can only switch the layout on a per application level, meaning that you'd have to switch the layout for each application that you want to use. Whoever had this idea at Microsoft needs to be slapped with a large trout.

I can still type on QWERTZ/QWERTY, albeit a bit slower than I used to. The one thing I'm incredibly lost at, is when I want to type program code on a friends MacBook since I never learned the Mac OS specific QWERTZ layout. However, this is a problem I'd also have if I'd still use the Windows specific QWERTZ.

If you're already using the English QWERTY layout, there's probably not that much benefit in switching to Colemak. QWERTY is already nice enough for programming and the layout is identical on Mac and PC. For everyone else who is programing a lot on the German, French, Czech or Swedish layout, Colemak sure is a very nice alternative.

UVC Camera Control for Mac OS X

For a recent computer vision project I needed to pull images out of a Logitech QuickCam 9000 and track some markers with the help of the ARToolKitPlus library. I connected the camera to my Mac and was quite surprised to see that it just works. There was no need to install any drivers. As I learned later, that's because the QuickCam 9000 is a UVC webcam for which Mac OS X 10.4.9 already provides a driver. I was able to get to the raw camera images through the QTKit Framework in no time.

However, the QuickCam 9000 has its auto exposure enabled by default, which is absolutely deadly for stable tracking results. I thought I could just turn the auto exposure off and set it to a fixed value through some QTKit API – but no, there's no way to change the exposure of a UVC camera with QTKit. In fact, there's no way to change any parameters of your camera. No exposure values, no white balance, no gain, nothing. Apple just implemented the bare minimum in its UVC driver and the QTkit Framework.

Well, maybe I could get to these parameters through the older Sequence Grabber Framework then? After all, there's a VDIIDCSetFeatures function and a vdIIDCFeatureExposure key! But nope, as the name implies, this stuff only works for IIDC cameras. What's an IIDC camera? Wil Shipley asked the same questions almost 3 years ago - even back then, IIDC cameras were pretty much deprecated. Still, these cameras are the only devices that Apple provides an API for, if you want to change some esoteric parameters no one would ever need to change, like oh, the exposure time or white balance temperature for instance.

Apple is aware of the problem but hasn't done anything to solve it. And Logitech apparently doesn't see the need to provide a Mac driver for their cameras, since Mac OS X already ships with one. Great.

But wait, UVC is a standard, right? USB.org provides a documentation for all device classes, and the Video Class is no exception. So, I poked around in the documentation for a while, read some Linux UVC driver sourcecode and used Apple's USB Prober to see what's going on. After some more hours of playing around with the Kernel Framework's USB API, I was finally able to control some of the QuickCam's settings!

Read complete post »