Corollary to the definition of insanity

[This was originally written in March, but I apparently forgot to post it...]

I’m currently on an airplane. Aisle seat, exit row; little to complain about there.

After listening to two Developer Lives podcasts (Brent Simmons and Daniel Jalkut) I decided I needed some music. Philip Glass’s Cassandra’s Dream was a good choice, as this was to be background to reading XCode documentation (NSXMLParser as it turns out).

At some point the music sounded repetitive (even for Philip Glass. I know, I know.). My iPhone’s key lock came up, meaning I’d been listening more than an hour.

The first track to Cassandra’s Dream, at approximately two minutes and twenty seconds, was set to auto-repeat.

It took me more than an hour to realize this.

[Einstein defined insanity as doing the same thing over and over again and expecting different results.]

From my side of the Mac Developer Roundtable

Last week I was asked to participate in the Mac Developer Roundtable podcast, hosted by Steve “Scotty” Scott. I’m unquestionably the new kid on the program. This was my first podcast ever, and the other guests are far more experienced in Cocoa programming than little old me. Everyone was very nice, and I had a great time.

I should say I’m writing this prior to the episode’s release but I’m assuming Scotty will do his usual excellent job editing, hopefully even raising my IQ a few points. I also hope the GSM buzz from my end of the line isn’t distracting. The phone in question was in another room and wasn’t audible to me during recording, but I heard it later on. Very frustrating as I’d done everything to keep noise down including buying a pop filter and turning off the HVAC system (I already had decent audio equipment for other purposes). Alysa somehow managed to keep Ariella (our almost-two-year-old) quiet, which was amazing.

My secret hope in participating was to motivate myself to improve the frequency of both my Cocoa coding and blogging. Only time will tell about the latter, but the former has paid off. I have two new (small) iPhone app projects in the works. The more complicated is time-sensitive in nature so I’m working towards releasing it first. I’d actually completed an iPhone app mid-July, but at the last moment decided against releasing it. That’s an interesting story really, but for another day. I do regret my decision to pull back on that app. The app wouldn’t have made the world a better place, but I suspect I’d be a better coder if I’d continued in forward motion.

One comment I remember making during the show is how Apple makes it difficult for newbies to ObjC/Cocoa to get from Point A to Point C. One possibility is that’s intentional, to weed out those not cut out for quality Mac programming. Either way it’s clear that Apple does not apply their highly regarded ease of use talents to the coding process.

Today I ran into two issues. First was an error with iPhone Provisioning Profiles. My app wouldn’t install onto my iPhone (in development/debug mode), with XCode spitting out a 15507 error saying my profile wasn’t on my phone. Which it was (I’d installed other self-written apps previously, and even did so again to confirm all was still happy). I combined several suggestions provided by the googleverse, deleted and re-installed profiles, changed various project options, and suddenly all was happy in the world. Provisioning profiles (part of the signing process) are key to iPhone development, yet the whole process is far removed from anything Mac users would consider sensible. I don’t mean it’s too technical; it’s just wrong.

Second, I wanted to configure XCode’s built-in Source Code Management (Subversion) functionality. I’d used this with other folks’ projects before, but had never configured my own (instead doing ad-hoc version control myself). I searched for Subversion within Developer Tools Library. The top item was a link to an ADC page on configuring Subversion – using XCode 1.5. I’m using 3.1.2. More than a few differences. So I was left to figure things out on my own. Not necessarily a bad thing, but not how I’d hoped to spend my time. Only while writing this post did I find the more recent documentation further down the results list. Why would Apple include such old info within 3.1′s documentation? The old page doesn’t even provide a link to newer info.

Neither of the above are earth-shattering of course. I really am enjoying using XCode, ObjC, and Cocoa. Just two minor yet preventable issues that got in the way of my intent to code. I’ve been coding on Macs off and on since 1986 so I’ve seen plenty of odd stuff (like creating QTVR images in MPW!). This just seems inconsistent with why I use a Mac.

I said I’d blog more. I’ll try to complain less.

Apple TV, what it could be

I recently bought an Apple TV. I’ve had a Mac Mini connected to our TV for 2+ years, but it never got the use I was hoping. The Apple TV is quickly becoming a big hit in our house due to its ease of use. It’s a great little device, especially considering it’s just a “hobby” for Apple.

I have several suggested improvements for the next generation of hardware and/or software. I have no expectation Apple will either see or pay attention. I’ll also not attempt to turn the Apple TV into something Apple clearly doesn’t want it to be. So no push to support every codec under the sun, no tuner/recorder, no blu-ray player, etc. Might be nice but a waste of time to suggest.

This has been in my drafts folder for a while. It’s way too long as-is, so I’m getting it out there.

Software Changes

Network sharing: Allow local computer users to share (play) media stored on the Apple TV. Basically, make it act like iTunes and iPhoto already does. This should follow standard restrictions on protected content, again just like any computer. This should also allow one Apple TV to share the content of another Apple TV. We’re having so much fun, getting a second may be tempting someday – but only if all content were accessible at all times.

Podcast improvements: I’m having a blast with video podcasts. First, we need better searching. The current Apple TV search is titles only, while an iTunes search is much more thorough. Also, allow subscribing to podcasts directly on the Apple TV. (General theme: do as much as possible through the Apple TV interface, not requiring constant access to the host computer’s iTunes.)

More codec support: I’m not suggesting XviD, WMV, etc. I think the Apple TV should support every codec available on the Mac desktop using QuickTime. This would allow users to play DV files, videos made on digicams, etc, without going through lengthy conversions. Some of these are better kept on the host computer to save space; the intention here is to save conversion time. Some large codecs might require more CPU power, or a hardwired ethernet connection, but most should be fine.

Also, for conversion, some simple batch-convert process for video. We can batch-convert music to MP3/AAC in iTunes, why not video? I know there are third-party solutions to this, but it should really be integrated. NEVER MIND – Advanced->Create Apple TV Version. I haven’t tried this yet; curious if it’s the same as Quicktime’s Export to Apple TV (a very high quality/large file size conversion with no options).

Manually set the poster frame: This is a lame one, but I’d like it. Pause a movie on your favorite frame, then set the poster frame. Also, manually add chapter markers the same way. These should be synced back to the host computer.

Sync while playing: The Apple TV can’t seem to sync with the host computer while playing video. That’s silly.

The ability to play more HD formats, specifically 720p/30 and 1080i/p (24 and 30). Most large (and more smaller) HD TVs are 1080p now. All my home video is shot 1080i/30 (or 1080i/60 if you count fields). It’s a shame I need to scale that down to 960 x 540. There might be a hardware component to this as 1080p video stutters even on somewhat modern computers.

Ditch the stupid .m4v format. I don’t get this one, although it has little to do with the Apple TV itself. .mov is a great container. Why the new format? Was it to say Apple was producing an open format? Try changing some tags in a large .m4v file. Takes forever. A .mov? Barely noticeable. Yes I can use .mov fine, but the quick exports from iMovie, Compressor, etc, all go to .m4v. Plus .mov can have multiple audio tracks, closed-caption tracks, etc.

Support multiple tracks of .mov files. Following from the above, allow the user to choose which audio track to play when watching a movie. When I RIP DVD’s for flights I include the main audio and any commentary tracks, all in the same file. In Quicktime Player I just select which I want to hear. The same should be possible on the Apple TV. (And imagine how many more movies Apple would sell if they included director/actor commentary tracks?)

Multiple users. This is a big one, and an easy one. We have three people in our house – why would we want the same set of favorites, or the same playlists, or the same YouTube account? I’m not suggesting a completely separate library (although some might want this). My wife doesn’t need to see my WWDC videos in her listing, and our daughter doesn’t want to see anything other than Sesame Street and Curious George.

EXIF/IPTC tags while watching photos. While watching photos, we’ll sometimes wonder when the photo was taken. How about a popup of basic data? (And oh, by the way, iPhoto should embed this info into photos instead of storing the data elsewhere. Major multi-year pet peeve here.)

Be a wireless access point (and for some a repeater). My Apple TV is on Ethernet. Why can’t it be another access point for my home LAN? For those using the Apple TV on WiFi, making the Apple TV be a repeater might be nice, although throughput would drop in half so mixed feelings here.

Hardware changes

Apple will inevitably ship a new hardware version of the Apple TV, unless they kill it off of course. I’ll assume the device will have a better CPU and graphics card to support 1080p, etc. So that’s a given.

Gigabit ethernet and 802.11n WiFi. Obvious – move those video files faster.

A desktop (3.5″) hard drive!!! This is my biggest complaint about the first generation Apple TV, and the Mac Mini as well. Why on earth did Apple see it necessary to use a 2.5″ laptop drive in a non-portable device? They saved roughly six-tenths of an inch of space (height) on the device. Hip hip hooray. But they lost a ton of storage space – for a device where storage is key. Many 3.5″ drives are plenty quiet (I’ve had a Tivo for eight years, never heard anyone complain). A quick check at my favorite drive vendor shows 160GB laptop drives roughly the same price as a 500GB desktop drive. Apple is using desktop drives in the Time Capsule, and I’ve never heard anyone complain it’s too large. A perfect example of form obliterating function.

Bluetooth – to support more devices, remotes, etc. See theoretical changes below for more rationale.

External hard drive support – I think this is possible, but unlikely from Apple. They like closed devices. I disagree with their decisions here but accept them as part of the big picture.

Theoretical changes

SDK. Apple has the iPhone SDK, and it’s a huge success. The Apple TV is running OS X too. A real SDK (combined with the better processor and GPU likely coming anyway) could turn the Apple TV into a competitive gaming platform. I don’t play games myself so I don’t care, but it would make the device very popular. Integration with the App Store, etc. Apple would limit SDK functionality (muck like the iPhone), here to prevent the Apple TV from becoming too much like a computer and competing with their own Macs. That’s ok.

Through that SDK they could open the Apple TV to other content providers. (Whoa, is that the third rail I sense?) I don’t see Apple’s content being all things to all people. Access to NetFlix, Hulu, more photo/video sites, etc, is necessary. Apple has conquered music. They haven’t conquered video, and they won’t. Apple has not positioned the Apple TV as a loss-leader to content (like game consoles do). Open it up to the wider world, and Apple will own this market.

Give the remote an accelerometer. Just like the iPhone (and just like the Wii from what I understand). Would be fun for gamers, and probably useful for something. Otherwise the current remote is fine. Simplicity is Apple’s forté, and most do-everything remotes are horrid.

Subscription video service. Ok, this isn’t really a software feature. I think Apple did the right thing by avoiding subscription music. Video is another beast. Netflix’s video subscription is proving popular, at least among the tech crowd. Already multiple hardware boxes support it. If Apple could get the studios on board they could have a great offering.

Ok, I’m done.

WWDC: Phil Schiller introduces the Barenaked Ladies

Lots to say about WWDC08 (for starters, I wasn’t confused with the other Mitch Cohen this year). But I was able to get a decent video of Phil Schiller introducing the Barenaked Ladies at the WWDC party tonight. Well the audio stinks, as it was taken on my little digital camera. I thought this would be a good opportunity to join the digital revolution and post my first YouTube video. Edited and uploaded directly from iMovie ’08.If anyone wants a copy better than what YouTube provides, leave a comment or drop a note.Turns out they’re huge Apple/Mac fans. I hope others post video from their show as they were lots of fun. One amusing thought. When I figured out who was playing (not pre-announced, but they taped the setlist to the stage so easy to Google) my first thought was “Wow, they got a real band for this little party.” Then I realized – Apple is the number one seller of music in the country. They could likely get anyone they wanted with little effort.[Update - seems YouTube wants to bump my 16:9 movie up to 4:3. Something to look at later.]

Header files are stupid

I’ve been meaning to get this off my chest for years. Header files are stupid.

I view header files as abstractions of programming code. In Cocoa, they not only tell the compiler what lives in a class file, but also tells Interface Builder what objects and messages it can use. Plus they let a human quickly determine what a class does. So it serves a tremendously important purpose.

But they’re still stupid. They shouldn’t need to exist. My problem is a conflict with my general theory of duplication – nothing should ever be typed twice. If data exists in one form, and it is needed in another form, that’s work a computer should do. Not a human.

If I have a class file I, even in my lowly state of knowledge, can create a corresponding header file. This isn’t an exercise of the mind, it’s menial duplication. Copy/paste with finesse.

Thinking in the opposite direction, if I have a header file, I can create the template of the class file. Not the code guts of course, but the raw objects and methods.

So why do I need to do this? Why can’t the computer? In my travels I’m certain to run across situations that might not fit the 100% bidirectional header<->class correlation. So fine, provide some manual override if needed.

Interface Builder gets a partial pass on this complaint. It can write a basic class file structure from within, based on the GUI. But only once; after that you’re supposed to do all editing in XCode (although I have successfully merged code from successive rewrites). One step in the right direction.

So in my ideal world, the header<->class<->IB relationship would be automated and semi-transparent to the programmer. Create anything anywhere, and all the other stuff should just populate. IB would be a bit more complicated but I think it could be done. But header<->class is an abstraction relationship which humans shouldn’t be bothered with.

I fully expect to re-read this when I’m smarter and be thoroughly embarrassed.

Quick! Learn Cocoa in three weeks!

WWDC begins three weeks from yesterday. So I think it’s time to learn Cocoa. For real.

I’ve attended the last two WWDC’s. It’s not like I’m totally ignorant on Cocoa/Objective-C. I know the Mac’s innards rather well and can read ObjC/Cocoa code fine. I’ve messed around with all the intro examples known to mankind. I’ve done the Headstarts. I’ve gone through at least one book in moderate detail. I’ve written a few mini-programs on my own. But it’s all been to give me a broad knowledge, and I’ve long since achieved that goal.

I’m at the point where I think I can program in Cocoa, but when I open XCode I get the “uh ok what now?” look on my face. I can modify existing code but can’t quite remember where to start, simply because I only launch XCode once every three months. There’s a big difference between reading a language, and speaking that language.

It’s time for some “real” programming. To put pressure on myself, I’ll attempt to blog the next three weeks. I don’t expect many readers but someday, perhaps, I’ll look back on this and laugh at my early mistakes.

I bought the new Hillegass book, Cocoa Programming for Mac OS X, 3rd edition. I’ve gone through the first three chapters quickly. I plan to re-read Chapter 3, on Objective-C, before continuing. Lots to take in, plus I committed the sin of reading while not actually doing the exercises.

I scanned the book’s TOC and index. I was a bit surprised to see no mentions of QuickTime (seriously, it’s not in the index!). But that’s ok I suppose – fundamentals first.

Let’s go!