Doxygen UI for OS X

MacPorts comes with a nice package for Doxygen, the source documentation tool. However, it is missing the doxywizard, to quickly create and edit the sometimes very long Doxygen configuration files. However, there is a page (even from the original Doxygen guy) hosting special OS X builds with a nice small bundle, that you can drop into your Applications folder and which looks like this:


Finally: Rotations of real Spherical Harmonics according to Blanco et al.

I finally managed to implement Blanco's 1997 paper. The formulas were quite tedious to implement correctly, with all the matrix indices going possibly wrong. But after lots of debugging, I now have a working implementation in my SH explorer. Have a look:
This is an antenna pattern by Tiiti, which was rotated by 45, 90 and 45 degrees, in ZYZ angles. And it did not explode or deform badly. :)


iTunes and non MP4/MOV videos

There is a nice little blog entry which explains how to convince iTunes to take other media into your media library. The command is:

SetFile -t "MooV" -c "TVOD" some-movie.avi 

When you've installed Perian, iTunes should then accept almost any movie, be it avi, mkv or xvid.


OS X 10.6.5: GLSL problems are solved

Thank you Apple, thank you. The latest OS X update solved my crashes and broken renderings when using GLSL. Apple does not state what has changed in the knowledge base, but my last assumption was that at least the GLSL compiler produced broken code. Apple uses the wonderful LLVM compiler infrastructure for GLSL, which is great, but also known to produce problems sometimes. But LLVM+GLSL has made great advances, and this update makes it even better. Here's the correct rendering which I now can enjoy:
Update: I was too quick with my joy. The machine crashed again. But differently. It took much longer, and there was a hint screen this time, plus the machine sent a crash report after the reboot. Hopefully we are slowly getting to a solution... Ok, let's reopen the bugreport at Apple...

Update 2: I investigated a little bit more. It seems that when I switch the MBP back to using the GeForce 9400M instead of the 9600M, the machine does not crash. I played around for a couple of minutes, and it seems to work fine. Of course it is horribly slow, because I am pushing it with a massive volume dataset and a marching raycaster, but it at least works. The 21" iMac with the ATI card still fails miserably. Rendering is totally borked, but at least it does not crash.
Update 3: After two weeks of letting this rest, I tried today again, and I cannot manage to crash the whole machine anymore. I don't know what Updates changed this behaviour, but I am glad anyway. The ATI card still produces garbage, but neither the 9400M, nor the 9600M GT nor the GT120 in the iMac crash at the moment. If the machine locks up again, I'll report back with the panic log.


GLSL bugs in OS X still there

 Some time back I reported on crashing the Macs here using a non-trivial GLSL shader program. This bug still exists to this day. Now we've got a small, brand new 21" iMac, fresh out of the box. It exhibits a similar problem. This time, the UI does not lock up, but the rendering is totally borked. Compare the two screenshots. The first one shows the correct rendering, on a Linux PC using an NVIDIA GTX285 GPU, the other one is from the 21" iMac using an ATI GPU. The trick between crashing and not crashing seems to be the ATI brand...


MagicPrefs for the MagicMouse

I do like the MagicMouse by Apple. But there are some limitations to it. Thus I installed MagicPrefs, and all is well. Check it out:


Linux and the UUID

Even after more than 15 years of Linux experience, I sometimes learn new stuff. Today, I figured out why my KDE goes haywire sometimes. It turns out, that my swap file was mounted as /dev/sda1. Which is fine, most of the time. Except when an external USB drive is plugged in. Then that one becomes sda, and the internal drives goes to sdb or even sdc, when two external drives are plugged in. So the swap won't work, and the USB drive cannot be mounted via dBus / HAL, since it is suddenly listed in the /etc/fstab. Also, KDE will have some strange troubles during this time, and will not restore my session. But I am not 100% sure this is related. Time will tell... Anyway, what was strange was, that everything else worked. That was because the root filesystem was mounted using a UUID, which identifies a partition or volume uniquely. So, why did the swap not have this? Seems, this was forgotten by Ubuntu upon the upgrade to Maverick. But the Ubuntu Wiki helps. So what I did was:
  # swapoff /dev/sda1
  # MYUUID=$(uuidgen)
  # mkswap -U $MYUUID
  # sed "s/\/dev\/sda1/UUID=$MYUUID/"
  # swapon /dev/sda1
You can also just edit fstab with the editor of your choice...


Do magnetic hard drives go the way of the poodle?

There is an article over at Slashdot about the possible decline of the traditional hard disk. We now have tablets like the iPad and its clones having only solid state / flash memory, and the new MacBook Air reaching a price point which is a direct competition to Apple's entry level MacBook. This really might be a sign for solid state storage to have reached the ordinary customer, outside of MP3 players, cameras and smartphones. The discussion on Slashdot is erratic and irrational, as usual, but some interesting points are also made. The thing those people are missing though is: This is again another Apple strategy. Apple can allow to enter a mass market first. They have loads of money, their products are still priced at the high point. They don't compete with the low level market. So offering a 11.6" laptop with a meagre 64 GiB of storage is doable for Apple. Sure, most geeks will say: What a puny machine! But again, as with the iPad, Apple can drive markets that don't care about computing power and loads of disk storage: Your mom, my mom and millions of other people might be happy with such a machine, that only 5 years ago would have been more computer than you'd ever needed. In a significantly larger form factor.
And in 5 years you probably won't see any laptop with a spinning drive anymore. Apple is just very early to the game, as usual. Remember the floppy-less iMac? They never were the first, but they were always quick to pick up and set trends. Also, what most geeks at Slashdot don't understand: Yes, Apple is fashion. Apples is expensive. But that's exactly why their product sell. Is it a good thing? Probably not. But that's how the market works: fashion sells. Also their laptops are incredibly well manufactured, in my opinion. Not without flaws, but much better than most devices I held in my hand.


ICE train power outlets confuse iPhone

Currently travelling with the german ICE train. The iPhone is plugged in, and I notice the following: the touch events are noisy and jittered. Unplug: all ok. Plug in again: flaky. I guess the 230V line here is of very low quality. I am using the Apple transformer, by the way.


How to downgrade an iPad from 4.2beta to 3.2.2

When trying to downgrade an iPad from 4.2beta to 3.2.2 directly via iTunes, I just get a non-descript error message. However, there is a nice howto out there, which describes this.


Frogatto and Friends

An absolutely cute 2D, very classic jump and run game is Frogatto and Friends. It is for free, comes even with source code. Only the iPhone version does cost a bit. But I guess that is a nice way to support the developers. The game is crossplatform, running on Linux, OS X, Windows and, as mentioned, iOS devices. I assume, if you take the source, you can make it run on several other platforms as well. The music is nice, the characters lovable, and the levels have a great amount of detail. Controls are simple: cursor keys, plus A and S is all you need. What surprised me was that the music is stored as .ogg files, although it sounds like tracker songs. Thus it makes up 90 MiB of the game data, the whole game being slightly over 100 MB in size. Anyway, download it and have fun!


Emacs in Ubuntu...

...it's buggy. I tried the snapshot, but that behaves strange as well. My workaround so far is to go fullscreen. Still, customize is broken: the customization buffer shows up in the wrong buffer. I haven't found a bug description for that yet. Also, the git interface does not work. I will install magit next, to see if that helps. Anyway: Emacs on (K) Ubuntu is in bad shape...
Update: I fixed the first two problems. Turns out, emacs-snapshot does work, I just forgot to de-install emacs23-gtk and install emacs-snapshot-gtk. Thus I still fired up the old version. Customize works as well now, after uninstalling cedet and ecb, and instead using the latest ecb and cedet from Sourceforge. The versions shipping with Kubuntu are slightly out of date and were causing the buffer problem.


Truecrypt + ext2/3 + Linux AND OS X

Ok, so the combination of Truecrypt and ext2/3 is not optimal for sharing data between Linux and OS X. Truecrypt and fuse-ext2 on OS X cannot mount an ext2/3 partition read-write. So I will now go back to the lowest common denominator for all OSes: NTFS...
Update: Yes, it seems NTFS is a good alternative. With both OSes using NTFS-3G, I can use the Truecrypt file on both Linux and OS X -- and even Windows, if I had one... Creation of a 200GB Truecrypt file takes time, though. And copying all the data to it, even more.


Description of Apple's Keynote file format

What a nice surprise. Apple has actually documented the Keynote file format. Sadly, as far as I can see, there is no import/export capability in either PowerPoint nor OpenOffice.org Impress. That would be a nice feature. But it's good that Apple does document the format. Since it is XML, it is easy to parse. However the hard part is always the semantics, not the syntax...


Akonadi Hell

Which sick, twisted mind designed Akonadi? Everytime I run Kontact for the first time, it will fire up a dialog, presenting me with strange errors that happen upon running Akonadi. The second time around, it works fine. This is, by the way, on a fresh KUbuntu 10.04 installation. Sometimes, a little bit more Q/A on complex FOSS projects would be really, really nice.
Update: Plus the display of Google contacts using Akonadi (in the KDE address book) is totally borked. Well, good thing I only change my contacts through MobileMe or the iPhone, and push those changes on to Google...


Spherical Harmonics Explorer

I have written a neat little Spherical Harmonics explorer. Right now, the projection function has some weird bug still, but the basis functions, and arbitrary combinations of them can be viewed nicely. The tool is written in Python, using PyQt4 and PyOpenGL. Python is excellent for prototyping such a tool. It might not be as fast as C++, but the rendering speed using PyOpenGL is more than enough and very smooth. I might put the small 3D viewer widget online later, because it might be useful for many people. Here's some eyecandy:
Update: Now the projection also works fine. See the example screenshot of an order 5 approximation. This still needs some more work, still using a very basic Monte Carlo sampling approach, which converges terribly slow. But I can already produce some results.


Selecting between overloaded signals in PyQt

The signal mechanism in Qt allows for overloading. E.g. the QSpinBox comes with two signals called valueChanged(int) and valueChanged(QString). However, since Python is dynamically typed, such overloading gives rise to problems. Here is how you can select which signal you want to connect to your slot:
from PyQt4 import QtCore, QtGui, uic

class MyMainWindow(QtGui.QMainWindow):

    def __init__(self):
        self.ui = uic.loadUi("MyMainWindow.ui", self)

        # Slot connections

    def spinBoxChanged(self, i):
        # do something...
Notice the (int) in the decorator of the slot. This has to match the signature of the signal. I haven't dug into more complex signals, passing around arbitrary objects, but I think that is not a problem: Qt datatypes have a Python wrapper, and functions in Python cannot be overloaded anyway, so there won't be clashes with pure Python signals and slots.


Redefining quit-char in Emacs 23

The quit command C-g is pretty much standard in Emacs. It runs the interactive function keyboard-quit and also serves as the default quit-char. It aborts basically every running function, also it allows you to cancel operations in the minibuffer. The Emacs documentation describes current-input-mode, set-input-mode and set-quit-char for getting and setting the quit-char value. Also, global-set-key allows you to rebind keyboard-quit to another character. However, this does not work very well. The quit-char is not settable for non-tty Emacs versions, e.g. on OS X using Cocoa Emacs you get this:
So, basically nothing changes. On a tty it looks more promising:
After rebinding the keyboard quit as well, using (global-set-key (kbd "C-q") 'keyboard-quit), not much happens either. It seems the minibuffer assumes C-g to be the choice of the day. Running find-file with C-x C-f or interactively via M-x find-file, and then hitting C-q does nothing except printing "Quit". Hitting C-g however quits the minibuffer. This seems to be documented in Bug #1218 of Emacs.


gitx with push / pull support

I love gitx, the git GUI for OS X. However, it used to have no push / pull support. Which is pretty important for git. But git and github are beautiful pieces of software. So there is another fork on github, containing push / pull support and more. This little context menu made me happy:

Readymade binaries can usually be found on Brotherbard's blog.

Update: There is a better, newer branch even yet. See my other blog post.


Backup of running VirtualBox machines

If you are using VirtualBox for running servers, you might have stumbled across the question: How do I backup a running virtual machine? The problem is, that the machine state, consisting of the hardware state and especially the virtual harddisk, might change during the backup. This means that you will most probably end up with an inconsistent machine state, from which you might not be able to recover, after restoring the machine from your backup.
So I thought up a little script that creates a static machine state that can be backed up, while the vbox continues to run on a current, changing machine state.
Requirements: two states named current and previous (you have to add them manually first), where "current" is the current vbox snapshot, which the machine is running on. The script will move the current state to the name "previous", and delete the old "previous" state. It will then take a new "current" snapshot.
The previous snapshot (.vmdk and .sav) together with the main .vmdk or .vdi can then be used for backup purposes.
So it's a good idea to run this script before your daily backup run. The snapshots take only some seconds. Deleting the old snapshot might take a bit longer, because the deleted machine state is committed back to the main machine state.
Note that your backup software will fail to backup the current snapshot correctly. However, since vbox generates random IDs for the states, it is not easy to exclude the file from the backup set. So just ignore error messages from your backup software concerning that particular state file. This way you will have a machine state that lags only some minutes compared to your backup system.


VBOXMANAGE="/usr/bin/VBoxManage -q"

if [ $# != 1 ]
    echo "Usage: $0 VBoxName"

echo "Renaming old snapshot..."
$VBOXMANAGE snapshot "$1" edit previous --name deleteme
echo "Renaming current snapshot..."
$VBOXMANAGE snapshot "$1" edit current --name previous
echo "Taking new snapshot..."
$VBOXMANAGE snapshot "$1" take current
echo "Deleting old snapshot..."
$VBOXMANAGE snapshot "$1" delete deleteme


Evoke 2010 wrapup

On Friday and Saturday I went to the Evoke 2010 in Cologne together with 0xtob. Exactly 25 hours before the 4k Intro compo deadline we started coding... Well, I haven't coded an intro ever before, 0xtob has some more experience. Plus the two other, very brilliant entries in the competition had much more time to prepare. But nevertheless we managed to submit an entry for Linux, which took about 3.2KiB.
0xtob even managed to code a minimalistic sound engine in less than an hour, so that we had at least some noise playing in the background. The whole intro is just one scene without any fading in or out so far. It's basically a raytraced implicit, morphing function (interpolating between two animated implicit functions). So we actually do not render any explicit geometry. The raytracer is written in GLSL, and the textures are a port of Ken Perlin's original improved Perlin noise to GLSL, which I somehow managed to do. The intro runs on both Linux and OS X, but on OS X it is currently about 7KiB, so not quite 4k. A Windows port will follow at some time, I guess. We are planning to clean up and beautify the intro somewhat and put it on pouet in the coming weeks.
All in all it was a lot of fun, and we got a lot of help: jix borrowed us his MBP running Linux, because the orga did not want to accept OS X as the host OS, and 0xtob's Quadro NVS was not up to the task rendering the whole thing in 720p. :) Some unknown guy borrowed us the MDP to DVI adapter. Robert helped to crunch the binary to minimal size, and also made the shader more colourful than ever. Roman gave helpful hints and was another pair of eyes watching over the code.


MobileMe bugs: Image upload with Linux based browsers impossible

Well, the MobileMe gallery upload seems to only like Mac browsers. I have only my SuSE box here, so I tried to upload using Chrom 5.0 and Firefox 3.5. No luck. Both browsers throw errors. Just like this:
So far, I cannot find any documentation on this behaviour. I would have assumed that either FFox or Chrome would work. MobileMe on OS X says it supports FFox and Safari. But since Safari is not available on Linux, I thought I might try FFox and Chrome. Now waiting for a MobileMe chat support guy. I doubt they are educated enough to actually help me...

Update: The chat guy was friendly, and had one hint: update to FFox 3.6. I was still on 3.5. And sure enough: now the upload works. Only one file at a time, though. But I found out even more on my own. It seems all the images are accessible from your iDisk as well. They are stored in Web/Sites/_gallery/id. Where id is the number of your gallery. However, you cannot just upload pictures there. Every image needs to be put in a separate directory. Every directory must then have the following files:


The exif.json is obviously a JSON style EXIF data block, e.g. like this:

{"data":{"infoSensing":"One-chip color area sensor","infoExposure":"Normal program","infoExposureIndex":"--","infoFNumber":"2.8","infoDistance":"--","infoGPSLongitude":"8° 15&#39 35.40" E","infoWidth":"2,048 pixels","infoName":"IMG_0133.jpg","infoDigitizedDate":"Thu, 19 Aug 2010 12:18:20 PDT","infoFocalLength":"3.85 mm","infoHeight":"1,536 pixels","infoExposureTime":"0.003846154","infoGPSLatitude":"50° 0&#39 5.40" N","infoAperture":"f/3.0","infoMetering":"Average","infoShutter":"1/260","infoSize":"1022.27 KB","infoBrightness":"--","infoCameraModel":"iPhone 3GS","infoMaxAperture":"--","infoCameraMake":"Apple","infoExposureBias":"--","infoFlash":"32","infoOriginalDate":"Thu, 19 Aug 2010 12:18:20 PDT","infoGPSAltitude":"115.00 m","infoISOSpeed":"64","infoLightSource":"--","infoSoftware":"4.0.2"},"status":1}

This should be easily created by a short shell script, using "exiftool -s image.jpg" and some awk magic. The image files in the folder are:

large.jpg: 2048x1536 (original resolution? at least for iPhone 3GS)
medium.jpg: 427x320 (approx. iPhone screen resolution)
square.jpg: 160x160 (thumbnail)
web.jpg: 1024x768

For portrait, I assume that the width and height are swapped. Have not checked this yet. Later, I will try to whip up a bash or Python script which produces these files automatically from a list of input images. Let's see if this works.

Oh yes, one more thing: In Linux you can easily mount the iDisk with "wdfs  http://idisk.me.com/your-id iDisk/

Update 2: A quick check revealed that the iDisk interface is quasi read-only. Writing new albums or pictures there will not show up in the gallery itself. That would have been too nice. So I guess this is only possible via the (unpublished?) HTTP API of MobileMe itself. Just like the Picasa API for uploading and manipulating photos. But it seems the API is quite hard to decipher, which is sad, given that Google practically documents all their APIs and encourages mashups and websites using their services.


UI Changes in Blender 2.5

There is a nice blog post about the UI changes from Blender 2.4x to the 2.5 series. All in all I think the new UI is much improved. However some things are still not perfect. e.g. Blender windows on OS X are not resizable, apart from the zoom (+) button. That's because the resize corner in the lower right is missing. On Linux, this will be provided by the window manager. Anyway, here is an idea of what Blender 2.5 looks like:


Getting halfway sane mouse click behaviour in Gimp on OS X

I can definitely recommend the X11 packages from the XQuartz project. They are more up to date than the X11 server shipped with OS X. Also, the Gimp packages over at Lisanet are fantastic, too. However, the default click behaviour of X11 or rather quartz-wm is not optimal, especially for the Gimp. Usually I like focus follows mouse, but for an interface like the Gimp, it does not make sense. You always inadvertendly focus on an image, that you did not want to focus. Since there is no delayed ffm mode in quartz-wm, I opted for click-to-focus instead. However, quartz-wm swallows mouse clicks on inactive windows. This is also not worthwile for the Gimp with it's extra tool palette windows. So the soluation is: click-through combined with click-to-focus. Easy:

defaults write org.macosforge.xquartz.X11 wm_click_through -bool true
defaults write org.macosforge.xquartz.X11 wm_ffm -bool false
In newer releases you can set this also from the preferences (⌘,). If you are using the X11 version shipped with OS X, you can most probably just replace org.macosforge.xquartz.x11 with com.apple.x11.


I love Python

It's so easy to quickly code something and calculate something. The following snippet actually computes the number of possible cards in the game Tsuro. The game ships with 64 cards, but my colleague and I suspected that those were not all possible combinations (eliminating all rotational symmetries). So we did some quick calculations, and came up with 105 possible cards. So I wrote this short Python code to enumerate all possible cards then:
Update: My first algorithm was wrong. The actual number of cards is 35. It is only 105, when the numbering of the conncetion points is of interest. So here is the augmented algorithm, which outputs the 35 unique cards. The game comes with two of every card, except for 6 highly symmetric cards, which are unique in the game.

def makeCards(cards, card, connectionSet):
if connectionSet == set([]):
for i in range(1,4):
c = shiftCard(card, i)
return cards
except ValueError:
return cards + [card]
start = connectionSet.pop()
for i in connectionSet:
newConnection = sorted([start, i])
cards = makeCards(cards, sorted(card + [newConnection]), connectionSet - set([i]))
return cards

def shiftCard(card, i):
newCard = []
for c in card:
conn = sorted([(c[0] + 2 * i) % 8, (c[1] + 2 * i) % 8])
newCard = sorted(newCard + [conn])
return newCard

mycards = makeCards([], [], set([0,1,2,3,4,5,6,7]))
print mycards
print len(mycards)


How to make Hybrid Apps that run on 3.1 and higher devices (iPod, iPad and iPhone)

This fantastic blog entry helps you to actually use the UserInterfaceIdiom message, which is only available in iOS 3.2 and higher. This way, you can actually build a hybrid iPad / iPhone app that even runs on the original iPhone, which only comes with iOS 3.1 at best.


iCal woes: Event invite for Google Calendar is never sent

Ok, here is another bugger that annoyed me for quite some time: I am using Google Calendar as my main method of dealing with appointments and shared calendars. I use the mostly fabulous Apple iCal for managing those dates. However, if I create an event to be shared with several people, and I try to send an invitation to those people, this doe not work. In the event properties, I enter a list of Email adresses, hit "Send" and it never gets sent. The event is marked as "waiting for answers", though. But that will never happen... So I have to fire up the Google Calendar website and resend the invitations manually. Bit annoying.
I haven't found a correct problem description so far for this in the discussion boards over at Apple, but I'll update this post if I find a bug description or some workaround. However, a preliminary search yields several problems relating to iCal and event invitations, but also with event invitations on Google calendars.


Mystery calls by my iPhone

In the last couple of days my iPhone made a couple of ghost calls. I.e. it called some people from my address book, without me doing the actual calls. I think I found the reason for that now. When you hit the home button for several seconds, an iPhone 3GS with iOS 3.x or 4.x will go into voice command mode. This even works when the phone is keylocked. The voice function is not so robust and will misinterpret quite a few background sounds, noises and voices for commands. I couldn't yet make 100% sure that this is how it happened, but it seems to be the only possibility so far, since my phone is always keylocked, when I carry it in my pocket. So I figure the home button was accidentally pressed, and thus the voice command was activated. Will try to investigate this further...


Wishlist item for the iPhone: Clickable Maps Icons

What annoys me most in the maps application of the iPhone: You cannot tap or click on symbols. E.g. when you tap a bus-icon in the maps.google.com website, you will get a popup with the name of the bus stop and the lines that go there. This is not possible on the iPhone. I also use the fantastic Fahrplan application, however if you do not know the name of the bus stop you want to go to, you're out of luck.


OS X graphics driver bugs

On both our MBP as well as our iMac I can get OS X to crash when using a perfectly fine fragment shader, which works well under Linux. Both under Linux as well as under OS X I am using NVIDIA hardware. This is what the crash looks like:

OS X crashing when using complex GLSL shaders from Arne Schmitz on Vimeo.

Update 2010-07-13: Apple already wrote back, and requested a sample app, which I provided. Let's see if they can figure this out. Kudos for reacting so quickly!


me.com woes

I have been using me.com for a while now, and am relatively happy with it. The automatic sync of the data between my work laptop and my iPhone is absolutely priceless. Now I've upgraded to the family account to share the (for my needs) ample 40 GB with two friends. Turns out, the other two accounts can only get 5 GB of storage. Ouch. That sort of sucks. Right now, 10 GB cannot be used at all, cause they are reserved for two more people. Why am I then paying for the extra storage anyhow?


VLC 1.1.0: Broken deinterlace on OS X

Well, I was wondering why some DVDs looked jaggy on OS X when watched with VLC 1.1.0. It seems deinterlacing on VLC for OS X is currently broken. The bug is fixed now, but we probably have to wait some more time for a 1.1.1 release.


New Book: Modeling and Tools for Network Simulation

There is a new book out, for which I contributed part of a chapter: Modeling and Tools for Network Simulation. The book is meant to be a textbook for everyone who needs to simulate computer networks. From the physical layer to the application layer, some best practices are described. Contrary to Amazon and Springer's webpages, the book has more than 256 pages. It's got more than 500 pages, so it is rather comprehensive.


Shortcuts on OS X

I use Spark for defining global shortcuts to tools, applications etc. One of the best things is shortcutting to the login window. This way you can quickly lock your screen, which is not bindable by default in OS X. Also useful: shortcuts to AppleScript, e.g. for opening a new Safari window. This is what Spark looks like, when you edit the shortcuts:

Yellow pages when printing with Debian?

We had the problem of yellow tinted printouts on our Debian Testing machines. With my OS X machine, I did not have this problem, although both system use CUPS 1.4.3 for printing. It seems that Ghostscript was the culprit. The pstopdf filter to be exact. This bug report in the Debian bug tracker describes the exact same problem. The idea is to comment out the "-dUseCIEColor" option. I am not sure in how far this will also change the colour reproduction, but since our systems are not colour calibrated anyhow, I think this will not matter.


Cococa Emacs

I just found out that there is a new website with Cocoa based Emacs builds. Now I can switch from the out-of-date MacPorts version to the Emacs 23.2 of Emacs for Mac OS X.

Update: This is really nice, now also the GUD debugger frontend works nicely. Check it out:


Typo3: Filelinks are not actually links

Whoever named the Typo3 filelinks, should be fired. Out of a cannon. Into the sun. This is because the filelink, does not actually link to a file, but it copies it to some folder (upload/media by default). Why this is so, is beyond my understanding. When you add a simple link in the RTE, and link to a file, you get the expected result: You get an <a> tag linking to the corresponding file in the fileadmin/ folder of Typo3. But when using the filelink, the file will be copied to the upload/media/ directory.

I have tried to use the DAM extension (digital asset management), but that is such a convoluted, under-documented beast, that I got rid of it very quickly. Now I still do not have a solution, but I welcome every hint on how to solve this.


Mobile Multi Display has hit the AppStore

One of the projects I have been working on at the lab has made it to the iPhone AppStore. It's the Mobile Multi Display, and you can find more information about it on its website: http://www.graphics.rwth-aachen.de/software/mmd/.


Mounting the iDisk in Linux

Ok, so the Apple iDisk of me.com fame seemingly cannot be used from within Dolphin, the KDE file manager. Either something in Dolphin or me.com is rotten. However, I solved the problem by installing wdfs, the FUSE based webdav mounter. Using wdfs and rsync on the command line is much easier anyway...


Switching flyspell dictionaries on the fly

Since I am using Emacs for most of my text processing, and it comes with the nice Flyspell mode, and I do write English and German the most, I found this nice snippet from the Emacs wiki:

(defun fd-switch-dictionary()
(let* ((dic ispell-current-dictionary)
(change (if (string= dic "deutsch8") "english" "deutsch8")))
(ispell-change-dictionary change)
(message "Dictionary switched from %s to %s" dic change)

(global-set-key (kbd "<f8>") 'fd-switch-dictionary)

On OS X, I recommend to use emacs-app or emacs-app-devel from MacPorts. For flyspell to work correctly, also make sure to install aspell and e.g. aspell-dict-de. Otherwise the above function will complain, most probably.


Cisco VPN Client triggering system crashes?

I am not quite sure, but I suspect my Cisco VPN Client for OS X is triggering some crashes on the MacBook Pro. Only when I have been using the VPN Client, suspend the machine, then wake it up again, the system becomes unstable in some cases. Once, I got a OS X death screen right away, the other time I just got the blue screen, and the activity LED on the front was just off. This so far only seems to happen after I have been using the VPN Client. The current release of the client is 4.9.0180, and is already pretty old. Funny enough the Cisco webpage lists only OS X 10.4 and 10.5 as supported, and not 10.6, which has been out for what... 9 months or so? If I find anything new on this, I will update this post.

Update: There is Tunnelblick, a free UI for OpenVPN, which can be used as well. Trying this out now, to see if it is any better.

Update: So far no more crashes. I've used Tunnelblick for some weeks now. So I guess the Cisco client indeed is the culprit


Arrow keys broken for console applications in OS X 10.6.3

I was just trying to configure some project using the curses based ccmake tool. I noticed that I cannot do that, since the arrow keys on my keyboard stopped responding when running ccmake. Turns out, Apple broke curses in OS X 10.6.3. Workaround is to copy the ncurses dylib from a 10.6.2 system, which I don't have at hand right now. Funny enough, the keys are also broken when using xterm instead of the standard terminal, so there is definitely something very broken in ncurses right now.


XCode cannot compare SVN directories

I am missing one feature in XCode: it can't compare whole directories under version control. Only single files can be compared. For example, I have a directory named "Classes". It's info dialog does not show the version control tab:

However, if I choose some source file, I get the SCM tab and can compare my local version with the head version in the repository:


Nice things about the iPad

Well, one nice about iPad development is that porting your app is pretty easy. Took me 1 minute exactly. Sure, you have to re-tweak your UI, but the OpenGL ES rendering is instantly high-res.


iPad WiFi problems

Yes, it's true. The iPad WiFi problems are definitely there. I currently have one iPad lying around here, which has obscenely bad WiFi performance: bad signal, slow, disconnects. The eduroam node I am using is 6m away, almost line of sight (two open doors).

Python: swapping variables

I forgot where I read this, but this is a neat way of swapping variables in python:

u = 1
v = 2
print "%i %i" % (u, v)
u, v = v, u
print "%i %i" % (u, v)


Finder could not be started...

One of those mysterious error messages, which can only be solved by logging out and in again:


Making transparent iPhone-Sim Screenshots

This is a real time saver: Cmd-Shift-4, hit the space bar, select the iPhone simulator window. This makes a nice transparent screenshot, like this:

Setting PATH and other variables on OS X

Since OS X is a UNIX like many others, I usually put my environment variable settings like PATH in ~/.profile. However, for Cocoa based apps, that are not run from a terminal, this will not help. Luckily, there is a documented procedure for setting environment variables for Cocoa applications. In short, you just have to edit a plist. If it already exists on your system, just type the following in a terminal:

open ~/.MacOSX/environment.plist

If the file does not yet exist, just run the Property List Editor (e.g. via spotlight), and create that folder and that file.


Syncing iPod Touch and iPhone with Linux

Ok, so I just tried out the new libimobiledevice. Installation was a breeze, using the provided OpenSUSE repository. A first run of ideviceinfo returned successfully detailed information about the attached iPod Touch. I also upgraded libgpod4. But Amarok 2.3 did not show a thing. Mounting of the iPod needed to be done manually using "ifuse ~/my-ipod-dir". Supposedly, this happens automatically with Gnome, usin gvfs. But since I am using KDE, this is at the moment a no-go. Ok, so Amarok fails at this point in time. What about gtkpod? It works, although it throws some mysterious error message ("Eweiterte Informationen werden nicht verwendet" -- wtf?), and that program is dog-slow. I though iTunes is bad, but this program is really, really slow as a snail. But here a proof of concept that I was able to sync to albums to the device:

What I did not yet try is syncing contacts, notes and bookmarks. With gtkpod, you need to specify a program to do that. No idea which one that is supposed to be. Keeping my MobileMe contacts in sync with my Linux desktop would be nice, though. Also, syncing from within Amarok is mandatory for me, but does not work currently. So let's wait and hope the situation gets better with time. So far I will continue to sync my device with OS X.

Extremely slow SMB performance over WiFi using OS X

I have an OpenSUSE machine running a Samba server to provide files to my network. Now when I use the MacBook Pro to access those files, this happens awfully slow, with 80-200 KiB per second. I never figured out why, since rsync and sftp work very fast (for WiFi at least), at speeds of around 1.2 MiB per second. Today I googled for it, and it turns out that OS X delays ACK packages. I have no clue why it does that and what good this does, but you can disable it by running:

sudo sysctl -w net.inet.tcp.delayed_ack=0

After that, my SMB transfers jumped to 1 MiB per second, minimum. You can presumably make this change permanent by adding "net.inet.tcp.delayed_ack=0" to the file /etc/sysctl.conf. This will then be applied during system startup.

Update: Here is a nice explanation why the performance of OS X suffers sometimes, when using delayed ACK, and also why it might be useful in some cases.


Drag and Drop of Actions in Qt Designer 4.6.2 on OS X does not work

One more stupid bug in Qt found. When using the Designer, you can't drag and drop QActions, if you are using the Cocoa version of Qt. The bug is described here, a fix will be available in Qt 4.6.3.


OpenCL on OS X

I have just tried to run an official OpenCL sample program by Apple on a MBP 10.6.3 machine. Result: a crash. Why? I do not know yet, but it seems that OpenCL somehow crashlanded the nvidia OpenGL driver. This is what I get:

08.04.10 17:04:50 kernel NVDA(OpenGL): Channel exception! exception type = 0xd = GR: SW Notify Error
08.04.10 17:04:50 kernel 0000006e
08.04.10 17:04:50 kernel 00200000 00008397 00000474 00000040
08.04.10 17:04:50 kernel 0000047e 00001408 00000001 00000008
08.04.10 17:04:50 kernel 00000000 00000000 01dfdc03
08.04.10 17:05:04 kernel NVDA(OpenGL): Channel exception! exception type = 0x8 = Fifo: Watchdog Timeout Error
08.04.10 17:05:04 kernel 0000006e
08.04.10 17:05:04 kernel 00000010 00008397 00000474 00000000
08.04.10 17:05:04 kernel 0000047e 00001528 00000000 00000008
08.04.10 17:05:04 kernel 00000000 00000000 019fdc03

As soon as I know something more and especially how to fix it, I will share it here.

Update: It does not crash, if I don't touch any keys when the kernel runs. So I guess the OpenCL drivers are a bit buggy still...


Emacs: autocomplete-mode

Just a quick note: the Emacs autocomplete-mode is easy and lovely. It is not as clever as semantic, but it works, is pretty fast and can optionally use semantic, if I understood correctly. Installation is easy, due to the provided install script. It provides nice pop-up menus to choose the alternatives from:


SD card reading problems

Today I was shooting some pictures using some camera and a cheap 2GB SD card. Upon returning home, I copied the pictures from the SD card to the Mac, using an old 6-in-1 card reader. After about 980 MiB of images, OS X throws a read error. Using cp in terminal yields the same result. Trying to repair the card using the hard disk utility even resulted in the system hanging. No hard freeze, but I had to power cycle it, since I was too lazy to fire up another ssh-capable machine.
After some research, I read on Wikipedia that SD cards over 1 GiB are adressed differently. It seems that older devices, such as my reader may have problems using those cards. This means I have to go buy a new reader tomorrow, I guess! Or be restricted to using only 1 Gig of the SD cards I use... Which is not a good idea for camera producing 37 MiB RAW files.

Update: My suspicion was correct. A new 10 € card reader solved the problem. The 2 GiB are back, I can read all the photos from the card.


Automatic security updates for Debian

I was wondering how to configure automatic security updates for Debian. Especially for Debian stable, which I am running. Turns out it's easy. First, you just install cron-apt. Second, you can configure it by editing /etc/cron-apt/config. I learned from some other blog, that setting one variable helps in getting actually emails for the upgrades, namely setting MAILON="upgrade" in this file does the trick. And lastly, there is a directory /etc/cron-apt/action.d, which contains all the actions that cron-apt will execute. In there is a file named 3-download, which I changed to look as follows:

autoclean -y
upgrade -y -o APT::Get::Show-Upgraded=true

The second line is changed from "dist-upgrade -d ...", because you don't want any automatic dist-upgrades. That might leave your server in a horrible state. Also, instead of only downloading (-d), you want it to install the upgrades as well. That's all and should help you keep up with security patches more easily.

Update: The updates seem to work fine! Tonight I got the first email that notified me of a successful security update.


Tivoli Storage Manager: Servername not found

The infamous Tivoli Storage Manager client (a.k.a. dsmc) uses two configuration files: dsm.sys for the system wide configuration, specifying which directories to backup and so on, and the dsm.opt for the backup/restore client. The problem is, if you specify the backup SERVERNAME in both files, this will lead to problems, if they are not the same. So, e.g. I misconfigured the dsm.opt via the dsmj wizard, and had "SERVERNAME myhost" in the dsm.opt, while the dsm.sys said "SERVERNAME something.at.rwth-aachen.de". The first entry obviously was complete bull, and confused the dsmc, so that it answered "ANS1217E Server name not found in System Options File". Aligning both entries to the correct, real server name solves this problem.


iPhone / iPhoto syncing woes

I just tried to download a couple of images from my iPhone, using iPhoto '08. No luck. Suddenly the iPhone was not listed anymore in iPhoto! It turned out that something on the iPhone was broken / corrupt. When I looked at the device using the Image Capture program, I got this:
As you can see the devices section lists 24 images on the phone, but the photo list is empty. Deleting the pictures on the device restored the functionality. If you need the photos badly, you can forward them to your email or MobileMe account, and then delete them.

Sometimes it is so much better to just have a plain filesystem with photos, instead of some advanced database, that might break...


Bug in ff-find-other-file of Emacs 22?

I am working on a C++ project which is organized such that source files (*.cc) are in some subdir called, let's say, project/dir1/, and header files (*.h) in a directory called project/include/. Now Emacs has a function called ff-find-other-file, which is able to switch between header and implementation of C/C++ files. If you take a look at the source of this function, you will find another function called ff-get-file-name, which tries the following: first, it looks for already visited buffers, if they contain the appropriate file. Then it will search a certain set of directories, if they contain the file. Last, it will ask to find or create the file in a user specified directory. However, in my case, although both files are already being visited by buffers, the first test (finding the file in already loaded buffers) fails. Actually the offending piece of code looks like this:

(if (bufferp (get-file-buffer filename))
(setq found (buffer-file-name (get-file-buffer filename))))

The problem is that this always fails, and found will always be nil. The filename constructed is not being expanded, as get-file-buffer demands. However, expanding it is useless, since the exact expansion (absolute path) of the searched file is not exactly known! However, you can rework these lines to just look for a buffer whose name matches the file you are looking for:

(let ((b (find-if (lambda(x) (string= (buffer-name x) filename)) (buffer-list))))
(if b
(setq found (buffer-file-name b))))

Note that this will only do a simple string matching. It might happen that for a certain file foo.cc you have to buffers visiting some foo.h. The function will only find the first one. But in my opinion, there is not simple solution to find the semantically correct header file, anyway. So this is still better than the broken solution in Emacs.


No 64bit CUDA for OS X so far

I am still waiting for 64 bit CUDA support for OS X 10.6. As this thread indicates, we might have to wait for a while so far. Maybe I will switch to OpenCL in the meantime? :)


Recursive Makefile for LaTeX

I wanted to make a Makefile for a seminar report. This report contains all the sub-reports of the students. So the Makefile needs to recurse into subdirectories to compile all the contained LaTeX files there. So, given a file reports.tex which will include some PDFs in subdirectories 00/ to 10/, we get a Makefile that looks like this:

# A small LaTeX Makefile


CHAPTERS=00 01 02 03 04 05 06 07 08 09 10

all: subdirs $(PREFIX).pdf


.PHONY: subdirs simple

@for i in $(CHAPTERS); do \
(cd $$i; $(MAKE)); done


$(PREFIX).aux: $(PREFIX).tex
pdflatex $(PREFIX).tex

$(PREFIX).pdf: $(PREFIX).aux
pdflatex $(PREFIX).tex


pdflatex $(PREFIX).tex


@for i in $(CHAPTERS); do \
(cd $$i; $(MAKE) clean); done
rm -f $(PREFIX).aux $(PREFIX).bbl $(PREFIX).blg\
$(PREFIX).idx $(PREFIX).log $(PREFIX).out $(PREFIX).tcp\
$(PREFIX).toc $(PREFIX).tps $(PREFIX).prf $(PREFIX).lbl
rm -f $(PDFFILES) *.aux


Angry Birds

I have to make some advertisement for a funny little iPhone game: Angry Birds. The idea: green pigs stole some eggs, now the birds are angry! Use those Kamikaze birds as ballistic missiles to destroy the pigs! Nice physics engine. Also available on the N900, and costs only 79 Eurocents. Here's a shot:


How to duplicate Matlab functionality

Since I am a total Matlab-n00b, I rather write a convoluted Python script instead of using the appropriate Matlab function. And here it is. A small script to compute the standard deviation of two vectors. I guess this would have been one Matlab command.

import sys
import scipy.io
import math

def computeStdDev(file, vec1, vec2):
data = scipy.io.loadmat(file, struct_as_record=True)
vector1 = data[vec1]
vector2 = data[vec2]
if len(vector1) != len(vector2):
print "Error: Vectors do not have matching lengths."
diff = vector1
N = len(diff)

for i in range(N):
diff[i] = vector1[i] - vector2[i]

mu = 0
for val in diff:
mu = mu + val
mu = mu / float(N)

sigma = 0
for i in range(N):
sigma = sigma + (diff[i] - mu)**2
sigma = math.sqrt(sigma / float(N))

print "mu: %f" % mu
print "sigma: %f" % sigma

if len(sys.argv) != 4:
print "Usage: %s file vector1 vector2" % sys.argv[0]

computeStdDev(sys.argv[1], sys.argv[2], sys.argv[3])


Matlab and Python

How to read Matlab files with Python and SciPy can be read here. Short:

import scipy.io

data = scipy.io.loadmat('test.mat')

This will create a dictionary called data containing all the variables of the Matlab file.


jabber.org is coughing

The guys over at jabber.org are moving servers, and upgrading their software. However, it does not seem to work well. They mention the need to adjust settings for iChat and Kopete. However my IM+ does not work anymore either, Licq's pre-alpha jabber Plugin also crashes (however erijo seems to be working on a fix), and Adium also chokes, and will connect only every couple of hours. It seems they should have done a bit more testing before!


Mobile me, Mobile schmu

I am currently trying out Apple's Mobile Me service, which is free in the first two months. It seems relatively nice, but has some drawbacks. On the plus side, you get 20 GB of storage space, or 40 GB for the family pack. Also you can track your iPhone if you lose it. The mail service is useful, but on the downside: It does not support server side filtering! That's a great, great bummer. Also it does not seem to support Apple's notion of filtering, called "intelligent mailboxes". If that were supported on the server, I would ditch my GMX ProMail account, and switch to using Mobile Me for mail services.


Elegantly making a dictionary of lists

In Python I sometimes want to make a dictionary of lists. So usually I would write something like:

mydic = {}
for something in somethingelse:

This however will not work, if somekey did not exist so far, because it will raise an exception. But there is help! You can use a collection:

import collections
mydic = collections.defaultdic(list)
for something in somethingelse:


PyQt dynamic uic example

Here is a minimal example for PyQt4, to set up a main window and connect a simple action to some slot. The documentation on doing this is sparse to say the least. So I hope this is helpful for anyone trying something similar. I assume that you have created a ui_MainWindow.ui file with Qt Designer, which contains a form derived from QMainWindow.

import sys
from PyQt4 import QtCore, QtGui, uic

class MyMainWindow(QtGui.QMainWindow):

def __init__(self):
self.ui = uic.loadUi("ui_MainWindow.ui", self)
self.connect(self.ui.actionOpen, QtCore.SIGNAL('triggered()'), self, QtCore.SLOT('open()'))

def open(self):
fileDialog = QtGui.QFileDialog(self, "Open file")

app = QtGui.QApplication(sys.argv)
mainWindow = MyMainWindow()


Not happy with Qt on OS X...

I really don't get happy with Qt 4.6 on OS X 10.6. Nokia rates Qt on that platform as Tier 2. Which means, it is not fully supported. This results in stupid things happening. With Licq, I currently have the problem that the whole program crashes with the following message:

+[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.

The problem here is that Qt 4.6 for 64 Bit is (rightly so) built using the Cocoa API, instead of the C-only Carbon API. Now it seems that Qt uses the NSUndoManager, which in turn has an undocumented (?) function _endTopLevelGroupings. And as the above mentioned message tells you, it is only safe to call that function from the main thread. Since the qt4-gui plugin of Licq runs in a separate thread, this assertion fails, and the whole program crashes. So this basically means you cannot start up your GUI from a secondary thread with Cocoa based Qt. This, I think, constitutes a bug in Qt.

Update: I submitted a bug tracker item, and erijo is producing a minimal example that will hopefully show the bug in action. Now let's wait and see.


Update on MacPorts: Qt working again

Good news: The Qt port of MacPorts is working again. The port was upgraded to Qt 4.6 and now it compiles again. Now all I need is a 64 bit CUDA package for Snow Leopard, and I'll be happy.


Preprocessor Tricks

This allows you to convert any preprocessor macro value to a string, e.g. for printing.

#include <iostream>

#define MEINMAKRO 1.3.4

#define STRINGIFY(x) #x

int main()
std::cout << TOSTRING(MEINMAKRO) << std::endl;
return 0;


Syncing Google Calendar with the iPhone or iPod Touch

Since several people asked me how to do this, after I twittered about this, here it comes: How to correctly sync the Google Calendar with the iPhone. First step is to create a new calendar account in the iPhone settings (Email, Calendar, Contacts) using the Exchange protocol. The finished account should look something like this:

You can also sync the contacts and emails, if you want, but that's optional. The second step is to go to http://m.google.com/sync/ to set up which of your google calendars you are going to sync. Beware: on the german iPhones, the page will display an error message, unless you switch to the english page!

That seems to be a bug on google's page. So after you've done this, you get a list of your iPhones and can select for each device which calendars to sync:


Some small iPhone address book nags

I am using the try-out version of Mobile Me for the iPhone. Syncing the device with the Macbook Pro. Whenever I go to my address book, all the contacts appear twice. Very strange, I though, until I noticed that I was in the Group "All contacts", which will show the contacts synced from the Mac and from Mobile Me. What a stupid way to present things. Right now, I just need to switch to "All contacts from my Mac" to fix this, but when I were to add another address book (say a corporate one or the Google one), I would be in trouble. Not very clever, Apple...

Qt woes on OS X 10.6...

Oh dear, Nokia and Macports do seem to hate me. I've spent half a day to get some version of Qt running on OS X 10.6.2. The problem is as follows. Nokia only provides 32 bit builds of their Qt SDK for OS X (universal binaries for PPC and i386) as can be seen here and here. Under OS X 10.5 this was no problem, since the whole system was basically 32 bit. But Snow Leopard now builds for x86_64 per default. Especially when using Macports. So I thought, lets just install the qt4-mac port from Macports. Wrong again! That port is currently broken. So, my project depends half on Qt and half on stuff from Macports. Now neither one is in a usable state. Ok, so I thought maybe I can force Macports to build in i386 mode only, to be compatible again with Qt. So I edited /opt/local/etc/macports.conf, cleaned the whole Macports tree and reinstalled. Fail again. This time, perl5 fails to build. That port is broken on 10.6 for non 64 bit builds. Hooray. Well, I give up for today, but will continue to investigate and will report back, as soon as either Nokia provides a decent 64 bit build, or Macports recovers and fixes any of their build issues.