Blog
Here you will find an assortment of posts, tips, brain dumps and my personal reference materials. Some of the posts such as Unix tools are a collection of mini-posts which will keep growing over time.
The best of Unix tools
19/02/2012
An assortment of grep commands
19/02/2012
Vim tips, tricks and general usefulness.
19/02/2012
Notify NewRelic of a deployment from a Ruby script.
19/02/2012
A collection of book reviews, mostly on coding, but also other subjects.
20/02/2012
When switching branches make sure to restart the application server to ensure that the environment is reloaded. Branches may have different gem dependencies and configurations which can lead to frustration.
$ git checkout feature_65
$ rake test:integration
19 tests, 13 asser
17/05/2010
Getting PrinceXML to work with Passenger
18/05/2010
Showing a nested_set in a formtastic select
21/06/2011
Sessions across sub-domains in Rails 2.2.2
19/09/2010
The latest version, 2, of RMagick requires ImageMagick version 6.4.9 or greater. Unfortunately this version is not available via Aptitude - at least not on the version I am running, which is a few years old now.
The solution, for my purposes, was to install an older version of RMagick:
sudo gem install rmagick -v='1.15.17'
16/08/2010
Commenting out large chunks of code in Erb templates is sometimes a bit tricky, time consuming and looks ugly even with an IDE like Netbeans.
For example:
<% if @document.fresh?
13/07/2010
I'm using Jeweler to package my Ruby libraries/plugins as Gems. Jeweler uses a file called VERSION which contains the current version for the gem. It is also common practice to have a constant called VERSION in the plugin's root module which also returns the current version. This leads to duplication and th
14/05/2010
When using scaffolding each CRUD action usually has one entry point, the index action. If your CRUD actions (new/create, edit/update and destroy) have multiple entry points which may be the case if you allow editting records from an admin UI (/admin/documents/index), the public UI (/documents/index) and maybe a search UI.
In this case you need to know where
14/05/2010
I've been trying on and off for the last six months to get RVM (Ruby Version Manager) working on my Mac. I had no problems on linux. RVM allows you switch between different Ruby interpreters and their respective versions. For example I can test my applications in Ruby 1.9, JRuby and the new YARV bytecode interpreter.
Today I realised
14/05/2010
In my my controllers I am restricting access to features based on the users assigned price plan, which is an integer, mappable to a label such as 'Gold', 'Silver', 'Bronze'.
As well as providing autherisation at the controller layer, where it belongs, I also wish to enforce this at the model layer. This gives me
17/03/2010
If your having problems sending email using sendmail (actually Exim) on Debian based systems, in my case Ubuntu, then the first port of all call is to check the files in /var/mail for any error messages.
In my instance I was getting "Mailing to remote domains not supported".
This is because Exim is by default configured to only send mail locally. Yo
24/02/2010