Using the HTML canvas tag, JSON, and Javascript to capture and regenerate drawing

OK so it’s been a few weeks since the last post, but I have been busy with the holidays, this has slowed my after work development time considerably, but luckily it has not cut into my reading time and I stumbled upon Thomas Bradly’s Signature Pad JQuery plugin here http://thomasjbradley.ca/lab/signature-pad .

The plugin uses the HTML5 Canvas tag and stores the strokes in JSON format so, yes they could be placed into a database, and redrawn later (I already have some great ideas for a mind map app!) The demo is here: http://thomasjbradley.ca/lab/signature-pad-accept.

I’ll have more this week, but I just wanted to get this out there now!

Context, not Content, is King – Gary Vaynerchuck @ INC 500

Here’s a great video from Gary Vaynerchuck that explains social media for those old school MBA types that learned that ‘cash is king’. Check out around 10:05 into the video for the real reason why social media has become relevant, Gary goes on to say that his particular skill is to recognize those things that people say they are not going to do; but end up doing anyway.

Couple of great questions:

How many of you have a DVR and record most of the shows you watch? Now how many watch the commercials that are recorded along with the show?

How many people pay attention to the signs along the road?

Couple of observations:

Gary argues that the game is changing, and old school marketing methods are losing market share, but old school business is not. Gary changes the paradigm from ‘content is king’ to ‘context is king’, as the amount of content that is being produced in 48 hours, is equal to the entire amount of content created between the beginning of time until 2003, context will be the only way that your information gets noticed.

So what is Context?

Gary sees business going back to the days of the small corner store where personalization is the key. You know, where Amazon knows your name, and has a customized list waiting for you. Around the 23rd minute Gary starts to explain how his company uses Twitter to create that small store feel. His company winelibrary.com actually mines twitter data to see what their customers are passionate about and has used this information to send personalized thank you gifts to customers. The story about the customer in Chicago that really likes Jay Cutler and follows the Bears, who was contacted by their ‘thank you department’ and sent a signed jersey with a thank you note, after using the mined twitter data. The response, of course, was a new loyal customer, who used to spend hundreds of thousands of dollars with a local wine store, and will now shift his business to winelibrary.com. Another interesting take away, his company actually calls every new customer and thanks them for their orders.

These are examples of creating context, which is an emotional relationship with a product, instead of content, the traditional information that was non-individualized and disseminated to the masses. Winelibrary.com claims that their customers that are on twitter are outperforming customers that are not on twitter by 60%, as they have been able to create context with this customer segment.

Finally, some take aways, “How many of you have used twitter’s live search?”, the prediction is that this will outperform google searches in the future, and real time ads will outperform google ads. Have a try: http://twitter.com/#!/search-home.

Deconstructing a cyberattack

This is a interesting video that looks at the deconstruction of the Stuxnet attack that targeted control systems, and manages to get across the dangers critical infrastructure face from unknown entities.

A look at Javascript and how benchmarks deter good programming practices

This is a great video that shows the consequences of benchmarking something without knowing exactly what to benchmark, and I agree completely with the Java assessment. More to come later ..

PHP code for paging and remote filtering extjs4 grids

I put up a tutorial on remore sorting and paging in the extjs grid and someone asked if I could post the PHP code to show what happens behind the scenes, I thought about it and this is a great idea as the tutorial sites that I have taken a look at always omit this code, so here you go:

The extjs post that this goes to is here

<?php
$dbhost = 'some_host';
$dbuser = 'some_user';
$dbpass = 'some_password';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die  ('Error connecting to mysql');
$dbname = 'some_db_name';
mysql_select_db($dbname);

$start 		= strip_tags($_REQUEST['page']);
$dir_s 		= strip_tags($_POST['dir']);
$sort_s		= strip_tags($_POST['sort']);
$check_state_s 	= strip_tags($_POST['check_state']);
$check_pay_to_s = strip_tags($_POST['check_pay_to']);
$w1 = " ";
$w2 = " ";

if ($check_state_s  != ''){
	$w1 = " AND `check_state` LIKE \"%" . $check_state_s . "%\" ";
}

if ($check_pay_to_s  != ''){
	$w2 = " AND `check_pay_to` LIKE \"%" . $check_pay_to_s . "%\" ";
}

$start_new 	= ($start * 50);

$t_result = mysql_query("SELECT * FROM `checks` WHERE 1 = 1 " . $w1 . $w2 );
$num = mysql_numrows($t_result);
$limit_cl = "  LIMIT " .  $start_new . ", 50 ";
if ($num < 51){
	$limit_cl =  "";
}

$query  = "SELECT  `cpkid` ,  `check_num` ,  `check_amount` ,  `check_date` ,  `check_pay_to` ,  `check_state` ,  `check_zip` 
FROM  `checks` WHERE 1 = 1 " . $w1 . $w2 . " ORDER BY `" . $sort_s . "` " . $dir_s . $limit_cl ;
//echo $query;
$t_result = mysql_query($query);
$options = array("success" => true);
$options = array("results" => $num);
$i = 0;
  while ($row = mysql_fetch_assoc($t_result)) {
    $options["rows"][$i] = $row;
    $i++;
  }
  echo json_encode($options);
?>