Posts Tagged web
js1k: an allRGB entry in <1k of JavaScript
Posted by Howard Yeend in javascript on August 30, 2010
It’s contest season! The An Event Apart 10k JavaScript app contest has just ended (my entry got 2½/5), there’s a node.js contest, and the JS1k contest is ending on Sept 10th. JS1k is a much purer contest, disallowing any external libraries, while the 10k contest allowed things like jQuery and external web services. As Frederick Polgardy puts it, js1k is “An exercise in constraint, resulting in a kind of executable haiku”.
For js1k, I’ve entered a port of my PHP allRGB entry. The allRGB project is a great idea in itself – create an image which contains every possible colour in the RGB space exactly once. That’s 256*256*256 colours (=16777216), in a 4096×4096 image. Quite a challenge for PHP, and certainly not the kind of thing you’d attempt in JavaScript, right? ;D
Read the rest of this entry »
Writing a JavaScript app in 10k (#aea10k) – Part One
Posted by Howard Yeend in javascript, web on August 28, 2010
Two weeks ago I discovered the 10k JavaScript contest organised by An Event Apart. It challenged developers to “inspire the web with just 10K”. I knew I’d be cutting things fine with just 11 days left before the deadline (including 5 at work and 3 on holiday!) but I was desperate to enter an application.
You can play with the final entry right here – http://10k.aneventapart.com/entry/details/243 – voting closes today so please be generous with your votes and comments. I’ve literally just now come back from holiday so I haven’t had a chance to badger everyone to vote yet. Go and vote! ;)
The idea’s been kicking around my head for a while: Read the rest of this entry »
Some thoughts on JavaScript
Posted by Howard Yeend in Firefox, javascript on July 14, 2010
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.
XKCD Colour Survey – a 3D visualisation
Posted by Howard Yeend in javascript, machine learning on May 4, 2010
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:
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:
Fast PHP – effective optimisation and bottleneck detection
Posted by Howard Yeend in PHP, Productivity, web on April 18, 2010
PHP is not the fastest language on earth. That honour probably goes to machine code. But like many high-level languages, PHP provides some handy abstractions, like named variables, hashmaps (associative arrays), a C-like syntax, object oriented capabilities, loose typing and so on – we trade processing speed for development ease.
So it’s quite a common problem that people find their large PHP web applications running quite slowly.
Here are some frequently encountered bottlenecks found in web applications generally, and PHP specifically:
CSS Gradient Background – Cross Browser!
Posted by Howard Yeend in web on April 2, 2010
You read that right. This works in:
- Firefox >=3.6
- MSIE >=5.5 (!)
- Safari >=4
- Chrome
Oh Em Gee, I’ve got a CSS-applied Gradient.
How neat is this?
I mean really, this is super cool.
And it degrades gracefully in older browsers and Opera.
My boss Mike passed this little CSS gem to me, and now dear reader I pass it to you. It was orignally developed by FakeDarren, who posted a great little CSS button example. I find it useful for those times when designers get all fancy with gradiented backgrounds.
I’ve condensed Darren’s CSS down to these four lines plus comments, which will give you the lovely Green-to-Black CSS fade background you can see above.
.gradientV{ /* thanks to http://blog.fakedarren.com/2010/01/cross-browser-css-gradients/ */ /* fallback (Opera) */ background: #008800; /* Mozilla: */ background: -moz-linear-gradient(top, #00FF00, #000000); /* Chrome, Safari:*/ background: -webkit-gradient(linear, left top, left bottom, from(#00FF00), to(#000000)); /* MSIE */ filter: progid:DXImageTransform.Microsoft.Gradient( StartColorStr='#00FF00', EndColorStr='#000000', GradientType=0); }
And as you may have guessed by the ‘V’ in the class name, you can also do horizontal gradients – here are some more examples for left-right gradients, and we see what happens when we apply animations to a gradiented DIV.
Read the rest of this entry »
Super Useful Web Dev Tools
Posted by Howard Yeend in Firefox, PHP, Productivity, Programs, javascript on March 17, 2010
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:
Break out of infinite alert() popups!
Posted by Howard Yeend in Firefox, javascript on February 17, 2010
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:
Top 2009 Facebook Status Trends
Posted by Howard Yeend in web on December 22, 2009
As google release their annual zeitgeist, and many other sites prepare interesting stats on web usage, facebook have today done the same and released an fascinating insight into the top facebook status update topics of 2009:
WordPress Security Flaw – Admin Password Reset
Posted by Howard Yeend in Wordpress, hacking on August 11, 2009
It is possible to reset the admin password in all versions of wordpress up to and including the most recent version 2.8.3.
This information comes from a milw0rm exploit.
Read the rest of this entry »





