Making the Apple Keyboard Play Nice with Windows

After a long, long love affair with Logitech, I’ve finally finished a slow migration toward Apple’s input devices.  Their aluminum keyboard took some getting used, but once I’d grown accustomed to it on my Macbook, I decided to get one for my Windows 7 desktop.  It seemed like everything was working perfectly until I pressed the mute button; nothing happened.  Volume down?  No go.  In fact, all of the media keys (volume up/down, mute, play/pause, etc.) refused to do anything. For whatever reason, SharpKeys and other keyboard mapping utilities don’t recognize Apple’s media keys.  The solution, it turns out, is to install a pair of Bootcamp files from your Mac OS X installation DVD.

Here are the steps that worked for me.  I’m running Windows 7 x64 with a 2010 Apple aluminum keyboard, and have a Mac OS X 10.6 Snow Leopard installation disc.  As always, your mileage may vary:

  1. Insert your Mac OS X installation disc.  If it tries to auto-run anything, cancel it.
  2. Open Windows Explorer, right-click on your DVD drive, and select Open from the menu.
  3. Navigate to the Boot CampDriversApple folder.
  4. Copy BootCamp.msi (or BootCamp64.msi for x64 systems) to your desktop.
  5. Copy AppleKeyboardInstaller.exe (or x64/AppleKeyboardInstaller64.exe for x64 systems) to your desktop.
  6. Use a tool such as 7-zip to extract the AppleKeyboardInstaller.exe file.
    1. With 7-zip, can you do this by right-clicking on the file and selecting 7-Zip->Extract to “AppleKeyboardInstaller”.
  7. Navigate to the folder you extracted AppleKeyboardInstaller.exe to and run the DPInst.exe file to install the Apple keyboard driver for Windows.
  8. Click Start->All Programs->Accessories, right-click on Command Prompt, and select Run as administrator.
  9. In the command prompt, type “cd Desktop“.
  10. Install BootCamp by typing “BootCamp.msi” (or “BootCamp64.msi” for x64 systems) in the command prompt.
  11. Once the installation completes, you can delete the files on your desktop and remove the Mac OS X installation disc.  Reboot your computer and enjoy your new media keys!

April 2013 Update: I just tried this method using Windows 8 and the BootCamp drivers from Mac OS X 10.8 Mountain Lion. Apple seems to be preventing the new BootCamp.msi  (version 5) from installing on non-Apple hardware, so the above method will fail on Step 10. Luckily I had an old copy of Mac OS X 10.7 Lion BootCamp drivers (version 4) which worked perfectly on Windows 8.

August 2013 Update: Thanks to Tom in the comments section, who pointed out that Apple’s Bootcamp update will install on non-Apple hardware, so we can use the latest Bootcamp drivers on Windows 8! On my machine, however, these new Bootcamp drivers set the time incorrectly after each reboot. The fix is to open up regedit.exe and navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation. Double-click the RealTimeIsUniversal key and set its value to 0. Reboot and enjoy!

PHP ZIP Extension for MAMP

Do you use MAMP as a web development testing environment on your Mac?

Do you need the PHP ZIP extension for dealing with archive files?

Are you running Mac OS X 10.6 Snow Leopard?

I do, and found making these tools play nice together to be far harder than it should have.  If you need to fix a similar setup, here are the steps that finally worked for me (on Mac OS X 10.6.4 with MAMP 1.9):

  1. Install XCode if you don’t already have it (we’re going to be doing a bit of compiling).
  2. Download the MAMP source code components (available towards the bottom of the page).
  3. When the MAMP source code package opens, go into the MAMP_src folder and double-click the php-5.3.2.tar.gz file (if you are using a different version of PHP, replace 5.3.2 with your actual version number).
  4. You should now have a php-5.3.2 folder in your Downloads folder.  Open up Terminal and cd to ~/Downloads/php-5.3.2.:
    cd ~/Downloads/php-5.3.2/
  5. Install the pcre.h header file (we need it to compile the extension):
    sudo cp ext/pcre/pcrelib/pcre.h /usr/include/php/ext/pcre/
  6. Configure PHP for i386 architecture:
    CFLAGS="-arch i386" ./configure
  7. Configure the ZIP extension for i386 architecture:
    cd ext/zip; CFLAGS="-arch i386" ./configure
  8. Build the extension:
    make
  9. Install the extension:
    cp modules/zip.so /Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/
  10. Enable the extension by opening /Applications/MAMP/conf/php5.3/php.ini and appending the following line:
    extension=zip.so
  11. Remove the pcre.h header file we installed earlier, we don’t need it anymore.
  12. Restart MAMP.  If everything worked properly, you’ll be able to goto http://localhost/MAMP, click on phpInfo, and see zip in the list of enabled extensions.

StrayLight Photography

I’ve been meaning to revamp the photography section of this site for a while now; this weekend, I finally found the time to do it. I registered a new domain, straylightphotography.com, and put together a portfolio consisting of my 20 favorite shots (<shamelessPlug>many of which are currently on display at Interzone through February 28th!</shamelessPlug>). I’m hoping to quickly expand the site with themed portfolios (portraits, urban decay, etc.), but… first things first.

Also, the new portfolio has been an excuse to play with CSS3 and jQuery 1.4.  Visitors using Firefox, Safari, Chrome, or Opera should see a site that behaves like it was created with Adobe Flash, but is fully accessible and doesn’t require the proprietary Flash plug-in.  Visitors using Internet Explorer… well… it at least degrades cleanly.  Mostly.

Mapping Caps Lock to Control without Admin Access

Somewhere along the line, I picked up the habit of mapping the otherwise utterly useless caps lock key to act as another control key.  If you’re an Emacs user, this is sort of critical to avoid the wrist strain of constant pinky-stretches to the lower-left corner of the keyboard.  Its become second nature now, so when I recently found myself working on a Windows-based lab computer where caps lock actually performed as-advertised, the result was a lot of code THAT lOOKED LIKE thIS.  Unpleasant, to be sure.

Linux and Mac OS X make remapping this key extremely easy.  System Preferences on the Mac and the GNOME keyboard control panel on Linux include a simple option to enable.  Tada!  No more wasted space west of ‘A’.  Windows, of course, is a different beast.

The good news: there’s a very simple registry hack to remap caps to control.  Seriously, it’s floating all over the internet.  Except, there’s a wrinkle–you need administrative access to edit the HKEY_LOCAL_MACHINE registry tree, which is what all of these hacks do.  For whatever reason, our school has decided computer science graduate students aren’t to be trusted with administrative access to their own computers [another rant for another time], so what’s a wrist-strained user to do?

Muck around in the Windows registry, of course!  It turned out to be pretty straight forward.  There’s a duplicate of the keyboard mapping registry key under HKEY_CURRENT_USER, which non-administrators can modify, and it appears to behave exactly like the key under HKEY_LOCAL_MACHINE.  So, for anyone in a similar position, here’s the registry key to modify:

HKEY_CURRENT_USER→Keyboard Layout→Scancode Map =
hex:00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00


You can download a registry update file here.  Save it to your computer, double-click it to update your registry, then reboot and enjoy your vastly-improved keyboard.

Automating Spellcheck (SpellCorrect?)

Let’s start this off by admitting a dark secret: my spelling is atrocious. As an example, I initially typed that sentence as, “Let’s start this off by admiting a dark secret: my spelling is attrocious.”  Built-in spell checking serves as a constant face-saver, but repeatedly finishing a sentence, switching from keyboard to mouse, right-clicking on the freshly-underlined words, and choosing what is nearly always the top choice from the built-in dictionary gets old.  The fact that the computer’s first suggestion is almost always exactly what I tried to type makes me wonder: why can’t the machine automatically correct misspellings?  Spell-checkers already rank the possible solutions, so it seems logical that if the delta of the ranking values between the top two choices is sufficiently large, it would be pretty safe to automatically make the replacement.  If the action was accompanied by some sort of animation or color change (like the highlighting Mac OS X’s Preview performs when searching text in PDF files), the user would be aware the change had been made and could quickly evaluate whether it was correct.  If it is, no need to switch over to the mouse and lose your train of thought; you can keep merrily typing away.  If the correction was wrong, the highlight should remain for a while so that the user can finish typing, then come back to fix any mistaken spelling corrections.

Combining this technique with a machine learning system to detect patterns in a particular user’s misspellings (including the actual word they wanted) you could quickly end up with a highly-accurate spellcorrecter tailored to the end user.  This brings the idea into my area of research, since the result would be a machine-learned program that could hold significant time-saving value to users.  I’ll have to take a closer look at this at some point soon.  In the meantime, I’m just frustrated that such a system doesn’t already exist.

Adding New Lines to Cells in Excel for the Mac

In case anyone else had as much trouble figuring this out as I did… if you want to break up a cell in the Mac edition of Microsoft Excel into multiple lines, you need to hold down the Option and Command keys while pressing Return.  This is a little different than the Windows edition of Excel, where you hold down Alt while pressing Return.  Anyway, it seems to work well, and now I can get nicely-formatted text into my Excel documents!

My High School Music Collection

Backstory: Today in the lab, I found myself listening to some of the old local Detroit bands in my music collection.   It got me feeling a bit nostalgic, especially when some tracks came on from an old friend’s punk band, the Bourgeois Filth.  Shortly before the band split, he’d given me a demo tape of some very rad, very different stuff the band was working on, but I must have lost it years ago… I can’t even remember the last time I had a cassette player, let alone anything to play in one.  I still have their sole CD release, but this afternoon I really wanted to listen through that old tape again.

So anyway, tonight I Googled around a bit.  The band’s old webpage is still up on AngelFire (Seriously?  I had no idea AngelFire was still around…), but hasn’t been updated since their reunion show 9 years ago.  Seems like they never got much attention outside of Detroit; I really can’t seem to find anything useful on the Internets about them.  What I did find, however, was an old-school German FTP listing of MP3 sites that probably went dark a decade ago.  Including, I think, my old dual Pentium Pro basement server.  Near the top of the list is an entry for ftp://216.25.7.132/, sharing albums from such fine musicians as Nine Inch Nails, Green Day, Orbital, and the Bourgeois Filth.  I’m reading through this thinking, “Wow, that’s exactly what I used to listen to…” when I notice one of the band names: Semblance of Self.  That was the name I released my own material under!  Seriously!  As much as I’d like to think that someone found those tunes cool enough to bother mirroring them on their own FTP server, I really can’t believe anyone did.  So… someone’s still linking to an FTP site I ran during the 90’s, and specifically mentions my old band name.  Bizarre!

Tragically, I still can’t seem to find anyone who had a copy of that Bourgeois Filth tape and bothered to encode it into MP3s 🙁

Update: Since a few of you have expressed interest, I’ve uploaded the original Bourgeois Filth album.  If anyone has MP3s of their last demo tape, I’d love to get a copy!

Another update (March 27, 2012): A digital copy of Bourgeois Filth’s last demo tape has surfaced at Michigan Graveyard!