<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
   <channel>
      <title>Pankaj Kumar&apos;s Weblog</title>
      <link>http://pankaj-k.net/weblog/</link>
      <description>Random thoughts, musings, experiences, ideas, and opinions</description>
      <language>en</language>
      <copyright>Copyright 2012</copyright>
      <lastBuildDate>Sun, 27 Mar 2011 22:35:37 -0800</lastBuildDate>
      <generator>http://www.sixapart.com/movabletype/</generator>
      <docs>http://blogs.law.harvard.edu/tech/rss</docs> 

            <item>
         <title>YLike: A hackday project</title>
         <description><![CDATA[You can get the details, including an introductory video and installation instructions, on  <a href="http://pankaj-k.net/ylike/" target="_blank">Ylike</a> page. What I want to talk in this post is the story behind the hack.
<p>
Like most early online communities, the graduating class of 1989 from IIT Kanpur has a Yahoo! group: <a href="http://groups.yahoo.com/group/iitk-89">iitk-89</a>. It was created way back in 1999 and was quite active till a few months ago. We discussed stuff that our most other friends would find uninteresting. Some one will send a link to an article that he (there were girls in our batch but they rarely participated) liked or found outrageous and then a heated discussion will ensue. Sometimes we collectively solved mathematical puzzles. It was fun.
<p>
But then a dispute arose about an off hand comment made by one the members. Without going into details, I'll only say that this incident polarized the group and the nature of discussion became very different. At this point, one of the members wondered: "it would have been nice if Yahoo! allowed a simple form of expressing likeness/dislikeness of posts". Posting response to a message you disagree with takes too much energy, is seen as an attack and is delivered as email to everyone in the group. A click to express agreement or disagreement which is then aggregated and shown as count to only those who visit the group pages would be milder and much more effective. Think of this as simple yes- or no- nodding of head during normal conversation. These are cues that get picked up and changes the conversation in subtle ways before it gets to heated and loud verbal exchange.
<p>
I kept thinking that adding a capability like this would be very beneficial to the Yahoo! group communities. So when the opportunity came this month in form of Yahoo! (internal) hackday, I coded up YLike, a hack that adds like and dislike buttons. With a little bit of extra work, I was able to make it work on my personal server and make it available to others. Visit <a href="http://pankaj-k.net/ylike/" target="_blank">Ylike</a> page and give it a try. If you are a member of iitk-89 group then you can even see my votes for some of the recent messages.]]></description>
         <link>http://pankaj-k.net/weblog/2011/03/ylike_a_hackday_project.html</link>
         <guid>http://pankaj-k.net/weblog/2011/03/ylike_a_hackday_project.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">Programming</category>
                  <category domain="http://www.sixapart.com/ns/types#category">Software Development</category>
        
        
         <pubDate>Sun, 27 Mar 2011 22:35:37 -0800</pubDate>
      </item>
            <item>
         <title>Statistical Analysis of JEE 2009 Results</title>
         <description><![CDATA[<p>
This blog post is motivated by three seemingly unrelated events -- a mail by an IIT Kanpur batchmate pointing out the availability of <a href="http://www.iitg.ac.in/jee/jee2009.htm">JEE 2009 marks</a> of each of its 384,977 test takers, down to name, father's name, gender, PIN, category, and marks in different subjects (yes, this would be a major violation of privacy in US or in any of the European countries, but apparently not in India); a brief encounter with <a href="http://www.r-project.org/">R-Project</a>, a software package to do statistical analysis, in course of doing some day job related number crunching; and a simmering interest in comparing relative performance in tests. The <a href="http://www.iitg.ac.in/jee/images/jee2009.pdf">giant list of marks</a> (warning: it is a 67 MB PDF) of individual details turned out to be the starting point for questions like: How does the frequency distribution of marks look like? Is it bell-shaped? Is it same for boys and girls? Is their any perceptible difference in marks for different subjects? Is there any correlation between marks of different subjects -- say, Maths and Physics, or Maths and Chemistry, or Chemistry and Maths? Is the correlation, if any, different for boys and girl? for students scoring high or low total marks?]]></description>
         <link>http://pankaj-k.net/weblog/2010/07/statistical_analysis_of_jee_20.html</link>
         <guid>http://pankaj-k.net/weblog/2010/07/statistical_analysis_of_jee_20.html</guid>
        
        
         <pubDate>Fri, 02 Jul 2010 15:22:24 -0800</pubDate>
      </item>
            <item>
         <title>Using netcat to view TCP/IP traffic</title>
         <description><![CDATA[There are times when you do want to see what bytes are flowing over wire in HTTP communication (or any TCP/IP communication). A good tool on Unix/Linux to use for this purpose is <a href="http://linux.die.net/man/1/nc">netcat</a> (it is available as command <strong>nc</strong>), as long as you have the ability to set proxy host and post at the client side. This is best explained by the following diagram:
<center>
<a href="http://pankaj-k.net/weblog/netcat-proxy.png"><img title="click to enlarge" src="http://pankaj-k.net/weblog/netcat-proxy.png" width="200px" /></a>
</center>
<p>
Let us say your client program running on machine <strong>chost</strong> is talking to the Server program running on machine <strong>shost</strong> and listening for connections at port 8000. To capture the request and response traffic in files, you need to do two things:
<ol>
<li>Setup a netcat based proxy either on a third machine <strong>phost</strong> or any of the client or server machines. The commands are shown in the above diagram (click to enlarge). The first command <strong>mknod backpipe p</strong> creates a FIFO. The next command <strong>nc -l 1111 0&lt;backpipe | tee -a in.dump | nc shost 8000 | tee -a out.dump 1&gt;backpipe</strong> does a number of things: (a) runs a <strong>netcat</strong> program that listens for incoming connections at port 1111, writes output to <strong>stdout</strong> and reads input from FIFO <strong>backpipe</strong>; (b) runs a <strong>tee</strong> program that write a copy of the previous netcat output to file <strong>in.dump</strong>; (c) runs a second <strong>netcat</strong> program that reads the output of the first netcat program, connects to the server program running on shost at port 8000 and forwards all data to the newly established connection. the response messages from this connection are written back to the <strong>stdout</strong> of this program; (d) runs a second tee program that sends the output of the second netcat program (ie; the response messages from the server program) to FIFO <strong>backpipe</strong> and also appends a copy to file out.dump. Data bytes written to FIFO <strong>backpipe</strong> are read by the first <strong>netcat</strong> program and returned to the client program as response message.
</li>
<li>Specify the proxy host and port for the client. This can often be done without modifying the program. For example, most Browsers have GUI options to set proxy host and post; Java programs allow setting <strong>http.proxyHost</strong> and <strong>http.proxyPort</strong> system properties; and CURL based PHP programs have option <strong>CURLOPT_PROXY</strong>.</li>
</ol>
The request message gets captured in file in.dump and response message in out.dump on the machine where netcat based capturing proxy is running.
]]></description>
         <link>http://pankaj-k.net/weblog/2010/05/using_netcat_to_view_tcpip_tra.html</link>
         <guid>http://pankaj-k.net/weblog/2010/05/using_netcat_to_view_tcpip_tra.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">Programming</category>
        
        
         <pubDate>Mon, 17 May 2010 17:49:50 -0800</pubDate>
      </item>
            <item>
         <title>My Experience being a MATHCOUNTS Coach</title>
         <description><![CDATA[I had been meaning to write a long post detailing my experience coaching a bunch of middle schoolers for <a href="https://mathcounts.org/">MATHCOUNTS</a> competition at <a href="http://peterson.ca.campusgrid.net/home">Peterson Middle School</a> last year (2008-2009) but somehow could never find the time. Fortunately, a chance to share my experience at the upcoming GATE parents meeting at <a href="http://www.santaclarausd.org/">Santa Clara Unified School District</a> office gave me the perfect excuse to prepare a slidedeck and slideshare.net lets me embed it right here.

<div style="width:425px;text-align:left" id="__ss_1396731"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/pankaj_k_net/mathcounts-at-peterson2008-09-1396731?type=powerpoint" title="Mathcounts At Peterson(2008 09)">Mathcounts At Peterson(2008 09)</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=mathcountsatpeterson2008-09-090506170534-phpapp02&stripped_title=mathcounts-at-peterson2008-09-1396731" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=mathcountsatpeterson2008-09-090506170534-phpapp02&stripped_title=mathcounts-at-peterson2008-09-1396731" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object><div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View more <a style="text-decoration:underline;" href="http://www.slideshare.net/">presentations</a> from <a style="text-decoration:underline;" href="http://www.slideshare.net/pankaj_k_net">pankaj_k_net</a>.</div></div>

I only hope the parents coming to the meeting and listening to the talk don't see this before the meeting.]]></description>
         <link>http://pankaj-k.net/weblog/2009/05/my_experience_being_a_mathcoun.html</link>
         <guid>http://pankaj-k.net/weblog/2009/05/my_experience_being_a_mathcoun.html</guid>
        
        
         <pubDate>Fri, 08 May 2009 16:09:52 -0800</pubDate>
      </item>
            <item>
         <title>Ten Years at HP</title>
         <description><![CDATA[Today is my last day at HP. I'll cease to be an HPer tomorrow and will become a Yahoo! Yes, you heard it right -- After 10 years or so, I am leaving HP for Yahoo! I know you must be wondering why. But let me save that for a subsequent post.
<p>
The most common question I have answered in last few days, second only to "why Yahoo!", is this: how long did I stay with HP? A straight-forward question that should have a simple and definite answer. But it isn't so, and usually prompts me launch into a long narrative -- I became an HPer through VeriFone acquisition in June 1997. This is the same VeriFone that <a href="http://www.marketwatch.com/news/story/verifone-ipo-may-tap-tech/story.aspx?guid=%7B17F85152-F96B-4E17-9E55-AC3CCCEBFB74%7D">went for IPO in year 2005</a> after being sold to a private investment group by HP sometime in year 2000 or 2001, and has been in news recently for all the wrong reasons. I had joined Bangalore office of VeriFone in 1993 January,  relocated to US office in October 1998 and then moved to E-speak group within HP in July 1999. So when did I really join HP? As per HP HR records for service anniversary awards and leave calculation, I am HPer since the day of joining VeriFone in Bangalore. For certain other benefits, it is the day VeriFone got acquired by HP. Personally, I felt like an HPer only after moving to the HP E-speak group in one of the Cupertino campus buildings. 
<p>
You see, it isn't that simple. So, I just picked the round number 10. A bit less than what the official records indicate, a bit more than my real years at HP and pretty close to the average of these two figures.
<p>
Besides the obvious aging and graying (or rather, loss) of hair, these 10 years have brought numerous changes: relocation from Bangalore to Bay Area and all its attendant transitions in the lifestyle, addition of Unnati (my younger daughter) to our three member family, <a href="http://pankaj-k.net/weblog/2003/10/fulfilling_part_of_the_america.html">fulfilling part of the American dream</a>, naturalization to US citizenship and many others.
<p>
My years at HP saw many historically significant events: spinning off of Agilent, merger with Compaq, colorful days of Carly Fiorina and a resurgent HP under Mark Hurd, to name a few. However these had much less impact on my day to day professional life than events less well known but much closer to what and with whom I worked on in the software business of HP: the initial excitement and euphoria around E-speak and its subsequent unfolding along with dotcom bust of 2001 (I personally and <a href="http://www.hpl.hp.com/techreports/2004/HPL-2004-150.pdf">HP as a company did a learn a thing or two with this whole endevour</a>), acquisition of Bluestone (a company that developed a J2EE App Server) and its subsequent closing for business reasons, and the rapid expansion of HP Software business through acquisition of Peregrin, Mercury Interactive and Opsware in recent years. Each of these touched and affected my professional life in a much more profound way and saw me go through a succession of roles, each building upon the previous one: developer, development manager, product design architect and then a solution architect.
<p>
Besides the customary project deliveries and customer visits, what I remember most about working for HP is the meeting and working with very different, interesting and wonderful people. Attending TechCons, invite-only annual gathering of HP technologists from all over the world to share ideas and showcase best of their works, has been another highlight, though the competition to get invited has become much more fierce in recent years.
<p>
Projects at work, though interesting and important, weren't quite as exciting and fulfilling as semi-professional projects at home: assembling a PC in early 2000 with individually purchased part at local Frys, authoring a book on <a href="http://www.j2ee-security.net/">J2EE Security</a> (though the torrid pace of change in technology has made it obsolete in less than 5 years), launching a hobby <a href="http://charteo.us/">Web 2.0 site</a> which found <a href="http://online.wsj.com/public/article/SB117459402867645874-eZqZTRCwfaC1qjChzgaWpjSb1m8_20080321.html">a mention in the venerable Wall Street Journal</a>, and numerous other smaller projects at home including a <a href="http://pankaj-k.net/weblog/2006/02/goodbye_cds_welcome_home_radio.html">home radio based on iTunes and a FM transmitter</a>, <a href="http://pankaj-k.net/weblog/2005/08/my_next_hacking_project.html">a modded NSLU2</a> and <a href="http://pankaj-k.net/weblog">this blog</a>. 
<p>
My latest home project: a Linux based media server that can rip song/book CDs and self-recorded DVDs into shorter clippings and then serve to the living room TV through <a href="http://en.wikipedia.org/wiki/Internet_Channel">Wii Internet Channel</a> or a future intenet enabled phone (it will iphone 2.0 or an android based phone -- haven't made up my mind yet!)over the home network, a combination of <a href="http://pankaj-k.net/weblog/2006/03/experimenting_with_powerline_n.html">PowerLine Network</a> and wifi Access Points. A <a href="http://ffmpeg.mplayerhq.hu/">ffmpeg</a> based prototype running Fedora Core 7 within a VM is almost ready but lacks the the usability that 11-year old Akriti demands for ripping and 7-year old Unnati demands for viewing.
<p>
As you would most certainly agree, these were wonderful 10 years!]]></description>
         <link>http://pankaj-k.net/weblog/2008/06/ten_years_at_hp.html</link>
         <guid>http://pankaj-k.net/weblog/2008/06/ten_years_at_hp.html</guid>
        
        
         <pubDate>Mon, 30 Jun 2008 05:40:11 -0800</pubDate>
      </item>
            <item>
         <title>Hercules made me a fan of VM appliances</title>
         <description><![CDATA[Came across <a href="http://www.vmware.com/vmtn/appliances/directory/300">Hercules</a>, a <a href="http://www.linux.com/feature/138166">VM appliance</a>, while looking for a TCP-level load-balancer for  a <a href="http://e-docs.bea.com/wls/docs100/cluster/index.html">WebLogic Cluster</a> setup. WebLogic Server does includes a HTTP-level load-balancing servlet known as <a href="http://e-docs.bea.com/wls/docs100/cluster/setup.html#wp684345">HttpClusterServlet</a>, which works okay for HTTP and simple HTTPS traffic, but not for 2-way SSL (or SSL with mutual authentication). The problem is that the connection originated from the client terminates at HttpClusterServlet and a new connection is established to one of the servers within the cluster, losing the user identification embedded within the client certificate. What you need for such configurations is a load-balancer that can transparently forward the TCP connection to a cluster machine and let the machine do the SSL handshake and map the certificate DN to a user identity. Hercules fit the bill.
<p/>
Once I started playing with Hercules, I realized that it did more than just fitting the bill -- at download size of just 2.5MB, it was the tiniest VM image I have ever come across. Built with <a href="http://busybox.net/">BusyBox</a>, <a href="http://www.uclibc.org/">uClibc</a>, <a href="http://siag.nu/pen/">Pen</a>, <a href="http://matt.ucc.asn.au/dropbear/dropbear.html">Dropbear</a>, <a href="http://www.acme.com/software/thttpd/">thttpd</a> and <a href="http://udhcp.busybox.net/">udhcpc</a>, it does a remarkable job of providing all the needed basic functionality of load-balancing a wide variety of TCP-based protocols such as HTTP/S, SMTP, FTP, POP3 and LDAP with minimal of disk and memory footprint. Not only that, the documentation included was very concise, clear and very complete, a rarity among less well-known opensource software.
<p/>
Getting it to work with VMware Server was a snap. Even making configuration changes from default of supporting only HTTP to support both HTTP and HTTPS was fairly straight-forward. And it did its job of load-balancing client connections and failing over flawlessly.
<p/>
Although I have only good things to say about Hercules, my experience with VMware hosted <a href="http://www.vmware.com/appliances/">Virtual Appliance Marketplace</a> was less than stellar. It does a great job of maintaining a directory of third-party appliances and providing basic information, including download statistics that can help one determine the popularity of a particular appliance. Where it fell short, in my opinion, is how users download the VM images, some of which could be very big, running into Giga bytes. VMware doesn't really host images, it simply points to the location specified by the creator. Appliance creators often provide downloads through BitTorrent, which, unfortunately, are blocked within most corporate firewalls and are not very helpful anyway as few appliances are so popular to attract large no. of simultaneous downloads. I could get Hercules image bits only because its creator <a href="http://communities.vmware.com/people/prabhakar">prabhakar</a> posted <a href="http://communities.vmware.com/thread/43984">a message </a>with <a href="http://sourceforge.net/project/showfiles.php?group_id=170938&package_id=195195">http download URL</a>.]]></description>
         <link>http://pankaj-k.net/weblog/2008/06/hercules_made_me_a_vm_applianc.html</link>
         <guid>http://pankaj-k.net/weblog/2008/06/hercules_made_me_a_vm_applianc.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">Trends</category>
        
        
         <pubDate>Fri, 27 Jun 2008 15:35:25 -0800</pubDate>
      </item>
            <item>
         <title>Did you know that each integer in a PHP array takes 68 bytes of storage?</title>
         <description><![CDATA[<p>
I should clarify upfront that I love PHP for its simplicity in developing web applications and this post is not meant to be a PHP bashing by any stretch of imagination. My only motivation is to plainly state certain facts that I came across while researching/experimenting about a design decision on how best to keep track of structured information within a PHP program. What I found was quite surprising, to say the least.
<p>
One of my function calls returned a collection of pairs of integers and I was wondering whether to store the pair as an array of two named values (as in <code>array('value1' => $value1, 'value2' => $value2)</code>) or a PHP5 class (as in <code>class ValuePair { var $value1; var $value2; }</code>). As the number of pairs could be quite large, I thought I'll optimize for memory. Based on experience with compiled languages such as C/C++ and Java, I expected the class based implementation to take less space. Based on a simple memory measurement program, as I'll explain later, this expectation turned out to be misplaced. Apparently PHP implements both arrays and objects as hash tables and in fact, objects require a little more memory than arrays with same members. In hindsight, this doesn't appear so surprising. Compiled languages can convert member accesses to fixed offsets but this is not possible for dynamic languages.
<p>
But what did surprise me was the amount of space being used for an array of two elements. Each array having two integers, when placed in another array representing the collection, was using around 300 bytes. The corresponding number for objects is around 350 bytes. I did some googling and found out that <a href="http://bugs.php.net/bug.php?id=41053">a single integer value stored within an PHP array uses 68 bytes</a>: 16 bytes for value structure (zval), 36 bytes for hash bucket, and 2*8 = 16 bytes for memory allocation headers. No wonder an array with two named integer values takes up around 300 bytes.
<p>
I am not really complaining -- PHP is not designed for writing data intensive programs. After all, how much data are you going to display on a single web page. But it is still nice to know the actual memory usage of variables within your program. What if your PHP program is not generating an HTML page to be rendered in the browser but a PDF or Excel report to be saved on disk? Would you want your program to exceed memory limit on a slightly larger data set?
<p>
Coming back to the original problem -- how should I store a collection pair of values? array of arrays or array of objects? For memory optimization, the answer may be to have two arrays, one for each value.
<p>
For those who care for nitty-gritties, here is the program I used for measurements:
<pre>&lt;?php
class EmptyObject { };
class NonEmptyObject {
  var $int1;
  var $int2;
  function NonEmptyObject($a1, $a2){
    $this-&gt;int1= $a1;
    $this-&gt;int2= $a2;
  }
};
$num = 1000;
$u1 = memory_get_usage();
$int_array = array();
for ($i = 0; $i &lt; $num; $i++){
  $int_array[$i] = $i;
}
$u2 = memory_get_usage();
$str_array = array();
for ($i = 0; $i &lt; $num; $i++){
  $str_array[$i] = "$i";
}
$u3 = memory_get_usage();
$arr_array = array();
for ($i = 0; $i &lt; $num; $i++){
  $arr_array[$i] = array();
}
$u4 = memory_get_usage();
$obj_array = array();
for ($i = 0; $i &lt; $num; $i++){
  $obj_array[$i] = new EmptyObject();
}
$u5 = memory_get_usage();
$arr2_array = array();
for ($i = 0; $i &lt; $num; $i++){
  $arr2_array[$i] = array('int1' => $i, 'int2' => $i + $i);
}
$u6 = memory_get_usage();
$obj2_array = array();
for ($i = 0; $i &lt; $num; $i++){
  $obj2_array[$i] = new NonEmptyObject($i, $i + $i);
}
$u7 = memory_get_usage();

echo "Space Used by int_array: " . ($u2 - $u1) . "\n";
echo "Space Used by str_array: " . ($u3 - $u2) . "\n";
echo "Space Used by arr_array: " . ($u4 - $u3) . "\n";
echo "Space Used by obj_array: " . ($u5 - $u4) . "\n";
echo "Space Used by arr2_array: " . ($u6 - $u5) . "\n";
echo "Space Used by obj2_array: " . ($u7 - $u6) . "\n";
?&gt;</pre>
And here is a sample run:
<pre>[pankaj@fc7-dev ~]$ php -v
PHP 5.2.4 (cli) (built: Sep 18 2007 08:50:58)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
[pankaj@fc7-dev ~]$ php -C memtest.php
Space Used by int_array: 72492
Space Used by str_array: 88264
Space Used by arr_array: 160292
Space Used by obj_array: 180316
Space Used by arr2_array: 304344
Space Used by obj2_array: 349144
[pankaj@fc7-dev ~]$</pre>

]]></description>
         <link>http://pankaj-k.net/weblog/2008/03/did_you_know_that_each_integer.html</link>
         <guid>http://pankaj-k.net/weblog/2008/03/did_you_know_that_each_integer.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">Programming</category>
        
        
         <pubDate>Mon, 31 Mar 2008 16:49:32 -0800</pubDate>
      </item>
            <item>
         <title>All you would ever need to know about Ajax</title>
         <description><![CDATA[<p>
Okay, a short blog post like this (or even a big one, like <a href="http://steve-yegge.blogspot.com/">those penned by Steve Yegge</a>) can't tell you everything *known today* about Ajax, forget "all you ever need to know". In fact, it can't tell you everything about anything worth knowing. There is just way too much information and knowledge around us about almost everything, consequential or not. To make things worse, at least for those who claim to "tell everything", this body of information and knowledge keeps growing every minue. 
<p>
So why did I choose this particular title? No, I didn't intend to write everything <em>I know</em> about Ajax. It is just a link-bait. Seems to have worked quite well for others. Might work for me as well. 
<p>
What I really want to do in this post is to write a short review of "Ajax -- The Definitive Guide", a book published by O'Reilly. Those who are familiar with Oreilly's <em>The Definitive Guide</em> series know that these books have a reputation of being very comprehensive and all encompassing about the chosen topic. This certainly seems to be the case for a number of  books in this series on my bookshelf, such as "JavaScript: The Definitive Guide" and "SSH, The Secure Shell: The Definitive Guide". But a definitive guide on something like Ajax? It would have to cover a lot of stuff, in all their fullness and fine details, to do justice to the title: the basics of Ajax interactions, (X)HTML, JavaScript, XML, XmlHttpRequest, CSS, DOM, browser idiosyncrasies, Ajax programming style and design patterns, tips-n-tricks, numerous browser side Ajax libraries such as prototype, YUI library, jQuery etc. and their integration with server side frameworks such as RoR, Drupal etc. The list is fairly long, if not endless. And each topic worthy of a book by itself.
<p>
<center><iframe marginwidth="0" marginheight="0" width="120" height="240" scrolling="no" frameborder="0"
  src="http://rcm.amazon.com/e/cm?o=1&l=as1&f=ifr&t=charteous-20&p=8&asins=0596528388&IS2=1&lt1=_blank">
  <MAP NAME="boxmap-p8"><AREA SHAPE="RECT" COORDS="14, 200, 103, 207" HREF="http://rcm.amazon.com/e/cm/privacy-policy.html?o=1" >
	<AREA COORDS="0,0,10000,10000" HREF="http://www.amazon.com/exec/obidos/redirect-home/charteous-20" >
  </MAP>
  <img src="http://rcm-images.amazon.com/images/G/01/rcm/120x240.gif" width="120" height="240" border="0" usemap="#boxmap-p8" alt="Shop at Amazon.com">
</iframe></center>
</p>
Fortunately, <em>Ajax -- The Definitive Guide</em> doesn't try to be a definitive guide for everything that goes or could go into an Ajaxy application. I found the book more to be a good collection of interesting and relevant topics that the author Anthony T. Holdener III has had first hand experience with. Most of these I knew about, some I was vaguely familiar with and a few were quite new to me. However, I wouldn't call the collection a "definitive guide for Ajax". If you are new to Ajax and are somewhat lost, in terms of where to start and how things relate to each other, then this book is certainly worth paying for. However, if you have already been into Ajax development for sometime and are craving for a single text to answer recurring questions around Ajax specific patterns, solution to common problems, browser differences and ways to tackle them then this is perhaps not the book for you. In this sense, the book doesn't really fit into the "The Definitive Guide" pattern.
<p>
On the other hand, the book does provide good introduction to basic concepts, is quite readable, includes a lot of source code for non-trivial working programs and lists relevant resources, such as Ajax libraries, frameworks and applications, in its References section. I especially liked the "chat" and "whiteboard" application that allows two or more users to share a whiteboard and chat through their browsers.
<p>
Okay, so how does this book compares with other books on the same topic? This is a tough question, for I haven't been paying attention to most books that have come out on this topic. Though there is a answer, and it comes from this Amazon Sales Rank comparison chart:
<!--
<script type="text/javascript">
Charteous = {params: {amzn: { asins: ["0596528388", "1932394613", "0596102259", "1932394990"]}}};
</script>
<script type="text/javascript"
src="http://charteo.us/charteous/show-chart.js">
</script>
-->
<p>
A higher Sales Rank for an item implies that more people are buying it from Amazon. This doesn't tell how well a particular book will meet your needs but just that the high ranking items, in general, are being bought by more people than the low ranking ones. The above chart does indicate that <em>Ajax -- The Definitive Guide</em> is outselling its rivals, at least at the time of this review (March 17-18, 2008).]]></description>
         <link>http://pankaj-k.net/weblog/2008/03/all_you_would_ever_need_to_kno.html</link>
         <guid>http://pankaj-k.net/weblog/2008/03/all_you_would_ever_need_to_kno.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">AJAX</category>
        
        
         <pubDate>Tue, 11 Mar 2008 16:20:58 -0800</pubDate>
      </item>
            <item>
         <title>Google -- Innovation Model or Anomaly?</title>
         <description><![CDATA[<p>
"Should innovation-minded managers look at the fast-growing Internet company as a model — or an anomaly?" This is the question posed by <a href="http://roughtype.com/">Nick G Carr</a> in a <a href="http://www.strategy-business.com/press/article/07404?gko=a2bce-1876-26510326">Strategy & Business article</a>. Delving into various aspects of the enigmatic company, he opines:
<p>
<blockquote>The way Google makes money is actually straightforward: It brokers and publishes advertisements through digital media. ... snip ... Google’s protean appearance is not a reflection of its core business. Rather, it stems from the vast number of complements to its core business. ... snip ...  For Google, literally everything that happens on the Internet is a complement to its main business. The more things that people and companies do online, the more ads they see and the more money Google makes. In addition, as Internet activity increases, Google collects more data on consumers’ needs and behavior and can tailor its ads more precisely, strengthening its competitive advantage and further increasing its income. As more and more products and services are delivered digitally over computer networks - entertainment, news, software programs, financial transactions - Google’s range of complements is expanding into ever more industry sectors.</blockquote> 
<p>
Though this argument appears plausible, I don't think it will withstand critical scrutiny. Not all online activities can be equally monetized through ads. It is well documented that ads alongside search results perform much better than ads on content pages, email messages, online productivity apps, video clips or social networks (to be fair the verdict on last two is still not out). Would a company as focussed on effectiveness as Google try to increase the online ad market by doing things which are proven not to be very effective?
<p>
In my opinion, Google's core competency is in developing and running highly customized hardware and software systems and they will use this competency to solve mega-problems that others are ill-equipped to address. In the process, they will disrupt a number of established businesses.


]]></description>
         <link>http://pankaj-k.net/weblog/2007/11/google_innovation_model_or_ano.html</link>
         <guid>http://pankaj-k.net/weblog/2007/11/google_innovation_model_or_ano.html</guid>
        
        
         <pubDate>Tue, 27 Nov 2007 14:24:21 -0800</pubDate>
      </item>
            <item>
         <title>Named Captures Are Cool</title>
         <description><![CDATA[<p>Regular Expressions are well known for their power and brevity in validating textual patterns. Less known is their ability to extract substrings surrounded by known patterns of text through a construct known as <a href="http://www.regular-expressions.info/brackets.html">round bracket groupings</a>. The text matching the sub-expression within a pair of round brackets is captured and is available as a backreference within the regular expression itself  or an indexed variable outside. For example, the PHP statement
<pre>
preg_match('/Name: (.+), Age: (\d+)/', $text, $matches);
</pre>
<p>would return 1 on finding a substring that matches the specified pattern and stores the matched name, ie; the first captured group, in <code>$matches[1]</code> and matched age, ie; the second captured group, in <code>$matches[2]</code>. <code>$match[0]</code> stores the full matched text. Other languages that support regular expressions, and the list of such languages is pretty long, have similar conventions.
<p>
Counting the capturing groups to get the index of the captured text works okay with short regualr expressions that don't change often. However, counting the position becomes tedious and error prone when the number is large and new groups may get introduced or existing ones removed as the code evolves.
<p>
If you just rely on the documentation accompanying your programming language, such as <a href="http://us.php.net/manual/en/reference.pcre.pattern.syntax.php">this regex syntax for PHP</a>, or <a href="http://java.sun.com/javase/6/docs/api/index.html?java/util/regex/package-summary.html">this Javadoc page for Java</a>, then you are not likely to find a better solution to this problem. At least this is what happened to me, for I wrote code that had the magic indexes all over till I started readingJeffrey E.F. Friedl's excellent <em>Mastering Regular Expression</em> and came across PHP's support for <a href="http://www.regular-expressions.info/named.html">named captures</a>, a mechanism to associate symbolic names to captured groups.
<center><iframe marginwidth="0" marginheight="0" width="120" height="240" scrolling="no" frameborder="0"
  src="http://rcm.amazon.com/e/cm?o=1&l=as1&f=ifr&t=charteous-20&p=8&asins=0596528124&IS2=1&lt1=_blank">
  <MAP NAME="boxmap-p8"><AREA SHAPE="RECT" COORDS="14, 200, 103, 207" HREF="http://rcm.amazon.com/e/cm/privacy-policy.html?o=1" >
	<AREA COORDS="0,0,10000,10000" HREF="http://www.amazon.com/exec/obidos/redirect-home/charteous-20" >
  </MAP>
  <img src="http://rcm-images.amazon.com/images/G/01/rcm/120x240.gif" width="120" height="240" border="0" usemap="#boxmap-p8" alt="Shop at Amazon.com">
</iframe></center>
<p>
What it essentially means is that I could rewrite the previous statement as
<pre>
preg_match('/Name: (?P&lt;Name&gt;.+), Age: (?P&lt;Age&gt;\d+)/', $text, $matches);
</pre>
<p>and access the matched name and age as <code>$matches['Name']</code> and <code>$matches['Age']</code> and need not worry about introducing (or dropping) groups. It not only improves the readability but also makes the code more robust.
<p>
At this point one could argue that in this particular case the book was just incidental, for the information on named captures was already available on the Web, as my link shows, and I should just have googled it. Unfortunately, you need to know a little bit about something to search for more. Google and the Web are no good if you don't know what you don't know. This is exactly where I think the book <em>Mastering Regular Expressions</em> really shines. You need to go through this to realize what you didn't know and what you should look for. And be assured that there are enough aspects of regualr expressions and their implementations in various languages that you may not know to justify the cost of the book. By the way, named captures are not the only thing that I learned from this book. Other things I learnt inlcude 'x' modifiers, conditionals within regular expressions, lookaheads and lookbehinds, and many others. No wonder this book is selling almost as well as Programming Perl, 3rd Edition, the all time programming best seller from O'Reilly.
<!--
<script type="text/javascript">
Charteous = {params: {amzn: { asins: ["0596528124", "0596000278"]}}};
</script>
<script type="text/javascript"
src="http://charteo.us/charteous/show-chart.js">
</script>
-->
<p>
At this point I should add that named captures may not yet be widely available in all languages. In fact, as per the book, Perl doesn't have it, though my research for this post led me to <a href="http://use.perl.org/articles/07/08/26/0142221.shtml">this page</a> and eventually to this <a href="http://www.regex-engineer.org/slides/img17.html">page stating that Perl 5.10 has named captures</a>. In fact, the support in Perl 5.10 are much more powerful and makes available not only the last match, as we saw in PHP, but <a href="http://www.regex-engineer.org/slides/img19.html">all the matches in an array</a>.
Java and JavaScript programmers may have to wait longer for named captures, though!
]]></description>
         <link>http://pankaj-k.net/weblog/2007/08/named_captures_are_cool.html</link>
         <guid>http://pankaj-k.net/weblog/2007/08/named_captures_are_cool.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">Programming</category>
        
        
         <pubDate>Sat, 25 Aug 2007 20:30:27 -0800</pubDate>
      </item>
            <item>
         <title>Are Freakonomics copycats dud?</title>
         <description><![CDATA[<p>The copycats of the 2005 mega seller <a href="http://charteo.us/amzn/items/0061234001"><em>Freakonomics</em></a>, such as <a href="http://charteo.us/amzn/items/0525950257"><em>Discover Your Inner Economist </em></a>and <a href="http://charteo.us/amzn/items/046500217X"><em>The Economic Naturalist</em></a>, aren't doing well -- <a href="http://online.wsj.com/public/article/SB118609843574586762.html">says The Wall Street Journal</a>. The story backs it up with some interesting statistics from Nielsen BookScan sales data: the original has sold 119,000 copies since January whereas the copycats have sold only 12,000 copies combined since their spring releases. Seth Godin <a href="http://sethgodin.typepad.com/seths_blog/2007/08/the-801-freakon.html">comments on the story</a> and makes the guess that the original is outselling the copycats 80:1.

<p>Let us take a look at how does all this statistics compare with the Amazon Sales Rank comparison charts at <a href="http://charteo.us">charteous</a>:
<!--
<script type="text/javascript">
Charteous = {params: {amzn: { asins: ["0061234001", "006073132X", "0525950257", "046500217X"]}}};
</script>
<script type="text/javascript"
src="http://charteo.us/charteous/show-chart.js">
</script>
-->
<p>No doubt the expanded/revised Freakonomics  is doing much better than the copycats. Even the first version (lower line in the chart) is not doing. But I wouldn't call the copycats complete failures. At least not at their current Sales Rank level of between 100 and 1000. It would be interesting to watch this chart over time, though.

<p>There is something else that caught my attention -- The WSJ story compares sales numbers for different time periods: the publish date for <em>Discover Your Inner Economist </em> is Aug. 2, 2007 and that of <em>The Economic Naturalist</em> is May 21, 2007, whereas the reported sales of 119,000 for <em>Freakonomics</em> is since Jan. 1, 2007. So, the copycats may not be doing as bad as a cursory look at the numbers might suggest.

<p>I read the older release of <em>Freakonomics</em> a few weeks ago and was pretty impressed by the basic notion of how the economics of incentives drives human behavior as well as the specific case stories. The first point is easy to understand but its implications in specific situations are usually non-obvious. The specific stories make the connection and often make for very good reading. I am assuming that what WSJ is calling copycats essentially analyze research and observations in different fields with the theory of economic incentives. If so, I wouldn't consider them copycats at all. In fact, I would buy them, at least the ones that become popular, and read them for the stories.
]]></description>
         <link>http://pankaj-k.net/weblog/2007/08/are_freakonomics_copycats_dud.html</link>
         <guid>http://pankaj-k.net/weblog/2007/08/are_freakonomics_copycats_dud.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">Trends</category>
        
        
         <pubDate>Thu, 09 Aug 2007 13:30:11 -0800</pubDate>
      </item>
            <item>
         <title>Is GNU Sort Broken?</title>
         <description><![CDATA[<p>Humor me with this simple task -- arrange the following list of strings in <a href="http://en.wikipedia.org/wiki/Lexicographical_order">lexigraphically</a> ascending order:
<pre>
a.b
aab
aaa
</pre>
<p>Keep in mind that the ASCII value of '.' is 46, which is less than 97, the ASCII value of 'a'. Note down your arranged list. Now, create a text file <code>list.txt</code> with the above strings in separate lines and sort them on a Linux system using the <strong>sort</strong> utility with the following command:
<pre>
$ sort list.txt
</pre>
<p>Did you get what you were expecting? I didn't. Here is what I was expecting and what I got under three different Linux systems (Fedora Core, Mandrake and Ubuntu):
<pre>
Expected           sort output
=======           ========
a.b                   aaa
aaa                   aab
aab                   a.b
</pre>
<p>What is going on here? Looks like sort is simply ignoring the '.' character. It shouldn't, at least not as per the <a href="http://www.hmug.org/man/1/sort.php">sort man page</a>. There is this option '-d' to ignore all characters except letters, digits and blanks, and hence '.', but this is not a default option.

<p>Just to confirm that I didn't make a mistake in my manual sort to arrive at the expected list, I sorted the strings within PHP command line shell:
<pre>
php > $a = array("a.b", "aab", "aaa");
php > sort($a);
php > print_r($a);
Array
(
    [0] => a.b
    [1] => aaa
    [2] => aab
)
</pre>
<p>This output is same as what I expected. So, no mistake on my part!
<p>And this led me to the question: is GNU Sort broken? or did I miss something. After shifting through sort man pages at different machines, noticed this warning on a Fedora Core 6 box:
<blockquote>       
 *** WARNING *** The locale specified by the  environment  affects  sort order.  Set LC_ALL=C to get the traditional sort order that uses native  byte values.
</blockquote>
<p>So, this is what I was missing! Btw, this is not something obvious that I just didn't pay attention to. Rechecking the <a href="http://www.hmug.org/man/1/sort.php">online man page</a>, something that I tend to use more often than the man output on a 20x80 terminal screen, confirmed that the warning wasn't there. Also, none of the machines I had tried, all installed for US locale, had LC_ALL set to C by default. And keep in mind that I came across the above discrepancy in sort output only after my program finding the difference of two sorted files failed on certain specific input values. Like most normal folks, I suspected my program first and it took a while to suspect the sort output as the culprit.
<p>Sorry for the provocative title -- I found out about  LC_ALL environment variable only while writing this blog post and double checking my facts (one of the few advantages of writing things down) and didn't feel like changing the title. After all, how many of us will think of setting LC_ALL=C before issuing sort! In that sense, Gnu sort IS broken.]]></description>
         <link>http://pankaj-k.net/weblog/2007/08/is_gnu_sort_broken.html</link>
         <guid>http://pankaj-k.net/weblog/2007/08/is_gnu_sort_broken.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">Linux</category>
                  <category domain="http://www.sixapart.com/ns/types#category">Programming</category>
                  <category domain="http://www.sixapart.com/ns/types#category">Software Development</category>
        
        
         <pubDate>Tue, 07 Aug 2007 19:48:20 -0800</pubDate>
      </item>
            <item>
         <title>July-August 2007 HBR Case Study: Monolithic Enterprise Software or SOA</title>
         <description><![CDATA[<p>
The HBR Case Study in July-August 2007 issue <a href="http://harvardbusinessonline.hbsp.harvard.edu/b01/en/common/item_detail.jhtml?id=R0707A">Too Far Ahead of the IT Curve</a>, authored by John P. Glaser, CIO of Partners Healthcare Systems and co-author of <em><a href="http://charteo.us/amzn/items/0787974684">Managing Health Care Information Systems</a></em>, presents the case of failing IT infrastructure of Peachtree Healthcare, "a federation of 11 hospitals of assorted sizes and special purposes, each with its own proud history and culture, and each with its own weird mishmash of IT systems of various vintages and vendor pedigrees".
<p>
The main problems with the existing system and goals for the future system identified in the study are:
<p>
<ul>
<li>Keeping all the different systems running with acceptable up-time and performance is a strain on the IT department: "the IT infrastructure was consuming so much maintenance energy that further innovation was becoming a luxury".</li>
<li>Sharing of patient records, ensuring quality, consistency, and continuity of care across the entire network of hospitals and physicians.</li>
<li>"Selective" standardization of certain medical procedures across the network but allow sufficient flexibility to individual hospitals and professionals in other areas.</li>
</ul>
<p>
Of course, these points are not so neatly laid out but are embedded within the story in a typical HBR case study style. I had to read it twice.
<p>
Two options are presented to address the current problems and meet future objectives:
<p>
<ul>
<li>Deploy a monolithic enterprise software system that will be much more manageable but will also standardize the business processes across the network. Peachtree Healthcare CEO Max Berndt does not like the brute force homogenization across the network hospitals, especially for non-routine stuff.</li>
<li>Adopt Service Oriented Architecture (SOA) which will enable selective standardization. Though the details are somewhat hazy  -- are they talking about (a) integrating existing IT systems within various hospitals using SOA; or (b) completely replace the existing systems and build the equivalent functionality on top of SOA building blocks such as SOA capable App servers, registries, business process engines and so on. (a) will not address the up-time and performance problems being faced by individual hospitals. (b) will require a costly redesign and rewrite of systems, but will provide the desired flexibility and agility.</li>
</ul>
<p>
As usual, the expert opinions on this case are varied: <a href="https://newsmedia.kaiserpermanente.org/kpweb/executiveprofiles/detailpage.do?bodyContainer=/htmlapp/feature/119executiveprofiles/nat_georgechalvorson.html">George C. Halvorson</a>, the chairman and CEO of Kaiser Permanente, is concerned that the CIO of Peachtree is not enthusiastic about about SOA and recommends more work around defining the vision and identifying the objectives. Typical CEO speak, but it might help the CIO in better understanding the pros and cons of the two options. <a href="http://www.aa.com/content/amrcorp/corporateInformation/bios/ford.jhtml">Monte Ford</a>, senior VP and CIO at American Airlines, recommends SOA based on his experience in adopting SOA. <a href="http://www.forrester.com/ER/Research/List/Analyst/Personal/0,,784,00.html">Randy Heffner</a>, a VP at Forrester Research, makes the comment that "by goofing around SOA as a product category instead of looking at it as a methodology, the CIO has missed key perspectives" and recommends SOA. John A Kastor, a professor of medicine at the Univ. of Maryland School of Medicine, agrees with Peachtree CEO Max that indiscriminate standardization of all medical processes is not the right thing to do, but offers no choice for IT infrastructure modernization.
<p>
The interesting thing to note is that none of the experts recommend a monolithic enterprise software system.
]]></description>
         <link>http://pankaj-k.net/weblog/2007/07/julyaugust_2007_hbr_case_study.html</link>
         <guid>http://pankaj-k.net/weblog/2007/07/julyaugust_2007_hbr_case_study.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">Software Development</category>
        
        
         <pubDate>Fri, 13 Jul 2007 22:36:55 -0800</pubDate>
      </item>
            <item>
         <title>What is wrong with this widely used AJAX event handler registration code?</title>
         <description><![CDATA[John Resig's blog post on <a href="http://ejohn.org/projects/flexible-javascript-events/">Flexible Javascript Events</a> presents cross-browser functions to register and deregister DOM events to/from any DOM element: <font size="+1"><code>addEvent()</code></font> and <font size="+1"><code>removeEvent()</code></font>. He wrote these functions in response to a <a href="http://www.quirksmode.org/blog/archives/2005/09/addevent_recodi.html">addEvent() recoding contest</a>, that was published at <a href="http://www.quirksmode.org/">a well-known site for Web developers run by Peter-Paul Koch</a> and included <a href="http://jszen.blogspot.com/">Scott Andrew LePera</a>, <a href="http://dean.edwards.name/about/">Dean Edwards</a> and John Resig himself as co-judges. The recoding contest itself was a response to wide interest in his blog post <a href="http://www.quirksmode.org/blog/archives/2005/08/addevent_consid.html">addEvent() considered harmful</a> where he outlined a problem with a widely used <a href="http://www.scottandrew.com/weblog/articles/cbs-events">function addEvent() published by Scott Andrew LePera</a>. It should also be noted that <a href="http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html">John Resig's entry was judged as the winner entry</a>.

Most web developers are familiar with the names mentioned in the previous paragraph. They have published books, maintain highly visible websites (Google PageRank of websites/blogs maintained by <a href="http://www.quirksmode.org/">Peter-Paul Koch</a>, <a href="http://dean.edwards.name/">Dean Edwards</a>, <a href="http://ejohn.org/">John Resig</a>, <a href="http://jszen.blogspot.com/">Scott Andrew LePera</a> are 9, 8, 7 and 7, respectively at the time of this blog post), blog regularly and are generally considered gurus in the area of client side web development.

I add all this background only to make the point that writing cross-browser DOM event handling code is non-trivial and has attracted the attention of best minds in the field. With that feeling of comfort that comes with being in good hands, one would think that the problem, although considered difficult in the past, has been solved once and for all and can be reused without much thought.

At least this is what I thought till some strange behavior in my AJAX code that used John Resig's winning addEvent() and removeEvent() forced me to analyze each and every line of the whole program and <em>discovered</em> a couple of really interesting things about the addEvent() function. But before I get into my discovery, let us take a look at the addEvent() code from John Resig's page:

<pre><font size="+1">
function addEvent( obj, type, fn ) { 
  if ( obj.attachEvent ) { 
    obj['e'+type+fn] = fn; 
    obj[type+fn] = function()
      {obj['e'+type+fn]( window.event );} 
    obj.attachEvent( 'on'+type, obj[type+fn] ); 
  } else 
    obj.addEventListener( type, fn, false ); 
}
</font></pre>

As you can see, this code takes on two issues with IE's support for DOM events: (a) IE uses a non-standard method attachEvent() to register event handlers; and (b) it runs the handler code in the global context (ie; built-in variable <code><font size="+1">this</font></code> is set to <code><font size="+1">window</font></code> object during handler execution) and not in the context of the element to which the handler is registered. 

The removeEvent() code is very similar and doesn't need to be reproduced here.

So, what is the problem? Actually, none whatsoever, at least not until you have an event handler function that is few tens of lines long and you pass the name of the function as the last argument to addEvent() function. If you are like me, you would think that the code will either use the function name string or some kind of address to create a short string as key to store the handler function reference within the DOM element object. But what really happens is that whole text of the handler function consisting of few tens of lines of code becomes part of the key (key is 'on' + type + fn). In my code I had a key with length greater than 2000! This in itself would not be much of a problem if the key was created only once during registration and then used for lookup during handler execution, though even a lookup in a hash table with very long strings is probably going to tax the JavaScript interpreter badly. The killer is that the key gets created every time the handler is run. This could be very frequent if the event type is 'mousemove' and could easily result in excessive memory use and sluggish behavior.

"This doesn't sound like an insurmountable problem," you may say, "just wrap your long function within another function that simply invokes the long function. This way the addEvent() code will use the body of the wrapper function for forming the key and avoid creation of long strings."

Actually, this is very similar to what I tried, my motivation bring two-fold: reduce the length of the code that gets used as part of the key and also pass an argument at the time of event handler registration. The wrapper creation function looked something like this:

<pre><font size="+1">
function create_handler(func, arg1){
  return function(event){ 
    return lfunc.call(null, 
      event || window.event, arg1); 
  }
}
</font></pre>

And I used it as follows:

<pre><font size="+1">
function long_function(event, arg1){
 ... tens of lines of code ...
}
addEvent(obj, 'mousemove', 
  create_handler(long_function, arg1));
</font></pre>

which, actually, ended up creating this fixed text for every function: "function(event){ return lfunc.call(null, event || window.event, arg1); }". As the key is a created by concatenating the even type and function text, same key will be created for different handlers if the event type remains same, causing overwrite! This actually happened in my code!

So, even the winning entry has skeletons in the cupboard. It is not that every use would result in broken programs, but there certainly are situations where they fall short. In fact, this is true for most library function and it is always a good practice to know not only the interface and purpose but also the underlying assumptions and how the thing actually works. To be fair to the author John Resig, the recoding contest post had a strict set of requirements and being a reusable function under different conditions was not one of those.
]]></description>
         <link>http://pankaj-k.net/weblog/2007/07/what_is_wrong_with_this_widely.html</link>
         <guid>http://pankaj-k.net/weblog/2007/07/what_is_wrong_with_this_widely.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">AJAX</category>
        
        
         <pubDate>Thu, 05 Jul 2007 23:32:27 -0800</pubDate>
      </item>
            <item>
         <title>The most informative iPhone article (Or why I haven&apos;t bought one yet!)</title>
         <description><![CDATA[Like most techno geeks, I have been <em>reading</em> an awful lot about iPhone. Note the emphasis on reading, for I haven't got one yet! Based on all the glowing reports about <a href="http://youtube.com/watch?v=czCCavcnNd8">its ruggedness</a>, <a href="http://www.waitingforiphone.com/2007/07/05/att-activates-over-1-million-iphones/">record sales</a> and continuing surge in AAPL stock price post-launch , it seems to be living upto the hype that was created prior to the launch.

However, <a href="http://mailbox.allthingsd.com/20070705/questions-about-apples-iphone/">the article I found to be most informative on iPhone</a> , which is actually not even published in an article format -- it is just a set of question and answers, makes me feel that it is essentially a version 1.0 product. This Q&A column by Walt Mossberg, a WSJ technology columnist, addresses some of the questions I had, such as can I change its dead battery when the inevitable happens (I recently replaced the 2 512MB memory modules of my Mac mini with 2 1GB memory modules with great effort but the kind of satisfaction that only a techno-geek can experience and wanted to know whether something similar was possible with iPhone battery); or can I watch YouTube clips on it; or can I use it like a hand held computer with wi-fi connectivity without signing up for an AT&T service. Unfortunately, the short answer is NO  for these questions (and for few others as well!). One question that it didn't answer and for which I think the answer is a NO is this: Can I access my favorite Web Apps such as <a href="http://www.google.com/ig">iGoogle</a>, <a href="https://www.google.com/adsense/login/en_US/">GMail</a>, <a href="http://www.google.com/analytics/">Google Analytics</a>, <a href="https://www.google.com/adsense/l">Google AdSense</a>, <a href="http://www.movabletype.org/">MovableType Blogging Interface</a>, <a href="http://drupal.org/">Drupal Admin Interface</a> etc. from an iPhone.This actually makes me feel good, for I didn't queue up and have no <a href="http://en.wikipedia.org/wiki/Buyer's_remorse">buyers' remorse</a>.

As you can see, what I am looking for in iPhone is not just a cool phone with MP3 player but a handheld thin client that can also be used as phone, camera, music player, and a personal tv. I have no doubt that iPhone, or its clones, will eventually become this dream device. And that would be a good time to retire my minimal SamSung phone with T-Mobile service.]]></description>
         <link>http://pankaj-k.net/weblog/2007/07/most_informative_iphone_articl.html</link>
         <guid>http://pankaj-k.net/weblog/2007/07/most_informative_iphone_articl.html</guid>
                  <category domain="http://www.sixapart.com/ns/types#category">apple</category>
        
        
         <pubDate>Thu, 05 Jul 2007 14:41:23 -0800</pubDate>
      </item>
      
   </channel>
</rss>
