“I made this my rule: When the Lord commands, do it.†~ Joseph Smith: http://tr.im/mAqF
Archive for May 2009
The Harold B. Lee Library recently started streaming music to one section of the library.One of the questions we’ve gotten since providing this service is, “Where can I see a list what is playing?”. I figured it was somehow possible and a friend helped me figure out how.
We use iTunes to stream the music to the ‘Music Area’ (clever name) of the library. Last.fm, through their ‘Scrobbling’ software, provides access to an RSS feed of your latest tracks. Here’s my recent tracks feed. (Insert your last.fm user name in the url to get your own feed.) Once I installed the Last.fm application on the remote computer, our feed started working instantly. That was step 1.
Step 2 was to get that feed published on a library page for easy advertising. Thankfully, jQuery has a plugin called jFeed. It does what you think – parses the RSS XML so you can output it as HTML – tada! That was relatively easy – they even provide a method to overcome cross-domain scripting woes. Step 2, Check!
Wait! The timestamps are 6 hours off! What?! I don’t know why this happens but I’m not the only one. But I assume that the 6 hour difference is consistent and create a fix thusly:
var timestr = Date.parse(item.updated);
var newtimestr = timestr - 21600; //subtracting 6 hours (in seconds)
var timeago = jQuery.timeago(new Date (newtimestr)); //this is explained in the next paragraph
Everything is now working fine and I could have left well enough alone, but I didn’t. The feed was displaying, the links back to last.fm were working, everything was special. However, I didn’t like the format of the datestamping: Tue, 19 May 2009 22:50:43 +0000. This is the standard date format for RSS publishing. And it is a great format – for computers. However, I wanted to display it in a human friendly way.
Enter timeago. Timeago is a jQuery plugin that does magic – it takes the loverly, aforementioned GMT timestamp and turns it into this: 7 minutes ago. That’s a lot more human friendly. And since I have more humans than computers as friends, I went with that option.
Obviously, this would have been easier for some to do in PHP. And it probably would have made more sense. Maybe someday I’ll do that.
![]()
I am excited about the future of the internet. It’s done amazing things in it’s short lifespan and the future is looking even brighter.
One of the bright spots in that future is the semantic web. At this point, the best thing I can do for you is share a video to explain it. Here’s my favorite:
The Semantic Web, In English from james levy.
So what is my contribution to this illustrious future? A WordPress theme, of course!
We’ve been using Microformats at the Harold B. Lee library for a couple of years. Recently, we even built a Ubiquity script to make use of that valuable markup. At Web Directions North, I met Manu Sporny, an advocate of RDFa, another flavor of semantic markup for the web. That meeting led to the opportunity to design and build a skin for the RDFa blog.
Since, RDFa and the semantic web is about the future, I built a lot of forward looking functionality into the design. I built a 9 column, fluid grid. I’ve been enamored with the work of that unstoppable robot ninja, Ethan Marcotte. He recently blogged and otherwise published on max-width fluid grids. I think these are brilliant. They provide the readability of fixed-width with the flexibility of fluid width. If you shrink the browser width, the design accommodates accordingly. Increasing or decreasing the font size further illustrates it’s flexibility.
There are other forward-looking details. I’ve included drop shadow on the RDFa text (visible in Safari). I’m using css columns in the footer (sorry IE users). I’m using @font-face with the lovely Museo Sans for titles and other details. I used these features, not to slight certain browser users. I generally try to accommodate as many browsers as possible (I do work for a library!). But for this site, I wanted to push the edges. I wanted to be thinking about the future – that’s where the value of the semantic web lies. We don’t get immediate returns on our investment in semantics; those returns come down the road as we continue to build for the future. The design of this site, in small ways, will improve as browsers adopt new standards.
Now, if I could only take the time to design a decent theme for my own site…