Tuesday, April 22, 2008

mod_rails + edge rails

Based on a recent conversation at phusion passenger google group, there is a bug wherein mod_rails fails to start its spawner for an application that uses edge rails.

Basically, you'll get this error (complaining about a failed 'to_constant_name' somewhere):

  Framework that failed to load:
Vendor directory: /path/to/vendor/rails
Error message:
Anonymous modules have no name to be referenced by
Exception class:
ArgumentError

More info about the bug can be found in the bug report filed by hongli


update: This seems to be fixed in edge rails + git passenger (though I havn't tried yet), as hongli's comment below says.

Monday, April 14, 2008

mod_rails + rails 2.0

I you encounter a "500 Internal Server Error" after setting up mod_rails in a recent (rails 2.0) application, you need to delete 'public/.htaccess'.

Monday, January 28, 2008

Detecting the googlebot

Detecting the googlebot as your site's visitor is easy by just checking user agent. Googlebot uses this user agent:
Googlebot/2.1 (+http://www.googlebot.com/bot.html)

And in the app, we can just check:
request.user_agent =~ /googlebot/i

Friday, January 25, 2008

Planned Music Purchases

Purchase albums:

and/or

once available and not too lazy to go to the mall.

Monday, December 24, 2007

Windows + ext2/ext3 access

As of Ubuntu 7.10, we now have read/write access to NTFS drives via ntfs-3g. But what about the other way around? I just needed that ability today to get a file from my linux install. Since I'm too lazy to reboot twice; and since windows boots up very slow, I don't wan't to do this everytime I need a file from the other partition.

A bit of google searching and I found this app called the 'Ext2 Installable File System for Windows' which allowed me to mount my linux partitions to my preferred drive letter. It gives me read and write (root) access to those files - very cool.

Monday, December 10, 2007

Copying files using rsync

Use rsync to copy files to files between servers through ssh with continue option:
rsync -P --rsh=ssh from_machine:/path/to/source.file destination/path
-P is the same as '--partial --progress'

Sunday, November 18, 2007

Monaco for Ubuntu

Trying to copy the 'All Hallows Eve' textmate theme in kate, I got stuck with the Monaco font. After a little searching, I found a nice blog post which includes an instruction for adding the Monaco font to the system.

Basically, get the font and run the following code to put it in the fonts directory:
sudo mkdir /usr/share/fonts/truetype/custom
sudo mv Monaco_Linux.ttf /usr/share/fonts/truetype/custom/
sudo fc-cache -f -v