Archive for the ‘Programming’ Category

Micro-huh?

Thursday, April 3rd, 2008

As reported by Macworld: “Exec touts developing iPhone apps without SDK”:

There are more ways to develop applications for the Apple iPhone device than using the company’s beta iPhone SDK. Through a combination of Microsoft and other technologies, developers can build a Web application for the iPhone, according to a speaker at the VSLive conference in San Francisco on Wednesday.

How would you use Microsoft technologies to make an iPhone application? Oh, right: VSLive = Visual Studio Live. Got it. Know your audience.

“Don’t worry about rubber-tired vehicles,” said a speaker at this week’s blacksmith convention. “They can’t take you anywhere a well-shod horse can go.

“And besides, they won’t let you make your own tires, which I find kind of offensive.”

Little details mean a lot

Tuesday, March 4th, 2008

I’ve just filed my 2007 taxes using the much-maligned TurboTax. (I filed my 2005 taxes this past January, so I’m doing much better this year.)

TurboTax for the Mac appears to have been completely rewritten with an eye towards satisfying the Mac customer, which is a refreshing change for Intuit. (It will be interesting to see how their Financial Life product looks this fall.)

As a good example of leveraging the foundations of Mac OS X to provide specific functionality for the customer: I was pleasantly surprised to be given these choices for saving my return after filing:

  1. “Print returns” (I routinely “print” to PDF, but Mac OS X already makes this easy);
  2. “Backup to .Mac”: this puts a copy of my TurboTax data file, as well as a PDF with my return and all supporting worksheets, into a folder (Documents/TurboTax/2007) on my .Mac disk;
  3. “Burn to CD”: this uses the standard disc burning interface to put a copy of my data file as well as the TurboTax application (fully updated, as far as I can tell) onto a CD. Brilliant. (I can’t tell you how much time I wasted looking for the 2005 software. The fact that it wouldn’t run under Leopard once I found it is another issue entirely…)

These are the little details that Mac users expect in their software (otherwise they wouldn’t have bought a Mac), and companies that pay attention to things like this should be able thrive in the Mac marketplace. Granted, Intuit’s reputation on the Mac is in tatters (and deservedly so), but I’m much more inclined to check out Financial Life now than I was before.

Dancing with the elephant (revised)

Saturday, November 3rd, 2007

While gathering information about application compatibility with Leopard, I notice one developer, Snerdware, is struggling to keep up with the situation. They report two major problems that affect their current applications, and, with some evident frustration, blame both of them on Apple. [Note: I’ve substantially rewritten my commentary on the first issue, since I’ve learned additional information and since my main point applies to the second issue.]

The first issue affects both their products; the report here is for AddressX:

AddressX won’t startup on 10.5.0/Leopard running on an Intel-powered Mac (a log indicates “… Reason: no suitable image found. Did find: /usr/lib/libcrypto.0.9.dylib: mach-o, but wrong architecture. …”).

When we looked at the 10.5 pre-release, we encountered an OS X library issue — it installs a non-universal/PPC-only version of a library that’s critical to our applications (and, of course, all our developer systems are Intel-powered). ‘Though we filed a bug report early in October (original Problem ID: 5520955 and have now re-filed it), believe it or not, it’s still a problem with the released/commercial version of 10.5.0 (even without the bug report, you’d think that a check to ensure all binaries are universal would actually be a basic QA step — it’s one that’s easily automated!).

After corresponding with someone named Bryan D. at Snerdware and doing a little more research, I’ve learned the following things which make me more sympathetic to their problem than I originally was:

  • Apple includes two versions of libcrypto: one called libcrypto.0.9.dylib, and one called libcrypto.0.9.7.dylib, and a symbolic link libcrypto.dylib that points to the newer library.
  • In Leopard, the newer library is indeed a four-way universal binary, but the older library is PowerPC only. I originally assumed this was because only pre-Intel applications would require it, since libcrypto.0.9.7.dylib has been available in Mac OS X at least as far back as 10.3.9; and so Snerdware was making a mistake by linking to the older library and then complaining that it wasn’t universal.
  • But it turns out that Snerdware relies on features that are present in the older library (which corresponds to libcrypto version 0.9.6l), but have been removed for some reason from the newer library.
  • More strangely, Apple did include a universal binary of libcrypto.0.9.dylib in the Intel versions of Tiger, but strangely left it PowerPC-only in Leopard. Huh?
  • Snerdware originally considered compiling the older library into their program, but since it’s crypto there are all kind of export regulations that come into play (and believe me, I know about this; I had to research exactly this topic at a previous job).

Hopefully this was indeed an oversight that can be fixed in a future update; otherwise, Snerdware has a problem with no easy solution, and some portion of the blame lies with Apple.

The second issue is a more fundamental problem, and one that affects nearly all Mac developers — Apple has a history of making significant changes to core system services between OS versions. I presume that Apple doesn’t do this maliciously, but there are plenty of developers who will tell you they’ve been burned by Apple changing or dropping technologies. Apparently Snerdware is once burned and twice shy:

Since we’ve previously been seriously “bitten” by Apple’s last-minute major changes to developer pre-releases, we can’t afford to take pre-releases seriously until they are near release. […]

With the imminent release of 10.5.0, we […] discovered that, even ‘though OS X’s Sync Services has the same interfaces and we’ve seen no documentation/release notes that document subtle but significant changes in behavior, we see that the behavior has changed in a way that will cause us to make very major changes to Groupcal … Given that Groupcal was working very well with 10.4, this is more than annoying for us, as well. Be angry with Apple, not with us.

[…] It’s things like this that make it much more difficult for an OS X product to be a viable business proposition.

Here I have a harder time finding sympathy. By their own admission they waited until the last minute to check whether the behavior of Sync Services had changed, and now they report to their users that their flagship product won’t be compatible until the first quarter of 2008, and point the finger at Apple?

(Luckily their target market appears to be corporate workgroups running Exchange servers, and those folks are less likely to be rushing out and upgrading to Leopard, so Snerdware may have some time there.)

If my livelihood depended on my product operating correctly with Sync Services, I wouldn’t rely on Apple keeping its behavior unchanged from release to release; I’d be booting up each Leopard seed on a non-critical system and checking things out. Perhaps I’d muster up the resources to send a developer to WWDC, where Apple encourages you to bring your code, try it out on the current seed, and discuss problems with the Apple engineers who have come up from Cupertino for the week for just this reason.

(To be fair, I don’t know that Snerdware didn’t do this; but with the “can’t afford to take pre-releases seriously” comment above, I somehow doubt it.)

And then — well, maybe Sync Services does change in the September seed and I still have a lot of work to do — but wouldn’t I’d be five weeks further along?

If you choose to dance with an elephant, you can approach it one of two ways — you can wait for the dust to settle, and then see what the lay of the land is; or you can try to be more nimble and maneuver around the elephant. We independent developers are supposed to be more nimble… aren’t we?

[But sometimes, even if you’re nimble, you can get still stepped on…]

Ruby vs. Python (take 147)

Tuesday, July 25th, 2006

Tim Bray, a new student of Ruby, admires it for its readability, and compares it to Python:

In theory, Python ought to do better, lacking all those silly end statements cluttering up the screen. But in practice, when I look at Python code I find my eyes distracted by a barrage of underscores and double-quote marks. Typography is an important component of human communication, and Ruby’s, on balance, is cleaner.

John Gruber concurs:

Now that I think about, those underscores and extra quotes are exactly why Python does not appeal to me. I find Python’s indentation-as-block rule to be quite elegant, but its use of punctuation feels clumsy.

As a Python programmer (but not a Ruby programmer), I have to say:

Huh?

I respect both Bray and Gruber, but I don’t see their point. At all.

When I look at my Python code, I see underscores in two contexts. The first is in the names of “special” methods and attributes. In practice for me, this is largely limited to __init__, since I rarely need to overload operators. (And this syntax makes such identifiers stand out as “special”. Who’s to say that this is less attractive than Ruby’s use of $ to mark global variables? Are underscores uglier than dollar signs?)

The second, more common use of underscores in my code is in long Cocoa method names, because by convention in PyObjC they replace the colons in the Objective-C selectors. Those underscores are generally acknowledged as ugly by the PyObjC community, but accepted as a necessary evil. I suspect Tim Bray is not writing PyObjC code. (Maybe he’s writing more special operators than I am.)

As for quote marks (single or double), the only “barrages” I can think of are in multi-line string literals, which are frequently used as documentation strings (or comments, effectively). I suppose this criticism might come from the common use of string literals as symbols — e.g., as keys in dictionaries (hash tables) — where Ruby has an actual symbol type, whose syntax is borrowed from Lisp keywords (a prefixed colon).

Whereas if one wanted to criticize a language for “clumsy” punctuation, one might point to any of the fourteen-odd uses of non-alphanumeric symbols in Ruby found here: marking different kinds of variables with $, @, @@, and &; four kinds of “quoting mechanisms” with %X{..}; etc. (Is that Perl I hear calling?)

Perhaps that’s why neither Bray nor Gruber commented on the controversial use of @ in Python to mark the user of a decorator function.

So I have to say I just don’t get it. To each his own, I guess. I see that Ruby is getting a lot of buzz these days, in large part because of the success of Rails, and that’s fine; if I had to throw together a quick web application I might investigate Rails too. Perhaps it’s just that I came to Python first and don’t really know Ruby very well.

Still, to me, saying Ruby’s use of punctuation is “cleaner” than Python’s is (to paraphrase Gruber) like criticizing the iPod because it doesn’t come in white…

PyWikit

Thursday, June 22nd, 2006

In response to a challenge in the Mac forum at Ars Technica, I’ve banged out a quick service that adds “Search With Wikipedia” to your Services menu (right below “Search With Google”). It’s called PyWikit because (a) somebody suggested “Wikit” for the name and (b) I wrote it in Python, using PyObjC.

To use it, download it and move it to your ~/Library/Services folder. At the moment you will probably have to log out and log in again to update your Services menu. If I get motivated I’ll build an installer, someday. (Unlikely since I’ve only spent about an hour on this, most of which was taken up building a universal binary for PyObjC. While it is true that PyObjC rocks, its universalness is still a little, uh, rocky.)

SubEthaEdit for $0 is a great deal

Tuesday, April 25th, 2006

SubEthaEdit from CodingMonkeys is an excellent collaborative editor that I’ve used to help create session notes at past PyCons. Many people also use it as a programming editor, although to date I’m still in the BBEdit camp.

Now, as part of BLOGZOT 2.0 on MacZOT.com, MacZOT and TheCodingMonkeys will award $105,000 in Mac software — specifically, free SubEthaEdit licenses (if enough bloggers link back to the web site to reduce the license price to $0).

Obviously, the intention is to drive a lot of visits to the MacZOT site, but SubEthaEdit for $0 is a great deal no matter how you slice it. (And MacZOT is an interesting idea itself; I’ve used it once or twice to spring for software I might not have otherwise bought, when the discount pushed the price down to impulse buying levels.)

(Thanks to Matt Deatherage for the heads-up.)

Update: Yes, enough bloggers fell for the offer to drive the cost down to $0, and I got my free license code over the weekend — thanks, MacZOT and Coding Monkeys!

New Tiger window style documented… sort of

Monday, June 20th, 2005

The new “unified title and toolbar” window style I previously commented on has now made an appearance in Apple’s documentation. Unfortunately, it just tells how to activate the feature from Carbon. We’re still waiting guidance on when to use it…