The blog has moved to ... Many google searches point here so I am leaving it operational, but there will be no new posts.

Sunday, October 21, 2007

Tic Tac Toe on Rails

Ok I finally completed my first rails project. Tic Tac Toe on Rails, you can check it out at It was a good reminder for me of how long it takes to really get up to speed on new technologies, Rails is really cool but it is definitely not a silver bullet for building web applications, when you get right down to it building software is hard work no matter which technology you choose to use.

Thursday, October 18, 2007

Rails RJS and newline characters

ok this one really got me, I was generating a javascript alert from the server via an rjs file, i.e.

# rjs render a javascript alert on the client
page.alert 'Errors\nError 1\nError 2'

and it kept on printing my error message as Errors\nError message 1\nError message2 - note that the newline characters were being escaped and rendered literally

I found this informative post which lead me to change my code from using single quotes to using double quotes - nasty.

# this one will output the newlines in the javascript alert message
page.alert "Errors\nError 1\nError 2"

here is the final code, looping through each error on the model object (product in this case) and outputing a newline on the javascript alert for each error

# rjs file
page.alert "#{get_message_for_show_server_error}"

# helper file
def get_message_for_show_server_error
__s = "Errors "
__@product.errors.full_messages.each do error
____s = s + "\n" + error.to_s

__return s

Sunday, October 14, 2007

Assembla is cool

Check out -

right now I am just using it for the 200MB of free svn repository for my first rails projects (always important to have a back up); but they have so much more to offer as well - Job Board, Distributed Team management tools, etc...

Peregrine sighting in Gualala

We went away for the weekend up to a bed and breakfast in Gualala - the Breakers Inn
a bit on the expensive side but they have pretty nice rooms with great decks that look out over the Gualala river where it comes into the ocean. The weather was perfect, not a cloud in the sky all weekend and no fog either - fall really the best time of year on the Northern California coast.

So there I was sitting on the deck enjoying the sunshine and checking out the seagulls and other water fowl hanging out in the river when all of a sudden they are all flying up in the air (often a sign that a predator is in the area) and so I am looking around in this swarm of birds and there it is a juvenile Peregrine Falcon. He takes a couple of stoops on some water fowl, like 3 or 4 times but nothing doing so he starts heading up the river just a few hundred yards and sees a lone water fowl in the river, next thing I know the Peregrine is diving in on this bird from 15 to 20 feet above the water, coming in from the right and then back from the left, each time the water fowl would avoid being hit by ducking into the water at the last minute - this went on for what seemed like over 5 minutes, I gave up counting how many times he stooped in on the bird after about 40.

So this Peregrine is really determined (probably real hungry) and finally gets the killer blow on the water fowl. He lands on the shore and rests for a few minutes then is back at it, but this time trying to pick the kill up out of the water, takes awhile but he finally grabs it; too heavy to pull out of the water so he flys just out of the water for a bit before dropping in the water and swimming the last 10 feet to the shore.

After a short rest he starts to pluck the feathers and eat some of it. But life is not easy at the top of the food chain. Some Turkey Vultures and Ravens move in and start hanging around the Peregrine. He did not get to eat too much of it before the Ravens move in a steal it from him, they flew off with the kill and the Peregrine tried to pursue and they all went out of my view from there; I doubt the Peregrine was going to get anymore of it at that point.

This was the craziest bird sighting I have ever witnessed - would have been really cool to have a video camera, although it probably would not due the sighting justice.