April 15, 2009
The Twitter Olympics
The Waterloo Regional Police Service has recently joined the ranks in using Twitter to broadcast updates, incident reports, and other information - 37 followers and counting. Now if only the rest of our public services could follow suit...
April 14, 2009
Rise and Shine
6:40 am - a record unmatched in the three months and change since I rolled off a plane from Tokyo directly into the flesh-piercing depths of the infamous Ottawa winter, only to greet the then-prolonged night at the sprightly hour of 4 am. This is not really impressive by any means - back in high school (a suitably Germanic name for it) I would routinely hoist myself from betwixt my covers ragdoll-physics style around 6:30 am to make the train for band practice.
Also a first for this term: pre-work training. I've started adding weight to my squats and situps, and am adding one-legged calf raises and pistols to my routine - as far as bodyweight exercises go, the unbalanced motions are spectacular for both strength and stability.
And now for something completely different: I made a trip over to Value Village this weekend to pick up some garb such as might befit one with a taste for the piratical. I'll explain later - say, about a week from now - in lurid detail both visual and prosaic. I will remark, however, that it has proven nigh impossible to source a tricorn in Ottawa, whereas a quick perusal of the Kensington-Chinatown stretch back in Toronto would effortlessly net me my sought-after accoutrements. Oh well.
Also a first for this term: pre-work training. I've started adding weight to my squats and situps, and am adding one-legged calf raises and pistols to my routine - as far as bodyweight exercises go, the unbalanced motions are spectacular for both strength and stability.
And now for something completely different: I made a trip over to Value Village this weekend to pick up some garb such as might befit one with a taste for the piratical. I'll explain later - say, about a week from now - in lurid detail both visual and prosaic. I will remark, however, that it has proven nigh impossible to source a tricorn in Ottawa, whereas a quick perusal of the Kensington-Chinatown stretch back in Toronto would effortlessly net me my sought-after accoutrements. Oh well.
April 8, 2009
Best Malpractices
"I learned very early the difference between knowing the name of something and knowing something." -- Richard Feynman
With that in mind, here's a well-reasoned rant against Best Practices. The IT world is replete with buffoons - programmers, managers, CS students, whatever - who toss around terms like AJAX, ORM, XP/Agile, Web 2.0, RDBMS, DRY, NIH, and OOP without ever pausing to ask the real questions. What do they mean? What do they do? Where do they succeed - and where do they fall short?
Consider this: Google does not follow Best Practices. They solve problems. Period.
Consider this: Google does not follow Best Practices. They solve problems. Period.
Labels:
IT,
problem-solving,
programming
Dark Night
Stayed up late (for work-term-acceptable values of "late") last night to watch Batman Begins. It's a fairly solid flick, but...while scientific snafus don't bother me as much as some, I draw the line somewhere before targeted microwave weapons capable of vaporizing a city's water supply while leaving nary a scratch on millions of human bystanders.
Speaking of water, it's hovering around freezing point here in Ottawa for the third day in a row. It's spring now - didn't you get the memo?
Speaking of water, it's hovering around freezing point here in Ottawa for the third day in a row. It's spring now - didn't you get the memo?
April 6, 2009
Brute Force Attack
Somewhere back near the beginning of this term, I set myself a goal. Today, I made some very definite progress towards that goal by completing three (non-consecutive, alas) muscle-ups on one of the bars at OGC. Of course, I'm sticking to the wording of the goal, which means this only counts as one in a row; that said, they take a fair amount of dedication to build up to, so I'm quite proud of myself right now!
Labels:
conditioning,
fitness,
goals,
parkour
Winter, Still
It's snowing - rather fiercely, too. I'd provide proof, but I don't have my camera and the Hill Cam is down.
Edit: Our wintry sentence has recently been commuted to a blustery blanket of barely-liquid rain. I now fully appreciate the benefits of living a mere two-minute walk away.
Edit: Our wintry sentence has recently been commuted to a blustery blanket of barely-liquid rain. I now fully appreciate the benefits of living a mere two-minute walk away.
Labels:
fecal matter,
Ottawa,
snow,
winter
Bric-A-Brac, Post-Weekend Style
Decided to try waking up earlier this week. Today: 7:20 am after one false start at 7:07 am. (Yes, I really do set my alarm clock for times like this - my favourite time is 8:08.)
Sugar is wonderful, maple sugar all the more so. I had the inimitable pleasure of visiting a sugar bush on Saturday along with the rest of my office; turns out the uncle of one of our programmer-analysts runs the operation, now in its 27th season of business. Nothing like maple sugar, maple syrup, and maple taffy in one day to mount a buffer overflow attack on your sweet taste buds.
Just found this cool animation off a link posted in a tweet from an ex-coworker; as explained on the video page, it uses data from this site. My $.02: I think all public services, utilities, etc. should be releasing data APIs for the general public to hack on. They could even release the data under a GPL-ish licence that requires any resulting apps to be made publicly available. They could even go one step further - simply hold an online vote to pick the top apps, then host them free of charge on their website. Help us to help you...
Edit: I forgot to post links to the sugar bush photos! Here they are. Additionally, here's some more pics as taken by coworker Boxing Chen and uploaded by the owner, Pierre Joanis.
Sugar is wonderful, maple sugar all the more so. I had the inimitable pleasure of visiting a sugar bush on Saturday along with the rest of my office; turns out the uncle of one of our programmer-analysts runs the operation, now in its 27th season of business. Nothing like maple sugar, maple syrup, and maple taffy in one day to mount a buffer overflow attack on your sweet taste buds.
Just found this cool animation off a link posted in a tweet from an ex-coworker; as explained on the video page, it uses data from this site. My $.02: I think all public services, utilities, etc. should be releasing data APIs for the general public to hack on. They could even release the data under a GPL-ish licence that requires any resulting apps to be made publicly available. They could even go one step further - simply hold an online vote to pick the top apps, then host them free of charge on their website. Help us to help you...
Edit: I forgot to post links to the sugar bush photos! Here they are. Additionally, here's some more pics as taken by coworker Boxing Chen and uploaded by the owner, Pierre Joanis.
Labels:
food,
public transit,
random,
sleep
April 4, 2009
Quod Libet: First Day
Some thoughts/observations so far:
- I'm enjoying the automatic rating plugin, and expect it will be very useful in filtering out the detritus from my CBC Radio 3 crawls - just listen on shuffle for a while, then drop the worst-rated files.
- The default rating settings are weird - 4 notes? Usually 5 or 10 is standard.
- I haven't found a way to properly refresh the library without restarting - newly downloaded songs don't show up. Not a deal breaker, but annoying nonetheless.
- Relatively seamless transitions between songs. I like. Also, the interface is snappy in general - no slowdown when I rescan the watch directories, no strange loading pauses.
- The built-in config GUI hides most options from me. Why? Is it that hard to provide an advanced settings toggle?
- The Amazon album-cover-grabbing plugin is barfing on me with some expat errors. Not cool. (As an aside: there's a bewildering proliferation of XML-parsing libraries for Python. It's no wonder that the Python standard library has taken the "here's some reasonable defaults, plug your own in if you want" route.)
Anything Goes
A growing music collection demands a powerful media player. While VLC will play just about anything you throw at it, it seems to choke regularly on larger libraries. I'm giving Quod Libet a spin for now:
(The plugins aren't strictly necessary, but they include some nice features like album cover grabbing and automatic rating systems.) So far, the experience is pretty seamless, though I've only got about 2000 songs loaded into the library; I'll be chiefly looking for scalability as I put my 1.5 TB RAID 5 to good use!
# apt-get install quodlibet quodlibet-plugins
(The plugins aren't strictly necessary, but they include some nice features like album cover grabbing and automatic rating systems.) So far, the experience is pretty seamless, though I've only got about 2000 songs loaded into the library; I'll be chiefly looking for scalability as I put my 1.5 TB RAID 5 to good use!
Labels:
music
April 3, 2009
The Sound of Scraping
After sitting on my CBC Radio 3 metadata for just over a week, I finally got around to throwing together a decent downloading script. Actually, the scraper/downloader is a loose federation of scripts, deliberately kept in separate modules so as to allow nice things like, say, running multiple copies thereof concurrently. I'll post a link to the source in the near future, along with a few words of explanation. Maybe I'll even write a README - after all, although CBC Radio 3 is afloat for now, there's no telling how long it will survive the budget axes of doom.
(And, to prevent the inevitable smartasses from chiming in with "you forgot wget, n00b" - nope, it's in there somewhere. That said, I think you'll find these scripts go a tiny bit further...)
(And, to prevent the inevitable smartasses from chiming in with "you forgot wget, n00b" - nope, it's in there somewhere. That said, I think you'll find these scripts go a tiny bit further...)
Labels:
bash,
crawling,
music,
programming,
python
April 2, 2009
If It Floats Like An Octopus
"C++: an octopus made by nailing extra legs onto a dog."
C++ is often referred to as a statically-typed language - it aggressively checks types at compile time (and, in the case of anything STL-related, spews out monstrous-looking errors.) By comparison, many "scripting" languages (and I use that word cautiously, since these are proving to be powerful application development languages in their own right!) such as Python and PHP support what is known as duck typing. Many rail against this, arguing that it leads to unmaintainable code and nasty runtime errors.
That aside, C++ does have support for duck typing - in its template system. Consider:
The global function p() enforces no type restrictions on the template class T; all it requires is that T implement void T::print() const, as A and B do. Also, note that p(c) causes a compile-time error, not a runtime error! There is a tradeoff, naturally: the compiler creates a separate copy of p() for each type that it's invoked with (g++ -S for the gory details!), so extensive use of this technique can easily balloon your object files.
C++ is often referred to as a statically-typed language - it aggressively checks types at compile time (and, in the case of anything STL-related, spews out monstrous-looking errors.) By comparison, many "scripting" languages (and I use that word cautiously, since these are proving to be powerful application development languages in their own right!) such as Python and PHP support what is known as duck typing. Many rail against this, arguing that it leads to unmaintainable code and nasty runtime errors.
That aside, C++ does have support for duck typing - in its template system. Consider:
#include <iostream>
using namespace std;
template <class T> void p(const T& t) { t.print(); }
struct A { void print() const { cout << "A!" << endl; } };
struct B { void print() const { cout << "B!" << endl; } };
struct C { };
int main() {
A a; B b; C c;
p(a); // "A!"
p(b); // "B!"
//p(c); // compile-time error
using namespace std;
template <class T> void p(const T& t) { t.print(); }
struct A { void print() const { cout << "A!" << endl; } };
struct B { void print() const { cout << "B!" << endl; } };
struct C { };
int main() {
A a; B b; C c;
p(a); // "A!"
p(b); // "B!"
//p(c); // compile-time error
}
The global function p() enforces no type restrictions on the template class T; all it requires is that T implement void T::print() const, as A and B do. Also, note that p(c) causes a compile-time error, not a runtime error! There is a tradeoff, naturally: the compiler creates a separate copy of p() for each type that it's invoked with (g++ -S for the gory details!), so extensive use of this technique can easily balloon your object files.
Labels:
c++,
duck typing,
programming,
templates
April 1, 2009
March 31, 2009
Pwnage: A Dish Best Served With Sheep and Wheat
I should add, in response to this post, that I soundly returned the favour. We'll have to settle this over a real match...
Mediaglyphic Evidence
Well, not quite - but here's the Montreal session video. The more I train, the longer the path ahead...
Who Says You Can't Swear in C++?
I currently have the pleasure of using Och's YASMET tool for maximum entropy model optimization. (Quick background primer: maximum entropy is really a simple concept - assume nothing about the data beyond what you're given. In slightly more technical terms, you want the most uniform distribution that fits the constraints.) Looking at the source code is akin to reading one too many JAPH snippets or sifting through Google's obfuscated JavaScript - it's an experience both awe-inspiring and twitch-inducing. Of course, it's GNU GPL'd, so anyone who can navigate the mess of two-letter variable names, magic numbers, and minimally-whitespaced text is free to modify it! (A re-indenting utility might help here - though a quick run against the K&R style expands it to 362 lines and reveals the terrifying depth of the conditional statements lurking within. Fair warning.)
Labels:
c++,
machine learning,
optimization,
SMT
March 30, 2009
Ow, My Hands
A few of us here in Ottawa (well, only three) hit up Montreal this last weekend to get a session in with some of the local traceurs. The Stade Olympique (less than fondly referred to as the "Big O", both for its shape and for the enormous debt incurred from its construction) is unsightly to most - and an absolute paradise for skateboarders, BMXers, and traceurs of all skill levels. The photos are up here.
In other news: if you haven't done so already, check out Pretty Lights. Who says you can't give away the music PWYC-style and make a good run of things? Oh, right - these thugs do.
March 26, 2009
And the total is...
76302. Of course, this is just the metadata - I wouldn't be so reckless as to hammer the CBC Radio 3 servers with 200 GB worth of download requests in a day! (Nor would my bandwidth permit me to suck down that much data in anything less than a couple of weeks. Oh well.) Next up: filter it down to a list of songs that I might actually want.
Labels:
bash,
music,
programming,
python
2017 Songs and Counting
Your guess as to what this does:
(Yes, I've left out some details - like what exactly those scripts do under the covers. I'll post about that when it's finished!)
Better make that 3156 songs. And counting.
#!/bin/bash
for i in `seq 0 25`; do
echo "http://radio3.cbc.ca/nmc/artists.aspx?offset=${i}"
done | tee -a artists.log |\
./url-dumper 1.0 |\
egrep -o "/bands/[^\"]*" | uniq |
while read line; do
b=`basename "$line"`
echo "/play/band/${b}"
done | uniq | tee -a bands.log | ./cbc3-get-music-info 1.0
(Yes, I've left out some details - like what exactly those scripts do under the covers. I'll post about that when it's finished!)
Better make that 3156 songs. And counting.
Labels:
bash,
crawling,
music,
programming,
python
March 24, 2009
Brothers From, er, The Same Mother
I'd like to congratulate my brother Neil on his acceptance into both Technical Illustration at Sheridan and Industrial Design at Humber. He's definitely one of the most talented artists I know, and I'm sure he'll make the most out of whichever program he chooses. So: congratulations!
Labels:
art,
congratulations,
family,
neil
Subscribe to:
Posts (Atom)

