Find Gremlins With BBEdit

February 26th, 2008

MarsEdit has a little shortcoming that can cause a vexing situation from time to time. It takes what you type or paste into it a bit too literally. So if you flub up at the keyboard and make some wacky keystrokes, you might end up with a weird “invisible character” in your blog post. What happens on most systems when you then go to publish, is you get a very unfortunate error message in return.


“Parse Error. Not well formed.” How lovely!

These tricky characters are especially sinister because you can almost never see them. When you end up with one of these bad boys in your post, the only hint you might get is if you are moving the cursor around with the arrow keys, you might see it “hiccup” a second while it stops on the invisible character.

I’m sure there are a lot of different names for these unwelcome guests in text, but I like the one the folks at Bare Bones use: “gremlins”. Their fine editor, BBEdit, has a dedicated tool just for rooting these suckers and either eliminating them or making them visible: Zap Gremlins.

I’d like to add something similar to MarsEdit, so I can spare users the pain of having to figure this out when run into an error dialog such as the one above. But in the meantime, I’ve been resorting to handling the customer support inquiries by myself taking the user’s example text into BBEdit and looking for gremlins. Then I can point out the location of the offending character to the user, they backspace it out of existence, and life goes on.

As relatively painless as BBEdit’s function makes the task, it’s not really perfectly suited to what I need. It’s more aimed at eliminating the beasts than examining them. Whereas I want as much information as I can get about them, so I can effectively communicate to the user (and also so I can catalog what types of characters users are running into trouble with).

Thanks to AppleScript support for the Zap Gremlins function, I was able to whip up a pretty handy script to streamline this operation. Find Gremlins takes the text contents of the clipboard, runs Zap Gremlins on it to find the gremlins, and then displays a summary of what it knows about them.

It gives me all the details I would normally have to work hard to figure out. What is the character? Where is it exactly, and most importantly of all, shows the character in context, replaced by a bullet for easy visibility. Although adding the text to a BBEdit document and manually examining the gremlins wasn’t too much of a time waster, it was still a bit boring and tedious.

I realize finding gremlins in the clipboard text will be useful to approximately 0% of you, but I thought it was a good opportunity to demonstrate how AppleScript support for the features of an application can turn out to serve incredibly particular needs. Thanks, Bare Bones! Zap Gremlins is saving me time, and helping me get my customers back to blogging in comfort.

Update: Thanks to reader Daniel Blanken who noticed a bug in the script that prevented it from finding gremlins very close to the beginning or ends of the selected text. I’ve updated the script with his fixes.

Acorn 1.1

February 25th, 2008

When Gus Mueller released Acorn, his fundamentally rethought bitmap image editing app, I was excited. Partly because it filled a void in my tool belt, but more because I knew it was the start of something big.

The best thing about a 1.0 release from any skilled developer is you know it’s only the tip of the iceberg. It’s like the debut of a thrilling new television series, or the opening of a great restaurant in your neighborhood. You’re gratified by the immediate rewards, but what’s perhaps more comforting is the promise of more good things to come.

For this lovely little app, good things are starting to come. Congratulations to Gus on today’s release of Acorn 1.1! I’m already looking forward to the next episode.

A Year Of Martian Sweaters

February 23rd, 2008

Somehow I managed to let yesterday pass by without remarking on the momentousness of the day. February 22, 2007 was the day Red Sweater acquired MarsEdit. I can’t believe it’s already been a year. Time has just flown by.

It’s been a lot of work, but when I compare version 1.1.2, which I acquired, to the latest release, it’s clear to me that the work is paying off. Coincidentally, the latest release is 2.1.2. How about that? I “lapped” the odometer, so to speak.

What will the next year bring? Perhaps by February, 2009, I’ll be remarking on all the progress that added up to what we know and love in 3.1.2!

Rogue Displays

February 21st, 2008

The folks at Rogue Amoeba have a product called Airfoil, which enables sending arbitrary audio streams to “AirTunes” devices. They just updated it to add support for streaming to your Apple TV. While Apple TV is receiving this streamed audio, it shows various information about the sender, which gave Rogue Amoeba an idea for doing something very “Mac-like.”

They might have been content to show the name of the computer, or a generic picture of a Mac, or even a picture of your particular Mac. But they took it one step further and decided to show a picture of your Mac with your current desktop imposed on it.

Guy English, the developer who came up with this trick, explains how he did it in the Rogue Amoeba blog. Click the link to see how it actually looks on an Apple TV. In a nutshell, he identifies the portion of the computer’s icon that is the “screen” and replaces it with your actual screen content. To make it useful, it shows only the desktop and the app that is sending audio. But for example, if I was writing this blog post and sending MarsEdit’s audio to an Apple TV, the image he’d have to work with might look like this:

Nice! I think it’s fair to say this is one of those nuanced touches that ultimately doesn’t improve the function of a product by all that much, but improves the feel of a product (and its company) by a great deal.