Turn to Your Left at the End of the Sky

Migrating Rails App to Dreamhost using mod_rails

Over Memorial Day weekend I migrated my Rails Application to Dreamhost using mod_rails (Passenger). It was not an entirely smooth process but I was also upgrading from Rails 1.8.x at the same time. That was compounded by making the foolish mistake of trying to rebuild my database using Rake migrations. (That’s a bad idea. I could have saved many hours by just uploading the schema)

Here is the procedure I followed (hat tip to Nock):

  1. cd ~/
  2. rails your_app_name -d mysql
  3. Copy app/, database.yml, routes.rb, db/
  4. Change public/.htaccess from .cgi to .fcgi
  5. put your app into production mode (uncomment line 5 in environment.rb)
  6. run rake db:migrate RAILS_ENV=production
  7. chmod -R 755 ~/your_app_name/app
  8. rm your_app_name/public/index.html
  9. killall -USR1 dispatch.fcgi
  10. killall -USR1 ruby

One comment on step 4. For some reason none of my stylesheets would load. Much of the advice gleaned from endless Google searches seemed to suggest that the problem would be fixed by setting the RewriteBase in /public/.htaccess. That turned out to not be the case.

My stylesheet problem was caused by having this line twice in my .htaccess file

RewriteRule ^(.*)$ dispatch.fcgi[QSA,L]

DO NOT uncomment the one before RewriteEngine On , as all the tutorials seem to imply, just change the .cgi to .fcgi in the block below it.

Thanks to Dreamhost for their stellar support over a frustrating (for me!) Memorial Day weekend. In the end, (as is so often the case), very little of the frustration was caused by Dreamhost or mod_rails but, rather, by some of the vagaries of Rails. I’m guessing that future deployments would be much smoother as this was my first time deploying to a shared hosting environment.

Advertisements

May 27, 2008 Posted by | Computers & Internet, Internet, Ruby on Rails, Technology | , , , , , | 3 Comments

Dreamhost Supports Passenger and mod_rails

I use Dreamhost to host my websites and they have now added support for Passenger (a.k.a mod_rails). Ruby on Rails deployment hassles should be a distant memory soon!

If you’re looking for a cheap and cheerful hosting company for your Rails app, I highly recommend Dreamhost. It’s great for the solo developer (or small team) because for a small amount per year you can launch your site on a shared hosting service and then later easily migrate it to a virtual private server as your needs change. 

Dream in Rails

May 26, 2008 Posted by | Computers & Internet, Internet, Ruby on Rails, Technology | , , , , | Leave a comment

New CD from Omega Okello

Omega Okello has released her new CD, Kiwomera Emmeeme. You can pre-order it now at Amazon and it will be released on May 27th, 2008. I’ve heard her sing live and it’s a great experience.

Here’s the blurb from her website:

Not only does this East African Diva burst on the world music scene with a unique name, but she also blazons into the industry with a fantastic new sound. Omega Bugembe Okello, who just goes by the name Omega, is blessed with a powerful vocal range and the international ability of singing in various languages and dialects.

The songstress who hails from Uganda has been described as “having a voice that touches the soul”. If you listen to her music you will undoubtedly agree. She definitely has the kind of voice that pleasantly, but hauntingly seeps into one’s soul and her latest album, Kiwomera Emmeeme, embodies this very essence.

Listen to Mujje a few times and you will be humming it the rest of the day!

May 25, 2008 Posted by | Christianity, Music, Spirituality | , , , | 1 Comment

Adding Links to Amazon

To link to Amazon, use the following code

http://www.amazon.com/exec/obidos/ASIN/<10 digit ASIN number>/simplelight-20

Simply insert the relevant ASIN number for the product that you are linking to. You can find the ASIN number at Amazon’s Associate page

For example, to you would link to For One More Day by Mitch Albom like this:

May 25, 2008 Posted by | Computers & Internet, Internet, Technology | , , , | Leave a comment

Touch Rugby in Palo Alto

If you’re looking for a game of touch rugby and live anywhere close to Stanford, there is a regular game at 3:30pm on Saturday at Roble field on the Stanford campus which has been running continuously since 1996. It runs year round and has solid representation from all the rugby playing countries. There are regularly 20 or more players of varying ability.

More details can be found here.

May 24, 2008 Posted by | Rugby, Sport | , , | Leave a comment

Enabling Skype HD Video

To enable 640×480 video in Skype (instead of the usual 320×240 resolution), add the following lines to the config.xml file in the Skype user directory

<Video>
    <CaptureHeight>480</CaptureHeight>
    <CaptureWidth>640</CaptureWidth>
    <Fps>30</Fps>
</Video> 

There will probably already be a <Video> … </Video> section in the file so just add the middle three lines in that section.

The config.xml file is typically located in:

c:\users\<win_username>\AppData\Roaming\Skype\<skype_username>

Note: The “AppData” folder is a hidden folder so you’ll have to search for it. Either that, or just make all the folders in c:\users\<win_username> visible.

I’m running Windows Vista 64-bit so your location might be different. (If you do have the location for a different OS please leave a comment and I’ll update the post). If you enable “Display technical call info during calls” under Skype->Options->Advanced->Connection, you will be able to monitor the resolution and frame rate. (Hover your mouse over the main Skype tab and a yellow box will pop up with all the technical Skype data, including frames per second, transfer and receive resolution. This is useful for testing whether you are indeed sending the higher resolution image.)

Also, make sure you have the latest Logitech webcam driver installed. You don’t need the Logitech app, just the driver. I use the Logitech Quickcam Ultra Vision  and the image quality is very good.

Skype has gone to great lengths to differentiate this “hack” from their HQ (high quality) video (which requires Skype-endorsed webcams) but I think the difference is marginal if you have decent hardware and bandwidth. It appears that as of Skype 3.8 you will no longer see the usual HQ Video logo but you will still be transmitting video at the higher resolution. Your frame rate might take a slight hit depending on your uplink bandwidth. 

(As an aside: I highly recommend not upgrading to the current Skype 4.0 beta)

May 24, 2008 Posted by | Computers & Internet, Engineering, Technology | , , , , | 8 Comments

A Life So Fragile

In the first week of my freshman year in college I went to a talk that was given by 4 people who had been disabled as a result of attempted abortions. Their mother had subsequently given birth to them. This video reminded me of that formative hour of my life.

May 9, 2008 Posted by | Christianity, Philosophy, Spirituality, Thoughts | Leave a comment

The Popularity of Programming Languages

The Tiobe Programming Index gives an indication of the popularity of programming languages. I’m pleased to see that Ruby (and consequently Ruby on Rails) continues to move up the rankings. I guess I’m going to have to learn Java at some point.

May 8, 2008 Posted by | Engineering, Ruby on Rails, Technology | , , , , | Leave a comment

The Rise of the Rest

Newsweek has a fascinating article by Fareed Zakaria. Some of the interesting points he makes:

  • 20 years ago the US had the lowest corporate taxes in the world. Today the US has the 2nd highest.
  • Only three countries in the world don’t use the metric system: Liberia, Myanmar, and the US.
  • In 2006 and 2007, 124 countries grew their economies faster than 4%.
  • The share of people living on $1 a day has plummeted from 40 percent in 1981 to 18 percent in 2004
  • The global economy has more than doubled in size over the last 15 years and is now approaching $54 trillion. Global trade has grown by 133 percent in the same period.
  • In World War II Germany suffered 70 percent of its casualties on the eastern front yet the American narrative is one in which the United States and Britain heroically defeat the forces of fascism.

May 6, 2008 Posted by | Economics, Investing, Politics | , , | Leave a comment

The Carbon Footprint of a Walk

I’ve heard before that walking a mile emits more carbon than driving a mile so decided to investigate for myself.

A 190lb human walking at 3 miles per hour would expend 302 kCal. Therefore, covering a mile would take 20 mins and approximately 100 kCal. Apparently it takes 7-10 kCal of fossil fuel to produce 1 kCal of food. The upper end of the range assumes a diet of highly processed food and meat being transported long distances. The lower end of the range assumes a more vegetarian-centric diet and locally produced food.

Therefore,  a 1 mile walk requires 700 – 1,000 kCal of fossil fuel energy.

Driving a 30 mile per gallon car for one mile at 60 mph takes 1 minute and 1/30th of a gallon of gas. One gallon of gasoline contains approximately 30,000 kCal of fossil fuel energy.

Therefore, a 1 mile drive requires approximately 1,000 kCal of fossil fuel energy.

Depending on where you source your food and what you eat, it doesn’t make much difference in terms of carbon emissions. Driving a car one mile is far cheaper than walking a mile. But the health benefits of walking a mile far outweigh the cost.

May 1, 2008 Posted by | Global Warming, Politics, Science, Thoughts | , | Leave a comment