rentzsch.com: tales from the red shed
Programming Special Interest Group PSIG 117 in August
in Programming Special Interest Group
Wednesday, July 02, 2008
04:56 PM

Hey all, the next PSIG would occur on July 3rd. That’s uncomfortably close to Indie Day (the Independent Mac Developer’s national holiday), so the next PSIG will be in August. We’ll talk about WWDC and what, if anything, dropped on our laps July 11th.

 
C4 C4[2]: Sep 5-7 2008
in C4
and C4
Saturday, June 07, 2008
12:00 AM

More and more folks are poking me, asking if and when there will be a C4[2]. I’m happy to report I’ve decided to go for another round, and C4[2] is scheduled for September 5th through 7th.

Same physical venue as last year, except was the “Chicago City Centre” has been totally renovated and is now “Doubletree Magnificent Mile”.

I’m going to use WWDC 2008 to firm up speakers, so no announcements until after the big show. Just be sure to leave a hole in your schedule for the first weekend in September. It’s going to be a blast.

 
Programming Special Interest Group PSIG 116: Thu Jun 5 2008
in Programming Special Interest Group
Tuesday, June 03, 2008
12:42 PM
When:
Thursday, June 5th, 2008 @ 7pm
Where:
Hotel Indigo (pic, directions from the Arlington Park Metra station).
Schedule:
Show & Tell
We'll start out the meeting by going around the table and talking about what we're currently working on or learning about. Handouts are welcome, or bring along your Mac and we'll hook it up to the projector.

Book Reports
Bring along the book you're currently reading, or one of your old favorites. Hopefully the book would have some relevance to programming, but we're fairly open-minded. Just give us an overview the book's topic, and what you liked (or disliked) about it.

Topics
Bring your WWDC08 predictions — we’ll be following tradition and offering our best guesses along with our updates+book reports. For the main presentation, Jonathan ‘Wolf’ Rentzsch will discuss how to add AppleScript support to your Cocoa applications.

Dinner
If you want pizza, bring along three dollars and we'll all chip in.

Looking for Presenters:
I'm always on the look-out for folks to want to give a talk for a meeting. The talk doesn't need to be long (10 minutes is fine if your topic is small or you just want to tease the group) and you don't need to be an expert (just tell us why you think your topic is cool or your experiences). Toss me an email and I'll assign you a chunk of time.
 
Code mogenerator v1.10
in Code
Tuesday, May 20, 2008
02:17 PM

mogenerator is my little command-line tool that reads in .xcdatamodel Core Data model files and spits out Objective C code following the Generation Gap codegen pattern.

Version 1.10 (download, source) is out — here’s what’s changed since the last time I wrote about it:

  • Corrected generated code that got snagged on the messaging-nil-with-method-returning-float gotcha (thanks to Ruotger Skupin).

  • Adds +[newInManagedObjectContext:] method to machine files. I can’t live without this method and it’s pretty much swiped from CoreData+JRExtensions so I don’t have to include those extensions for every Core Data project.

  • Now supports ObjC2 property syntax (but retains 10.4 compatibility thanks to preprocessor magic).

  • mogenerator now support 10.5 Core Data transformable attributes (thanks again Ruotger Skupin). It uses NSObject generically, but you can specify a different class name in the attributes user info under a attributeValueClassName key.

  • Plays a better game of hide-and-seek with Xcode’s installer and where it’s decided to locate momc this week. Handles Xcode 2.4, 3.0 and 3.1. Sadly, mogenerator still assumes /Developer — perhaps one day the installer will be enhanced to ask you which Xcode base to use. Patches welcome.

  • For those of you using Core Data in a multithreaded environment, 1.10 now generates a per-entity subclass of NSManagedObjectID. For example, if you had an entity named Person, its class name will be PersonMO and its managed object ID class name will be PersonMOID. Previously, you had to pass around type-less NSManagedObjectID when you wanted to handoff a managed object reference from one thread to another. Now you can pass a reference whose type will give you a clue as to what’s going on.

 
Programming Special Interest Group PSIG 115: Thu May 1 2008
in Programming Special Interest Group
Wednesday, April 30, 2008
12:00 AM
When:
Thursday, May 1st, 2008 @ 7pm
Where:
Hotel Indigo (pic, directions from the Arlington Park Metra station).
Schedule:
Show & Tell
We'll start out the meeting by going around the table and talking about what we're currently working on or learning about. Handouts are welcome, or bring along your Mac and we'll hook it up to the projector.

Book Reports
Bring along the book you're currently reading, or one of your old favorites. Hopefully the book would have some relevance to programming, but we're fairly open-minded. Just give us an overview the book's topic, and what you liked (or disliked) about it.

Topics
Jonathan ‘Wolf’ Rentzsch will cover Cocoa, HTTP and You. More than ever, Cocoa applications need to communicate via HTTP (thank you Mr. iPhone), so Wolf will cover your current options and surprising pitfalls. Includes a tour of the open source landscape for HTTP libraries, for both vending and consuming HTTP.

Dinner
If you want pizza, bring along three dollars and we'll all chip in.

Looking for Presenters:
I'm always on the look-out for folks to want to give a talk for a meeting. The talk doesn't need to be long (10 minutes is fine if your topic is small or you just want to tease the group) and you don't need to be an expert (just tell us why you think your topic is cool or your experiences). Toss me an email and I'll assign you a chunk of time.
 
Programming Special Interest Group PSIG 114: Thu Apr 3 2008
in Programming Special Interest Group
Tuesday, April 01, 2008
11:06 PM
When:
Thursday, April 3rd, 2008 @ 7pm
Where:
Hotel Indigo (pic, directions from the Arlington Park Metra station).
Schedule:
Show & Tell
We'll start out the meeting by going around the table and talking about what we're currently working on or learning about. Handouts are welcome, or bring along your Mac and we'll hook it up to the projector.

Book Reports
Bring along the book you're currently reading, or one of your old favorites. Hopefully the book would have some relevance to programming, but we're fairly open-minded. Just give us an overview the book's topic, and what you liked (or disliked) about it.

Topics
While embedded iPhone development is the current hotness, there exists an even deeper embedded environment available for Mac programmers: microcontrollers. Microcontrollers have clock speeds on the order of megahertz and memory on the order of kilobytes, but can still be used for all sorts of fun projects. Dave Dribin will talk about setting up a development environment for the popular Atmel AVR series of microcontrollers on your Mac. We’ll go over some basic C code to light up LEDs, including how to dim them with pulse width modulation (PWM) and how to download the program to a real device (no certificate needed!). We’ll also cover how to do some simple debugging with an oscilloscope.

Dinner
If you want pizza, bring along three dollars and we'll all chip in.

Looking for Presenters:
I'm always on the look-out for folks to want to give a talk for a meeting. The talk doesn't need to be long (10 minutes is fine if your topic is small or you just want to tease the group) and you don't need to be an expert (just tell us why you think your topic is cool or your experiences). Toss me an email and I'll assign you a chunk of time.
 
Programming Special Interest Group PSIG 113: Thu Mar 6 2008
in Programming Special Interest Group
Wednesday, March 05, 2008
12:00 AM
When:
Thursday, March 6th, 2008 @ 7pm
Where:
New Meeting Location: Hotel Indigo (pic, directions from the Arlington Park Metra station).
Schedule:
Show & Tell
We'll start out the meeting by going around the table and talking about what we're currently working on or learning about. Handouts are welcome, or bring along your Mac and we'll hook it up to the projector.

Book Reports
Bring along the book you're currently reading, or one of your old favorites. Hopefully the book would have some relevance to programming, but we're fairly open-minded. Just give us an overview the book's topic, and what you liked (or disliked) about it.

Topics
Core Data makes it easy to persist your data to disk, but what happens when your data format changes? This used to entail lots of pain, but 10.5 has a bunch of tricks up its anthropomorphized sleeve to make upgrading your data model much easier. Jonathan ‘Wolf’ Rentzsch will walk through Core Data’s migration facilities.

Hey this iPhone SDK is a big deal, so we'll be going through it instead of the above topic tonight.

Dinner
If you want pizza, bring along three dollars and we'll all chip in.

Looking for Presenters:
I'm always on the look-out for folks to want to give a talk for a meeting. The talk doesn't need to be long (10 minutes is fine if your topic is small or you just want to tease the group) and you don't need to be an expert (just tell us why you think your topic is cool or your experiences). Toss me an email and I'll assign you a chunk of time.
 
Programming Special Interest Group PSIG 112: Thu Feb 7 2008
in Programming Special Interest Group
Tuesday, February 05, 2008
01:09 AM
When:
Thursday, February 7th, 2008 @ 7pm
Where:
New Meeting Location: Hotel Indigo (pic, directions from the Arlington Park Metra station).
Schedule:
Show & Tell
We'll start out the meeting by going around the table and talking about what we're currently working on or learning about. Handouts are welcome, or bring along your PowerBook and we'll hook it up to the projector.

Book Reports
Bring along the book you're currently reading, or one of your old favorites. Hopefully the book would have some relevance to programming, but we're fairly open-minded. Just give us an overview the book's topic, and what you liked (or disliked) about it.

Topics
Ever wanted to write your own feed reader? PubSub is shorthand for Apple’s new “Publication Subscription” framework, included with Mac OS X Leopard 10.5. It consumes RSS 0.9, 1.0, 2.0 and Atom feeds and makes them available to your Cocoa application. Dave Dribin has been tinkering with PubSub and will walk us through how it works and some of its cooler features.

Dinner
If you want pizza, bring along three dollars and we'll all chip in.

Looking for Presenters:
I'm always on the look-out for folks to want to give a talk for a meeting. The talk doesn't need to be long (10 minutes is fine if your topic is small or you just want to tease the group) and you don't need to be an expert (just tell us why you think your topic is cool or your experiences). Toss me an email and I'll assign you a chunk of time.
 
C4 C4[1] Videos Available
in C4
Saturday, February 02, 2008
12:00 AM

Thanks to the volunteer work of Pat Hughes, Bob Frank, Mike Miley, Chuck Remes, Dave Dribin and Victoria Wang, I’m pleased to finally offer videos of C4[1]’s presentations.

I’ll upload one video per week, updating this entry as I encode+upload the videos:

You can peek at the schedule if you want the detailed presentation descriptions.

(Video geek tidbit: it takes my MacBook Pro six to seven hours to encode an hour of video. It then takes Viddler another hour or so to transcode it to Flash video. Many CPU cycles died to spare your precious bandwidth.)

Way back when I considered turning these videos in DVDs that I could sell to increase C4’s budget. However online videos like TED and Google Tech Talks have really driven home how great frictionless sharing of high-quality presentations can be. So spread these videos far and wide, all these are great speakers talking about subjects dear to their heart.

Update: Some folks have indicated they want to download the videos for sending to their Apple TVs or disconnected watching (say on a plane ride). That’s easy: sign up for Viddler account and then load the video’s Viddler page again. Now you’ll have a “Download” tab on the right side of the page that will allow you to download the original .mov file I uploaded.

Mucho thanks to Viddler for the rockin’ site and the tons of bandwidth. I priced out the costs of vending these videos on Amazon’s S3 — renowned for its low prices — and came up with a $12,000 bandwidth bill. Yeowch.

Update Feb 8: Shipley’s live. Guess that means I win the twitter fight.

Update Feb 15: Posted Daniel Jalkut’s talk.

Update Feb 22: Posted Shawn Morel’s talk. Also added Allan Odgaard to the video list, somehow I accidently left him off. He’s up next.

Update Feb 29: Posted Allan Odgaard’s talk.

Update Mar 7: Posted Bob Ippolito’s talk along with a surprise bonus of Bobby Andersen’s impromptu icon talk.

Update Mar 14: Posted Adam Engst’s talk. Sorry I’m late, had too much fun during Pi Day.

Update Mar 21: Posted Tim Burks’ talk on RubyCocoa and Nu.

Update Mar 28: Posted Cabel Sasser’s talk. That’s all she wrote, folks. Phew.

 
Programming Special Interest Group PSIG 111: Thu Jan 3 2008
in Programming Special Interest Group
Wednesday, January 02, 2008
12:00 AM
When:
Thursday, January 3rd, 2008 @ 7pm
Where:
New Meeting Location: Hotel Indigo (pic, directions from the Arlington Park Metra station).
Schedule:
Show & Tell
We'll start out the meeting by going around the table and talking about what we're currently working on or learning about. Handouts are welcome, or bring along your PowerBook and we'll hook it up to the projector.

Book Reports
Bring along the book you're currently reading, or one of your old favorites. Hopefully the book would have some relevance to programming, but we're fairly open-minded. Just give us an overview the book's topic, and what you liked (or disliked) about it.

Topics
New in Mac OS X 10.5, Scripting Bridge makes it easier for your Cocoa application to control and interoperate with other applications. Instead of embedding+executing AppleScripts, Scripting Bridge allows you to control scriptable applications with right in your Objective-C code. Jonathan ‘Wolf’ Rentzsch will walk through how the technology works and provide a demo of it in action.

Dinner
If you want pizza, bring along three dollars and we'll all chip in.

Looking for Presenters:
I'm always on the look-out for folks to want to give a talk for a meeting. The talk doesn't need to be long (10 minutes is fine if your topic is small or you just want to tease the group) and you don't need to be an expert (just tell us why you think your topic is cool or your experiences). Toss me an email and I'll assign you a chunk of time.
 
Programming Special Interest Group PSIG 110: Thu Dec 6 2007
in Programming Special Interest Group
Wednesday, December 05, 2007
01:17 AM
When:
Thursday, December 6th, 2007 @ 7pm
Where:
Inverness Room (downstairs rear) of the Holiday Inn Rolling Meadows

Notice: this will be the last meeting at the Holiday Inn. Starting January 2008 we'll be meeting at Hotel Indigo, which is within walking distance from the Arlington Park train station.

Schedule:
Show & Tell
We'll start out the meeting by going around the table and talking about what we're currently working on or learning about. Handouts are welcome, or bring along your PowerBook and we'll hook it up to the projector.

Book Reports
Bring along the book you're currently reading, or one of your old favorites. Hopefully the book would have some relevance to programming, but we're fairly open-minded. Just give us an overview the book's topic, and what you liked (or disliked) about it.

Topics
Mac OS X 10.5 introduces a new high-level framework for iCal data creation+mutation: CalendarStore. Before CalendarStore, your only options for interoperating with the system’s calendar were to use the potent-but-complex SyncServices or (shudder) grovel iCal files yourself. Now it’s easy to add calendar support to your Cocoa application. Victoria Wang will demonstrate how she integrated iCal support into her application.

Dinner
If you want pizza, bring along three dollars and we'll all chip in.

Looking for Presenters:
I'm always on the look-out for folks to want to give a talk for a meeting. The talk doesn't need to be long (10 minutes is fine if your topic is small or you just want to tease the group) and you don't need to be an expert (just tell us why you think your topic is cool or your experiences). Toss me an email and I'll assign you a chunk of time.
 
Bugs Curing MacBook Pro 17" Insomnia
in Bugs
and Suck
Friday, November 02, 2007
09:44 PM

Ever since I bought my MacBook Pro 17", its had issues with unexpectedly waking from sleep. It’s literally uncool when you pull your MBP out of your bag, and its entire case is hot to touch, fans blowing full speed, battery drained from its futile attempt to cool itself inside what amounts to a blanket.

My initial theory was that its sudden motion sensor was firing, and a bug in Mac OS X woke the machine when it shouldn’t. The problem with this theory is my previous MacBook Pro 15" (Core Duo) never exhibited this problem.

I tried a number of techniques to cope, finally alternating between two undesirable choices: simply shutting down the entire machine when toting it around or attempting to time bag insertion with Safe Sleep’s sizable delay when it is dumping RAM to disk (understandably, the machine is largely catatonic during this operation, and I discovered during those magic ~10 seconds the machine was impervious to being accidently re-awoken).

The latter technique was more desirable from a state-retention stand point, but still I would find my machine overheating in my bag. Worse, it’s somewhat dangerous. That ~10 second delay is the result of a ~3GB write to the drive, so by stashing the machine into my bag during that temporal window, I’m jostling the drive right when it’s busiest. That’s bad hardware karma.

Finally I just accepted the flaw and when I knew the machine would be in my bag for more than five minutes, I’d just always completely shut down. Suck.

Quite by accident I stumbled upon Glenn Fleishman’s TidBITS posting. I’m not sure how I missed it in the first place — I subscribe to their feed. Anyway, Glenn mentioned a power management setting I had previously overlooked: lidwake. The man page for pmset says this:

lidwake - wake the machine when the laptop lid (or clamshell) is opened (value = 0/1)

I immediately gave it a shot and issued this command:

sudo pmset lidwake 0

I’m happy to report my MacBook Pro 17" now sleeps peacefully in my bag, even being after inserted + jostled + removed. Apparently the Sudden Motion Sensor was innocent after all, the genuine source of my insomniac angst being an oversensitive lid sensor.

My current theory is the 17"’s sheer girth slightly bends its frame, tripping the lid sensor. A friend is sending his 17" in for service hoping to physically resolve the same issue on his machine. I’ll update this entry, reporting back if he gets any satisfaction, but for me this simple lidwake software work-around solves my issue.

 
Programming Special Interest Group PSIG 109: Thu Nov 1 2007
in Programming Special Interest Group
Tuesday, October 30, 2007
12:00 AM
When:
Thursday, November 1st, 2007 @ 7pm
Where:
Inverness Room (downstairs rear) of the Holiday Inn Rolling Meadows
Schedule:
Show & Tell
We'll start out the meeting by going around the table and talking about what we're currently working on or learning about. Handouts are welcome, or bring along your PowerBook and we'll hook it up to the projector.

Book Reports
Bring along the book you're currently reading, or one of your old favorites. Hopefully the book would have some relevance to programming, but we're fairly open-minded. Just give us an overview the book's topic, and what you liked (or disliked) about it.

Topics
Mac OS X 10.5 “Leopold” is finally shipping and it’s a smorgasbord of developer delights. Dave Dribin will provide and overview of what’s new and what’s better in the latest release of Mac OS X.

Dinner
If you want pizza, bring along three dollars and we'll all chip in.

Looking for Presenters:
I'm always on the look-out for folks to want to give a talk for a meeting. The talk doesn't need to be long (10 minutes is fine if your topic is small or you just want to tease the group) and you don't need to be an expert (just tell us why you think your topic is cool or your experiences). Toss me an email and I'll assign you a chunk of time.
 
Notes Block-level Parallels-Fusion Migration
in Notes
Saturday, October 06, 2007
12:00 AM

I currently run my mail server under Debian running on Parallels Desktop 2. Unfortunately Parallels Desktop 2 is end-of-lifed and has USB issues with Mac OS X 10.4.10 and later. Sadness: I upgraded to Parallels Desktop 3 and found it incredibly unstable. What to do?

Fortunately VMware’s Fusion has shipped and it seems even snappier than Parallels 2 and completely stable. But how to migrate my mail server VM from Parallels to Fusion?

Unfortunately there’s no official migration path if the guest OS isn’t Windows. I really didn’t want to spend the time building up a brand-new Debian mail server with its the associated configuration headaches, so I decided to dig a little and see if I could migrate the disk image itself. Sure enough, you can. Here’s how you do it:

  1. Let’s call the original Parallels virtual machine “MyVM”. First thing, open ~/Library/Parallels/MyVM/MyVM.pvs in a text editor and take note of the cylinders+heads+sectors settings for your disk image. Mine looked like this:

    Disk 0:0 cylinders = 16254
    Disk 0:0 heads = 16
    Disk 0:0 sectors = 63

    We’re going to multiply all the numbers together to get a total sector count: 16384032 (16254 * 16 * 63). We’ll need this number a little later on.

  2. Both Parallels and Fusion utilize sparse disk images by default, but I highly doubt their implementations are on-disk compatible. So convert the sparse image into a plain image using Parallels Image Tool. Your input file will be something like MyVM.hdd, while your output file will be MyVM-plain.hdd. Note: this step will temporarily burn disk space.

  3. We’re done on the Parallels side — we now have an unadorned file that’s a block-for-block realization of the virtual machine’s hard drive. Our next trick is to convince Fusion to play with this image file. I found a neat command-line tool stashed in Fusion’s app package: VMware Fusion.app/Contents/MacOS/diskCreate. We’ll use it to create a new nonsparse blank image like so:

    diskCreate -t monoFlat -s 16384032 MyVM-plain.vmdk
    

    Except substitute 16384032 with the total sector count you calculated from step 1. Note: again, this step will temporarily burn disk space.

    This command yields two files in your working directory: a small textual MyVM-plain.vmdk and a large MyVM-plain-flat.vmdk. The big file is also an unadorned nonsparse disk image: the same format as our converted Parallels image. Now we just need to switcheroo the new empty file with the previously converted image:

    rm MyVM-plain-flat.vmdk
    mv /path/to/MyVM-plain.hdd MyVM-plain-flat.vmdk

  4. At this point, Fusion is ready to play with your Parallels image. Just create a new VM and “use existing disk image” and point it at MyVM-plain.vmdk.

    One drawback is that the disk image is no longer sparse and thus wastes lots of disk space. I like to archive off my entire mail server image and a sparse image is the difference between ~600MB and ~8GB. Fortunately it’s easy to convert the image back to a sparse image that works with Fusion. Again we’ll use diskCreate:

    diskCreate -C /path/to/MyVM-plain.vmdk MyVM.vmdk
    

    The -C option clones from an existing disk image, and diskCreate by defaults creates a sparse image that houses both the image metadata and image itself in a single file. Once the tool completes, you can create a new Fusion VM and point at MyVM.vmdk.

This technique isn’t limited to just Debian or other Linuxes — this should also work (or not) with any guest operating system that works with both Parallels and Fusion and should be lossless. I do recommend you uninstall Parallels guest tools from your guest OS before attempting the transition to Fusion. Once you’re up and running on Fusion, you can install VMware’s guest integration tools.

 
Notes apple's antiCAPSLOCK
in Notes
Thursday, October 04, 2007
12:00 AM

About a month ago I picked up a new Apple keyboard. That’s the new thin model, the wired variant.

I’m rather pleased with it: like all keyboards, the previous model had a propensity of collecting debris+cruft. Unlike most other keyboards, the previous model showcased your cruft collection via its transparent sides. These things are hard to clean, so I hoped upgrading to the new thin model would keep my desk looking clean+swanky. So far so good.

But I did notice something odd. I rarely use the Caps Lock key, but often accidently bang it, missing the left Shift key. I would feel the mistake while typing, but then I’d look down and see Caps Lock hadn’t been engaged after all. Oh, I must have just imagined my mis-strike.

Over the next few weeks, this kept happening to the point where I started questioning reality. I was positive I hit it. This required scientifical investigation.

I’ve discovered something shocking. An anti-Caps Lock conspiracy silently bubbling up from the darkest trenches inside Apple:

Apple’s Caps Lock key has undocumented anti-jab protection.

Unique among the rest of the keys, Caps Lock doesn’t activate immediately upon strike. There’s a very small time window — perhaps a quarter of a second — where if you release the key inside the window, the keystroke is ignored.

But that’s only part of the conspiracy. The Caps Lock key isn’t just universally slow to react. If Caps Lock was already engaged, the keystroke is registered immediately, even before the upstroke.

So Apple’s modern keyboards have a bias against activating Caps Lock at all, and another bias to turn it off as soon as possible. That fits in perfectly with how I (mis)use Caps Lock, but I can’t help thinking it’s ALSO a subtle nudge to those to abuse Caps Lock to TONE IT DOWN A LITTLE.

Here’s a crappy video I shot with my Treo showing off the Caps Lock delay. I quickly, firmly strike the Caps Lock key head-on three times in a row without activating it. Then I strike it three times somewhat more slowly and it Works As Expected. Finally, I show even a viper-quick stab will register if the Caps Lock is engaged.

Update Oct 7: This turned out to be a popular entry. Three follow-ups:

  • Wireless variant too: I’m getting conflicting reports, but the majority say the wireless version of the keyboard has the same behavior. I’m inclined to think that’s the case, and the folks with the wireless versions that aren’t witnessing the behavior don’t drink nearly as much coffee as I do.

  • Control key remapping: A goodly number of you wrote in to say you remap Caps Lock to be an extra Control key (using the “Keyboard & Mouse” System Preferences pane, illustrated towards the end of Ars Technica’s coverage).

    The main question was: does this activation delay still take place if you remap the key? Unfortunately, yes — the activation delay occurs in the keyboard itself, before the operating system even sees the key-down. So if you’re an emacs fiend, you may want a different keyboard altogether. If this antiCAPSLOCK trend ends up extending to Apple’s notebooks in the future, well then it may suck to be you.

  • Eject key delay: I also received a number of email pointing out the Eject key also has a time-delay, so Caps Locks isn’t “unique among the rest of the keys”.

    Yes and no.

    Yes: at the user level, Caps Lock and Eject work similarly, with the Eject key having a longer activation delay.

    No: Caps Lock is unique among the keys, because its activation delay takes place in the keyboard itself. The Eject key’s activation delay was a feature added to Mac OS X 10.4.9. Using Dave Dribin’s excellent HIDBrowser (part of DDHidLib), I verified the key-down is sent immediately (even on Apple’s newest keyboards).

    So the Eject key activation delay is optional and can be disabled in software, but I don’t know of a way to do the same with the Caps Lock key. In fact it may be impossible to disable this “feature” short of hardware hacking.

 
Cocoa -[NSWindow frame] lies
in Cocoa
and Bugs
Wednesday, October 03, 2007
02:41 PM

You’d think Cocoa would get right something basic like “what’s the position of this window on the screen?” You’d be mistaken.

-[NSWindow frame] is supposed to return the window’s frame. And it mostly does. Unless you’re dragging a window around, and then it just returns the window’s saved-off drag starting frame, not its actual current frame. Until you stop moving the mouse. Then it’s swell and reports reality again.

Uck.

I wrote a category for NSWindow called -liveFrame. It wraps a Carbon API that reports the window’s current rectangle, like, all! the! time! Those Carbon APIs are so boring.

Here’s the compiled demo app if you want to bask in -frame’s duplicity for yourself. Drag the window around and watch -frame’s numbers not update until you stop moving the mouse. Then revel in -liveFrame’s consistent output sincerity.

 
Programming Special Interest Group PSIG 108: Thurs, October 4th, 2007
in Programming Special Interest Group
Tuesday, October 02, 2007
02:31 PM
When:
Thursday, October 4th, 2007 @ 7pm
Where:
Inverness Room (downstairs rear) of the Holiday Inn Rolling Meadows
Schedule:
Show & Tell
We'll start out the meeting by going around the table and talking about what we're currently working on or learning about. Handouts are welcome, or bring along your PowerBook and we'll hook it up to the projector.

Book Reports
Bring along the book you're currently reading, or one of your old favorites. Hopefully the book would have some relevance to programming, but we're fairly open-minded. Just give us an overview the book's topic, and what you liked (or disliked) about it.

Topics

Shh, don’t tell anyone, but I’m more excited by Tim Burks’ Nu programming language than I am about Mac OS X 10.5. I’m hoping it becomes an S-expression gateway drug for legions of Cocoa coders.

Nu is a Lisp-like scripting language for Objective-C + Cocoa. It’s written in Objective-C with the intent of deep interaction with Objective-C. I’ll cover the basics of Nu, the provided tools+libraries and its awesome philosophy.

Dinner
If you want pizza, bring along three dollars and we'll all chip in.

Looking for Presenters:
I'm always on the look-out for folks to want to give a talk for a meeting. The talk doesn't need to be long (10 minutes is fine if your topic is small or you just want to tease the group) and you don't need to be an expert (just tell us why you think your topic is cool or your experiences). Toss me an email and I'll assign you a chunk of time.
 
Bugs Awesome GCC Literal Suffix Bug
in Bugs
Tuesday, September 11, 2007
03:48 AM

The setup:

$ cat bug.c
#include <stdio.h>

static float f(float x) {
  printf("f() called\n");
  return x + 1;
}

int main (int argc, const char *argv[]) {
#if TYPO
  float y = f(42f);
#else
  float y = f(42.f);
#endif
  printf("y: %f\n", y);
  return 0;
}

Let’s build+run it normally:

$ gcc -o bug bug.c && ./bug
f() called
y: 43.000000

OK, let’s insert the typo:

$ gcc -DTYPO=1 -o bug bug.c && ./bug
bug.c:10:14: error: invalid suffix "f" on integer constant

OK, still in the land of the sane. Now let’s add a couple of flags Xcode 2.4 normally adds for a Debug target, -arch and -fasm-blocks:

$ gcc -arch i386 -fasm-blocks -DTYPO=1 -o bug bug.c && ./bug
y: -1.999849

Lovely bug, isn’t it? When targeting Intel and CodeWarrior-style assembly blocks are enabled, 42f is no longer recognized as a syntax error.

It gets better. The entire statement hosting the errant literal just disappears. It’s as if you never even called it. Notice y’s wonky value on the last run: it was never initialized and just holds randomish memory.

Turns out not all literal suffixes have expose the bug, only the following ones: a b c d f g k m n o p q r s t v w x y z. Sigh.

 
Programming Special Interest Group PSIG 107: Thurs, September 6th, 2007
in Programming Special Interest Group
Tuesday, September 04, 2007
01:47 PM
When:
Thursday, September 6th, 2007 @ 7pm
Where:
Inverness Room (downstairs rear) of the Holiday Inn Rolling Meadows
Schedule:
Show & Tell
We'll start out the meeting by going around the table and talking about what we're currently working on or learning about. Handouts are welcome, or bring along your PowerBook and we'll hook it up to the projector.

Book Reports
Bring along the book you're currently reading, or one of your old favorites. Hopefully the book would have some relevance to programming, but we're fairly open-minded. Just give us an overview the book's topic, and what you liked (or disliked) about it.

Topics
Jonathan ‘Wolf’ Rentzsch will premiere Xmo’d: an Xcode plugin that makes custom Core Data entity classes totally painless.

Previously custom Core Data entity classes were a pain. They’re worth it in the long run, and mogenerator significantly eases the pain, but the pain’s still there. Xmo’d makes it easier to use custom classes than generic classes, even from your project’s very first entity. This is a total reversal from previous Core Data development — now it’s easier to do the right thing. It’s as if you built muscle mass by eating Ben & Jerry’s.

Dinner
If you want pizza, bring along three dollars and we'll all chip in.

Looking for Presenters:
I'm always on the look-out for folks to want to give a talk for a meeting. The talk doesn't need to be long (10 minutes is fine if your topic is small or you just want to tease the group) and you don't need to be an expert (just tell us why you think your topic is cool or your experiences). Toss me an email and I'll assign you a chunk of time.
 
C4 C4[1] Thanks
in C4
Monday, August 20, 2007
12:00 AM

Only a week ago we laid C4[1] to rest. Feels like a month ago.

I needed to go heads-down the week after C4[1] in order to catch up with client work. I have a ton of email from you guys that I’ll be catching up on this week. Apologies for my latency.

I have a list of things to blog about C4[1], but before anything else, I want to thank the following people:

  • Bob Frank for bringing together our A/V recording + file server hardware story, running a camera, going hotel shopping with me and conning me into starting C4 in the first place.

  • Tim Allison and Victoria Wang for manning the registration table. Victoria also helped fold your t-shirts and sort your name badges.

  • Pat Hughes for running this year’s A/V and dealing with a late-binding crazy man like me.

  • Chuck Remes for buying a new raw 500GB drive on my behalf when I was running late on Friday, and for taking care of the leftover Saturday night pizzas for us.

  • Alex Payne for offering to morph the C4 twitter account into a backchannel for the weekend. I think it worked extremely well and added a lot of value to the conference.

  • All the Speakers. You guys were fantastic. At least four of the speakers were completely new to giving talks. I defy you to list them. All of you put on excellent, professional-caliber presentations about great topics. I especially enjoyed how later presenters made joking references to prior presenters’ points.

  • drunkenbatman. You can thank DB for C4’s existence. More than anything else, the success of his Evening at Adler showed me something like C4 was even possible. DB brings legitimate criticism to our echo chamber. I’m only unhappy his early topic flashbang derailed the rest of the discussion.

  • Iron Coder entrants. Thanks for working hard creating great hacks and showing them off. When I announced the API+theme, I wondered how many would be able to roll with it. I should have known better given the caliber of talent that’s in this community.

  • All the Attendees. C4 couldn’t exist without you guys. You care deeply about great hardware+software and work hard to make things better. It’s no joke that it’s an honor to be in your company.