Tuesday, March 29, 2022


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 weak and sickly", but I prefer a little preventative rest to avoid becoming weak 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: 

<title>Super iPod</title>

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: 

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       >
Pootie 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>


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 atscottk@mactech.com.

Friday, March 25, 2022

Spelling bee kid

One of the highlights of my youth was my Spelling Bee career. When you're a pudgy little nerd, you take your competitive events where you can get them, and I was a great speller. In 8th grade I took the Denver written spelling test and I did well enough to qualify for the state test, also in Denver. That memorable day began with the test in a fancy hotel downtown, followed by a lunch banquet for all us little geeks and our parents. After lunch, the top 20 spellers, based on the state written test, were announced, and I was one of them!

They piled us into taxis – my first ever, having grown up in suburbs, where everybody has a car – and sent us to the studios of channel 7, a local TV station that broadcast the final rounds live. I survived for an hour or so under the hot studio lights. What pressure! Then, with 5 people remaining, I met my fate: frontispiece, which I misspelled "fronticepiece". Ding! My fifth-place finish earned me a dictionary, which I still have somewhere.

All my spelling bee memories are happy. There was no cramming, no parental or self-imposed pressure, no worrying. I only wished there had been a professional spelling league in which I could become a star and earn a living. Yes, dreams die hard.


Thursday, March 10, 2022

Why did we travel almost 2000 miles to see a total eclipse?

 Why did we travel almost 2000 miles to see a total eclipse?

All my life I've loved science fiction movies with amazing special effects. Yesterday I stood on a field with a few hundred people as it gradually got dark in the middle of the day. I watched through heavy sunglasses as the sun became a crescent and then slipped away completely. The temperature dropped 12 degrees in a few minutes. Then I took off the glasses and stared at a giant black hole in the sky. I felt like I was on another planet. The horizons looked like sunset –  in every direction. Then, just when the sun had surrendered, it reannounced itself with an explosive "diamond ring" effect that said "Fun's over, folks. Put your glasses back on or you'll regret it!"

Seeing this event with a crowd of people was surreal and awe-inspiring. It made me think about a universe or god that enables an incredible cosmic coincidence where ONLY ON OUR PLANET do the sun and the moon have the same apparent size. The eclipse made me laugh and cry. It was otherworldly and surreal. For 2 minutes I got to be on a different planet! Better than any special effect ever.

Tuesday, October 15, 2019

Resources for the MacTech Conference keynote "That’s amazing! Why Storytelling is Crucial to Tech, Business, and the World":

An Introvert's Guide to Better Presentations
5 Science-Backed Ways to Give Better Presentations
How To Give a Killer Presentation
The Moth
TED Talks

Thursday, August 1, 2019

The first performance of Adjacent to Greatness

I'm feeling lucky!

I've had an incredibly fortunate career in Silicon Valley. I spent 7 years at Apple in the '80s, a few years at General Magic in the '90s, and more years at Microsoft and Google after that. I'm a writer, not an engineer. I've loved watching, teaching, and describing the incredible work I've been lucky enough to see: Macintosh, HyperCard, Magic Cap, and other marvels.

Over the years I acquired a long list of stories about the amazing, bizarre, fun, and just goofy things I've seen in my work. A few years ago my boss at Google, the legendary Louis Gray, encouraged me to start writing some of these stories in blog posts. That was great! But then, in a shocking development, I discovered stage performance and fell in love with it. And it turns out there's a thing called solo performance, where one person gets on stage and tells stories, creating a narrative, typically for an hour or so.

Could I do that? It sounded hard and really, really fun. When I told stories to people, they seemed interested. So maybe it could work. I started listing my stories and then rewriting them to be delivered live. I found it very hard to rehearse, because I felt foolish without an audience, with no feedback to guide me. But I also realized I had been "rehearsing" all the time, whenever I told stories to a friend at lunch or a poor cornered family member. Eventually I was comfortable enough to do a test run with invited friends. It was terrible. Really bad! I got great feedback on what I needed to change, and I changed it.

I spent a lot of time planning, organizing, rewriting, procrastinating, and dreaming, but not performing. Last year I applied to a new works program at The Marsh, a legendary solo performance venue in San Francisco. They accepted me and I got to perform for 20 minutes several times, and again I learned a lot (and got better). I realized that the only time I really made progress was when I actually performed. So I got over my fears, talked to my friends at Playful People Productions, and scheduled a date in San Jose at the Historic Hoover Theatre. Then I actually invited people to come.

Last Friday night was my first full-length performance. So many dreams came true that night! I told my stories on stage in a theatre, for an hour, in front of a good crowd of people, with sound, lights, projected images, props - a real show. And it felt fantastic! And thanks to my great friend John A. Vink, it was recorded, so you can watch if you want. And if you want to see this or future shows live some day, you can sign up to get on my email list here.

Now I just have to figure out when I'm going to do it again!

Saturday, June 2, 2018

Technology, storytelling, Apple, and me

There's a long tradition of storytelling and theater in technology companies. You might be surprised to hear this, because a lot of people think of tech as mostly nerds and bros doing nerdy bro things. But tech companies aren't shy about talking of changing the world, making a difference, and so on, in addition to selling widgets or serving up websites. If you think your work is important - and it might well be - then you spend time in your companies telling stories to each other and to the world.

And if you doubt the importance of storytelling by companies to their customers, may I refer you to the latest Apple keynote. This keynote hasn't actually happened yet, but I know it'll be superb theater - sure, they'll be talking about world-class innovative engineering and design, but it's presented on a stage in a master storytelling fashion, complete with drama, humor, pathos, and tension. It's no accident that Apple spent $179 million dollars on its new theater, and then named it after Steve Jobs, the greatest storyteller in tech history.

There are many ways to tell stories: in writing, in small groups, from a stage. These ways further subdivide: you tell a story differently in a blog post than you do in a tweetstorm. There are different techniques for a solo stage show than for telling a story to your friend over coffee. I've become acutely aware of these differences lately. I'm blessed and cursed with a compulsion to tell stories, as my long-suffering friends are all too aware. It's not enough for me to experience something interesting, unusual, or funny - I have to tell other people about it or it feels incomplete.

I'm a writer, so I usually share things by writing them down in my blog, or on Facebook or Twitter. But recently I thought it might be interesting to tell my stories from a stage as a solo show. I've been working on this for awhile, and very soon I'm going to get up onstage at The Marsh in San Francisco and try it out. From a stage, I have to be bigger and bolder than when I'm just "performing" for a few friends. I have to add characters, really live scenes instead of just describing them. Because I've mainly been a writer, this is new for me. It feels uncomfortable and I'm sure I'm doing a million things wrong. But I'm compelled to get up there and tell stories this way. I hope eventually it's entertaining - even if it never changes the world.

Come see me at Monday Night Marsh in San Francisco on June 11th and 25th

Thanks to Keith Rollin and Dave Mark for photo search support.