Superfluous Matter
Random C++ Fact

I thought I would mention a random C++ programming thinger I came across at work the other day. If you don't work with C++ or don't care about programming you probably want to stop reading now.

Let's say you have a base class, A, which overloads the method "foo" in several ways, like this:

class A
{
public:
    A();
    virtual ~A();

    void foo(int a);
    void foo(int a, int b);
};

Further suppose you have a class B which derives from A, and you'd like to overload "foo" in a new way in the derived class, but also maintain the implementations of the base class A, like this:

class B : public A
{
public:
    B();
    virtual ~B();

    void foo(int a, int b, float c);
};

Due to the way C++ does name resolution, the definition of "foo" in B actually hides the other definitions from A. So if you do this:

B* b = new B();
b->foo(3);

the compiler will fail because it can't find a matching method for foo(int). The problem is that as the compiler walks up the class hierarchy looking for a match for "foo" it will stop at the first class that defines a method with the name "foo" regardless of whether or not there is a suitable match for the specified parameters.

I've actually read about this name resolution rule before, but I never thought about it in this context and so I spent a frustrating half hour trying to figure out why my code wouldn't compile. There are several ways to get around the behaviour. You can redefine the methods of A in B, or you can add a "using" statement to the class definition of B, like this:

class B : public A
{
public:
    B();
    virtual ~B();

    using A::foo;
    void foo(int a, int b, float c);
};

It's important to add the "using" statement before any new definitions of "foo" though.

Anyway, this learning experience turned out to be not immediately applicable because I ended up having to write the code in an entirely different manner anyway. I'm blogging about it so that the experience wasn't a complete loss. Also, this blog post is the first use of the a new feature I just added to my blog to show code in a blog post. Good times!

World Nutella Day!

Today is World Nutella Day and holy crap that's awesome!!! Well Nutella is awesome at least. I eat it on crackers, bread, crepes or just straight out of the jar. Also, for people selling food items, adding the word Nutella to the name of the food is a good way to get me to buy it. Anyway, I'll have to have a bunch tonight in celebration. I'm thinking of heating some up slightly so it gets runny and then drizzling it over some of the Ben & Jerry's "Half-Baked" ice cream I have sitting in my freezer. MMMMMM!!!

Short Update

Well, things can certainly change at work. Not for me apparently but for lots of other people I work with.

Last weekend as full! Like there was no more stuff I could have done because I used up all of the non-asleep time. Friday night was dinner at Weezies for Patrick's birthday (mmm...delicious) followed by looking at Patrick's Iceland photos. Saturday I did some chores in the morning including making my muesli, and then Kim and I went to see the classic Euripides play Medea at the Canon theatre. It was pretty good, but as it was a tragedy it didn't exactly have a happy ending. After the play we headed to Chris's house where he and John made us homemade pizza and then we watched the Bourne Ultimatum on BluRay. Sunday I helped Patrick and Toni for the whole day with their wedding website. It was fun, and it taught me a lot of stuff about Ireland, but it was also a very long day.

In climbing news, I'm finally lead climbing again on Wednesdays. I've been pretty lazy the last few months and just doing plain top-rope. But someone at the gym told me that every time you top-rope something you could have lead, God kills a kitten.

Bouldering Competition Photos

A couple people brought cameras to the comp last Saturday, so I have some pictures of me climbing and stuff. The first shows one of the main walls at the comp with a bunch of bouldering problems on it. Problems are marked by different colours of tape and the start and end are marked with boxes. The second photo show me on one the start of problem number 19, which is about midway through the range.

The last two photos show me on problem 22, which was a really fun unique problem that I was super happy to solve. It started with a running jump to get up to the big orange blobby hold and followed by a set of long reaches to more hand holds. It was a lot of fun!

One of the walls at the gym filled with problems
One of the walls at the gym filled with problems
Me on a bouldering problem
Me on a bouldering problem
Me on the start of a bouldering problem
Me on the start of a bouldering problem
Me slightly further along on a bouldering problem
Me slightly further along on a bouldering problem
Stuff and Things

Things have been fairly busy so far this year and I'm sleepy as a result of that. There has already been wedding planning (the date will be October 10, the Saturday of Thanksgiving weekend) and I had another bouldering competition Saturday. This one was a at a new gym at Lansdowne and Dupont and it went really well. I hurt lots today which means that I worked appropriately hard.

I've also been playing "The Force Unleashed" for the Wii and I thoroughly enjoy it. Basically you're Darth Vader's new apprentice and you run around using the Force for evil (mostly). My only criticism is that it's very easy to beat the game in under ten hours. Does that seem short to anyone else? You have the option to play through again with all of your accumulated powers (which I am doing), but other than that and the two-player duel mode there just isn't that much stuff in the game. I can't imagine putting in all the effort to create the game's framework and to interface with the Wii's unique controller system and then not generate lots of content to go with it.

I also played with the Google Maps API a bit last night to answer some questions for Patrick and his upcoming wedding. It was pretty cool and easy to use. You can do a lot more to a map than I thought you could, including custom overlay drawing. Fun times!

Finally, I left my camera battery charger at my mom's house over Christmas and it's making me sad because I can't take pictures. I need to rectify this situation.

Holiday Marathon

Well, other than eating all of the chocolate I received, the holidays are over. I had a good time at all of my events as usual, but also as usual there were too many of them all in a row. I averaged two Christmases a day for four days straight and then more random stuff until New Years.

The biggest news from the break (and possibly my biggest news ever) is that on the Saturday before Christmas, Kim and I got engaged!

Anyway, here are some pictures from the last couple of weeks.

Patrick...number 4 in the Secret Santa game at the Chili cookoff
Patrick...number 4 in the Secret Santa game at the Chili cookoff
Celebratory champagne served by Patrick, post wedding proposal
Celebratory champagne served by Patrick, post wedding proposal
My reflection in a Christmas ball on my mom's tree
My reflection in a Christmas ball on my mom's tree
Flower
Flower
Christmas candle
Christmas candle
Kim at the Eaton's Centre
Kim at the Eaton's Centre
Mike at Swiss Chalet
Mike at Swiss Chalet
New Year's sausage destined to be currywurst
New Year's sausage destined to be currywurst
Christmas == Busy

We're halfway through December and I've already been to three Christmas parties, with another to go to tomorrow. It's lots of fun, but I get too stressed when there is this much stuff all close together. I still have Christmas shopping to do and many places to go. I will have two weeks off this Christmas though so that is nice.

The first party of the year was the CIBC Christmas party with Kim. It was held at the Convention Centre and was attended by something like 5000 people. It was pretty insane. The meal was decent (as much as it could be when it had to happen for 5000 people simultaneously), and there was wine on every table and one free drink ticket for everyone. They also had impersonators of famous musicians including Neil Diamond, Elvis, and Abba. It was definitely an experience.

Next up was the NeoEdge Christmas party, which, although I still don't work there, I have attended every year for the past three years on account of being friends with half of the employees. This year Kim and I were bartenders and it was lots of fun. I got to make up drinks that made people make bad faces.

Finally, there was my party, the Autodesk Christmas party. This one definitely had the best food and drink (real bartenders, open bar), but unfortunately it also had the poorest food distribution system (some people waited for more than an hour). It was a nice venue though and for the first time in a long time we were allowed to bring a guest.

Tomorrow is party number four, the annual wing night Christmas party. This year it's a Chili Cookoff and I'm gonna win. My chili is obviously the best.

After that there's just seven more Christmas events, a New Year's party and then I can relax until next year.

iMenorah

I'd just like to take a brief moment to mention my friend Mike's new iPhone application, iMenorah! It's the perfect app for anyone celebrating Chanukah far from home.

I don't own an iPhone, and I'm not Jewish, but I tried it out on a friend's iPhone and it was really well done. Good interactivity, well polished graphics and animation, and Mike singing the blessings at the end is just classic. Oh, and they are donating some of the proceeds from sales to a San Francisco Jewish charity.

For $1.99 it's a great deal.

Politics

I know I'm a bit late blogging about this, but some crazy stuff happened recently in Canadian politics! And by crazy I mean, "wow, a lot of people are really dumb."

I can't say I supported anybody in the craziness that was last week and I think the fact that parliament was prorogued was probably the best possible outcome. It should give everybody some time to come to their senses. Of course the best case would be everyone working together but that clearly wasn't going to happen.

Seriously, what did Stephen Harper expect the other parties to do when he introduced that economic update? Hello! You don't have a majority government! That means you need to avoid completely pissing off everyone else. I mean he could have at least tried to work with them a little bit.

Next problem, what the hell is wrong with everyone who thinks that the coalition was pulling some sort of sneaky, underhanded, "undemocratic" maneuver? A lot of people kept talking about "who the Canadian public voted for." But that was never a question. Each riding voted for their candidate and those candidates went to parliament. That hasn't changed at all. The executive power in government is then formed by the largest group of elected candidates that can agree to work together. In a minority situation (ie. the largest such group does not have the majority of the seats), if the rest of the house loses confidence then it's either time for a new election OR a different group can take over (if asked to by the governor general). That's the way it works! Nobody votes for a party, nobody votes for a Prime Minister. You vote for a candidate to represent your riding. That's it. Statements like "the Canadian people did not vote for a Liberal-NDP coalition" are meaningless. The Canadian people voted for 308 different people to come together and run the country.

Next, and this relates to the previous point, I think that the Bloc Quebecois were treated extremely shabbily in this process. I don't want Quebec to separate but as I mentioned above, the elected candidates of that party were chosen by the people of their riding. Those ridings feel that the members of the Bloc are the best people to represent them in parliament. By bashing the party and its members, Stephen Harper is saying, "Hey, Quebecers, everyone can have democracy except you. Your members of parliament should not have a say in the running of the country and thus you should not have a say." I couldn't believe how many times Stephen Harper made harsh comments about the Bloc in his speech to the country. It just blew my mind. It is irrelevant that the Bloc has a mission (or maybe it's just a vague goal at this point) to separate from Canada. They have legally elected members whose duty is to represent their constituents. Those members deserve as much respect as any other member of parliament. To do otherwise is to pay massive disrespect to all of the people represented by those members.

The last point I'd like to make is that there has been a bit too much emphasis on the leader of the various parties lately. This is not the United States. We do not vote for our Prime Minister. The Prime Minister just happens to be the leader of the largest group of MPs who agree to work together in parliament. A strong leader is important, but I see no need to put them up on a pedestal. They're only human. What matters is your local MP and how they represent you in parliament.

Movie Selection

Me this afternoon:

"Hmm, I want to watch a movie, lets see what DVDs I have. Oh, Requiem for a Dream, that's a good movie and I haven't seen it since the first time I watched it. I remember it was a painful and emotionally draining experience when I watched it before, but surely it won't be as bad the second time and I'll be able to appreciate the subtler details of this powerful and evocative film."

Wow, what a horrible idea. That wasn't any easier the second time. I don't think there will be a third.

Older | Newer