PoMoPro solutions

Computer

I’m at PoMoPro today. We’ve been asked to blog our solutions. So here they are.

Problem 1: Slopographer

Ivan wants a chart which shows how “sloppy” a project in version control is, and how it changes over time. He and Nat suggest using a Subversion repository containing a Java project.

Our solution:

#!/bin/bash
export url="https://svn.sourceforge.net/svnroot/build-o-matic"
export revisions=`svn log $url 2>&1 | egrep "^r[0-9]+" | cut -d" " -f1 `
echo "" > REPORT.html
for revision in $revisions; do
  echo $revision >> REPORT.html
  svn co --quiet -$revision $url
  export slops=`grep -r print build-o-matic | wc -l`
  echo -n "" >> REPORT.html
  rm -rf build-o-matic
done
echo "" >> REPORT.html

Problem 2: Horoscope in a word

Nat wants to know whether he should bother getting up today. He’s a superstitious and seemingly quite lazy person and wants a single-word summary of what the day will be like.

Our solution:

lynx -dump http://weeklyhoroscope.com/powerRating/ | awk -f score.awk

where score.awk is:

/Taurus[ ]*[0-9]+/ {
  rating[12] = "crap";
  rating[11] = "poor";
  rating[10] = "naff";
  rating[9] = "poorish";
  rating[8] = "okish";
  rating[7] = "middling";
  rating[6] = "acceptable";
  rating[5] = "goodish";
  rating[4] = "good";
  rating[3] = "great";
  rating[2] = "excellent";
  rating[1] = "superb";
  print rating[$2]
}

I must admit I would’ve preferred they let us print out the number (1–12) for how good your day is rather than bloat this program right up with a map.

Problem 3: Make Top Trumps cards for each delegate

This one was horrendous. Using a newline-separated list of the names of all the delegates at the conference and produce a “Top Trumps” card for each one. The card should be pretty (according to Ivan’s eye, so that could mean anything), and should contain several bizarre statistics and other bits of information.

We spent ages on this and came up with… nothing. We hit a lot of very unpleasant webpage scraping issues! We wanted to use zoominfo to collect information and photos of the delegates. It turns out to be poor at collecting photos though, and Google checks the referrer for the search to stop people using the service directly, so that’s out too. Successful solutions (by people who work at Google…) was to use Yahoo for images and compute some random stats off web hits.

I think we were trying to reach too high on this one!

We also spent ages searching for good top trump graphics. There aren’t any. There’s a market out there for a decent top trump card generating website.