Twitter Stream

Flickr Photos

Archive for January, 2007

Objective-C Rocks Your Socks

Saturday, January 20th, 2007

People who don’t know a thing about Objective-C are always asking me why I’d want to learn a special language “just for Mac programming” or why I like it more than most other programming languages in general. I think this is a great code snippet that made me stop and say you could NOT do this so elegantly in C++ or many other languages.

NSArray *participants = [archive valueForKey:@"participants"];
NSEnumerator *en = [participants objectEnumerator];
User *user = nil;

while (user = [en nextObject]) {                    
    // do stuff with the user
}

So what’s fascinating about this simple block of code? Let me explain. Lets say archive is a regular NSDictionary object, and participants is an OPTIONAL key/value in this dictionary which could contain an array of Users. How does that affect the rest of our code? Well that means the NSArray participants will be nil. So what happens when you call objectEnumerator on a nil object? An error? Nope! calling a message (any message) on an nil object returns nil. So that means en, our enumerator, becomes nil. Now when we get to our while loop calling nextObject on en will also return nil. Thus the loop terminates gracefully without any error checking code, an no sig-faults from calling our “nil” objects. I’ve just written code that not only performs it’s task but gracefully degrades even under optional conditions.



Yahoo! Messenger Beta 2

Tuesday, January 16th, 2007

Yahoo!’s starting to announce some details of the forthcoming Beta 2 (sorry for such a long delay between beta releases but there is a good reason.) We’ve got some coverage over at Ars Technica and TUAW. Here’s a rundown of the stuff coming:

  • Tabs - Hoorah! We’re in the 21st century with client features. Even iChat hasn’t caught up here yet. Although Chax helps out there
  • Archiving - This one was braindead obvious. We didn’t get it done in time due to political reasons
  • Spotlight searching - Goes along with archiving
  • Voice Chats - As we said in the release notes for Beta 1, voice is coming.

So there you have it. There are obvious bug fixes and other things coming that I can’t talk about, but that should hold most people over until we release the final version of 3.0. The (huge) delay in our beta 2 release is basically because of Voice — it takes time porting software across platforms. However never fear, it will be awesome!



iPhone released

Tuesday, January 9th, 2007

iPhone size comparison
Originally uploaded by freshyill.

Well they did it, and beyond my most wild expectations — the iPhone actually got released. I was surly betting against this one mostly because it was the one Apple product I wanted the most and that usually means it’s the one thing I won’t get. This pic shows the dimensions relative to other phones / devices on the market. It’s not too bad really. For a bit larger than a 30gb ipod you get the whole package.



HUGE iPod Mini

Tuesday, January 2nd, 2007

AppleMini
Originally uploaded by Philapple.

I think Apple went a little overboard on this one.