2009-11-29

New Theatre Production: “Antony and Cleopatra”

Got time for seeing a play? The BUSC proudly presents “Antony and Cleopatra” by William Shakespeare, starting December 11th. The setting is a nod to Brasilian telenovelas. Yours truly puts in a few short appearances as the smarmy lawyer Thidias.

2008-02-23

If nothing’s left …

… is it then all right?

2006-09-30

Installing CAcert’s Root Certificate in Psi on Mac OS X

I’m using the Psi instant messenger (version 0.10) on Mac OS X 10.4.8 with a Jabber server that has an SSL certificate signed by CAcert. Their root certificate isn’t installed in Psi by default, however, so I got a warning message about an invalid certificate each time I connected to my server. I followed these steps to get the CAcert certificates into Psi:

  1. Download the class 1 and class 3 certificates from the CAcert root certificate page in PEM format.
  2. Run the following command in Terminal:
    openssl x509 -in root.crt -fingerprint
    The first output line shows the MD5 fingerprint. Verify it against the fingerprint on the root certificate page.
  3. Open Psi’s rootcert.xml file in an editor. In a standard installation, the path is /Applications/Psi.app/Contents/Resources/certs/rootcert.xml
  4. Add two new <certificate> elements and inside each a <data> element.
  5. Edit the root.crt and class3.crt downloaded in step 1. In each file, remove the first and last line and all newline characters. This results in one long line of gibberish each. :-)
  6. Copy each of the modified certificates into one of the <data> elements created in rootcert.xml in step 4.
  7. Start Psi. The warning about an invalid certificate has disappeared.

2006-02-02

OpenCV on Mac OS X

Some time ago, I managed to compile Intel’s Open Computer Vision library on Mac OS X. In this article, I hope to explain how I got it to work. I’ll list the prerequisites, then explain how to compile and install OpenCV as well as a sample program to get you started. I’ll describe quirks in using OpenCV on the Mac as I stumble upon them. The description of the installation process assumes familiarity with using the command line in Terminal.

I welcome all your feedback and corrections or requests for help. Just send an e-mail, especially if you want to hear back from me, or use the comments link at the bottom right of this article.

Updates

2006-02-02
  • Added a “Quick Start” section explaining how to get one of the OpenCV samples running.
  • I don’t use “Panther” any more, but the instructions still apply.
  • Made a German translation of this article.
2005-09-30
With OpenCV 0.9.7, the tests don't get compiled by default. I’ve updated the instructions to take that into account.
2005-07-28
  • OpenCV 0.9.7 (beta5) is out. This removes the need for a patched distribution because the Linux version works on Mac OS X. This article stays valid since you still need some special configuration flags on OS X, and the FFmpeg patch stays useful as well. I’ve removed the download link for my patched distribution, but the file is still there. However, I urge you to update to 0.9.7 because it contains a lot of bug fixes and improvements.
  • I’ve updated the quirks section with a hint about setting -bind_at_load in XCode and a recommendation to use GCC 3.3.
2005-07-13
The instructions now apply to Mac OS X “Tiger” as well (but have a look at the quirks section if you want to run the tests). I had to update the FFmpeg patch again, so be sure to download the new version (no need to recompile on Panther, though). You can now check whether you have the current version by verifying that the files match the supplied MD5 checksums (if you’re using Safari, it will probably uncompress them for you, so there are separate checksums for the uncompressed files). I’m also using a newer version of Fink now on Panther, but that doesn’t really change anything. I’ve added the need for X11 to the prerequisites section. I was going to recommend using the current CVS version of OpenCV which obviates the need for a patched distribution, but last I checked, there was a bug preventing it from compiling cleanly on OS X.
2005-04-28
I’ve updated the patch for FFmpeg so that the libraries are named and installed in the correct way. The dynamic linker will now no longer complain that it cannot find them. (If you used my previous patch, remove libavcodec* and libavformat* from /usr/local/lib before trying the new version.) I’ve also updated the patched OpenCV source so that the installation involves one step less and the binaries are bound at load time (see the updated quirks section). The test binaries will now build as well, although two tests in cxcoretest fail for reasons unknown to me.
2005-02-15
Turns out the installation of FFmpeg wasn’t quite as straightforward as I thought—I had to run through this process on a Mac that didn’t have any developer tools installed. I’ve added some detailed installation instructions for FFmpeg now in the prerequisites section. Also, I added an item to the quirks section.
2005-02-14
Updated list of required Fink packages according to Tom’s comment (thanks Tom!)
2004-11-27
First published

Prerequisites

My Mac currently runs Mac OS X “Tiger” 10.4.4 with XCode 2.2, but I’ve also tested these instructions with Mac OS X “Panther” with XCode 1.5. I have installed Apple’s X11 (can be found on the OS install CDs/DVD as X11User.pkg) and X11 SDK (comes with XCode as X11SDK.pkg).

OpenCV depends on several tools and libraries. The easiest way to install them is probably via Fink, which is what I’m using (binary distribution, version 0.7.2 on Panther, 0.8.0 on Tiger). You will need to install the following packages (along with dependencies which Fink handles automatically):

You will also need FFmpeg, which isn’t available in Fink (at least not in the stable version). You can either try to use the version in the unstable branch of Fink (which I didn’t), or follow these instructions:

  1. Download the source for version 0.4.9-pre1 of FFmpeg (1.5 MB). I’m using that version since I don’t have time to track the CVS version, where the API might change so OpenCV stops working.
  2. Uncompress the source, switch to the source directory on the command line and apply my small patch (1 KB, MD5 checksum: 41b2d644b9d82f38d3a75c88d9054e4b for the compressed file, 4be5f172eefd5aa1945a2c35d3cda31f for the uncompressed file) (you might have to uncompress it yourself if your browser doesn’t already do so):
    patch -p1 < /path/to/ffmpeg-0.4.9-pre1-macosx.patch
    I derived this patch from the Fink package for 0.4.8, but it’s not as complete.
  3. Configure ffmpeg with the following command line:
    ./configure --cc=gcc-3.3 --enable-shared --enable-pthreads --disable-vhook
  4. Compile and install it (in /usr/local):
    make
    sudo make install

This will get you a version of FFmpeg without any optional capabilities or codecs, but I found it fulfills my needs so far.

Please note that I don’t use camera capturing and have no idea how to get it to work on Mac OS X.

Installation

  1. Download the Linux source distribution of OpenCV 0.9.7 (10 MB), uncompress it somewhere and switch to the source directory on the command line.
  2. Configure the source like this:
    ./configure --with-apps CPPFLAGS="-I/sw/include -I/usr/include/malloc" LDFLAGS=-L/sw/lib CC=gcc-3.3 CXX=g++-3.3
  3. Compile the source and install it in /usr/local:
    make
    sudo make install
  4. If you want to run the included tests, compile them with:
    make check

Quick Start

In order to get up and running, try compiling and running one of the samples in Terminal:

  1. Copy the files morphology.c and baboon.jpg from the samples directory to your home directory:
    cd ~
    cp /usr/local/share/opencv/samples/c/{morphology.c,baboon.jpg} .
  2. Compile the source code:
    g++ -bind_at_load `pkg-config --cflags opencv` morphology.c -o morphology `pkg-config --libs opencv`
  3. Start X11, switch back to Terminal, then run the sample program and play with it:
    ./morphology
  4. To get started with OpenCV programming, read the documentation, starting with the file /usr/local/share/opencv/doc/index.htm.

Quirks

IE to Firefox

I’ve implemented a way of encouraging users of IE to switch to Firefox, as described by Oli.

2006-01-13

Fighting Blog Spam

I switched from the writeback plugin for Blosxom to the feedback plugin. That will hopefully help me fight the blog spam.

2005-12-07

Nobel

Read Harold Pinter’s Nobel Lecture: Art, Truth & Politics. Now.

2005-10-29

Diploma Thesis

By the way: I finished my diploma thesis about two weeks ago …

2005-09-05

Animated Short About “Trusted Computing”

A former colleague has made an animated movie about so-called Trusted Computing. Watch it, the movie and the issue are worth your attention!

2005-02-14

backup2l on Mac OS X

Some months ago, I worked out a satisfactory way of backing up my iBook’s harddisk. The iBook runs Mac OS X “Panther” (version 10.3.8 currently), and since Mac OS X is a UNIX derivative, I thought I’d try backup2l (now at version 1.4). I had read about the tool in Oli’s blog, and in about a day, had it working to my satisfaction.

In theory, I could have used backup2l more or less out of the box. All the UNIX utilities it needs are installed with the BSD subsystem on Mac OS X, e.g. tar, gzip or sed. However, there were two major problems:

  1. When running backup2l with my first test configuration file, there were error messages from utilities like du, complaining about command line options they didn’t understand.
  2. The installed versions of tar and friends cannot safely backup files from the HFS file system used in standard Mac OS installations because they don’t handle resource forks (e.g. a thumbnail for an image file might be stored in the resource fork).

The first problem occurred because backup2l makes use of features that only appear in the GNU versions of the required utilities. The installed versions are not sufficient—this is now mentioned in the README file of the backup2l distribution. Since I make use of the Fink project, I solved the problem by installing the packages sed, findutils and fileutils. It may also be necessary to install the diffutils package, which I already had installed.

The second problem meant that I had to find a suitable command line archiver that could handle HFS, and that I’d have to write my own “driver” for backup2l. I found four candidate archivers:

  1. ditto, which is written by Apple and included in Mac OS X. I’d like to have used it, because the manufacturer would probably know best how to handle HFS correctly. However, although it has a mode that allows you to create archives in cpio format, you cannot pass it a list of files to archive in that mode, which is a prerequisite for using it with backup2l. This is listed as a known bug in the ditto man page, so it may be fixed in the future.
  2. hfstar is a patched version of GNU tar that can handle HFS. I tried this first, because it meant I only had to make a slightly modified version of the standard tar driver in the backup2l script. Everything worked fine until the point where backup2l compares the list of files that should have been archived with the list of files actually in the archive. I saw at that point that hfstar had cut off some long pathnames, which of course made it unusable for my purpose. This may be a limitation of GNU tar—I didn’t investigate further and gave up trying to make this work.
  3. HELIOS Xtar is another version of tar that can handle HFS. After my experience with hfstar, I didn’t even try this, because I assumed it would have the same problem. I may be wrong, however.
  4. hfspax is a hacked, HFS-enabled version of pax, an archiver that also comes with Mac OS X. This is what I ended up using.

I then wrote the driver and added it to the appropriate configuration variables:

CREATE_DRIVER="DRIVER_HFSPAX"

USER_DRIVER_LIST="DRIVER_HFSPAX"

DRIVER_HFSPAX ()
{
    case $1 in
        -test)
            require_tools hfspax
            echo "ok"
            ;;
        -suffix)
            echo "pax"
            ;;
        -create)
            hfspax -w -d -f $3 -x cpio < $4 2>&1
            ;;
        -toc)
            hfspax -f $3 | grep -v "\.\.namedfork"
            ;;
        -extract)
            sed 's#^#/#' $4 | xargs -i -r hfspax -r -pe -f $3 -s#^/## "{}" 2>&1
            ;;
    esac
}

Don’t ask about what this all means—I’ve half forgotten it myself by now. It works for me … Also, please note that this doesn’t use compression.

So, to summarize: If you want to use this, install backup2l and make an appropriate backup2l.conf using the above driver. I’ve been backing up my harddisk (to my iPod, before that to a Linux partition mounted via NFS) for some months now without problems, but I can’t guarantee that it will work for you. So, handle with care, and make sure restoring works as well.

And one quirk: the date output in the backup summary only works if you also install a GNU version of date. This isn’t provided in the Fink stable distribution, so I didn’t bother.

2004-12-31

Fair’s fair

Microsoft has changed its website as well now (screenshot (JPEG, 111 KB) in case it’s gone). I still like Apple’s version better.

2004-12-30

Apple vs Microsoft

www.apple.com (screenshot (PNG, 122 KB) in case it’s gone already)

www.microsoft.com (no screenshot because there’s nothing special to see)

It’s these little things that make the difference to me …

2004-11-09

Firefox 1.0 released

’Nuff said.

2004-10-27

New York Times Firefox Ad Donation

I just donated $10 for the Firefox ad to appear in the New York Times—via Oli’s link, before I realised I could have used my own account and grabbed the affiliate credit for myself. Well, once in a while I can allow myself to be altruistic by accident instead of by design. ;-)

2004-10-12

Shake a Tower

Isn’t it nice to take a shower in the morning? Of course, unless you happen to realise afterwards that you forgot to bring a bath towel and have to dry off with the small towel that you keep near the basin. Sigh. I guess I’m still not a guy who knows where his towel is.

2004-10-08

Fucking Flies! (2)

Update: They are moving, but really slow. Maybe some kind of tantric sex. Hot action pix here!

Fucking Flies!

No really! I just returned to my notebook, and there are two flies having sex in the top right corner of the display. Doesn't seem to be much fun, as they’re both not moving …

2004-01-21

Wake up now!

Just found out about two very cool alarm clock designs: A Puzzle Alarm Clock (if you're the type who can turn off their alarm clock while asleep, thereby defeating its purpose), and a Sunrise Alarm Clock.

2003-11-12

I’m not a vegetarian, but:

“What is the Meatrix?” (Flash movie)

2003-10-08

Ring ring ring …

Found a very cool ring tone, obviously for a new SonyEricsson mobile phone: Ring ring ring (MP3)

2003-10-06

Learning the hard way

I just found a naughty bug in one of my Java projects. I was using a StringTokenizer to parse a string separated by semicolons into a list:

StringTokenizer tokenizer = new StringTokenizer(tokenString, ";");
List tokens = new ArrayList();
for(int i = 0; i < tokenizer.countTokens(); i++) {
    tokens.add(tokenizer.nextToken().trim());
}

Can you spot my mistake? The countTokens() method doesn't actually give you the overall count of tokens in the string. It calculates how many tokens are left, i.e. how many more times you can call nextToken() without getting an exception! So of course I was getting too few entries in the list.

Now being the good boy that I am, I had of course written a JUnit test for the related class. Among other things, it tests whether the list parsed from a well-known string was the same as the one parsed from a string from an external source by the class to be tested. Of course, I used a similar tokenizer loop …

And the morale is of course: Write unit tests, but don't trust them blindly. After all, somebody has to control the controller.

By the way, the correct loop is this:

while(tokenizer.hasMoreTokens()) {
    tokens.add(tokenizer.nextToken().trim());
}

2003-09-15

King of the Hill

Went to work by bike. Climbed the uphill part without having to dismount and push. Happy now.

2003-08-29

New design

To be strict, it's the first design that doesn't have to be ashamed of its name. I haven't tested it in IE yet, but it probably produces the usual chaos.

By the way, the colour #AA0 looks like perfect barf …

2003-06-02

Why? Why not!

Weblogs are all the rage. So why shouldn't I have one, too? After all, I found this nice little blogging tool called blosxom … Of course I have to tinker with the templates a bit so it won't look quite this boring.