SWIG me gently from Mr. C to Mrs. P

I prepared a presentation on SWIG for our internal institute discussion group recently and ran into a couple of unexpected problems. One of the big advantages of SWIG is that it’s well-documented and there are many tutorials but still I did not find the solution to my problems instantly (i.e. using a simple Google search). That’s why I’m wrapping up my results in this blog entry for those that might have had similar problems.

Disclaimer: [SWIG](http://www.swig.org/) is only one of many interface generators to integrate your C/C++ code in a Python environment. There is a good comparison of different wrapper tools in [Python Wrapper Tools: A Performance Study](http://people.web.psi.ch/geus/talks/europython2004_geus.pdf). SWIG seems to be somewhat slower than native Python/C wrapping, SIP or Boost.Python, but still I find it much more intuitive to get a working solution quickly (if you read the complete documentation including tutorials which I obviously didn’t at that point).

In the following, I will give two examples of what can be done with SWIG. First, I will show how to integrate a [C implementation of suffix arrays](http://www.cs.dartmouth.edu/~doug/sarray/) within Python. Second, I will give an example of how to swig a C++ implementation of edit distance (aka Levenshtein distance) into Python.

„SWIG me gently from Mr. C to Mrs. P“ weiterlesen

1. April am 9. Mai

Also manchmal muss man ja im Nachhinein schmunzeln. Diesmal sogar mit mehr als einem Monat Verspätung. Ich bin nämlich gerade zufällig über das da gestolpert:

[~]$ ls *sh*
-rw-r--r--  1 me assi     29 2008-04-01 11:48 dummy4qsub.sh.e186301
-rw-r--r--  1 me assi   1072 2008-04-01 11:48 dummy4qsub.sh.o186301

[~]$ grep '| >' dummy4qsub.sh.*
dummy4qsub.sh.o186301:| > #!/bin/bash
dummy4qsub.sh.o186301:| > 
dummy4qsub.sh.o186301:| > printenv

So ’nen Scherz kann sich nur jemand mit root-Rechten erlauben. Na wartet, da muss ich mal den exploit rauskramen, um es euch heimzuzahlen. 😉

Ubuntu Hardy Crapon

Ok, now I’m really pissed with all this Ubuntu crapology of upgrades. I changed to Hardy Heron recently and have to realize that the blinking cursor of the gnome-terminal _cannot_ be disabled via one’s profile any more. After searching the web I saw that this option [was moved](http://bugzilla.gnome.org/show_bug.cgi?id=342921) to the System->Preferences->Keyboard setting where a blinking cursor can be disabled for *all* apps including gnome-terminal. Following the Gnome standard of usability bullshit. C’mon guys, that really, and I mean _really_, kind of sucks. I think I’m not the only one who prefers the big crappy gnome-terminal cursor _not_ to blink, whereas the standard cursor, this tiny horizontal hint of a line, should be fine with blinking here and there. \*sigh\* Maybe I should stop complaining and switch to fvwm and urxvt… Or give the famous [Arschlinux](http://www.archlinux.org/) a try.

1. Erstes Kapitel

Ein [Spiegel-Online-Artikel über LaTeX](http://www.spiegel.de/netzwelt/tech/0,1518,549509,00.html), der Emacs zurecht als „mächtigstes Computerprogramm überhaupt“ preist. Das ist natürlich wahr, jedoch hat der Autor des Artikels den Sinn von LaTeX leider nicht verstanden, wie man im [Beispielbild](http://www.spiegel.de/netzwelt/tech/0,1518,grossbild-1160987-549509,00.html) deutlich sehen kann. Herr Zschunke, fragen Sie das nächste Mal lieber vorher ein paar Texperten. 😉

Interview im Magazin Musiceque .2

Gerüchten zufolge werkelt Yonker erneut an einem neuen Album. Die Single-Auskopplung „Smoothology of Interest (part i)“ soll dementsprechend fast fertig sein. Yonkers Blonks (**YB**) traf den symptomatischen Frontmann der Band (**sFdB**) in einer der hippesten Office Lounges Aachens.

**YB**: „Hi, alles fit for fun?“
**sFdB**: „Na klaro, du Horst.“
**YB**: „In Internet Chat Logs kursieren derzeit Gerüchte, du würdest an einer neuen Single arbeiten. Stimmt das?“
**sFdB**: „Das stimmt. Der Titel wird Teil eines neuartigen Konzeptalbums mit dem Namen „Your Daily Dose of Listening Pleasure“. Ich arbeite momentan hart am finalen Mix, der Track an sich steht aber zu 92%.“
**YB**: „Wann wird releast?“
**sFdB**: „Am liebsten diese Woche.“
**YB**: „Und wie heißt das gute Stück?“
**sFdB**: „Smoothology of Interest (part i).“
**YB**: „Das lässt auf mehr hoffen?“
**sFdB**: „Bestimmt, sofern die Zeit reicht.“
**YB**: „Es haben sich einige Leute beschwert, dass du quasi mit jedem Lied ein neues Album ankündigst. Werden diese Alben zu den jeweiligen Single-Auskopplungen eines Tages fertiggestellt oder ist das nur so ’ne Masche von dir?“
**sFdB**: „Nur so ’ne Masche. Ich bin aber Mitglied des internationalen Musikerverbundes ‚NoMTmp3‘, in Deutschland vertreten durch ‚Keine Leeren MP3 Tags Bitte e.V.‘ Ich finde, jedes Lied sollte sich in ein überspannendes Konzept einordnen lassen. Dazu eignet sich die Pseudokategorisierung durch Albentitel, auch wenn sie nur metaphorisches Rauschen in den weiten des Klangnetzes darstellen.“
**YB**: „Ach so. Und welche Musikrichtung schlägt denn dein neues Machwerk ein?“
**sFdB***: „Schwer zu sagen. Es ist ’ne Mischung aus mellow groovalistic smooth beats und deep funky psychedelic trip-flop soundness. Im Grunde dösende Klangflächen mit groovendem Bass und psychedelischen E-Piano-Einlagen. Weniger poppig, nicht zu sehr Eletronica, eher Anleihen aus dem Fusion. Eine Hammond ist auch wieder dabei, das wird meinen treuen Fan Basti freuen.“
**YB**: „Klingt interessant. Wir warten schon gespannt. Schon Pläne für danach?“
**sFdB**: „Ja, auf alle Fälle. Scheiße, ich seh‘ gerade, Mittagspause zu Ende, muss weg.“

Wir danken trotzdem fürs Interview.