Inkscape just got better

I got an invaluable tip regarding Inkscape on OS X today.

One of the problems I have always had with Inkscape is the difficulty selecting object hidden behind others. I have solved this by tabbing, or putting objects in different layers.

It turns out there is a much better way. Simply alt-click multiple times in the same place to toggle between all objects covering that pixel.

Now there is only one problem. The alt key has never worked for me in X on my MacBook Pro. But there is the simple fix.

Put the following two lines into ~/.Xmodmap (you probably need to create the file first):

keycode 66 = Meta_L

keycode 69 = Meta_R

As a bonus I can now create clones using the keyboard shortcut. That is also a time saver.

Thank you Richard for making Inkscape even better.


Profiling python – the easy way

I have this line I need to look up sometimes. By posting it here, I will always know where to find it:

$ python -m cProfile --sort cumulative script.py

It usually gives me a good indication on which parts of my program that are consuming my precious CPU cycles. If you run it on a large program, you will probably want to pipe that into something like head -40.

Right now I needed it to improve the performance of a problem analyzer i am building. It is part of a larger project that I hope will result in a game released on the App Store before Christmas. But more about that in a later post.