Coding
As a software developer I generally work with either Python, for lightweight web development, or Java, for strongly typed specialized applications. The environments I like best are the command line, using Vim as my editor of choice, and the Eclipse IDE.
Python
Python is a flexible language, suitable for fast development and prototyping of web applications. We use the PyDev plugin in Eclipse for Xierpa development, a web environment built around a simple Twisted server.
Libraries
Python 2.6.2 (r262:71600, Apr 16 2009, 09:17:39) [GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import defcon >>> defcon.__version__ >>> dir(defcon) ['Anchor', 'Component', 'Contour', 'Features', 'Font', 'Glyph', 'Groups', 'Info', 'Kerning', 'Lib', 'Point', 'UnicodeData', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', 'addRepresentationFactory', 'objects', 'removeRepresentationFactory', 'tools', 'version'] >>> print defcon.version 0.1 >>> print defcon.__path__ ['/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/defcon'] >>>
Java
The Processing environment was originally developed by Casey Reas and Ben Fry at MIT and is written in Java. It is ideally suited for generative audiovisual work and infographics. Processing provides an interface for inexperienced non-techical users. However, the main, non-GUI functionality consists of a set of libraries. In Java, a language designed as being strictly object-oriented, everything is a package or a subpackage. Therefore, it is relatively easy to import the Processing core and Processing-specific libraries into a regular Java IDE, such as Eclipse. By downloading my code into a separate workspace, I can easily switch between workspaces containing Python projects and the workspace containing my Processing-based generative and infographics work.
The code that I’m developing is stored at GitHub. There is an official page for running GitHub projects in Eclipse (you need to scroll down a bit).
System Configuration
Especially for Python, many libraries actually wrap deeper-lying C/C++ code. On Linux-based systems, which generally come with a package manager of some sort, this can be relatively pain-free. However, on a newish Mac, this can mean that you need to be able to compile all sorts of dependencies, which can cause conflicts because architecture register sizes (32 vs. 64 bit); you need to choose one or more of the following options:
- Power PC (
-arch ppc), - Intel 32 bit (
-arch i386) or - Intel 64 (
-arch x86_64) bit.
Larger libraries, such as the PIL Imaging library, can have many dependencies, including those for JPEG and PNG encoding and reading and writing of several font formats such as OpenType and TrueType.
Dynamic Libraries
file /opt/local/lib/libxml2.2.dylib otool -L site-packages/PIL/_imaging.so
Architecture Flags
sudo env ARCHFLAGS="-arch x86_64 -arch i386" python setup.py install
Macports
sudo port upgrade --enforce-variants libxml2 +universal
Command Line Tips & Tricks
Over the years, an experienced programmer will develop certain techniques to do his job faster and more painless. Once you get yourself comfortable with the command line or shell, it will give you all sorts of benefits. Shell scripts, for example, are small programs that can make use of all the file system commands that are available and can make use of conditional statements and loops. There are also some commonly used commands that can give you limited control. I’ve been documenting some tricks I’ve been using a lot for a long time as a reminder for myself. Previous incarnations of this site contained information on all sorts of audiovisual stuff, but since I’ve moved on to more professional applications thanks my current position at a design studio, I stripped down the list to the bare essentials. I decided to write a little bit more of a in depth explanation of why these commands are useful to me. The find command, for example, will return all files below a certain current position in the file system tree:
find .The dot isn’t needed on Linux-based systems, however on OSX you need to provide a path explicitely even for the current folder position. An extra delete option will simply delete all files that correspond to a certain name pattern. Removing Finder metadata using find delete can be done like this:
find . -name '<name>' -delete
Another way is to pass on the results to the standard remove command, using so-called back ticks. So if you want to remove all subversion folders recursively from a branch:
rm -rf `find . -name .svn`
To remove the dot files on OSX, use
dot_clean
The disk usage command is perfect for finding out where the big files are located. I use this version to sort files in a human readable way:
du -ksh * | sort -n
How to set global ignores in Git:
git config --global core.excludesfile ignore-files.txt
I’ll add some more tips and tricks on grep, cronjobs and bash scripts soon!
Compresssion & Conversion
For compression of and conversion between audiovisual sources, command line tools can often be of help. mplayer and it’s encoding/decoding counterpart mencoder are basically your Swiss army knife of compression and conversion. For example, the basic command for retrieving audio from a video fragment looks like this:
mplayer -vo null -ao pcm:file=.wav <source />
Ripping audio from your DVD’s usually gives you good quality samples. Here’s how you do it:
mplayer -ao pcm:file=powaquatsi.wav dvd://2 -chapter 14 -alang eng
where the value behind dvd:// should load the title of the main DVD feature. Often, some trial and error is needed to find the correct index for the feature. Leaving the chapter part away grabs the entire fragment.


