Las Vegas

Carol and I were in Las Vegas from Wednesday to Saturday. Las Vegas is 5.5 hours away from our house so we had to go at some point =)

Even though we do not gamble and do not like to spend big bucks to go clubbing, we had a good time because we stayed The Belagio, saw the Cirque du Soleil’s “O” show, had some excellent Italian food, and admired the designs of the fancy casinos (my wife is an interior designer).

Click here to see some photos of our trip

Advertisements

Dealing with 404's in ASP.NET the RIGHT way!

For the longest time I thought the web.config was all you needed to tweak to get the whole "page not found" thing working right:

<customErrors mode="On" defaultRedirect="/ErrorPages/ErrorPage.aspx">
  <error statusCode="404" redirect="/ErrorPages/PageNotFound.aspx"/>
</customErrors>

But it turns out I was wrong! When I was debugging the HTTP headers with the Live HTTP Headers Firefox plugin I noticed that when you hit http://example.com/NonExistentPage.aspx, you got a 302 (redirect) and then a 200 (OK).  You never get a 404!!!

The problem with not getting a 404 is that search engines do not remove the pages from their indexes unless they see a 404 when crawling your site. 302 actually means "The requested resource resides temporarily under a different URI".

After doing a google search, this turned out to be a common problem. And the fix was easy. On your Global.asax’s Application_Error method, add the following:

Exception lastException = Server.GetLastError();
if (typeof(HttpException) == lastException.GetType()
    && lastException.Message.Contains("does not exist."))
{
    this.Response.StatusCode = 404;
    this.Server.Transfer("/ErrorPages/PageNotFound.aspx");
}

I saw dead people

I went last night to the "Body Worlds" exhibit http://theleonardo.org/bodyworlds/index.php where I saw plastinated bodies like this one:

body-worlds

I thought the exhibit was going to be very eerie, and it was,, but not too much. It really felt like this one time in high school when we were supposed to have a presentation about a human body part. Our group was assigned the feet and we had the excellent idea of bringing in some chicken feet to show how the ligaments moved the fingers. Needless to say it was really gross, I still remember the raw chicken flesh smell. Of course we bought the chicken feet at a local market, we did not harm a chicken just for the sake of our HS presentation =).

Anyway, the exhibit ended at 9pm and I had not had dinner. I would normally be starved by that time but I was really not very hungry and I was definitely not craving anything with meat. Also, I felt like I really had to wash my hands even though I did not touch any of the bodies. I mean, I always wash my hands before eating but even before I left the exhibit, I had a great desire to wash them.

This other weird thought crossed my mind: Being in the exhibit, I was breathing the air that touched the bodies, and that made me uncomfortable, at least for 30 seconds. But I did not panic and after a while I did not think about it again.

Well, besides the weirdness. I learned TONS of good educational facts. And just being able to appreciate the complexity of the human body makes it worth your money ($22 + $2.50 online booking fee). I’m glad I went.

Hard core snow!

For the first time this season, we had about 3 inches of snow fall overnight at my house. It will continue snowing today until about 2pm!

I guess this means biking is officially over =(.

Working with Open Source Code

At Neumont, we began using Moodle as our Learning Management System. Moodle is an open source project that is constantly being maintained by the community. And since we have tons of developers at Neumont, we also make our own updates to the code.

In case you wonder why software developers need 2 monitors, here is why…  There are really many reasons, like you write the code in one monitor and you test it in the other one. But yesterday they were extremely helpful and it was not because of this.

Yesterday, I incorporated the community updates in our local copy of the code. The community touched about 800 files out of which 60 had to be added, about the same amount had to be removed, and the remaining ones had to be updated. Of the updated ones we had 20 files with conflicts. I used the monitors for the conflict resolution.

diff-madness

It took me close to a couple of hours just to resolve the conflicts on those 20 files (mostly because it was the first time I did this) but it would have taken at least double if I only had one monitor.

In case you’re wondering: I used WinMerge to compare our code with the community’s code (seen on the left monitor) and TortoiseSVN’s diff tool to see which were the changes we made to our code (seen on the right monitor).

Things worked great on my local installation of Moodle, now I now have to update our shared test environment so we can thoroughly test the upgrade. Good times!