SKerwin: July 2007 Archives

Curing Parallels Desktop's Key Lag


I use a Mac at work and run Parallels so I can use Visual Studio (our code doesn't quite play nice with Mono/XSP yet, so I'm stuck with one foot in Microsoft's garden for the time being). Visual Studio is actually a relatively nice IDE, at least in terms of the hooks it provides for customization. I've remapped most key commands to work the way I'm used to using them on a Mac, and until today I had Parallels set to swap my command and control keys, meaning that for the most part Windows felt almost like another Mac app -- a hideously ugly Mac app with its own file system and two menu bars which was pointlessly confined to one screen, but a Mac app nonetheless. Sort of.

The biggest problem with this solution was that the swapped control and command keys seemed to lag; if I released the command key and started typing too quickly, Windows would register the first few characters as being typed with the control key down, often to hilarious effect. For some reason, when Parallels swaps keys it introduces keyboard latency -- for those keys only. That last part is the real problem; if the whole keyboard lagged I'd probably be fine (I'm pretty well accustomed to out-typing programs, I've been doing it for quite some time). It's a pretty glaring bug, and it renders the Parallel's key-swapping feature well-nigh useless.

But, as luck would have it, Windows has built-in keyboard remapping hooks. I say 'hooks' instead of 'features' because I refuse to consider anything that makes me thing about endianness a 'feature'... But I digress. Open up RegEdit and browse to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout (not Keyboard Layouts, right below it) and add a new binary value.

Then make it look like this:

00 00 00 00 00 00 00 00 20 00 00 00 1D 00 5B E0 00 00 00 00
(00 00 00 00 00 00 00 00 20 00 00 00 1D 00 5B E0 00 00 00 00)

That will turn your left windows key into a left control key. Restart Windows, turn off Parallel's key remapping, and you're good to go.

Learn More, Know Less


I read Refactoring. Thought I understood it. Liked it, even. Wordy in place, but well worth reading.

Now I'm working with XSLT. I want the transformations to be fast, of course, which means I need to learn more about functional programming (because, though you'd never really know at first blush, XSLT is a full-on language).

So in hindsight, Extract method, replace temp with query... this is all about referential transparency, isn't it? The concepts are really inextricably linked, very obviously for those refactorings and less obviously but no less intrinsically to many other refactorings.

But referential transparency is all about about pure-functional programming, removing side effects. And side effects are like globals (or singletons, and Lord do I hate singletons) but isn't an object method kind of a like a function with the object properties as globals? How's it different? Is it?

If maintainable code is refactorable, and refactorable code is functional, and objects are inherently tied up with side-effects, and side-effects are non-trivially incompatible with functional programming, how the hell are we not all globally and intrinsically screwed?