A Peek At MarsEdit 2

July 16th, 2007

Since I took over development of MarsEdit back in February, a lot has happened! I’ve released several bug-fix releases, and a modest 1.2 feature release, which added support for Growl, image uploads to Picasa for Blogger users, and early support for the Vox weblog system.

And of course, I heard feedback. Lots of feedback. MarsEdit users know what they want, and they’ve helped shape the priorities for the next major release of MarsEdit. And working on MarsEdit 2 is how I’ve spent a great deal of my time over the past few months.

I don’t want to give too many details away, because (crosses-fingers) things can always go wrong and features get pulled, but the release is starting to gel in some areas. Here is a sneak-peek at the new post editor window as it stands today:


(Click for full-size image)

Suffice to say, there are some features you can glean from the screenshot. The post editor window, and some other important parts of the user-interface, are being given a significant overhaul. I think most MarsEdit users will find it a refreshing cleanup, that manages to pack more features into MarsEdit without ruining its visual simplicity.

As for the complete feature list. Well, why don’t we wait until the features are actually complete :)

Suicidal Code

July 13th, 2007

Some code is not meant to live forever. In particular, during development phases of projects, it can be very reassuring to know that a particular release of an application will have a short life-cycle, because you’ll be (relatively) assured that users aren’t accidentally running crufty old (development!) versions of the app.

The basic means of accomplishing this is to put a date check in your code that determines if a certain time has come and, if it has, refuses to run any longer. Anecdotally, I can tell you that lots of developers do something like this. But I can also tell you that lots of developers do it the error-prone, labor-intensive way. I did too, until I picked up a great tip from Brian Cooke a while back, that completely automates the process.

The laborious and error-prone method involves manually typing into your code a particular date in the future, and using that date as the test for whether or not to keep running. Brian’s brilliant observation was that the future date is almost always some number of days from “now,” where “now” is the date the code is being compiled. Using a gcc predefined macro, __DATE__, the code can know for itself when it was compiled, and build in an expiration date based on that value.

// Two-week expiration
#define EXPIREAFTERDAYS 14

#if EXPIREAFTERDAYS
   // Idea from Brian Cooke.
   NSString* nowString = 
      [NSString stringWithUTF8String:__DATE__];
   NSCalendarDate* nowDate = 
      [NSCalendarDate dateWithNaturalLanguageString:nowString];
   NSCalendarDate* expireDate =
      [nowDate addTimeInterval:(60*60*24* EXPIREAFTERDAYS)];

   if ([expireDate earlierDate:[NSDate date]] == expireDate)
   {
      // Run an alert or whatever

      // Quit!
      [NSApp terminate:self];
   }
#endif

By putting code like this in all of your projects, you have at your disposal a simple, error-proof way of releasing a build that will stop working N days from now. When you’re ready to release a non-suicidal version, just change the EXPIREAFTERDAYS preprocessor macro to 0. Nifty, eh?

PS: Thanks to Jon Trainer for inspiring this entry by thinking the idea was cool when I told him about it.

Update: Rosyna points out that dateWithNaturalLanguageString might be a dangerous method to use here, because it will implicitly use a different locale to parse the string, depending on the user’s language settings. Furthermore, the documentation for that method strongly discourages its use. Ironically though, the reason its use is discouraged, because it’s got a limited vocabulary and favors English, is probably just about right for parsing the date from GCC.

The GCC documentation describes the contents of __DATE__ as “eleven characters and looks like ‘Feb 12 1996’.” I’m not really sure how many locales this will or will not work correctly for, so I’m thinking the safe bet is to use a more explicit string -> date conversion format. I’m busy with something else right now but if anybody has a good capsule solution for this, please share it in the comments! Rosyna suggests offline that perhaps some POSIX date string formatter will do the trick.

Wil Shipley On iPhone’s “SDK”

July 9th, 2007

If I wanted to program in a crappy language just so I could get more customers, I’d switch to Windows, not stinking JavaScript.

Pretty much sums it up for me, too. Wil makes this point and about a million other cutting and accurate remarks about Apple’s sloppy presentation of web development as an “SDK” for the iPhone. It’s a common theme among developers that we feel burned not by the lack of an SDK, but by the fact that Apple expects us to believe that this is one.

iPhone’s AJAX SDK: No, thank you.

Interview With Ars Technica

June 28th, 2007

I met so many amazing people at WWDC, among them Jacqui Cheng and Clint Ecker of Ars Technica.

Imagine how honored I was when they invited me to be interviewed on video for the blog? I think it came out pretty well, all things considered. You’ll get a sense for my speaking voice, and also hear my words drowned out by downtown San Francisco traffic!

Ars at WWDC: Video Interview with Daniel Jalkut