<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Kumar&#039;s Blog</title>
	<atom:link href="http://kumarbhot.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://kumarbhot.wordpress.com</link>
	<description>सह नौ भुनक्तु &#124; सह वीर्यं करवावहै &#124; तेजस्विनावधीतमस्तु मा विद्विषावहै &#124;&#124;</description>
	<lastBuildDate>Wed, 27 Jan 2010 13:23:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='kumarbhot.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Kumar&#039;s Blog</title>
		<link>http://kumarbhot.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://kumarbhot.wordpress.com/osd.xml" title="Kumar&#039;s Blog" />
	<atom:link rel='hub' href='http://kumarbhot.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Boolean comparisons in JavaScript</title>
		<link>http://kumarbhot.wordpress.com/2010/01/27/boolean-comparisons-in-javascript/</link>
		<comments>http://kumarbhot.wordpress.com/2010/01/27/boolean-comparisons-in-javascript/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 12:54:01 +0000</pubDate>
		<dc:creator>Kumar</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://kumarbhot.wordpress.com/?p=65</guid>
		<description><![CDATA[//inside a condition, <code>undefined</code>, <code>null</code> and <code>''</code> (empty string) -<strong> <em>they all are equivalent to boolean</em> <code>false</code></strong>.

<strong>But that is only half the truth</strong>. It is very important to know that the following statements return <code>false</code>.

<code>(undefined == false);
(null == false);
('' == false);
</code><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kumarbhot.wordpress.com&amp;blog=8226538&amp;post=65&amp;subd=kumarbhot&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>At times we have to check for return type of a function call where the return value might be null or undefined. Although, there are many ways to handle this check in JavaScript e.g. the simplest approach is</p>
<p><code>if (myReturnValue) {...}</code><br />
//inside a condition, <code>undefined</code>, <code>null</code> and <code>''</code> (empty string) -<strong> <em>they all are equivalent to boolean</em> <code>false</code></strong>.</p>
<p><strong>But that is only half the truth</strong>. It is very important to know that the following statements return <code>false</code>.</p>
<p><code>(undefined == false);<br />
(null == false);<br />
('' == false);<br />
</code></p>
<p>(but, ironically <code>(undefined == null)</code> returns <code>true</code>)</p>
<p>This knowledge becomes critical when you are comparing two unknown return types. So, whenever you must compare these three values against each other or with boolean false, the best way is to add <code>!</code> (NOT) (or <code>!!</code> &#8211; double NOT) operator to both the operands. This will ensure that both the operands are boolean before the comparison happens. Now, try the following; they all return <code>true</code>.</p>
<p><code>(!undefined == !false);<br />
(!null == !false);<br />
(!'' == !false);<br />
(!undefined == !'');    //yes, it does return true<br />
(!undefined == !'');    //and that, too<br />
</code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kumarbhot.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kumarbhot.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kumarbhot.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kumarbhot.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kumarbhot.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kumarbhot.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kumarbhot.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kumarbhot.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kumarbhot.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kumarbhot.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kumarbhot.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kumarbhot.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kumarbhot.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kumarbhot.wordpress.com/65/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kumarbhot.wordpress.com&amp;blog=8226538&amp;post=65&amp;subd=kumarbhot&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kumarbhot.wordpress.com/2010/01/27/boolean-comparisons-in-javascript/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7d1120dbd8243dd84f4345f2da59b721?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Kumar</media:title>
		</media:content>
	</item>
		<item>
		<title>Why to use DOM 2 event listeners?</title>
		<link>http://kumarbhot.wordpress.com/2009/07/20/why-to-use-dom-2-event-listeners/</link>
		<comments>http://kumarbhot.wordpress.com/2009/07/20/why-to-use-dom-2-event-listeners/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 17:15:55 +0000</pubDate>
		<dc:creator>Kumar</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://kumarbhot.wordpress.com/?p=45</guid>
		<description><![CDATA[document.getElementById("myButton").onclick = function(e) { &#160;&#160;&#160;&#160;//do something }; What&#8217;s wrong with this approach of assigning handler to an event? If you ask me, I can think of at least 4 reasons not to follow it. It looks really ugly. If multiple programmers are working on the same interface, there might be situations you won&#8217;t be aware [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kumarbhot.wordpress.com&amp;blog=8226538&amp;post=45&amp;subd=kumarbhot&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><code>document.getElementById("myButton").onclick = function(e) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;//do something<br />
};</code></p>
<p>What&#8217;s wrong with this approach of assigning handler to an event? If you ask me, I can think of at least 4 reasons <strong>not</strong> to follow it.</p>
<ol>
<li>It looks really ugly.</li>
<li>If multiple programmers are working on the same interface, there might be situations you won&#8217;t be aware of other pre-existing event handlers to the same DOM element. The above method is a sure-shot way to override existing handlers.</li>
<li>What if I want to have multiple handlers for the same event on a DOM element? Yes, with tricks it can be achieved (by <a target="_blank" href="http://marcgrabanski.com/article/preserving-existing-events-javascript">retaining the existing event handler</a>). But even a novice programmer can guess the trouble one can get into as the number of handlers goes on.</li>
<li>Let&#8217;s assume you assign 5 event handlers using the above method to the same element. Now, you want to remove the third one (random). There is no way you can crack this without modifying all instances of event handler assignment.</li>
</ol>
<p>So? This is exactly why DOM 2 events module introduced a standard and more manageable approach for assigning handlers to an event.</p>
<p><code>function attachEventListener(domElement, eventName, eventHandler) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;if(window.addEventListener){        // Mozilla, Netscape, Firefox<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;domElement.addEventListener(eventName, eventHandler, false);<br />
&nbsp;&nbsp;&nbsp;&nbsp;} else {                            // IE<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;domElement.attachEvent("on" + eventName, eventHandler);<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
}</code></p>
<p>Now,</p>
<p><code>var myButton = document.getElementById("myButton");<br />
var myButtonClickHandler = </code><code>function(e) {//do something};<br />
attachEventListener(myButton, "click", myButtonClickHandler);</code></p>
<p>Can an anonymous function be used here instead of a function reference? Not a good idea. If at a later stage, if a particular handler is to be removed, you <strong>must</strong> have a reference to it which can be passed to <code>removeEventListener</code> (Mozilla, Netscape, Firefox) or <code>detachEvent</code> (IE).</p>
<p>An elaborate explanation on this topic can be found at <a target="_blank" href="http://www.howtocreate.co.uk/tutorials/javascript/domevents">http://www.howtocreate.co.uk/tutorials/javascript/domevents</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kumarbhot.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kumarbhot.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kumarbhot.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kumarbhot.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kumarbhot.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kumarbhot.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kumarbhot.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kumarbhot.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kumarbhot.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kumarbhot.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kumarbhot.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kumarbhot.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kumarbhot.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kumarbhot.wordpress.com/45/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kumarbhot.wordpress.com&amp;blog=8226538&amp;post=45&amp;subd=kumarbhot&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kumarbhot.wordpress.com/2009/07/20/why-to-use-dom-2-event-listeners/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7d1120dbd8243dd84f4345f2da59b721?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Kumar</media:title>
		</media:content>
	</item>
		<item>
		<title>Where to put the login form?</title>
		<link>http://kumarbhot.wordpress.com/2009/07/06/where-to-put-the-login-form/</link>
		<comments>http://kumarbhot.wordpress.com/2009/07/06/where-to-put-the-login-form/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 11:05:11 +0000</pubDate>
		<dc:creator>Kumar</dc:creator>
				<category><![CDATA[User Experience]]></category>

		<guid isPermaLink="false">http://kumarbhot.wordpress.com/?p=17</guid>
		<description><![CDATA[Last night I was discussing about a user interface with one of my friend for his upcoming website. We discussed many aspects of it but want to share the placement of login form in particular. Let&#8217;s analyse why people come to our home page. To see the cool graphics work we put there? To see [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kumarbhot.wordpress.com&amp;blog=8226538&amp;post=17&amp;subd=kumarbhot&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Last night I was discussing about a user interface with one of my friend for his upcoming website. We discussed many aspects of it but want to share the placement of login form in particular.</p>
<p>Let&#8217;s analyse why people come to our home page. To see the cool graphics work we put there? To see what the website is all about, its features? To become a member? To login, if they are already a member? We might get assertive answers to each of these questions; but which &#8216;Yes&#8217; is the most important one? Of course, the numbers will say it all.</p>
<p>The most popular example to consider here would be Gmail. Like any other service, it too, highlights the main features on the homepage but has placed the login form right there opened and focused (read that as &#8216;ready to type in&#8217;).</p>
<p>I really appreciate one web-based email provider for the user experience it has in offer; it is awesome but it gives me hard time whenever I switch between computers. From the home page, I have to click on the &#8216;Login&#8217; link and wait for separate login page to load. Why? I can&#8217;t reason. And what occupies the home page? Eye pleasing graphical work that explains how the product works and its features make it better than others. But do I have to bother about that now? I am already a member!</p>
<p>Some websites take the middle route – they provide a popup based login form. So waiting for another page to load is avoided; but user still needs to click on the &#8216;Login&#8217; link! And sometimes even have to click on the Username field to focus and start typing. Ah!</p>
<p><u>Unless login isn&#8217;t required to access the content or avail the services on the website</u>, 9 out of 10 times, if not more, people come to the home page to login. Login! Login!!</p>
<p>It is very natural to have some cool, fancy stuff on the home page, highlight the product features etc., so let it be but don&#8217;t ignore the user for that. Give her the first thing she wants – the login form. Home page IS THE PLACE to have the login form. It can further be improved by setting the focus on the Username field by default.</p>
<p>Many banks offer lesser loan interest rates for new customers; we don&#8217;t have to be alike. Let&#8217;s care for what we already have; our existing users!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kumarbhot.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kumarbhot.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kumarbhot.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kumarbhot.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kumarbhot.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kumarbhot.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kumarbhot.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kumarbhot.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kumarbhot.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kumarbhot.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kumarbhot.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kumarbhot.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kumarbhot.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kumarbhot.wordpress.com/17/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kumarbhot.wordpress.com&amp;blog=8226538&amp;post=17&amp;subd=kumarbhot&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kumarbhot.wordpress.com/2009/07/06/where-to-put-the-login-form/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7d1120dbd8243dd84f4345f2da59b721?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Kumar</media:title>
		</media:content>
	</item>
	</channel>
</rss>
