Wednesday, July 05, 2006

One more flight of stairs to the Snickers bar… on learning things the hard way

I decided that if it was too much for me to haul myself up the 3 flights of stairs to the candy vending machine, I probably didn’t need that Snickers bar. I mean, it’s not honestly that I like Snickers, it’s more like I thought to myself that the nutrition of a Snickers bar was likely better than that of a Milky Way – because of the peanuts’ protein.

Anyhow, what’s this have to do with code? Well, like most systems librarians, I fell into the trade because of an affinity for computers and by that, I mean only a lack of fear, not some vast stores of knowledge from a previous career in IT or anything of that sort. So over the years, I’ve moved from the training wheels version of computing environments to the automobile version.

This slightly fractured trail to library web work means that I’ve missed some webmaster 101 stuff along the way. The way that I’ve learned my trade (to the degree that I have thusfar) is to force myself to walk that figurative 3 flights of stairs – even though I really don’t want to. For example, I never thought that I’d really need to know how to hand-code html – heck, I had my own personal website on Geocities and it didn’t require html knowledge to create it! I never thought that I’d really need to know command line UNIX or its lovely vi editor. You get the picture. At some point or another, though, I ran across a need. And at that point, I forced myself to do the ugly blow-by-blow learning of those technologies. And everything I’ve learned at one level has somehow helped me at the next.

As I’d mentioned in my last entry, using the feed to javascript server at Maricopa wasn’t working out for me very well. I mean, it worked, and I was grateful. It got me started, but then the response time was poor – the feed loaded ever so slowly into the body of the web page. And then the server out there went offline (I think), so when the page finally did load up, the major portion of it was blank. Very bad! So I used the RSStoHTML ByteScout ASP code to pull in my WordPress blog-based feed and display it in the body of the webpage (see http://www.cslib.org/new.asp) Then I wanted to tweak how it displayed. Primarily, I wanted the hyperlinks in the body of the blog entries to be fed into the webpage as hyperlinks, not as plain text. I looked into the code – both the ASP and the XML of the RSS feed - and eventually spotted the XML tag that the script was calling upon – I noticed that it was the plain text version of the entry. Within the RSS feed, however, there was another tag that enclosed an encoded version of the same entry. The encoded version had the appropriate hyperlink information in it. So I changed the ASP code to call on the tag of encoded content. As I worked on the script to tweak the display of the RSS feeds just a little more, I ended up with a script that was hanging up the server altogether.

What was causing the trouble? I went through the script code – couldn’t see anything really odd. Then I remembered to look at the quotation marks and – sure enough – in the body of a bit of code that was within another set of quotation marks – I’d put double quotes – instead of singles. Could that have made the difference? Previous experience has taught me that the code often lives and dies on issues so seemingly minor as this – so I replaced them with single quotes and voila! The whole thing worked… Would I have known how crucial the quotes might be without a history of making myself learn seemingly arcane and detailed technical skills – probably not - so all of that forcing myself to traipse up the stairs was worthwhile! Now time out for that candy bar…

No comments: