Shaun Mccran

My digital playground

19
D
E
C
2010

The mathematics of solving the UK snow problem

I've had enough of the UK news whining about the weather conditions. I was raised in Scandinavia, where they have a more resolute disposition towards the snow. It is something that happens every year, and you learn to get on with it.

So I got to thinking, what do I do when it snows? I get out there and I clear it off. I grab the shove/broom and I clear it out of the way. What would happen if the able bodied population of the country did the same, instead of sitting around complaining? Manpower is free, and its readily available.

This article examines the theoretical maths involved in that idea.

[ More ]

16
D
E
C
2010

Showing and hiding Divs using JQuery and a select field

Ever want to show and hide div elements using form controls? JQuery makes this sort of functionality super easy.

In this blog entry I'll show you how to create a simple JQuery function that shows and hides elements based on a form select field.

You can see an example of the finished script here: Demo JQuery show / hide using a select field

[ More ]

15
D
E
C
2010

Sensationalist mobile usage claims - is mobile usage changing?

I like to keep abreast of the technology industry in general, and one of the recent articles published by the inquirer piqued my interest.

http://www.theinquirer.net/inquirer/news/1932583/offers-unlimited-smartphones

Its all about data plans from '3' and how they have gone from a 1 gig limit to an unlimited tariff.

The problem with the article is this quote, from Marc Allera, Three's sales and marketing director.

"We expect to see more people using mobiles than PCs to access the internet by 2015."

It's the sort of sensationalist statement that is supposed to create a band-wagon, let alone entice people to jump on it.

My point is that the mobile revolution is already here. It is taking place already. People are subtly integrating smart mobile devices into heir everyday life, without really realising it. The statement above is supposed to make you think, "Hey why aren't I using my phone for all my surfing! I need to do that too!".

The reality is far different. Your home pc (or Mac) is a multi functioning beast. It plays the role of several different appliances, all happily bundled into one. You surf, play games, do your banking, watch TV and a whole host of other activities, because it is an adaptable technology platform.

Your smart mobile device is not a replacement product. It's not even in competition.

To quote a recent argument I was involved in, if a PC/Mac is a 'Car' then a smart mobile device is a 'motorbike'. They both fulfil similar roles, but in totally different ways. Just as you would use each type of transport for specific journeys, you would use your pc/phone for different tasks. To suggest that the functionality of the two is totally interchangeable is wrong.

Suggesting that more people are going to use a mobile to browse the internet on does not signify an increase in mobile browsing, it signifies a fundamental shift in how people use the internet. And that sort of social change is never driven by technology.

08
D
E
C
2010

Differences in calling a function in JQuery

I'm still playing around with some aspects of JQuery, and I noticed recently that I was still writing functions in the old school JavaScript fashion. I was constructing a JQuery selector, and then pointing the event handler to a separate JavaScript function. Like this:

view plain print about
1$("#type").change(changeFields);
2
3function changeFields(){
4    var selected = $("#type option:selected").val();
5            $('.formElems').hide();
6            $("." +selected).show();
7            }

I noticed then that all the other JQuery based functions do not construct the function as a separate entity. The function is embedded within the actual event handler.

More like this:

view plain print about
1$("#type").change(function ()
2        {
3        var selected = $("#type option:selected").val();
4            $('.formElems').hide();
5            $("." +selected).show();
6        });

Both methods work equally as well (IE they do what they are supposed to) but I can't see any reason you would do one over the other. The only thing I can think of is that in the first example the function is reference able from elsewhere, whereas the second code example is not.

Anyone more knowledgeable than me got a view on this?

_UNKNOWNTRANSLATION_ /