Few 2D Graphics Optimization Tips

Here are few optimization techniques that were handy to me recently; they mostly concern 2D graphics programming, where these patterns often emerge, but are helpful anywhere where you have to iterate and update data.

In short:

  • iterate
  • don’t do if‘s
  • map all you can
  • don’t float
  • cache your reads

Continue reading

Change Diff Program for Subversion (SVN) in Linux

I always forget this, thought it’s trivial.

To change the program you use for diff-ing, for editing of the commit logs, and much more, edit the ~/.subversion/config file, e.g.

editor-cmd = vim
diff-cmd = meld

The file is well commented, so you should find your way around it easily.

Note: with update to Ubuntu 11.04, meld stopped to work as an SVN diff program for me (seems like support for ‘-v’ parameter has been dropped); this can be solved easily – just create a new script, e.g. /usr/bin/svnmeld containing:

#!/bin/bash
meld "$6" "$7"

then chmod it as executable, and use diff-cmd = svnmeld in your SVN config file.

Remapping keyboard keys in Linux

For some reason, Delete and Insert keys are combined on my laptop (ASUS). You have to press fn key and Delete key to get Insert.

The simple system-wide solution to this is the xmodmap utility; this utility allows you to map any key to any other key.

In my case, I decided to use Pause key instead of Insert (how often do you need the Pause key anyways?), and this is all you have to do:

xmodmap -e "keysym Pause = Insert Insert Insert Insert"

Add it to rc‘s to get this automatically run on system startup.

Note: in the xmodmap command above, the 1st Insert is a key press with no modifier pressed, 2nd with Shift, 3rd with Ctrl, 4th with Ctrl+Shift.