Tuesday, December 30, 2008

Buzzword overload

There's a question on StackOverflow about the best source code comments people have seen or written. My favourite answer is this one, which doesn't require any programming knowledge to understand, since it's impossible to understand anyway. I found it quite hysterical:

/**
This method leverages collective synergy to drive "outside of the box" thinking and formulate key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive down the bottom-line. I really wanted to work the word "mandrolic" in there, but that word always makes me want to punch myself in the face.
*/

Nothing about "solutioning", though; perhaps it's out of date. I'd never heard the word "mandrolic" before, so perhaps I'm out of date.

Gail has on occasion actually used some of these words, particularly "synergy" and "solutioning", and doesn't understand why I laugh every time. I have an idea what it "means", or what it's supposed to mean, but to me, "synergy" is just the quintessential buzzword that doesn't actually mean anything.

Monday, December 22, 2008

Failure is not an option

Our camera stores pictures on a compact flash memory card. The other day when changing the card, Gail managed to bend a pin inside the camera, so it wouldn't recognize any card. We took it into a camera repair shop yesterday, and it's going to cost us $200 to get fixed. The repair guy said that Gail likely tried to put the card in sideways or backwards or something and that it's not that uncommon. For a fairly expensive piece of equipment, this seems like a blatant design flaw. If a card should only go in one way, why can't they design them so that it's physically impossible to put it in wrong? Make it so that it's impossible to screw it up. Failure should not be an option.

We had the same problem with an old wireless PCMCIA card. We had a PCI card in the computer, and that card had a slot that the PCMCIA card could slip into. But it was entirely possible to put the card in the wrong way, in which case it simply wouldn't work. (Luckily it didn't damage the card.) Unfortunately, it wasn't plug and play, so you had to shut the computer down, put the card in, and boot it up again. If you got it backwards, you'd have to shut the computer down again, reverse the card, then boot it back up.

The designers of the SD card that's in my kids' $89 cameras seemed to get it right:

  1. Make it a rectangle that's longer than it is wide, so you can't put it in sideways
  2. Put a notch in one corner so that if you put it in backwards, the notch makes it not fit before the card gets to the pins.

Update: I wrote the above before talking to the camera guy. Turns out it is impossible to put the card in backwards or upside down, but it is not impossible to put it in sideways. If they had made it "portrait instead of landscape" as the camera guy said, this possibility would have been removed as well.

Friday, December 19, 2008

Raindrops on roses and whiskers on kittens

I'm not a big fan of the snow. I go skiing once or twice a year, maybe more in the future because I took the boys last year and they enjoyed it, and tobogganing and making snowmen with them is fun too, but other than that, I'd be fine living somewhere that never got snow.

However, and I can't explain this, one of my favourite things is a work-from-home day when I sit down at my laptop, sip a mug of hot chocolate, and watch a huge snowstorm outside. Maybe it's the knowledge that I don't have to navigate the roads, or maybe it's just the fact that it's cold and nasty outside and I'm toasty and warm inside, but I love that feeling.

It's snowing like crazy outside, and I just finished my hot chocolate. I might make another cup. It's a snow day today so the boys and Gail are home, but I'm warm and cozy inside and have no plans of venturing outside today (except maybe to shovel later on but I won't think about that now). <Happy sigh> Suddenly my TLS certificate validation problem on the Mac just doesn't seem so daunting.

Saturday, December 13, 2008

The might know science, but they don't know web programming

While trying to buy tickets online for the Ontario Science Centre, I saw this:

Seriously, how hard is it to accept a postal code without a space and add it yourself?

Later on in the transaction, I hit an SSL error because the certificate was valid for "www.ontariosciencecentre.ca" but I happened to type "ontariosciencecentre.ca" into my browser, and none of the links after that redirected me to "www.". If their certificate relies on the "www." prefix, then their web server should be redirecting me.

They might know everything there is to know about science (and they do, I've loved going to the Science Centre since I was a kid), but their webmaster has a few things to learn.

Update: As you can see in the comments, Ken Huxley from the Science Centre has fixed the postal code problem and is working on fixing the SSL problem as well. Kudos to him, and my apologies for my condescending "has a few things to learn" comment above (not to mention the title of the post). When he mentioned that he was going to reconfigure DNS to fix the SSL problem, I realized that I understand at a high level what he's going to do, but I have no idea how to actually do it. I guess I have a few things to learn as well. But if I hadn't whined written about the problems I found, they wouldn't have gotten fixed, so it's nice to know that my blog has made the world a better place.

Tuesday, December 09, 2008

Stability in the NLL

OK, this is getting ridiculous. There's a news report saying that the owner of the Chicago Shamrox is trying to sell the team, and they might fold (as early as this week) which would require yet another dispersal draft. Is anyone else getting tired of this? The last time an NLL season began with exactly the same teams as the previous year (in the same cities) was 1993. Here's what's happened since:

  • 1994: Removed Pittsburgh
  • 1995: Added Rochester, removed Detroit
  • 1996: Added Charlotte
  • 1997: Removed Charlotte
  • 1998: Added Ontario and Syracuse, removed Boston
  • 1999: Ontario moved to Toronto
  • 2000: Added Albany, Baltimore moved to Pittsburgh
  • 2001: Pittsburgh moved to Washington, Syracuse moved to Ottawa, added Columbus
  • 2002: Added New Jersey, Montreal, Calgary, Vancouver
  • 2003: Washington moved to Colorado, removed Montreal
  • 2004: New Jersey moved to Anaheim, Albany moved to San Jose, Columbus moved to Arizona, removed New York and Ottawa
  • 2005: Added Minnesota, removed Vancouver
  • 2006: Added Edmonton and Portland, removed Anaheim
  • 2007: Added New York and Chicago
  • 2008: Removed Arizona
  • 2009: Added Boston, removed Chicago?

Sometimes franchises fail because lacrosse just didn't sell in that city (Ottawa, Anaheim). Sometimes they fail because of corrupt or incompetent ownership (Vancouver). In the case of Arizona, it was some mystery reason that made no sense — they shut down operations because the season was cancelled, but then the season was resurrected two weeks later. Arizona management announced that they had already shut everything down and couldn't restart it in time (though every other team managed it), so they'd just sit out 2008 and return in 2009. Of course they didn't return at all, so it sounds to me like they used the season cancellation as an excuse to fold up operations since they weren't making much money. This is too bad (particularly for Arizona fans), since they had a very good team that made the finals twice in three years. The Chicago thing sounds like another mystery reason — their owners say that it's just too difficult to manage the team in Chicago from their offices in Atlanta and LA. Mmmmmmkay. Never heard of phones? Email? Video conferencing? Hell, hire someone who lives in Chicago that can run things.

What the hell ever happened to due diligence, not only on the part of NLL ownership groups, but on the part of the NLL itself?

Apparently the Chicago owner announced that he wanted to sell the team during the middle of last season, which means that less than two seasons after he bought an expansion franchise, he's trying to sell it. Did he not consider the "difficulty" of running a team from a thousand miles away before spending $3 million to buy an expansion franchise? Did the NLL not ask him how he intended to run the team from a thousand miles away?

Twenty-one NLL teams have folded or moved since the league was formed in 1987. Of those, four only lasted a single season. Compare that to the NHL, where a total of eighteen teams have folded or moved since 1917. Three cities (Pittsburgh, Washington, and New Jersey) have had NLL teams fail twice, and the New York Titans are threatening to make it four. Does this sound like a good league to purchase a franchise in?

Having said that, the Toronto, Colorado, Calgary, Philadelphia, Buffalo, and Rochester franchises are all healthy. I don't know about Edmonton, Minnesota, Portland, or San Jose, and I haven't heard too much lately in the way of negative rumours about those four. I really hope that the late 90's and early 2000's were a kind of experimental phase for the NLL, where they tried lots of new markets, many of which failed. Now that they have a core of seven or eight franchises that are doing well and are unlikely to fold, perhaps we'll see a little more stability.

Thursday, December 04, 2008

On rebuilding

I read an article on general borschevsky's Maple Leafs blog the other day that contained the following text at the bottom:

Brian Burke believes Mats Sundin is not interested in returning to Toronto. No one seems to mind. Despite the obvious need for a top line centre, despite the need for veteran leadership, despite the fact that this team is already better then last year's team and that the playoffs are just a short win-streak away,...

As soon as I saw the line about "the playoffs are just a short win-streak away", I cringed. I immediately commented on the article, saying that this is why many people think that Leafs fans are stupid. No matter how bad the team is, these die-hards always seem to think that if we just make the playoffs, the Cup is ours. Or that making the playoffs, even if you get swept in the first round, makes the season a success. I wrote a little while ago about delusional Leafs fans who think that every year is the year. I, on the other hand, have accepted the fact that this year's Leafs are not a contending team, and are likely not even a playoff team. In the long run, this is probably good, in that they will get a higher draft choice, and Our Saviour will pick the next Sidney Crosby.

For the record, general borschevsky is neither delusional nor stupid. He responded to my comment, saying that making the playoffs may not mean a Cup victory, but it does mean that we'll be watching the Leafs in the playoffs, and it'll be exciting and entertaining. And for those of us not employed in the sports industry, that's what sports is, isn't it? Entertainment? This is a good point — neither Toronto nor Pittsburgh won the Cup last year, but I am quite sure that Pittsburgh fans enjoyed last year's playoffs a lot more than Leafs fans did.

There are three reasons a team misses the playoffs:

  1. Your team sucks because you are rebuilding, and after a few years, you will be a contender.
  2. Your team sucks because you are rebuilding, but after a few years, you will still suck.
  3. Your team just sucks.

Of course, the difference between groups 1 and 2 can only be seen through hindsight. The Leafs have missed the playoffs three years in a row, and I think they were squarely in group 3 during that span. They were not rebuilding — you don't trade away a prospect and a draft pick for Yanic Perrault if you're rebuilding. But the Leafs are clearly rebuilding now, so if they miss the playoffs this year, it will be because they have moved to either group 1 or group 2 — only time will tell which one.

I have been a Leafs fan my whole life. In that time, I have never watched a Leaf game hoping that they lose. So why is it that I cringe when someone suggests the possibility that the Leafs might make the playoffs this year? Because I have managed to convince myself that in order to get good, the Leafs will have to suck for a while. I mean really suck. It'll be a tough couple of years (or more), but if Our Saviour does what everyone seems to think he will do, the Leafs will be a really good team in four or five years. I know that there's no guarantee (losing is a necessary but not sufficient condition for building a winning team), but I have some confidence, so I'm willing to put up with the sucky years, mainly because the only other option is stay mediocre-at-best for the rest of whatever. So I've convinced myself that the Leafs will suck for a few years but in the long run, this is a good thing. I've braced myself for the pain. Then someone says "the Leafs could make the playoffs!" and I realize that if that happens, the pain will likely still come, it's just been postponed.

I love analogies. I'm not always good at coming up with them, but I love them. So here's my analogy. Sorry if you're reading this over lunch.

You went for dinner at the local greasy spoon and had the monster chili burger with onion rings and big piece of coconut cream pie. And a Diet Coke. Man, was that good. But a couple of hours later as you're sitting down to watch the Leaf game, you realize that the Diet Coke just isn't sitting well. Damn, shoulda had the chocolate shake. The discomfort turns to pain, and a few minutes later, you start to wonder if your dinner might, ahem, come back. Twenty agonizing minutes later, you're now hoping it will come back, since that will likely make the pain stop. You make your way to the bathroom not looking forward to what's about to happen, but ready for it. But when you get there, the bathroom door is locked — your roommate, who went for dinner with you, is in there already with similar issues. Do you bang on the door and thank your roommate for allowing you to put off the inevitable upchucking? No, because as unpleasant as it's going to be, you know it's necessary, and you've braced yourself for it.

Dumb analogy? Well, sure it is. Dinner is likely coming back up anyway, whether the bathroom door is locked or not, whereas the pain of not making the playoffs but not getting any better either can continue indefinitely. So here's another one:

You're in the dentist's office getting a filling. The dentist is about to stick that four-foot needle in your mouth (and then wiggle it around just in case you can't feel it). You grip the armrests, leaving visible dents that patients that use that chair the next day can still feel, bracing yourself for the most unpleasant part of any dentist visit. (Aside: I've had many fillings and four or five root canals and crowns, and for me, the needles are always the worst part.) Just before the dentist gives you the needle, he remembers something. "Oh, hold on" he says, puts the needle down, and starts fiddling with some other equipment. You breathe out, having been given a little reprieve. A minute later he picks the needle up again and says, "OK, I'm ready now". You grip again, and again he says "Oh, wait a sec" and puts the needle down. Now say he keeps doing this, several times. First off, you might want to find a less forgetful dentist. Secondly, by the seventh time he does this, you're ready to yell "Just give me the damn needle, will you?" Do you want the needle? No, but you know it's necessary and you've braced yourself for it.

So when someone suggests that the Leafs might make the playoffs this year, I say no. Not because I want them to lose, but because they are rebuilding and they need to lose for a while in order to get better. It's necessary, and I've braced myself for it.

Thursday, November 27, 2008

That was random

One thing that computers are really bad at is coming up with random numbers. You ask the computer to do something specific and tell it exactly how, and it will do it exactly right every time. But ask it to come up with a random number, and it will ask "how?" Well, there is no "how" for that question, you just pick a number at random. A human can do it better, but even we're not that good at it. If you ask a million people to each pick a random number between 1 and 1000, the number of people who choose numbers less than 10 or greater than 990 should be around 2% but is likely to be much less. And who's going to pick 500? Or 666? That's not very random, right?

In recent years, some computers have been built with real random number generators; these use things like thermal noise generated by the processor itself to come up with truly random numbers. In the majority of cases, though, this isn't available, or at least it may not be so you have to assume it isn't. You are then forced to use a pseudo-random number generator (PRNG), which gives you a sequence of numbers that appear to be random, but are actually completely reproducible if you "seed" the generator with the same value each time. This is helpful for us programmers when trying to reproduce a problem, but in general you want your pseudo-random numbers to be closer to real randomness, so you need to seed the PRNG with a different value each time. Coming up with enough entropy in your PRNG seed can be a difficult problem.

Many programs choose the number of seconds since midnight January 1, 1970, since it's a fairly easy number to obtain in the C language (for historical reasons that I am not going to go into here, mainly because I have no idea what they are). However, if you have multiple programs starting at the same time, they can end up using the same seed and therefore the same sequence of pseudo-random numbers, which can be a serious security hole. So some programs go much further in picking a seed — combining the current time with the process ID or some other piece of data that changes frequently in an unpredictable way. I have heard of programs that ask the user to type a sentence, and calculate entropy by analyzing the typing pattern of the user — the average number of milliseconds between keystrokes and stuff like that.

The end result is that programs sometimes have to go to a lot of trouble to come up with a seed for the PRNG that has sufficient entropy. Essentially, you need to come up with a good pseudo-random number in order to generate pseudo-random numbers.

Straight outta left field

Just announced: Brian Burke is the new Leafs President and GM. Wow, didn't see that one coming.

I was going to call it the worst-kept secret in sports, but I don't think anyone attempted to keep it secret, even when Burke was still employed by the Ducks.

Now that Our Saviour has come, the Leafs are a lock for the Stanley Cup within three years, right? If you believe the Toronto sports media who have been going apeshit over Burke for a year, you might believe that too. Personally, I will reserve judgement for a while. At least let the man arrive in Toronto before you start planning the Stanley Cup parade.

Wednesday, November 26, 2008

NLL West 2009 predictions

I did my analysis of the NLL East two weeks ago, so now I'll do the NLL west. I realized after I posted the east review that I should probably have waited for the rosters to be announced. I know about the major trades and such, but there are always players that are released and free agents signed that either aren't announced or are announced quietly, so I'm partially going by last year's rosters. Once the rosters are announced, I'll look things over and post updates if necessary.

Calgary Roughnecks

2009 will be Calgary's first full season with Josh Sanderson. Sanderson joins an already potent offensive group with Kelusky, Toth, Ranger, Cable, and Curt Malawsky, and they also signed Kyle Goundrey. The Roughnecks went 8-10 last year including the playoffs, but 4-2 with Sanderson in the lineup. Shooter is an impact player who will definitely have a positive impact on the 'necks. The loss of veteran Steve Dietrich won't make too much of a difference, since he played less than Pat Campbell last year anyway. The Roughnecks have both Ryan Avery and Matt King, both decent backups to Campbell.

Colorado Mammoth

In the past, trading Gary Gait away would be considered a major move for any team, but it's almost a non-issue for the Mammoth since he's been retired for three years. Actually, losing Gait is a plus for the Mammoth, since they picked up Andrew Potter and two first round draft picks from the Knighthawks essentially for nothing. Gee Nash is a top 5 goalie in the NLL and now has Andrew Leyshon backing him up. Gary Rosyski joins Gavin Prout, Dan Carey, and the always fun to watch Brian Langtry on the offense. This franchise has been at or near the top of the pack since they were in Washington, so it would be a mistake to count them out.

Edmonton Rush

The people who sew the names on the back of Edmonton Rush jerseys have really been earning their money in the past year. They made five trades in March alone last year (four on trade deadline day), and have made eight more since the season ended. In are veteran goalie Steve Dietrich, Spencer Martin, Cam Bergman, Andrew Biers, and Lindsay Plunkett, and out are Brendan Thenhaus, Kurtis Wagar, Matt King, Kyle Goundrey, Ben Prepchuk, and Dan Stroup. They also traded Troy Bonterre, but signed former Rock Tim O'Brien to play the same goon role. I'm surprised they released Stroup and losing Prepchuk will hurt as well. They also lost Mike Accursi who played part of last year with the Rush. Goaltending looks solid with Dietrich and Palidwor, but that's a lot of offense to lose, especially for a team that was 4-11 and last place overall last year. Barring yet more trades, I don't see the Rush contending anytime soon.

San Jose Stealth

Big changes for the Stealth! Former goaltender of the year Anthony Cosmo is gone, as are Gary Rosyski, Luke Wiles, Paul Dawson and a bunch of others. In are Peter Veltman and Matt Roik and a bunch of young kids. Colin Doyle posted his opinions on his blog after week 1 of training camp; he didn't say whether they'd be better or worse, but he did say they'd be "bigger and a little more athletic", and that the offense will "have a different flavor to it". Not sure what he means by that exactly. Lots of the defenders are American rookies, and American lacrosse players tend to start with field lacrosse and learn box later. As Doyle says, "the learning curve will take some time". With this many changes to the roster and this many American rookies, I don't see the Stealth repeating as Western division champs.

Minnesota Swarm

The Swarm move from the East to the West division, and might be poised to take over the west. Goalie Nick Patterson showed he was the real deal last year, Craig Point was Rookie of the Year, and Ryan Cousins was Defensive Player of the year. The Swarm was third in the NLL in scoring last year, and had five players over 50 points, all of whom are returning. If the sophomore jinx doesn't hit Point like it hit the previous ROTY, Ryan Benesch, I see the Swarm being a major player in the west.

Portland LumberJax

The LumberJax won the division in their first season, and then sucked rocks in their second season. Last year, they were pretty ordinary in the regular season, just squeaking into the playoffs, where they caught fire and went to the Championship game. Given all that, I have no idea how to predict what the Jax will do this year. The Jax lost Dan Dawson to Boston, and with all due respect to Brodie Merrill, he was their franchise player. Future Hall of Famer Dallas Eliuk has retired (or at least won't be playing this coming year — there are rumours that he has not retired and may play in 2010, but he's 44 now so I doubt that), but he wasn't their starting goalie last year anyway. They did sign Dan Stroup and traded for defender Brad MacDonald, but the loss of Dawson might just push the LumberJax back down into "sucks rocks" territory.

Summary

New kids on the Western block Minnesota should take it. San Jose won't repeat, but will still make the playoffs. Calgary and Colorado will be there too, as always, but there might be a pretty big gap between fourth place and fifth, with Portland and Edmonton finishing out of the playoffs.

Prediction:

  1. Minnesota
  2. Calgary
  3. Colorado
  4. San Jose
  5. Portland
  6. Edmonton

Update: After Chicago vanished and the rosters were released, I updated my predictions.

Tuesday, November 25, 2008

Dues

An actual conversation at our house tonight:

Nicky: Ryan, what's the money you have to bring to Cubs called?
Ryan: Dues.
Nicky: You don't have to go get dues today. Here. <Gives him a toonie>
Ryan: Where'd you get it?
Nicky: From my piggy bank. It's my only toonie.
Ryan: That's OK, Nick, you keep it. I'll get one from my piggy bank.

Wednesday, November 19, 2008

CD Review: Death Magnetic

I bought a CD a couple of weeks ago — an actual physical CD! How quaint! I have bought my share of music from both iTunes and puretracks.ca, and as convenient as digital music is, for some albums I still prefer having the actual CD for the liner notes. iTunes has its advantages, the main one being convenience. It's absolutely brain-dead simple to buy stuff from iTunes; from the time you say "I think I will buy this", you could have it downloaded and available on your iPod within a couple of minutes. However, the music is DRM'ed up the wazoo. I tend to prefer puretracks.ca over iTunes as they sometimes have DRM-free MP3s available, but if they don't, you get fully-protected WMAs. Either way, though, you can burn a CD from the iTunes files or the WMAs, and then rip the CD to clean MP3s. If you use a rewritable CD and then erase it when you're done, you don't even waste a CD, which begs the question: why do you need a physical CD to do this? You're using software to convert the files from protected MP3/WMA to CD format, then using software to convert from CD format to unprotected MP3. So why can't the software just do both without writing to a physical disk in the middle? It just blows my mind.

But I digress. The CD I bought was the latest from Metallica, "Death Magnetic". I have been a Metallica fan since 1991, thanks to the Black Album. I still remember buying it (and Nirvana's "Nevermind") at Tower Records in Redmond, Washington during my work term at Microsoft. It wasn't long before I picked up all of Metallica's previous albums, and "Master of Puppets" and "...And Justice For All" quickly became two of my favourite albums of all time. I wasn't that thrilled with "Load" when it came out, but it grew on me after a while and now I really like it. "Reload" never grew on me at all and I rarely listen to it. It should have been called "Filler from the 'Load' sessions". It just seems too, I don't know, gimmicky, for lack of a better word. "Garage, Inc." was good, but obviously a little different since it's all covers. Since it's mainly covers of bands I don't listen to (Motörhead, Mercyful Fate, Misfits, Killing Joke), I don't listen to that album often either (though their cover of Bob Seger's Turn the Page is seriously kick-ass). For whatever reason, I had high hopes for "St. Anger", but was sorely disappointed. I've listened to it many times since in the hopes that it too would grow on me, but while Frantic isn't a bad song, the title track annoys the hell out of me and much of the rest is simply forgettable.

Which brings me (finally) to "Death Magnetic". In a nutshell, this is easily the best Metallica album since (at least) "Load" — though given my comments above about the albums since "Load", that's not saying much. There are actual guitar solos, something completely lacking from "St. Anger". Jason Newsted was a decent bassist, but his bass playing in Metallica kind of sat unnoticed in the background. You can really hear Trujillo's bass playing, and that combined with the sometimes unconventional drumming of Lars Ulrich makes for a powerful bottom end. James Hetfield is one of the most underrated guitarists out there, probably because he isn't flashy and doesn't generally do the solos — Kirk Hammett plays the solos (and nothing else) on the recordings — but Hetfield is his usual solid self here. He is also one of the better metal singers around, in that he actually sings. He can growl with the best of them when necessary, but isn't afraid to actually use his voice for more than just belting out words.

Some other miscellaneous comments:

  • Broken, Beat & Scarred has the same problem that annoyed me about St. Anger (the song): excessive repetition. "What don't kill ya make ya more strong" is not only bad English but is said about a hundred times in the song. It's still a better song than St. Anger though.
  • the beginning of The Day That Never Comes sounds uncannily like Fade to Black.
  • The Unforgiven II on "Reload" had some obvious musical nods to the original The Unforgiven. The Unforgiven III on this album does as well, but isn't quite as obvious. The music is different, but the vocal melody during the verses is reminiscent of the original.
  • Parts of All Nightmare Long are almost radio-friendly but not as blatantly so as Escape from "Ride the Lightning". But don't expect to hear it on Top-40 radio anytime soon.
  • Suicide & Redemption is the first Metallica instrumental song since "...And Justice For All". I'm not a huge fan of To Live Is To Die, but I love the other instrumentals (The Call of Ktulu and Orion), and this one is up there with those two.

Sunday, November 16, 2008

perrow.ca 2.0

I've just finished rewriting some parts of my family web site to be more "AJAX-y". There are a bunch of pages where we have pictures from various vacations and baby pictures of my kids and such. With the old format, the page loaded all of the images for a particular page and if you wanted to see a close-up of one of them, you clicked on it and it just displayed the raw image. Then you had to click the back button to get back to the list of images. This was fine, but not very nice on a slow system (like my parents and Gail's parents, who are on dial-up). Some friends of mine use smugmug.com for their family pictures, and I like their setup — it shows some thumbnails in a panel on the left and when you click on one, it loads that image on the right. There are also next and previous links to cycle through pictures one at a time, and there are page forward and page back links for going to the next set of thumbnails. I decided to steal borrow this idea and in so doing, teach myself Javascript and AJAX. AJAX is actually an acronym meaning "Asynchronous Javascript And XML", but my solution doesn't use any XML, so I suppose I should just call it AJ.

I started doing the work myself from scratch. I found an online tutorial that described Javascript (I had done a little bit previously, but had to get much more in-depth) as well as what AJAX was and how to do asynchronous requests. After adding a few fairly simple AJAX things to my lacrosse pool web site, I started work on the image galleries at perrow.ca. I was making progress when I discovered a Javascript library called jquery which made some of the AJAX stuff easier but more importantly, made navigating through the DOM much easier as well. It allows you to iterate through all objects of a particular class and make changes to them, or find a particular element given its ID, and make other changes that would otherwise require lots of HTML changes. Best of all, they've already solved the cross-browser issues for you, so when trying to determine the size of an element, I don't have to worry about the fact that IE does things in the DOM differently than Firefox.

I downloaded it and started adding jquery calls to my Javascript code, and this allowed me to clean up my code significantly. As I mentioned, all of the code I'd written to handle IE and Firefox differences went away (and I hadn't even got to Safari, Opera, or Chrome).

The most complex part of this whole project was keeping all the languages straight. The whole site is written using PHP, so to make changes, I had to change the PHP code to generate different HTML, then update the CSS stylesheet, then add the Javascript code to make the AJAX requests, then update more PHP code to handle those requests. The Firebug plug-in for Firefox was invaluable for debugging Javascript, although there were a number of occasions where it would just lock up. Firefox would continue seemingly normally, but Firebug just stopped responding. I couldn't even click the 'X' or hit F12 to close the Firebug window. Shutting down Firefox completely and then starting it up again cleared out whatever cruft was causing that.

The other difficult part was the fact that the browser's "Display page source" feature is not useful if the contents of the page are mostly generated using Javascript. If the page wasn't doing the right thing, I had to tweak the output so that it would display the raw html so that I could see what was going wrong. This is what we old guys call the time-honoured printf method of debugging, not like these kids today with their C# and their Visual Studio and their fancy-schmancy debugging tools. Back in my day, we used printf and that was it. And we liked it.

The whole page is basically done with Javascript now. The HTML for the main part of the page now consists of:

<div id="pagecount">&nbsp;</div>
<div id="imgcount">&nbsp;</div>
<div style="clear: both"></div>
<div id="thumbnailarea"><span class="spinner">&nbsp;</span></div>
<div id="mainimagearea"><span class="spinner">&nbsp;</span></div>

Everything else is done using CSS and Javascript — CSS to define where things go and what they look like (colours, borders, stuff like that), and Javascript to load the page initially and to handle mouse clicks. The "pagecount" block is populated with the page number, number of pages, and page navigation links. The "imgcount" block contains the image number, image count, and image navigation links. The thumbnail area is populated with the appropriate page of thumbnails, currently four rows of images, where the number of images per row is dependent on the size of the block in the browser. The "mainimagearea" is populated with the first image on the page, and is then updated whenever the user clicks on a thumbnail. When the page is loaded, the "spinner" spans are initialized to contain a little spinner image spinner that indicates that something is happening in the background. Thanks to jquery, this can be done in a single line, regardless of how many spinners I have on the page:

$(".spinner").html( "<img src='/images/ajax-loader.gif' />" );

It's also nice that if I change the spinner image or the location of the file, I just have to change the URL in this one place rather than anywhere I use the spinner image. That can be done with CSS as well:

.spinner { background: url( /images/ajax-loader.gif ); }

If you do it using Javascript, however, the spinners won't show up if you have Javascript disabled. In that case, however, nothing else will load either, so the page will be entirely blank. I had to add <noscript></noscript> tags containing a message saying that you need Javascript enabled to make this work. Since I do have a non-Javascript solution (the old code), I could just put that code inside the <noscript> tag, and I probably will... later.

I used to have a special page for a "slideshow", where it would display a large image and you could click next and previous to go through them, or click "autoplay" and it would automatically go to the next image after five seconds. To implement this in the Javascript world, I just added a checkbox for "Auto-advance", which sets a Javascript timer for five seconds and pretends that "Next" was clicked when the timer fires. I had to make sure I cancel the timer if the user clicks anything else, but apart from that, it was pretty easy.

Friday, November 14, 2008

Irony: thawte.com insecure?

I was trying to download some root certificates from thawte, and Firefox gave me this error:

XSS attempt from thawte.com

Thawte is the second biggest public certificate authority in the world. Their entire raison d'être is internet security. I see there being three posibilities here:

  1. they really do have an XSS vulnerability on their site
  2. their site is badly written so as to confuse NoScript
  3. there's a bug in NoScript that causes a false positive on the Thawte web site

Any of the three is the height of irony.

Thursday, November 13, 2008

NLL East 2009 predictions

Lacrosse season is almost upon us! The season starts at the end of December, and the teams are getting their rosters ready now. I don't think I've done this in the past, but here is my mini-analysis of the NLL's Eastern division as well as some predictions for how the teams finish. The teams below are listed in no particular order; I'll get to the predictions at the end. I'm a Rock fan so I'll start with Toronto.

Toronto Rock

It turns out Dan Ladouceur did not retire at the end of last year as previously believed (though I never did see an official statement to that effect), but will play at least one more year. Honestly, I'm not sure how much Laddy can contribute anymore. He used to be a very solid defenseman, but he's not nearly as effective as he once was — though I do remember saying after one game last year that he played really well. Jim Veltman did retire which is a big loss for the Rock, but he will join the coaching staff and I think he'll do a good job there. I'm happy with the Rock's choice of Chris Driscoll as the new captain. He's a veteran player who's respected, and is also one of the unsung heroes of the Rock over the last few years. He can score with the best of them but also plays solid defense and is pretty quick on transition as well.

Manning and Ratcliff will lead the offense, and hopefully Ryan Benesch can shake the sophomore jinx that plagued him last year. Aaron Wilson is gone but was replaced by Luke Wiles, and I mentioned before that he looks like a similar player to Wilson anyway, so that's a wash. If Craig Conn is healthy then he will be a strong addition. Jason Crosbie has scored more than 50 points in four of the past six seasons, so even if the two big "ifs" (Benesch and Conn) don't produce, the offense is still better.

We lost Veltman but gained Stephen Hoar. Hoar is a good defenseman, but he's no Jim Veltman. But Veltman was a hundred and eighty years old while Hoar is 26. At best, that's a wash. There weren't any other major defensive or transition changes, so call the defense a little worse, but not significantly.

My biggest fear for the Rock is goaltending. Bob Watson is coming off a Goaltender of the Year award, which is pretty impressive for a 7-9 team that didn't make the playoffs. But he's also 38, and Mike Poulin, a very capable backup, is gone. Mike Attwood, the new backup (gotta have a goalie named "Mike", apparently), has played a total of zero minutes in the NLL. If Watson gets injured or just can't play as well as he used to, the Rock could be in serious goaltending trouble.

Overall the Rock are improved, but it may not be by much. Exactly how much depends on Conn, Benesch, and Watson.

Buffalo Bandits

Not much to say here. They're the defending champs and have made no major changes in the off-season. Tavares is 40 now but doesn't seem to be slowing down, and Steenhuis and Powless are only likely to get better.

Rochester Knighthawks

Not many changes for the K-Hawks this year, but they are significant. Out: John Freakin' Grant, arguably the best player in the game right now, and Stephen Hoar. In: Gary Freakin' Gait, arguably the best player in the game ever, and Aaron Wilson. Gait is not likely to be what he once was — heck, when he retired in 2005, he wasn't what he once was. But he's still Gary Gait, and though he won't replace Grant, he and Wilson together might, numbers-wise anyway. Last time Grant was injured for a while, Shawn Williams stepped up admirably and became the de facto team leader. Might that still happen with Gait on the team? Sure it could.

But if Wilson+Gait=Grant, then the Knighthawks are a Hoar short of the same team that missed the playoffs last year. From that point of view, it could be argued that they're not much improved from last year, and I suppose that's true. But I don't see the Knighthawks missing the playoffs this year. Why do I think Rochester will improve while I'm not so sure about Toronto? Easy: Rochester underperformed last year, while Toronto didn't.

Weird: Grant will not play this year, but he will be an assistant coach in Rochester. John Grant the injured player coaching Gary Gait the former NLL Championship-winning coach seems a little weird.

Philadelphia Wings

No major changes in the off-season for the Wings either, though reigning MVP Athan Iannucci got injured in the summer league and there were rumours that would not be 100% this coming season. If that's true, that's a big blow to the Wings, but from what I've heard recently, those rumours were unfounded and Nooch will be ready to go. Kyle Wailes has been signed and has apparently dealt with his work visa issues, and so he will be able to play this year, so he joins Iannucci, AJ Shannon, and Merrick Thomson on the offense. Geoff Snider broke Jim Veltman's loose balls record last year, and is an absolute monster on faceoffs. The Wings have Hajek, Jacobs, and Taylor Wray on defense, and they also have Rob Blasdell and Brandon Miller in goal, possibly the best one-two punch in the NLL.

I expect big things from Philly this year

New York Titans

The Titans went to the eastern division final last year, and now have a new coach in Ed Comeau. What else can I say but that they are an all-round solid team? I remember seeing Jarett Park play last year and was impressed, and Jordan Hall was a heckuva player as well. Powell, Boyle, and Maddalena make for a pretty potent offense, and Matt Vinc was an All-Pro last year. Turns out Americans can play box lacrosse after all. Who knew?

Boston Blazers

Meh — they're an expansion team so they'll suck, right? Maybe not. The Blazers grabbed Dan Dawson from Arizona in the dispseral draft (or was it from Portland in the expansion draft?), and remember Dawson brought the LumberJax from missing the playoffs to the Championship game the very next season. They also got Jake Bergey from Philly, and a couple of pretty solid goaltenders both named Mike: Miron and the aforementioned Poulin. Will they make the playoffs? I'd say probably not, but this will not be one of your 2-14 expansion teams (à la Edmonton or Ottawa).

Chicago Shamrox

Chicago only made one major move in the offseason, but it was a doozy. The Shamrox acquired Anthony Cosmo, one of the best goaltenders in the league, from San Jose for Matt Roik, a better-than-decent goaltender himself, and a couple of draft picks. This doesn't immediately turn them into a contender, they'll need some more offense for that, but they might win a few more 11-9 games rather than losing 17-11.

Summary

The East will be a tight race, as it always is. I think the Bandits and Wings have to be your top two teams. New York proved last year that they can compete with anyone, and I think Rochester will rebound from an off year, so that gives you your top four. This means that Toronto, Chicago, and Boston will not make the playoffs. Man, I hope I'm wrong about Toronto, but I have no idea which of my top four would have to drop out for Toronto to get in. If I had to guess, I'd have to say Rochester.

Prediction:

  1. Philadelphia
  2. Buffalo
  3. New York
  4. Rochester
  5. Toronto
  6. Boston
  7. Chicago

I'll do the NLL West next.

Update: After Chicago vanished and the rosters were released, I updated my predictions.

Saturday, November 08, 2008

Obama makes headlines

How is this for cool? This page has a whole ton of newspaper front pages from around the world the morning after Obama was elected. Most of the headlines are what you would expect — "Obama" (with and without exclamation point), lots about change, lots about making history, that sort of thing.

Gotta love this paper from Portugal, where a picture of a supermodel is bigger than the one of Obama and McCain. And this one, also from Portugal, or this one from Bulgaria, where there's no mention of the election at all (as far as I can tell, I don't speak Portuguese or Bulgarian). But this one combines the "best" of both worlds — a scantily-clad woman and no mention of Obama!

That last one isn't from Portugal, it's from Brazil — where they speak Portuguese. What does that tell you about Portuguese people? They like women in bathing suits and don't care about American politics. Can't fault them for that. Next vacation — Rio de Janeiro? Hmmmm....

Friday, November 07, 2008

Concert review: Robert Munsch

We went to see Robert Munsch last night in Hamilton. We saw him a year or two ago in Kitchener as well, and we all really enjoyed it, so when we heard he was coming to Hamilton, we grabbed some tickets. Gail is away this weekend so she had to miss it, but I took the boys who are both big Munsch fans. We have a bunch of his books, and the boys regularly bring home others from the school library.

I didn't know until yesterday (before the show) that Munsch had a stroke back in August which left him unable to form sentences. Luckily, he's recovered enough that he is still able to perform, though he did have a couple of pauses during the show where he seemed to forget the next part of the story he was telling. But he's quite animated and a bit eccentric on stage anyway, so if I hasn't known about the stroke beforehand, I don't think I would really have noticed.

According to the article on the stroke, he's touring in support of his latest book "Just One Goal", but he didn't perform that one last night. Munsch frequently invites kids from the audience up onto the stage, but they frequently just sit while he tells the story. During the Paper Bag Princess, one of Gail's favourites and a highlight of the show, he had people from the audience perform it with him — he'd read the lines and had the "characters" repeat them. He had a young girl playing the part of Princess Elizabeth, an even younger boy as Prince Ronald, and a father (he said he needed "an ugly father") playing the dragon. He also performed I Have To Go!, Love You Forever (which I am completely unable to read without choking up), Mortimer (which everyone loves to sing along with), We Share Everything!, Stephanie's Ponytail, Something Good, Thomas' Snowsuit, Up Up Down, and a bunch of others that I hadn't heard before. He talked for about an hour and ten minutes so it wasn't a long show, but you can't expect young kids to sit much longer than that. The tickets were $18, which is quite reasonable in this era of $75-for-the-cheap-seats concert tickets.

If you've never seen Robert Munsch perform live and you have young kids, I recommend taking in a show. By "young kids", I mean pre-teenager. I'm sure there are teens who would enjoy it as well, but it's more aimed at the younger crowd. My boys are 9 and 6 and they both loved it.

And that's the end of that story.

Wednesday, November 05, 2008

Obama makes history

First off, congratulations to US President-elect Barack Obama. I don't follow American politics all that much (hell, I don't follow Canadian politics all that much), but I do like what I've heard from Obama in the past, and I'm also glad that a nutcase like Palin will not be VP. I've heard of a lot of Americans who are truly excited and optimistic about their future with their new President, probably for the first time in many years.

But onto the reason for the title of this entry. You might think that Obama is just another politician, just like every other guy who's been elected President. But there's something different about him, something that makes him stand apart from every other President the US has ever had. Yes, it's true: Barack Obama has won two Grammy awards, both for Best Spoken Word Album. As far as I can tell, no other President has ever won a Grammy award.

To be fair, Bill Clinton and Jimmy Carter have each won a Grammy award, also for spoken word performances, but they both won theirs after being President. Hillary Rodham Clinton has also won one, so perhaps in four years...

Monday, November 03, 2008

Leafs fans are revolting

Howard Berger posted an article last week on his blog that insulted Leaf fans in every way possible. He called us sheep, delusional, easily placated, and said that we have "an insatiable willingness to accept whatever garbage is tossed [our] way". His point is that the powers-that-be at MLS&E are getting rich off of us stupid Leaf fans who continue to buy tickets and merchandise in record numbers. He even brags about how much money he personally is making from Leafs fans who read his blog. Then after all that Leaf-fan-bashing, he adds the postscript: "p.s. You're the very best, most devoted fans in the world... don't change a thing" If you asked every sports writer in Canada to write something more patronizing and ass-kissing, I doubt anyone could.

After posting this garbage article, he then has the nerve to disallow comments on it. Well OK, he hasn't formally disallowed them. Comments are moderated, which is fine, but in the four days since the article was posted, he hasn't seen fit to approve a single one. I left one myself that hasn't been approved, and if you think that mine is the only one, you're as delusional as us Leaf fans.

Update: Between the time I wrote this article and the time I published it, Mr. Berger and/or the Fan blog people approved 25 comments on this article, including mine.

Are there delusional Leaf fans out there who see a three-game win streak in October and want to plan the Stanley Cup parade? Sure there are. Are there delusional Leaf fans who hate a particular player and want to trade him for a bucket of pucks one day and then want to nominate him for the Hart trophy the next? Sure. Are there Sens fans who do the same? Yes, absolutely! Canadiens fans? Yes! Red Wings fans? Yes! Predators fans? Well, probably not. But Berger lives and works in Toronto, probably the biggest hockey market in North America, if not the world. In absolute numbers, there may be more hockey fans in Toronto than any other city in the NHL (with the possible exception of New York City, just because greater New York has four times the population of the GTA and two NHL teams — three if you include New Jersey). Every city has its share of delusional fans, so it stands to reason that if your total number of fans is higher, you're going to have more delusional fans. And guess what? These delusional fans are also frequently the loudest, so a sports writer like Berger is going to hear from them a lot more than from us realistic fans. But Howard Berger has covered the Leafs for years, so I would have thought that by this point, Berger would be smart enough not to paint all Leafs fans with the same brush.

Even my favourite sports broadcaster, Bob McCown, has talked about Leafs fans as sheep in the past. He doesn't say it because people buy lots of tickets or merchandise, or even because they support a team that hasn't won a Stanley Cup in forty years; he says that people that cheer for a team that so openly treats them like garbage are sheep. I guess I can understand his reasoning, but I've grown up in Toronto and have been a Leafs fan all my life. I can't just up and change teams, though I do admit to having had doubts in the past.

A bunch of Leafs blogs have gotten together and written an open letter to Leaf fans saying that we've had enough of media types criticizing and insulting us. They suggest a "revolt" of sorts, saying that we do have alternatives to these media types who blame Leafs fans for failings of Leafs players, coaches, and management. These blogs provide commentary and insight on the Leafs without the condescension of Mr. Berger and other Toronto sports writers because they are written by actual Leafs fans. I don't have the time to read all of these blogs myself, but I do read Down Goes Brown, which I find quite insightful and thought-provoking and sometimes just funny. Pension Plan Puppets has some good stuff as well, though there seems to be less discussion and analysis and more "Go Leafs Go!" on that one.

For my part, I have removed the Toronto Star's Damien Cox's blog from my blog list. I have only been reading it for a few weeks and I never found it all that insightful anyway. I never subscribed to Berger's blog in the first place. Now I'm posting this article in support of this "boycott" of sports writers who think of Leafs fans as moronic sheep while they make money off of us.

Having said all that, I'm not going to stop listening to McCown.

Saturday, October 25, 2008

Thursday, October 23, 2008

The hockey story that just won't die

Mats Sundin had a physical in Toronto the other day in preparation for his return to the NHL. Toronto apparently has cap room to sign Sundin, but why the hell would they? They're trying to rebuild and are letting the young kids play to see what they've got. Would Sundin make the team better? In the short term, yes, but at the expense of taking playing time away from the kids. They've already got veterans like Blake and Kaberle for the kids to learn from. News flash (via Ron Wilson): the Leafs are not going to contend for the Cup this year (or likely for at least the next couple), so what would be the point of signing Sundin?

Nobody from the Leafs organization will say this out loud, but you have to know they're thinking it: they also don't want to be too good this year, otherwise their chances of winning the John Tavares sweepstakes get lower and lower.

Sundin has said that if he plays this season, it will be his last season. But this is the same guy who refused to waive his no-trade clause last year (when the Leafs could have gotten something for him) because he didn't like the idea of being a rental player. He said that playing for the Stanley Cup is only meaningful if you've been playing with the team since the beginning of the season. And now, less than a year later, he's sitting out until two months into the season and is hoping to sign with a Cup contender, and then he'll retire after the season's over. In other words, he's sitting out specifically so that he can be a rental player.

I harbour no ill will towards Sundin; if he comes back with another team (even the Senators or Habs), best of luck to him. But part of me will remain angry with him for a while because of his refusal to waive his no-trade clause last season. He could have made the Leafs a better team in the long term by agreeing to a trade for draft picks and/or prospects, but he didn't want to do that because (he said) he didn't want to be a rental player and (he said) he wanted to remain a Maple Leaf. I accepted both of those statements at the time. But his actions since the end of last season conflict with both of them, and now I don't know what to think. It's kind of too bad that he won't get the retirement send-off that one of the best captains in Leaf history should have had. Rather than have the big celebration of his career in his last-ever game in Toronto like Jim Veltman had this past year, the Sundin era in Toronto just faded away.