Archives for : October2008

Product versus Process

Daring Fireball, on rumor that Apple’s Finder App to get Cocoa Rewrite for Snow Leopard:

Everyone out there with a stiffy for the “rewritten in Cocoa” Snow Leopard Finder needs to get a grip. Cocoa is just an API. It is not some sort of magic technology where you just sprinkle a ton of square brackets in your source code and you instantly get a better UI.

I don’t think that’s the big deal. I think the big deal is that with Apple finally facing up to a really big, nasty Carbon-to-Cocoa rewrite, they’re either going to appreciate the pain they’re insisting that their partners go through with their legacy products (Word, Photoshop, etc.), or (more optimistically) they’re going to develop tools and techniques as part of their internal transition, and make those available in some future tool or SDK.

Granted, this is the sound of me clinging to a soon-to-be-wrong prediction that Carbon would get deprecated this year:

Apple has some still-viable pre-OS X apps (iTunes anyone?) that are presumably Carbon, and with the Intel transition done, I wonder if they’re not spending the first half of 2008 converting those to Cocoa, developing needed migration tools along the way, with the intention of rolling into WWDC 2008 able to say “it’s not that hard, we did it, here’s how, and here’s stuff to help.”

Link: Harmonix announces Beatles game

Details from Gamasutra. With all the iconic design associated with the Beatles — the Yellow Submarine movie, the Sgt. Pepper concept, the B&W of “A Hard Day’s Night” or the Bond-spoof “Help!”– this could be as fascinating visually as much as anything else. Maybe “Rock Band” meets “Kingdom Hearts”, where the different Beatles eras and concepts serve as the various lands?

Since Harmonix is made up of musicians, it’s safe to assume it won’t suck like the Sgt. Pepper movie. Worst case, it’s Across the Universe, which sits unwatched in my DVR…

BTW, with rumor mongers saying for years that a deal for Beatles on iTunes was close, who would have thought that we’d see them in a game before being on iTunes or one of its rivals?

The other conspicuously missing Java platform

Sony announces they’re removing the PlayStation 2 content approval process, thereby making PS2 effectively an open platform.

Do you suppose this will hasten Java for PlayStation 2, promised in the JavaOne 2001 keynote?

No, of course not, but it’s fun to recall this among other J1 vaporware — anyone remember the 2004 announcement of Java for the hated and vaporous Infinium Phantom console? — as a counter to whiny little bitches who can’t get over Steve Jobs’ arguably unkept vow to make the Mac the best Java platform. Seriously, kids, half of what gets announced in keynotes never ships… get over yourselves already.

And not needing any comment from me (because the forum’s already hopping): [FYI] Sun stopped funding of SwingX.

Link: Using the Rock Band drum kit with Garage Band

Clever as heck idea from MacLife:
Rock Out in GarageBand with the Rock Band Drum Controller.

Makes me wish I could actually play actual instruments and use GB.

When content filters fail

iTunes tries, and fails, to censor an obscene band name:

iTunes tries, and fails, to censor an obscene band name

Slideshows aren’t movies (unless they are)

Since returning to GRR, I’ve let the Mac Pro run overnight, downloading 30-some WWDC 2008 videos, which just became available on Friday. At an average of 500 MB each, I’m probably burning through 15 GB of data, which means that under some bandwidth-rationing regimes, I’d be closing in on a bandwidth cap. I ranted about this before, but this is a textbook case of why the US’ broadband oligopoly is going to hurt the country in the long run: somewhere out there, there’s an iPhone developer on Comcast or AT&T who can’t get needed iPhone development info because he or she has hit an arbitrary bandwidth cap. American developers are at a disadvantage, relative to the rest of the world, thanks to the crooked arrangement of just having one or two providers (if any) in a given area, enjoying a government-protected monopoly while not being expected to provide any specific level of service.

We don’t have a single provider taking care of everyone in the public interest, nor do we enjoy the benefits of genuine competition. What we’ve got is good old fashioned US-style cronyism, something that will only get worse as the government frantically borrows more money (WTF?) to buy more of the private economy (WTF?)

Having said that… why the heck are all these videos a half gig anyways?

If you look at the previous years’ WWDC videos or similar ADC on iTunes content (Leopard Tech Talks, for example), you’ll notice that by and large, the video portion of the file is just the slides. Except for the transitions and any demos, the video portion of the presentation doesn’t move. Yet if you zoom in on the text, you’ll see a little bit of an artifact that jumps every second or so as it hits a keyframe, meaning this non-moving content has been encoded as if it were natural, moving video.

And it’s a massive waste of bandwidth. Since QuickTime supports variable frame rates, you could have a single frame (i.e., a slide) that stays up for 10 or 20 or 60 seconds, and only need the data for that frame once. Then for the next slide, you’d only need one sample, however long it is. There are slideshow-movie-maker examples for QuickTime that do exactly this (I think I even did one in QTJ a long time ago, but it’s not in the book [should have been] and I don’t know where I posted it, if I did). I suspect you could do the slides with a lossless codec, like PNG or even Animation (which is just RLE), and still get a huge space saving over the current process of re-encoding that keyframe every second, and providing B-frames (deltas) that don’t convey any information because the image doesn’t actually change.

In fact, you could still use natural video for your demos by simply having a second video track that would contain samples only for those times when you’re actually doing video. Moral of story: QuickTime creative abilities remain freaking awesome.

So why not do this? Well, obviously, the videos need to be playable on iPods and iPhones, which only support H.264 (though I’d be interested to know if H.264 can do variable frame rates… I assume it can’t, at least not in the Low Complexity profile, but it’d be a real nice feature for exactly this kind of thing). You could use the variable length samples in production — drop some PNGs on a video track in your Final Cut timeline and stretch their durations and you’re doing exactly that — but once you export, you’ll get the same constant-frame-rate H.264 that you would if you were exporting your kids’ Halloween videos. Alas.

WWDC: Whenever We’re Done Compressing

Finally! WWDC 2008 session videos and slides are available to attendees.

I’m up at the folks’ place, on their wireless broadband from across the lake ISP, and I managed to get about 40 sets of slides and 4 videos overnight before the site went down for “maintenance”.

When I get back to GRR and 3 Mbps, I may just have iTunes go and get everything. That might finally use up the untouched 60 GB on my iPod Classic that I haven’t filled yet.

The same thing going down…

We’re probably pushing a beta of the book today or tomorrow… once I write a few grafs of flow here and there. The monster debugging/performance chapter is splitting into two chapters, which made for a little reworking here and there… I added a section to debugging on how to spot and resolve missing #import / #include / @class statements and forgotten framework linkage, plus a “Joe Asks” explaining why you might want to use Shark since it’s Simulator-only (it’s a little simpler to find stuff in Shark than in Instruments’ CPU profiler, though nobody denies that Instruments is far, far more comprehensive a profiling tool).

Also working on an article for Mystery Client, which was pitched as being somewhat similar to the URL Loading System stuff in the Network I/O chapter when the book looked dead. So I’ve had to revise the article to make it more different from the book, which was actually a good exercise. The article will offer a URL downloader that flips between web view and source view. It’s a pretty cute demo actually.

When I was trying to come up with a different example for the article, I started writing an RSS client. It works great, but the overhead of parsing the XML and populating the table kind of buries the URL stuff, which was the original point. I may take an hour over the weekend or next week to convert that into a sample code freebie on one of my various blogs (maybe O’Reilly Digital Media, with pointers to the book and a link from here… I don’t know yet…)

Next in the book… I don’t know if I’m taking on one of the easier chapters from the remaining list (accelerometer, address book), or starting into the challenging media chapter. I also need to work my share of the errata. There are a few of the examples that were written really early in the SDK betas and don’t really suit iPhone programming practices today, so those need to get cleaned up. Specifically, the “flipping preferences” demo provided its own flip code whereas Xcode now gives you a template for that, and the file i/o example builds more of its navigation GUI in code than is necessary. I also need to re-read the file and network chapters to make sure I haven’t spent too much time on old-fashioned tight-loop byte-reading, since the patterns throughout Cocoa (and even Core Foundation) make it clear that the callback-driven approaches are much preferred. That’s a case where I came into the book with biases and experiences from other languages and platforms, and need to really make sure I’m presenting Cocoa qua Cocoa.

One more thing: at some point, I need to parachute into the table chapter (written by a co-author) and provide the “how to design table cells in IB and use them in your app without wasting memory or CPU” recipe (which is what my first article for Mystery Client is about). For anyone who needs the secret now, my approach is: put the cell in its own NIB, write a factory class to find the cell with loadNibNamed:owner:options:, use the factory where you used to use alloc and initWithFrame:reuseIdentifier: (ie, when you couldn’t dequeue an already-existing cell from the table). There are probably other approaches, but I’m very happy with this recipe.

I’m not going to Chicago for iPhone Tech Talks… just got my “sorry, turns out we’re full after all” note yesterday. No big loss; I just wish they’d post the damn WWDC videos already (or just the slides, ferstevessake!). I didn’t take notes because I counted on being able to go back and look that stuff up. Thwart!

Clanging away on the debugging chapter

Whew, another long stretch of radio silence on the blog, this time corresponding with my writing the debugging/performance chapter for the iPhone SDK book. It ended up running about 32 pages(!), because of the scope:

  • Build errors
  • Using documentation in Xcode
  • IB errors
  • Xcode debugger
  • Performance tuning with Shark
  • Performance tuning with Instruments
  • Static analysis with Clang

The last is a bonus topic that’s a bit of a risk, considering that we’re basically telling the user to download a nightly build, drop it in their /usr/local and try it out on their code.

I had the good luck to run the Clang Static Analyzer scan-build while my app-signing certificates were messed up, which totally failed and forced me to confront the realities of how it works: scan-build actually runs your command-line build script (either make or xcodebuild) and integrates into the gcc tasks of the build to do its work. If xcodebuild doesn’t work with your project’s default settings, you fail with an inexplicable error like this:

2008-10-15 15:58:33.461 xcodebuild[747:2a73] Warning: Couldn't discover the 'ccc-analyzer' compiler's built-in search paths and preprocessor definitions for language dialect 'objective-c'. This may lead to indexing issues.
Compiler: /usr/local/checker-109/ccc-analyzer
Reason: gcc-4.0: installation problem, cannot exec '/Developer/usr/bin/arm-apple-darwin9-gcc-4.0.1': No such file or directory

This turns out to usually be a total red herring. The problem in my case was that app signing was broken (I’d generated my new cert on the MacBook, and hadn’t exported my private key from that computer back to the Mac Pro), so the build was failing for code signing reasons. Of course, this would also happen for any of our readers who download a sample project where the default target is the device, if they either don’t have a certificate or haven’t changed the signing identity to something other than “iPhone Developer: Chris Adamson”.

Since we don’t really care about code signing or the device when we’re doing static analysis, the fix is to just go to the project’s properties and set the “Base SDK” to “Simulator – iPhone OS 2.1” rather than “Device”.

In other news, I still haven’t heard if I got my registration submitted in time to go to the iPhone Tech Talks in Chicago. Daniel says he registered for it too, so maybe we’ll road trip (or take a train, though the Amtrak schedules from GRR and K-zoo don’t fit real well). Also, check out the unintentional hilarity from Apple’s tech talks registration form:

If yes, what other mobile platforms do you develop on? Check all that apply.
Windows Mobile

Anybody notice a prominent mobile platform missing from that list? Like the one that everyone actually has on their phone, no matter how cheesy the model? I’m surprised the Java mob hasn’t blogged bitterly about this obvious example of nefarious skullduggery! and how much “Steve Jobs hates Java”. Actually, I think it’s quaint that they remembered that BREW exists. Or that Palm still does.

SDK on the radio

Within hours of the iPhone SDK NDA dropping, Scotty of the Late Night Cocoa released the interview with me, Bill, and Marcel, co-authors of the Prags’ iPhone SDK book, that we recorded like two or three months ago. You know, back when we thought the end of the NDA was imminent.

Did I have a cold then too? My voice sounds really flat. On the other hand, using the good mic makes a huge difference, even over Skype.

Not much I’d take back, except I can tell that this was before I’d finished the Bonjour section, because I’m not sure I would really want to say that you send data via Bonjour. You discover with Bonjour, but then exchange data over plain ol’ sockets.

I had hoped Scotty was going to edit out my mention of a WWDC OpenAL demo. It’s probably harmless, but technically, everything at WWDC other than the Stevenote is NDA. Oops. Crap. Hopefully, Apple’s ninja lawyers haven’t figured out where I live now.