Wee Date Picker Rails Plugin

July 18th, 2008 by pyrat

After a bit of a sabbatical here is another plugin for you to feast on.

This is a super simple datepicker for your rails apps. It is essentially just a packaged version of DatePicker v2.9 by frequency-decoder.com with rails helpers for easy integration.

Install

If you install the plugin using git the installer should run and the files will be copied across recursively to your public directory.

Example

In the head section of the layout.

<%= yield :date_includes %>

In the template.

<%= load_date_picker %>

Then for each date field you need to do the following. Remember: field_names have to be unique on your page.

<%= date_picker :start_date, Date.today %>

Where the first argument is the field_name and the second is the initial value. This must be a date object.

This is a tiny plugin which needs a bit of work but hopefully it helps. It is available on the github project page

Update: I wrote the installer script myself.

Rails Gotcha ActionController::MethodNotAllowed

July 14th, 2008 by pyrat

Turns out that sometimes with Mongrel less than 1.1.5 routes are not being resolved properly with Rails 2.1. (Experienced on OSX)

To fix the problem I upgraded mongrel.

sudo gem update mongrel

Would be nice to know how widespread this problem is. This link talks about this same issue in the comments. The main post is a little confused however.

Orienteering Route Choice with GIS

July 11th, 2008 by pyrat

orienteering map

I read an interesting article on how some students in Sweden did a project on calculating route choice using GIS from an orienteering map.

After reading through it, it looks as if they have been pretty successful. It would have been interesting for them to get runners to run the routes and compare them with a human route choice.

Further down the line this could be interesting if the orienteering map was held in some sort of digital device. It could calculate the optimum route in real time and then use GPS to direct you along this route. Turning super technical orienteering into a string course that take the optimum route with respect to contours, terrain run-ability and road options.

In the coming years it will be a challenge to maintain the challenge of orienteering with advances in navigation technology. Formula 1 restrictions will no doubt come into force.

Read the article

Patching with Git

June 27th, 2008 by pyrat

Git is hard; but powerful. A wee bit of command porn for you for contributing with open source projects.

When sitting in a branch you have been working on for a new feature / bugfix which was created with the command:

git checkout -b cool_patch

To create a patch for the master branch which is a remote tracking branch for a read only git repo. Typically, this is an open source project which you cant push to therefore you need to patch.

  git format-patch master --stdout > ~/patches/patchname.diff

Now you can create a ticket on the open source project with your patch.

-||-

To load a patch, its good to do it in a new branch.

So a workflow to applying a patch is as follows

  git branch master
  git checkout -b new_patch
  cat ~/patches/patchname.diff | git am

You can then check you are happy and when you are. You can merge back into master by committing the branch changes then switching back to the master branch and merging your

  git add .
  git commit -a -v 
  git branch master
  git merge new_patch

Please correct me on any glaring errors you see. Im pretty much making it up as I go along.

Add users to groups

June 24th, 2008 by pyrat

  groups deploy
  sudo usermod -a -G www-data deploy

Summer Skiing

June 7th, 2008 by pyrat

My mate Per Arne Troset attempts to ski across a lake.

Apologies for the swear at the end. I am not normally like that.

Web Designers should do their own CSS

June 6th, 2008 by pyrat

Something I have believed for some time has been put into words by DHH. Last three posts have all be 37Signals related. Makes me look like a bit of a fanboy. Dont care tho, its good stuff.

Web Designers should do their own CSS

Ryan talks some more

June 4th, 2008 by pyrat

Andy heres another interview for with Ryan Davis Singer for you. (Its audio)

Interview

Tips for Designers and Rails

June 3rd, 2008 by pyrat

Andy you might like this one; Ryan Davis Singer from 37 Signals on Design and Rails.

Multiple Submit Buttons on Rails Form

June 3rd, 2008 by pyrat

Pretty basic stuff but I often forget as I dont use this pattern much.
Multiple Submit Buttons