Archive

RSI

Posted on Fri 21 Apr, 2006

I’ve been working a lot recently. And when I say a lot, I mean thousands of lines of Rails code across three projects, and thousands of lines of php across many projects. I started to get concerned about RSI. I’ve had vague work-related pain in my wrists in the past, and I think a big contributor to this was the fact that I once broke both my wrists. I’d elaborate on this, but it’s just way too embarrassing for me to slap that on my blog!

Back to RSI. I’ve found these two apps really helped:

Windows: Workrave

Workrave tells you when to take micro breaks, longer breaks, and what…

Continue reading → | Tagsrsi, ergonomics

PHP 5's anonymous functions

Posted on Wed 5 Apr, 2006

I don’t see much use of anonymous functions in php, yet when I write python or ruby, I use constructs like this quite often. You can do it in php though, with create_function. It’s nothing that fancy, it just lets you create a function whenever you feel like it. This can be placed wherever you need a callback in php.

Callbacks in php must be a function name. You can’t refer to methods in the current class, or hack it by making a function that returns an object: function()>probably_a_singleton>hello(). This is where create_function() comes in.

Here’s an example:

$where_sql[] = ” $...

Continue reading → | Tagsphp, programming