xopl.com

X is for infamous.

contents:

This website is under construction.

kazoo!

Apr 5, 2006 @ 01:03

Happy long sequential datetime to you! Once in a century!

01:01:58 04/05/06
01:01:59 04/05/06
01:02:00 04/05/06
01:02:01 04/05/06
01:02:02 04/05/06
01:02:03 04/05/06

Wooooooooo!

3 comments... | link

pitchforks and torches

Apr 4, 2006 @ 21:05

298,412,466 Sony Wega 23" LCD HDTVs

That's how many beautiful, wide screen, HD, flat panel TVs that could have been purchased with 250 billion dollars.

That's one TV for every single man, woman, and child in the United States.

Mind you, we've actually spent much, much more than 250 billion dollars in Iraq. But, what else can you buy with 250 billion dollars?

How about two manned missions to the Moon AND two manned missions to Mars.

How about a full 4-year ride to college for 7,260,000 students.

You don't have to take my word for it. This article delivers the real funny.

My favourite part is probably this:

"What better way to ring in the dawn of this new age than by transforming the symbol of our nation's heritage of freedom into a death-spitting dark angel presiding over the time of ruin? There is no better way. That was rhetorical."

add a comment... | link

third eye blind

Apr 4, 2006 @ 15:27

i wish you would...

So, Jesse turns to me and he says, "Traffic is stopped both directions on 94. Somebody is gonna jump off the bridge at 3rd." Just as I'm frantically trying to load up the correct traffic cam off the MN DOT website, Jesse is sending me similar camera links. I love the internets. I totally got some hot snaps. They were zooming and panning the web cam in real time.

I guess they arrested the guy.

...step back from that ledge my friend.

I quickly called into Radio K to request the following set:

*"Jumper" - Third Eye Blind
*"Jumpers" - Sleater Kinney
*"Fell off the face of the earth" - Firewater
*Anything by Elliot Smith

They're playing the Sleater Kinney right now.

2 comments... | link

bacronym

Apr 1, 2006 @ 14:48

Surprisingly, getting my car registered and titled in Minnesota wasn't anywhere near as bad as the forms on their website made it seem like it would be. I took the sith's tip and went up the the DMV is Roseville.

Let me tell you something... the government hates Black people. This is clear from the difference in quality of service (and hours of operation) at a DMV in the city versus a DMV in a fairly well to do suburb.

Anyway, they actually give you a plate on the spot. Mine starts with 'TDB' which I figure must stand for 'The Dark Beast.'

3 comments... | link

the tri-lambs (λλλ)

Apr 1, 2006 @ 00:28

Ha! Learning Scheme in CSci 1901 proves useful! Somewhere deep in the recesses of my mind, functional programming knowledge endures. It's a good thing I paid attention in that class. Actually, out of the 150 or so students taking the class that semester, I got the highest grade. (The prof emailed me to tell me. You rock Maria!) So I did a little more than just pay attention.

Man, I used to be so awesome... what happened?

Anyway, I'm writing a widget for the OS X Dashboard. Typically these things are written in Javascript, and I discovered an interesting language problem...

I have count <div>'s, and each one has a unique number associated with it. When I click on the <div> I need to know the unique number of the <div> that was clicked... and I'm creating these things dynamically by adding them to the DOM. I'm not doing any document.write() crap. So, I thought I'd be clever and when I create the <div> I will overwrite its onclick method with a lambda function that calls my clickHandler() function while passing in the unique number for the <div>. Something like this:


for ( var i = 0; i < count; i++ )
{
    var div = document.createElement( 'div' );
    div.onclick = function () { clickHandler( i ); };
    container.appendChild( div );
}


That looks like it should work. Seems logical. The problem is that clickHandler( i ); is the body of a function, so it is not evaluated at the time of this assignment, and the i is not evaluated to its numerical value. It remains a reference to the variable i in the scope of this for loop.

What does that mean? Well, every time clickHandler() is called, i has the exact same value, since it is a reference to the same variable. i evaluates to count to be exact, because that is what i equals at the end of the for loop.

So shit, what do I do about that? I was initally wondering about dereferencing i to its actual value, but that wouldn't have mattered because the dereference also wouldn't have been immediately evaluated. There would have been the same problem.

Luckily, the solution just popped right into my noggin! Another lambda function ... that returns our first lamda function! So this is what it needs to look like:


for ( var i = 0; i < count; i++ )
{
    var div = document.createElement( 'div' );
    div.onclick = ( function ( i ) { return function () { clickHandler( i ); }; } )( i );
    container.appendChild( div );
}


So what the hell is going on there, and how does that work? Well, lets look at this part first:


function ( i ) { return function () { clickHandler( i ); }; }


So there we have a lambda function that takes one argument i, and this function returns our original lambda function. Yeah... you can do that.

But we don't want to override the <div>'s onclick method with this new lambda function! Because if we did, rather than calling clickHandler() when we click the <div>, instead you'd be creating lambda functions when you click... and that's just crazy (or genius... click to create functions... hmmmm).

Actually, we want to call/evaluate this lambda function in place, so that it returns our lambda function whose body calls clickHandler() and that gets assigned to the <div>'s onclick method.

You're getting all this right?

And the way you call a lambda function in place is by slapping some parens around it, pretending that is a function name, and then adding on the usual parens with args in them at the end. Here, let me give you an example:


function mySquare( n )
{
    return n * n;
}

mySquare( 3 ); // will return 9


So that's a named function, and here's the same thing using a lambda function:


( function (n) { return n * n; } )( 3 ); // will return 9


You get it now?

Anyway... I've totally gotten away from the point. The magic part is that passing i as an argument into the new lambda function we wrapped around our original lambda function means that i gets evaluated at that moment! And so the lambda function returns our original lambda function with a new i in its scope that has the correct value of i. Problem solved!

I totally rushed through the important part, didn't I?

5 comments... | link

Older entries...