Snow Leopard Chaos Subsides

Like a damn fool true fanboy I installed Apple’s Snow Leopard the day it came out. Sure, it was faster, and I liked the polishes they made to the user experience. But it broke a lot of things that made it possible for me to develop web sites on my laptop: MySQL, all my Perl modules, and the Ruby apps I use to track my To Do list (Tracks), and my projects (Redmine). I also lost the ability to print to my Canon laser printer, which I like cuz it does 2-sided printing. Also broken: Saft, iStatMenus, and Parallels, but I could get by without them (but did miss them).

Usually Google is my friend, but since it takes a few days for Google to catch up with people’s blog updates this time I turned to Twitter, and got up-to-the-second reports on people’s reactions to and fixes for Snow Leopard. MySQL turned out to be a quick fix, since it was just a broken symlink. After that my PHP scripts could once again connect to their databases, as could the Navicat app. But for the life of me I couldn’t get Perl’s DBI and DBD::mysql modules to work right, which meant a bunch of my older scripts weren’t working, and it made working on some of my older sites challenging in that I couldn’t test changes locally, I had to make them to the (gulp!) live site, which is hardly ever a good idea.

Every few days I’d search Twitter and Google for advice, and would try different things, but nothing would get Perl talking to the database :(

In the meantime I upgraded to Parallels 4.0 ($), which let me view my sites again under Internet Explorer. Since WinXP could still talk to the Canon printer I could print now if I saved to a PDF file, moved it over to Parallels and printed it there (ya, tedious, but at least it was possible). And new versions of iStatMenus (free!) and Saft ($) came out, so things were slowly returning to what we laughingly call normal here.

Labor Day (yesterday) was a down day that I used to finish digging the hole for the cob oven project (another post for another day), and I returned once again to my Perl/mySQL problem. Not a lot of people are using Perl anymore, or at least they’re not posting about their fixes for Snow Leopard, but all those hotshot Ruby kids kept saying they had to recompile the 64bit version of MySQL. Not wanting to break what was already working, I decided to try doing that on the family iMac and see if I could get Perl and MySQL working on it. Stock 64bit MySQL installed just fine, and I could talk to it over the command line. Good so far. I then installed the latest DBI and DBD::mysql modules using CPAN, which took a while but both installed with no problems (woohoo!). I created a small test table on the command line, then wrote a small Perl script to display all the records in it… and it worked!

Emboldened and embiggened, I then went over to the laptop, backed up all the mySQL databases, and removed all traces of mySQL from the computer. I then went thru the same steps as on the iMac; mySQL installed just fine, as did the DBI module, but DBD::mysql still refused to install. Desperate, I decided to copy the installed DBI and DBD::mysql modules from the iMac to the laptop, and after restarting Apache my perl scripts connected to mySQL just fine! Yes, it was a good day.

This morning for the heck of it I uninstalled all my Ruby Gems and reinstalled their 64bit versions, along with an updated passenger. After restarting Apache, Redmine once again started working! This is a very good thing, since I use it primarily as a GUI to the various Mercurial repositories I have for each of my web sites.

And a Google search for printer driver updates turned up a new driver which got my printer working again!

Jeezum, it’s like the morning of Aug 28, before I installed Snow Leopard! :)

Staying on top of Changes with Mercurial

If there’s one constant in software development, it’s change. Little changes here and there, and the occasional big change happen all the time.

Web development is the same, and arguably even more so. Freed from the need to package everything up and ship it in a numbered release, it’s all to easy to fix a single small bug and immediately make it live on the site. Or change a single word on one page, and make that live.

If you have more than one person working on a project (web or otherwise), keeping everyone’s changes in sync can be a chore. Back in the day when Jared and I were working on Redux together it was a simple matter for one of us to “claim” a chunk of the source code for an hour (or a day), telling the other to keep their hands off it.

Nowadays there is an entire genre of Source Code Management programs that keep track of everyone’s changes with a minimum of fuss. In addition they document changes, keep track of different revisions, know what files were changed when and by who (and why). They eliminate the possibility of one person stepping on another’s code (and wiping out their changes), and should a change go completely astray, they even let you revert to any earlier (working) version.

After looking at a few different SCM programs, I settled on Mercurial, which seemed the best fit for my working style. It’s lightweight, and installs easily on Mac OSX as well as the various Unix servers that host my web sites. You control Mercurial from the command line, using the new hg command it installs (from the chemical symbol for mercury: Hg).

After installing Mercurial, the first step was to pick one of my websites and tell Mercurial which files I want to keep track of for the site. I then made a snapshot of those files, or as Mercurial refers to it, a “changeset”. It asked me to include a brief comment with the changeset to describe it; for the first changeset a comment like “added key site files” worked just fine.

Now I make changes as usual, and Mercurial keeps track of what changed. I frequently commit a set of changes to a new changeset, along with a brief note describing the change. At any point if I don’t remember what I’ve changed a simple hg diff command will tell me not only which files changed, but which lines in those files changed (both old and current versions).

What’s very cool is that I can keep a local copy of the website on my MacBook, make changes locally and testing them, and when I’m satisfied that the changes are ready to go live I can send those changes to the website with a simple command: hg push.

Once the changes have been pushed to the site, I can make them live at my leisure; a simple hg update command instantly makes the changes live. No more fussing with uploading changes with ftp, messing with renaming files or worrying about copying files to the wrong directory.

Mercurial is easy to install, easy to learn, and easy to use. It makes it easy to keep track of changes, and to migrate those changes to different developers (or different locations, like live web sites). I’ve only scratched the surface of what it can do, but even after just a few days it’s already made my life easier.

Dave, morphed

I found this “cool morphing site”:1 on today. You upload your photo, and a java applet morphs your image in various ways.

Here I am morphed to a Manga cartoon and an El Greco painting:

It’s like Sunday morning comics!