Archives

Archives / 2006 / January
  • I love Javascript!

    Just kidding. But I think that got your attention :)
    Seriously, there are things I really like about Javascript (like it being a dynamic language), but some things are just... So unexpected they just look plain wrong.
    For instance, what do you think this evaluates to:

    "" == 0

    Of course, I gave you enough clues for you to guess that it does return the wrong thing. Yes, this is actually true. Empty string equals zero. Isn't that a beautiful feature? Isn't that going to make your life so much easier? No? Really? Well, I agree with you, this is FUBAR.
    While I can understand that Javascript would evaluate both empty string and zero to be equivalent to false in contexts where a bool is expected, I would expect both sides of an == operator not to be such a place. To tell you the truth, I think it's kind of wrong even in boolean contexts because it's a bug attractor, but anyways.
    If anyone has a reasonable explanation for this, I'm all ears.
    Oh, and about a workaround... You can use toString() on both sides of the equals operator once you've checked that they are not undefined or null.

    UPDATE: as some have pointed out in comments (and I should have researched that), you can use the strict equality operators (=== and !==) and get the expected results on recent browsers (on older browsers you can compare the types as well).
    In a nutshell, I think the problem here is that the initial specification for the == operator was absolutely wrong, but changing it would have been a breaking change so they had to add the === operator to finally get it right. So for all useful purposes, I can see no reason to use == instead of === except to save one character.

  • SiteMap menu with icons

    While binding a Menu (or TreeView: everything in this article applies to TreeView as well) to a SiteMapDataSource is very easy, it can prove challenging to find how to extend the site map with custom properties and use these extended properties in a Menu. This sample shows how to add icons in a sitemap-driven menu.

  • Atlas interview on MSDN France

    MSDN France publishes an interview they made of me in November. The subject is Atlas, but it's in French only. Thought some of you may find it useful anyway (and I don't get interviewed every day, so I thought I'd do some bragging).

  • I made this faceplate

    I made this faceplate So here's what I've been up to. The original idea came from this beautiful Xbox 360 faceplate all the employees of the Xbox division got at launch.
    It has some beautiful concept art but the best part in my opinion is this "I made this" thing they wrote on the USB door.
    I figured that even though I was not working in the Xbox division, I could still have my own "I made this" faceplate.
    I searched for a possible subject for my first custom faceplate and quickly settled on the Emily the Strange comic character. It has an excellent mood and both myself and my wife are great fans and collectors of Emily art and books. We love the elegance and simplicity of the bi or tri-color drawings and the way they're drawn with sharp edges and perfectly flat surfaces.
    So what do you think? (except that it's not very personal, I just copied something I like, but well, let's say that I'm not too confident in my own drawing talent to do something really personal for the moment).

  • My Xbox 360

    Faceless Xbox 360Here's what my Xbox 360 looks like currently. Can you guess why?

    UPDATE: Here's your feedback and my answers...

    Azra: You add a tape recorder in?
    BLR: Err, no, but that's an interesting hack idea. Certainly an original one...

    Wim: Err...you decided to put a mod chip in? ;-)
    BLR: Nope. No modchip exists yet, and there isn't much that a modchip would add to the unmodified 360. The feature set is already pretty cool and I'm not at all into piracy.

    Wim: Problems with overheating?
    BLR: No, I've never had any overheating problems. Both the box and its power brick have their vents away from any other object. I've never noticed one or the other being more than warm. If I had to modify something, it would be to put silent fans, because the built-in ones are pretty noisy.

    Wally: Its turned the wrong way?
    BLR: No, that's the front.

    Wally: Its broken?
    BLR: No, works perfectly.

    Wally: You had laid it flat and had something on top of it?
    BLR: No.

    Brandon: looks like you spilled Tang on it and had to throw away the face plate.
    BLR: Yes, I did remove the faceplate, but not for that reason. And I did "spill" something on the faceplate, but after I removed it.

    Chris: Cause you got a new faceplate?
    BLR: Aha! Getting close. But if I had bought a new faceplate, it would already be there. I still have only the original faceplate, but removed it for a good reason.

    Travis: No, why? Tell me before I pick one up. Planning on it when they become available at the local Walmart.
    BLR: go ahead and pick it up. It's absolutely awesome. Best console ever (and I've had a few). The Live feature is flawless.

    Dror: i think you baought PS3 faceplate :)
    BLR: :) That's a funny one.

    Brian: You are painting your faceplate.
    Chris: well that would mean you are customizing your faceplate. Cool.
    You just inspired me, I think I may go paint my OEM faceplate this afternoon.
    BLR: Yes, exactly.
    I recommend acrylic paint and some varnish when it's dry.

    I'll post pictures of the completed project once it's finished...