Thursday, November 29, 2007

Python 25 & MySQL on Leopard

There was a bit of trouble when I tried to use macports to install the excellent Trac project management and issue tracking application. Specifically, the py25-mysql port did not compile correctly.

Trolling through the InterWeb, I found this post about a fix to compile the python module from scratch. The post, however, has more instructions than are necessary, so here is my revised procedure:

  1. Download the source from here.
  2. Unpack the archive and edit the _mysql.c file to comment out lines 37-39:

    // #ifndef uint
    // #define uint unsigned int
    // #endif

  3. Edit the site.cfg file to set the mysql_config path. For me this was:

    mysql_config = /usr/local/mysql/bin/mysql_config

  4. Compile as normal

    python setup.cfg config
    python setup.cfg build
    sudo python setup.cfg install

Now if only someone would make these changes in the port file, then trac installs would be super easy, instead of just easy-ish.

Tuesday, November 27, 2007

X11 on Leopard, auto-launch is awesome

Being used to Tiger's version of X11, I automatically started an X11 session at the start of the day to enable X11 port forwarding from our Linux servers. It has annoyed me that Leopard starts an xterm window every single time and having looked through the xinitrc files an seeing no mention of an xterm on launch was driving me batty.

I finally got fed up enough today to start hunting the InterWeb for a solution and found this page that gave me several tidbits of good news. First is that X11 is now an on-demand service, and will start when it is needed. Second, the /App/Utils/ is not a link to the service itself, but really a link to starting an xterm via the on-demand launchd X11 service. Hence I was starting that xterm myself! D'oh!

This has two practical implications for my work method. First, that I don't need to manually start the X11 service anymore. Second, that I must remove the DISPLAY env setting from my bash profile. That last bit is important, hence the emphasis. If set, the DISPLAY env will basically cause the on-demad service to not work.

I tested out connecting via SSH to our servers and launching an xterm. As advertised, once the DISPLAY setting was removed from my profile, the xterm from the server started the X11 service as needed and displayed correctly.

Now if Apple fixes those Spaces bugs, everything will be all good.

Speaking at Philly on Rails Meeting

I will be speaking at the PhillyOnRails December group meeting next week. Topics, previously covered on this blog, will be using R with Ruby to make plots and using Gbarcode.

Wednesday, November 14, 2007

OS X 10.5 Leopard and MySQL

UPDATE: The supplied preferences pane now works. Just use that.

It seems that the once super-simple MySQL on OS X install is no more in Leopard, that is until the MySQL developer community catches up. Now there is a small amount of terminal-fu that must be done to enable a mysql server on OS X, which has been covered in some other blog posts. But I will repeat the procedure here, since I added a script or two to make things a tiny bit simpler for me.
First, if you did a clean install of Leopard, then you need to download and install the MySQL server for OS X from the Just install the main server, not the preferences pane or the start up item.
Next download this launchd file and copy it to "/Library/LaunchDaemons/com.mysql.mysqld.plist"
Next change the ownership to root. Might as well set proper permissions while you are at it:

sudo chown root:wheel /Library/LaunchDaemons/com.mysql.mysqld.plist
sudo chmod 644 /Library/LaunchDaemons/com.mysql.mysqld.plist

Next load the file into launchd using launchctl

sudo launchctl load /Library/LaunchDaemons/com.mysql.mysqld.plist

Finally, you can create some shell script to load and unload the server at will and place it where you normally place your binaries (mine is ~/bin/sqlserverctl ):
case "$1" in
sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysqld.plist
sudo launchctl unload -w /Library/LaunchDaemons/com.mysql.mysqld.plist
echo "USAGE: $0 {start|stop}"

UPDATE: There was a small error in my start script, namely and extra space in the case statement, it has been modified and fixed above.

UPDATE: If you install MySQL via MacPorts, then use the "+server" varient and use this launchd file instead

Tuesday, November 13, 2007

Annotated Western with iPhone sketch app

Just tested out the Sketch application for annotation of a western blot on the iPod Touch. Verdict: Not so easy to write text or small symbols. Also it was impossible to do one handed, as the touch slid around the desk. Would need some sort of rubber mat to put any small device on to provide enough traction for one-handed operations.

On the bright side, it should be a fairly easy task to alter this app for putting in text and small oft-used symbols (like arrows).

Thursday, November 8, 2007

On The Apple Tablet

The internet is all-a-twitter with rumors of an Apple tablet. Frankly, like others, I am of the opinion that the tablet already exists in some prototype fashion within Apple and never released because of the so-far lack luster market. Unlike them, however, I do think that there is a market out there for this sort of device, even outside of the "professional" computing world environment that they cite, such as doctors and sales reps.

Having owned an iPod touch for several weeks, it has become my go-to device for web surfing and quick tasks. The thick-fingered-centric design of the touchscreen is really very satisfying to use, and would only get better with increasing size. One example application would be music. How cool would a touchscreen mixer board (GarageBand anyone?) be? Or for great DJ effects at a party, like virtual record scratching. Finger Painting. Awesome renditions of boardgames. Or totally new game designs, like the DS rendition of Zelda. Give it a kick stand and prop it up to view movies. Or better yet a dock and stand with keyboard and mouse to drop the tablet into.

Business applications are also pretty amendable to such a device, namely my idea of bench-top LIMS input devices. Experience with the Touch also lead me to believe that note taking, brain storming, and diagramming would be greatly enhanced, or at least as easy, as regular laptops.

But before I get my own hopes and dreams up any further, I stick with the "I'll believe it when I see it."