Pottering slowly with Ruby on Rails

I’ve just got my hands on the Pragmatic Programmers Programming Ruby and Agile Web development with Rails and have been wading my way slowly through it all.

The slowness is not I must hasten to add a result of some facet of Rails or a pair of unreadable books (and boy do I have a few of those on my programmers book shelves), it is simply the result of too much work.

So all in all I have only been able to devote a few hours hear and there to get my head around Rails and Ruby, although I have read both books cover to cover whilst eating breakfast (sad I know).

A few thoughts

Seriously who can resist the lure of a zen like programming language that has come from the mists of Japan, hey maybe programming can be cool to people who aren’t programmers, becuase lets face it no matter how gorgeous your code or elegant the user workflow of your app, nobody else gives a toss (especially the designer sitting next to you). When I think of Japan, it is Hiroshige (the artist) or crazy dressed tourist / students in London, and that is much better than a big guy with 4 litres of coke, a beard and a Metalica T-shirt writing binary.

The idea of a framework that does all the grunt work for you is nice too, especially one that lets you rip away that armature as you go.

I also like the idea of something that is modern and fresh, and Model View Controller makes what you do a serious (beard tugging web app) but without all the Java thing. After all I can’t be the only one who has noticed that all these ball breaking Java based web monster thingys are sodding slow, and anyway who wants to write a trillion lines of XML config stuff?

So along comes Ruby on Rails…

to be continued…

The .htaccess they never tell you

There is one simple use for an .htaccess file that none of the books or online tutorials or references ever seem to tell you, and it is the one thing that I always find myself wanting to do.

Simple Redirect

Redirect from http://www.mywebsite.org to http://www.mywebsite.org/something/

Recently I have had to recreate from scratch a number of websites – sure the hosting company had full backups but theitr timescales were radically different from mine, so yes there is a website, but there sure as hell isn’t any content.

So like any good web person I reinstalled from my own backups, which for some unfathomable resaon had every file, execpt for the .htaccess files which I had to rewrite on the spot.

So here it is simple and effective, but so so elusive, type the following into a text editor, save the file as .htaccess and FTP it to the root of your website.

RewriteEngine on
RewriteBase /
RewriteRule ^$ blog/
RewriteRule index.html$ blog/
RewriteRule index.php$ blog/

Enable cgi scripts outside of cgi-bin

This assumes that you do not have access to Apache httpd.conf file AND that the your setup allows you to override server settings with .htaccess . Again create and save an .htaccess file.

Options +ExecCGI
AddHandler cgi-script cgi pl

This has come in very useful installing a copy of Movable Type for a friend

And the useful links that I have found on my travels

cross browser min-height CSS

Always forgetting the usefull tips I find and use every other day. Despite now using http://del.icio.us I still have an ocean of bookmarks.

notes to self

400 px element that will expand with more content:

#content {
height: 400px;
height /**/:auto;
min-height: 400px;


  1. IE does not recognise a min-height but will use height and expand as needed.
  2. Firefox will not expand with height


  1. Reset height to auto in Firefox with a hack