Saturday, August 28, 2010

Parallel processing in a bash script - wait

Use the 'wait' command.

some command &
some other command &

command that needs the results of the previous two

Monday, August 16, 2010

Strange crash with pyglet, wxwindows and multiprocessing

The following code will crash. Commenting out the wx import (note that wx is never used) will work as expected.
import multiprocessing as mp
import wx

def run():
import pyglet
w = pyglet.window.Window(resizable=True)
while not w.has_exit:

p = mp.Process(target=run)

This may be related to the shadow window bug, but setting shadow window to False does not help.

Friday, August 6, 2010

Svn revision numbers

From here:

"Subversion's revision numbers apply to entire trees, not individual files. Each revision number selects an entire tree, a particular state of the repository after some committed change. Another way to think about it is that revision N represents the state of the repository filesystem after the Nth commit. When a Subversion user talks about “revision 5 of foo.c”, they really mean “foo.c as it appears in revision 5.” Notice that in general, revisions N and M of a file do not necessarily differ!"

Reverting code checked into svn

Problem: Someone has checked in code into svn that needs to be reverted back to an older version


svn revert * #To remove all local edits to your working directory
svn merge -r HEAD:XX svn://path/to/repository/trunk/modulename #add the clean revision's code to your working directory as changes. XX is the clean revision.
svn -ci -m"Reverted back to XX" #commit all the 'changes' to the repo

Some fun with sound on Mac OS X

osascript -e “set Volume 4″ #Sets volume on machine
say -v Whisper “That was fun\!" #Uses text to speech converter

Change name of mounted volume on Mac OS X

diskutil rename /Volumes/Volume NewVolName

Some others:
Set Bonjour Name
sudo scutil –set LocalHostName NewName
Set Sharing Name
sudo scutil –set ComputerName NewName

Thursday, August 5, 2010

Latex/LyX/Beamer on Mac OS X

  1. MacTex
  2. Tex Live utility.
  3. Update/install the beamer package
  4. The beamer.layout file (referred to in the documentation) is NOT part of the beamer distribution but part of the LyX distribution. A recent LyX distribution should have it installed already
  5. You should now have a 'beamer' document class: use that and follow the beamer guide.

Tuesday, August 3, 2010

Task Coach

Task Coach : a really good, open source to-do list software that lets you make categories and sub categories and tasks and sub-tasks.  Incidentally, written in Python.

Matplotlib: change axis ticklabel properties

ax = pylab.gca()
labels = ax.get_xticklabels()
pylab.setp(labels, rotation=30, fontsize=10)