jQuery 1.9 takes away live() – I put it back

January 8th, 2014

Sometimes it’s annoying when a function you’re using all over your code is depreciated and then taken away, and the reasons for it having been taken away don’t warrant the effort required to go through and rewrite everything to work with the new function. For me, on a project I’m working on at the moment, that was the case with jQuery 1.9 and the live() function. The effort required to change every instance of ‘live()’ to ‘on()’ in our code simply wasn’t worth it – it doesn’t actually gain us anything perceivable in terms of a benefit, and would’ve taken a few hours to do. I set out to find a quicker solution – it seemed obvious that since the functionality of on() is basically equivalent to the functionality of live(), it should be relatively easy to write a wrapper function so that any call to live() becomes a call to the new on() function, without having to actually change any of those function calls.

Turns out, that’s exactly what jQuery 1.8 does for you, they just removed this functionality in 1.9. It’s therefore very trivial to put it back in, simply add this little block of code immediately after loading jQuery – you will then be able to carry on using live() in jQuery 1.9 (and probably beyond):

(function( $ ) {
	// jQuery 1.9 takes away live(), I puts it back. ~Kieran Simkin
	if (typeof($ != 'function') {
			live: function( types, data, fn ) {
				jQuery( this.context ).on( types, this.selector, data, fn );
				return this;

Apparently the economy is recovering…

August 14th, 2013

Inflation has fallen back from its recent ridiculously high rate, house prices are on the up again and unemployment continues to fall. Apparently this is sufficient for the Tory bastards to declare that the economy is “off life support”. Nevermind that inflation is still at 3%, with actual take-home pay falling in real terms, nevermind that the unemployment figures obscure the real truth that many people are being forced off benefits and into the grey market economy or into underpaid jobs which leave them deeper in poverty and forced into the hands of payday lenders, food banks and loan sharks.

This “recovery” is just manipulation of the figures by a devious government of con men, embezzlers, liars and cheats. These bastards are in league with the banksters and the corporate fat-cats in an unspoken conspiracy to concentrate wealth and power in the hands of the few. For a true recovery to happen; we need to take the vast fortunes these bastards have amassed at our expense, and redistribute them to the poor sods who’ve been screwed over by them. We need to take back democracy and make it work for the people, instead of allowing the continuing charade of false choice between a lineup of elitist criminal scumbags.

What I still don’t understand though, is why everyone seems to think rising house prices are a good thing – for people like me who’d love to get on the property ladder, but can’t, rising house prices is the last thing we want. What would absolutely make my day is if there was a complete collapse in the housing market, such that houses were selling for their actual value, rather than some arbitrarily inflated figure plucked out of an estate agent’s asshole.

Sure, a collapse of the housing bubble would leave a lot of people in negative equity – but at the end of the day it’s their fault for buying something at a price which they knew to be vastly overinflated. Can I interest you in a £200,000 tulip anyone? Greater fool theory is no way to do business. Besides, if people actually bought their house for the purpose it was intended – ie, to live in, and they can afford their mortgage repayments, then what does it matter if they’re in negative equity?

If you want to gamble on the markets, there are a plethora of fun and exciting financial derivatives you can buy. Go buy some CFDs, or binary options if you wanna tie your fortunes to the arbitrary value of some abstract financial entity, hell if you want an investment just go and buy some stock in a company or some government bonds. Just don’t buy a house as an investment, it’s not fair on the rest of us who just want somewhere to live that we can call our own.

If the government were actually building more social housing, which I would consider a very good thing, then the effect I would expect to see on the housing market is a decrease in prices. The persistently rising house prices are a symptom of a chronic lack of decent quality affordable housing – if you ask me that’s a negative indication of the state of the country, not a positive one – it’s simple supply and demand economics – supply is failing to meet demand, so the price is becoming inflated beyond the true value of the asset, due to its scarcity. Why do these asshat politicians persist in the delusion that rising house prices are a good thing?! That attitude is just pushing us deeper and deeper into a housing crisis and creating a neo-feudal system of property owners and serfs.

I don’t like being a serf.

When I talk about redistributing the wealth – I don’t mean directly putting it into the hands of the poor (although a little bit of that wouldn’t hurt). What I’m actually talking about is taking a large portion of the private fortunes amassed by these corporate hags and investing it in civic infrastructure and social projects that benefit everyone. New museums, libraries, parks, subsidized (and renationalized) public transport, free high speed broadband access for all (and a renationalized British Telecom), investments in renewable and carbon-free energy infrastructure (and a renationalisation of the energy and utility companies), a return to student grants rather than student loans, increased availability of grants and loans for small businesses – and of course a massive social housing building project.

All the public services that the Tories have sold off over the years to their corporate scumbag mates – let’s take them back and run them for the benefit of the public rather than for the benefit of a select few corporate fat-cats. Fuck buying back these services, let’s just take them – who cares if the companies who owned them go bust as a result? They deserve it, they’ve been screwing us for years.

Let’s just bulldoze the docklands and replace canary wharf with council housing. It’s the banksters who are the real leeches on our country, not benefits claimants.

Oh well, I can dream can’t I?

A message to Maplin Electronics

July 11th, 2013

When is Maplin going to reverse the trend of downsizing and closing the in-store parts counters?
In the Brighton store, the parts counter used to run along the entire side of the shop, with row after row of component drawers, and a helpful old guy who’d talk through your project with you and help you select the correct components.

Now Maplin is becoming more and more like a consumer electronics store, more like Dixons or PC World, and the parts counters are disappearing – they have been gradually for years.

We don’t need another consumer electronics store – and besides, that’s a dead-end business now anyway, people treat high-street electronics stores like showrooms where they go and try out the product, only to buy it later on Amazon or eBay for a lower price. There may be money in high-street consumer electronics right now, but there won’t be for much longer, trust me.

The one thing that cannot be replicated online is the face-to-face contact with an experienced electronics engineer on the parts counter. Plus I think it much less likely that people would go into Maplin, seek advice on a project and then go home and buy the parts online – if you’ve gone to the trouble of going to the store and discussing your project with the guy in there, you’re not going to then go home and put your parts list into Farnell and wait for the delivery, only to save a few pence if you’re lucky.

I think a return to your geek hobbyist roots is the only way Maplin will survive long-term – and it’s a growing market at the moment, with the Maker movement and suchlike – there’s an increasing interest in DIY electronics projects. The margins may be smaller on components than on ink cartridges, but I think if you were to fully stock your stores with a broad range of components (unlike the measly offering at the moment), and hire the experts to work on the parts counter, I think you could make up for the lower margins by increasing volumes. Plus you’d be selling to interested and knowledgeable hobbyists rather than idiots who haven’t realized you can get printer cartridges online for half the price you sell them in-store. Surely there’s gotta be more satisfaction selling a good product to an informed customer, rather than selling overpriced crap to morons?

My thoughts on 3D printing and the upcoming manufacturing/supply chain revolution

July 9th, 2013

I wrote this as a forum comment and thought it was worth posting here too:

Traditional manufacturing is at the beginning of a terminal decline globally – this is expected and not necessarily a bad thing. Over the next few years we’ll see a move towards manufacturing being done much more locally to the consumer (in some cases even in their own homes on 3D printers) and also much more personally for each individual consumer. Large factories will eventually become a thing of the past and the supply chains they create will become obsolete as items will be created on-demand, much closer to the point of sale. There will also be a change in the items being manufactured – we’ll be individually customizing the products we buy to a much finer degree, and designing our own one-off modifications of many products. Eventually we may not buy products at all, but simply pay for the design which we would then produce (or have produced) at home or in our local 3D printing shop.

3D printers are the enabling technology for this revolution (I’m mainly thinking of SLS here rather than the nasty plastic crap that’s produced by extrusion-based home printers). CNC is also important. If you don’t see the massive disruption these technologies will cause to manufacturing, you haven’t properly understood the technologies, or existing manufacturing and supply chain processes.

Announcing jQuery.ui.FadeOver 1.0

February 5th, 2012

One effect I use a lot in web development is what I call “FadeOver“. By this, I mean that when you put your mouse over something, it shouldn’t just suddenly change colour – it should fade to a new colour – it just looks cooler. Since I’m now moving to jQuery, I’ve thought it wise to make this effect into a jQuery UI widget and release it as opensource.

Above you can see an example of the widget – the text with the blue flame is done entirely in CSS, no images involved, FadeOver simply fades between stylesheets with different CSS text-shadow values. The buttons below to enable and disable the widget are also FadeOver widgets themselves, although they look exactly like jQuery UI buttons, if you play with them you’ll notice they fade between colours when they change state rather than just flicking between colours instantly. It’s a subtle difference, but touches like this make all the difference in my opinion.

Click here to see more examples or download FadeOver to use it yourself.

Announcing jQuery.ui.MediaSlide 1.0

January 22nd, 2012

I’ve been using the jQuery Javascript library a lot recently, although this website is actually done entirely using jQuery’s biggest competitor; Prototype+Scriptaculous. A few things have convinced me that jQuery is better:mainly jQuery UI (particularly the theming), also the level of abstraction is nice – you’re almost not writing Javascript anymore, you’re writing jQuery – that’s a good thing (Javascript smells bad). jQuery’s documentation is better too, and there seems to be a bigger community surrounding it.

Furthermore, jQuery UI’s widget “factory” makes it very convenient to create standard web controls that can be easily used by anyone.

I therefore thought it would be appropriate if I ported the cool image gallery slider thingie from the gallery part of my website from Scriptaculous into jQuery, and released it as an opensource jQuery UI widget that anyone could use. That is what I’ve done, it’s called MediaSlide, licensed under my 1-clause Javascript BSD license. Visit the MediaSlide project page now for more details (including the code you need to add a MediaSlide to your website), or have a play with the example below to get an idea of what it does:

The widget you see above is a minature version of MediaSlide – it loads the image list directly from my Flickr feed – the images and thumbnails themselves are loaded directly from Flickr too. You can use Flickr feeds to populate MediaSlide with images, or you can use your own XML or JSON feeds. Consult the comprehensive MediaSlide documentation for more information.

The 1-clause BSD license (Javascript License)

December 31st, 2011

It occurred to me that the 2-clause BSD license doesn’t really apply anymore in a web environment where PHP and Javascript are the languages of choice. The two clauses of the license relate to source and binary distributions – this fits well for compiled programs in languages such as C or C++, but it doesn’t make much sense for Javascript libraries.

Instead, I moot a 1-clause BSD license for Javascript libraries – the Javascript BSD license (or 1-clause BSD license). Here’s my suggested template wording:

Project Name - Version 1.0
Copyright (c) - Author Name

Redistribution and use, with or without modification, are permitted
provided that the following condition is met:

 *  Redistributions of this code must retain the above copyright notice,
this condition and the following disclaimer.


Lest we forget

November 11th, 2011

Yellow horned poppies


August 9th, 2011

Everyone’s talking about the riots, condemning the chavs for mindless violence etc.

It seems to me that to dismiss the riots as pure criminality is a bit of a cop-out. The riots are clearly symptomatic of a wider problem with society. Increasing numbers of people are feeling a disconnect between the establishment (the government, companies, shops, whatever) and the people on the street. Peaceful protests have happened regularly in the last few years, and I think the perception of a lot of people is that those protests have been largely ignored and that in some cases the police exercised undue force to control protesters who weren’t really doing very much wrong.

Of course the people who attended the anti-war demo before the Iraq war, and those attending the peaceful “stop the cuts” protests are probably not the same ones who are now terrorising the streets, but the point is the government has created a generalized distrust of the establishment. The police haven’t helped by allowing themselves to be filmed apparently beating innocent protesters during peaceful demonstrations. The kids on the streets now weren’t at those demonstrations, but you can bet their parents and friends probably watched them on the news. What’s happened is that society as a whole has tried to change government peacefully, it failed, and now those with a lower intellect and a penchant for criminal damage and petty theft have taken over. This is what happens when you ignore the people and deal with them using undue force. They will rise up – the police will be outnumbered.

This is why I’m reluctant to support the Met Police – they’ve kinda brought it on themselves, and I kinda do want the government to be made aware that the people are not happy. I wish the moronic thugs would do a better job of voicing the concerns of the populace, and of course I don’t support petty theft and mugging – it’s terrible the destruction that’s being caused, but if someone threw a brick through the window of number 10, I’d probably be cheering them on. Don’t take that to mean I’m on the side of the rioters, I’m not, but I’m sure as hell not on the side of the government or the pigs either.

I’m just on the side of the communities who’ve got together today to start clearing stuff up.

The government bailing out the banks hasn’t gone down well either – it’s seen as the government taking from the poor to give to the rich, and people aren’t happy about it. They’re right not to be.

I’m not blaming it all on the Tories or the Lib Dems either – this is mostly Labour’s fault, the majority of this has built up over Tony’s rein. The Tories have just pushed things over the edge, I think Tony is the one who’s really to blame, for ignoring the people and going to a war nobody wanted.

Here’s some protest songs to accompany the riots:

Here’s a relevant link from the Guardian.

Baby on the way

July 7th, 2011

Lisa is now 7 months pregnant with our baby, a little boy. He’s due August 28th and we’re really excited :)

The scan pictures are below.. in the first scan the sonographer got a bit trigger happy with the photos so we ended up with quite a few more than we’d asked for (for free). In the second scan we only got 3 pictures, but one of them shows his little feet very clearly!

We’ve not decided for definite on a name yet although we have one likely contender – I think we’re going to make the final decision after we actually meet the little guy, who we’ve temporarily nicknamed ‘Pickle’, due to Lisa craving all things pickled in vinegar early in the pregnancy.

pickle scan 2011-02-10 1

pickle scan 2011-02-10 1

pickle scan 2011-02-10 2

pickle scan 2011-02-10 2

pickle scan 2011-02-10 3

pickle scan 2011-02-10 3

pickle scan 2011-02-10 4

pickle scan 2011-02-10 4

pickle scan 2011-02-10 5

pickle scan 2011-02-10 5

pickle scan 2011-02-10 6

pickle scan 2011-02-10 6

pickle scan 2011-02-10 7

pickle scan 2011-02-10 7

pickle scan 2011-02-10 8

pickle scan 2011-02-10 8

pickle scan 2011-02-10 9

pickle scan 2011-02-10 9

pickle scan 2011-04-12 1

pickle scan 2011-04-12 1

pickle scan 2011-04-12 2

pickle scan 2011-04-12 2

pickle scan 2011-04-12 3

pickle scan 2011-04-12 3