December 1, 2009

Goodbye, World.

This will be my last post here.

Wait, what?

That's right - I'm moving my blog to, in an effort to rule its layout and content with a silicon fist. The Blogger version will remain alive purely for historical interest; future posts will be uploaded at the new site.

Once more: the blog has moved to - update your bookmarks!

November 29, 2009

Recyclists of SF

San Francisco - nexus for the industries of silicon and logic, erstwhile hub for countless wide-eyed Flower Children and their pharmacopoeia of psychedelics, and home to the most efficient army of hunter-gatherer recyclers known to mankind. These scavengers rove about the city filling carts of all descriptions with aluminum, plastic, and glass gold, pausing only to swig the last dregs of partially re-fermented beer from that hastily-discarded PBR. There's a lesson in here somewhere about economics: by raising its bottle deposits to the point where serial bottle-returning becomes a decent source of quick cash, California has effectively crowd-sourced recycling. As a result, they're able to post 74% recycling of beverage containers.

(I can hear the Hounds howling - this wealth-redistribution racket is straight-up capital-C Communism, a conspiracy perpetrated by Obama and his sleeper-agent terrorist-Jew-Illuminati cohort ever since the Dark Time of Marx to pave the way for such unimaginable horrors as public health care and tighter bank regulations!)

The bottle deposit is an effective tax on laziness, which is perfectly fine by me. After all, it's a fair bet that even if we taxed the beverage companies for making these containers in the first place, polluter-pays style, we'd end up paying this portion anyways (unless, in accounting for the total cost of production, that can of Coke became prohibitively expensive...)

November 26, 2009

Fear and Loathing in Philadelphia

6:00 am. There is something brutal and savage about stepping off a red-eye flight into the flickering fluorescent wash at Philadelphia to the tune of stock classical music, like a low-budget stage production of Clockwork Orange - any second now, I fear, my generally unorthodox wardrobe will spark senseless violence and mayhem. Then again, anyone voluntarily leaving California - especially as we begin this inevitable march towards Winter - is clearly expecting a rude shock to the system. Cats meow from somewhere in the open-concept holding cell known as The Waiting Area; before my sleep-deprived sensory apparatus has time to square this with the whole airport thing, a woman starts jerkily dancing along with the classical fare over out front of Gate B-13. There is a scent of rank feral desperation about the place, augmented by the ringtone interjections of crudely-produced hip-hop. The double shot of bourbon back in SFO has long worn off, leaving me woefully unequipped to handle the sort of ultraviolence that is surely headed my way. I hear they still have Public Lynchings in those pleasant atavistic backwaters of this fine country, and I can certainly muster enough blasphemy to make the ticket...

God Jesus! It seems the spirit of Hunter S. Thompson has crept into my brain, a direct frontal assault from the pages of my newly-finished copy of Fear and Loathing: On the Campaign Trail '72. If you would claim to understand the intricate meanderings of politics, read this book - a better account of the haphazard chaos behind your average televised presidential campaign has never been given. No major newspaper could print this with a straight face without immediately forcing the termination of half their editorial staff, with the heads to be mailed to Washington for public display...and it seems my connecting flight is boarding, judging by the impatient queue slowly lurching towards the open gate. More to follow...

November 21, 2009

In San Francisco, Startup == Pub

Any event where you wake up the next morning with two free shirts, a deck of cards, a jar of bubble soap, a stack of business cards, and a video of yourself ziplining across an office hallway is a resounding success. Enter Startup Crawl, an open house on some of San Francisco's hottest startups. It's part pub crawl, part power-speed-networking, part tech-speak geekout session, and 100% SF-style general hilarity. Where else can some lowly Canadian undergrads walk in off the street - in jeans and T-shirts, no less - and end up throwing back Don Julio with the CEO over talk about scalability and the startup life within the half hour? Where else can you climb out a window to have rooftop beers with high-wired entrepreneurs preparing for next morning's Y Combinator pitch? The list of such meritocratic hedonist enclaves is short indeed.

This event deserves to be ported elsewhere - where's the beef, Waterloo?

November 20, 2009

Mean Streets of Silicon Valley

Mean/variance calculation is ridiculously commonplace in data analysis, yet most programmers have never seen this gem from TAoCP:

def online_mean_and_variance(data):
    n, mu, s2 = 0, 0, 0
    for x in data:
        n += 1
        delta = x - mu
        mu += delta/n
        s2 += delta*(x - mu)
    if n > 1:
        yield (mu, s2/(n-1))

Unlike the standard two-pass algorithm, this one is online; it also happens to be more stable.
If that's not enough, I've given it to you here as a Python generator. Enjoy!

October 28, 2009


It was only a matter of time before Google did this - let the battle begin.

802.11x In The City

Another morning, another wireless hotspot courtesy of the thriving West Coast coffee-shop culture. This one is located within the confines of Cup Of Java, a fairly standard joint that just so happens to have a Casio CTK-471 sitting around - any instrument on the keyboard-piano spectrum, even a cheap MIDI-spewing plastic-encased Casio, earns bonus points. I order the Greek Omelet, which comes nestled between a bed of -

Actually, never mind that. I'm no food critic; that's what we have Yelp for. (Hooray for externalized memory!)

In San Francisco, every coffee shop comes with its very own resident Bluetooth headset-wearing intravenous-caffeine-drip work-from-home maven; the more popular ones boast entire armies of these laptop-toting soldiers, each one vying for a slice of the ether. (I'm taking more than my fair share with Transmission (more proof that the highly publicized takedown and subsequent sale of The Pirate Bay does jack-all to staunch the, er, torrential (yeah, I winced too, but it seemed like most appropriate adjective) flow of information), and am watching nervously over my shoulder for the legions of RIAA men-in-black that are no doubt waiting to haul my recidivist pirate ass into court.) I'm half tempted to whip out Wireshark to see what exactly these people are doing, but that would most likely cross the line between harmless curiosity and feline genocide.

...and I'm off to scour a couple of thrift stores before grabbing the bus into work.

October 27, 2009

The Gubernator Strikes Back

Need one more reason to be proud of your elected officials? Here you go. While we're at it, here's another epic fail courtesy of our beloved civil engineers.

What else? I went ATVing at the Pismo Dunes State Vehicular Recreation Area, an unnecessarily obtuse moniker for what amounts to a giant outdoor sandbox filled with off-road vehicles of every description. As a testament to its rugged nature, the area is rife with Second-Amendment freaks on oversized rollcages-with-wheels proudly festooned with Southern Confederate flags. If you've ever wanted to live out those Mad Max post-apocalyptic fantasies of petrol-fueled villainy, this is most definitely the place.

Found a super-chill haven of hippie-dom sandwiched between Mission and Valencia. The Oz Hookah Lounge delivers drunk revelry, multiflavoured smoke haze, cushions, and a panoply of psychedelic patterns at nearly every hour of the night. This particular visit was punctuated by a host of inebriated Iranian expats carrying beer-laden ice buckets and gin-and-tonics from a nearby bar, which they promptly distributed amongst the crowd.

Halloween's coming - get your costumes together! Photographic evidence is requested, lest the veracity of your respective accounts be called into question.

October 20, 2009

Eye of the Sloth

It's training time - my general fitness took a proverbial beating from the demons of stress, work, and take-out cuisine last term, and I'm just now starting to rectify that. (Of course, there's no snow here, so I'll have to settle for Cali sun and SF fog. Woe is me.) To that end, I'm making a commitment to hit the gym at least tri-weekly; encouragement (and light berating, if that's more your style) is, er, encouraged. I'm hoping to make it out to some of the SFPK meets as well. Naturally, I'll be concocting my own personal brand of inspiration - if this cryptic remark has you puzzled (as well it should) you'll just have to keep posted for more details!

October 19, 2009

Putting the Ignoble in Vignoble

Had the chance to wine and dine in the famed wine-producing region of Napa Valley this last Saturday. I decided to don my only suit jacket (and no socks - hey, it's laundry day) for the occasion so as to meet the requisite minimum standard of pomposity. (I should really source a monocle, kerchief, pocket watch, and top hat. As a general rule, you don't argue with anyone who is actively employing all these objects in the service of highbrowdom.)

The Stanford Canadian Club Thanksgiving dinner was a resounding success as measured by the excess of available foodstuffs; there was turkey, stuffing, mashed potatoes, and pumpkin pie in abundance. Yum. Maybe this whole gastronomic shindig should be a weekly affair (or fortnightly, at the very least.) In true seasonal fashion, the leaves are Monty-Python-style suicide-diving off the trees in droves; the air is crisp with that familiar decay-scent, something I had not expected to find this far south.

Important news flash: I just saw a rainbow out the shuttle window. If I were inclined to believe in such nonsense, I'd say that was a good omen for the day.

October 16, 2009

My One Lunar Cycle No-Post-iversary

Yeah, it's been that long. 28 Days Later, stuffs and things at varying orbitals of excitement have been happening with acceptable regularity:
  • Not only am I the proud owner of a longboard, but this particular plank of my comprehensive transportation platform now bears the inimitable insignia of one Randall Munroe. (I can only wonder what joyous blasphemies #666 will bring.)
  • Finally made it out to the infamous DNA Lounge; this SF institution has the peculiar distinction of being owned by ex-Netscape programmer Jamie Zawinski.
  • Canadian Thanksgiving shindig, complete with full turkey and pumpkin pie. Need I say more? (No, but I should probably add this: there's another Canadian Thanksgiving dinner this Sunday hosted by the Stanford Canadian Club; despite what their (apparently infrequently updated) site says, it really is this weekend.)
  • Pretty Lights at The Independent last night. If you haven't seen them, you really should.
How's Facebook? (Come on - if you care enough about me to read my pithy musings, you're probably expecting an answer to this question.) Intense. It pains me to say it, but Facebook has so far provided much more in the way of personal development and work-related awesomeness than Google ever did. How can that be? It comes down to recruiting strategy: Google casts as wide a net as possible, hoping to grab what it considers to be the best of the best before someone else does. In my opinion, this strategy is bound to backfire. You end up with a zillion interns and, well, less than a zillion interesting and/or useful projects; it doesn't take a math major to see that you can't pair each intern up with something worthwhile to work on. (It does take a math major, however, to look at the whole situation and start rambling about bijections.) Here's the point: half of the interns coming out of Google are extremely wary of returning, and that can't be good. ("Half" here is an extremely unscientific guesstimate, but several co-interns (who will obviously remain nameless in such a public forum as The Internet) have expressed similar sentiments.)

September 19, 2009

The Pirates United Will Never Be Defeated

"We have, ourselves, full confidence that if all do their duty, if nothing is neglected, and if the best arrangements are made, as they are being made, we shall prove ourselves once more able to defend our Internets, to ride out the storm of war, and to outlive the menace of tyranny, if necessary for years, if necessary alone.
Even though large parts of Internets and many old and famous trackers have fallen or may fall into the grip of the Ifpi and all the odious apparatus of MPAA rule, we shall not flag or fail. We shall go on to the end, we shall fight in France, we shall fight on the ef-nets and darknets, we shall fight with growing confidence and growing strength in the air, we shall defend our Internets, whatever the cost may be, we shall fight on the beaches, we shall fight on the, we shall fight on the /. and on the digg, we shall fight in the courts; we shall never surrender, and if, which I do not for a moment believe, the Internets or a large part of it were subjugated and starving, then our Empire beyond the seas, armed and guarded by the Anon Fleet, would carry on the struggle, until, in Cerf's good time, the New World, with all its power and might, steps forth to the rescue and the liberation of the old."

September 15, 2009

Onwards and Upwards

Congratulations, Facebook! Now for the other 6.4 billion.

(Side note: looks like Google's playing Wolfram Alpha's game. Round Two: fight!)

September 14, 2009

The Ongoing Saga of Evan's Search For Housing in San Francisco

I've finally uploaded a couple of albums, as promised - one for our intern-squad trip to LA, one for random.choice() style samplings of SF. The latter album will hopefully expand as the term progresses!

The small handful of people that actually read this thing might have noticed a considerable lull in post volume - and not without good reason. For illustration, here's a timeline of my weekend:
  • Friday, 9 pm: pass out from exhaustion. Turns out I still haven't caught up on sleep from the month of death, a fact which late-night mid-week meanderings in Mission can only exacerbate.
  • Saturday, 9 am: wake up, foot it to Lower Haight for breakfast.
  • Saturday, 11 am: still at breakfast place, firing salvos of Craigslist replies. Aiming for the clusterbomb strategy; the housing search in San Francisco is not exactly easy, especially when you're a male international student looking for something short-term.
  • Saturday, 12 pm: moved on to Upper Haight, where I score myself a longboard.
  • Saturday, 1 pm: running laps around here to the dismay of tourists and local art cognoscenti alike. Still need practice before I can take this thing to the streets.
  • Saturday, 2 pm: finally work up enough confidence to book it down to Stockton and Market, where I've got an overpriced screen-repair appointment at the not-so-aptly-named Genius Bar.
  • Saturday, 4 pm: with everything in working order, I work my way back to the hostel.
  • Saturday, 5 pm: keycard doesn't work. Uh oh.
  • Saturday, 5:30 pm: I learn that, contrary to my understanding, the hostel has fubar'd my reservation; I was supposed to check out this morning. At least they're nice enough not to charge me for the privilege.
  • Saturday, 6:50 pm: after a hasty sack-packing and another ear-grinding leg on the BART, I'm standing on the San Jose-bound platform at Millbrae Caltrain. The plan? Lug myself to the office, drop my stuff off, and find a nice comfortable couch to crash on. Oh, and I just missed the train.
  • Saturday, 8:30 pm: I finally get to the office.
  • Saturday, 9 pm: I check my email, where I find a welcome bit of good news - one of the Craigslist postings actually responded.
  • Saturday, 9:30 pm: One of my coworkers happens to be working late on a rush job; he kindly offers me a place to crash for the night.
  • Saturday, 11 pm: I'm watching Clash of the Titans. Hey, this nomad business isn't half bad.
  • Sunday, 11 am: me, my longboard, and I make it out to the Caltrain for a trip back into SF. Not having a place to stay, I ping jverkoeyen; he volunteers the services of his fine floor for the cause. Random discovery - turns out there's a farmers' market right outside California Ave. Caltrain every Sunday.
  • Sunday, 2 pm: standing at Embarcadero and Market. The Craigslist poster rings me; I've arranged a viewing at 4 pm. Between then and now, I've got to find Jeff and get my ass across most of downtown SF to the far side of Mission. Whatever will I do?
  • Sunday, 3 pm: turns out Jeff and his girlfriend Emily shelled out for a mattress and bedframe off Craigslist and need help moving it. In return, they'll ship me across town in a Zipcar pickup truck and pass off a set of keys so I can get into their place.
  • Sunday, 3:40 pm: I reach the room I'm viewing with time to spare. The tenants show me around. Good vibes all around; these people are exactly the kind of laid-back I need right now.
  • Sunday, 5 pm: eating in some supposedly Cambodian restaurant near Mission.
  • Sunday, 8 pm: a meal, a spot of rainy longboarding, a none-too-quick bus ride, and a short hike later, I reach Jeff's place. It's exactly as sparsely furnished as I had imagined.
  • Sunday, 9 pm: I find a corner supermarket with the help of a map Jeff left on the counter.
  • Sunday, 9:30 pm: I'm eating a hasty meal of baguette, cheese, turkey, pasta salad, nectarine, and orange juice under Bay Bridge.
  • Sunday, 11:30 pm: restless, I take a brief promenade about the apartment complex grounds. Nice pool; there's something pleasantly surreal about living in the shadow of an enormous bridge.
  • Sunday, 12 am: lights out. Too much busy-work roaming for one weekend.
And that was it. Gasp. I must have covered the whole city a zillion times.

On the upside, I've landed a place to live for the rest of the term; I'm bunking up in my favourite hostel in SF until move-in. That, and I have yet to injure myself longboarding. (Depending on who you ask, that's either a good sign or an indication that I'm not doing it right. We'll see - I've got plenty of time and hills to reverse this trend with.)

September 12, 2009

Board in SF

Shelled out a wad of cash today for a longboard, which I've been (painlessly (so far, at least)) riding around SF on. My goal is to cut door-to-door times in the city core by 60-75% compared to the estimated walking time on Google Maps. (I'd estimate 80-90% for cycling, but this is immeasurably cooler - not to mention far more prone to catastrophic failure.)

And, yeah, I promised pics a few days back. I have yet to deliver on that promise, but I'll definitely post here when I do!

September 10, 2009

You've Been Facebook'd

Where "you" is TechCrunch. Long live engineer humour!

September 3, 2009

Where Two Files Meet

(Note: I promise that I'll post something more generally interesting before this day draws to a close, for non-technical values of generally interesting.)

Let's say that you have two large unsorted files, each of which is essentially a long list of strings, and you want to find their intersection. There's the simple brute-force way:

while read line; do grep "$line" file2; done < file1

There's a problem - this is quadratic! Fortunately, we can cut this down pretty easily with the old time-memory tradeoff:

sort file1 > file1.sorted
sort file2 > file2.sorted
sort -m file1.sorted file2.sorted > combined
diff combined <(uniq combined)

August 13, 2009


"It is criminal to steal a purse, daring to steal a fortune, a mark of greatness to steal a crown. The blame diminishes as the guilt increases." -- Schiller
I was sitting in the City Cafe (accent intended) Bakery (held in slightly-above-average esteem by the professor who brought Waterloo's CS frosh such delights as Scheme), taking a quick breakfast with my brother; this quote was written on their blackboard. City Cafe is an economic enigma. They have no cashiers, opting instead for a self-serve honour-system model; you deposit your payment into a bus fare box (Cleveland Transit, I'm told, although I've never verified this) before leaving.
Question of the day: why does this work? By traditional economic theories, the dominant strategy is to eat and run. One theory holds that this is a form of the tit-for-tat strategy: the City Cafe Bakery places trust in its customers, who then feel compelled (perhaps because reciprocity helps maintain social norms) to pay. Another possibility is that the players are maximizing self-interest according to a different payoff function. There might be quantifiable reward in keeping the bakery open or in appearing honest to one's friends. (It is notable that customers often leave tips - maybe it is psychologically easier to tip when the register and tip jar are combined into one receptacle!) There is also the novelty factor; by following an unorthodox business model, they generate a certain amount of word-of-mouth buzz.
(According to Schiller, your best strategy is to grab everything in the bakery and run - that way, you minimize blame!)

Denouement (again, accent intended) comes from the French noeud for knot; the literal translation is "unknotting". I'll leave that open to interpretation.

August 7, 2009

Context-Free Blogging

My hobby: thinking up weird pseudo-science-sounding phrases and investigating the resulting Google harvest. This time around, a search for context-free schooling (thought process: take CS 360, add various ruminations on the state of modern education, bring to simmer) returned a list of links to this paper on the impact of education on contextual information processing. (The original absolute/relative tasks are described in greater detail here.) The question of how much you can really extrapolate from drawing lines in boxes is left open; in any case, we may be able to include big-picture connection-building among the victims of traditional schooling.

Oh, and the Internet has finally invented meta-time-wasting. Enjoy!

July 26, 2009

The Eleventh Hour

Aside from being the title of an awesome children's book (which may or may not still reside on my shelves), this phrase adequately sums up my situation here. I've got slightly under 72 hours to polish and document my Graphics project, touch up an essay on Church's solution to the Entscheidungsproblem of Hilbert's Program, and - of course! - push the trains struggle as far as possible.

(Yes, I know you can see the edges of the skybox in the above image. I probably won't have time to change that before the Graphics demo.)

On the real-time front, we've had a very fortunate breakthrough; the sensor polling bug fell before a quick debugging sprint yesterday morning. We're driving hard to get route-finding working tonight, as this will leave us all of Tuesday (as mentioned, I have other things to worry about tomorrow!) to put together our final demo. Given the time constraints, we'll likely have to go with something almost braindead-simple; the plan currently being floated around is to hack together a cat-and-mouse game using the trains.

But enough about schoolwork! I'm off to Germany on the 30th. Let's hope I manage to drag my bedraggled body to Pearson in time!

Final note: this blog has been very one-dimensional over the last month. Given my situation, this is perhaps understandable; nevertheless, I shiver with antici-

Delay(60);    // pause for 3s (one tick == 50 ms)

-pation at the prospect of having something other than Graphics or Real-Time to talk about.

July 23, 2009

Ore for Wood

5 days to go - I've missed a few here. Graphics is going reasonably well; the past day or so has seen the addition of skyboxes, proper terrain clamping, texture blending on the terrain (albeit a hacked-together software version), smooth normals, water reflection, and a few test scenes to my project. Above: a test scene that shows the use of the skybox (rendered in garish colours for maximum obviousness!), one tree (with eight levels of branching), and a few randomly positioned rocks (two levels of subdivision each).

Real-Time, on the other hand, is coming to an inauspicious close. Our program suffers from a showstopper bug: sensor polling freezes. We managed to hack around this to complete most of the first train control objective, but the second control objective will remain elusive until this is resolved. The PsychOS team is running out of time rapidly, but we still have a few more tricks up our sleeves:
  • We can redesign sensor polling. The current plan is to extend the kernel's event-handling structures to support software events as well; this way, the SensorManager() can trigger EVENT_NEW_SENSOR (or something like that) whenever a new sensor comes along.
  • We can attempt adding a chain of couriers (or similar data-passing tasks) to the train input server. If the problem lies in dropped bytes, this might resolve the issue.
  • Failing all else, we can add some NOPs (or the C equivalent: a busy-wait for loop - our TA actually did this when he took the course.) The mere thought of adding such a blatant hack induces violent fits of cringing, but we'll do it if we need to.
If we can get past this, we already have systems in place to find routes and reserve track sections - they just need to be tested and used.

Personal notes: it is now quite obvious that the month is drawing to a close. This has been a bizarre ride of ups and downs, of hope and despair, of sleeplessness and take-out meals and 16-hour debugging sprints. I'm feeling strangely calm as I enter the final stretch, in stark contrast to the near-complete-breakdowns that some of those Real-Time sprints drove me to. Not even the possibility of missing the final Real-Time demo fazes me; regardless of what happens with the project, I've learned an incredible amount about hardware, low-level programming, and operating system design - and it's all practical knowledge, especially given that we've been working with the ARM architecture.

If I had to pinpoint the source of our problems, I'd put it down to hubris. The early assignments were relatively easy, the test programs rather trivial; we simply wrote the required code and then went off to take care of our other assignments, working on the assumption that everything would continue to go well. This is never good practice, not even in the classroom. We implemented proper error-checking about three weeks ago, something we should have done three months ago. We should have rigorously tested our kernel, bombarding it with interrupts and I/O and requests and everything else that could possibly bring it to its knees; we did some of that, but it was too little and far too late.

Despite the above tirade - which looks suspiciously like a pre-emptive post-mortem - I should add that I refuse to give up. Once I get Graphics out of the way, we'll dig our heels in this weekend to try anything and everything that might work. Keep posted!

July 18, 2009


10 days to go. After plowing through the first few sections of Prusinkiewicz and Lindenmayer's The Algorithmic Beauty of Plants, I hacked together a quick tree renderer. The above image was generated by randomizing the parameters in Figure 2.8, with slightly higher branching angles to fake downward tropism. (Yeah, I know that's not how it's really done - but it's dead simple.)

At this point, I need to start trying to mash things together. I could spend several days tweaking my texture, terrain, rock, and plant generators to near-perfection, but I just don't have the time - especially when I've also got to slap in texture mapping, a skybox background, a simple water plane with stencil buffer reflection, interaction (I've got the keyboard working, but I haven't implemented mouselook yet), terrain clamping, and collision detection.

July 17, 2009

Phoenix Down

11 days to go. No picture this time, but I don't need one: we fixed the kernel, thus reviving ourselves just in time for the final sprint. Depending on how the next couple of days go, we may even be able to make the Train Control 2 deadline on Monday. This milestone - the last before the final project - requires groups to track the motion of two trains while preventing collisions.

Graphics front? Nothing for today. I'll be putting in a sprint tomorrow, which will hopefully furnish me with more flashy images to post here on qx5. I'm treating myself to a break this evening; given that I've been putting in 10-14 hour workdays every day including weekends this fortnight prior, such a well-needed pause could prove instrumental in averting catastrophic burnout.

(For the more observant reader: yes, the days-to-go counts over the last three posts have been inconsistent. This one is correct; I'm counting down to the Graphics project deadline. I'd wish myself good luck, but dtam says luck is for I'll wish myself good skill instead.)

Well, I'm off to go eat pizza and watch Bill Nye with our friendly neighbourhood CSC. Keep posted!

July 15, 2009


13 days to go (I missed one in my daily reporting - blasphemous!) Above: a quick mockup of Catmull-Clark subdivision surfaces on a cube. As you can see, the face normals are still slightly off; nevertheless, the general technique appears to be mostly working (although, as promised, the quads produced are predominantly non-coplanar.)

Why would I bother doing this? Simple - I'm going to make rocks! I'll start with a "random" cube formed by taking a point from each octant. Toss in a couple of Catmull-Clark iterations, perturb the face and edge vertices, and hopefully the end result will be vaguely boulder-esque. I'm also planning to implement stochastic OL-systems for trees and plants. (Trust me: although these sound impressive, they're actually quite easy to piece together.)

On the Real-Time front: we've finally discarded enough hubris to implement proper fail-fast error checking. We now panic on every buffer overflow and system call error with a very informative message detailing as much of the system state as possible. This approach - something that we should have implemented long ago! - has already located several serious issues. For each one we fix, two more pop up; nevertheless, not all hope is lost. If we can excise enough of these pesky critters by, say, four days before the project deadline, I still think we can cobble together a working demo.

Personal front: I've been aiming for a renewed adherence to my previous plan of proper sleep, decent nutrition, and exercise over the past three days. The result? My stress levels have plummeted, my mood has improved measurably, and I once more regard my projects as fascinating challenges rather than onerous obstacles.

July 12, 2009

Rude Interruptions

16 days to go. The increased I/O demands of sensor polling and interface updating have uncovered a heretofore hidden weakness in our Real-Time kernel - our UART communication routines are most definitely dropping characters. Fortunately, this sort of thing is comparatively easier to tackle than the obscure context switching snafus that dogged us earlier; I've already made some progress in re-enabling the FIFOs on UART1, which is used for communication with the train controller. I'm going through a quick I/O optimization sprint this morning (and early afternoon!) with the aim of improving this part to the point where we can reliably gather timing data from the track.

Personal notes: I currently have no life. I'm spending upwards of 10 hours a day either actively programming or thinking about programming, and my buttocks have become a quasi-permanent fixture in the Real-Time lab. I did manage to pop out briefly for a couple of pints on Friday, but only after putting in a solid day plus overtime. I've got a few forms that need to be filled out, a couple of unpaid parking tickets, an encroaching tide of facial hair, and piles of unwashed dishes in both kitchen sinks (though, to my credit, I am wearing freshly washed clothes.) And you know what? The experience is actually kind of fun, in a more-than-masochistic brain-grinding teeth-clenching sort of way. I'll be able to look back on this as the most intense month of undergrad CS at Waterloo. (I note wryly that Real-Time is listed on - "earning credits for playing around with trains, how easy is that!?")

So far, Real-Time is proving to be decidedly more involved than Graphics; the former provides much more potential for those delicious WTF moments that all hackers learn to simultaneously cherish and loathe. I still remember the first Real-Time assignment with an odd mixture of nostalgia and vomitous aversion. The busy-wait I/O libraries provided by the prof to help us down our well-intentioned path contained a fatal flaw: the baud rate divisors for UART1 were taken from the previous Intel architecture, and were therefore quite wrong. That was the first of many potent WTF moments - if you can't trust the provided starter code, what can you trust?

Anyways, I should probably get back to work. Keep posted!

July 11, 2009

Joseph and the Amazing Technicolor Terrain Patch

Now in colour! With semi-decent lighting! The random white patches are triangles pointed directly at the sun (or directional light, whichever you prefer); for this test render, I'm only calculating face normals and calling glNormal3d() once before each triangle. One way to get vertex normals is to average over the neighbouring face normals.

Topographically Speaking

17 days to go. As promised, I've hacked together heightmap functionality; this one is based off the diamond-square algorithm. Next up: lighting, texturing, keyboard and mouse interaction, and some kind of sky (I'll probably go with skybox for that one.) Real-Time is coming along, albeit not as quickly as I had hoped. We're now working out an issue with the sensor modules; either the modules don't always send the right number of bytes, or we're dropping bytes somewhere in our serial drivers. Either way, we've got to figure this out and reliably track the movements of a single train to within a few centimetres by Monday.

July 8, 2009

Voronoi the Paranoid Android

Above: a cellular-based texture, Worley-style. Still implementing cool textures for my procedural content generation project; so far, I've got a couple of noise basis functions along with a framework for combining them into more complex textures. Next up: terrain generation. This will involve a few steps:
  • Generate a heightmap. For a first pass rendering, midpoint displacement is dead easy to implement. Since heightmaps are textures, I can even slap this into my texture framework as another basis function (albeit one with a relatively heavy initialization time (although the midpoint values could be generated on demand!))
  • Set up the OpenGL window. We've been using gtkmm for previous assignments; I see no reason to break that trend, as I can save time by slapping our old window setup code into the project.
  • Issue OpenGL commands to render the heightmap. In its most basic form, this is just a series of GL_QUADS. If I was going after static rendering, I'd probably put the whole thing into a display list and use GL_QUAD_STRIPS instead; however, this will be interactive, so I'll need to do something smarter than shoving the whole terrain patch into a display list.
There are other considerations as well. For example, I might want to dynamically load blocks of terrain as the user walks around. Randomly generated terrain becomes a bit of a problem in this case - unless the blocks are "aware" of each other, there will be discontinuous jumps! I'll leave those problems for later.

15 Minutes of Fame

20 days to go, and it is with the utmost pride that I post the above image. What is it? Look closely in the upper-left corner and you'll see what looks like a timer reading just over 15 minutes.

That's right - yesterday around 9:30 pm, after four days of debugging, we posted this commit to the SVN repo. While we fixed several other glaring issues with our context switch during this marathon of frustration, this was the one to finally extirpate a nasty Heisenbug that all but stopped development on our Real-Time project. The above image is proof that, with this bug removed, our system can now run for 15 minutes without crashing - the same 15 minutes that will be required of us during our final project demonstrations. More importantly, this allows us to continue on with more interesting aspects - like figuring out how to reliably track the location of a train in the face of highly fallible hardware and malicious switch-flipping sensor-triggering TAs.

For me, this renews the confidence that I had called into question not four days ago. It's hard to stress the importance of this enough when you're up against a formidable challenge - and the combination of Graphics and Real-Time is most certainly that.

July 6, 2009


22 days to go, and I'm putting the finishing touches on my raytracer. Above: my sample image, which features implicit surfaces and adaptive anti-aliasing. (Technical details? Bounded Newton-Raphson iterations, gradients for normal vectors. Simple. I'm told regula-falsi is preferred; if I had another day, I'd pop that in there. As for the adaptive anti-aliasing, I'm applying a Sobel operator to the luminance values from the first pass and randomly supersampling pixels above a certain threshold.) Unfortunately, the images seem to suffer from a good deal of noise; in raytracing, this is a sign of numerical instability. If I was pursuing a raytracer-based final project, I would investigate further and fix it, probably along these lines of attack: 
  • The problem worsens with distance from the camera. This might be fixed by applying a projective transformation, but that would FUBAR angles for shadows and reflection.
  • Some of the mesh models have wonky normals; it might be worth the time to recalculate them to the outside.
  • I could probably eliminate a few spurious divisions and normalizations.
That said, I don't have time, so noisy images it is. Let's hope my final project is free of such trite errors!

July 5, 2009


23 days to go. After reflecting upon the virtues of getting proper amounts of sleep and not eating takeout Chinese or Pita Factory twice a day, I've decided that my approach to this month has to change. From now on, I'll be experimenting with a strict 11-7 sleep schedule. I've also stocked up on snacks of the apples-and-carrots variety, and I took some time aside last night to concoct container-loads of pasta e fagioli and salad. I'll also try to set some time aside in my daily breaks for exercise.

The hypothesis is that, if applied correctly, this will increase my general alertness and productivity. As a side effect, it will likely contribute to a more psychologically-balanced state. This seems obvious; I'd wager, however, that most students faced with crushing workloads panic and go the graveyard-shift route, a path which I had been following up until last night.

So - 23 days to go, and may each be better than the last!

July 4, 2009

Score and Four To Go

That's right - 24 days left. Current status:

Raytracer's almost finished. I just have to put a flag in to render bounding boxes, speed things up a little, and render a custom scene (unlike the one at top, which was provided by the TAs as a test.) I'll also put a bit more effort into stamping out numerical instability - especially for ray-polygon intersection - and I'll perform random supersampling to smooth things out a bit. Once I get that done, I can finally get back to my end-of-term project!

We've hit a snag in Real-Time land. System call parameters occasionally get corrupted, and it's somehow related to timer interrupts. (For full details, see here.) So far, the bug has proven itself to be highly resistant to our debugging efforts. Not all is lost, however; I'm planning to branch the repo, pare down the system to only those parts necessary to reproduce it, and tweak around until this thing is fixed. While it might cost us some short-term assignment marks, we still have time to rewrite the thing from scratch - and I'm fully prepared to do so in the absence of effective alternatives. (It's worth noting that at least one other group has followed this precipitous path!)

On a more personal note, this is the most demanding sustained workload I've ever faced. Until this month is over, weekends and holidays mean nothing to me. I'm holding up so far; the Real-Time bug brought me close to the breaking point, but I've since regained my self-confidence. The bottom line is this: I enjoy what I do. I like the challenge of it, the reward of writing something abstract to get a very concrete result. If I didn't, I would have ditched CS long ago for less silicon-encrusted pastures. If I have to remind myself of that when I'm chugging away another 10-hour stint in the Trains Lab, so be it. I'll make it through these 24 days one way or another - Evan will prevail!

That said, I'm always open to receiving words of encouragement, advice, or anything else positive.

July 2, 2009

Once More Unto the Breach, Dear Trains, Once More

26 days to go. It's approaching 10:30 pm (despite what the timestamp says!) and I'm currently tackling the last known problem in our kernel: interrupt-based terminal I/O. 12 hours to go before the due date - wish me luck!

July 1, 2009

T -27 days

One day in. I'm ahead of schedule so far - the next Theory of Computation assignment only took 2.5 hours instead of the 5 I had allotted. Today: History of Math and Real-Time sprints, with a dash of raytracing if time permits. If everything proceeds in similar fashion, I might actually be able to pull this off without all-nighters...

June 30, 2009

The Ultimate Showdown

So this is it - the final make-or-break stretch of my most demanding term at the University of Waterloo. Over the next 28 days, I will either successfully complete Real-Time and Graphics concurrently or consign myself to a pseudorandom location within the Bermuda Triangle of exhaustion, insanity, and despair trying. In typical fashion, I've done some preliminary number crunching: assuming roughly 8 hours of productive time per day - including weekends! - I have 224 hours in which to complete four Theory of Computation assignments, an essay about Church's approach to the Entscheidungsproblem, a raytracer, two more Real-Time train control milestones, one last midterm...and both my Real-Time and Graphics projects. I believe that this feat is tractable, albeit barely so - but time will be the judge of how well my wetware handles NP-complete scheduling problems!

The clock is ticking.

June 29, 2009

Following Procedure

What does three hours of work get you? A Mersenne Twister, the above image, and the revelation that, according to this book, Perlin is blissfully unaware of the finer points of Knuth shuffling. (This should not be construed as an attack on the rest of Perlin's work, which is responsible for much general awesomeness in subsequent cinematography.)

Graphics geeks will recognize this immediately; for the other 99.99% of humanity, it's an example of Perlin noise. This is the first intelligible thing to come out of my graphics term project, in which I plan to explore the exciting world of procedural generation. CG artists will commonly blend several instances of Perlin noise at different frequencies (16 pixels for my test image) to generate more complex textures. These textures are then applied to objects in the scene.

Why did I bother implementing a more complicated random number generator? Let me count the reasons:
  • The default implementation uses the full 32-bit integer range and provides an incredibly long period.
  • I now know exactly how my RNG works. (To be fair, I'm a bit fuzzy on the details of all those bit-shifts...but it feels good to roll your own!)
  • Python uses it since Python 2.3, which is a ringing endorsement in my books. (I'm told it has become something of a defacto standard.)
The bottom line is this: I'm going to be generating a lot of random numbers in the course of my project, so I might as well get a good (but still algorithmic - no /dev/urandom reads!) source of them.

Next up: I'll probably tackle Voronoi cell textures and attempt to actually texture-map a procedural texture in OpenGL. I'll also be continuing to post raytracer updates here, so keep posted! For information on the ever-changing state of my team's Real-Time Programming project, see the PsychOS blog.

June 22, 2009

Shady Business

Here's the same picture as before, with one important difference: the spheres look, well, spherical. Between dancing under the stars (and early-morning fog!) and class, I've somehow managed to find both the time and requisite sanity to implement Phong shading. Given libraries for vector operations, this is a relatively trivial task; nevertheless, it adds a whole new dimension (yeah, I couldn't resist) to rendered images. I'm also computing shadow rays to get the nice (albeit somewhat pixelated) shadows on the occluded parts of spheres. Next up: box and mesh intersections, supersampling, and hierarchical rendering. I'll keep posting progress images as I go along.

June 20, 2009

Here's Shooting a Ray at You, Kid

(Yes, I finally saw Casablanca a couple of weeks ago.) Exhibit A: the first meaningful image produced by my raytracer for CS 488 Assignment 4. It's a binary intersection image; it shoots a single ray from the eye through each pixel, rendering it white iff the ray intersects an object. I'll tackle Phong lighting next. For those outside the Graphics/CS bubble, Phong lighting is a relatively crude but efficient way to model the way light interacts with objects. As you can see from the Wikipedia page, it allows us to shade surfaces, thereby giving the impression of depth.

In general, raytracing is an attempt to model the way vision works. Production-quality raytracers will model reflection, refraction, transparency, scattered reflection from rough surfaces, and any number of other real-world phenomena to impart as much realism as possible to the final image. Maybe I'm strange, but I think that's cool - thanks to CS 488, I now have an appreciation for exactly how much programmer effort and CPU time go into, say, Pixar's rendering pipeline. (6-90 CPU-hours per frame, according to their site!)

One last note: although the raytracer project is by no means large, it's hefty enough that ad-hoc cp -r source control won't cut it. To that end, I've decided to give Git a spin. First impressions are positive: it's fast in all the ways that Subversion isn't, and it's ridiculously easy to set up over SSH.

June 17, 2009

On the Right Trackball

And here is the completed spherical Trogdor (of uniform density?) You might notice a circle drawn across his beautiful Phong-shaded polygons; that's part of a virtual trackball. Roughly speaking, this allows you to rotate the model as though the scene were contained in a sphere. (Also: that site uses a rather inefficient way to get the angle between the two projected vectors - can you think of a fast approximation?) Other user-interface goodies: you can select individual joints and rotate them, causing Trogdor to coil up or flex his shapely back-arm. You can also move Trogdor around.
Just remember: if you hear from me only sporadically this term, it's because I'm doing super-fantastic-awesome things like modelling Trogdor and driving model trains. All in the pursuit of higher education!

June 15, 2009

Burninate the Graphics Lab

It's CS 488 Assignment 3 time, which means I get to play around with hierarchical modelling - and what better way to do so than to construct the very likeness of Trogdor? (Yeah, it's a stretch. You try modelling anything with only transformed spheres.) BURNINATE!!!!!

June 4, 2009

Serial Experiments Lisp

I was watching Serial Experiments Lain when I noticed a certain LISP keyword scroll across the screen. A few posters have uploaded the still frame. Reminds me of the nmap cameo.

June 1, 2009

Data Abort

Found an interesting article, from which I'll pull two excerpts for comparison:

"White House officials now want to make government data sets available for citizens to use however they see fit."

"The problem is figuring out how to organize and display the data in a useful and informative way, instead of forcing people to sift through heaps of mind-numbing spreadsheets."

The first is a visionary statement. It amounts to crowdsourcing data analysis, something that (if applied correctly) could rescue our governments from the technophobic morass they have so willingly plunged into. At the same time, it would provide a spectacular resource for future machine learning research.

The second, if taken at face value, is facepalm-worthy. Why? If you want a gesture like this to be effective, you have to supply the raw data. Standard graphs and charts aren't enough; let us decide how we want to visualize your data. Let us rip your datasets apart with state-of-the-art statistical analyses and classification algorithms. Better yet - allow us to upload our homebrew visualizations, hold an online voting process, and host the best examples.

Imagine this simple gesture taken to its logical conclusion: complete data transparency of government actions. There would be no room for nepotism, pork-barrel spending, and other forms of shady backroom politics. We would finally have the power to inspect the inner workings of our government, much as our intelligence agencies now monitor us. After all, it is extremely improbable that the likes of CSIS and NSA will give up the incredible power offered by telecommunications, much as it is laughable to expect the world's nuclear powers to spontaneously and permanently renounce their missile stocks; the technology is there, the knowledge is there, and nothing short of the complete destruction of mankind will change that. The best we can do is to level the playing field.

This sort of talk immediately raises national security concerns. Should it? What if every citizen had the ability to assess national security threats, much as every Wikipedia user has the ability to stop malicious edits in their tracks? Which model, in the end, is more robust - the cathedral of centralized government, or the bazaar of direct democracy?

Enough ranting from me; I've got some projective geometry to tackle.

May 27, 2009

Thanks, Calendar

I'm not sure if I should be confused or flattered that Google thinks I speak all the above languages, despite the fairly clear linguistic limitations set up in my user settings. (Update: the problem was quite temporary; not 30 seconds later, everything appears in order.)
In other news: I've been spending an unhealthy amount of time in the Real-Time lab hacking away at an ARM context switch. As a result, our kernel now has a successful kernel exit along with a valid kernel entry point in the jump table. Unfortunately, all hell (well, 16 registers of hell, at least, plus or minus a few mode-specific versions of said registers) breaks loose upon re-entry; we're hoping to resolve this by today so that we can cap off this part of the kernel spec and get on with real life.

May 22, 2009

Real-Time Psychotics

I'm now gearing up to tackle the implementation of this specification for an embedded microkernel in the infamous Real-Time Programming course at the University of Waterloo. To share the masochism, our team has started the PsychOS blog. We'll be posting about our exploits - favourable, frustrating, pants-less, or otherwise - there, so keep posted! I'll try to mirror particularly poignant posts here at Quizzical Quincunx as well.

In other news, I've solved We Are The Swarm from Facebook's Engineering Puzzles site. This one is pleasantly devious; out of respect for the puzzle-solving spirit, I'll refrain from posting any hints. Enjoy!

May 16, 2009

Two Weeks And Still Alive

Okay. It's been a while since I last posted here. Some of you may know that I've applied more than a little masochism to my course selection this term - I'm taking Real-Time and Graphics, both of which are notorious for heavy project workloads. I've made it through the first Real-Time assignment shaken but still intact, and should be on track to get Graphics (Tetris + OpenGL == fun!) finished for Thursday. Point being: if you don't hear from me, I'm not dead; I'm just in the Real-Time lab cursing at model trains.

Aside from that:
  • I did make it out to see Star Trek, which was nothing special.
  • I'm almost finished reading through Zen and the Art of Motorcycle Maintenance, which presents a bizarre mix of quasi-autobiographical rambling, philosophical criticism of romantic-classic duality, and wanderlust. I'll reserve full judgment until I've reached the end.
  • The "official" Campus Rec parkour group (as if anything about parkour could truly be official!) has started up for the term. First meet was, er, wet.
  • I've signed up for the Bike and Hike - I think I'll opt for the 25 km bike.

May 7, 2009

AdSense + LaTeX = Fail

Point being: semantic analysis is hard. Simple keyword matching just doesn't cut it.

Death From Above

(Or this DFA - whichever you prefer.)

I'm writing this in the middle of an especially sluggish induction proof in CS 360. I've decided to make a few minor but hopefully positive changes in the way I approach class:
  • I'll try to make it to as many of them as possible - even those pesky 8:30 am ones that have marred my attendance track record in previous terms. (Not that anyone keeps track, but still...)
  • I'm keeping semi-rigorous notes for any lectures that don't have nice preformatted course slides available online.
  • I'm keeping those LaTeX.
The idea with the latter step is that having legible notes will encourage me to revisit them, a process that lies in stark contrast with my longstanding practice of keeping sporadic write-only notes. We'll see how that one goes. In either case, I'll endeavour to make the notes publicly available, thus driving a further spike in various efforts initiated by the University of Waterloo administration to lock up our course materials.

Final note: if you are concerned about the privatization of knowledge, I strongly urge you to do the same. Keep notes, make PDFs, and distribute like crazy. Help us bridge our ingenuity gap.

May 6, 2009

Waterloo Sunset

Work Term Reports - why?
The utter pointlessness is
Rather annoying.

(Decided I'd, er, borrow a motif from vasavage.) Spring is here in Waterloo - the sound of construction in the air, the cranes in full bloom! At least the ensuing fracas has contributed the above sign, redolent of the kind of neon-coloured cartoon-character Engrish prevalent in Japan, to our collective student consciousness. I've snapped a couple of pics of my room, as well as a few around campus; they're up in my nascent Waterloo album. As for me, I'm scrambling to get this work term report done so I can get on with life - for high-course-workload values of life, that is.

May 5, 2009

Retrospectively Yours

One more co-op term down, one to go. What have I learned? Since I don't have any similar record for previous co-op terms, I'll flesh that out as well:
  • Spring 2006: Rational Robot sucks, as does most "business intelligence" software. There's no way I'm doing testing again. Working with other co-op students is fun. Working in Waterloo during the summer is not.
  • Winter/Fall 2007: Startup culture is refreshingly dynamic and fast-paced. That said, the almost complete lack of process produces crap quickly. Pair programming works. Food is adequate compensation for late-night project stints. The Salad King chilli scale is a game you can't win. Concurrency is always harder than you think. It's important to contribute in meetings - if you can't, you're not preparing enough.
  • Spring 2008: Big-company culture is a living contradiction. Perks are awesome. Silicon Valley is a bubble world in all the best possible senses of the term. Testing is a crucial skill in software development. Reviews are a Good Thing, no matter how irate they make you at first. Sleep is optional. Do more better. Warm climates permit vibrant cities. Never rent a place before you meet the landlord.
  • Winter 2009: Optimizing without a profiler is like driving with a nightshade on. Optimizing with a profiler will surprise you. Testing is a crucial skill in software development. Do less better. Like everything, parkour requires dedication. Like everything, building a computer is surprisingly easy once you actually do it. Presentations are less nerve-wracking than most imagine. People respect your efforts to speak their language.
Naturally, these observations are somewhat abridged, and I've more than likely forgotten 90% of the salient (and/or salacious) tidbits. If you really want to know, you'll have to ask me in person...

May 4, 2009

Panic! At the 401

After an epic journey down the 401 involving 5-6 coffee cups worth of caffeine, 2 hospitals, 12 hours (7 or so of which were spent either in said hospitals or in an ambulance headed thereto), and 3 carpopedal spasms (these resulting from panic attacks, which in turn were most likely induced by the aforementioned dose of caffeine), I finally made it back up to Waterloo in one piece. I'm most definitely avoiding caffeinated beverages from now on...

On a more positive note, I'll be living here for the next four months. (That said, my decision to take the infamous Real-Time and Graphics project courses concurrently may very well minimize the time I get to spend in my new digs!) I've got a decent room setup which will only get better with a few key investments in hardware - pics to follow.

I'll post some kind of winter term retrospective in the near future; for now, however, I'm off to tackle some nagging errands.

April 30, 2009


The birds are singing, the sun is bright, the days are getting ever-longer - and I have to write another work term report. Ugh. Fortunately, a quick Google search brought up this. It's not the cleanest bit of LaTeX code, but it gets the job done! (Yes, I know I could use Word. I'll consider it next time I want to spend 90% of my time format-tweaking to obtain a layout that I can't easily reuse and share.)\

Also: the same search unearthed this (unfortunately nascent) effort to create a public repository of work report templates! Hooray for open source.

Little 5

(Not to be confused with Big5.) 5 hours of plane travel each way (despite the fact that a direct flight would probably take less than 2.) 5 pictures (four of airports and one of the best beer selection I've seen I forgot to take real pictures. Oops.) 5 ten-spots laid out for extended-stay parking at YOW. 5 pancakes shuttled down my gaping maw. (At least I think it was 5. Really, the pan-sized ones can count for anywhere between 2 and 3 - say, e pancakes.) 5 bottles/cans of beer partaken of in the weekend. Coincidence? I think so. Anyways, Little 5 weekend was an absolute blast - I'd write more about it, but that's already been done for me.

April 29, 2009

Nobles Paroles, Seigneur Gardakan!


A while back, I promised some basic regularity in my postings here. I've been somewhat lax with that, so here's the first in a rapid succession of updates covering my numerous activities this previous fortnight.

The weekend of April 17-19 brought me the inestimable bewilderment and pleasure of two lifetime firsts. It was my first visit to the beautiful bastion of historical import that is Quebec City. I only received a cursory overview of the city proper, however; the bulk of my weekend was spent engaging in the sort of faux-chicanery alluded to by the above snapshot. (I've got a few more here, among other random photos.) Yes - it was also my first time engaging in the bizarre yet alluring world of Live Action Role-Playing, which translates in French to the somewhat more poetic Grandeur Nature.

Imagine a weekend-long costume party where the attendees actually put in some effort, throw in some overtones of medieval fantasy, toss it all together with a heavy dose of guerilla theatre, and garnish lightly with pencil-and-paper role-playing geekdom. That gives some idea of the atmosphere here.

Of course, Imagika is one of the more politically-involved games out there, and so I spent much of my time randomly milling about while grasping desperately for some context as to how exactly a debate on slavery, a war against the descendants of dragons, the birth of a new god, a wayward monk whose teachings instilled madness, a roving band of necromantic cultists, and countless other subplots were connected. Owing to my status as a weak newcomer, I also spent a good deal of time faking death while awaiting the kindness of capable healers. Peu importe - it was still loads of fun, and I might even consider taking part in Waterloo By Night if my habitually overloaded schedule permits!

April 20, 2009

Speaking of Essential Research...'s a gem from the pen of Knuth.

Lights Out On Parliament Hill

For those who can read French: here. For those who can't, a brief summary:

As the Obama administration pours billions into scientific research, Harper and his cronies are busy slashing funding for "non-essential" research left and right in favour of programs that will net immediate jobs - this, shortly after announcing cuts in support for the arts. Between this and the appointment of a creationist as Minister of Science, it's evident that Harper is, er, heaven-bent on ensuring that we remain shackled by Bush-era ideals. Let's hope that the common sense of over 2000 of Canada's top scientists and researchers can sway the issue, and that subsequent governments have the foresight to protect Canada's position in the modern global economy.

April 16, 2009

Something To Chew On

To please certain of my readers, I furnish you with this bilingual gem from the hinterlands of Gatineau - enjoy.

Original Thug Life

Proof, if needed, that LaTeX is the shiv of academics worldwide. Now get outta my way before I get all Knuth on your ass.

(Oh, and bonus points if you get the reference in the comic/song.)

Safe Computing 101: Use LaTeX

I'm plunging into that dreaded final stretch of the work term, where everything is due concurrently and you suddenly realize you have approximately numeric_limits<int>::max() things to properly wrap up. Top of the end-of-term priority queue: give two presentations tomorrow morning explaining how exactly I spent the three months prior. Most people would reach for PowerPoint at this, er, juncture. I, however, am a CS student with a Tux-genuflecting, Redmond-execrating reputation to uphold, and therefore by socialization rendered immune to such manifestations of pure evil. I'm with these people on this one, and so I reach for something completely different: LaTeX with Prosper. As a result, I can nimbly sidestep the format-tweaking cruft of PowerPoint and cut to the meat of the matter - the content. Not only that, but my content becomes easily reusable if, say, I want to draft some papers. Even better, I can quickly render PDFs, PostScript, or whatever I want out of the LaTeX files, all the while remaining smugly assured that my presentation will work on pretty much any computer - for free. Try doing that with those arcane and proprietary MS formats.
Long story short: if you have an urge to use MS Office, there's usually a better way.

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.

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.

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?

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!

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.

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.

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.)
Overall, it's a positive first impression - most things work as they should, save for some minor gripes with plugins and general style.

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:

# 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!

Scripted Reality

As promised, here are the scripts.

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...)

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:

#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

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.

April 1, 2009

Oh, Google

In the grand annual tradition - enjoy.

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.)

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.