Skip to content

Using OmniGraffle with Subversion without Sadness

OmniGraffle is an awesome charting and drawing tool. Subversion is a great version control system. Unfortunately, by default, they don’t work perfectly
together.

That’s because OmniGraffle has (at least) two formats for its files: a flat XML file, and a “bundle”, which is actually a special folder containing a bunch of files. By default, OmniGraffle makes flat files, but if you add an image to your document it will magically turn into a bundle and store the image in the filesystem.

If you’re using this with Subversion or SVK, this is a problem for at least three reasons. First of all, most version control systems don’t deal too well with files suddenly turning into directories behind their backs. Secondly, if you add more images, OmniGraffle will add them to the directory, but Subversion will have no idea that these new files should be under version control, and you’ll have to manually svn add them.

More annoyingly, the bundle format used by OmniGraffle puts a file in the bundle which sets the bundle’s icon, and the file is named Icon\r. With a carriage return in it. Yeah. I’m not sure what they or Apple were thinking (as far as I can tell this is one of many ways to set a document bundle icon and I can’t find other apps that use this one), but putting control characters like a carriage return in file names just sucks. And to tie back into the point of this post, Subversion just won’t let you check in that file.

There’s a solution, though, at least for OmniGraffle! Just type the following line in your terminal:

defaults write com.omnigroup.OmniGraffle PrivateGraffleFlatFile 0

(Or if you run OmniGraffle Pro, you apparently should do

defaults write com.omnigroup.OmniGrafflePro PrivateGraffleFlatFile 0

though I haven’t tested this.)

This will make OmniGraffle make all future files as the flat-file format and never sneakily turn into bundle format. Hooray!

Screenshot of the day

I double-clicked on a diagram in a word document that I received:

Word cannot open the Microsoft.

That is all.

Versioning Data Formats

A simple rule for designing data formats: if you want your data format to declare in-band what its format version is (and you probably do), then you MUST guarantee that the version identifier appears at a relatively fixed position near the top and is parsable with a minimum of effort.

vCalendar 1.0 and its successor iCalendar 2.0 fail here: they require a VERSION property, but don’t mandate that it appear anywhere near the top. iCalendar is even worse, by allowing arbitrary non-standard properties (with parsing rules that differ from vCalendar’s) to appear on the VERSION line. And in both cases the VERSION line can be line-folded, except that the line folding rules are slightly different between the two standards.

I have almost managed to create a file that parses successfully (including VERSION line) as both iCalendar and vCalendar. For example:

BEGIN:VCALENDAR
PRODID;ENCODING=QUOTED-PRINTABLE:Something=
VERSION:2.0
VERSION:1.0
END:VCALENDAR

contains the line VERSION:2.0, and yet is a perfectly valid vCalendar 1.0 file. (The fact that the line folding examples in the vCalendar spec are wrong doesn’t help either.)

Bah. Don’t do that. What would the harm would have been in saying BEGIN:VCALENDAR[1.0]?

Darwinports

For a Best Practical project, I’ve had to deal with the bad idea that is known as WAP Binary XML. In August I wrote Perl bindings to the libwbxml library. I recently started using darwinports on my PowerBook to manage open-source software, so when I had to reinstall libwbxml yesterday, I realized it was actually easier to set it up through darwinports than by hand. So, my first Portfile.

Starting

I’ve had a personal blog for a while, but it never felt like a good place to post tech-related stuff. So, now this.

My name is David Glasser. I am a student at MIT. In June I will finish my bachelor’s degrees in computer science and mathematics and become a Masters of Engineering student in computer science. Last summer (and when I’ve found time since then) I worked for Best Practical Solutions.