Wednesday, July 30, 2008


How to make a compact beautiful PostScript or PDF file from a TeX file
LaTeX, PostScript, and PDF
ttfpt1 : True Type Font to Postscript Type 1 Converter
True Type to Type 1 Conversion Font HowTo
Embedding the Base-14 (Times, Helvetica...) fonts in PDFs created with LaTeX
How to insert figures into LaTeX articles
Getting to Grips with Latex - Floats, Figures and Captions
Graphics and Colour with LaTeX
LaTeX2e tricks
Controlling LaTeX Floats
Using TrueType fonts with TeX (LaTeX) and pdfTeX (pdfLaTeX)
CVPR 2006 Camera-ready copy notes

Embed all fonts with ghostscript

gs -sDEVICE=pdfwrite -q -dBATCH -dNOPAUSE -dSAFER -dPDFX -dPDFSETTINGS=/prepress -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dAutoFilterGrayImages=false -dGrayImageFilter=/FlateEncode -sOutputFile=out.pdf -c "<</NeverEmbed []>> setdistillerparams" -f in.pdf -c quit

pdf ps acm ieee

Dear me it was tough finding the right way to get my latest paper ready to submit to the ACM.

What they needed was basically are PS and PDF files created from TeX that had all the fonts embedded in them.

For PDFs, there were a lot of webpages that talked about adding the following line to: /usr/share/texmf/web2c/updmap.cfg

pdftexDownloadBase14 true

This did not work for me.

What did work for me was to use ghostscript to embed all the fonts in the PDF:

1) Generate PDF with pdflatex:

pdflatex in.tex

2) Embed all fonts with ghostscript

gs -sDEVICE=pdfwrite -q -dBATCH -dNOPAUSE -dSAFER -dPDFX -dPDFSETTINGS=/prepress -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dAutoFilterGrayImages=false -dGrayImageFilter=/FlateEncode -sOutputFile=out.pdf -c "<</NeverEmbed []>> setdistillerparams" -f in.pdf -c quit

3) Make sure all the fonts are embedded

pdffonts out.pdf

For generating a Postscript file:

1. Add the following lines to /usr/share/texmf/web2c/updmap.cfg

sudo vi /usr/share/texmf/web2c/updmap.cfg

dvipsDownloadBase35 true
dvipsDownloadBase14 true

2. Update font map files for TeX output drivers.

sudo updmap

3. Create the .dvi file

latex file.tex

4. Create the .ps file

dvips file.dvi -o

You might not have to do steps 1 and 2, but I had a figure with an embedded Helvetica font in it, and the first two lines were necessary to properly embed that font as well.

Monday, July 28, 2008




TAPESTREA : Basic UI information
The Audicle : A Context-sensitive, On-the-fly Audio Programming Environ/mentality



Use sox for resampling audio:

sox play.wav -r 48000 play-rate-48000.wav rate



Tapestrea - Techniques And Paradigms for Expressive Synthesis, Transformation,
and Rendering of Environmental Audio (also known as taps)

A new program from Perry Cook's Lab to analyse and synthesize sound.

Saturday, July 26, 2008

Friday, July 25, 2008


Vint Cerf is just about done with the Interplanetary Internet Protocol.


0MQ - Zero Message Queue. Fastest. Messaging. Ever.

Nice, I wonder how it compares to my current favorite Amazon SQS.


The Sanskrit Heritage Site - The first online Sanskrit dictionary.

ls -lrt

Document-centric GNOME. About making the desktop metaphor work better to find files.

I can has a solution:

ls -lrt


find -ctime +3

However, find time arguments suck, I always have to read the man page to figure them out. Someone should write a new flag for find where you can enter a nice human readable date, like "between 3 and 7 days ago".


Human Mirror! another awesome one from Improv Everywhere.

Thursday, July 24, 2008


I'm playing with Sonic Visualiser, a program that lets you examine sound files in a wide variety of graphical ways. Neat.

Sonic Visualiser Manual
Getting Started
Techniques for analysing recordings: an introduction

The Vamp audio analysis plugin system - Plugins to do analysis in Sonic Visualiser
Vamp developer information

scroll lock

For some reason when I was messing around with xkeycaps, my scroll lock key started scroll locking. I fixed it with:

xmodmap -e "clear Mod5"

Wednesday, July 23, 2008

gist emacs bindings

gist is a website where you can paste little snippets of code.

It's related to pastie, but has emacs bindings.

;; gist.el --- Emacs integration for
;; Copyright (C) 2008 Christian Neukirchen <>
;; Licensed under the same terms as Emacs.

;; Version: 0.2
;; 21jul2008 +chris+

;; Ideas: fetch & fork

(defun gist-region (begin end)
"Post the current region as a new paste at
Copies the URL into the kill ring."
(interactive "r")
(let* ((file (or (buffer-file-name) (buffer-name)))
(name (file-name-nondirectory file))
(ext (or (file-name-extension file) "txt"))
(output (generate-new-buffer " *gist*")))
begin end
(format (concat "curl -sS "
"-F 'file_ext[gistfile1]=.%s' "
"-F 'file_name[gistfile1]=%s' "
"-F 'file_contents[gistfile1]=<-' "
" &") ext name)
(with-current-buffer output
(re-search-backward "href=\"\\(.*\\)\"")
(message "Paste created: %s" (match-string 1))
(kill-new (match-string 1)))
(kill-buffer output)))

(defun gist-buffer ()
"Post the current buffer as a new paste at
Copies the URL into the kill ring."
(gist-region (point-min) (point-max)))

(provide 'gist)
;;; gist.el ends here.


gist is similar to pastie, and has emacs bindings.


Japanese onomatopoeia at everything2.


Tuesday, July 22, 2008


From : ocn506

Micro and Macro Readings Main ideas (excerpted or paraphrased) and page number:
detail can add clarification
39 - graphical indexing can be useful instead of tables to show how science changes over time
43 - consider innovative ways to order information
50 - Tufte is really wordy sometimes :)
51 - high density of information is good, clutter is a design flaw

38 - micro/macro designs report immense detail, organized complexity through multiple and hierarchical layers of contextual reading
46 - micro/macro designs have multifunctioning graphical elements
49 - micro/macro designs portray large quantities of data at high densities
50 - micro/macro designs enforce both local and global comparisons and at the same time, avoid the disruption of context switching
51 - clutter and confusion are failures of design, not attributes of information; seek instead a rich texture of data, a comparative context, an understanding of complexity revealed with an economy of means.

ui patterns

User Interface Design Patterns:

Designing Interfaces - A really great looking book, most of content is on this website. Want have. - A site where you can post new user interface design patterns. Nice.
Yahoo Design Pattern Library
Pattern library from
User Interface Design Patterns



Spring-Loaded Modes - A spring-loaded mode is one that persists only as long as the user explicitly does something to keep it active. The most typical example is a state that exists as long as the user holds down a mouse button. As soon as the user releases the button, the system exits the temporary state.

This is a nice solution to a user-interface problem I've been trying to solve. The spring loaded mode will be triggered by the user holding down the control key. Nice.



I had a string field in a MySQL database connected to Rails that contained a long series of mostly numbers:


And I wanted to order them numerically. I found the answer at How to do natural alpha-numeric sort in MySQL and the code I use is:

@recordings = Recording.paginate :page => params[:page], :per_page => 10, :order => 'tape + 0', :conditions => { :year => params[:id] }

That little:

:order => 'tape + 0'

Is what was needed. Neat!


lfs - Logic File System, the filesystem of discriminating hackers.

So funny! Check this out:

ls '/lfs/ext:c|ext:h/date:*--*--2008/.ext/'

mplayer -z '/lfs/ext:mp3/genre:Disco|genre:Electro/year:<70/.ext/'*.mp3

firefox ''

Want have.

dm - Visualizing public data

Sunday, July 20, 2008


Sadly, mozex isn't working anymore for Firefox 3.0. I was looking at hacking it to make it work, and make it work better with Emacs, but then I found:

about:config view_source.editor.path

Unfortunately, this didn't seem to work with my emacsclient setup, until I found:

Emacs as default View Page Source / Greasemonkey editor in Firefox on Windows

So, I just editted my "firefox-emacsclient" script to look like this:

/usr/sness/emacs/bin/emacsclient -c -n -s sness $1

and I can get beautiful source code viewed in my favorite editor.

Richard Stallman (as St IGNUcius) : Emacs vs Vi

Emacs Org-mode - a system for note-taking and project planning



arduino python bridge
Arduino and Python
SimpleMessageSystem - is a library for Arduino 0004 and up. Itfacilitates communication with terminals or message based programs like Pure Data or Max/Msp. All Serial input and output will be made and interpreted as ASCII characters.
Arduino + Firmata + Pyduino (Python)



OSC Overview and Concepts - For the Make Controller
Communicate with the Make Controller Kit via OSC

OpenSound Control in Max/MSP for Macintosh and Windows

oscpack - s simply a set of C++ classes for packing and unpacking OSC packets. Oscpack includes a minimal set of UDP networking classes for Windows and POSIX which are sufficient for writing many OSC applications and servers.

OSC and Python on the MC
OSC and Python on the MC #2

Make Controller Kits and MAX/MSP
MAX-msp and the Make Controller


Python - SimpleOSC : v0.2.5 - Great little Python API for talking to OSC

Here's some minimal code examples that I came up with last night to talk to the Make Controller. These are as minimal as you can get, just the most basic functions so you can see what is going on clearly.



import osc

def testDigitalOut():
""" a minimal function that flashes an LED connected to the
first digital output on the Make Controller

import time

i = 1
while 1:
i = (i + 1) % 2
print i
osc.sendMsg("/digitalout/0/value", [i], "", 10000)


if __name__ == '__main__': testDigitalOut()



import osc

def testAnalogIn():
""" a simple function that requests the value of the first
analog input on the Make Controller
osc.listen('', 10000)
osc.bind(printStuff, "/analogin/0/value")

import time

while 1:
osc.sendMsg("/analogin/0/value", [], "", 10000)


def printStuff(*msg):
"""deals with "print" tagged OSC addresses """
print msg[0][0], "=", msg[0][2]

if __name__ == '__main__': testAnalogIn()


Barcelona Food Girl has a post about Port Wine. I used to get some fine ports in the Netherlands, mmm.

Thursday, July 17, 2008

The Chemical Brothers - The Private Psychedlic Reel

Chemical Brothers - Out Of Control

Chemical Brothers - Hey Boy Hey Girl

Ministry Jesus built my hotrod

Thunderheist - Grahm Interview

The Jesus And The Mary Chain - You Trip Me Up

Disasteradio - international deviance

Disasteradio - Awesome Feelings





What do you do if you want to suspend a process but your keybinding for suspend isn't working?

kill -SIGSTOP 29273

You can then resume it later with

kill -SIGCONT 29273

or on the terminal you started it from:



Splitting and Merging PDFs

Merge PDFs

gs -sDEVICE=pdfwrite -dNOPAUSE -dQUIET -dBATCH -sOutputFile=out.pdf *.pdf

Split PDFs

gs -sDEVICE=pdfwrite -dNOPAUSE -dQUIET -dBATCH -dFirstPage=m -dLastPage=n -sOutputFile=out.pdf in.pdf

Wednesday, July 16, 2008

mac os x cli

Some neat tools for the Command Line on Mac OS X:

From :
Mac OS X command line goodies
CPU Temperature and Hardware Sensor Values in Terminal

/usr/sbin/system_profiler | less
ioreg -l | less


Installing libjpeg on Mac OS X:

tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
cp /usr/share/libtool/config.sub .
cp /usr/share/libtool/config.guess .
./configure --enable-shared --enable-static
sudo make install
sudo ranlib /usr/local/lib/libjpeg.a

Tuesday, July 15, 2008



Goregous plotting out of Python with matplotlib



Matlab spectrogram code

function X = spectrogram(x,nfft,fs,window,noverlap,doplot,dbdown);

%SPECTROGRAM Calculate spectrogram from signal.
% spectrogram for the signal in vector A.
% NFFT is the FFT size used for each frame of A. It should be a
% power of 2 for fastest computation of the spectrogram.
% Fs is the sampling frequency. Since all processing parameters are
% in units of samples, Fs does not effect the spectrogram itself,
% but it is used for axis scaling in the plot produced when
% SPECTROGRAM is called with no output argument (see below).
% WINDOW is the length M window function applied, IN ZERO-PHASE
% FORM, to each frame of A. M cannot exceed NFFT. For M<NFFT,
% NFFT-M zeros are inserted in the FFT buffer (for interpolated
% zero-phase processing). The window should be supplied in CAUSAL
% NOVERLAP is the number of samples the sections of A overlap, if
% nonnegative. If negative, -NOVERLAP is the "hop size", \ie, the
% number of samples to advance successive windows. (The overlap is
% the window length minus the hop size.) The hop size is called
% NHOP below. NOVERLAP must be less than M.
% Thus, SPECTROGRAM splits the signal into overlapping segments of
% length M, windows each segment with the length M WINDOW vector, in
% zero-phase form, and forms the columns of B with their
% zero-padded, length NFFT discrete Fourier transforms.
% With no output argument B, SPECTROGRAM plots the dB magnitude of
% the spectrogram in the current figure, using
% IMAGESC(T,F,20*log10(ABS(B))), AXIS XY, COLORMAP(JET) so the low
% frequency content of the first portion of the signal is displayed
% in the lower left corner of the axes.
% Each column of B contains an estimate of the short-term,
% time-localized frequency content of the signal A. Time increases
% linearly across the columns of B, from left to right. Frequency
% increases linearly down the rows, starting at 0.
% If A is a length NX complex signal, B is returned as a complex
% matrix with NFFT rows and
% k = floor((NX-NOVERLAP)/(length(WINDOW)-NOVERLAP))
% = floor((NX-NOVERLAP)/NHOP)
% columns. When A is real, only the NFFT/2+1 rows are needed when
% NFFT even, and the first (NFFT+1)/2 rows are sufficient for
% inversion when NFFT is odd.
% If DOPLOT is nonzero, the spectrogram will be plotted in any case.
% DBDOWN (default=100) sets the clip level below the maximum in dB.
% See also: Matlab's SPECGRAM function.
% 02/04/02/jos: Created
% 02/12/04/jos: Added dbdown

if nargin<7, dbdown=100; end
if nargin<6, doplot=0; end
if nargin<5, noverlap=256; end
if nargin<4, window=Hamming(512); end
if nargin<3, fs=1; end
if nargin<2, nfft=2048; end


M = length(window)
if (M<2) error(...
'spectrogram: Expect complete window, not just its length');
Modd = mod(M,2); % 0 if M even, 1 if odd
Mo2 = (M-Modd)/2;
w = window(:); % Make sure its a column
zp = zeros(nfft-M,1);
wzp = [w(Mo2+1:M);zp;w(1:Mo2)];

if noverlap<0
nhop = - noverlap;
noverlap = M-nhop;
nhop = M-noverlap;

nx = length(x);
nframes = 1+floor((nx-noverlap)/nhop);

X = zeros(nfft,nframes);
x = x(:); % make sure it's a column
xoff = 0;
for m=1:nframes-1
xframe = x(xoff+1:xoff+M); % extract frame of input data
xoff = xoff + nhop; % advance in-pointer by hop size
xzp = [xframe(Mo2+1:M);zp;xframe(1:Mo2)];
xw = wzp .* xzp;
X(:,m) = fft(xw);

if (nargout==0) | doplot
t = (0:nframes-1)*nhop/fs;
f = 0.001*(0:nfft-1)*fs/nfft;
Xdb = 20*log10(abs(X));
Xmax = max(max(Xdb));
% Clip lower limit to -dbdown dB so nulls don't dominate:
clipvals = [Xmax-dbdown,Xmax];
% grid;
axis xy;
xlabel('Time (sec)');
ylabel('Freq (kHz)');

Monday, July 14, 2008


urxvt mouseless url yanking - Nice.

I love urxvt, I use it exclusively now. Wish I had more time to delve into doing neat things like this, but someday I will. zsh, emacs and urxvt forever. These three will keep me going for at least this lifetime.


The Edirol UA101 - Nice USB sound card with lots of inputs and outputs that works well with Linux.

Friday, July 11, 2008


My friend and colleague is playing at Electric Eclectics, a new music festival in Toronto.

Check out a video of him playing the RadioDrum:


Thursday, July 10, 2008


Imagemagick to convert the Orcalab labbooks to jpgs

convert -define pdf:use-cropbox=true -density 600 test.pdf -resize 1042 test.jpg

or a big pdf with a number of pages:

convert -define pdf:use-cropbox=true -density 600 aug04\ -\ aug13\ 2005.pdf -resize 800 image_%03d.jpg


Imagemagick to convert the Orcalab labbooks to jpgs

convert -define pdf:use-cropbox=true -density 600 test.pdf -resize 1042 test.jpg

Wednesday, July 09, 2008


Rails Migrations Cheat Sheet - Very well done, tons of info.


A really neat article where some famous typographers are asked to show their handwriting. Neato.


I'm going to use Protocol Buffers for doing my data serialization in my new projects. protobuf is from Google and is a way of encoding structured data in an efficient yet extensible format. Google uses Protocol Buffers for almost all of its internal RPC protocols and file formats. There is an overview of Protocol Buffers that is good reading.

You know, for years I promoted the use of XML for data interchange, but now I think that XML is too heavyweight for doing most kinds of data interchange, and should be instead used for data archiving. That's too bad, XML looked really sweet there, but really, performance does matter.

Tuesday, July 08, 2008



Installing MySQL on OS X:

A great resource is at

Here's the commands I used:

./configure --prefix=/usr/local/mysql --with-unix-socket-path=/usr/local/mysql/run/mysql_socket --with-mysqld-user=mysql --with-comment --with-debug
sudo make install
sudo /usr/local/mysql/bin/mysql_install_db --force
sudo mkdir /usr/local/mysql/run
sudo mkdir /usr/local/mysql/var
sudo find /usr/local/mysql -exec sudo chown mysql:mysql {} \;
sudo /usr/local/mysql/bin/mysqld_safe --user=mysql &
/usr/local/mysql/bin/mysqladmin -u root password 'a_very_secure_password_of_which_this_is_not'

Monday, July 07, 2008

c in flash

So cool, Scott Petersen from Adobe recently gave a talk where he talks about compiling C to run inside Flash. This is with Tamarin which is a high-performance, open source implementation of the ECMAScript 4th edition (ES4) language specification.


Andrew Turnbull still uses Windows 95. Hardcore.

You know, in some ways Windows 95 was the best Windows ever. Windows XP has it's good points as well.

But for me, it's Linux forever. Well, some kind of GPLed Unix/Plan9/Hurd something forever at least.

But Emacs forever!

I'll be 90 years old, still working in Emacs, you can bet on that.


Brutalism, the movement in architecture came from the Le Corbusier's "Beton brut" which is French for "raw concrete". I never knew this!



automount in Mac OS X.


Saturday, July 05, 2008


KinetiK Engine and KarmetiK MahaDeviBot

Satnam and the KarmetiK MahaDeviBot

KarmetiK MahaDeviBot with ESitars and EDilruba


Make a Theremin


Happy 50th birthday Lisp!




Tea cup Theremin. Turn a cup of liquid into a theremin. Got to try this for the MIR course, that might rock people's worlds.

Watch the video


monome + keyboard. Interesting idea, I like.


httpmr - HTTPMR is an implementation of Google's famous Map/Reduce data processing model on clusters of HTTP servers.

Sweet. I got to try this out.


Collaborate and Connect with Subversion. Nice.

I'm using git for my personal version control, and subversion for collaborating with groups.

I find this works great, I just put the svn tree inside an existing git project, and then use git to track my personal changes, and then when I have a really solid version, commit that to svn.


test c++

googletest - Google's framework for writing C++ tests on a variety of platforms (Linux, Mac OS X, Windows, Windows CE, and Symbian). Based on the xUnit architecture. Supports automatic test discovery, a rich set of assertions, user-defined assertions, death tests, fatal and non-fatal failures, various options for running the tests, and XML test report generation.

Interesting. I wonder how it compares to cxxunit.

tex + wiki

= WiX.

WIX (pronounced 'wick') is a text markup format. Its syntax is a blend of Donald Knuth's TEX and various wiki markup.



The vi editor inside Emacs. Perverse!

Friday, July 04, 2008


An excerpt from my latest paper:

"Instead of viewing these pitches to be deviations
of pre-existing ``normalized'' scales our method defines a more
differentiated scale from the outset. With our approach the scale
tones do not require ``normalization'' and thereby exist in an
autonomous microtonal environment defined solely on statistical
occurrence of pitch within a temporal unfolding of the given melodic

Thursday, July 03, 2008


Making predictions with Weka

Saving and loading models

You save a trained classifier with the -d option (dumping), e.g.:

java weka.classifiers.trees.J48 -t /some/where/train.arff -d /other/place/j48.model

And you can load it with -l and use it on a test set, e.g.:

java weka.classifiers.trees.J48 -l /other/place/j48.model -T /some/where/test.arff

weka commandline primer
Running weka from the command line
[Wekalist] How to attach instance IDs to classified instances?
Batch Filtering in Weka

Wednesday, July 02, 2008


marsyas svn

To install the latest Marsyas via svn (subversion) use the command:

svn co marsyas

Tuesday, July 01, 2008


The DuinoStamp.

I like.


Build a Logic Probe from a kit.



The Continuum.



The indeterminacy of translation:

"Consider Quine's example of the word 'gavagai' uttered by a native upon seeing a rabbit[1]. The linguist could do what seems natural and translate this as 'Lo, a rabbit.' But other translations would be compatible with all the evidence he has: 'Lo, food'; 'Let's go hunting'; 'There will be a storm tonight' (these natives may be superstitious); 'Lo, a momentary rabbit-stage'; 'Lo, an undetached rabbit-part.' Some of these might become less likely ? that is, become more unwieldy hypotheses ? in the light of subsequent observation. Others can only be ruled out by querying the natives: An affirmative answer to 'Is this the same gavagai as that earlier one?' will rule out 'momentary rabbit stage,' and so forth. But these questions can only be asked once the linguist has mastered much of the natives' grammar and abstract vocabulary; that in turn can only be done on the basis of hypotheses derived from simpler, observation-connected bits of language; and those sentences, on their own, admit of multiple interpretations, as we have seen."


Beeswax - is an information management system inspired by Lotus Agenda. It aims to recreate Agenda's flexibility and efficiency in a clutter-free, text-based (ncursesw) user interface with vi key bindings. Beeswax views & reports will have specifications for sections, columns, filtering, and sorting.

Can we have this as a Emacs Lisp extension please?


go forth


Tenet the first:oiu isn't unix
Tenet the second:We don't need no steenking files
Tenet the third:We don't need no steenking linkers either
Tenet the fourth:There is but one tree although manifold are its roots and branches
Tenet the fifth:The documentation is the code



testing flash

The flash-selenium project - aims to extend the Selenium RC clients for adding Flash communication capabilities.
Testing Flash with Selenium RC
AutoTestFlash - This is a tool to record and play UI Tests in flash applications. UI Testing is better than Unit Testing because usually it enables a larger coverage and does not have impact in refactorings. The recorder also makes it easier to create tests.

Ummm, FAIL: UI Testing is *not* better than unit testing, but it's a good adjunct. Unit tests, Regression Tests and UI tests are all important parts of testing.

testing flash

The flash-selenium project - aims to extend the Selenium RC clients for adding Flash communication capabilities.
Testing Flash with Selenium RC
AutoTestFlash - This is a tool to record and play UI Tests in flash applications. UI Testing is better than Unit Testing because usually it enables a larger coverage and does not have impact in refactorings. The recorder also makes it easier to create tests.

Ummm, FAIL: UI Testing is *not* better than unit testing, but it's a good adjunct. Unit tests, Regression Tests and UI tests are all important parts of testing.




"Q: when running Weka, we get "Train and test set are not compatible" error.
A: 1. Make sure that the train and test sets have EXACTLY the same attributes (fields),
including last entry:
@attribute Class {MED,MGL,RHB,EPD,JPA}
2. If the attribute descriptions appear to be identical but you still get the same error, you may have an invisible control character in one of the files. Remove the attribute descriptions from the test file and replace them with the attribute descriptions from the train file. That may help.
3. You can also run Weka from the command line, e.g.
java weka.classifiers.IB1 -t train_file.arff -T test_file.arff -p 0

From : Data Mining Course Final Project


Chroma Feature Analysis and Synthesis

MA Toolbox for Matlab - Implementing Similarity Measures for Audio


The Google C++ Style Guide.



Running weka from the command line:

java -classpath /usr/sness/weka-3-4-12/weka.jar weka.classifiers.bayes.NaiveBayesSimple -t 446A.arff