McCain a Panamanian Sleeper Agent?

John Noriega McCain is foreign-born! What if Panama considers him a citizen? His loyalties could be dangerously divided! How can we trust this man to not be a Panamanian sleeper agent? Look at him, proudly embracing the costume of his true homeland:

John McCain, in the costume of his native land

Maybe all of these zealots who are swayed by his fancy speeches and claims of patriotism are willing to elect this dangerous man to be our commander in chief, but I am not! Spread the word…


Some charts from the New York Times presenting data from the Democratic primary battle. I’m not sure what conclusions, if any, can be drawn from the first chart, which shows that out of the states which Bush won in 2004 that have held their primary contests already, Obama’s gained 96 delegates net over Clinton, while in Kerry states, Clinton netted 15 — too many other variables correlate with “red” vs. “blue” statehood.

The other two are informative1, though; they show that superdelegates not deciding this race is about as likely as Huckabee’s “miracle”, and that this race would be just as close if the primaries were winner-takes-all, either by state or by congressional district.


  1. Tufte would note that they’re extremely low-density, however. 


As reported by Chad, Ridley Scott is making a movie based on Monopoly. Chad pooh-poohs the idea, but I see a few interesting directions this could take:

  • “What do you expect me to do, Race Car, mortgage Baltic Avenue?” “No, Mr. Thimble, I expect you to die.”
  • “Pop quiz hot-shot: You’ve just rolled your second doubles. If you roll doubles again, the bus explodes. If you don’t roll doubles, I kill every man, woman, and child in Marvin Gardens. What do you do? What do you do?!”
  • “Ye can take our hotels, but ye’ll never take our FREEDOM!!”

LanguageLog describes the havoc wreaked by journalists’ inattentive use of spell-checkers. For instance, the following from a Reuters article:

With its highly evolved social structure of tens of thousands of worker bees commanded by Queen Elizabeth, the honey bee genome could also improve the search for genes linked to social behavior.


I’ve been enjoying reading the coverage of the primaries. It’s fun to read about the mechanics of things like delegate apportionment that aren’t usually as important as they are this year. I have a long post about it on Liz’s new politics forum for those of you who are into that sort of thing.


Prince Charles appears at energy summit via hologram.


Richard Knarr, the co-founder of Wham-O, died today. Wham-O was responsible for the Hula Hoop and the Superball, and for popularizing the Frisbee.

Their first marketing idea was a slingshot; they had been using one to hurl meat to their pet falcons to train them.


Switching Finks

One of the open-source projects I contribute to is Fink, a package manager for OS X; if you’ve used apt-get or yum on Linux, it provides a similar facility, allowing you to install, say, GnuPG by running fink install gnupg. It installs things into its own directory tree, rooted at /sw by default, to avoid interfering with things shipped by Apple (/, /usr) or manually installed by the user (/usr/local.) That is, if you have Fink installed, your system will have /sw/bin, /sw/lib, /sw/etc, /sw/share/man, &c.

So that you can run things installed in these nonstandard locations, Fink provides some shell commands in /sw/bin/init.sh which edit environment variables like PATH and MANPATH to include the /sw/* directories. Most Fink users have . /sw/bin/init.sh in their ~/.profile, so these commands will be invoked when their shell starts.

Having my shell automatically pull in Fink at startup doesn’t work for me, though. It’s important to me to have a clean environment available. For instance, when I’m contributing to non-Fink open-source projects, trying to help someone who doesn’t have Fink installed troubleshoot something, or submitting a bug report for a program that interacts with other programs where I have the Fink version installed, but Apple ships a different version with the system.1 (Note that this is only an issue if program A interacts with program B by invoking it as a standalone process without using an absolute path.2)

Also, as a Fink developer, I actually have multiple Fink installations at different paths,3 and I only want one loaded at a time; I don’t want to activate /Volumes/SandBox/fink/dev-sw in an environment where /Volumes/SandBox/fink/sw has already been pulled in!

It’s much easier to pull Fink stuff in later when I need it than to undo the changes that /sw/bin/init.sh makes to my environment. My solution for making it easy to activate a particular Fink installation was to add the following to ~/.bashrc:

  1. if [ -n "$SW" ]
  2. then export CFLAGS="-I$SW/include"
  3. export LDFLAGS="-L$SW/lib"
  4. export CXXFLAGS="$CFLAGS"
  5. export CPPFLAGS="$CXXFLAGS"
  6. export ACLOCAL_FLAGS="-I \"$SW/share/aclocal\""
  7. export PKG_CONFIG_PATH="$SW/lib/pkgconfig"
  8. export PS1="[$SW_DISPNAME \\W@$(hostname -s)]\\\$ "
  9. . "$SW/bin/init.sh"
  10. export PATH=~/bin:"$PATH"
  11. fi

What this does is arranges it so that if I start a new shell with SW and SW_DISPNAME set, it’ll pull in the Fink installation rooted at the directory $SW and put $SW_DISPNAME in my shell prompt so that I can see which environment I’m using. The extra environment variables before . $SW/bin/init.sh set things up so that if I compile things by hand, they’ll find and link against Fink-installed libraries; the PATH setting at the end is because init.sh places the Fink bin directory at the front of the PATH, and I want my personal bin directory to come before it.

I run the following script (saved as ~/bin/finkinit) when I want to pull in Fink:

  1. #!/bin/bash
  2.  
  3. FINK=${1:-main}
  4.  
  5. case "$FINK" in
  6. main)
  7. SW=/Volumes/SandBox/fink/sw
  8. SW_DISPNAME="fink"
  9. ;;
  10. dev)
  11. SW=/Volumes/SandBox/fink/dev-sw
  12. SW_DISPNAME="fink-dev"
  13. ;;
  14. *) echo "Unknown fink install '$FINK'" >&2 ; exit 1
  15. esac
  16.  
  17. export SW SW_DISPNAME
  18. exec /bin/bash

This gives me a subshell with Fink turned on, which I can exit out of when I want to return to a clean environment. If I run it as finkinit, I get my main Fink installation, or I can run finkinit dev to get an alternate Fink.


  1. Yes, this actually happens somewhat frequently. Sometimes Fink has a newer version of a program than the OS (e.g. Subversion 1.4.6 vs. 1.4.4), or sometimes the Fink version has more extensions enabled (I use Fink’s Apache because it lets me use Fink’s PHP, which in turn lets me install PHP’s MySQL extension by doing fink install php5-apache2-ssl-mysql as opposed to compiling it by hand.) 

  2. Unlike Linux, executables on Darwin have the absolute paths to their shared libraries hardcoded in the binary, so a program linked against /usr/lib/libexpat.1.dylib will always use it, even if /sw/lib/libexpat.1.dylib exists. Linux, on the other hand, uses a search path mechanism at runtime to find the libraries, similar to the way the shell figures out which program to invoke when you command it to ls

  3. At the moment, one for my personal use and a clean one for testing packages I maintain in an environment without extra packages installed. This is important for testing that you’ve declared all of the necessary dependencies. 


Unmitigated Audacity

Details to follow, but I’m working on porting Audacity 1.3.4 to Mac. I’m making good progress (note that actually clicking on anything doesn’t work yet, if you want to nitpick Update: This was simple pilot error, stuff does actually work):

Audacity 1.3.4 on Mac OS 10.5


For All Your Finger-Pointing Needs

While working with a large codebase, I often want to find the origin of a particular line. Subversion offers a tool, annotate (aka blame, aka praise), which displays the author and revision for every line in a file, indicating who made the last change to a line. However, the last change is often not very useful; it was a minor change as a result of some other change you’re not interested in, or the code was moved around due to refactoring, and you need to go back even further.

When I need to do this, I find myself doing a sequence of:

  1. svn blame FILE | less; find the revision N where the line was last changed
  2. svn log -rN FILE | less; if the change is interesting, read the commit log for the file
  3. svn blame FILE@N-1 | less; using Subversion’s little-known pinned revision1 syntax, find the previous time the line was changed
  4. Using N-1 as the new N, return to step 2.

I’ve put together a rough version of a tool to make this easier; it’s at /trunk/blamegame in my repository, which is here for browsing with ViewVC, or it can be checked out with svn co http://zevils.com/svn/trunk/blamegame blamegame . It still needs some fine-tuning and documentation, but invoke it like blamegame FILE LINE (where FILE is a URL or the path to a file in a Subversion working copy) to start looking at a particular line of a file. You can navigate and search the file using a less-like interface. To drill down to the previous change to a line, hit r and then enter the line number. l, o, n, and m switch between viewing the commit log, the changed parts of the old file, the changed parts of the new file, and (the default) the diff. If you need to change the path you’re looking at (for instance, to jump inside a branch), use the p command. h will show the available commands.

Let me know what you think.


  1. Pretty much any Subversion command that takes a path argument can be given PATH@REVISION instead to use the version of the path at a particular revision. This is great for diff and cat as well as blame. I use it for working with deleted files and branches and diffing a branch against trunk.