Satya's blog - 2007/05/

May 31 2007 11:21 Glasses
This morning I woke up and felt very off-balance. I had trouble focussing on stuff. I assumed it was due to less sleep and general morning bleariness.But during my shower I discovered that one of the lenses in my glasses had come off when I placed them on the nightstand last night. Yeah, that'll mess with stereo vision.

Tag: self

May 24 2007 21:26 Rails and Mongrel

Okay, you have a Ruby on Rails project, and Mongrel. Suppose your project is 'spiffy' and can be found at http://yourspiffyserver.com/spiffy

In config/routes.rb, add:
ActionController::AbstractRequest.relative_url_root = "/spiffy"

Somewhere in your default routes, in the same routes.rb file, add the route to your default controller and method, the things you want to hit when someone goes to http://yourspiffyserver.com/spiffy
map.connect '', :controller => 'home', :action => 'index'

Symlink your public directory to your project name:
cd public && ln -s . spiffy

Be sure to give your web server write access to log/ and tmp/ with a chown -R.

Add something like the following in your Apache config (remember, this is for Mongrel):
ProxyPass /spiffy http://127.0.0.1:8200/spiffy
ProxyPassReverse /spiffy http://127.0.0.1:8200/spiffy
(8200 = port that mongrel is listening on for this site.)

Add to /etc/mongrel/sites-available/ a file called spiffy or spiffy.conf containing:
# RAILS_ROOT of your application
dir=/home/rails_apps/spiffy
# port the first mongrel instance should listen to, additional instances will us e ports above this
port=8200
# number of mongrel instances -- more if your app is hit heavily. They use ports starting at 'port' and up. So, 8200, 8201, etc.
servers=1

As usual, these instructions may or may not work for you.

Tag: howto geeky rails

May 24 2007 20:55 Ruby on Rails and Subversion

Instructions on how to quickly get a rails project into subversion, based on http://wiki.rubyonrails.org/rails/pages/HowtoUseRailsWithSubversion. (Actually, almost verbatim but tailored for my work habits. Your mileage may vary.) These are geared towards use at work and with butterfat, especially the first bit about the server.

On the SVN server:
cd to the svn repo, public or private.
su to www-data before creation so that the files will have the proper permissions. This assumes your SVN URL is something like https://svn.yourserver/etc
svnadmin create /path/to/subversion/repo/private/project_name --fs-type=fsfs

In your_rails_app (created by the command `rails your_rails_app`):

# svn import . repository_url -m "Import" --username user
# cd ..
# mv your_rails_app your_rails_app-backup
# svn checkout svn_url_to_your_repository your_rails_app
# cd your_rails_app

Then do these (you should be able to copy paste):

# Remove the log files.
svn remove log/*
svn commit -m "removing all log files from subversion" 
# Ignore the log files when they are re-created
svn propset svn:ignore "*.log" log/
svn update log/
svn commit -m "Ignoring all files in /log/ ending in .log" 
# Ignore the tmp directory with all its content (cache, sessions, sockets)
svn remove tmp/*
svn propset svn:ignore "*" tmp/
svn update tmp/
svn commit -m "Ignoring all files in /tmp/" 

Note: this post is mainly as a note to myself. Your situation may be different. Among other things, I use mongrel, not Capistrano or Switchtower.

Tag: howto geeky

May 24 2007 12:51 Medical stuff and Star Trek

I've been watching Star Trek: The Next Generation and I realised that Dr. Crusher often uses something called "inaprovaline". Apparently it's a stimulant because she's always using it on unconscious people. I was wondering if it can be used to treat mesothelioma -- which tells you how much I know about pharmacy, as mesothelioma is some kind of asbestos-related lung disease.

Hmm, Wikipedia has an article on inaprovaline, too. Seems there are whole web sites devoted to a database (oy, ask me sometime about the confusion at work!) of Star Trek medications.

Tag: startrek