Shaun Mccran

My digital playground

05
J
U
L
2010

Using the JQuery Cookie plugin to emulate server side forms

A project request recently came up where we needed to track some users responses to a series of questions, then build an account 'home' page based on those responses. Pretty straight forward you'll agree. The problem here arose from the clients using a bespoke online solution that blocked any kind of server side interaction.

I've played with JavaScript cookies in the past to remember display states in JQuery functions, so I thought they would be a great solution to this. This article deals with how to use JavaScript cookies to emulate a normal form submission.

There is a demo of using the JQuery Cookie plugin to emulate forms here.

[ More ]

04
J
U
L
2010

Swype 1.47 for Android phones

I've never found typing on the Android graphic keyboard to be all that difficult, so when people started mentioning a way of typing that involved simply dragging your finger around, rather than tapping the keyboard, and how it was much quicker, I was a little sceptical.

The Application is called Swype, and it literally allows you to drag you finger over the keyboard to type. I've only just installed it, so I'm reserving judgement until I've used it for a while.

It is not the easiest of installs, as it is not available through the Android Marketplace, and you need a specific version based on your handset (I love the Android platform, but how fragmented can the handset market get?).

Go here and download the version for your phone.

http://www.gamestrikes.com/swype-1-47-24-6826-for-nexus1htc-desire-480x800

04
J
U
L
2010

iPhone 4 vs htc Evo 4G Fanboy video

I don't normally (re) post other blog entries, or link to hosted videos, but I'm making an exception for this one.

Its a short video exploring the extremes of fanboy-ism. Its not necessarily a dig at Apple or the iPhone, its just a good example of how hype can overrule consumers making informed decisions about their purchases.

Oh, and its hilarious. Its actually had me crying with laughter. (Features some bad language).

Credit goes to Phandroid.com for posting it first:
http://phandroid.com/2010/06/30/nsfw-iphone-4-vs-htc-evo-4g-i-dont-care/

After having a dig around I have also found that the guy who made it is a best buy employee, and they are attempting to fire him because of it!

Techcrunch have an article dealing with it:

http://techcrunch.com/2010/07/01/best-buy-iphone-4-evo-4g/

It highlights pretty well how some of the large corporates are out of touch with the real world, and just how badly they can misinterpret how the interenet works, and what the public opinion will be.

02
J
U
L
2010

How to reload a JQuery Datatables table data, using the API

Since I found the JQuery dataTables plugin, I use it quite a lot. I think it's a great way to display tabulated data, and it provides simple easy to use pagination and filtering options.

I've been building an interface to manage data, and arrived at the need to reload a datatable powered table, through a JavaScript request, rather than a page reload, or external variable (Url or form).

The problem with this is that if you try and re initialise a datatable into an existing datatable you get an error:

view plain print about
1DataTables warning: Unable to re-initialise DataTable. Please use the API to make any configuration changes required.

So you cannot re initialise an existing dataTable object. Looking through the API methods there is a relatively straight forward fix.

view plain print about
1if (typeof dTable == 'undefined') {
2
3    dTable = $('#example').dataTable( {
4    // data tables code
5    "bProcessing": true,
6    "bStateSave": true,
7    "bServerSide": true,
8etc...
9    aoData.push({ "name": "pageFilter", "value": filterText });
10    });
11else
12        {
13            dTable.fnDraw();
14        }

This code is basically checking if the object 'dTable' already exists, and if it is we are re drawing it, rather than using the existing object.

The fnDraw() method re-draws the table, so the data is refreshed. It uses the fnClearTable() method to first clear an existing data set, and the re draws it.

As an aside the 'filterText' value is a JavaScript value set elsewhere (a select field) that I am sending through to my server side request. It is used in a simple where clause in a query.

_UNKNOWNTRANSLATION_ /