Convert your Rails' application database to UTF-8

Posted by Andrew

Its unlikely that this will ever matter in local development, but its good practice to have your environment properly setup.

Dump your database to a file:
$ mysqldump -u root --default-character-set=latin1 --skip-set-charset project_development > project_development.sql

Convert the characters in that file from latin1 to UTF-8 using iconv:
$ iconv -f latin1 -t UTF-8 project_development.sql > project_development_utf8.sql

Drop your existing database and recreate it with the appropriate defaults:
$ mysql -u root --execute="drop database project_development; create database project_development character set utf8 collate utf8_general_ci;"

Repopulate your database with your converted data:
$ mysql -u root project_development < project_development_utf8.sql

Don’t forget to add the encoding to your database.yml!

adapter: mysql
database: project_development
username: root
password: 
host: localhost
encoding: utf8

Site Specific Browsers (SSBs)

Posted by Andrew

I just spent a few minute setting up Site Specific Browsers for my Google Apps. Using Fluid, which was inspired by Mozilla’s Prism, and some nice icons left me with a pretty cool setup – little red badges even show up on my icons if I have unread mail or feed items.

Dock

The Power Of Social Networking: Last.fm Gets It Right

Posted by Andrew

While tinkering away with Evan Weaver’s sweeper (a ruby gem for updating id3 tags of mp3s based off last.fm’s fingerprint database) I started clicking around my last.fm profile. I’ve been a religious scrobbler for a few years now (nearly 20,000 songs since May 4th, 2004), but I had never stopped to think about how powerful all of this data could be. I mostly used last.fm for its music recommendations; my profile page will suggest artists for me to explore based off what I have listened to in the past.

Today, I discovered an even cooler feature: events. Last.fm knows what I like, and it knows about lots of events (concerts, shows, festivals). By combining this data, the service can build me a custom calendar of upcoming acts that I may be interested in! I’ve created a quick mash-up using 30 boxes iCal support to display the information on the web, but I have already added this calendar to my personal google calendar. Now, even as my music tastes change, and I move around, I will always have calendar of upcoming events in my area that I will likely be interested in attending. It makes even more sense that CBS spent big money to acquire these guys.

Lighthouse Bugzilla Importer

Posted by Andrew

I have looking at some alternatives to Bugzilla for managing my projects. Basecamp was too simple, Redmine tries to do too much, but I think Lighthouse gets it juuuuuust right. In order to migrate my tickets I wrote a little script to parse Bugzilla XML and create and post Lighthouse tickets. The code is up on github.

Rails is on Git!

Posted by Andrew

Rails is moving from SVN to Git!

I have not yet patched Ruby on Rails, but I am still very excited about the move to Git. Why? I think it will spawn some cool forks that solve special cases. These branches (especially with the social nature of GitHub) will be much easier to find and develop. Its a good day in the rails community.

Rails Stack

Posted by Andrew

Linux, MySQL, nginx, Mongrel , Rails, and friends.

Big Picture:

An ideal setup uses two different servers or virtual machines to split up the load and facilitate scaling. The first machine runs nginx serving static content and acting as a reverse proxy passing dynamic requests to a pool of mongrels running the rails application. The second machine is a dedicated MySQL database server. Even if you only have one physical box, two virtual machines (Xen based) is preferred, it is easier to scale and doesn’t require as much memory context switching. Our host, Engine Yard, uses a similar setup based on Gentoo and Xen.

Git

Posted by Andrew

I’ve been experimenting with Git for source control management (SCM), I’m really starting to appreciate the benefits of the distributed features it provides. The User’s Manual is very comprehensive, and the SVN -> Git crash course was excellent in getting me up to speed. Simplistic Complexity provides an awesome SVN to Git Migration Guide that helped me split my monolithic subversion repository into a series of lean git trees. Although git is relatively new, there is some pretty good support for hooking it into existing tools like Redmine, which has support for git in its latest trunk. Hopefully I will be able to convert some of my co-workers soon, but until then I’m going to be using a hybrid workflow of git and subversion, mostly facilitated by git-svn.

Update: I’ve been playing with gitosis for managing “push” repositories that I can share with others or use to deploy with capistrano. The program requires you have SSH setup perfectly, and there are a few caveats (read: must use ssh on port 22 to deploy with capistrano), but its very simple once you get it working. I really like how access to your repositories is done with public SSH keys. Scie.nti.st has more.

Another Update: I secured a GitHub beta invite and was able to successfully push all of my repositories there. GitHub also has some great documentation on deploying with capistrano and github which enabled me to re-deploy all of my applications to my server using git. As a side-benefit I now also have all my mongrels running as an unprivileged user.

New Office

Posted by Andrew

A few quick photos of my new workspace.

My desk

New Job!

Posted by Andrew

Its probably time to announce that I am no longer gainfully unemployed. I accepted a position as “Web Development Engineer” at OneHub.com. Starting on February 18th I’ll be living and working in Seattle, WA. Scary.

~2000 Common English Words as Domains

Posted by Andrew

I did some Ruby Judo and wrote up a little script that matches common English words against the list of TLDs.