Evil Code

I try to refrain from determining morality associated with code, but I'm thinking this example may have to transcend that to being truly evil.

var myfunc2 = function () {
    alert("I don't exist");
};

function myfunc () {
    with (this) {
        eval("myfunc2 = function () " +
             "{ alert(\"Hey I exist.\"); }; ");
    }
}

myfunc();
myfunc2();

I love the flexible nature of Javascript's objects, it makes it fun to program in. But combining this, eval and with is where things start to get scary. The funny part is that I made this example because I want to use this feature.

For those who aren't really familiar with Javascript this is overriding the traditional lexical scoping by using a with to make the global object the current object. this is the global object on functions that are declared in the global object. So, effectively we can create functions that are usable elsewhere from strings even through we're in a function. Useful, but definitely hard to read.

posted on Thu, 16 Nov 2006 at 14:56 | permanent link

Bumper Sticker 2

To remember the recent election I'd like this bumper sticker:

I voted for the
TERRORISTS
Dems. 2006

For those who haven't been watching the election (or don't live in the US) this may seem a little crazy. What basically happened is that many of the Republican candidates and press outlets made the claim that voting for the Democrats is like voting for the terrorists. Luckily, it seems that more people got amusement out of it than actually got motivated by it.

posted on Thu, 09 Nov 2006 at 16:11 | permanent link

Novell and Microsoft

I'm sure you've heard by now, but if you haven't, you can read Groklaw's take on the fact that Novell and Microsoft have entered a patent agreement. I think some other interesting reading on this is Miguel de Icaza's blog. I actually expected him to be one of the people driving this, but apparently he didn't know until it was almost finished.

I think that the one thing that many open source people are missing in this deal is a subtlety of the wording. Novell is not "licensing patents from Microsoft" it is entering an agreement so that Microsoft will not sue their customers for any possible patent infringement. There is a huge difference here. I think that the case Novell is worried about the most is when they go and sell to a customer and the customer comes back with: "Oh, you're just going to get sued by Microsoft and so we might as well buy their product now instead of later." This agreement says to those customers that it's safe to buy Novell Linux until 2012. What this doesn't say is that it was unsafe before, just that it is safe now.

I understand that many people are approaching this with the logic of: "Why would they do this unless they knew they were violating a Microsoft patent?" That's a fair argument. But, I think that Novell, and Linux in general as the smaller player in the IT sector has to remove barriers to adoption. One of those barriers is a perceived legal risk. Whether it is there or not, it is perceived to be there, which slows down adoption. I believe that Novell's motivation for this agreement is more about removing perceived risk rather than actual risk.

Maybe I'm just an optimist. Maybe I'm not jaded enough about the "evil empire" that is Microsoft. But, I do know there are some really good Free Software people at Novell. If they start jumping ship, then I'll get worried.

posted on Wed, 08 Nov 2006 at 12:47 | permanent link

Gift Giving

Cover of the book 'Working with You is Killing Me'

I was walking a long and came across the best Secret Santa gift ever. It is a book where the title is "Working with You is Killing Me" written in big letters on the front. Just the shock of watching someone's face as they try to figure out who is saying that they're "killing them" as they open the book would be priceless. Of course, it's not really about that -- but it would be an awesome first reaction.

There are probably a few very good reasons that I don't work at a company that thinks anonymous gift giving is fun. Play to win!

posted on Fri, 03 Nov 2006 at 02:16 | permanent link