Quickie: Ruby's string modulo method (%)

Posted by theBlatherskite Sun, 11 May 2008 20:52:00 GMT

Just came across this in Ruby today:


>> tmpl = "I am a stored %s with %d replacements"
=> "I am a stored %s with %d replacements"
>> tmpl % ['template', 2]
=> "I am a stored template with 2 replacements"
>> tmpl % ['fish', 17]
=> "I am a stored fish with 17 replacements"

Handy way to save formatted templates for printfing later, but a bit strange the first time you see the % method applied to a string.

Posted in ,  | Tags , , , ,  | no comments

Using Capistrano's disable_web on Site5

Posted by theBlatherskite Mon, 16 Apr 2007 05:16:00 GMT

I’ve been playing around with capistrano lately, and I think I’ve fallen in love. It was merely a convenience until that ill-fated deployment – that moment when, with panicked error messages scrolling across my screen and equally panicked (if less verbose) thoughts filling my head, a decisive cap rollback restored the calm.

Most recently, however, I discovered the cap disable_web and cap enable_web commands. These let you, with one command, push a helpful static ‘maintenance’ page out to the users while you do, well, maintenance. With a little customization, the page can be downright professional (at least, I like to think my implementation of it was).

Read more...

Posted in ,  | Tags , , ,  | 3 comments

Y Combinator's Stanford Startup School 2007

Posted by theBlatherskite Thu, 12 Apr 2007 04:55:00 GMT

On March 24 I attended Y Combinator’s 2007 startup school at Stanford University. I heard talks by a number of great speakers; reviewing my notes, I’ve culled a few key moments I’d like to share.

Read more...

Tags , ,  | 2 comments

Setting environment for script/runner

Posted by theBlatherskite Wed, 04 Apr 2007 00:16:00 GMT

Looking for a way to set the rails environment for your script/runner cron jobs? I wasn’t, until yesterday at 6:30 PM when I updated my rails gem. Suddenly

/script/runnner -e production System.some_method

(which had been working fine) started throwing errors, which meant I had to endure cron yelling at me periodically until I found a fix. It was surprisingly difficult to locate information about such a simple issue, but I finally came across somebody with the info I needed.

The new, functioning form:

RAILS_ENV=production ./script/runner System.some_method

As a side note, is also works for setting the environment in script/console and, presumably, wherever else you’d need it.

Posted in ,  | Tags , , ,  | no comments

FreeBSD II: Updating and Optimizing

Posted by theBlatherskite Wed, 29 Nov 2006 00:55:00 GMT

I recently wrote about installing FreeBSD. In the month since, I’ve been consistently Googling for information on various upgrade and maintenance tasks. Now that I’ve succeeded, I’m compiling the results here for others to use. This article will cover updating (and using) the ports tree, customizing and optimizing the kernel, and rebuilding everything to make the changes stick. I consider this a necessary intermediate step between a bare OS install and a fully-functional server (although the server stuff does tend to be more engaging – at least for me. I’ve gotta admit I cheated a bit and wrote up my experiences installing Lighttpd, Mongrel, and Pound before cracking down on this article).

Read more...

Posted in  | Tags , , , , , ,  | no comments | no trackbacks

Older posts: 1 2 3