Schadenmonday

So much for Apple Bug Friday (and the related Schadenfriday). No sooner did I finish writing up yesterday’s Fun Apple Bug of the Week post than I noticed a similar bug in Camino. The Camino bug is less of a pain, however, because

a) most people who hide the search field probably don’t use it often, if at all; and
b) it doesn’t create a situation where the app is basically unusable (you could still get the search field in a sheet with Command-Option-F, for instance).

Now if only I could figure out the circumstances that cause ExtendedSplitView to save a width property in the plist in the first place, I could figure out how this is happening and put a stop to it.

posted on 23 February 2009 at 1733computing0 commentstrackback

Fun Apple Bug of the Week

Just filed this as rdar://6612125 . Back up your Stickies database (in ~/Library/) and com.apple.Stickies.plist (in ~/Library/Preferences/) before attempting to reproduce this fun one.

1) Launch Stickies.app.
2) Close all open notes. (If you start with no StickiesDatabase file, there will be two by default.) When prompted to save, don’t.
3) Choose “Use as Default” from the Note menu.
4) Try to create a new sticky note.

To fix the damage you just did, quit Stickies and throw out the new com.apple.Stickies.plist file as well as the new StickiesDatabase file. Restore your old files (I told you to make a backup!) and you’re back in business.

This is a great example of two key mistakes often made by developers: failure to validate UI items (enabling/disabling them as appropriate), and failure to validate input.

The “Use as Default” menu item should never have been enabled in the first place if there wasn’t anything to use as a template. It’s very easy to enable or disable a menu item programmatically, so there’s not really a good excuse for failing to do so. Well-behaved Mac OS X applications — at least, those written by developers who sweat the details — almost always do a very good job of this, and it’s probably a simple oversight on Apple’s part (and maybe Jens Alfke’s, though I don’t have a Classic Mac OS version of Stickies around to test).

Even assuming there was a good reason to have “Use as Default” enabled with no notes open, there’s no excuse for allowing dimensions of a window to be set to zero or negative values. A window is an on-screen analog of a physical object and, like its physical counterpart, cannot have zero or negative dimensions. On-screen objects are defined in pixels, and a pixel is the smallest entity that can be displayed on a screen. Fractions of a pixel, for these purposes, have no meaning. The application should check that the dimensions in the property list are integers greater than zero and, if they aren’t, should replace the obviously bad data. The most logical thing to do is probably to replace zero and negative values with the app defaults (in this case, 200 by 300 pixels), and to replace non-integer values with an integer, as would be achieved by the use of a floor() function or by casting the float (or other non-integer numeric data type) to an int.

Here endeth the week’s lesson.

posted on 23 February 2009 at 0244computing0 commentstrackback

You’re Doing It Wrong

In an entry about a bicycle headlight (a $500 bicycle headlight, I should note) on the excellent Cool Tools site:

In the winter I mountain bike one to two nights a week after dark on fast technical single track trails.

OK, where do I start? Ah yes: “In the winter I mountain bike”.

I can only assume the person writing this does not live anywhere north of, say, the Mason-DIxon line, because anyone living in the Midwest or Rockies or Northeast knows damned well that riding a bike in two feet of snow is not only impossible but suicidal if you go anywhere near cars.

Continuing on with “one to two nights a week after dark”: I understand work schedules are work schedules and it gets dark at four in the afternoon in December, but c’mon, man.

Then we come to “on fast technical single track trails”. Yeah, you should probably have your head examined. If God wanted you to ride bikes on terrain like that at night in the winter, He would have given you better eyes.

I love biking and getting outdoors, but I’m not anywhere near crazy enough to spend $500 on a headlight just so I can go bombing around difficult, rocky trails in the middle of the night. You better make sure you have the local ambulance service on speed-dial, because the Magic Eight-Ball sees a trip to the ER in your near future.

I’d be more than happy to spend $500 on a light if it kept all the crazies in cars from running over me, though.

posted on 07 February 2009 at 2146two-wheeling0 commentstrackback