Everything I know about databases is wrong. Also, right.

June 24th, 2010, 12:48 pm UTC by Greg

I have been teaching CMPT 470 for six years now, with my 13th offering going on right now. Anybody doing that is going to pick up a thing or two about web systems.

I was there for the rise of the MVC frameworks and greeted them with open arms. I watched Web 2.0 proclaim “screw it, everything is JavaScript now” and listed with suspicion, but interest. I am currently watching HTML5/CSS3 develop with excitement but wondering why nobody is asking whether IE will support any of it before the sun burns out.

There’s another thing on the horizon that is causing me great confusion: NoSQL.

The NoSQL idea is basically that relational databases (MySQL, Oracle, MSSQL, etc.) are not the best solution to every problem, and that there is a lot more to the data-storage landscape. I can get behind that.

But then, the NoSQL aficionados keep talking. “Relational databases are slow” they say. “You should never JOIN.” “Relational databases can’t scale.” These things sound suspicious. Relational databases have a long history of being very good at their job: these are big assertions that should be accompanied by equally-big evidence.

So, I’m going to try to talk some of this through. Let’s start with the non-relational database types. (I’ll stick to the ones getting a lot of NoSQL-related attention.)

Key-value stores
(e.g. Cassandra, Memcachedb) A key-value store sounds simple enough: it’s a collection of keys (that you lookup with) and each key has an associated value (which is the data you want). For Memcachedb, that’s exactly what you get: keys (strings) and values (strings/binary blobs that you interpret to your whim).

Cassandra add another layer of indirection: each “value” can itself be a dictionary of key-value pairs. So, the “value” associated with the key “ggbaker” might be {"fname":"Greg", "mi":"G", "lname":"Baker"}. Each of those sub-key-values is called a “column”. So, the record “ggbaker” has a column with name “fname” and value “Greg” (with a timestamp). Each record can have whatever set of columns are appropriate.

Document stores
(e.g. CouchDB, MongoDB) The idea here is that each “row” of your data is basically a collection of key-value pairs. For example, one record might be {"fname":"Greg", "mi":"G", "lname":"Baker"}. Some other records might be missing the middle initial, or have a phone number added: there is no fixed schema, just rows storing properties. I choose to think of this as a “collection of JSON objects that you can query” (but of course the internal data format is probably not JSON).

Mongo has a useful SQL to Mongo chart that summarizes things nicely.

Tabular
(e.g. BigTable, Hbase) The big difference here seems to be that the tabular databases use a fixed schema. So, I have to declare ahead of time that I will have a “people” table and entries in there can have columns “fname”, “lname”, and “mi”. Not every column has to be filled for each row, but there’s a fixed set.

There are typically many of these “tables”, each with their own schema.

Summary: There’s a lot of similarity here. Things aren’t as different as I thought. In fact, the big common thread is certainly less-structured data (compared to the relational style of foreign keys and rigid data definition). Of course, I haven’t gotten into how you can actually query this data, but that’s a whole other thing.

Let’s see if I can summarize this (with Haskell-ish type notation, since that’s fresh in my head).

data Key,Data = String
memcacheDB :: Map Key Data
data CassandraRecord = Map Key (Data, Timestamp)
cassandraDB :: Map Key CassandraRecord

data JSON = Map Key (String | Number | … | JSON)
mongoDB,couchDB :: [JSON]

data Schema = [Key]
data BigTable = (Schema, [Map Key Data]) -- where only keys from Schema are allowed in the map
bigTableDB :: Map Key BigTable -- key here is table name

The documentation for these projects is generally somewhere between poor and non-existent: there are a lot of claims of speed and efficiency and how they are totally faster than MySQL. What’s in short supply are examples/descriptions of how to actually get things done. (For example, somewhere in my searching, I saw the phrase “for examples of usage, see the unit tests.”)

That’s a good start. Hopefully I can get back to this and say something else useful on the topic.

Computer Woes

June 10th, 2010, 10:32 am UTC by Greg

My computer at home has been locking up occasionally for the last few weeks. This has been happening since my upgrade to Ubuntu 10.04/Lucid, but I suspect this is a coincidence. (1) The lockups are hard: even the SysRq magic doesn’t do anything, so I deduce that the problem is in the kernel or below. (2) I haven’t seen any reports of the new Linux kernels being flaky. (3) I tried an upgrade from the i386 to amd46 (32-bit to 64-bit) system which I had been meaning to do anyway: no change even with a significantly different kernel.

Thus, I am of the opinion that I have a hardware problem.

As a computer scientist, I don’t enjoy hardware problems, so I’m thinking about buying my way out of them. (Also, my current system is mostly 3 years old, so it’s not a crazy time to upgrade.) My current thinking:

For about $700, that would leave me with the same case and power supply (an Antec Sonata II, 450W), my video card (nVidia 7600GT, but don’t game so who cares), my Hauppauge PCI TV tuner, and my recently-upgraded hard disks.

So, the questions for the crowd: Does my “it’s hardware” assessment sound right? Is it likely that the processor/mobo/RAM swap will fix my problems? Any other suggestions for hardware purchases?

Future epic culinary journeys?

June 3rd, 2010, 11:46 pm UTC by Kat

Now that me fried rice journey has ended, I find myself contemplating the next epic food journey. Having gone through one, I think I can handle another. The key is to only ask individual people, namely either my Aunt Daisy or my mom, very specific questions about whatever dish I am trying to make. I haven’t decided which dish will be next, but I thought I should write them down somewhere while they are fresh in my mind. So, here are some of the family dishes that I may want to try to make, and the person that I think knows how to make them:

My mom:
Pancit bihon, which is a Filipino rice noodle dish
Pancit sotanghon , which is more soupy than pancit bihon (I think) and made with a different type of noodle
Lumpia Shanghai (fried spring roll with meat in it)

My Ama:
Chow mein (I made this once with my Aunt Belen, so I think I can make it again, but I’m not totally sure)
Kiam pung (translation: salty rice), which is a form of fried rice that is brown (this one has soy sauce for sure!), and contains meat and sometimes hard-boiled eggs, and is flavored with spices like star anise and whole peppercorns. My Ama may have used adobo sauce from pork or chicken adobo to flavor the sauce. I think my Ama’s kiam pung is on the dry side compared to other people’s dishes (based on a Google image search of kiam pung). Also, it does not contain peanuts.
Fried meatballs

My Aunt Daisy:
Lumpia prito (fried vegetable spring rolls). She learned how to make these from my Ama. Learning from my aunt will be more straightforward. The only down-side of this dish is that it is deep fried. That’s a lot of work, and I’m not sure I’d ever really make it on my own because of that.

My Aunt Edna:
Kiam beh (translation: salty rice, but in congee-form). I loved my Ama’s kiam beh but I really don’t think I’d ever be able to learn that recipe from her. Luckily, my Aunt Edna has been making kiam beh for my Ama, and I had some last night. It’s close enough to my Ama’s (my mom’s version was good, but never quite the same), so I’m going to ask her to teach me how to make it. The linked picture of it has a recipe from a guy in Toronto. Maybe I’ll try his version and see if it tastes like my Ama’s! :)

The family in general:
Lumpia sariwa (fresh spring rolls). LOTS of work goes into making these. It’s more of a whole-family effort. I would just like to know the ratios of ingredients. I think that’s all I can really hope for.

That’s my list so far. Am I crazy for wanting to start what could be another soul-crushing experience?

How fried rice drove me insane (Part 3)

June 1st, 2010, 9:55 pm UTC by Kat

Following Saturday’s soul-crushing family conversation about my Ama’s fried rice, during which I was informed of additonal, never-before-mentioned fried rice ingredients and cooking techniques, I have to say that I was at my wit’s end. There may have been a few instances that I sat in a ball and ricked back and forth. However, Sunday was a new day, and I was determined to take another shot at the rice on Tuesday, for Pam’s dinner night. This way I would have another set of taste buds to either confirm or reject my latest attempt.

Sunday almost killed me. We decided to start at the T&T on 1st and Renfrew (or is it Rupert – anyways, one of the R-streets). After circling both the bottom and top parking lots a couple of times without any parking luck, we decided to try somewhere else. The nearby Superstore was our next stop. Ample parking, but we couldn’t find the Wing Wing Chinese sausage anywhere. After asking a few employees, we found other Chinese sausage, but no Wing Wing. What we failed to take into account was that Wing Wing sausage was on sale last weekend, so of course there wasn’t any left! I was starting to get a little nervous. I’ll admit that conspiracy theories involving my family, The Great Canadian Superstore corporation, and the company that owns T&T were going through my head. I believe at one point I may have accused Greg of being in on it too. He pointed out that he voluntarily went to Superstore on a Sunday with me to buy the sausage. I thought that was a little suspicious, but I let it go with a warning that I was watching him. We then went to Metrotown which had both a Superstore and a T&T – ended up buying the Wing Wings at T&T (my family would be appalled that I didn’t save the 10 cents at Superstore, but I didn’t think I could get Greg to go into 2 Superstores on a Sunday). Sausages: check!

To deal with the meat drippings, I marinaded a couple pieces of chicken on Sunday night. Thank goodness I knew my Ama’s marinade recipe – again, not so much a recipe, more like mix stuff together and keep tasting it until it tastes right. Meat marinading: check!

On Monday night I roasted the chicken and collected the drippings. The meat doesn’t actually go into the fried rice – just the drippings! Anyone need two cooked chicken breasts for anything? Meat drippings: check!

Since you need cold cooked rice to make the fried rice, I also cooked the rice on Monday night so that it would have a chance to sit in the fridge for Tuesday night’s main event. Rice cooked and cooled: check.

So today was the big day. I had all of the ingredients (at least all of the ingredients that my family has chosen to tell me about). I have to admit I was a little scared to start cooking. I was seriously going to lose it if this rice tasted nothing like my Ama’s. I would be okay if it wasn’t perfect – I was just hoping to get closer than I had before. Yes, not such a lofty goal, but keep in mind, I’ve been doing this for almost 6 years – no point in getting my hopes up too high. So I started with the sausages in a large pan. I needed to get them to release their oil so that I would have oil to cook the eggs and fry the rice. They were cooking, but they weren’t giving up any oil. I was starting to panic. Pam called my Ama’s house and we were told to prick the sausage. So I made them into pincushions. After a while there was enough oil to barely cover the pan (it was a big pan though), so we pulled the sausage and I poured out the oil, leaving enough to scramble the eggs. I had a good feeling about the dish when I smelled the reserved sausage oil, and it instantly reminded me of my Ama’s kitchen. As Pam sliced the sausage and cut up the eggs, I added the rest of the oil back into the pan and added the rice. It didn’t seem like enough oil to fry the rice, but I wasn’t going to give up hope. We added the cut-up sausage and egg back into the pan, seasoned with only a little bit of salt (I think the sausage oil was pretty salty) and only 1/2 a teaspoon of sugar and…

… after almost 6 years, I, with the help of Pam and Greg, had finally done it. I made my Ama’s fried rice! The dish that has eluded me for so many years has finally been conquered. I have to admit, I did do a little dance of joy.

In the end, the ingredient that I was missing was not something you could actually see. The pivotal ingredient was the oil from the Wing Wing Chinese sausage! Aunt Daisy said that if you use a different brand it doesn’t taste the same. I don’t know whether I believe that or not, but I’m not going to go out of my way to try it. My dislike of Chinese sausage had made it previously impossible for me to make her fried rice! I tried two slices of the sausage again today – *blech* I still don’t like it. So now whenever I make my Ama’s fried rice, Pam will be receiving cooked Chinese sausages.

As for the meat drippings, I figured my Ama probably used them when she didn’t have any sausage on hand, and therefore didn’t have any sausage oil. I made a second batch of rice with vegetable oil, some of the chicken drippings, rice, egg, salt and sugar. It tasted okay, but it wasn’t THE rice. It was actually closer in flavor to my fried rice and my Ama’s.

We decided that we’re going to make Ama’s fried rice again next week for dinner night. I will also make black (seaweed) soup to go with it, which was one of Ama’s staple soups. Pam and I are very excited. We called my Ama’s house to share the good news. My Aunt Daisy was happy and my Ama was too – especially when I said that I would go over and make some for her.

And so my epic fried rice journey has come to an end. I’m annoyed that it took this long, but in a way it’s probably for the best. I now fully appreciate this fried rice and will be extremely happy every time I make it. :)

How fried rice drove me insane (Part 2)

May 30th, 2010, 11:20 am UTC by Kat

My mom is in town, so Greg and I went to have dinner at my Ama’s house. Inevitably the conversation turned to food, which led me to ask about my Ama’s fried rice for the 100th time. This time there were more people around, and everyone had an opinion about what went into Ama’s fried rice and how it was prepared.

Me: My fried rice still doesn’t taste like Ama’s even though I added sugar.
Aunt X: Oh yeah, of course you have to add sugar!
Aunt Y: Ama adds a little bit of sugar to everything. Didn’t you know that?
Me: *eye twitch* No, nobody tells me these things!!!
Aunt Y: Did you scramble the eggs? Ama scambles eggs and adds them in.
Aunt Z: No she adds them in raw and then they cook with the rice.
Me: She’s done both. I know. I’ve asked and tried them both. I’m okay with the egg. I need to know what else I’m doing wrong.
Pam: When we added sugar it tasted more like Ama’s rice, but the flavor faded.
Aunt Y: Oh, it’s garlic! Did you add garlic?
Me: I used garlic powder. Did Ama use fresh garlic?
Aunt Y: Yes! Ama uses fresh garlic in everything. If you use fresh garlic the flavor won’t fade.
Me: Okay, I will use fresh garlic. (see phone conversation below)
Aunt X: It will taste good if you add adobo sauce.
Me: NO! Ama’s rice is very pale. There’s no adobo sauce!
Aunt X: But it would taste good with adobo sauce!
Me: *eye twitches*
My mom: When I make fried rice…
Me: NO! I know how to make your fried rice! My fried rice IS your fried rice! I want to make AMA’s fried rice!
My mom: I know how Ama makes her fried rice. I’ve cooked with her before.
Me: Then why does your fried rice taste totally different?
My mom: Mine is the simpler version.
Me: Okay, how does she make it?
My mom and aunts combined: You cook the sausage. Set it aside. Then you can use that oil from the sausage to scramble the egg. The you chop that up and add the garlic and rice. Then salt and soy sauce and sugar, and you add the sausage back.
Me: You’re sure there’s soy sauce? Ama’s rice was very, very pale!!
Them (without my Aunt Daisy, who had left the room): Yes, yes there’s soy sauce. It’s light soy sauce.
Me: I’ve tried that – even the smallest dash turned it very, very pale brown. Ama’s rice was never brownish. *eye twitch*
Them (without my Aunt Daisy): Yes! Yes! There’s soy sauce! (see phone conversation below)
Me: That’s it, then, that’s all of the ingredients. Nothing else?!?!
Them (without my Aunt Daisy): Yes, that’s it. It’s so easy.
Me: *eye twitch*

So by then I was willing to try it again. Fresh garlic and the oil from the sausages may be the key, I thought. I was still not convinced about the soy sauce. There was no freaking way that there was soy in there – the color would be all wrong.

Later that night, I was saying goodbye to my Ama:

Me: Bye Ama.
My Aunt Daisy: Wait, you know the liquid that comes off meat when you roast it? We collect that, skim off the fat, and then freeze it. Ama puts a bit of that in.
Me: INTO THE FRIED RICE?! *eye twitches*
My Aunt Daisy: Yes. That might be the flavor you’re missing. You know, the stuff you make gravy from.
Pam (who had just walked into the room): What gravy?
Me: *eye twitch* Ama adds roasted meat drippings – you know, the stuff you make gravy from.
Pam: TO FRIED RICE?!
Me: YES! *eye twitches*
Pam: Crap, we don’t have that!

The whole time my Ama is sitting there smiling all cute and nodding her head yes.

The drippings from roasted meats.  They may or may not be an essential ingredient of my Ama’s fried rice. I say may or may not because sometimes she puts it in, and sometimes she doesn’t. *eye twitch* Apparently my family does not want me to learn how to make this damned fried rice. After 5 years of being assured “yes you have all of the ingredients”, a couple of months ago I was told there was a little bit of sugar. Then from the above conversations that there is also fresh garlic. And now meat drippings!?! The problem: too many people think they know what is in the rice, and they don’t.

The entire way home, in between eye twitches, I must have been muttering “garlic”, “sugar”, “chicken juice?!” because Greg was laughing the entire drive home. Surely, this must be the end to the story, right? If you think that, you don’t know my family.

When I got home, I called my Ama’s house to ask what brand of Chinese sausage they buy (it’s Wing Wing). I’m not taking any chances this time. I have to roast a chicken to make this right – I’m not buying the wrong kind of sausage and have that be the problem!

Aunt Daisy (who had left the room when others said that my Ama used soy sauce and fresh garlic): You know, Ama never used garlic in her fried rice.
Me: Are you sure?!?! *eye twitch*
A. Daisy: Yes, the last few years that she made it, I was the one helping her make the fried rice.
Me: Okay, so no garlic at all?
A. Daisy: No garlic at all. But she did marinade the meat with garlic before she roasted it. You know the marinage recipe, right?
Me: YES! I do know the marinade recipe! She only has one, right?
A. Daisy: Yes, there’s only one marinade. Oh, and she never used soy sauce in her fried rice.
Me: YES! I knew it! Are you totally sure?
A. Daisy: Yes, there was never soy sauce.
Me: Okay, how much of the drippings? (for reference, my Ama often cooked for 10+ people daily, making enough food to have an additional leftover meal – for all 10 people!)
A. Daisy: I don’t know, a bit.
Me: *eye twitch* Okay, that’s fine. I’ll figure it out. So if I cook the sausage, use the sausage oil to scramble the eggs, chop up the eggs in the pan and then add the rice, “a bit” of the meat drippings, salt and sugar, and no soy sauce or garlic, I should get Ama’s fried rice?! *eye twitch* *eye twitch* *eye twitch*
A. Daisy: Maybe…

So today I have chicken defrosting in my fridge. I have to marinade it overnight in THE marinade. Tomorrow I will roast the chicken and collect the drippings and skim off the fat. I also have to go out and buy the sausage today (My Aunt Daisy phoned me back 30 minutes after the above phone conversation to say that they were on sale at Superstore this week for $3 something. My entire family knows all of the weekly grocery sale prices every single week, but they have no clue what goes into fried rice!!! *eye twitch*) On Tuesday Pam, Greg and I will try this again. Seriously, in the fall it’ll be 6 years. 6 years!!! *eye twitch*

The saga continues… *eye twitch* *eye twitch* *eye twitch* *eye twitch*

How fried rice drove me insane (Part 1)

May 29th, 2010, 10:32 pm UTC by Kat

For the last ~5+ years I have been attempting to make fried rice. Not just any fried rice though, my Ama’s fried rice. I have wonderful memories of visiting Vancouver in the summer and for Christmas and having my Ama’s fried rice for dinner, usually with an accompanying soup of some sort. The combination of my Ama’s fried rice and black (seaweed) soup would be one of my top picks for a “last meal”. My Ama is in a wheelchair now and doesn’t cook anymore. So, if I ever want to have this dish again, I figured I should learn how to make it. If you look at the fried rice, it looks pretty plain: slightly yellow rice, often with (but not always) thin slices of Chinese sausage. “How hard could it be?” I thought. 5 years later I am no closer to the correct recipe than I was when I started, and I now have the urge to kill my entire family.

To really understand my pain, we have to go back to the beginning of my epic rice journey. I started out making fried rice the way my mom makes it with oil, rice. egg, garlic powder and mixed frozen vegetables, and sometimes shrimp. My mom didn’t use the Chinese sausage because I don’t actually like it. When I took out the vegetables, it still didn’t taste the same as Ama’s rice (when there wasn’t any sausage in it). I figured I’d just ask my Ama, and she’d tell me how she made the rice, and all would be yummy. I didn’t asking her in the beginning because in the past she always said that she didn’t measure anything – she just cooked, so she couldn’t tell me how much of anything she put in. Fine. Whatever, just tell me WHAT is in it, and I can play around with it. At this point every family member pipes in with totally random things that my Ama may or may not have ever used in her fried rice at one point or another: egg, Chinese sausage, shrimp, pork, adobo sauce, soy sauce, salt, etc. etc. the list goes on. I tried to clarify that I just wanted the ingredients for her simple fried rice: the yellow rice with or without sausage – that’s it. It was like yelling into the wind. “You need shrimp!” “She used light soy sauce.” “She never used soy sauce, she only used salt.”

So, I went away and tried again on my own with no more knowledge that I had before. But whatever, I persevered. I learned to ask specific questions:

Me: Ama, did you use MSG, salt or soy sauce?
Ama: Yes.
Me: All three together?
Ama: No.
*silence*
Me: *deep breath* Which one?
Ama: I used to use MSG, but that was a long time ago.
Me: So recently did you use salt or soy sauce or both?
Ama: Yes.
Me: You used both together?
Ama: Yes.
Me: [thinking we're making progress] Okay, but how is it that your rice is really pale yellow? If I used soy sauce, my rice turns brown-ish.
Ama: I used light soy sauce.
Me: So did I. How much did you use?
Ama: *smiles*

I don’t think she used soy sauce. There’s no freaking way. Even the slightest dash of light soy sauce turns the rice a light brown. Damn you old woman!

Me: Okay, how about the egg.
Aunt X: She scrambles eggs and then cuts them up into small pieces and adds those to the rice.
Aunt Y: She adds raw egg to the rice and it cooks as the rice was frying.
Aunt X: You should add pork or shrimp. Do you have shrimp?
Aunt Z: Or adobo sauce! It tastes good with adobo sauce!
Me: No! I’m asking about eggs!! Ama, did you cook the egg with the rice or add cooked egg to the rice?
Ama: Yes.
Me: You’ve done both at different times or together?
Ama: I used to put it in raw, but then I started cooking it first and adding cooked egg to the rice.
Aunt X: Yes, adobo sauce is good.
Me: *eye twitches*

Now imagine 1-2 conversations like this every year, and you can begin to feel my pain. Honestly, I’m not sure how we’ve talked about this dish so many times and yet I still can’t seem to make it. It should be so simple: yellowish (from the egg) rice with or without small pieces of egg (yes, I remember both versions), without or without Chinese sausage! What the hell?!

Reality started to sink in a couple of months ago. My cousin Pam was over for dinner, and I was trying to make Ama’s f*$&ing fried rice. We called Ama’s house again, and had a conversation fairly similar to the ones above. After the fried rice was cooked, we called back and told them exactly what we put in.

Ama: You need to put in sugar.
Me and Pam: WHAT?! Sugar?!

My Ama puts a little bit of sugar in a lot of stuff, so I wasn’t that surprised. What was aggravating was the fact that nobody in the last 5 years ever bothered to mention the sugar.

Me and Pam: How much? We started with 3 cups of uncooked rice.
Ama: A little bit.
[For reference, my Ama used to cook for ~10 people every day and still had enough food for a leftover meal for all 10 people! We needed to know how much to scale this down.]
Me and Pam: A tablespoon?
Ama: No! Too much! Just a little.

We put in a pinch. Didn’t taste any different. We put in a tablespoon. It tasted a little more like what we remembered. YAY!

However, I was still doing something wrong because the addition of sugar, while making my fried rice better, didn’t make it my Ama’s fried rice.

The events of Saturday, May 29th, 2010, as they pertain to my epic fried rice journey will be Part 2 of “How fried rice drove me insane.”

How to not attend a lecture

May 28th, 2010, 12:06 am UTC by Greg

I teach at a university. That comes with certain parameters: most of my students are in their late teens or early twenties, the average student is reasonably bright but occasionally unmotivated, and I don’t really have any way to compel students to come to lectures.

I do my best to give interesting, informative, and entertaining lectures. I’m successful enough that most students come most of the time, and that’s awesome.

Sometimes students don’t come to lecture. They don’t need a good reason, and they don’t have to tell me about it. I’m okay with that too: part of being at university is being responsible about that kind of thing and I’m happy to assume that whatever reason they have is a good one.

But what really annoys me is when students feel the need to email me, tell me the stupid reason they didn’t come to lecture, and then ask me to tell them what I covered.

I already spent an hour (or three hours) of my time giving the lecture and they had an opportunity to attend. I put a great deal of time and effort into explaining the material in the best way I can and pointing out the things that I think are important. I did all of this because I think I can actually do a decent job of getting material across in the lecture format and I think the material I’m talking about is important.

These emails leave me with two choices: (1) reduce a carefully-prepared lecture to a pointless list of topics and thus implying that I might as well have read them the textbook, or (2) spending another hour repeating the lecture in email form. Neither one of those is very attractive, but there’s also the third option that I have started to avail myself of: telling the students to shove off.

I’ll say here what I said to my CMPT 165 class last semester: if you miss a lecture, you ask a friend in the class for their notes. If you don’t have a friend in the class, ask the person sitting beside you; if at all possible, try to do this when you are sitting beside someone who you find attractive and offer to buy them coffee in return.

Seriously… do I have to explain everything?

cf. entitlement generation.

CMPT 383: for real this time

April 19th, 2010, 6:09 pm UTC by Greg

I have mentioned here before that I was planning to teach CMPT 383. It ended up being a no-go this semester because of a very productive capstone project team (more on that later).

But, I’m on-deck to teach it in the summer. The class is full; the waiting list is full; must be time to plan a course. After much soul-searching, I have decided there will be three main topics in the course and they will be covered in this order:

Functional programming (and Haskell)

This will be most students’ first introduction to a non-imperative programming paradigm (and associated language). Every little while I think this won’t take long, then I remember the list of things that have to be introduced to get anywhere with Haskell: being really good at recursion, list comprehensions, lazy evaluation, type inference, higher-order functions, and other stuff to be discovered as I try to teach the language.

From my perspective, there are two reasons to be talking about functional programming. First, it’s finding some relevance, probably because people want to parallelize things (e.g. CouchDB). Second, there are important lessons from functional programming that can be transferred to OO programming.

“Language Features”

This section contains the big concepts of the course: type systems (static/dynamic, strong/weak, type coercion, duck-typing, late/early binding, …), interpreted vs compiled, pointers vs references, memory management, reflection, runtime environments, first-class functions, objects, exceptions, mutable/immutable objects, ….

The basic question here is: what are the real differences between the programming languages you have to choose from? How might they affect your choice of language for a project?

Logic programming (and Prolog)

As much as I am aware that Prolog is pretty much confined to old school AI researchers, I still think there’s some value in being exposed to logic programming. It should be possible to translate back to the OO world the idea of expressing a problem as a series of constraints and then looking to satisfy those constraints.

To be fair, this is the chunk I am most unsure of. Part of the reason it comes last is that if anything should fall off the end of a full semester, it’s this.

The exact balance of the topics remains to be seen. I’ll guess 5 weeks, 5 weeks, 3 weeks.

As for getting marks, I am as far as:

  • Lab exercises: weekly hour-or-two chances to practice the concrete skills.
  • Assignments: like… two of them? One Haskell, one Prolog?
  • Project: pick a somewhat obscure language from a list I provide. Explore it by writing a report and some programs with it.
  • A midterm and a final exam.

No idea what I’ll ask on the exams. Maybe Warren has some old ones I can look at.

So there it is. Unless I change my mind.

The History of HTML

March 19th, 2010, 8:46 am UTC by Greg

After a simple query from a colleague about the differences between HTML versions, I wrote this. I thought I might as well post it. Everything was from-memory, so there may be some minor errors.

HTML 1 never existed (it was the informal “standard” that the first documentation implied).

HTML 2 was a really minimal initial description of the language. The language was simple because the initial goals were simple. The browser makers made many de facto extensions to this by implementing random stuff.

HTML 3 was an abandoned attempt to standardize everything and the kitchen sink. HTML 3.2 was a really ugly standard that was basically “here’s what browsers accept today.”

Which brings us to modern history…

HTML 4 was an attempt to clean up the language: get rid of the visual stuff and make HTML a semantic markup language again. It included the transitional version (with most of the old ugly stuff) and strict version (as things should be).

HTML 4.01 was a minor change: missed errors and typos.

XHTML 1.0 is HTML 4.01 but with XML syntax: closing empty tags with the slash, everything lowercase, attribute values quotes, etc.

XHTML 1.1 contains some minor changes, but was abandoned in a practical sense because nobody saw any point to the change. XHTML 2.0 was another very ambitious change (non-backwards compatible changes to the language) that was abandoned.

HTML 5 is in-progress of being standardized now. If you ask me, there are two camps driving it. One who thinks “the web is more about more than just simple web pages now: applications and interactivity rule the day” and another who thinks “closing our tags is too hard; I don’t understand what a doctype is: make it easier. Dur.”

As a result, there are some things I like and some things I don’t. I is showing signs of something that will actually be completed and used (unlike HTML 3 and XHTML 2).

Most people don’t know that the HTML 5 standard includes an XHTML version as well. It will be perfectly legal to write HTML 5 with the XML syntax and call it “XHTML 5″.

Addendum: The moral of the story is that I have no intention of teaching HTML 5 anywhere until the standards process is done. For 165 I also need real browser support: no JS/DOM hack to get IE to work, and some defaults in the system stylesheet to let the thing display reasonably without any CSS applied. Even then I will probably teach XHTML 5 because I think it promotes the right habits.

Olympic Summary

March 1st, 2010, 3:24 pm UTC by Greg

I have avoided blogging throughout the Olympics because I just couldn’t figure out what to say. I still don’t know, but feel like I should write something. I have collected my Olympic pictures and will link as appropriate. (I have some pictures from last night that aren’t in there yet: give me a few hours.)

Here are my highlights…

Things we did

  • On the 16th, I slept in and Kat got up early to do the zipline. I wandered downtown at my leisure and sat down to watch the curling game (Martin v Norway) in Robson Square, right under the zipline tower. In the span of three minutes, Kelly zipped, Martin won the game, and Kat and Pam zipped.

    There are pictures from the zipline. Be sure to notice the movies Kat took.

  • Later that day, we went to the Mint pavilion. As much as I can’t believe I’m saying it, it was totally worth waiting for three hours.

    The Olympic medals are fundamentally just a pound of metal, but they just feel different: special and important. We don’t have many pictures from that because I mostly spent my time rolling the thing around in my hand and staring at it.

  • On the second day of the Colbert report, we went around behind the stage (based on Kat’s discovery the day before). Everybody who went on or off the stage walked within 10 feet of where we were. Pam got a signed picture.
  • Nico and Allison came to visit for a couple of days, which was great. We ran into Meredith Vieira from the View. That was exciting once Kat and Allison explained to Nico and I who that was. Also, we made pretzels.
  • We saw two women’s curling matches: the semi-finals (Canada over Switzerland and China over Sweden) and the bronze medal match (China over Switzerland). So, we saw the Chinese women win the bronze: they were obviously very excited and I got some good pictures of them celebrating (thanks to the Chinese photographer who called them over to our side of of the rink).

The Games

  • Jon Montgomery’s triumphant march through Whistler. I think this is my favourite moment of the games because it’s obvious to me that he would have done the same thing if he had come in 2nd or 6th. There might not have been a camera crew, and one of his friends would have gotten him a beer instead of some random girl handing him a pitcher, but he would have been there either way.
  • Marianne St-Gelais’ reaction to Charles Hamelin’s 500m gold. I particularly like it when she lost the coordination to jump up and down and switched to running in place.
  • Scott Moir: “We’re second… no just kidding: first!”
  • Kevin Martin’s curling gold and Cheryl Bernard’s ulcer-inducing silver.

    Kevin Martin’s dominance in this sport really cannot be overstated. If we count the biggest competitions in the sport in the last year (Brier, Canadian Olympic qualifiers, World Championships, and Olympics), Martin has lost 3 games out of 40. In a sport where a couple of missed shots can swing the game in your opponent’s favour, that’s stunning.

  • William-goddamn-Shatner in the closing ceremonies. “I’m Bill and I’m proud to be Canadian”. Really, is there anyone more full of awesome than Shatner?

I will point out that my top two there (Montgomery and St-Gelais) were the result of CTV putting a camera pointing in just the right (non-obvious) direction at the right moment. Kudos to them on solidly good coverage.

« Previous Entries