GIS on Rails

September 20, 2009

There are times we want our Rails apps to have some sort of spatial capability. Recording lat long point locations and displaying them in a google map is fine, but increasingly we want to do more with our spatial data.
We want to be able to import data from a wide range of existing spatial [...]

Read the full article →

How does respond_to work in the Rails controllers?

September 13, 2009

This is one of the first questions I’m asked whenever I introduce someone to Ruby/Rails from another language.
WTF is going on?!?! (aka the rails respond_to block)

respond_to do |format|
format.html
format.xml { render :xml => @mah_blogz }
end
The key thing to understand is that respond_to is a method attached to your controllers superclass: ActionController, [...]

Read the full article →

JRuby, Postgres & Rails

September 3, 2009

Just a quickie. When using Rails, Postgres and JRuby for the first time, you’ll need to install a jdbc-friendly database driver. The nice fast ones you’re used to written in C (like ruby-pg), will simply not work.
There seems to be lots of choice here, and dead ends of old attempts. The latest and greatest however [...]

Read the full article →

On Rails, Postgres, Passenger & Capistrano…

August 31, 2009

We’re sorry, but something went wrong.
You’re using the above combination, and it’s your first time deploying this app via capistrano. You get this:

A one way ticket to baldness
Not so bad you think. Then you go to the logs where you find precisely nothing. No logs. Zip.
The production.log files are empty, as are the apache logs. [...]

Read the full article →

Fine grain caching in rails using Memcache

August 31, 2009

Speed is pretty important, especially with searching. Fortunately it’s a cinch to use ultra fine grained caching in Rails (objects, search results, json data etc), as long as you’ve have installed the Memcache server, set it up, and started it. In your environments.rb:
Shake

require “memcache”
CACHE = MemCache.new(’127.0.0.1′)

In your application_controlller.rb:

private
def cache(key)
begin
[...]

Read the full article →

Install Django, GeoDjango, PostgreSQL & PostGIS on OSX Leopard

June 1, 2009

This procedure will loosely follow the directions in the following locations:

http://www.djangobook.com/en/2.0/chapter02/
http://geodjango.org/docs/install.html#mac-os-x
http://code.google.com/p/geodjango-basic-apps/wiki/GeographicAdminQuickStart

I’ll assume you are using the terminal. You are also using OSX 10.5.6 (or later)
1) Install Django
Make a temporary directory to house the install files and enter that directory
mkdir django_install && cd django_install
Download the latest stable version of Django.
wget http://media.djangoproject.com/releases/1.1/Django-1.1-beta-1.tar.gz
Untar it into a temporary directory [...]

Read the full article →

Costing a website or webapp: A guide for the non-developer

March 29, 2009

I won’t cover how estimates are produced, or how to conduct the actual project management – these are covered in loads of good books such as James Shore’s: “The Art of Agile Management“. What I want to cover here are initial techniques that you, the stakeholder, can do to help get the best estimated costs [...]

Read the full article →

.NET MVC vs Ruby on Rails

March 21, 2009

Or rather, .NET MVC for Ruby on Rails developers.
Note: Some edits have been made in light of useful comments

It seems oddly regressive to be going from the polished world of Ruby and Rails to the rough hewn newborn lump of .NET MVC, but well, needs must. I’ve just finished a project in .NET MVC (RC1) [...]

Read the full article →