Skip to main content

Technologies related to the web.

JavaScript Closures and Loops

Submitted by Xenoveritas on
Topics

JavaScript closures can be kind of weird. The way a closure works within a loop is a fairly common "gotcha" because it doesn't work in the way that it intuitively feels like it should.

Take the following block of code:

for (var i = 0; i < 5; i++) {
    var button = document.createElement("button");
    button.innerHTML = "Button #" + (i + 1);
    button.onclick = function() {
        alert("You clicked on " + button.innerHTML + "!");
    };
    document.body.appendChild(button);
    document.body.appendChild(document.createElement('br'));
}

What does that do? Read More to find out.

Roger Ebert has died

Submitted by Xenoveritas on
Topics

Roger Ebert has lost his battle with cancer and died today at age 70 - and I'm actually really saddened by this. I've followed his Twitter feed for ages - in fact, assuming Twitter lists people in reverse order that they were followed, he's the fourth person I followed on Twitter. (Minus any I've unfollowed, of course.) For a while he was pretty much the only reason I ever even bothered to check Twitter.

Colossal Cave Adventure web port version 0.10

Submitted by Xenoveritas on
Topics

I've updated my Colossal Cave Adventure JavaScript port. It fixes a few bugs related to the Plover room, but probably more importantly, adds the ability to save the game. Save games are done by creating a new link that can be bookmarked. The URL can be loaded in order to restore the game to whatever state it was at when the game was saved.

Heh

Submitted by Xenoveritas on

I know I'm not the only one this is happening to, but it's still amusing:

Apple's website returning a HTTP 403 Forbidden error

Update: Just to be clear, this happened immediately after the iPhone 4S was announced (October 4th, 2011), but before Steve Jobs's death (October 5th, 2011). Note the time stamp.

Restaurant Website Nightmares

Submitted by Xenoveritas on
Topics

After watching an episode of Kitchen Nightmares (sadly the US version, the UK version is better), I decided it might be time to try and get some takeout from one of the many local restaurants in my area.

Unfortunately, I am a bit of an "introvert," and therefore don't know anyone in my area and know next to no restaurants. So to Google Maps it is to look at local pizza places.

That finds me today's entry for "Restaurant Website Nightmares," Jimmy's Pizzeria.

Facebook.net NoScript Surrogate Script

Submitted by Xenoveritas on
Topics

This is only for blip.tv, but as of now, if you have NoScript set to block Facebook.net, you won't be able to view videos on blip.tv.

Thankfully, there is a feature in NoScript called "surrogate scripts" that allows NoScript to substitute a script stub to make things work on websites even if a given domain is blocked. So all I need to do it write a surrogate script to implement the functions it needs.

It turns out blip.tv doesn't work because a single function is missing: FB.Event.subscribe. So the entire surrogate script is:

Screw Theora

Submitted by Xenoveritas on
Topics

Seriously, screw Theora. None of the tools work. Really, there's no reason to go beyond that at all. ffmpeg can't create working Ogg Theora files for no discernible reason. The makers of Theora don't provide an encoder, so it's not like you can just use theirs! The only working Theora tool appears to be ffmpeg2theora - which is completely useless because it can't be used to remux streams.

The one thing Xiph does provide, a tool for creating Ogg streams, doesn't create working streams. Making it completely useless as well.