Posts Tagged ‘JavaScript’

Word Jumbling ‘Experiment’

Posted in 'Cool Stuff, JavaScript' by James on January 16th, 2009

Apparently it started back in 2003 but it only came to my attention about two years after that. It’s since been labelled as an internet meme which is interesting because the first time I saw it was on a poster at a train station near London, not on the internet! If you’re wondering what "it" is here you go:

Aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it deosn’t mttaer in waht oredr the ltteers in a wrod are, the olny iprmoetnt tihng is taht the frist and lsat ltteer be at the rghit pclae. The rset can be a toatl mses and you can sitll raed it wouthit porbelm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe.

Assuming you have no reading impairment understanding the above block of text is supposed to be easy, in fact most people (apparently) don’t notice that it’s jumbled until half way through. Here’s the un-jumbled version:

According to a researcher at Cambridge University, it doesn’t matter in what order the letters in a word are, the only important thing is that the first and last letter be at the right place. The rest can be a total mess and you can still read it without problem. This is because the human mind does not read every letter by itself but the word as a whole.

According to Matt Davis, who works at the Cognition and Brain Sciences Unit in Cambridge no such study (to his knowledge) has ever taken place. See his article which covers it all here: http://www.mrc-cbu.cam.ac.uk/~mattd/Cmabrigde/

Anyway, to test this ‘myth’ for myself I wanted to experiment with some more realistic everyday sentences, but me, being so lazy could not be bothered to manually jumble up letters so I did a google search for a ‘word jumbler’ and ‘letter jumbler’. Neither search gave me what I was after so I decided to create a little JavaScript ‘program’ to do it for me.

Bookmarklet: ‘Let me Google that for you’

Posted in 'Cool Stuff, General, JavaScript' by James on December 1st, 2008

I’m sure none of you have missed the recent hype surrounding the new ‘Let me google that for you’ initiative, but for those who did miss it here’s what it’s all about, from the site:

This is for all those people that find it more convenient to bother you with their question rather than google it for themselves.

I think it’s an awesome idea and I’m already making use of it… it’s so much more fun to retort with a LMGTFY URL instead of the everyday "Have you tried Google?"! :D

I’m quite lazy and can rarely be bothered to go to the LMGTFY website so I created a cool bookmarklet which will let you enter a search phrase then it will go off and get a shortened version of the "let me Google that for you" URL. (It’s shortened so that when you post it on a forum/IRC/chat the recipient won’t know what hit ‘em until they click on it!)

You can try it out now by clicking this link:

Let me Google that for you!

If you want to keep it then drag the bookmark up to your bookmark panel/toolbar. (Or right-click to add to favourites).

UPDATE: The above bookmarklet doesn’t appear to work in older browsers and is a little bloated. I’ve created a much simpler one which will alert the shortened LMGTFY URL:

Let me Google that for you! (simpler)

Let me know if you spot any bugs in the second one (the simpler version) – it should be working in ALL browsers.

Some jQuery Shortcuts

Posted in 'JavaScript, Usability' by James on October 31st, 2008
Some jQuery Shortcuts

Having used jQuery on a number of projects I’ve picked up a few handy shortcuts that are definitely worth sharing. There are no secrets here, just basic jQuery techniques discovered with the aid of the jQuery documentation. If you have any which you think are worth mentioning then please feel free to leave a comment.

Checking if the DOM is ready

Running code when the DOM is loaded and ready for manipulation is a popular requirement. The ideal solution is to place all initiating code at the bottom of your document (as per Yahoo’s "Best Practices for Speeding Up Your Web Site") but sometimes this is not possible. The next best alternative is to use a solid ‘DOM ready’ function such as the one jQuery offers. You normally access it like this:

$(document).ready(function(){...});

There’s a quicker way of accessing the same functionality:

$(function(){...});

Creating elements

There are a few different ways of creating elements, this is my favorite:

$('<div />').appendTo('body');

Alternatively you could take this route:

$('body').append('<div />');

Notice that you don’t have to write out the entire element. Even though DIV elements cannot have self-closing tags it’s still fine to specify it like above – JQuery will know what you mean.

Solving Twitter’s URL posting issue

Posted in 'JavaScript, Twitter' by James on October 25th, 2008
Solving Twitter’s URL posting issue

I’m one of the few people on this planet still using the Twitter web interface. I just cannot be bothered with any of those Adobe Air clients, they seem too intrusive. Twitter isn’t so great that it deserves it’s own process in Windows (sorry Twitter!). Plus, if I was using a client I’d feel like I’d have to tweet about every tiny insignificant thing that happens, which, although it is the point in twitter, would be a massive waste of time!

There are a few things which annoy me about the web interface though. The worst thing by far is that it’s very slow and sometimes just doesn’t work. There are also some posting issues; if I have a really long link which I want to share, it won’t let me press the "update" button (because my tweet is now over 140 characters) – but I know that Twitter will convert the URL to a tinyurl which will surely result in a tweet shorter than 140 characters but Twitter still insists on disallowing this action!

Cannot update Twitter

I got really tired of this, twitter wouldn’t let me tweet even though shortened versions of posted URLs would fit into the 140 character limit quite nicely! Out of desperation I decided to create a cool little GreaseMonkey script which solves this problem.

You can install the script here – (Sorry, it’s Firefox only, duh!)

JavaScript libraries vs. Usability

Posted in 'JavaScript, Usability' by James on October 18th, 2008
JavaScript libraries vs. Usability

JavaScript libraries like MooTools, jQuery, Dojo and Prototype have proven very popular with developers recently, perhaps too popular!?

Over the last year there’s been a major recognition boost for these libraries, especially those featuring animations/effects and Ajax capabilities. Blinking/fading/sliding text was in fashion back in the nineties but it seems, following the hype of Web 2.0, these effects have made a massive comeback!

To be honest I think it’s great; what better way to expand the imagination of the average developer than to give him/her some brand new toy to play with? Web developers are now thinking of innovative ways to utilise these new-found JavaScript enhancements and designers are pushing boundaries with their designs, integrating these enhancements into their mockups!

This is all wonderful, but unfortunately I fear the overuse of JavaScript libraries such as jQuery has had a detrimental effect on usability. Obviously we had issues before these libraries and we will surely continue to rave about it afterwards but I cannot help but notice what is happening right now; people are turning a blind eye to usability and focusing all their attention on making their websites as smooth and swish as possible!