Matthew Hutchinson

about

Matt is a web developer from N. Ireland. He currently runs Hiddenloop and works in Dublin. Want to find out just a little bit more ?

An audio feed is available for the latest articles at matthewhutchinson.net, find it here.

Mephisto filter:mp3

posted 5 months ago in , ,

On my to-do list for some time was implemting Jeroen Wijering’s mp3 player (flash) in this blog as a mephisto filter.

Somewhere between the sessions of @media yesterday, I found the time to code it in (grab it , there are some steps to follow at the top of this file). It has sensible defaults, and configuration attributes. Now including tunes in posts is as easy as;

< filter:mp3 id="my-tune" mp3="/path/to/tune.mp3" / >

You can place alternate content inside the filter tag (e.g. a direct link to the mp3). Here are some examples;

Photo Booth, by Ola Podrida

Or even a playlist of tunes with links etc.

Bubble Gum, Mr. Loco Let the Music Play, by Shannon Goonies R Good Enough, by Cindy Lauper

While the code degrades well with flash/javascript off in the browser, some work needs done on what shows up in feedreaders. The filter could be amended for RSS feeds and simply show a link to the mp3 file(s) being played. If anyone finds this filter useful, let me know.

Lightboxing, Control.Modal style

posted 7 months ago in , , , ,

You might have noticed a minor style change in the most recent blog entries. I’ve decided (from now on) to use a light-box for showing off any embedded videos and (biggish) images on the page. It keeps the layout tidy and allows you to focus on the video you’re watching or image your viewing, without distraction. So I can do things like this for images;

And even stuff like this, for videos

All of this is made possible using Control.Modal, a light weight, unobtrusive JavaScript library for creating modal windows and lightboxes using content that is already on the page. So with javascript turned off, everything still works, with the links navigating to anchor tags in the page.

At the moment I am applying display:none; on the modal content to avoid a visible onLoad jump effect as the content gets hidden by Control.Modal javascript. I’ll be changing this (since doing this hides the content when javascript is off, and CSS is on) – There’s also a small bug with the tv-icon link style on IE6.

In Mephisto, I was able to create my own custom ‘Modal Macro’ filter, so I can easily apply the effect to any content in my articles. Here is the code for doing just that. Save this as modal_macro.rb in the lib/ folder for any new or existing vendor/plugin. As usual, any comments, questions or suggestions are appreciated.

Mephisto Gravatar Caching Plugin

posted 8 months ago in , ,

I have managed to turn my work at gravatar caching into a little plugin for Mephisto. Its available to install via subversion like so:

ruby script/plugin install http://svn.hiddenloop.com/public/plugins/mephisto_gravatar_cache

You can browse the source code and the README file, which describes how to install and configure it. Although the plugin will work out of the box with it’s default settings.

Given the nature (and newness) of the Gravatar service, its (highly) likely that they may change their usage instructions again. I originally came across some gravatar caching code from a Daniel Haran – it worked with the old gravatar API, which is no longer available.

This new plugin works in a similar way (wget’ing the images) – however – to check an email has a gravatar at all, a request is made to gravatar.com (with a default no-gravatar image). If a 301 (redirect) is found on this request – it is assumed that the user has no image to fetch. The plugin also includes a rake task (for use in a cron job), image expiry time and other configurable class settings for caching options.

While this plugin is a Mephisto Gravatar Cache plugin – with a little modification it could work for any Rails application. The rake task ‘cache_gravatars’ would need to be modified, and a call to cache_gravatar made on any email addresses.

I have tried to comment my code as best as possible, to encourage further development. Please report all bugs and/or submit patches to me at this post. Your comments, criticisms and thoughts are welcome.

—Update – Curtis at millarian.com has recently played around with this plugin and fixed some bugs. I’ll be sure to update the repository soon and add some more tests. This was my first plugin release and something I coded rather hastily.

OpenID

posted 8 months ago in ,

Maybe I am a bit late to the party, but OpenID seems to have made a surging comeback in the last month or so, not least in the Rails community. Its something I am looking to implement on a few projects of my own, and luckily (with Rails) I won’t have to re-invent the wheel. Here are some useful links on the matter:

Last year during @media2006, Mr. DHH questioned whether login/signup (and managing multiple usernames/passwords across the web) was such a big problem after all. With modern browsers capable of remembering passwords and client side tools to take care of the matter. He does seem to have changed his tune on the matter now. You can see how 37 Signal’s new HighRise application handles it (with a small unobtrusive link in the login box corner).

For some more discussion on the good/bad aspects of OpenID, we have:

One awkward part of OpenID at the moment, is the use of a URL to login with; to the average user this has to be a bit confusing. With that, and few major sites offering OpenID support, it may be a while before it takes off across the web.

Behind the scenes

posted 8 months ago in , ,

Maybe youv’e noticed, maybe you haven’t, but quite a lot has changed at this site in the last few days. Its all behind the scenes work though, with the exception of a few style changes and new pages here and there. So what’s new;

  • Switched from Typo to the much better, Mephisto
  • Microformats have been applied to all entries (hAtom)
  • My updated footer profile and all comments have also got the hCard treatment
  • Pagination on old entries has been removed and I’ve got an archive for anything posted way back when. There is also a new tag cloud page
  • The entire layout is a bit more liquid (in more ways than one) Its now fluid rather than fixed – (drag your browser width) and built on liquid templates (part of Mephisto) There is a min-width defined – which (of course) falls over on narrow IE6 pages :(
  • Gone are the old AJAX comment submissions (in Typo) and AJAX on ‘search-as-you-type’ has also been removed.
  • I’ve added my own code to handle Gravatar caching, which was very easy to bolt into Mephisto. I’ll probably do another post on how this was done soon.
  • I’ve upgraded the server to the latest Lighttpd 1.5 RC. With the new mod-proxy-core module, it means I no longer have to work with a mongrel-pound-lighttpd stack. The site is just served straight-up, from Lighttpd to 3 Mongrels.
  • As usual the newer ‘more about me’ page still needs more work.
  • Last but not least, error pages have got a Batman inspired makeover.