Sunday, October 19, 2008

Building Python 2.3.5 on Ubuntu Intrepid (8.10)

I'm working on Testoob again, and I want to test its compatibility with different Python versions.

Usually it's no sweat - all I need is to download the sources and then

./configure --prefix=...
make
make install

But when building Python 2.3.5 on Ubuntu Intrepid I get a neat little error:

*** buffer overflow detected ***: ./python terminated

I've been out of gcc land for a while, and it seems several security compiler flags are now enabled by default. For some reason Python 2.3.5's configure ignores CFLAGS, but BASECFLAGS is honored:

./configure BASECFLAGS=-U_FORTIFY_SOURCE --prefix=...
make
make install

And Python 2.3.5 installs correctly.

Monday, October 6, 2008

Ripping and encoding music with EAC, LAME, and Zsh

This is my current ripping+encoding scheme (on Windows, but LAME part is relevant for *nix as well):

  • Use the Hydrogenaudio wiki as an authoritative information source
  • Rip to WAV with Exact Audio Copy for best ripping precision - configure EAC with the configuration guide from Hydrogenaudio
  • Encode to MP3 with the latest LAME (Windows binaries here)
  • Encode high-quality (-V 2) MP3s for the home computer, low-quality (-V 6) MP3s for the portable player

Once the ripping is done, I use this shell-script magic to encode all the WAVs in high quality (low quality left as an exercise):

for x in **/*.wav; do
  mkdir -p ../high/"$(dirname $x)"
  /cygdrive/c/lame3.98/lame.exe -V 2 "$x" ../high/"${x/.wav/.mp3}"
done

This lets me get the attention-intensive need-to-change-the-CD-in-the-drive ripping out of the way quickly. I don't even need to be around later when its encoding.

This requires Zsh with extended globbing turned on (I use it on Windows through Cygwin). Non-zsh note: you can probably use 'find' with or without 'xargs' instead of the '**/*.wav' recursive globbing, but which one is cooler? :-)

Sunday, October 5, 2008

QUnit and URL query string

QUnit is a really nice testing framework for JavaScript (jQuery's own framework - here's the tutorial I used).

I wanted to put some tests in the following URL:

http://localhost/tests?param1¶m2
but my tests weren't running - I kept getting:
"0 tests of 0 failed."
I learned that QUnit uses the URL query string to filter which tests to run, and in this case I don't want it to.

QUnit will run any test that has a substring-match with one of the query parameters. So "&foo&" in the URL will match tests "food" and "buffoon", and I guess this also means that the empty string will match anything. I appended a '&' to the end of the URL:

http://localhost/tests?param1¶m2&
and now QUnit runs all my tests. Sweet!

Thursday, October 2, 2008

Changing Trac's Roadmap Queries

Trac 0.11 allows customizing ticket workflows and we created a new 'resolved' state (pending QA verification), but now 'resolved' tickets show up as active in the milestone queries in the roadmap page.

It turns out that the Trac developers were aware of this too and added the [milestone-groups] trac.ini section to allow customizing the milestone queries, what's marked "active" or "closed", and more. Nice.