Tuesday, February 26, 2008

Instance variable in viewer for ActionMailer

Using the ActionMailer in your Ruby on Rails application, I wanted to display a variable in the viewer. If the content_type is "text/html", the body needs to have the instance variable symbol e.g. body :var => var. In the viewer, you may reference this variable with <%= @var %>.

Thursday, February 14, 2008

svn checkout url

For some reason, I always have a tough time remembering how to check out code from an svn repository. So here it goes:

svn co svn+ssh://[user]@[server]/[path to project on svn server]

Sunday, February 10, 2008

Sharing OSX leopard folder and mounting it on Windows XP

So it shouldn't be that hard, but it took me about half an hour so I got to document it. I tried mounting a folder shared on my Leopard from an XP machine. This is finally how I got it done:

On Leopard:
  1. In System Preferences, under Network, tab over to WINS and set the Workgroup to something like 'Mshome'
  2. In System Preferences, under Sharing, click options and check 'Share files and folders under SMB'
On Windows:
  1. Right click on 'My Computer', clicking on 'Map Network Drive'
  2. Click 'Browse', and you should see your Mac (for some reason your XP might not see the Mac right away, wait about 5 minutes)

Wednesday, February 6, 2008

Simple exporting of MySQL tables into a file

echo "select * from [table];" | mysql -u[user] -h[server] -p[password] [database] > [output_file]

Friday, February 1, 2008

Simple Ruby MySQL

To get the MySQL Ruby library to work as documented on troubleshooters, I had to add the following require statement:

require 'rubygems'
require 'mysql'