Posts Tagged javascript

Some thoughts on JavaScript

I don’t know about you, but I grew up doing image rollovers in JS and other groundbreaking “dhtml” stuff. Since then CSS has evolved, web standards and browsers have evolved, and things are much much nicer than before.

One thing that is starting to change is the way we fundamentally approach javascript. Not simply the recent popularity of libraries such as jQuery, allowing us to literally “change the way we write javascript”, but also there’s now much more awareness of the power that javascript has, and we’re doing more mission-critical stuff with JS. We’re moving from favouring simple procedural snippets of javascript that add twinkles to the page to fully object oriented JS applications, exporting great swathes of functionality away from the servers and onto the client.

This is a great thing. In fact it’s little short of a miracle; the servers are running faster and so are the clients! There seems to be no trade-off; by deeply integrating JavaScript into our web applications we’ve gained speed at both ends!

Not quite though.

Read the rest of this entry »

, , , ,

No Comments

Caching in Javascript with Cachejs

Here’s a useful open-source (MIT license) javascript caching object I developed for my job at GG.com, the best horse racing site on the net.
(I am contractually obliged to say that every time I mention the URL. Not really though).

Like most web applications these days, we make fairly extensive use of Ajax, sending and receiving JSON data across the net on hover events and so on.

However, we’ve found that all those HTTP requests can slow down the user experience, and causes unnecessary extra load on our application servers, so we decided to employ a client-side Least Recently Used (LRU) caching object, so that we can reduce the number of HTTP requests, and increase the response speed for cachable queries. It employs lazy garbage collection, just like memcached does. In fact we see this as a kind of “memcache for javascript”, if that makes any sense at all.

It depends upon no external libraries. Here’s a simple usage example:

Read the rest of this entry »

, , , , , , , , , , , , , ,

1 Comment

XKCD Colour Survey – a 3D visualisation

Randall Munroe (of XKCD) has been running a “name the colour” survey for the last few months and today released the data. The results are broken down by gender, and he makes some fascinating obvservations.

I’ve been working on a colour-related project on and off for about a year now, and part of that has involved creating visualisations of the RGB colour space – plotting red on the X axis, blue on Y, green on Z. So I thought it would be interesting to map XKCD’s 954 most common colour names in three dimensions – his charts are nice n’ all, but sexy javascript 3d is, well, sexier:

XKCD Colour Names in 3d

If you click that, you’ll be taken to the demo page, where you can interact with the cube. It’s a bit juddery, working entirely with divs and DOM manipulation, rather than canvas. Here’s a view from the side angle that shows off the “3d-ness” a bit more:

Of course, a canvas is really a better solution, so here’s a version that renders onto canvas, which is much much faster, but currently omits the names:

Read the rest of this entry »

, , , , ,

16 Comments

Super Useful Web Dev Tools

OMG, it’s been a whole month since my last update.

I have draft posts about all kinds of Good Stuffâ„¢, but none are quite publishable yet. So today I’m just going to point you at a few great resources I use all the time while doing my web development magic:

Read the rest of this entry »

, , , , , , ,

5 Comments

Break out of infinite alert() popups!

How many times have you been developing in javascript and said “I’ll just pop it in an alert”, alt-tab, refresh and then the sudden sinking feeling as you realise that you’re about to get 300 alert popups?

Damn! Now you have to sit there and press OK a bajillion times, or restart the browser – which is a pain because you’ll lose all your tabs, and more importantly you’ll lose your concentration while you load everything up again.

We’ve all been there. But recently I found a neat little trick to break out of infinite javascript alert loops in firefox:

Read the rest of this entry »

, , , , , ,

17 Comments

Facebook Chat History

A little video I made with some instructions on how to get facebook chat history, even if your friends are offline.

It’s always really annoying when you remember that a friend sent you a cool link but they’re not online any more. With this facebook tweak you can bring up the chat history.

Important: To get your facebook chat history back, you need to be logged in and online on the chat box. If you’re offline it won’t work.

Facebook only stores chat history for a few days though, so there might be no history to retrieve.

This is an extension of my facebook hacks page.

PS: Sorry the text is so small on the vid, put it fullscreen and you can read it better :0)

, , ,

60 Comments

Adaptive Web Sites

(this is a slightly expanded transcript of a talk I gave at Oxford in June 2009 about my work there)

Hi! I’m Howard Yeend, my supervisor is Vasile Palade, and the title of my project is:

Implementing Adaptive Web Sites using Machine Learning and Ajax“.

But before I talk about what all those buzzwords mean, I’d like to give a little background information about why this is an important research area, and why I feel it’s the right project for me.

When I was trying to think of a project title, I had a question in mind:

How can we improve the web?

And I think that’s a hugely important question for us to ask.

Read the rest of this entry »

, , , , , , , ,

14 Comments

Hacking Facebook

Wersja Polska

Hacking Facebook with Javascript

now updated for the latest (March 2010) version of facebook!

Because facebook relies so heavily on javascript, and because we can type javascript into the address bar, that means we can “poke” into the workings of facebook to do things that we wouldn’t normally be able to do. It’s not “hacking” exactly, but it employs the same sort of skills hackers use when looking into applications. The best part is that because it’s all using the same control codes (or “API”) that facebook uses, there’s no way for facebook to find out you’re doing it, so it’s totally safe! (I think…) Besides, we’re not going to be doing anything too dodgy, just a few little tweaks ;)

Read the rest of this entry »

, , , , , ,

220 Comments