Wednesday, April 7, 2010

Son shining ;-)

Looks like, I have left no stone un-turned in spoiling my extra ordinary son... so much so that, now he says "Abba!! dekho... ITEM" .

Phew... mind you, he's just 2 yrs [Alright... 2 years and 3 months]. Even I don't have the privilege to say that it was a mistake or it was unintentional... because once I was looking at an image of Drew Barrymore... and this genius asked... "Abba, ye kya hai?" and you know, the answer was like carved on the stone... God forbid, if he says something like this infront of my Dad... I'll be literally DEAD :((

But there is something that saves my blushes... [Haan yaar, I have taught him something good also] And that is... he uses "InshaAllah" pretty frequently... almost as much as I do. Secondly, he keeps thanking Allah :) for example:

Habeeb: Abba, packet main kitne biscuits hain?
Me: Beta.. bohat saarey hain.
Habeeb: Bohat saarey hain? Allah ka shukar hai!

Another good thing is: seeking mercy of Allah... whenever he's tired [or acts, as if he's tired :)] he'll breathe a sigh and say "Allah raham karo" :)

This are just few examples, and there are many more. I know... as of now he's just aping me... what is to be seen is, when he grows up, and starts understanding the things, will he still stick to these goodies...? I hope so, INSHA-ALLAH :)

PS: This Drew Barrymore episode was pre-Hajj era, so don't pound me with sarcastic comments; ab main kaafi sudhar chuka hoon... atleast I think so ;)

Wednesday, February 24, 2010

Using Google Visualization APIs for counties in US

I was trying to create a heatmap which shows the energy consumption graph of different States / Counties in US. The sample code was working fine with 'world' view but when zoomed-in, it was showing me only New York in colored, however displayed all the counties... as usual not much help [or to correct myself, not easily search-able] on relevant topic :(

Finally, after lot of trial and error I came to know that: the example provided at documentation is bit misleading... it simply uses "New York" while it should follow "US-NY" pattern... this way it was able to recognize "New York" somehow, but when I write "Miami" or "South Dakota" it didnt color the region.

So, cutting the long story shorter, here's is the working code [in which most of the developers are interested :) ] ... the description was for search engines not for u ;)

<html>

<head>

  <script type='text/javascript' src='http://www.google.com/jsapi'></script>

  <script type='text/javascript'>

   google.load('visualization', '1', {'packages': ['geomap']});

   google.setOnLoadCallback(drawMap);



    function drawMap() {

      var data = new google.visualization.DataTable();

      data.addRows(6);

      data.addColumn('string', 'Country');

      data.addColumn('number', 'Energy Savings');



      data.setValue(0, 0, 'US-AZ');

      data.setValue(0, 1, 18);

      

  data.setValue(1, 0, 'US-LA');

      data.setValue(1, 1, 32);

      

  data.setValue(2, 0, 'US-MI');

      data.setValue(2, 1, 21);

      

  data.setValue(3, 0, 'US-MN');

      data.setValue(3, 1, 30);

      

  data.setValue(4, 0, 'US-CH');

      data.setValue(4, 1, 26);

      

  data.setValue(5, 0, 'US-NJ');

      data.setValue(5, 1, 17);



      var options = {};

      options['region'] = 'US';

      options['colors'] = [0xE57878, 0xECEE5D, 0x6CEE62];



      var container = document.getElementById('map_canvas');

      var geomap = new google.visualization.GeoMap(container);

      geomap.draw(data, options);

  };

  </script>

</head>



<body>

  <div id='map_canvas'></div>

</body>



</html>



Hope it helps.

Best,
Siraj