cleaning the not so mighty mouse

November 9th, 2008

Every once in a while the scroll ball on my Mighty Mouse stops working.  According to google, this happens to approximately everyone who owns one.  Cleaning with a little bit of cotton and alcohol worked for a while, but recently I lost the ability to scroll down.  Doh.

After trying all the usual methods I found this wonderful description of flossing the scroll ball with tape.  Worked like a charm!

Swapping the Alt and Windows keys on a USB keyboard under Mac OS X

October 24th, 2008

I was making things too hard again.  The mac control panel lets you swap modifier keys on a per-keyboard basis.  That’s enough to solve the problem of the Apple and Option keys being backwards on a USB windows keyboard when used with a mac.  (I had given up on using the control panel stuff before because it can’t do arbitrary key remapping.)

OpenGL woes on a MacBook Pro running Vista

October 23rd, 2008

Let’s keep this short:  hooray for Mobility Modder!  It seems that Apple only distributes quite old ATI drivers with their Boot Camp updates, and this was crashing at least one OGL program I was developing.  Like most other notebook manufacturers, Apple also prohibits ATI from allowing their “reference drivers” (read: “most up-to-date/fast/stable drivers”) to be installed on Apple hardware.  That’s where mobility modder comes in, providing an app to modify the latest ATI driver distribution to run on most notebooks.

So my code is working again.. yay!  Now if only I could get back the 8 hours or so I spent debugging Apple’s driver update policies.

BTW, I wonder if this would also fix a crash I was having with FXComposer…

Boot Camp keyboard layout woes

October 16th, 2008

It’s only taken me 4 hours, but I’ve finally got my MacBook Pro’s japanese keyboard acting like a … japanese keyboard.  At some point in the recent past, Vista decided that the keyboard layout was really US, so colons, @ marks, and lots of other keys were mixed up.  I still have no idea what caused it, but this registry hack has restored order to the world, for now.  I want half my day back.

Installing Boot Camp 2.1 on Vista (BCUpdateVista32.exe)

September 17th, 2008

It took forever, but I’ve finally managed to do it.  The installer would start up saying “preparing to install” or the like, then disappear and nothing ever happened.  Finally a thread on macrumors tipped me off that it was a localization issue.  I have Japanese Vista Ultimate running with an english language pack.  Switching everything to Japanese and then rebooting solved the problem.  Note that Vista tells you to log off, but you actually need to reboot.  What is it with Windows and rebooting?!

it boggles the mind…

July 6th, 2008

I was reading the handy Apple OpenGL Programming Guide for Mac OS X when I found a joke right in the middle of the “Using Extensions to Optimize” section, of all places!

Note that OpenGL does not use DMA for a power-of-two texture target (GL_TEXTURE_2D). So, unlike the rectangular texture, the power-of-two texture will incur one additional copy and performance won’t be quite as fast. The performance typically isn’t an issue because games, which are the applications most likely to use power-of-two textures, load textures at the start of a game or level and don’t upload textures in real time as often as applications that use rectangular textures, which usually play video or display images.

What a bunch of pranksters!

Wait a sec, you guys are serious?!

If this were an episode of Star Trek, now would be a “set phasers to kill” moment.

incremental search for cocoa

June 24th, 2008

After downloading the plugin ages ago, I finally got around to installing the incremental search input manager which adds emacs-style incremental search to cocoa text widgets on OS X. I had problems getting it to work on leopard until I discovered some Leopard-specific issues with input managers. What I ended up doing was:

  1. build from source using XCode
  2. sudo cp -pR IncrementalSearchInputManager /Library/InputManagers
  3. sudo chmod -R go-w /Library/InputManagers
  4. sudo chown -R root:admin /Library/InputManagers
  5. sudo chmod a-x /Library/InputManagers/IncrementalSearchInputManager/IncrementalSearchInputManager.bundle/Contents/MacOS/IncrementalSearchInputManage

Of course while writing this post I discovered that there’s a universal binary available on the author’s site, so maybe I didn’t need to rebuild at all. In fact, I was trying to use a PPC binary on an intel machine the whole time, so maybe the instructions in the readme are, in fact, ok. The whole situation is confusing though, as the sourceforge wiki seems not to be updated and most of the pages linked to on the web are MIA.

Anyway, it can be done, and life is happy.

Update: or maybe not.  I can’t get it to work in Mail.app or Xcode.  Doh.

building an fltk app on Mac OS X

May 21st, 2008

This is how I set up a FLTK project under XCode 3.0, which is current as of this writing. I assume that fltk is installed under /usr/local; if not then modify appropriately. This will produce an OS X application, meaning something you can double-click in Finder to run. Note that the link line below forces the project to be statically linked against the fltk libraries, instead of a dynamic link. The reason I do it this way instead of dragging the libraries into the project is because that part of XCode is horribly broken — a library reference in the GUI translates to the gcc command line option ‘-llibname‘ which will search for the library and prefer dynamic libraries.

Note also that the following settings will produce an app built with the default system SDK, so on Leopard it will build against 10.5 and not work on Tiger systems. To build a universal binary you need to make sure fltk was built against 10.4u and set the Base SDK Path appropriately.

  1. create a c++ command line tool project
  2. delete the command line program target
  3. add a new target of type Carbon C++ Application
  4. under the target “Build” preferences (command-i):
    • add the following to Other Linker Flags:
      -framework CoreServices -framework ApplicationServices -framework IOKit -framework AGL -framework OpenGL /usr/local/lib/libz.a /usr/local/lib/libfltk.a /usr/local/lib/libfltk_images.a /usr/local/lib/libfltk_jpeg.a /usr/local/lib/libfltk_gl.a /usr/local/lib/libfltk_png.a
    • add /usr/local/include to Header Search Paths
    • optionally add a precompiled header to be included everywhere (search for prefix)

  5. drag sources into the Source folder (or something else you create). be careful with the copy files into group option, it’s enabled by default.
  6. delete the automatically generated main.cpp
  7. Build and you’re done!

libdc1394 on OS X Leopard

May 11th, 2008

After upgrading to Leopard I started getting the error message “Could not create LocalIsochPortInterface”. Eventually I found that building libdc1394 against the universal SDK did the trick, like this:

./configure CFLAGS=-isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -arch i386

Clearly something has changed in 10.5.

encryption and backup

April 26th, 2008

I have a laptop. I use it for pretty much everything. A couple weeks ago during cherry blossom season, it was my job to stake a claim on some prime blossom territory with a big, blue tarp and then.. hold it. So I hauled my laptop along and got some work done while waiting for the party to start. After the battery died, I got up to take some pictures. With my face pressed to the viewfinder I sensed someone behind me, near my tarp. It was an old guy on a bike pointing at my laptop sitting alone on the ground. I gather he didn’t think that was the best place for a laptop, alone on the ground.

After he left it took me about two seconds of thought to figure out he was right. It also didn’t take me long to realize that, being a laptop, my macbook pro is all too vulnerable to pretty much every form of data loss imaginable, including theft, lost luggage, me being scatterbrained, crushed in a crowded train, …. scary stuff.

That’s it. It needs to be backed up.

Since it’s a Mac, and since I just upgraded to 10.5, my first thought was “Time Machine!” And shortly thereafter I had a new Time Capsule on my shelf backing up the machine. Nice.

But in my googling, I realized that encryption would be a good idea to. Having once been a victim of identity theft, I’m really not eager to repeat the experience. I suspect that my corporate clients would be none-too-happy to hear that details of their new products/research were about to be on bittorrent, either.

But no problem, this is Leopard! We’ve got FileVault, right?

Kinda.

Encryption and backups are really a necessity for laptops, when you think about it as I reluctantly did. Unfortunately FileVault and Time Machine don’t quite have that synergy thing going. FileVault will encrypt your home directory, and TM will back it up, but only after you’ve logged out. Er, I mean while you’re in the process of logging out. Which for me is like, never.

Some googling and some experience have brought to light that:

- TM is not all that stable. It’s crashed on me once already, probably because I closed the lid while it was working. That isn’t hard to do, btw, since it’s almost always working.

- when using FV, you can no longer use TM’s GUI to restore files. Oops.

- with FV, your home directory backups become way less efficient with disk space, and they weren’t very efficient to begin with.

So now I’m looking for a replacement. There are lots of programs out there, but most of them are of the mirror/duplication variety. Yes, it’s nice to have a bootable external drive as a backup, but it won’t do you much good if a big chunk of the filesystem gets corrupted and then duplicated before you notice. So SuperDuper! and its ilk are kinda out for me.

To make a long post short, I think I’ll go with CrashPlan. It’s pretty flexible, very professionally done (and I wouldn’t say that of many programs), and works on OS X, windows, and even linux. Its reason for living is to do off-site backups, and it can be coerced into doing local backups if you have more than one pc. It will also backup a FileVaulted home directory while mounted (with the backup encrypted, of course). It does versioning, and it even does it the smart way: by saving only the parts of the file that have changed.