I’m back, baby!

September 14th, 2009, 10:12 pm PDT by Greg

I woke up last Tuesday to the cold realization that my study leave was over: there was no choice but to admit that I was back at work. My first lectures were Wednesday: one hour of CMPT 165 and three of CMPT 470.

After the 165 lecture, Diana stuck her head into my office. She hadn’t been teaching in the summer semester, so she was also coming back to teaching. “Did you have your first lecture yet? Were you… excited?” Apparently she was so excited to get back to teaching that she was a little befuddled in her first lecture. This is why I love Diana.

I don’t know that I was particularly excited before my lectures, but now that I’ve done a full week, I’m feeling good about being back.

There’s something about being in front of a lecture room that feels right, especially with 165 and 470. Those courses are really the equivalent of comfort food for me and I think I’m going to have fun this semester.

So, I guess a year of study leave really does help one’s attitude. At least for the first week.

Anybody want a desk?

September 5th, 2009, 9:34 pm PDT by Greg

As a result of watching Hoarders and an ongoing effort to clean up our office (which has never been quite right since we moved in), we have a desk to get rid of:

desk closed desk open

It’s an Ikea corner-unit desk that folds open/closed. It actually holds a fair amount of stuff. It just doesn’t fit right into our office, so it’s time to let it go.

Free, but we have no vehicle to move it, so once it’s down the elevator here, it’s your problem.

Wikipedia Anti-Hate

August 26th, 2009, 10:31 pm PDT by Greg

There has been a bunch of bad noise about Wikipedia on the tubes recently and it’s annoying me.

First, there was a study about Wikipedia growth slowing. Basically, the rate of new article creation has slowed and one-off editors are more likely to have their edits reverted.

Secondly, Wikipedia is adding a new level of editorial oversight for biographies of living people. This amounts to turning on flagged revisions for those articles: basically, non-logged-in users only see “flagged” edits that have been approved by “trusted editor” (i.e. not worth reverting).

Both of these caused a lot of consternation: Wikipedia is over the hill, Wikipedia is becoming elitist, etc. I made the mistake of reading slashdot comments on the second issue and regreted it.

Seriously? Can you look closely at the English Wikipedia and come to the conclusion that it’s dying?

Try clicking “random article” in Wikipedia a few times. Can you really say that the number of new articles shouldn’t be slowing down? Many of the articles are pretty dicey on the notability criteria. There is simply a finite number of “notable” topics that need to be written about: I’d say that English Wikipedia is closing in on that number. There will always be gaps, but they’re getting hard to find.

I have done a moderate amount of Wikipedia editing: about 200 edits across Wikimedia sites. In looking at the history of pages, I’ve never seen an edit that has been unjustly reverted. (Although I do tend to stay away from controversial pages.) Most of the reversions I have seen are of the quality “my high school principal is teh gay”. Again, I’m sure there are problems and edit wars, but they are definitely not the majority.

As for “flagged revisions”, I think it’s a great solution to the vandalism problem. Logged in users and editors will always see the most recent revisions, only anonymous viewers will see the “flagged” versions. The criteria for flagging seems to be “not worth reverting”, so that’s pretty minimal. I’d feel better if there was a better definition of “trusted editor” who can flag a revision, but assuming there is a sufficient set of people doing the flagging, it should work well.

So why the hate? My theory is that all of these people have written long articles about their totally awesome band, but had the page deleted for not being notable. Or maybe their high school principal really is teh gay, and they feel they are being censored.

DDP Kayaking

August 17th, 2009, 12:40 pm PDT by Greg

A while ago, Ted and I had the brainwave to take some of the DDP kids kayaking. (If you don’t know what DDP is, just think “Chinese exchange students” and you’ll be close enough to follow along.)

So yesterday, we showed up at Rocky Point with something like 28 students, approximately 27 of whom had just seen a kayak for the first time that day, and certainly never been in one. Try to picture me, Ted, and two guys from the kayak rental place trying to quickly explain “hold the paddle like this; that end is the front; sit in it; go!”

I re-learned that Chinese people don’t have a keenly developed sense of “let’s get together and do this activity as a group.” This, along with the baseline inability to control a kayak on your first time out, meant that getting the group to all head in one direction to get somewhere was hopeless.

More than anything, I wish I could get time-lapse video of the bay we were in for those two hours. It would have looked like Brownian motion. As a group, I think we went maybe 500 metres in the whole time. Ted and I each paddled miles in a futile effort to sheepdog the group.

There were two students who tipped out of their kayaks during the day, which is probably pretty good all things considered. It’s a good thing Ted was there: I have never done a deep water kayak rescue. (But I could do a deep water canoe-over-canoe rescue with my eyes closed.) It turns out the principles are the same: empty the boat, bring it alongside you for stability, and get the person to kick-and-pull their way up out of the water.

For the second rescue, I was alongside Ted. (My kayak, then Ted’s, then the empty one, and the student in the water on the far side.) The kick-and-pull out of the water wasn’t going so well. (It takes either a strong swimmer or a lot of upper-body strength.)

I learned everything I know about patience from my father. So, while the student was kicking, I grabbed him by the life jacket, hauled him up (hard enough that he made a little squawking noise), and deposited him face down into Ted’s lap. Hey, the goal was to get him out of the water, and I achieved the goal, right? And, once he found himself laying across Ted’s lap, he was pretty quick to hop back into his kayak too, so it was efficient all-around.

I hope the students had a good time: I suspect they would have told me they did no matter what. I was in the water in a small boat, so I had a blast.

Edit: It should be pointed out that I wasn’t aiming for Ted’s lap; that’s just how it played out. Overall the day was a lot of fun, and I’d do it again next weekend if everybody else wanted to go too.

Lightning

July 25th, 2009, 9:41 pm PDT by Greg

While the aforementioned ice cream sandwiches were being made, this is what was going on outside:

Lightning Big lightning Lightning

Click the thumbnails for the full images. I managed to get some nice pictures with a tripod, one second exposures, and some persistence. As the storm passed and the sun set, this happened:

sunset

Edit 07/26: Katkam (no relation) pwned me due to vantage point: sunset, fireworks.

Custom classes in Docbook to HTML conversion

July 16th, 2009, 8:55 am PDT by Greg

Maybe I should have a tag for “boring technical notes that I’m writing so others can Google them later”.

Anyway… if you’re converting a Docbook document to HTML, and want customized classes on elements (so you can hit them with CSS), first create a custom XSL style for the document (and use with xmlto -m).

Then suppose you have <code language="html"> in the Docbook and want that to have classes html and xml to hold on to in the resulting HTML. Add this:

<xsl:template match="code[@language = 'html']" mode="class.value">
html xml
</xsl:template>

The match can be any XSL matching pattern. The contents can also be a <xsl:value-of> if you want to do something more advanced.

Maybe it’s because I’m an XSL newb, but I haven’t seen this explained nicely anywhere else.

CMPT 383, or “Why I Hate Ted”

July 7th, 2009, 1:56 pm PDT by Greg

As many of you know, one of the goals for my study leave has been to prepare to teach CMPT 383, Comparative Programming Languages. The calendar says this course is:

Various concepts and principles underlying the design and use of modern programming languages are considered in the context of procedural, object-oriented, functional and logic programming languages. Topics include data and control structuring constructs, facilities for modularity and data abstraction, polymorphism, syntax, and formal semantics.

I took a similar course in my undergrad, and I think it was really useful in helping me see the broader picture of what programming is.

I have been thinking about the course off-and-on for more than a year. I had been forming a pretty solid picture of what the course I teach would look like and things were going well, despite never having devoted any specific time to it or really writing anything down.

Then I talked to Ted. Ted has taught the course before, and has thought a lot about it. His thoughts on the course differed from mine. In particular, he opined that “logic programming is dead, so why teach it?” (Okay, maybe that’s not a direct quote, but that’s what I heard.) So that leaves functional programming as the only new paradigm worth talking about.

He also convinced me that covering too many languages in the single course puts students into a situation of too many trees, not enough forest. (That is, they get lost in syntax and don’t appreciate the core differences between languages.)

Basically Ted did the most annoying thing in the world: he disagreed with me and he was right.

But, there is a lot of stuff that I hadn’t considered before, but might be worth talking about:

  • Type systems: static/dynamic, strong/weak, built-in data types, OO (or not), type inference, etc.
  • Execution/compilation environment: native code generation, JIT compilers, virtual machines, language translation (e.g. Alice → Java → execution), etc.

So, what the hell do I do with all of that? Any ideas how to put all of that together into a coherent course that students can actually enjoy?

Wikipedia-based Machine Translation

July 1st, 2009, 12:07 am PDT by Greg

I have been pondering this for a while and thought I might as well throw it in a blog entry…

Wikipedia is, of course, a massive collection of mostly-correct information. The information there isn’t fundamentally designed to be machine readable (unlike the semantic web stuff), but there are some structures that allow data to be extracted automatically. My favourite example is the {{coord}} template allowing the Wikipedia layer in Google Earth.

The part of Wikipedia pages that recently caught my eye is the “other languages” section on the left of every page. I’d be willing to bet that these interwiki links form the largest translation database that exists anywhere.

Take the entry for “Lithography” entry as a moderately-obscure example. On the left of that page, we can read off that the German word for lithography is “Lithografie”, the Urdu word is “سنگی طباعت”, and 34 others. Sure, some of the words might literally be “lithograph” or “photolithography”, but that’s not the worst thing ever. All of this can be mechanically discovered by parsing the wikitext.

Should it not be possible to do some good machine translation starting with that huge dictionary? Admittedly, I know approximately nothing about machine translation. I know there are still gobs of problems when it comes to grammar and ambiguity, but a good dictionary of word and phrase translations has to count for something. The “disambiguation” pages could probably help with the ambiguity problem too.

I’d guess that even this would produce a readable translation: (1) chunk source text into the longest possible page titles (e.g. look at “spontaneous combustion”, not “spontaneous” and “combustion” separately), (2) apply whatever grammar-translation rules you have lying around, (3) literally translate each chunk with the Wikipedia “other language” article titles, and (4) if there’s no “other language” title, fall back to any other algorithm.

I can’t believe this is a new idea, but a half-hearted search in Google and CiteSeer turned up nothing. Now it’s off my chest. Anybody who knows anything about machine translation should feel free to tell me why I’m wrong.

Trifle Recipe

June 10th, 2009, 4:09 pm PDT by Greg

The trifle that I regularly make is always a big hit. This is particularly joyous because it’s not very hard to make. The recipe is from the (annoyingly, out-of-print) New Canadian Basics cookbook, with a few mods by me. If you find a copy of Basics, buy it and live by it.

We served it at our open house and I posted a vague recipe then. Daniela wanted me to be more explicit, so…

Trifle

This makes a big party-sized bowl.

  • 2 pound cakes (or similar cakes from grocery store) cut into 1″ cubes
  • 1 C fruit coulis (recipe below)
  • 6 C fruit pieces (berries, peaches, mango,… whatever is available. Use canned/frozen if you must.)
  • 6 C custard sauce (recipe below)
  • 2 C whipping cream
  1. Make the other recipes below. They need to cool, so leave some time. (I usually do them the day before.) Eat a few handfuls of the cake pieces while you’re getting stuff together.
  2. For the first layers, use about a third of each: cake pieces, fruit coulis, fruit pieces, custard.
  3. For the next layers, repeat step 1 twice more, using the rest of each ingredient. Cover and refrigerate for 4–8 hours.
  4. Whip cream and spread on top. Garnish with some berries.

Fruit Coulis

This makes more than the trifle needs, but there’s nothing wrong with having some berry sauce in the fridge. Reasonable substitution: decent berry jam thinned with a little fruit juice or sherry.

  • 1 kg bag of frozen fruit (mixed fruit or mixed berries)
  • water
  • sugar
  • cornstarch
  • 1/4 C sherry (optional)
  1. Put 1/4 C of water and 1 tbsp of cornstarch in a jar/tupperware. Shake to combine. (Goal: no cornstarch lumps.)
  2. Combine 1/4 C water, 1/4 C sugar, and the berries in a saucepan. Cook over medium heat, stirring occasionally.
  3. When the berries have started to cook, add half of the cornstarch mixture and stir. Make sure the mixture boils to cook the cornstarch.
  4. Look and taste. Add more cornstarch mixture if it needs to be thicker; sugar to taste; cook longer if there are too many berry chunks.
  5. Turn off heat and stir in sherry.

Custard Sauce

Makes about 6 cups. You could probably substitute 6 cups of custard made with a custard powder, but I have never tried.

  • 3/4 C sugar
  • 6 tbsp (=3/8 C) cornstarch
  • 4 1/2 C milk
  • 6 eggs
  • 1 tbsp vanilla
  1. In a big microwavable bowl, combine the sugar, cornstarch, and milk. Whisk to combine.
  2. Microwave on high for 3 minutes. Whisk to combine and break up any lumps. Repeat until it thickens. (It will boil a bit: covering the bowl saves cleanup.)
  3. In a smaller bowl, beat the eggs. Whisk in a little of the hot mixture. (You’re preventing egg lumps here: add hot mixture to eggs slowly while whisking, until you have added about as much mixture as you had eggs originally.)
  4. Microwave for a few more minutes. Stop and whisk every minute or so. Continue until the whole thing has cooked (thickened and maybe boiled a bit).
  5. Add the vanilla.

Alaska Summary

June 1st, 2009, 11:43 pm PDT by Greg

We’re back from the Alaska cruise. We didn’t blog daily like China since it was a lot more sedate. Here’s the rundown:

I put pictures of the cruise up if you want to see it. There’s some good stuff in there. Again, many of the pictures are geotagged, so you can click the Google Earth/Maps link on the left of the gallery.

I wasn’t expecting wild excitement on an Alaska cruise with Holland America (which has an older demographic). But, I was looking forward to the downtime and being bored, so that was just fine with me.

That kind of worked out, but I spent a lot of time being dragged around by Kat to events on the boat. Kat decided to collect ship bucks that could later be redeemed for swag. That meant participating in (for example) several Name-That-Tune games which consisted entirely of music for the Holland America demographic which we didn’t know.

The shore days were a little depressing. The three cities we went to seemed to only exist for the purpose of providing cruise ships somewhere to dock and their passengers to buy crappy souvenirs. (That’s probably not entirely true, but from what a cruise ship passenger sees, that’s what it looks like.) Ketchikan was my favourite: it felt the least artificial.

That’s not much of a summary of a week of travel, but short of describing every day in excruciating detail, I’m going to stop. Kat probably has more highlights that she can blog about all by herself.

« Previous Entries   Next Entries »