History Repeating Itself: wxUniversal

I work with a cross-platform toolkit called wxWidgets. The idea is that the wxWidgets classes are all wrappers around real platform-native widgets, so that you can program with a “wxButton” and it is implemented on Mac as a Carbon button, on Windows as a Windows button, on Linux as a GTK button, and so on. (No Cocoa buttons for Mac! Cocoa’s GUI architecture is too deviant from the norm for the wxCocoa project to have gotten very far.)

I mentioned this to my friend Eric, a Java dude, a year or so ago, and he said, “oh, just like the old awt!” I was a bit taken aback, because the Java awt (abstract windowing toolkit) was a notorious failure. Awt-based applications were ugly and tended not to work right on platforms other than the one they were mainly developed on without major bug-squashing effort.

Kind of like wxWidgets applications….

I put it out of my mind until, googling for information on making universal binaries for wxMac applications, I came across wxUniversal.

The wxUniversal port is a SciTech Software-sponsored project to create a set of widgets that are implemented in wxWidgets itself. In all previous ports, with some exceptions, each widget class is a wrapper around an existing implementation on that platform. A wxUniversal-based port therefore needs only need a relatively straightforward effort on each new platform, to provide basic classes such as wxWindow, wxFrame and wxDC.

Wow, that’s… that’s exactly what Java ended up doing with Swing. They implemented widgets themselves, so they only had to port some basic drawing and event primitives from platform to platform, and they weren’t burned by differences in architecture between various platform-specific widget sets. Then Swing implemented “pluggable look and feel” to allow it to adapt to the look and feel of the various target platforms, so it could blend in without actually using the native toolkits…

wxUniversal supports a theme system to change the look and feel, and there are currently two themes: WIN32 and GTK+.

DOH! History repeats itself again. And I’m a decade late.

Rmagick

To write a rails app that manipulates images (e.g. makes thumbnails), you need the extension rmagick. Rmagick is hard to install, as its web page notes:

RMagick can be more difficult to install than the typical Ruby extension. First you have to install ImageMagick or GraphicsMagick, and those libraries require a lot of other libraries.

I wanted to install it on my Mac without depending on Fink or MacPorts so it wouldn’t be vulnerable to my wiping out Fink or MacPorts in a fit of anger and resentment.

In retrospect, I could have installed it without immense pain by consulting the aforementioned web page. Also, I ran into trouble compiling libwmf, which was related to the ‘gd‘ graphics library, so I decided to try installing gd on its own first; it turns out gd has a great document about solving problems that arise compiling on OS X, and many of the tricks there help with other prerequisites.

Finally I had to make my own little fix by going to /usr/local/share/ghostscript and doing the following:

sudo ln -s 8.56/fonts ./
sudo ln -s 8.56/lib ./
sudo ln -s 8.56/Resource ./

because rmagick was looking for fonts in /usr/local/share/ghostscript, not /usr/local/share/ghostscript/8.56. (The lib and resource links may not have been necessary but I did them to be thorough.)

After only a half dozen lengthy false starts and staying up till 1 AM messing with it, I had me a working copy of Rmagick! Huzzah for libraries that depend on libraries that depend on libraries that depend on libraries, where a problem compiling any one of them can hose you completely!

Vimeo / Lip Dub – Flagpole Sitta by Harvey Danger

Vimeo / Lip Dub – Flagpole Sitta by Harvey Danger:

Despite the fact that it contains enough young, hip, attractive, happy, dancing people to make me puke, this video is fun and clever. Worth a watch. Via pop culture will eat itself, which reports that the people in the video are the staff of some successful internet humor and t-shirt company, which means this is what their work day is like, which is even more hateful.

On second thought, fuck them. Don’t watch the video. Just click here and be surly with me.