Friday, August 21, 2009

New song: Everybody wants a plucking time machine



"Everybody wants a plucking time machine" by Timothy Chen Allen



WARNING: DIRTY WORDS! FOUL LANGUAGE! AWKWARD CONCEPTS!

Click here to see the decidedly adult lyrics

There are things in this world I have wished for
Love and kindness and peace with my fellow man
I can smile at the dreams of my childhood
But I still dream a dream when I can...

Tuesday, August 11, 2009

Safe SQL LIKE conditions in Ruby On Rails

This is a problem that was driving me a little nuts. In this discussion of how to write a Ruby on Rails query without leaving myself open to a SQL Injection, I found this passage:

"Building your own conditions as pure strings can leave you vulnerable to SQL injection exploits. For example, Client.first(:conditions => "name LIKE '%#{params[:name]}%'") is not safe. See the next section for the preferred way to handle conditions using an array."
However, they never show how to actually write the exact query to replace the unsafe one safely. Here it is:

escaped_query = params[:name].gsub('%', '\%').gsub('_', '\_')
@posts = Post.find(:all, :conditions=> ["subject like :eq or name like :eq", {:eq => "%" + escaped_query + "%"}])

Friday, August 7, 2009

New song: Waiting for Winter

"Waiting for winter" by Timothy Chen Allen



Where are you flying now?
The winds have all died
The heat of Summer drove the birds back inside
And if you're with me now
Don't know where to look
Somewhere inside you must be
Somewhere inside of me

I went to look for you one day in the park
I caught a glimpse of you just as it got dark
And I ran screaming for you not to fly away
It did no good I lost you then
I guess you'll always be within

Somewhere inside of me

The year is fading now
The sky has gone gray
I climb the fence and watch the leaves blow away
You're sitting with me now
Looking at the sky
Waiting for winter to be
Somewhere inside of me

Monday, August 3, 2009

Video: Daybreak Training - Parkour

This was a parkour training session I did recently. The background music is an instrumental called "Plowshares" I wrote for the film-- and since I've been too sick to get it together, this is my weekly song as well: