Archive for June, 2008

One Hundred Pushups

Thursday, June 26th, 2008

First post in a while - it’s hard to find time between work and school and not alienating friends.

Anyhow, I’ve just started the One Hundred Pushup Challenge. The idea is that through thrice-weekly sessions over a 6 week period, one can develop the ability to do a hundred consecutive pushups.  It’s a not-so-modest number for me - my initial test put me at an astonishingly bad 7, which is quite weak for a 23-year-old 6-foot tall male.  So I’m hoping this specific goal (which incidentally is a SMART objective) will be explicit enough to motivate me to complete it.

I recommend it so far, it feels good being on the path to accomplishing something, even something so modest. Does anyone else care to join me?

Christmas on Mars Review: Eat Your Own Spaceship

Sunday, June 1st, 2008

Last weekend I attended the Sasquatch Festival in Gorge, Wa., and it was fantastic. 3 days, 72 bands, but one thing stood out for me, and that was being at the second showing ever of Christmas on Mars, the Flaming Lips’ movie. I would have been at the first, but the oompa-loompas in construction suits neglected to mention that we needed tickets.

The movie itself was shown in a big circus-style tent, complete with fog machines, lasers, and Wayne Coyne, the Lips’ ever-enthusiastic frontman, in attendance. In front was a large poster reading “Eat Your Own Spaceship,” and the tickets read the same. I’ll try not to spoil anything, but just in case anyone is really concerned I should put, in big letters:

MILD SPOILERS AHEAD

The movie was not at all what I expected. I had not watched any previews that existed, although the friend I went with had. I was expecting some sort of rock opera, or something of the such, or something more whimsical, and while there was arguably a great deal of whimsy, the end result is a far more jarring film than I had anticipated.

The film started with an announcement from Wayne about the film, specifically about how loud it would be. It was explained that this loudness was to increase the intensity of the film, and I must say it worked — I was in a constant state of sensory overload throughout the film, and sitting through it was actually a fairly uncomfortable experience, which isn’t to say I regretted it. The film featured many disturbing hallucinations suffered by the protagonist, accompanied by loud, dissonant synth chords, and by the end of it I was feeling rather lightheaded. It was certainly an experience I would encourage to anyone, once, but not something I’m eager to repeat, at least not at full volume. Intense is the word.

It’s difficult to critique the acting or the plot, because neither of these things were really the point of the film. It was designed for interpretation, which I will avoid at this time because I don’t want to spoil anything.

At the end of the day, I still view the movie as one big old mindfuck, a thoroughly memorable experience that I would recommend to anyone save the infirm and pregnant, just for the experience.

Javascript Tip: Use the rel Attribute

Sunday, June 1st, 2008

In HTML, <a> and <link> elements have a unique attribute, “rel.” Rel has practically no use in plain HTML these days, but with some creativity it can be an excellent hook for javascript events. This will provide you an unobtrusive way to change the behavior of these elements, without requiring “javascript:” links or onclick calls be written directly into the html.

Implementation:

var getElemsByRel = function(rel){
    aElements = document.getElementsByTagName("a");
    relElems = [];
    for (i = 0; i < aElements.length; i++) {
        if (aElements[i].hasAttribute("rel") && aElements[i].rel == rel) {
            relElems.append(aElements[i]);
        }
    }
	return relElems;
}

Case Study

Lightbox.js uses this to great effect: Any links with rel=”lightbox” activate the script, causing the image display to pop up with the target of the link as the image to display.

To accomplish this is very simple; for each element with the target rel attribute, one adds an onclick attribute that calls the function of one’s choosing, and - importantly - returns false, so that the link is not followed. As an added bonus, this technique fails extremely gracefully; if the javascript isn’t executed, the link is followed and the image is simply displayed in the browser.

Using rel in this case solves the problems of storing some relevant information in the link, forgoing the insertion of javascript into the markup, and providing some sort of semantic information in the markup as well.