Mac OS X Programming Secrets
ADHOC/MacHack: I Love the Nightlife
by Scott Knaster
If you're a Mac programmer, you've attended your share of computer conferences, such as Macworld Expo, Java One, and Apple WWDC. But unless you've been there, you've never experienced anything like ADHOC, the Advanced Developers Hands On Conference, formerly and still occasionally known as MacHack. ADHOC starts at midnight and takes place in the tourist mecca of Dearborn, Michigan, and those facts give you a good start toward understanding just how strange and wonderful ADHOC is.
In this month's column, I'll describe my visit to ADHOC/MacHack 19, which took place July 21-24, 2004. Wrapped inside is some actual technical content, a nifty iPod project that isn't nearly as cool as Tim Monroe's program-your-iPod article a few issues ago, but that has the advantage of being actually real.
Day 0: It's Time To Start
ADHOC begins on Thursday, but it's really Wednesday, and...well, I'll just let this exchange from the conference FAQ explain:
Q: When should I be there?
A: The best time to arrive is sometime on Wednesday before the conference begins. The conference begins at midnight, Thursday, which is really just a minute after 11:59 PM Wednesday. Don't get confused and think that you can arrive on Thursday. If you arrive on Thursday, you've already missed the keynote.
So I got on a plane on Wednesday, in time to arrive and watch the keynote as Thursday began. My flight from San Jose to Chicago was late, of course, which managed to eat up my layover time at O'Hare almost perfectly. Due to a quirk in the universe, I was able to trade little-used frequent flier miles for a seat in first class, which meant more service, a bigger seat, and, I'm pretty sure, a higher quality of air freshener.
I arrived in Detroit just late enough to have missed my chance to attend a baseball game, and headed to the glorious Holiday Inn Fairlane in Dearborn, home of ADHOC/MacHack.
Day 1: Night Fever
I checked in at the hotel, leaving my cable-and-battery-laden bag in my room. I registered for the conference and happily greeted beloved organizers Carol Lynn and Maurita Plouff. Then I headed to the ballroom for the first event of the conference: the midnight keynote (plus pizza - there's a lot of junky-but-fun eating at this conference).
This year's speaker was the famous David Pogue, star of books, the New York Times, and many a Macworld back page. The keynote was ostensibly about cool Mac tips and tricks, or something like that, but no MacHack keynote ever stays on track for long. You see, we nerds have no social graces, so as soon as the speaker begins, we start to "interact" with him - not by heckling, exactly, but by adding our own comments, stories, and questions.
David said he was nervous, because he felt he was less technical than everybody in the audience, which he probably was. He thought he would have nothing to teach us, but he was wrong. Even when he revealed a tip that most members of the group already knew about - in one case, somebody knew about a tip because he was the programmer who had actually written the code for it - David stayed spontaneous and hilarious, and the crowd appreciated it. David dealt superbly with the ADHOC style of interactivity, listening to all comments and responding to them, even when they required him to change the ever-ambling course of his talk.
At one point in the talk, some of us nerds decided we weren't multitasking enough, so we started interacting with David electronically. A couple of folks used iChat's Rendezvous feature to send notes to David while he was talking. I started fiddling with my Bluetooth-enabled phone and managed to bluejack David during his speech. He took it all in good humor, along with all the other geeky antics.
David concluded after touring through a bunch of Mac OS X tips, lots of editorial comments, about a million jokes, and even a few of his well-known parody songs, including "Don't Cry For Me, Cupertino" and "The Girl I Met by E-mail". ADHOC keynotes go on for hours, and David finished up at an impressive 3:40 AM. David's presentation was wonderful, and enjoyed by all the geeks in attendance.
One of ADHOC's oft-repeated mottos is "Sleep is for the week and sickly", but I prefer a little preventative rest to avoid becoming week and sickly. So after hanging out post-keynote until about 4:30, I headed off to bed.
Day 2: We Belong To The Night
One of the Holiday Inn Fairlane's finest and most important features is the superthick blackout curtains in the rooms, which prevent any trace of sunlight entering to disturb sleep. Taking advantage of these wonderful curtains, which were probably installed specifically for our little conference, I slept until the still-early time of 10:30, when I had to prepare for the ADHOC session I was presenting on writing books at 11:00. I was told that I would have few attendees at that early hour, but that more folks would trickle in as we approached noon (nobody wants to sleep through a meal). So, in the spirit of the conference, I decided to present the session backwards, beginning with Q & A, then the summary and miscellaneous info, and the important stuff at the end. This worked out OK - everybody understood and appreciated my meager attempt at adding entertainment value.
After lunch, I started to think about working on my hack project. In previous MacHacks, the soul of the conference was the attendee hack projects. People at the conference were encouraged to cook up some weird and fun programming project while they were there - something they probably wouldn't find time to work on while back at home in the real world. On the third night, attendees would get a chance to show off their work in a marathon hack show, featuring MacHack-style interactivity. The final night featured the awards banquet, at which contest honcho Scott Boyd bestowed weird and appropriate prizes on all participants - last year I got a bag of rocks.
For a variety of reasons, the final hack contest took place in 2003. This year's conference featured a reasonable facsimile called the ADHOC Labs Showcase. Although the name, details, and traditions changed, the important bits - attendees hacking, showing off their work, and receiving awards - were pretty much the same. Everyone at ADHOC is encouraged to create a hack, even the non-programmers. For example, Mac maven Adam Engst hacks the hotel itself by hiding (sometimes in plain sight) a four-foot wooden stake somewhere, which stays in the hotel until he can retrieve it the following year.
As a professional explainer, I'm not really a programmer, and I had never attempted a hack in my 3 previous MacHacks. This year was going to be different: I wanted to hack the iPod.
Although some hack purists insist on waiting until Friday afternoon (that is, the last minute) to start working on their hacks, I was much more cautious. I wimpily started on my project with more than a day to spare.
Every iPod that has the Notes application includes a little-known feature called "museum mode". With judicious use of museum mode, you can actually prevent users from getting to the standard iPod commands, and replace them entirely with your own custom user interface. Of course, there's a catch: your new UI can only take advantage of the iPod's notes features. Even with this limitation, you can do a lot. Notes can display text (of course), link to other notes, and even play music.
The trick to stealing the iPod's user interface is to create a note with the following text:
<meta name="NotesOnly" content="true">
If you save this file with the name Preferences (or Preferences.txt) and put it into the root of the Notes folder on the iPod, then reboot the iPod, it will no longer display the familiar commands of the main menu. Instead, the iPod will only show the names of other files and folders in the Notes folder. Score!
My plan was to use museum mode to construct a faked-up "Super iPod" with all the features that have been rumored for the iPod over the past few years. Of course, these "commands" would actually be notes. On some of them, I would create dummy interfaces for the "features". What I lacked in technical virtuosity, I would have to make up in comedic value, a standard MacHack technique.
Furthering The Hack
To make my iPod notes hack, I first created the Preferences file. In addition to the tag shown above, I added another tag:
This title tag lets you replace the text that normally appears at the top of the screen with whatever you want. Adding this tag to the Preferences note made sure that I would see "Super iPod" at the top of the screen when the iPod started up, which would enhance the illusion.
Next, I wanted to figure out which fantastic items my main menu screen would contain. After a judicious review of the best iPod rumors, I came up with these choices:
Music > Pictures > Telephone > Video >
To simulate these Super iPod features, I created a folder in the Notes folder with the name of each feature. You'll note a very important hidden feature of these commands: they're listed in alphabetical order. The Notes application always displays files and folders in alphabetical order, a fact I had to keep in mind when I picked the names of my super-features. I had hoped to use another esoteric notes feature, the main.linx file, to list features in whatever order I wanted. But unfortunately, when I created the main.linx file, I discovered that Notes didn't display the right-arrow after the names of the folders such as Music and Pictures, which destroyed the illusion that those were iPod commands. So I had to abandon the main.linx technique and avoid other "features" (such as Backlight or Settings) that would appear out of their natural order.
Now it was time for the social engineering part of my hack. What should happen when I delved into the Super iPod features? I wanted the Music command to actually play music, because that's what an iPod does (and it's one of the things you can do from Notes). The menu I built inside the Music command looked like this:
Albums Artists Composers Playlists Shuffle Songs
These weren't in proper iPod order, but I figured it was close enough for their quick appearance during the demo. For the last item, Shuffle Play, I used another Notes trick: the .link file. I created a file called shuffle.link, with the following contents:
<title>Shuffle Songs</title> <a href="song=Invasion of the Gabber Robots">Shuffle Songs</a>
The href tag plays the given song. Putting the tag into a file with the .link suffix tells Notes to start playing the song as soon as the user selects the note on the iPod. The title tag hides the file's true name and replaces it with another, in this case "Shuffle Songs", which is how we want it to appear in the Music menu. The effect is that when the user clicks Shuffle Songs, the song will start playing. The other notes (Albums, Artists, Composers, and Playlists) are just dummy files.
Adding Features That Don't Exist
Now that I had faked music playing, it was time to work on the Super iPod features. For the Pictures "feature", I decided to simply add a set of folders chosen for their humor value, since I wasn't really going to try to display images on the iPod. Inside the Pictures folder, I added these folders:
blackmail > Hawaii > kitchen remodel > MacHack 1857 > not safe for work > vacation 2003 >
Because I wasn't going to open any of the folders, I simply left them empty. The next "feature" I worked on was Video. I added some files and folders to the Video folder:
Ardussi's greatest hits > I, Robot iMovie Store Purchases > Pooty Tang Star Wars Episode III The Incredibles
The items with the greater-than sign were folders, and the others were files. As with the Pictures folder, I wasn't going to do anything with these items other than just show and joke about them, with one exception: The Incredibles. All the folders and files were empty except for "The Incredibles". Inside that file, I put the following text:
The MPAA filterbot has detected the presence of unauthorized content. Local law enforcement authorities have been informed. Thank you for your cooperation. Visit Universal Studios!
"The Incredibles" is, of course, this fall's new release from Pixar. After I finished setting up the Video folder, I moved on to the Telephone "feature". My idea for Telephone was to fill the folder with names of people, one per note, as if they were contacts. I put files into the Telephone folder like so:
Adam Engst Alaska Airlines Andrea Ammerman Asa Noriega David Shayer Jef Raskin Marshall Clow Nevin Liber
I intentionally listed Adam first because he had been talking earlier in the conference about how he's often listed first in cell phone address books and so gets more than his share of accidental I-forgot-to-lock-the-phone calls. By listing him first, I would help Adam prove his point - and earn another laugh, I hoped.
All the contacts were simply empty files, except one: Jef Raskin. For some reason, this year's conference included a never-ending series of jokes and comments about Jef, I decided to add Jef to my Super iPod and to actually call him there on stage when I was demonstrating my hack! Well, apparently.
What I really wanted, of course, was to display Jef's contact info, including phone numbers. Then, I would click a phone number, and the iPod would "dial". At that point, I would say something like "Well, it's late, and we really don't want to bother him right now", and I would press Menu to "hang up" the "phone". To dial convincingly, I wanted the iPod to play a series of DTMF tones. Asking Mr. Google for help, I quickly found a site that would turn any string of digits into the corresponding DTMF tones. I added the tone-song to my iTunes library, then moved it to the iPod. I then created Jef Raskin's contact note, like this:
Jef Raskin 1313 Mockingbird Lane Palo Alto, CA 94030 home: <a href="song=raskin">650-555-8736</a> work: <a href="song=raskin">650-555-2947</a> mobile: <a href="song=raskin">415-555-7799</a> Notes Likes fondue, old movies, and formal arguments.
As you can see, I wired up all three (fake) phone numbers to the DTMF file. When I selected any of the phone numbers, the tones would play, just as if the iPod were making a phone call. My Super iPod was ready. I was even lucky enough to borrow a brand-new 4G iPod for the demo from David Shayer, who also helped me get the hack up and running.
With my hack all set to go, I could enjoy the second night's keynote speech by Steve Hayman, an Apple engineer who works in Toronto. Steve's speech was fast-paced and funny, and filled with great hacks. Steve's best trick was using Apple Remote Desktop and a bit of script to make a line of PowerMac G4 Desktops in the next room repeatedly open and close their DVD trays. Steve and his able assistant Daryl Hawes even rigged an iSight camera and iChat to verify the remote tray antics. After Steve's session and the requisite hanging around and munching cold pizza, I turned in about 5:45 AM. Tomorrow was another day - well, actually it was the same day: Friday.
Day 3: What Day Is It? Can You Please Tell Me? What Day Is It? I'm Confused, You See...
Friday dawned bright and clear, probably. But I wasn't there to see it. I shuffled to my feet just before noon and headed down to, er, lunch. With my hack in the bag, I devoted Friday to socializing, attending sessions, and the inevitable road trip to Zingerman's, the incredible deli in Ann Arbor about 30 miles away. Zingerman's is a MacHack/ADHOC tradition. Long live potato knishes!
As the hack showcase approached, I mentally went over my presentation. I concocted a story in which I claimed I found a strange iPod in the bushes at Apple after parking my car for a nearby restaurant. I started playing with the strange iPod, and...behold! Super iPod!
About 5 minutes before the show was supposed to start, I suddenly had an idea for something new to add. I had planned on "dialing" Jef Raskin and then bailing out of the "call". But I had a Belkin Voice Recorder for my iPod. I could use it to record "Jef's" answering machine, then play the recording after the DTMF tones. I ran out of the ballroom and found a quiet corner, where I recorded the message (got it in one take). I had just enough time to change Jef's contact file so that the second phone number was connected to the "answering machine message". All I had to do was select and press the second link - it would happen too fast for anyone to notice.
I got to demo Super iPod a little while later, and it went pretty well, although projecting the iPod's screen proved to be a challenge. Of course, the highlight was the fake answering machine, which proves an old adage about demos: the best part is the part you added right before the demo.
The show featured lots of great demos, as always, and I got to bed at the unusually early (for ADHOC) hour of 3:15 AM.
Day 4: 'Round Here We Stay Up Very, Very, Very, Very Late
Saturday is always the last day of the conference. There are fewer sessions to attend, so there's more catching up with old friends and general socializing. The day is capped by the awards banquet, with everyone anticipating both their own prize and the overall winner. I received the "ADHOC Prize in Women's Studies", apparently because in my session on writing books I jokingly claimed that being a technical book writer would help you get a date - be careful what you say at this conference. The actual winner was Jorg Brown for his wonderful Unsummarize, a Mac OS X service that takes a theme sentence or two and expands upon it, exactly the reverse of Summarize, which you'll find in your Services menu right now (it's in the Application menu). In the great spirit of ADHOC, Jorg was inspired by a comment David Pogue made during his keynote, wishing for a program just like Unsummarize, and Jorg put it together in less than 48 hours.
After the banquet, in another great ADHOC tradition, we all went to a nearby theatre to make fun of a new movie. This year's target was "I, Robot", and it certainly proved worthy. And after the movie, the attendees were treated to a lively movie discussion by Keith Stattenfield, star of "Keith Explains!", this year for the first time participating via iChat video conference. And then it was morning again, and time to go to sleep.
Day 5: Steal My Body Home!
Sunday morning features bleary-eyed attendees catching cabs and shuttles and returning to their regular lives. As I schlepped my bags to the taxi, I took a last look at the majestic lobby of the Holiday Inn Fairlane. It was another great time at MacHack, even though it's now called ADHOC. I knew I would give (almost) anything to be back next year at this most uniquely geeky conference.
Plus, on the way to the airport, I saw the World's Biggest Tire.
Scott Knaster writes books, including the recently published Mac Toys and the brand-new Hacking iPod and iTunes, both from Wiley Publishing. Scott can't read and listen to vocal music at the same time. Scott writes these little bios in the third person. Write to Scott email@example.com.
Post a Comment