Saturday
Mar052005

mac os x development, and the opengl superbible

I've been programming for, hmm, twelve years minimum, at the most conservative estimate. I just had an experience that should happen all the time and yet I'm pretty sure it's never happened before. Not once.

It's time for me to learn the basics of OpenGL. I've been doing cool stuff with high-level toolkits based on OpenGL, but I haven't done much raw OpenGL coding beyond vertex here, vertex here, vertex there. I did some research, and it looks like
the OpenGL SuperBible
is a good resource to start with. I raced down to Barnes & Noble this morning and bought the book, then came back to the loaded g5 in the cave, ready to struggle for a while to get the examples to work.

I put the cd in the drive. I copied Examples/Mac into ~/src. I double-clicked on Examples/Mac/Chapter 1/Block/Block.xcode. Xcode launched, and then just for kicks I hit "Buid and Go." The example worked the first time, with no tweaking the build setup.

Lately I've been spending hours getting each new library I want to work with set up for each new computer I need to work with it on. Endless invocations of "./configure --another-option=/usr/local/eek" are educational, but they're also frustrating delays on the road to, for instance, using an XML library, or rendering fonts, or vector math, or whatever. It's always, "now where is gcc 3.3 on this machine?" and "urg, why don't I have automake 1.7.5?" and that sort of thing. But not today.

I hereby award one gold star to the authors of the SuperBible (Richard S. Wright, Jr, and Benjamin Lipchak) and one platinum star to the architects of Xcode and OS X.

Seriously -- when has demo source code compiled and run, directly off a book's cd-rom? Not that I can remember in twelve years of coding on Solaris, Linux and Windows machines.

Tuesday
Mar012005

usps.com: how to waste half an hour

I've been working on getting a particularly annoying set of letters out the door. I decided tonight's the night, and printed out the final draft of the letter, five times. I signed the letters, wrote post-it notes to each of the individual recipients, put them in big envelopes, then said, hmm, postage... How about I try usps.com? They advertise like mad that I can do anything online that I can do at the post office, and all I want to do is smack some stamps on there; this should be easy.
No.
The only way to purchase postage for immediate use on usps.com is via a java applet. 7:20 I try it on my mac, in firefox. Nope, I need the java plugin. Firefox makes it easy for me to get the plugin from mozilla.org, although the "auto-find plugin" tool didn't work.
7:25 I try again on my mac. This time the applet loads, shows two buttons "Purchase & Print" and "Cancel." The whole applet is around 640x480, with only the top 30 pixels occupied with these buttons. The rest is blank. I'm dubious, but I hit "Purchase & Print," then I wait.
7:30 I give up on waiting. Nothing's happening, and my firefox seems to have crashed. Okay, on to the PC. I try again in Firefox. Whoops, I still need the java plugin.
7:35 The java plugin is installed, and I try the applet again, still in firefox. This time it shows me a sample label, and a progress bar claiming it's processing the credit card payment, then that it's printing. Except that it's not printing.
7:40I decide to do this in the most typical way possible, the configuration that USPS had to have been thinking of when they wrote this application: IE 5.0, Windows XP, HP DeskJet over USB. Again, I get as far as the progress bar, then nothing happens... I open the java console and it has reassuring comments such as "---sending credit card # to server---" and "---retrieving addresses from server---" -- come on, guys, you're supposed to take the debugging println's out before you ship. Duh. Then IE dies and has to be killed.
7:45 Wait, they have a link for "if your browser doesn't support java," which opens a new window. I go through the shopping cart again in this special, new, non-java window... then when I hit the "Check Out" button, it launches... the very same Java applet!
7:50 I give up. I'm going to drive to CVS and buy a bunch of stamps.

Sunday
Feb272005

cave success

Yesterday I'd started to feel like I don't have superpowers -- for a week now I've been working on documentation for ChemPad, not writing any code. So I devoted the afternoon to therapeutic programming on Screen: programming that makes me feel good. I had a fantastic day in the Cave: I made text swarm around the user's head, in a path determined by a bunch of sine waves with different frequencies and amplitudes... I could last about ten seconds in VR with words swimming around me before I started to feel very dizzy. That's actually a good thing, in this case, because the point is to overwhelm the user with text. At Josh's suggestion, I tried it out with extruded polygonal text instead of texture-mapped, antialiased, alpha-blended text. Damn, it looks good. Poor Josh brought it up like, "This is just blue-sky stuff, idea off the top of my head, I know it would probably be really hard to do, but it would be cool if the text had some depth." Aha! That's just an option in FTGL. I only had 15 minutes or so to get it to work before we had to go meet friends for Battlestar Galactica, and I couldn't find the depth control. I came back to the cave later that night, after three or four episodes of BG:TNG, and got extruded text to work very quickly. I turned on the hardware-supported full-screen-antialiasing, and now it looks better than the texture-mapped alpha blended text, and I don't have to do z-sorting.

Yesterday's coding demonstrated that the toolkit I'd spent my weekends in January constructing actually does enable rapid design and implementation of spatial text applications for virtual reality. Yeah!!!

Thursday
Feb242005

fantastic restore-from-backup -- i love you, .mac!

In august, when my mac first started having trouble, I backed up all of the data on my mac using Backup 2. I tried unsuccessfully several times to back up to .Mac, but I just had too much stuff. I wanted one coherent backup, in one file, on one disk, so I plugged in my 5 gb firefly (firewire hard drive, not joss whedon series) and created a 4.96 gb backup of all of my iLife: purchased music from iTunes and all my iPhoto's, most importantly. I also put my most precious stuff -- my writing -- on my ipod, and on a cd, and on a remote fileserver... I had forgotten that I had backed up my iTunes purchased music, though. I thought, there's just too much of it, I couldn't have burned it all to a single cd, and I don't have a dvd burner, so it must be just lost and gone forever... like my Guster album. (Sidenote: Audible.com lets me download purchased materials as many times as I'd like, which is far more convenient than the iTunes music store policy of "one dollar, one download," since I have three machines from which I'd like to listen to audiobooks.)
So, here's the beauty of .mac:
I copied my giant 8-14-04.backup file from my firefly to my desktop, and double-clicked it. Backup launched, all set up to "restore checked files." It didn't have any of the files checked, so I checked the ones I cared about, which was almost everything. It said, some of these items need to be backed up to a folder, so I created ~/Restored/ for that stuff. Spin, spin, spin, then all my data was back!
I "add to library"'d from iTunes, pointed it at ~/Restored/Music/iTunes Library, and <em>all of my purchased music was back</em>. Aah... And I pointed iPhoto at my restored iPhoto library, and it was <em>all there</em>. This has been the most painless restore <em>ever</em>.
To cap off this fantastic experience, I started on a redesign of my home page, using iWork's Pages. It's not much, but ye gods it's better than what used to be there.
My mac is the oldest and slowest machine I own, the only machine with just 802.11b wireless, no bluetooth, no smart-card readers built in, and the battery only lasts about ten minutes... Still, it's my favorite system, by far: the first one I reach for in the morning, the one who sings me to sleep at night, the one on which I do as much work as possible, the one I resent having to put down. It just works the way it's supposed to.
<em>*sighs contentedly, them puts down the mac to go tweak C# on my tablet pc*</em>

Tuesday
Feb222005

podcasting: technology and content exactly when I needed it!

For the last few days I've been looking for free online spoken-word news and commentary. Sure, I can get lots of This American Life and All Things Considered as windows media or real audio, but it's a pain to start and stop, to move from one machine to another, and I can't burn to cd from streaming media. audible.com charges significant fees for downloadable versions of radio programs, like $2.95 for one episode of All Things Considered, and even that isn't released until many many hours after the news is tired. TellTallWeekly has micro-fees for audio content, but, ahem, most of it is either unknown or dead authors. I want to listen to news and commentary while I'm falling asleep, or driving, or, notably, driving in between major radio markets.

Podcasting is exactly what I've been looking for. A few NPR shows and a few BBC shows have started podcasting -- this is just the same sort of content that I'd be willing to pay, and have in fact paid for. I just find the feeds I want, add them to my iPodder subscriptions, then poof! The latest episode will appear in iTunes, and from there, on my iPod.

So, I'm a late early adopter on this one. Still definitely an early adopter as related to the world at large, but my big brother was doing this six months ago. I'm finding the technology just when I want it, just when I want more free downloadable current spoken word audio content.

Can anyone explain why I'm awake at six am? Perhaps listening to a BBC podcast entitled "the Cambrian Explosion" will help me sleep.