Tuesday, April 24, 2007

Ping Pong Programming

Ping Pong Programming

Aim: To get your pair to do the hard work.

Setup: The game begins with a failing test. Players take turns...

Turns: You have 3 options

1
a/ Make the failing test pass
b/ Do any refactoring you can see
c/ Write or Uncomment a new failing test

2
a/ Comment out the failing test
b/ Write a simpler failing test

3
a/ Comment out the failing test
b/ Refactor to simplify the code
c/ Write or Uncomment a failing test

Hints: If your turn is longer than 3 minutes try option 2 or 3

Notes: Give this a go and notice how frequently you change drivers. Great when you have a pair that hog the keyboard.

Sunday, April 22, 2007

Freelancing on Rails

If you are freelancing as a software developer and especially if you are focused on rails, you should check out Craig Ambrose's podcast series.

I have had the pleasure to work with Craig at both Torus Games and Open Windows, and always find him insightful, pragmatic, and a pleasure to work with.

Check it out at http://www.craigambrose.com/podcasts

Friday, April 06, 2007

Hobo on Rails

Hobo looks great! It's a web framework built on top of Rails. It's structured as a plugin, so you can use as much or as little of it as you want.

I recommend checking out the screencasts to get a good overview of how this all works. I must say, I'm impressed.

I love the way it simplifies updating of several parts of a page with a single ajax call. Their solutions seems to be to tag parts of the page, then in the ajax call pass a list of parts that will need to be refreshed. The page is therefore telling the controller what parts to spit back, so the controller doesn't need to know the 'current page'. I'll have to look into exactly how this works.

I was also very impressed by DRYML, their templating system. It's just so simple! You define custom tags which is equivalent of defining functions, so they have a list of parameters and a body. When calling the tag you can pass in the details as the parameters. There is a nice concept of a context object for evaluation of any part of the DRYML, which simplifies the code in the tags too.

[It still find it amusing when people proposing their framework as the fastest way to develop a web app use php for their own site. What's with that?]

Friday, March 23, 2007

Updating your Textmate Bundles (UTF-8) issue

Assuming you got your bundles from svn... (you did didn't you?) ... then you can update them in the following way.
cd /Library/Application\ Support/TextMate/Bundles
svn up *.tmbundle
Doing this I got an error though
subversion/libsvn_subr/utf.c:466: (apr_err=22)
svn: Can't convert string from 'UTF-8' to native encoding:
subversion/libsvn_subr/utf.c:464: (apr_err=22)
svn: Ruby.tmbundle/Preferences/Completion: ENV[?\226?\128?\166] variables.tmPreferences
This is to do with having a local set that doesn't allow UTF-8.
export LC_CTYPE="en_US.UTF-8"
export LANG="en_US.UTF-8"
will fix it. Add them to your ~/.bash_profile to make the change permanent.

Update Mysql Gem problem

I just tried to update gems and got a problem with mysql (on my macbook)
I got the following errors.

checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no

Googling around I found a post with the answer..
$ sudo gem install mysql -- --with-mysql-config 
This worked great.

I have no idea what the error messages meant, or why this fixes it, so I thought I should share it or risk forgetting it :)

Anyone care to enlighten me?

GitHub Projects