Wednesday, January 7th, 2009
Some of the people at Culver City Crossfit started doing a “100 Burpee Challenge” they found on Crossfit Santa Cruz’s site. (Check that link for a full explanation of the “rules” and for what a good Burpee looks like.)

It sounded like fun so I jumped in and made up my missing Burpees. Since we started it on the 1st of the year, it’s pretty easy to know how many you have to do for the month of January — it’s just the date. It gets trickier after January’s over — you need to know what day of year it is.
I found a sweet PDF calendar generator which includes the ability to put the day of the year right in the calendar!
So, here it is. (I’ll bring one in for Crossfit Culver’s wall before the end of January.)
Link: 100_burpee_calendar.pdf
Filed under: Crossfit by Joshua Barratt
No Comments »
Tuesday, January 6th, 2009
So, I have resurrected the blog!
There were some victims — at one of the transitions along the way, many of my posts got truncated to just ’summary’ length and the ‘real data’ is gone. (Moment of silence.) Moving on to brighter and better things.
Wordpress was able to connect to my textile database and inhale all my posts. (Thanks!) Unfortunately, it was all in Textile markup. And they didn’t seem to plan on supporting that.
What to do?
I made a quick YAML config to store database options in, config.yml:
---
dbserver: mydbserver.com
dbuser: mydbuser
dbpass: doilookthatdumb
db: my_wp_db
dbtable: wp_posts
dbcolumn: post_content
dbkeycolumn: ID
I didn’t hard code it in the doc so I could generically do this kind of thing later if I wanted.
And then, the cowboy perl to inhale the markup and go from Textile to HTML, using the handy Formatter::HTML::Textile:
#!/usr/bin/perl
use strict;
use warnings;
use YAML qw(LoadFile);
use DBI;
use Formatter::HTML::Textile;
my $c = LoadFile("config.yml");
my $dbh = DBI->connect("dbi:mysql:$c->{db}:$c->{dbserver}",$c->{dbuser},$c->{dbpass}) || die "Can't connect to database: $!\n";
my $q = "select $c->{dbkeycolumn},$c->{dbcolumn} from $c->{dbtable}";
my $uq = "update $c->{dbtable} set $c->{dbcolumn} = ? where $c->{dbkeycolumn} = ?";
my $sth = $dbh->prepare($q);
my $usth = $dbh->prepare($uq);
$sth->execute;
while (my ($key,$text) = $sth->fetchrow_array) {
my $formatter = Formatter::HTML::Textile->format( $text );
my $newtext = $formatter->fragment();
$usth->execute($newtext, $key);
}
And in a fraction of a second, all my old blog posts were converted, in all their (arguable) glory. From now on I’m only blogging in XHTML, suckers.
Filed under: Tech by Joshua Barratt
No Comments »
Monday, January 5th, 2009
It's pretty amazing to be able to do longer form blogging from the iPhone. I don't know that I will do it much, but it's nice to have the option.

For no reason other than that it makes me laugh (well, and to test upload) I am including this image of a cat.
Filed under: Tech by Joshua Barratt
No Comments »