Clever Humans

Logo

Clever Humans do the darnedest things!

Categories

18 January 2008

Site Redesign

by Patrick

Well, I got the first part of the site redesign done. At the least, all the content I wanted to put in place is now where I want it to be, even if it is not as pretty as it can be. I wanted to put my most recent post (which, um, should be this one for a couple days) on the home page. But I wanted to do it in the laziest way possible. My home page is just a vanilla html page. No server side code at all. So anything I did would have to be done in JavaScript. I checked out the dasBlog APIs, but they were decidedly unhelpful. The webservices cannot give me useful things like the most recent article from the site.

So I turned to the last possible way to get at the data, the RSS feed. Ok, it wasn’t the last possible way. I mean, when you think about this in server round trips (which I will spell out in excruciating detail in a moment), this whole thing is a bit absurd… but remember, I am being lazy here. So, I could write some JavaScript to do an http Get on the RSS url, then I could parse the Xml, and then display the most recent post.

That is decidedly *not* the lazy way to do things. Lazy meter is red lining. Instead I figured someone must have written code to do exactly this already, and surely I could just use what they’ve done. And lo and behold, two seconds of googling and I found two different sites that do this. My lazy meter was moving back into the green!

I settle on Feed2JS.org, a site that will take any RSS feed, and automatically generate the JavaScript necessary to turn that RSS feed into displayable text on your website. Yay! A couple button clicks on a very easy to use User Interface and I had my JavaScript generated. Slap into my home page, upload the whole thing, and I am done! Lazy meter pegged firmly in the “sleeping in till noon” category.

Of course, you might rightly point out that this is not the most efficient way of delivering this content. Here is a diagram how the home page gets to you after you request that page:

Step 1, your request goes to the CleverHumans web server.

Step 2, the page goes back to your computer. Simple right? In a sane world, this is where it would end. But, no!!! I gotta be lazy so…

Step 3 and 4, JavaScript on the home page requests an RSS feed from the Feed2JS servers.

Step 5 and 6, the Feed2JS servers then request the RSS feed from the CleverHumans site (the site you started at, remember).

Step 7 and 8, the Feed2JS site then takes that RSS feed and turns it into formatted text that is finally displayed on your computer for reading.

Crazy right? You should see how I cook my toast.

tags: meta - programming