28
November
2007

Links

27
November
2007

Links

27
November
2007

code

Tagged as:
, , , , .

Displaying the number of hours without a leading zero in Ruby’s #strftime

A pet peeve of mine is the lack of a documented shortcut in Ruby’s #strftime to function to return the hour of the day, in twelve-hour clock, without a leading zero. To wit:

puts Time.now.strftime("%I:%M") # >> 03:29

That’s not particularly attractive. I could strip the leading zero with some string manipulation, but this is getting sledgehammer-ish to crack a nut. Fortunately, this works:

puts Time.now.strftime("%l:%M") # >> 3:29

That’s a lowercase L in the formatting string, which returns the number of hours in a twelve-hour clock sans leading zero. Result! And yes, that’s undocumented everywhere I’ve looked. Thanks to my colleague Colin for pointing that trick out.

Now, if only I could get it to return am/pm without having to call #downcase

25
November
2007

Links

23
November
2007

Links

21
November
2007

Links

20
November
2007

Links

19
November
2007

Links

18
November
2007

Links

18
November
2007

design

Tagged as:
, , , , .

Deliberance

Time for my second post about the Epson R-D1, which I was lucky enough to play with when my colleague Lars bought one recently.

Along the top surface of the camera is what looks like a film-advance lever: the winder you crank to move to the next shot on a film camera. Obviously, there’s no film to advance on the digital camera. But the lever still serves its other traditional purpose: it re-cocks the shutter for another shot.

I’ve marked it in the photograph below.

Initially, I thought this was another of the R-D1’s ersatz “retro” features. After all: there’s no real need for such functionality. Even the Leica M8 abandons the film-advance lever. But once I used the camera, the lever made sense to me.

Firstly: it’s somewhere to rest your thumb. That may sound like a silly thing to say, but if you’ve ever used a rangefinder, or an old SLR with a slim body and no moulded grip, the lever becomes a useful way to counterbalance the body in your hand. It’s nice to have that familiar anchor-point to rest on.

But far more importantly than that: it makes the act of taking a photograph more considered. It brings to mind one of my favourite quotations about photography, from Ansel Adams:

“…the machine-gun approach to photography is flawed… a photograph is not an accident; it is a concept.”

I love that. Photographs are not something that is taken; they’re something that is made. An image is considered, composed, and then captured. And the life of that image ends there. To take another, you must re-cock the shutter, and start again.

And so the shutter-cocking lever makes the very act of making a photograph with the Epson more deliberate. That “ersatz” retro touch is actually fundamental to the way the camera demands to be used. As a result, you end up taking fewer photographs with the Epson - there’s none of the mad “double-tapping” that sometimes becomes habit with a DSLR. It feels more genteel, more refined - and I think the pictures you end up making with it are all the better for that.

Links & notes for this month

Endnotes