Archive for May, 2009
This phoku was looking for the fabled front-door straits
Saturday, May 30th, 2009It’s all about context
Saturday, May 30th, 2009
One big selling point of jQuery – so everyone says – is the ability to nest/chain selectors, so that using oen string you can, in theory, pick out any element in the DOM. But this has eluded me somewhat until today; until I realised the usefulness of setting a context for jQuery selectors.
I noticed a few days ago that my new crossSelect plugin was a bit inefficient, in that it queried the DOM far too often. It used to have something like the following code:
$(this).parent().parent().find('.target1').children('li')...
$(this).parent().parent().find('.target2').children('li')...
But the next iteration was going to have something like this instead – far sleeker.
var context = $(this).parent().parent()
$(context).find('.target1').children('li')...
$(context).find('.target2').children('li')...
But it bugged me that I couldn’t pick out the <li>’s with a string selector. This is because context is an object, not a string, and therefore can’t be a part of a selector string. But then I discovered setting the context on selectors (easy to miss as it’s not linked to from the selectors bit of the documentation site). So that led to the following:
$(context).find('.target2').children('li');
is equivalent to
$('.target2', context).children('li');
which can be rewritten
$('.target2 > li', context);
Far more elegant, I think you’ll agree. So it’s jQuery context setting all the way for me. From now on I will only use find when I need to find a child element on the same line that I’ve already done something to the parent; it really has no place at the begining of a line of jQuery code.
This phoku had such lofty ideals back then
Thursday, May 28th, 2009crossSelect jQuery plugin
Wednesday, May 27th, 2009
I thought I should write a short post to say I have written another jQuery plugin, for making multiple select form elements more intuitive to use. It’s called crossSelect, and here is a demo.
One of these days I will make a proper portfolio site/subsite which collects all the stuff I make together.
I will, I will, I will!
This phoku has no need for polari and right ear earrings
Tuesday, May 26th, 2009iSproggler – an elegant scrobbler for a more civilized age
Monday, May 25th, 2009
I like Last.fm. I really do, though I don’t use it as much as I used to, for trivial reasons (where I work at the moment my PC’s box is a tower on the floor, rather than on the desktop, so my headphones don’t reach). But despite not using the website to listen to music, I do still want it to record what I listen to, partly because when I do start listening again I want it to have up to date information on my music tastes, and partly because I’m a bit of a geek and like to check every now and then if Elliott Smithis still my top artist in figures as well as in esteem.
But Last.fm does have one major annoyance. The Last.fm software for scrobbling information about the music you play to the website is far more bulky than needs be. It contains a player (not really necessary now they’ve introduced the ability to play straight from the website), and also reminds you incessantly to download plug-ins for every mainstream media player you have, even if you only use one, and as you can’t uninstall Windows Media Player, this means a lot of updates of no benefit to you. It also requires updating very frequently and will remind you every time you start iTunes, thus disrupting the mood that put you in mind to listen to some music in the first place.
I needed something better. And I found it.
iSproggler is a little application developed by some Last.fm user(s) which is a bare bones sproggler for iTunes. If you set it to run when windows opens it will send all your listening data to Last.fm and nowt else. It’s reliable, discreet, uses a fairly small amount of resources, and most importantly never nags you to be updated; exactly what the Last.fm software should be like. Also it’s name, as I’ve just discovered, is rather humorous, be it deliberate or not.
It does however have one minor setback – every time you close iTunes it asks you to click OK, but even though this happens every time (as opposed to the Last.fm software reminding you to upgrade only until you upgrade it) it bothers me a lot less as it doesn’t delay my listening to the music I’ve decided would suit the moment.
To download it you need to join the iSproggler group, but it’s a small price to pay.
This phoku wouldn’t trade his silk worm’s life for anything. Not even a chow mein.
Sunday, May 24th, 2009Avoiding using a list when a table won’t do
Sunday, May 24th, 2009
The other day I neglected to mention how I had resolved the list/table dilemma on the site I’d been working on.
As I explained, the content fitted the semantics of a table more than that of a list, but Internet Explorer’s bugs in applying positioning to <tr> tags (up to and including ie8) prevented me from using a table to implement the design.
Or did it.
In the end I had two choices of mark-up for each item in the list:
<ul>
<li><h3><a title="Blue Reef Resort" href="duikhotel/Egypte/
... marsa_alam/Blue_Reef_Resort">Blue Reef Resort</a>
</h3>
<ul>
<li>All inclusive</li>
<li>8, 15 dagen</li>
<li>Marsa Alam</li>
...
</ul>
</li>
</ul>
or
<tr>
<th colspan="3" scope="row">
<a title="Blue Reef Resort" href="duikhotel/Egypte/
... marsa_alam/Blue_Reef_Resort">Blue Reef Resort</a>
</th>
<td class="rating">
<img alt="4 stars" src="/img/star4.png"/>
</td>
</tr>
<tr>
<td>All Inclusive</td>
<td>8, 15 dagen</td>
<td class="location">Marsa Alam</td>
<td class="price">vanaf €399</td>
</tr>
The second example, combined with appropriate column headings, I figured gave the closest approximation to the real table structure of the content. And the presence of a <th> every other row does suggest that rows are to be taken in pairs (though I’m not sure this is any help to screen reader users).
The above means, I think, that I am closer to web design zen. I have rejected the false grail of table based design, and only now that I have mastered CSS and semantic structure can I claim to understand the table and start to mold it to my enlightened purposes.
Bright eyes
Saturday, May 23rd, 2009
Occasionally I come across a band I know I should like, but inexplicably don’t. And when that happens I desperately try and make it explicable.
Bright eyes are one such band.
I should like them because they play lo-fi folky American indie with rambling, cleverly rhyming lyrics, and sung by someone with a cracked, melodic though far from opera-standard voice. There are countless bands I love that share most or all of these qualities – Pavement, Grandaddy
, Arcade Fire
, Elliott Smith
, Jim White
, Lambchop
, Ryan Adams
and, at a stretch, The Flaming Lips
, Devendra Banhart
… and I could go on.
So why are Bright Eyes crap?
I only studied music until the age of 16 (though considered taking Music A-level, but was dissuaded by the reputation of the music teacher for being the musical equivalent of someone who’s read a lot but isn’t well-read, a reputation that was borne out the following Christmas when I listened to his choir deliver a stultifying performance of Gaudete Christus est natus to a load of pensioners who could probably have done without a further slowing of their heart-rates. (Incidentally, Youtube is full of godawful versions so maybe I was spoilt by the version my Dad had on tape when I was growing up. The version I linked to here may be a piss-take of monks with homoerotic overtones done by boys in hoodies, but the music they decided to have as the mime track is probably the best on youtube, and a damn site better than the bloody Mediaeval Baebes. Don’t people know it’s supposed to be an impassioned call and response?!))
But I digress. I only studied music briefly so can’t really analyse Bright Eyes in detail, and neither would I want to because, as I think I’ve already mentioned, they’re crap. But I think the main thing about them that annoys me is the lyrics. For instance:
So you nurse your love
Like a wounded dove
In the covered cage of night
Every star is crossed
By frenetic thoughts
That separate and then collide
And they twist like sheets
Till you fall asleep
And they finally unwind
It’s a black balloon
It’s a dream you’ll soon deny
“But what’s wrong with those?”, I hear you ask.
“Exactly!”, I respond, “Nothing!!!”. They’re flawless. The whole song is flawless. Every line throws a new, pertinent, and frequently unexpected image at you, and they all interconnect and build on each other perfectly. I wish I could still write lyrics as consistently good as that.
And that’s what’s wrong. It’s too consistent. It’s incessantly, blood-thiningly earnest. I feel like screaming at them “For God’s sake, please throw in a line that sounds deep but probably means nothing, so I can get away from this feeling of listening to overwhelmingly competent, sensible words. Or write something trashy and throwaway. But please, please stop trying to be taken so seriously!!!”
The music too has a similar feel. There’s very little risk taking. It’s lo-fi American indie by numbers. And it’s so good it’s crap.
As a footnote, their website also tells you what screen resolution it is best viewed at. Turgid.
My advice – have a listen to Pavement




