<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-9148728900153461678</id><updated>2011-11-28T05:36:05.402+05:30</updated><category term='install'/><category term='__doPostBack'/><category term='sucessfull'/><category term='registry'/><category term='free'/><category term='dimension'/><category term='calculate'/><category term='FORM Validation'/><category term='column'/><category term='method'/><category term='__VIEWSTATE'/><category term='ThreadStart'/><category term='Print Error'/><category term='threading'/><category term='shortcut'/><category term='array'/><category term='c#'/><category term='location'/><category term='submit'/><category term='eat'/><category term='function'/><category term='elephant'/><category term='utorrent web UI'/><category term='New Input Controls'/><category term='multi'/><category term='.net'/><category term='pooram'/><category term='Solution'/><category term='ThreadPriority'/><category term='laptop'/><category term='sort'/><category term='thrissur'/><category term='Media Management'/><category term='multiple'/><category term='sample code'/><category term='table'/><category term='panchavadyam'/><category term='snaps'/><category term='logic'/><category term='signcode'/><category term='Port forwarding'/><category term='fetch'/><category term='postback'/><category term='ADSL Modem'/><category term='india'/><category term='thumbnail'/><category term='WaitCallback'/><category term='handler'/><category term='Script error'/><category term='custom'/><category term='kerala'/><category term='__EVENTVALIDATION'/><category term='festival'/><category term='retrieve'/><category term='HTML'/><category term='UseSubmitBehavior'/><category term='large'/><category term='GDI+'/><category term='Image Management'/><category term='BASE TAG'/><category term='framework'/><category term='ASP.net'/><category term='DHCP'/><category term='Standardization'/><category term='big'/><category term='nettipattam'/><category term='Validity'/><category term='width'/><category term='grasshopper'/><category term='javascript'/><category term='client'/><category term='Outlook 2003'/><category term='web page'/><category term='AJAX'/><category term='QueueUserWorkItem'/><category term='setCustomValidity'/><category term='gold'/><category term='event'/><category term='detect'/><category term='application'/><category term='Router'/><category term='assembly'/><category term='digitally sign'/><category term='form'/><category term='HTML 5'/><category term='ASUS RT-N13U'/><category term='2D'/><category term='chat'/><category term='Software'/><category term='height'/><category term='background'/><category term='temple'/><category term='code'/><category term='Sample'/><category term='HTML5'/><category term='Static IP'/><category term='plant'/><category term='ThreadPool'/><category term='element'/><category term='Internet'/><category term='signtool'/><category term='process'/><category term='determine'/><category term='single'/><category term='simple'/><category term='post'/><category term='Beginner'/><category term='bubble'/><category term='thread'/><category term='ParameterizedThreadStart'/><category term='create'/><category term='ascending'/><category term='click'/><category term='checkValidity'/><category term='SEO'/><category term='ThreadAbortException'/><category term='call'/><category term='god'/><category term='server'/><category term='two'/><category term='gmail'/><category term='leaves'/><title type='text'>Sanal's Blog</title><subtitle type='html'>I want to use this blog for knowledge sharing. Various articles related to software will be published here.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://sanalksankar.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://sanalksankar.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Sanal K. Sankar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_3Q-bcUHukBM/St8fSV6o0aI/AAAAAAAAC_g/DlPlN2Wpwzo/S220/sanal2_edited.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>20</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-9148728900153461678.post-7817563042595410102</id><published>2010-12-17T17:22:00.001+05:30</published><updated>2010-12-17T17:22:25.093+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='function'/><category scheme='http://www.blogger.com/atom/ns#' term='custom'/><category scheme='http://www.blogger.com/atom/ns#' term='sample code'/><category scheme='http://www.blogger.com/atom/ns#' term='web page'/><category scheme='http://www.blogger.com/atom/ns#' term='setCustomValidity'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML 5'/><category scheme='http://www.blogger.com/atom/ns#' term='FORM Validation'/><title type='text'>Provide custom validation messages using setCustomValidity in HTML 5 pages</title><content type='html'>If you have come through my other note on "&lt;a href="http://sanalksankar.blogspot.com/2010/12/form-validation-using-checkvalidity-and.html"&gt;Form validations on HTML 5&lt;/a&gt;", you already know that &lt;b&gt;HTML 5&lt;/b&gt; is promising enough to make validations better and native. Just set the right properties for the INPUT elements and HTML 5 gives you on-the-fly validations with less code. But, in some scenarios, we might have to include additional logical validations, in which case,&amp;nbsp;&lt;b&gt;setCustomValidity&lt;/b&gt;() function can be used to logically decide and set your own validation messages.&lt;br /&gt;&lt;br /&gt;Below is a simple sample code that will demonstrate the usage of&amp;nbsp;&lt;b&gt;setCustomValidity()&lt;/b&gt; functionality.&lt;br /&gt;&lt;pre class="brush: xml"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&amp;lt;meta charset="utf-8"&amp;gt;&lt;br /&gt;&amp;lt;title&amp;gt;HTML5 Sample Validation Page&amp;lt;/title&amp;gt;&lt;br /&gt;&amp;lt;style type="text/css"&amp;gt;&lt;br /&gt;body&lt;br /&gt;{&lt;br /&gt;    font-family:Arial;&lt;br /&gt;    font-size:12px;&lt;br /&gt;}&lt;br /&gt;.valid&lt;br /&gt;{&lt;br /&gt;    color:#000000;&lt;br /&gt;}&lt;br /&gt;.invalid&lt;br /&gt;{&lt;br /&gt;    color:#FF0000;&lt;br /&gt;}&lt;br /&gt;&amp;lt;/style&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;form id="form1" method="post"&amp;gt;&lt;br /&gt;&amp;lt;label&amp;gt;Age: &amp;lt;input type="number" required="true" value="50" min="18" max="60" step="1" oninput="validate(this)"&amp;gt; (between 18 and 60)&amp;lt;/label&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;&amp;lt;div id="validateMsg"&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;&amp;lt;div id="validity"&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;script&amp;gt;&lt;br /&gt;function validate(input) {&lt;br /&gt;    //logically decide and set custom validation message&lt;br /&gt;    if (input.value == "20" || input.value == "30") {&lt;br /&gt;        // set custom validation message&lt;br /&gt;        input.setCustomValidity('Your Age (' + input.value + ') is in a transition phase.');&lt;br /&gt;    } else {&lt;br /&gt;        // reset the validation message - makes it valid for checkValidity function&lt;br /&gt;        input.setCustomValidity('');&lt;br /&gt;    }&lt;br /&gt;    document.getElementById('validateMsg').innerHTML = 'Validation Message: "' + input.validationMessage + '"';&lt;br /&gt;    document.getElementById('validity').innerHTML = 'checkValidity function output: "' + input.checkValidity() + '"';&lt;br /&gt;}&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;b&gt;Concept&lt;/b&gt;:&lt;br /&gt;In this example, Age input is expected to accept only values between 18 and 60. Additionally, 20 and 30 ages are also treated as Invalid (of course, unusual scenario). This is done by using &lt;b&gt;setCustomValidity&lt;/b&gt;() function which will internally set the &lt;b&gt;validationMessage &lt;/b&gt;property of the input control. The &lt;b&gt;HTML 5&lt;/b&gt; form validation function &lt;b&gt;checkValidity&lt;/b&gt;() takes the validationMessage in to account and provides output as shown below, in &lt;a href="http://www.google.com/chrome"&gt;Google Chrome&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Valid Input&lt;/b&gt;:&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" src="http://lh3.ggpht.com/_3Q-bcUHukBM/TQtKYY5O0EI/AAAAAAAADWM/y5Bp4tA46TY/s800/html5_Adv_Valid.png" style="border: solid 1px #EAEAEA;" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;Invalid Input&lt;/b&gt;:&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" src="http://lh4.ggpht.com/_3Q-bcUHukBM/TQtKYIxYZQI/AAAAAAAADWI/fuV7QiIGOqY/s800/html5_Adv_InValid.png" style="border: solid 1px #EAEAEA;" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;Custom In-valid Input&lt;/b&gt;: (20 and 30 are not accepted):&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" src="http://lh6.ggpht.com/_3Q-bcUHukBM/TQtKYZGlsZI/AAAAAAAADWQ/xLkXGX4j8S8/s800/html5_Adv_Custom_InValid.png" style="border: solid 1px #EAEAEA;" /&gt;&lt;/div&gt;&lt;br /&gt;In valid scenarios, &lt;b&gt;validationMessage&lt;/b&gt; is an empty string and &lt;b&gt;checkValidity&lt;/b&gt; function returns true. In In-valid scenarios, including our custom invalid scenarios, &lt;b&gt;checkValidity&lt;/b&gt; function returns false and &lt;b&gt;validationMessage&lt;/b&gt; is returned based on the custom message set.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9148728900153461678-7817563042595410102?l=sanalksankar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanalksankar.blogspot.com/feeds/7817563042595410102/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sanalksankar.blogspot.com/2010/12/custom-validation-message.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/7817563042595410102'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/7817563042595410102'/><link rel='alternate' type='text/html' href='http://sanalksankar.blogspot.com/2010/12/custom-validation-message.html' title='Provide custom validation messages using setCustomValidity in HTML 5 pages'/><author><name>Sanal K. Sankar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_3Q-bcUHukBM/St8fSV6o0aI/AAAAAAAAC_g/DlPlN2Wpwzo/S220/sanal2_edited.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_3Q-bcUHukBM/TQtKYY5O0EI/AAAAAAAADWM/y5Bp4tA46TY/s72-c/html5_Adv_Valid.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148728900153461678.post-2126825761298486483</id><published>2010-12-17T01:46:00.000+05:30</published><updated>2010-12-17T01:46:12.520+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='checkValidity'/><category scheme='http://www.blogger.com/atom/ns#' term='Validity'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML 5'/><category scheme='http://www.blogger.com/atom/ns#' term='FORM Validation'/><title type='text'>Form Validation using checkValidity and Validity in HTML 5 using JavaScript- Sample Code</title><content type='html'>The next major version of the HTML standards (&lt;b&gt;HTML 5&lt;/b&gt;) seem to have numerous improvements over the current standards. Most of the functionalities, for which the developers has to write extensive custom code, will get reduced to a certain extend by the launch of new standards.&lt;br /&gt;&lt;br /&gt;The below sample shows how to perform a FORM validation for an HTML 5 input element using the newly introduced "&lt;b&gt;Validity&lt;/b&gt;" property associated to an input element. This will also demonstrate the usage of &lt;b&gt;checkValidity()&lt;/b&gt; function which can be used to identify whether the the form elements are all validated to proceed with the server communication. &lt;br /&gt;&lt;br /&gt;Skill level: For &lt;b&gt;Beginners&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Sample Code&lt;/b&gt;:&lt;br /&gt;&lt;pre class="brush: xml"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&amp;lt;meta charset="utf-8"&amp;gt;&lt;br /&gt;&amp;lt;title&amp;gt;HTML5 Sample Validation Page&amp;lt;/title&amp;gt;&lt;br /&gt;&amp;lt;style type="text/css"&amp;gt;&lt;br /&gt;body&lt;br /&gt;{&lt;br /&gt;    font-family:Arial;&lt;br /&gt;    font-size:12px;&lt;br /&gt;}&lt;br /&gt;.valid&lt;br /&gt;{&lt;br /&gt;    color:#000000;&lt;br /&gt;}&lt;br /&gt;.invalid&lt;br /&gt;{&lt;br /&gt;    color:#FF0000;&lt;br /&gt;}&lt;br /&gt;&amp;lt;/style&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;form id="form1" method="post"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;label&amp;gt;Age: &amp;lt;input type="number" required="true" value="50" min="18" max="60" step="1" oninput="validate(this)"&amp;gt; (between 18 and 60)&amp;lt;/label&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;&amp;lt;div id="validateMsg"&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;&amp;lt;div id="validity"&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;script&amp;gt;&lt;br /&gt;    function validate(input) {&lt;br /&gt;        var out = document.getElementById('validateMsg');&lt;br /&gt;        if (input.validity) {&lt;br /&gt;            if (input.validity.valid === true) {&lt;br /&gt;                out.innerHTML = "&amp;lt;span class='valid'&amp;gt;" + input.value +&lt;br /&gt;                            " is a valid age.&amp;lt;/span&amp;gt;";&lt;br /&gt;            } else {&lt;br /&gt;                out.innerHTML = "&amp;lt;span class='invalid'&amp;gt;" + input.value +&lt;br /&gt;                            " is not valid age.&amp;lt;/span&amp;gt;";&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        document.getElementById('validity').innerHTML = "checkValidity() output: &amp;lt;span class='invalid'&amp;gt;" + input.checkValidity() + "&amp;lt;/span&amp;gt;";&lt;br /&gt;    }&lt;br /&gt;&amp;lt;/script&amp;gt; &lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;Concept&lt;/b&gt;:&lt;br /&gt;The input element is a number element (that accepts "Age") in this example, with maximum and minimum values set in the design mode.&amp;nbsp;[If more information is needed on the Input elements, refer&amp;nbsp;&lt;a href="http://sanalksankar.blogspot.com/2010/12/html-5-sample-page-with-sample-code-for.html"&gt;here&lt;/a&gt;.]&amp;nbsp;During the user input event, a&amp;nbsp;JavaScript&amp;nbsp;function &lt;b&gt;validate&lt;/b&gt;() is called.&amp;nbsp;This function validates the input value using the input.validity.valid property and provides appropriate message, after checking for the support of this functionality.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;checkValidity&lt;/b&gt;() function is called to check and understand the value that it returns for the successful and unsuccessful validation scenarios.&lt;br /&gt;&lt;br /&gt;Here are the output screens:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Valid Input:&lt;/b&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" src="http://lh4.ggpht.com/_3Q-bcUHukBM/TQpVgj5rcEI/AAAAAAAADV4/dpmnD2LpR18/s800/html5_valid.png" style="border: solid 1px #EAEAEA;" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;Invalid Input:&lt;/b&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" src="http://lh5.ggpht.com/_3Q-bcUHukBM/TQpVgiyM4PI/AAAAAAAADV0/ApPQUW10Z8I/s800/html5_invalid.png" style="border: solid 1px #EAEAEA;" /&gt;&lt;/div&gt;&lt;br /&gt;As you can see, the&amp;nbsp;&lt;b&gt;checkValidity&lt;/b&gt;() always seems to return false. It returns true for values less than 10. It is being suspected that the inadequate browser support is one reason behind this weird&amp;nbsp;behavior&amp;nbsp;OR i'm missing something. However, as per the documentation &lt;a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#dom-cva-checkvalidatity"&gt;here&lt;/a&gt;, this function will help us to check and trigger functions based on the invalid/valid state of one/multiple elements, thereby assisting us in form validations.&lt;br /&gt;&lt;br /&gt;In the above code, the script tag is provided inside the body tag, for the sake of easy understanding. Keep it inside the HEAD tag, as it is usually done.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9148728900153461678-2126825761298486483?l=sanalksankar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanalksankar.blogspot.com/feeds/2126825761298486483/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sanalksankar.blogspot.com/2010/12/form-validation-using-checkvalidity-and.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/2126825761298486483'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/2126825761298486483'/><link rel='alternate' type='text/html' href='http://sanalksankar.blogspot.com/2010/12/form-validation-using-checkvalidity-and.html' title='Form Validation using checkValidity and Validity in HTML 5 using JavaScript- Sample Code'/><author><name>Sanal K. Sankar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_3Q-bcUHukBM/St8fSV6o0aI/AAAAAAAAC_g/DlPlN2Wpwzo/S220/sanal2_edited.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/_3Q-bcUHukBM/TQpVgj5rcEI/AAAAAAAADV4/dpmnD2LpR18/s72-c/html5_valid.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148728900153461678.post-8995558678305114423</id><published>2010-12-12T22:32:00.019+05:30</published><updated>2010-12-16T22:32:55.513+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sample'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML5'/><category scheme='http://www.blogger.com/atom/ns#' term='Standardization'/><category scheme='http://www.blogger.com/atom/ns#' term='code'/><category scheme='http://www.blogger.com/atom/ns#' term='simple'/><category scheme='http://www.blogger.com/atom/ns#' term='New Input Controls'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML 5'/><title type='text'>HTML 5 Sample page with sample code for newly introduced INPUT elements</title><content type='html'>Here is a sample code for an &lt;b&gt;HTML 5&lt;/b&gt; page with the new input elements, which has the minimum set of properties defined so as to get a feel of how the &lt;b&gt;new HTML standards&lt;/b&gt; are coming up. This will also give us an idea on how these changes are going to affect the user experience once they gets implemented in web pages.&lt;br /&gt;&lt;br /&gt;Let us start by specifying the HTML 5&amp;nbsp;doc-type&amp;nbsp;as shown below.&lt;br /&gt;&lt;pre class="brush:xml"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/pre&gt;At the time of this writing, below are the type of input elements that are available. Most of these new element types are being supported in Google Chrome.&lt;br /&gt;&lt;br /&gt;&lt;table border="1" cellpadding="2" cellspacing="0"&gt;        &lt;tbody&gt;&lt;tr&gt;            &lt;td&gt;&lt;b&gt;Keyword&lt;/b&gt;&lt;/td&gt;            &lt;td&gt;&lt;b&gt;State&lt;/b&gt;&lt;/td&gt;            &lt;td&gt;&lt;b&gt;Usage&lt;/b&gt;&lt;/td&gt;        &lt;/tr&gt;&lt;tr&gt;            &lt;td&gt;search&lt;/td&gt;            &lt;td&gt;Search&lt;/td&gt;            &lt;td&gt;&amp;lt;input type="search"&amp;gt;&lt;/td&gt;        &lt;/tr&gt;&lt;tr&gt;            &lt;td&gt;number&lt;/td&gt;            &lt;td&gt;Number&lt;/td&gt;            &lt;td&gt;&amp;lt;input type="number"&amp;gt;&lt;/td&gt;        &lt;/tr&gt;&lt;tr&gt;            &lt;td&gt;range&lt;/td&gt;            &lt;td&gt;Range&lt;/td&gt;            &lt;td&gt;&amp;lt;input type="range"&amp;gt;&lt;/td&gt;        &lt;/tr&gt;&lt;tr&gt;            &lt;td&gt;color&lt;/td&gt;            &lt;td&gt;Color&lt;/td&gt;            &lt;td&gt;&amp;lt;input type="color"&amp;gt;&lt;/td&gt;        &lt;/tr&gt;&lt;tr&gt;            &lt;td&gt;tel&lt;/td&gt;            &lt;td&gt;Telephone&lt;/td&gt;            &lt;td&gt;&amp;lt;input type="tel"&amp;gt;&lt;/td&gt;        &lt;/tr&gt;&lt;tr&gt;            &lt;td&gt;url&lt;/td&gt;            &lt;td&gt;URL&lt;/td&gt;            &lt;td&gt;&amp;lt;input type="url"&amp;gt;&lt;/td&gt;        &lt;/tr&gt;&lt;tr&gt;            &lt;td&gt;email&lt;/td&gt;            &lt;td&gt;E-mail&lt;/td&gt;            &lt;td&gt;&amp;lt;input type="email"&amp;gt;&lt;/td&gt;        &lt;/tr&gt;&lt;tr&gt;            &lt;td&gt;date&lt;/td&gt;            &lt;td&gt;Date&lt;/td&gt;            &lt;td&gt;&amp;lt;input type="date"&amp;gt;&lt;/td&gt;        &lt;/tr&gt;&lt;tr&gt;            &lt;td&gt;month&lt;/td&gt;            &lt;td&gt;Month&lt;/td&gt;            &lt;td&gt;&amp;lt;input type="month"&amp;gt;&lt;/td&gt;        &lt;/tr&gt;&lt;tr&gt;            &lt;td&gt;week&lt;/td&gt;            &lt;td&gt;Week&lt;/td&gt;            &lt;td&gt;&amp;lt;input type="week"&amp;gt;&lt;/td&gt;        &lt;/tr&gt;&lt;tr&gt;            &lt;td&gt;time&lt;/td&gt;            &lt;td&gt;Time&lt;/td&gt;            &lt;td&gt;&amp;lt;input type="time"&amp;gt;&lt;/td&gt;        &lt;/tr&gt;&lt;tr&gt;            &lt;td&gt;datetime&lt;/td&gt;            &lt;td&gt;Date and Time&lt;/td&gt;            &lt;td&gt;&amp;lt;input type="datetime"&amp;gt;&lt;/td&gt;        &lt;/tr&gt;&lt;tr&gt;            &lt;td&gt;datetime-local&lt;/td&gt;            &lt;td&gt;Local Date and Time&lt;/td&gt;            &lt;td&gt;&amp;lt;input type="datetime-local"&amp;gt;&lt;/td&gt;        &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;Here is the sample HTML code showing the basic features of the newly introduced input controls. For sake of simplicity, the properties are kept to a minimum. Even the layout beautification is ignored.&lt;br /&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;b&gt;Simple Sample Code&lt;/b&gt;:&lt;br /&gt;&lt;pre class="brush:xml"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&amp;lt;meta charset="utf-8"&amp;gt;&lt;br /&gt;&amp;lt;title&amp;gt;HTML5 Sample Page&amp;lt;/title&amp;gt;&lt;br /&gt;&amp;lt;style type="text/css"&amp;gt;&lt;br /&gt;body&lt;br /&gt;{&lt;br /&gt;    font-family:Arial;&lt;br /&gt;    font-size:12px;&lt;br /&gt;}&lt;br /&gt;&amp;lt;/style&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;form id="form1" method="post"&amp;gt;&lt;br /&gt;Search:&lt;br /&gt;&amp;lt;input type="search" placeholder="Search text here"&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;Number:&lt;br /&gt;&amp;lt;input type="number" value="50" min="40" max="60" step="5" autofocus="true"&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;Range:&lt;br /&gt;&amp;lt;input type="range" value="50" min="40" max="60" step="5"&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;Color:&lt;br /&gt;&amp;lt;input type="color" value="#000000"&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;Telephone:&lt;br /&gt;&amp;lt;input type="tel" placeholder="999" pattern="[0-9][A-Z]{3}" title="A part number is a digit followed by three uppercase letters."&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;URL:&lt;br /&gt;&amp;lt;input type="url" value="http://www.google.com"&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;Email:&lt;br /&gt;&amp;lt;input type="email" multiple value="me@somewhere.com"&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;Date:&lt;br /&gt;&amp;lt;input type="date" max="2050-12-31" min="2000-01-01" value="2010-01-01"&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;Date Time (Time zone information included):&lt;br /&gt;&amp;lt;input type="datetime" value="2000-12-31T00:00+05:30"&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;Local Date Time (No Time Zone information):&lt;br /&gt;&amp;lt;input type="datetime-local" value="2000-12-1T00:00"&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;Month:&lt;br /&gt;&amp;lt;input type="month" max="2000-10" min="2000-02" value="2000-04" step="2"&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;Week:&lt;br /&gt;&amp;lt;input type="week" max="2000-W50" min="2000-W05" value="2000-W06" step="2"&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;Time:&lt;br /&gt;&amp;lt;input type="time" max="23:00:00" min="01:00:00" value="04:30:00" step="5"&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;File Upload:&lt;br /&gt;&amp;lt;input type="file" accept="image/*" name="image" multiple onchange="updateFilename(this.value)"&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;&amp;lt;input type="submit" value="Submit"/&amp;gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/pre&gt;&lt;br /&gt;The above sample code also includes the usage of new properties like &lt;b&gt;multiple&lt;/b&gt;, &lt;b&gt;pattern&lt;/b&gt;, &lt;b&gt;placeholder&lt;/b&gt;, &lt;b&gt;autofocus&lt;/b&gt;, &lt;b&gt;min&lt;/b&gt;, &lt;b&gt;max&lt;/b&gt;, &lt;b&gt;step&lt;/b&gt; etc.&lt;br /&gt;&lt;br /&gt;Here is how it looks in Google Chrome.&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_3Q-bcUHukBM/TQn6jEHYrdI/AAAAAAAADVk/nASByk5gyOA/s1600/html5_screenshot.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="1" height="320" src="http://3.bp.blogspot.com/_3Q-bcUHukBM/TQn6jEHYrdI/AAAAAAAADVk/nASByk5gyOA/s320/html5_screenshot.jpg" width="306" style="border: solid 1px #EAEAEA;"/&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Yes, it looks ugly (though it serves the purpose)! Feel free to copy the code and&amp;nbsp;beautify/change it as needed. Let me know whether there is any changes, since the specification is fairly new.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;References&lt;/b&gt;:&lt;br /&gt;&lt;a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary"&gt;http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/common-input-element-attributes.html#the-multiple-attribute"&gt;http://www.whatwg.org/specs/web-apps/current-work/multipage/common-input-element-attributes.html#the-multiple-attribute&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9148728900153461678-8995558678305114423?l=sanalksankar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanalksankar.blogspot.com/feeds/8995558678305114423/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sanalksankar.blogspot.com/2010/12/html-5-sample-page-with-sample-code-for.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/8995558678305114423'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/8995558678305114423'/><link rel='alternate' type='text/html' href='http://sanalksankar.blogspot.com/2010/12/html-5-sample-page-with-sample-code-for.html' title='HTML 5 Sample page with sample code for newly introduced INPUT elements'/><author><name>Sanal K. Sankar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_3Q-bcUHukBM/St8fSV6o0aI/AAAAAAAAC_g/DlPlN2Wpwzo/S220/sanal2_edited.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_3Q-bcUHukBM/TQn6jEHYrdI/AAAAAAAADVk/nASByk5gyOA/s72-c/html5_screenshot.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148728900153461678.post-3987644411766383278</id><published>2010-11-21T22:38:00.011+05:30</published><updated>2010-11-23T17:33:48.986+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Router'/><category scheme='http://www.blogger.com/atom/ns#' term='laptop'/><category scheme='http://www.blogger.com/atom/ns#' term='ASUS RT-N13U'/><category scheme='http://www.blogger.com/atom/ns#' term='ADSL Modem'/><category scheme='http://www.blogger.com/atom/ns#' term='utorrent web UI'/><category scheme='http://www.blogger.com/atom/ns#' term='Port forwarding'/><category scheme='http://www.blogger.com/atom/ns#' term='DHCP'/><category scheme='http://www.blogger.com/atom/ns#' term='Static IP'/><title type='text'>Port forwarding through a modem and router to expose and enable communications to local services - How to?</title><content type='html'>&lt;br /&gt;I’ve been trying to expose few ports on my machine to the public, for the past few days. I started off assuming that this will be a simple task to do. Even after trying different configuration settings found from Googling, I was not successful. As I’m not a networking guy, I was missing few basic things which were crucial for this to work. Combining all these learning, here are the steps that you will have to take to successfully forward ports to your desired local machine.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The purpose:&lt;/b&gt;&lt;br /&gt;This might vary from person to person; sometimes you might want to locally &lt;b&gt;deploy a web site&lt;/b&gt; and expose it for testing to your friends OR you might want to open up your &lt;b&gt;MySQL &lt;/b&gt;or &lt;b&gt;utorrent Web UI&lt;/b&gt; so that it is publicly accessible. From a networking perspective, all of these scenarios lands up in opening up ports in your router to the PC in which these services resides. By default, most of these ports are closed.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Network Structure:&lt;/b&gt;&lt;br /&gt;Assuming that the following is your existing network structure, let’s see the steps involved.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_3Q-bcUHukBM/TOqhbmrmteI/AAAAAAAADVA/vHhALYHDKzg/s1600/modem-router.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;" target="_blank"&gt;&lt;img border="0" height="285" src="http://2.bp.blogspot.com/_3Q-bcUHukBM/TOqhbmrmteI/AAAAAAAADVA/vHhALYHDKzg/s320/modem-router.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;Initial Steps:&lt;/b&gt;&lt;br /&gt;Here are basic information needed to start with&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The port to be opened up; in my case, this is 61799&lt;/li&gt;&lt;li&gt;The local IP address of the system which will be running the target service; Ex: 192.168.1.3&lt;/li&gt;&lt;li&gt;IP address of the router and your public IP; the IP address that represents you in the world.&lt;/li&gt;&lt;/ul&gt;&lt;b&gt;Make sure that the IP addresses are static.&lt;/b&gt;&lt;br /&gt;Before starting with the steps involved, we need to make sure that all these addresses does not get altered over time. This is important because most routers assigns IP addresses dynamically to each of the PC/clients using DHCP, as and when they initialize a connection with the router. Based on the Lease time (the time for next renewal), the IP assigned to one client-PC might get changed later.&lt;br /&gt;&lt;br /&gt;So, let’s first give your PC a static IP first. if your PC is already on static IP, skip this step.&lt;br /&gt;Conceptually, what you are going to do is to understand the preferred network settings and set them to your network adapter-card. You will also disable dynamic IP address renewal in your PC. Based on the OS that you have, static IP assignment process can vary. &lt;a href="http://portforward.com/networking/staticip.htm"&gt;Here&lt;/a&gt; is one site that explains this. A typical settings can look like this.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_3Q-bcUHukBM/TOqhcNpPFKI/AAAAAAAADVI/BuZNOA1Rg1g/s1600/staticIp.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;" target="_blank"&gt;&lt;img border="0" height="320" src="http://4.bp.blogspot.com/_3Q-bcUHukBM/TOqhcNpPFKI/AAAAAAAADVI/BuZNOA1Rg1g/s320/staticIp.png" width="287" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;One most important thing here is that, even though you have told your PC to have a static address, you should tell your router you assign the same. Otherwise router will still try to dynamically renew the PC’s IP which will lead to conflicts. To accomplish this, set the router in such a way that the router’s DHCP does not include this address. However, care should be taken that the existing clients can still run on dyncamic IP assignment process. In order to do this, the best step is to set a range for DHCP an assign an IP out of this range to the PC. It is always better to limit from the top range so that you are not touching the router/modem IP settings, which are usually on the lower range. From my settings below, i freed up IP addresses above 192.168.1.100&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_3Q-bcUHukBM/TOqhUHIRGRI/AAAAAAAADUw/Vq5q4UgKgYU/s1600/dhcp.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;" target="_blank"&gt;&lt;img border="0" height="134" src="http://2.bp.blogspot.com/_3Q-bcUHukBM/TOqhUHIRGRI/AAAAAAAADUw/Vq5q4UgKgYU/s320/dhcp.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;So, now the&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Local PC is set with the IP 192.168.1.101&lt;/li&gt;&lt;li&gt;The port to be opened up is 61799&lt;/li&gt;&lt;li&gt;The router IP is 192.168.1.2 (usually this is 192.168.1.1). this is the IP at which the router’s web console resides.&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;b&gt;Port forwarding:&lt;/b&gt;&lt;br /&gt;Now, let’s welcome and guide the requests from the outside world to the local PC. This is done using port forwarding. For beginners, let’s assume that port forwarding is like guiding a guest from one door to the destination room in your house. Some time, this can involve going through multiple doors(ports) OR just a single door. This is a very limited or primitive way of looking at it. From networking perspective, there is more to it. Just like your house to be secure, most of these doors are closed, by default. That’s why you need to open this up.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Port forwarding&lt;/b&gt; is sometimes called &lt;b&gt;Virtual Servers&lt;/b&gt;. The trick is to access the router’s configuration page and find the page for this setting. Basic information, the page will ask for is&lt;br /&gt;&lt;ul&gt;&lt;li&gt;the service name (just for your identification)&lt;/li&gt;&lt;li&gt;the incoming port (when some one comes to this door)&lt;/li&gt;&lt;li&gt;the local PC (route to which computer)&lt;/li&gt;&lt;li&gt;the target port (to which door; the port at which your service is keep listening to so that it can accept the request).&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;Here are the screenshots as per my router.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_3Q-bcUHukBM/TOqhc2Kv3bI/AAAAAAAADVM/XFrkV8I4rsc/s1600/virtualServer.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;" target="_blank"&gt;&lt;img border="0" height="154" src="http://2.bp.blogspot.com/_3Q-bcUHukBM/TOqhc2Kv3bI/AAAAAAAADVM/XFrkV8I4rsc/s320/virtualServer.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Allow access for the Port in Local PC - Firewall changes:&lt;/b&gt;&lt;br /&gt;The final step is to make sure that the port is opened for access in your local PC. To open the port in your local PC, access the advanced settings of your firewall in your local PC and add a port exception. Most windows OS handles this section seamlessly. Basically we are trying to tell the firewall that if any request comes through 61799 door, let it come through.if you are looking for Step-by-step instruction for this, googling will help! Below are the major parts in this process, in screenshots.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_3Q-bcUHukBM/TOqhUV9JBNI/AAAAAAAADU0/2j9V0edXOc0/s1600/firewall_wizard_step1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;" target="_blank"&gt;&lt;img border="0" height="258" src="http://3.bp.blogspot.com/_3Q-bcUHukBM/TOqhUV9JBNI/AAAAAAAADU0/2j9V0edXOc0/s320/firewall_wizard_step1.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_3Q-bcUHukBM/TOqhUir7lQI/AAAAAAAADU4/Bxk1pa5djaI/s1600/firewall_wizard_step2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;" target="_blank"&gt;&lt;img border="0" height="258" src="http://1.bp.blogspot.com/_3Q-bcUHukBM/TOqhUir7lQI/AAAAAAAADU4/Bxk1pa5djaI/s320/firewall_wizard_step2.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_3Q-bcUHukBM/TOqhVW1LFPI/AAAAAAAADU8/Yd_JJfMoPe8/s1600/firewall_wizard_step3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;" target="_blank"&gt;&lt;img border="0" height="258" src="http://4.bp.blogspot.com/_3Q-bcUHukBM/TOqhVW1LFPI/AAAAAAAADU8/Yd_JJfMoPe8/s320/firewall_wizard_step3.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Public IP Address:&lt;/b&gt;&lt;br /&gt;Let’s identify the public IP of your’s . Most of the ISP( internet service provider) will assign an IP for your network, each time you connect to it. if you have a static IP bought from your ISP, ignore this section. Otherwise, you can have to find out your piblic IP using websites like&amp;nbsp;&lt;a href="http://whatismyip.org/"&gt;whatismyip.org&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;That's it. You’re done. Use any of the online port check tool to confirm whether the port is open. &lt;a href="http://canyousee.org/"&gt;canyousee.org&lt;/a&gt; is one such site. Make sure that your service is running at your local PC while checking. Once this is confirmed, you should be able to access the service at [public IP]:[port].&lt;public ip=""&gt;&lt;port&gt;&amp;nbsp;For example, an http service can be requested by http://ppp.ppp.ppp.ppp:61799/ where ppp.ppp.ppp.ppp is your public IP.&lt;/port&gt;&lt;/public&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Tip:&lt;/b&gt;&lt;br /&gt;There are FREE tools available that can give you a domain name for your IP, even if changes dynamically. You can register with them that will get you and address like http://you.theirname.com. You might have to download few apps to refresh thier records as and when your IP changes. These changes will be done automatically and you will now have a public address by using this. With this, your address for the service will be http://you.thiername.com:61799. Few free sites are&amp;nbsp;&lt;a href="http://www.dyndns.com/"&gt;http://www.dyndns.com/&lt;/a&gt;,&amp;nbsp;&lt;a href="http://www.no-ip.com/"&gt;http://www.no-ip.com/&lt;/a&gt;,&amp;nbsp;&amp;nbsp;&lt;a href="http://asus.freeddns.com/"&gt;http://asus.freeddns.com&lt;/a&gt;&amp;nbsp;(free for &lt;b&gt;ASUS &lt;/b&gt;products)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Multiple Router Scenario:&lt;/b&gt;&lt;br /&gt;For most common network structures, the process is now complete. But tragically, my network structure were slightly different. It is something like this.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_3Q-bcUHukBM/TOqhboadhpI/AAAAAAAADVE/x8DMX3VU9xQ/s1600/router-router.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;" target="_blank"&gt;&lt;img border="0" height="285" src="http://2.bp.blogspot.com/_3Q-bcUHukBM/TOqhboadhpI/AAAAAAAADVE/x8DMX3VU9xQ/s320/router-router.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Here, the modem that i was having, the one that my ISP gave me, was not really a modem; that was also a router. In this case, i had two routers in my network and all the clients were connected to my second router.&lt;br /&gt;&lt;br /&gt;The ideal way is to make the second router work as a &lt;b&gt;Access Point&lt;/b&gt; and make the above explained changes in the primary router. This is possible, if your secondary router is capable to work as an Access Point. Even though my router &lt;b&gt;ASUS RT-N14U&lt;/b&gt; is capable to do so, i tried to make it work without any changes to the existing system, keeping the secondary router as a router itself.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Primary router changes - Port Forwarding to secondary router:&lt;/b&gt;&lt;br /&gt;Here are the steps involved to make this happen:&lt;br /&gt;Connect the primary router directly to your local PC.&lt;br /&gt;Access the administrative module which might be residing at &lt;a href="http://192.168.1.1/"&gt;http://192.168.1.1&lt;/a&gt;. In my case this was a &lt;b&gt;Beetel 220bx&lt;/b&gt; modem. so, by default, it will not show you the advanced options. Little bit of googling showed that &lt;a href="http://192.168.1.1/main.html"&gt;http://192.168.1.1/main.html&lt;/a&gt; and &lt;a href="http://192.168.1.1/index.html"&gt;http://192.168.1.1/index.html&lt;/a&gt; are the two pages that exposes the options. Accessing main.html provided me the options to configure a virtual server in my primary modem.&lt;br /&gt;&lt;br /&gt;The virtual server in my primary modem was set as&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Incoming port: 61799&lt;/li&gt;&lt;li&gt;Target IP: IP address of the secondary router (192.168.1.2)&lt;/li&gt;&lt;li&gt;Target port: 61799&lt;/li&gt;&lt;/ul&gt;What i told here is to route all the requests from public at 61799 to the same port at 61799 to my second router, which is already set to route the request to my local PC.&lt;br /&gt;&lt;br /&gt;Once the settings are done, turn off the machines and get back to your original network structure.&amp;nbsp;This was the final step i have to do and get this working.&lt;br /&gt;&lt;br /&gt;If there are other ways to achieve the same, let me know as comments.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9148728900153461678-3987644411766383278?l=sanalksankar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanalksankar.blogspot.com/feeds/3987644411766383278/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sanalksankar.blogspot.com/2010/11/router-modem-port-forward-utorrent-asus.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/3987644411766383278'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/3987644411766383278'/><link rel='alternate' type='text/html' href='http://sanalksankar.blogspot.com/2010/11/router-modem-port-forward-utorrent-asus.html' title='Port forwarding through a modem and router to expose and enable communications to local services - How to?'/><author><name>Sanal K. Sankar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_3Q-bcUHukBM/St8fSV6o0aI/AAAAAAAAC_g/DlPlN2Wpwzo/S220/sanal2_edited.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_3Q-bcUHukBM/TOqhbmrmteI/AAAAAAAADVA/vHhALYHDKzg/s72-c/modem-router.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148728900153461678.post-6974106171507232048</id><published>2010-02-21T01:40:00.000+05:30</published><updated>2010-02-23T02:04:19.080+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='BASE TAG'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML'/><title type='text'>Solve absolute URL – relative URL issue without code changes using BASE tag (Google AJAX Feed API)</title><content type='html'>&lt;p&gt;&lt;strong&gt;     &lt;br /&gt;The Application&lt;/strong&gt;     &lt;br /&gt;&lt;br /&gt;I was trying out a sample application using &lt;strong&gt;Google AJAX Feed API&lt;/strong&gt;. The feeds were requested from a C# windows application and the responses (feed’s HTML content) were shown in a WebBrowser control.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;The Problem&lt;/strong&gt;     &lt;br /&gt;&lt;br /&gt;The weird problem was that the HTML snippet for some feed has relative URLs and they failed to display in the WebBrowser control. [For those, who are wondering what a relative and absolute URL is, see below.]&lt;/p&gt;  &lt;pre class="brush:xml"&gt;&amp;lt;!-- absolute URL --&amp;gt;&lt;br /&gt;&amp;lt;img src=&amp;quot;http://www.mywebsite.com/images/image.gif&amp;quot; /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!-- relative URL --&amp;gt;&lt;br /&gt;&amp;lt;img src=&amp;quot;images/image.gif&amp;quot; /&amp;gt;&lt;/pre&gt;&lt;p&gt;When i searched for it, few were trying to do a content search and to replace the relative URLs with absolute URLs. Well, this might be needed in some scenarios, but, not in my case, since the content gets rendered in a WebBrowser control.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;The Solution&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The &lt;strong&gt;BASE&lt;/strong&gt; tag can help us here. For me, I just put the feed content inside an HTML header section with BASE tag as shown below and now my feed renders fine; added the BASE-Target option also to make it better.&lt;/p&gt;&lt;pre class="brush: xml"&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&amp;lt;base href=&amp;quot;http://www.mywebsite.com/images/&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;!-- in the case of Google API, this was feed's link --&amp;gt;&lt;br /&gt;&amp;lt;base target=&amp;quot;_blank&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;!-- Provided this so that the links will open in new window --&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;!-- in the case of Google API, body has feed content --&amp;gt;&lt;br /&gt;&amp;lt;img src=&amp;quot;image.gif&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;a href=&amp;quot;http://www.mynewwebsite.com&amp;quot;&amp;gt;New Website&amp;lt;/a&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;strong&gt;The Conclusion&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Hope this solves the problem for few and the logic (use of BASE tag) will be useful in other scenarios too. As for the Google AJAX Feed API, I'm hoping that Google will fix this in the upcoming versions.&lt;br /&gt;&lt;br /&gt;&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:7cf1428e-52f0-4564-8fc3-8741ec296720" class="wlWriterEditableSmartContent"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/Google+AJAX+Feed+API" rel="tag"&gt;Google AJAX Feed API&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Absolute+URL" rel="tag"&gt;Absolute URL&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Relative+URL" rel="tag"&gt;Relative URL&lt;/a&gt;,&lt;a href="http://technorati.com/tags/BASE+TAG" rel="tag"&gt;BASE TAG&lt;/a&gt;,&lt;a href="http://technorati.com/tags/HTML" rel="tag"&gt;HTML&lt;/a&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9148728900153461678-6974106171507232048?l=sanalksankar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanalksankar.blogspot.com/feeds/6974106171507232048/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sanalksankar.blogspot.com/2010/02/solve-absolute-url-relative-issue-code.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/6974106171507232048'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/6974106171507232048'/><link rel='alternate' type='text/html' href='http://sanalksankar.blogspot.com/2010/02/solve-absolute-url-relative-issue-code.html' title='Solve absolute URL – relative URL issue without code changes using BASE tag (Google AJAX Feed API)'/><author><name>Sanal K. Sankar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_3Q-bcUHukBM/St8fSV6o0aI/AAAAAAAAC_g/DlPlN2Wpwzo/S220/sanal2_edited.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148728900153461678.post-3485278195214147416</id><published>2010-02-13T02:52:00.000+05:30</published><updated>2010-02-16T12:41:31.216+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='AJAX'/><title type='text'>Create simple and reusable objects for AJAX in JavaScript – ajaxRequest</title><content type='html'>&lt;p&gt;Well, there are similar ones out there. jQuery, YUI and AjaxObject are just to name a few, which has their own implementations along with other in-built functionalities. Then there is mine, which is done in a much simpler way with the cost of flexibility. If you’re just looking for a simple reusable JavaScript class for making AJAX calls (and AJAX calls only), you're at the right place.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;For Beginners:      &lt;br /&gt;&lt;/strong&gt;For the sake of the simplicity of this article, i will not be going in much detail about the basics of HTTP calls, the different modes (POST, GET) of communications and their related topics. Let’s just say that, an HTTP call or an AJAX call can be made to a URL (Ex: &lt;a href="http://www.mywebsite.com"&gt;http://www.mywebsite.com&lt;/a&gt;) using either GET (where URL has all the information like &lt;a href="http://www.mywebsite.com?name=john&amp;amp;age=25"&gt;http://www.mywebsite.com?name=john&amp;amp;age=25&lt;/a&gt;) or POST (where the form data is submitted as key-value pair like key1=value1&amp;amp;key2=value2 with appropriate header information on the request). Oops! did i just said everything about HTTP calls in one sentence? No, there is more.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;The ajaxRequest Snippet&lt;/strong&gt;     &lt;br /&gt;Here is the ajaxRequest’s code. The code is pretty straightforward and is designed in such a way that it works with minimum arguments. There are comments embedded in the code (download from below) and sample usage code provided below to make it’s use seamless.&lt;/p&gt;  &lt;pre class="brush: javascript"&gt;function ajaxRequest(url, method, postData) {&lt;br /&gt;    //validation start&lt;br /&gt;    if (url == undefined) return false;&lt;br /&gt;    this.method = method == undefined ? &amp;quot;GET&amp;quot; : method.toUpperCase();&lt;br /&gt;    if (this.method != &amp;quot;GET&amp;quot; &amp;amp;&amp;amp; this.method != &amp;quot;POST&amp;quot;) return false;&lt;br /&gt;    if (url == undefined || url == &amp;quot;&amp;quot;) return false;&lt;br /&gt;    //validation end&lt;br /&gt;    this.url = url + ((url.indexOf('?') &amp;gt; 0) ? &amp;quot;&amp;amp;ajts&amp;quot; : &amp;quot;?ajts&amp;quot;) + new Date().getTime();&lt;br /&gt;    var mainCls = this;&lt;br /&gt;    this.inProgress = false;&lt;br /&gt;    this.xmlHttpObj = null;&lt;br /&gt;    this.postData = postData;&lt;br /&gt;    this.toString = function() { return &amp;quot;Ajax by Sanal&amp;quot;; }&lt;br /&gt;    this.abort = function() {&lt;br /&gt;        if (mainCls.inProgress) {&lt;br /&gt;            mainCls.xmlHttpObj.abort();&lt;br /&gt;            mainCls.inProgress = false;&lt;br /&gt;            mainCls.xmlHttpObj = null;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    this.execute = function(statusChangeFunction) {&lt;br /&gt;        try {&lt;br /&gt;            // Firefox, Opera 8.0+, Safari&lt;br /&gt;            mainCls.xmlHttpObj = new XMLHttpRequest();&lt;br /&gt;        }&lt;br /&gt;        catch (e) {&lt;br /&gt;            // Internet Explorer&lt;br /&gt;            try {&lt;br /&gt;                mainCls.xmlHttpObj = new ActiveXObject(&amp;quot;Msxml2.XMLHTTP&amp;quot;);&lt;br /&gt;            }&lt;br /&gt;            catch (e) {&lt;br /&gt;                try {&lt;br /&gt;                    mainCls.xmlHttpObj = new ActiveXObject(&amp;quot;Microsoft.XMLHTTP&amp;quot;);&lt;br /&gt;                }&lt;br /&gt;                catch (e) {&lt;br /&gt;&lt;br /&gt;                    return false; //No support for AJAX&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        mainCls.xmlHttpObj.onreadystatechange = function() {&lt;br /&gt;            if (statusChangeFunction) {&lt;br /&gt;                statusChangeFunction(mainCls.xmlHttpObj.readyState, typeof (mainCls.xmlHttpObj.responseText) == &amp;quot;unknown&amp;quot; ? null : mainCls.xmlHttpObj.responseText, typeof (mainCls.xmlHttpObj.responseXML) == &amp;quot;unknown&amp;quot; ? null : mainCls.xmlHttpObj.responseXML, mainCls.xmlHttpObj.readyState==4 ? mainCls.xmlHttpObj.status : null);&lt;br /&gt;            }&lt;br /&gt;            if (mainCls.xmlHttpObj.readyState == 4) {&lt;br /&gt;                mainCls.inProgress = false;&lt;br /&gt;                mainCls.xmlHttpObj = null;&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        mainCls.xmlHttpObj.open(mainCls.method, mainCls.url, true);&lt;br /&gt;        if (mainCls.method == &amp;quot;POST&amp;quot;) {&lt;br /&gt;            mainCls.xmlHttpObj.setRequestHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/x-www-form-urlencoded&amp;quot;);&lt;br /&gt;            mainCls.xmlHttpObj.setRequestHeader(&amp;quot;Content-Length&amp;quot;, mainCls.postData.length);&lt;br /&gt;        }&lt;br /&gt;        mainCls.inProgress = true;&lt;br /&gt;        mainCls.xmlHttpObj.send(mainCls.method == &amp;quot;POST&amp;quot; ? mainCls.postData : null);&lt;br /&gt;        return true;&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;Code Download&lt;/strong&gt;&lt;br /&gt;The above code with embedded comments, along with the minified version, can be downloaded from &lt;a href="http://www.sanalks.com/blog_files/ajaxRequest/ajaxRequest_1.0.zip"&gt;here&lt;/a&gt;. [In case, if you don't know, minified version will not have the comments and spaces, to keep the file size to a minimum possible, making the server-browser communication faster.]&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Sample usage:&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;Provide a reference &lt;br /&gt;    &lt;br /&gt;&lt;/strong&gt;First, let the browser know that it needs to load the script.&lt;/p&gt;&lt;pre class="brush:xml"&gt;&lt;script src="ajaxRequest.js" type="text/javascript" language="javascript"&gt;&lt;/script&gt;&lt;/pre&gt;&lt;p&gt;If you're using the minified version, change the file name appropriately. &lt;/p&gt;&lt;p&gt;&lt;strong&gt;Create an Object &lt;/strong&gt;&lt;br /&gt;Then, in another scripting place, create an object for ajaxRequest as shown below. In the example below, the testAjax function will be the function that triggers the AJAX call to the server url “ajaxprocessor.aspx” which in turn processes the aynschronous requests. Since there are no other arguments passed, the call is defaulted to a GET call and the URL is expected to have input parameters for server processing.&lt;/p&gt;&lt;pre class="brush: javascript"&gt;function testAjax() {&lt;br /&gt;            var myAjaxRequest = new ajaxRequest(&amp;quot;ajaxprocessor.aspx?name=john&amp;quot;);&lt;br /&gt;            myAjaxRequest.execute(processMyRequest);&lt;br /&gt;            myAjaxRequest = null;&lt;br /&gt;        }&lt;/pre&gt;&lt;p&gt;One minor point to note here. Among the query strings that are being passed to the URL, it is not recommended to use the key &amp;quot;ajts&amp;quot; (AJAX timestamp) since that is being used by the ajaxRequest to make every AJAX call unique to the browser. This is applicable to both GET and POST requests.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Track your AJAX call&lt;/strong&gt;&lt;br /&gt;The “processMyRequest” function in the above code is the callback method, that gets executed when for every state change of your AJAX call. A simple implementation of the “processMyRequest” can be something like this. I’m assuming that you have a DIV with the id “myDIV” placed in your web page. [Beginners, you might want to know more about readyState and status for asynchronous calls]&lt;/p&gt;&lt;pre class="brush: javascript"&gt;function processMyRequest(readyState, responseText) {            &lt;br /&gt;            if (readyState == 1)//loaded&lt;br /&gt;                document.getElementById(&amp;quot;myDIV&amp;quot;).innerHTML = &amp;quot;Loading...&amp;quot;;&lt;br /&gt;            else if (readyState == 4)//complete&lt;br /&gt;                document.getElementById(&amp;quot;myDIV&amp;quot;).innerHTML = responseText;            &lt;br /&gt;        }  &lt;/pre&gt;&lt;p&gt;The callback function can be created with any number of arguments depending on the need. The arguments are in the order as specified in the main ajaxRequest code comments.&lt;/p&gt;&lt;p&gt;The sample approach can be used to make a POST call by changing the object creation as &lt;/p&gt;&lt;pre class="brush: javascript"&gt;var myAjaxRequest = new ajaxRequest(&amp;quot;ajaxprocessor.aspx&amp;quot;,&amp;quot;POST&amp;quot;,&amp;quot;key1=value1&amp;amp;key2=value2”);&lt;/pre&gt;&lt;br /&gt;Refer the downloaded ajaxRequest code for more technical details on each of these methods and variables.&lt;p&gt;&lt;strong&gt;Browser Compatibility&lt;/strong&gt;&lt;br /&gt;This code has been tested with IE, Firefox and Chrome and is expected to be working in most of the browsers. If problems are found, share them so that everyone will know.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Enhancements&lt;/strong&gt;&lt;br /&gt;Well, as mentioned at the beginning of this article, this might not be flexible enough. if you dig deep enough, you might find functionalities that could’ve included to make it better. Feel free to change the code for your usage and let me know what was missing.&lt;/p&gt;&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:8540333e-305c-4037-9a7b-ba0ef6832d5e" class="wlWriterEditableSmartContent"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/AJAX" rel="tag"&gt;AJAX&lt;/a&gt;,&lt;a href="http://technorati.com/tags/JavaScript" rel="tag"&gt;JavaScript&lt;/a&gt;,&lt;a href="http://technorati.com/tags/fast" rel="tag"&gt;fast&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Simple" rel="tag"&gt;Simple&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Object" rel="tag"&gt;Object&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Class" rel="tag"&gt;Class&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Snippet" rel="tag"&gt;Snippet&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Minify" rel="tag"&gt;Minify&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Server" rel="tag"&gt;Server&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Free" rel="tag"&gt;Free&lt;/a&gt;,&lt;a href="http://technorati.com/tags/LightWeight" rel="tag"&gt;LightWeight&lt;/a&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9148728900153461678-3485278195214147416?l=sanalksankar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanalksankar.blogspot.com/feeds/3485278195214147416/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sanalksankar.blogspot.com/2010/02/ajax-class-object-javascript-simple.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/3485278195214147416'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/3485278195214147416'/><link rel='alternate' type='text/html' href='http://sanalksankar.blogspot.com/2010/02/ajax-class-object-javascript-simple.html' title='Create simple and reusable objects for AJAX in JavaScript – ajaxRequest'/><author><name>Sanal K. Sankar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_3Q-bcUHukBM/St8fSV6o0aI/AAAAAAAAC_g/DlPlN2Wpwzo/S220/sanal2_edited.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148728900153461678.post-8829283315864991177</id><published>2010-02-04T22:50:00.002+05:30</published><updated>2010-02-04T22:53:28.203+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='retrieve'/><category scheme='http://www.blogger.com/atom/ns#' term='determine'/><category scheme='http://www.blogger.com/atom/ns#' term='fetch'/><category scheme='http://www.blogger.com/atom/ns#' term='width'/><category scheme='http://www.blogger.com/atom/ns#' term='calculate'/><category scheme='http://www.blogger.com/atom/ns#' term='height'/><category scheme='http://www.blogger.com/atom/ns#' term='element'/><title type='text'>Retrieve an element's width or height using JavaScript</title><content type='html'>Even though, not 100% browser independent, the following JavaScript code will get you an element's current/rendered width or height. The code is pretty simple and self-explanatory.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Code to retrieve element's width:&lt;/b&gt;&lt;pre class="brush: javascript"&gt;function getWidth(element){&lt;br /&gt;&lt;br /&gt;    if (typeof element.clip !== "undefined") //netscape&lt;br /&gt;    {&lt;br /&gt;        return element.clip.width;&lt;br /&gt;    }&lt;br /&gt;    else {&lt;br /&gt;        if (element.style.pixelWidth)//opera &lt;br /&gt;        {&lt;br /&gt;            return element.style.pixelWidth;&lt;br /&gt;        }&lt;br /&gt;        else //IE and firefox&lt;br /&gt;        {&lt;br /&gt;            return element.offsetWidth;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;b&gt;Code to retrieve element's height:&lt;/b&gt;&lt;pre class="brush: javascript"&gt;function getHeight(element){&lt;br /&gt;&lt;br /&gt;    if (typeof element.clip !== "undefined")    //netscape&lt;br /&gt;    {&lt;br /&gt;        return element.clip.height;&lt;br /&gt;    }&lt;br /&gt;    else {&lt;br /&gt;        if (element.style.pixelHeight) //opera&lt;br /&gt;        {&lt;br /&gt;            return element.style.pixelHeight;&lt;br /&gt;        }&lt;br /&gt;        else //IE and firefox&lt;br /&gt;        {&lt;br /&gt;            return element.offsetHeight;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;b&gt;Sample Usage:&lt;/b&gt;&lt;pre class="brush: javascript"&gt;&lt;br /&gt;function usage(){&lt;br /&gt; alert(getWidth(document.getElementById("yourElementId")));&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;This code works for most of the input (dropdown/select-one/Select-multiple, textbox, textarea) elements in an HTML form. Feel free to share any better solutions.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9148728900153461678-8829283315864991177?l=sanalksankar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanalksankar.blogspot.com/feeds/8829283315864991177/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sanalksankar.blogspot.com/2010/02/retrieve-elements-width-height.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/8829283315864991177'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/8829283315864991177'/><link rel='alternate' type='text/html' href='http://sanalksankar.blogspot.com/2010/02/retrieve-elements-width-height.html' title='Retrieve an element&apos;s width or height using JavaScript'/><author><name>Sanal K. Sankar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_3Q-bcUHukBM/St8fSV6o0aI/AAAAAAAAC_g/DlPlN2Wpwzo/S220/sanal2_edited.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148728900153461678.post-7066098572750946611</id><published>2010-01-07T01:36:00.001+05:30</published><updated>2010-01-07T01:39:08.005+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Image Management'/><category scheme='http://www.blogger.com/atom/ns#' term='Media Management'/><category scheme='http://www.blogger.com/atom/ns#' term='Software'/><title type='text'>Picasa Vs Windows Live Photo Gallery - A quick comparison</title><content type='html'>&lt;p&gt;If you're someone who went out to choose between Picasa and Windows Live Photo Gallery, don't look further. &lt;strong&gt;Picasa is the clear winner&lt;/strong&gt;. At this instant, there are not even comparable. Read ahead for more information. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;User Interface - Intuitiveness and simplicity&lt;/strong&gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Live photo gallery is simple and easy. The UI is not much congested as Picasa; may be because of the less visible features of Live gallery. Gallery is easy to play with. Picasa's UI has more options with various view modes and sliders all around providing greater flexibility. If your priority is for simplicity, Live Gallery wins here. But if you prefer flexibility, Picasa is the one. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Face Recognition&lt;/strong&gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; This is one place where Picasa rocks! Picasa has the easiest workflow (to assign the names for the detected faces in photos) available. As soon as the photos are added, Picasa scans them and groups them for you to name them. Each naming seems to improve Picasa's intelligence and face detection becomes more reliable and less error-prone. Live Gallery needs more manual activity to add people tags, making the workflow more cumbersome. Both the tools sometimes detects some part of the images as faces, while actually they are not. Live Gallery needs to improve a lot on this aspect. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Image Editing&lt;/strong&gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Again, Picasa is much better here. You will love the one touch abilities to fix your images and the ability to provide watermark or captions. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Sharing, Syncing, Email and Printing&lt;/strong&gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Both of them inherently supports their own photo sharing services online. Live Gallery supports adding Plug-ins too for sharing to other sites. Sync is much customizable and powerful operation in Picasa when compared to Live Gallery. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Export &lt;/strong&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Picasa allows you to export photos in bulk to the desired quality and size while Live gallery just provides a rename and resize facility for single images. Just in case, if you ended having some raw images for conversion, Picasa does this job much easier. You can even export them with watermarks. Common raw formats are supported by default in Picasa. Windows Live Gallery asks us to install plug-in for this. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Multiple format support for image and video      &lt;br /&gt;&lt;/strong&gt;&amp;#160;&amp;#160;&amp;#160; Well, this one may vary per user. Based on the formats that i had, Picasa handled all my videos and images without the need of any additional codec installs. Live Gallery did asked me to install additional plug-in. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Tagging&lt;/strong&gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Picasa has the leading edge here due to the availability of Quick tags and it seems to support all the standard tagging mechanisms like IPTC and EXIF. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Search      &lt;br /&gt;&lt;/strong&gt;&amp;#160;&amp;#160;&amp;#160; They both performed good here since they all searched based on tags and file names and provided the results. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Additional Features&lt;/strong&gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Live Gallery provides the facility to make a blog post and to create a Data CD with the images. Picasa goes much further in this aspect with Blogging, Collage, Geo-Tagging, Places association, multiple-image Screensaver, Movie Creation, Poster creation and list goes on... &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Conclude Now&lt;/strong&gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; This comparison can go further covering more minute details which doesn’t seem to be necessary for inferring the result. &lt;strong&gt;Picasa&lt;/strong&gt; provides much more flexibility and features in all those individual modules implemented when compared to Windows Live Gallery. Hopefully, we can expect more from Windows Live Gallery in the near future. &lt;/p&gt;  &lt;p&gt;If you’re in the lookout for similar tools with comparable capabilities, search for iPhoto (Mac) and Adobe Lightroom.&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:62add032-698f-47d5-8cbb-bc8aa2321beb" class="wlWriterEditableSmartContent"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/Comparison" rel="tag"&gt;Comparison&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Image+Management" rel="tag"&gt;Image Management&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Media+Management" rel="tag"&gt;Media Management&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Picasa" rel="tag"&gt;Picasa&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Windows+Live+Photo+Gallery" rel="tag"&gt;Windows Live Photo Gallery&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Face+Detection" rel="tag"&gt;Face Detection&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Face+Recognition" rel="tag"&gt;Face Recognition&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Images+and+Video" rel="tag"&gt;Images and Video&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Image+Sharing" rel="tag"&gt;Image Sharing&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Photo+Sharing" rel="tag"&gt;Photo Sharing&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Sync" rel="tag"&gt;Sync&lt;/a&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9148728900153461678-7066098572750946611?l=sanalksankar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanalksankar.blogspot.com/feeds/7066098572750946611/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sanalksankar.blogspot.com/2010/01/compare-picasa-vs-live-photo-gallery.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/7066098572750946611'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/7066098572750946611'/><link rel='alternate' type='text/html' href='http://sanalksankar.blogspot.com/2010/01/compare-picasa-vs-live-photo-gallery.html' title='Picasa Vs Windows Live Photo Gallery - A quick comparison'/><author><name>Sanal K. Sankar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_3Q-bcUHukBM/St8fSV6o0aI/AAAAAAAAC_g/DlPlN2Wpwzo/S220/sanal2_edited.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148728900153461678.post-2868080052661534780</id><published>2009-12-20T23:04:00.001+05:30</published><updated>2009-12-20T23:14:21.042+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='SEO'/><category scheme='http://www.blogger.com/atom/ns#' term='Internet'/><title type='text'>Compare Google, Bing and Yahoo webmaster tools – who indexes faster?</title><content type='html'>&lt;p&gt;   &lt;br /&gt;Well, we all know that these giants provide search-engines which make our life better, by pointing us to the right web pages that we’re searching for. They have their own crawlers to find out what all of these web pages has as contents and to index (assuming that you know what is indexing) them. To assist this process, they all have webmaster tools too, so that web site owners can submit and update the information related to the websites they own to these search engines using sitemaps. The following list shows their webmaster tools and the links to them, as currently available.&lt;/p&gt;  &lt;table border="1" bordercolor="#cecece" cellspacing="0" cellpadding="2" width="100%"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top"&gt;Google&lt;/td&gt;        &lt;td valign="top"&gt;Google Webmaster Tools&lt;/td&gt;        &lt;td valign="top"&gt;&lt;a href="http://www.google.com/webmasters/"&gt;http://www.google.com/webmasters/&lt;/a&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;Bing&lt;/td&gt;        &lt;td valign="top"&gt;Webmaster Center&lt;/td&gt;        &lt;td valign="top"&gt;&lt;a href="http://www.bing.com/webmaster"&gt;http://www.bing.com/webmaster&lt;/a&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;Yahoo!&lt;/td&gt;        &lt;td valign="top"&gt;Site Explorer&lt;/td&gt;        &lt;td valign="top"&gt;&lt;a href="http://siteexplorer.search.yahoo.com/"&gt;http://siteexplorer.search.yahoo.com/&lt;/a&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;Following is my experience with the above tools and the inference based on them, which might be totally different from yours and can change from time to time. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;The First Experience:&lt;/strong&gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; For one of my website, a standard sitemap was created and was submitted to all of these webmaster tools almost at the same time. To be precise, Sitemap was submitted to Google and Bing on the same day and was submitted to Yahoo few days later. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Result:&lt;/strong&gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Google indexed the pages first which happened with few days and started showing them in their search results. Bing took slightly more than a week to index them while Yahoo totally ignored them. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;The second experience:&lt;/strong&gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; After around 2 months, the site had to be moved to another domain, which means another URL. The same content had to be placed in the new links. For the sake of indexing, the old domain was kept alive with only the updated sitemap (removed old links) and the content was moved to the new website with a sitemap of its own. Again, both the website’s sitemap was submitted to these tools at the same time. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Result:&lt;/strong&gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Here again, Google found my new website within a week and started showing them as indexed. It took slightly more than a week for Google to remove my old website links from their list. For Bing, even after two months, my old website links are still showing up in results and nothing from my new website is indexed. Yahoo Site Explorer is the simple one here, since nothing from my websites has been indexed in their list until now. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; May be, there are technicalities involved based on moving the same content among websites OR the dependency of various aspects that controls the indexing process for search engines is too complex to accommodate the above scenario OR the other tools does well in other scenarios. But, whatever that is, for a user, for a specific content, based on the previous and the experiences stated above, it is found Google comes up with result of your sitemap submission first regardless of whether that is positive or negative. For a moment, I thought that we are going to have multiple options for web searches. But, it looks like I will have to stick with Google for updated results.&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:571a3973-71ab-4d5a-9739-9b3176b47315" class="wlWriterEditableSmartContent"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/Google+Webmaster" rel="tag"&gt;Google Webmaster&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Webmaster+Center" rel="tag"&gt;Webmaster Center&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Site+Explorer" rel="tag"&gt;Site Explorer&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Sitemap" rel="tag"&gt;Sitemap&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Index" rel="tag"&gt;Index&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Fast" rel="tag"&gt;Fast&lt;/a&gt;,&lt;a href="http://technorati.com/tags/SEO" rel="tag"&gt;SEO&lt;/a&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9148728900153461678-2868080052661534780?l=sanalksankar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanalksankar.blogspot.com/feeds/2868080052661534780/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sanalksankar.blogspot.com/2009/12/compare-google-bing-yahoo-webmaster.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/2868080052661534780'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/2868080052661534780'/><link rel='alternate' type='text/html' href='http://sanalksankar.blogspot.com/2009/12/compare-google-bing-yahoo-webmaster.html' title='Compare Google, Bing and Yahoo webmaster tools – who indexes faster?'/><author><name>Sanal K. Sankar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_3Q-bcUHukBM/St8fSV6o0aI/AAAAAAAAC_g/DlPlN2Wpwzo/S220/sanal2_edited.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148728900153461678.post-6974540834063789628</id><published>2009-12-18T00:45:00.002+05:30</published><updated>2009-12-18T01:31:32.654+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><title type='text'>Get and Set values for all form elements using JavaScript</title><content type='html'>&lt;p&gt;   &lt;br /&gt;Here, we will cover the &lt;u&gt;basic&lt;/u&gt; logic to retrieve and set values for various HTML form elements using a sample JavaScript code. &lt;/p&gt;  &lt;p&gt;This discussion assumes that you are familiar with the methods like document.getElementById, document.getElementsByName etc.. to find and load the element for further processing. For a quick note, if it is assumed that you have a textbox with id, ‘myText’, then that text can be accessed by document.getElementsById(‘myText’).&lt;/p&gt;  &lt;p&gt;The logic is pretty simple and is based on the concept that each element has it’s own individual property to be set. Below is the table that shows just that.&lt;/p&gt;  &lt;table border="1" cellspacing="0" cellpadding="2" width="100%" bordercolor="#CECECE"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td style="white-space: nowrap" valign="top"&gt;&lt;strong&gt;Element Type&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top"&gt;&lt;strong&gt;Property to be used&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top"&gt;&lt;strong&gt;Comments&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;checkbox&lt;/td&gt;        &lt;td valign="top"&gt;checked&lt;/td&gt;        &lt;td valign="top"&gt;&amp;#160;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;hidden&lt;/td&gt;        &lt;td valign="top"&gt;value&lt;/td&gt;        &lt;td valign="top"&gt;&amp;#160;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;radio&lt;/td&gt;        &lt;td valign="top"&gt;checked&lt;/td&gt;        &lt;td valign="top"&gt;&amp;#160;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;text&lt;/td&gt;        &lt;td valign="top"&gt;value&lt;/td&gt;        &lt;td valign="top"&gt;&amp;#160;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;textarea&lt;/td&gt;        &lt;td valign="top"&gt;value&lt;/td&gt;        &lt;td valign="top"&gt;&amp;#160;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;select-one&lt;/td&gt;        &lt;td valign="top"&gt;selected          &lt;br /&gt;OR           &lt;br /&gt;selectedIndex&lt;/td&gt;        &lt;td valign="top"&gt;This is a dropdown. It can be either set by setting the ‘selected’ property of the options collection OR setting the selectedIndex property of the dropdown itself. &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;select-multiple&lt;/td&gt;        &lt;td valign="top"&gt;selected          &lt;br /&gt;OR           &lt;br /&gt;selectedIndex&lt;/td&gt;        &lt;td valign="top"&gt;This is multi-select dropdown which is created using multiple=&amp;quot;multiple&amp;quot; for a select tag. Works similar to select-one.&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;To get the value of a particular element, use it’s appropriate property based on the type of the element being processed. The below code shows how that can be done in a simple manner. Note that the select-multiple returns an array of selected values. This code is presented in simple if..else syntax for simplicity. Provide error catching mechanism as necessary.&lt;/p&gt;  &lt;pre class="brush: javascript"&gt;function getValue(element)//returns the value&lt;br /&gt;{&lt;br /&gt;	if (element==null) return null;&lt;br /&gt;	var returnValue;	&lt;br /&gt;	if (element.type==&amp;quot;select-one&amp;quot;) &lt;br /&gt;	{   &lt;br /&gt;		//dropdown (select-one)&lt;br /&gt;		returnValue = element.options[element.selectedIndex].value;		&lt;br /&gt;	}&lt;br /&gt;	else if (element.type==&amp;quot;select-multiple&amp;quot;) &lt;br /&gt;	{&lt;br /&gt;		//multi-select drop down&lt;br /&gt;		var returnArray = new Array();&lt;br /&gt;		for(var i = 0; i &amp;lt; element.options.length; i++) &lt;br /&gt;		{&lt;br /&gt;			if(element.options[i].selected == true) &lt;br /&gt;			{&lt;br /&gt;				returnArray.push(element.options[i].value);&lt;br /&gt;			}&lt;br /&gt;		}&lt;br /&gt;		return returnArray;&lt;br /&gt;	}&lt;br /&gt;	else if (element.type==&amp;quot;checkbox&amp;quot;)&lt;br /&gt;	{&lt;br /&gt;		//checkbox element&lt;br /&gt;		returnValue = Boolean(element.checked);&lt;br /&gt;	}&lt;br /&gt;	else if (element.type==&amp;quot;radio&amp;quot;)&lt;br /&gt;	{&lt;br /&gt;		//radio element&lt;br /&gt;		returnValue = Boolean(element.checked);&lt;br /&gt;	}&lt;br /&gt;	else&lt;br /&gt;	{&lt;br /&gt;		//text, textarea, hidden&lt;br /&gt;		returnValue = element.value;&lt;br /&gt;	}&lt;br /&gt;	return returnValue;&lt;br /&gt;}&lt;/pre&gt;&lt;p&gt;To set the value, it’s just the reverse process, which is shown below.&lt;/p&gt;&lt;pre class="brush: javascript"&gt;function setValue(element, value)//return whether the set was successful.&lt;br /&gt;{ &lt;br /&gt;	if (element==null) return false;&lt;br /&gt;	if (value==null) return false;&lt;br /&gt;	var returnValue;	&lt;br /&gt;	if (element.type==&amp;quot;select-one&amp;quot;) &lt;br /&gt;	{   &lt;br /&gt;		//dropdown (select-one)&lt;br /&gt;		for(var i = 0; i &amp;lt; element.options.length; i++) &lt;br /&gt;		{&lt;br /&gt;			if(element.options[i].value == value) &lt;br /&gt;			{&lt;br /&gt;				element.selectedIndex = i;&lt;br /&gt;				returnValue = true;&lt;br /&gt;				break;&lt;br /&gt;			}&lt;br /&gt;		}		&lt;br /&gt;	}&lt;br /&gt;	else if (element.type==&amp;quot;select-multiple&amp;quot;) &lt;br /&gt;	{&lt;br /&gt;		//multi-select drop down, expects the value to be an array of selected values&lt;br /&gt;		for(var j = 0; j &amp;lt; value.length; j++)&lt;br /&gt;		{&lt;br /&gt;			for(var i = 0; i &amp;lt; element.options.length; i++) &lt;br /&gt;			{&lt;br /&gt;				if(element.options[i].value == value[j]) &lt;br /&gt;				{&lt;br /&gt;					element.options[i].selected = true;					&lt;br /&gt;					break;&lt;br /&gt;				}&lt;br /&gt;			}				&lt;br /&gt;		}&lt;br /&gt;		returnValue = true;&lt;br /&gt;	}&lt;br /&gt;	else if (element.type==&amp;quot;checkbox&amp;quot;)&lt;br /&gt;	{&lt;br /&gt;		//checkbox element&lt;br /&gt;		element.checked = Boolean(value);&lt;br /&gt;		returnValue = true;&lt;br /&gt;	}&lt;br /&gt;	else if (element.type==&amp;quot;radio&amp;quot;)&lt;br /&gt;	{&lt;br /&gt;		//radio element&lt;br /&gt;		element.checked = Boolean(value);&lt;br /&gt;		returnValue = true;&lt;br /&gt;	}&lt;br /&gt;	else&lt;br /&gt;	{&lt;br /&gt;		//text, textarea, hidden&lt;br /&gt;		element.value = value;&lt;br /&gt;		returnValue = true;&lt;br /&gt;	}&lt;br /&gt;	return returnValue;&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Additional thoughts:&lt;/strong&gt;&lt;br /&gt;If, the controls are rendered from an ASP.net application, there may be times where the value from a Label control is to be set or retrieved. Since a Label is rendered as a SPAN element, this can be done by enhancing the code for checking the nodeName OR tagName (or any appropriate property) and using innerHTML to set or get the value of the SPAN element.&lt;/p&gt;&lt;br /&gt;&lt;div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:a851794c-e0b6-464c-9480-807c0fde4603" style="float:none; display:inline; margin:0px; padding:0px 0px 0px 0px;"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/Javascript" rel="tag"&gt;Javascript&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Element" rel="tag"&gt;Element&lt;/a&gt;,&lt;a href="http://technorati.com/tags/retrieve" rel="tag"&gt;retrieve&lt;/a&gt;,&lt;a href="http://technorati.com/tags/set+value" rel="tag"&gt;set value&lt;/a&gt;,&lt;a href="http://technorati.com/tags/ALL" rel="tag"&gt;ALL&lt;/a&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9148728900153461678-6974540834063789628?l=sanalksankar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanalksankar.blogspot.com/feeds/6974540834063789628/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sanalksankar.blogspot.com/2009/12/get-retrieve-set-value-all-form-element.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/6974540834063789628'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/6974540834063789628'/><link rel='alternate' type='text/html' href='http://sanalksankar.blogspot.com/2009/12/get-retrieve-set-value-all-form-element.html' title='Get and Set values for all form elements using JavaScript'/><author><name>Sanal K. Sankar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_3Q-bcUHukBM/St8fSV6o0aI/AAAAAAAAC_g/DlPlN2Wpwzo/S220/sanal2_edited.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148728900153461678.post-2061376144185131504</id><published>2009-12-11T00:53:00.001+05:30</published><updated>2009-12-13T01:51:45.815+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='GDI+'/><category scheme='http://www.blogger.com/atom/ns#' term='.net'/><category scheme='http://www.blogger.com/atom/ns#' term='thumbnail'/><title type='text'>Simple and advanced methods for creating thumbnail images in .net using c#</title><content type='html'>&lt;p&gt;   &lt;br /&gt;When I stumbled upon GetThumbnailImage method available in the Image class for the first time, I immediately went ahead with the thought that now I have a native and efficient way to create thumbnails. I used a code similar to what shown below.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Option 1: using GetThumbnailImage&lt;/strong&gt;&lt;/p&gt;&lt;pre class="brush: csharp"&gt;private Image getThumbNailUsingGetThumbnailImage(string fileName)&lt;br /&gt;        {&lt;br /&gt;            Image img = Image.FromFile(fileName);&lt;br /&gt;            return img.GetThumbnailImage(300, 300, null, IntPtr.Zero);&lt;br /&gt;        }&lt;/pre&gt;&lt;p&gt;The result was quick. But, soon it was found that this will not work as efficiently as I expected. The biggest problem was that when the image got edited by any of the image editing tools out there, the thumbnail creation went wrong. It was because of the reason that GetThumbnailImage was depending up on the image metadata as it was set when the image got created. If the image thumbnail property is not getting modified by your image editing tool, GetThumbnailImage will fail to get the right thumbnail. Below is a similar method that retrieves the thumbnail from the PropertyItem collection of an image.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Option 2: Using PropertyItem&lt;/strong&gt;&lt;/p&gt;&lt;pre class="brush: csharp"&gt;private Image createThumbFromProperty(string file)&lt;br /&gt;        {&lt;br /&gt;            Image image = new Bitmap(file);&lt;br /&gt;            Image Thumb = null;&lt;br /&gt;            PropertyItem[] propItems = image.PropertyItems;&lt;br /&gt;            foreach (PropertyItem propItem in propItems)&lt;br /&gt;            {&lt;br /&gt;                if (propItem.Id == 0x501B)&lt;br /&gt;                {&lt;br /&gt;                    byte[] imageBytes = propItem.Value;&lt;br /&gt;                    MemoryStream stream = new MemoryStream(imageBytes.Length);&lt;br /&gt;                    stream.Write(imageBytes, 0, imageBytes.Length);&lt;br /&gt;                    Thumb = Image.FromStream(stream);&lt;br /&gt;                    break;&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            return Thumb;&lt;br /&gt;        }&lt;/pre&gt;&lt;p&gt;Thus started a lookout for a performance-improved simple way to achieve this which resulted in the following methods. Basically, these methods used GDI+. The logic seems pretty simple, which is to create another small in-memory based on the size of the thumbnail needed. It breaks down to this.&lt;/p&gt;&lt;p&gt;1. Load the original image &lt;br /&gt;2. Get the proportional size of the image based on the original Image size and target thumbnail size &lt;br /&gt;3. Redraw the image to the new canvas &lt;/p&gt;&lt;p&gt;A sample code for this is shown below&lt;/p&gt;&lt;strong&gt;Option 3: Using GDI+ for simple thumbnail&lt;/strong&gt;&lt;pre class="brush: csharp"&gt;private Image getThumbNail(string fileName)&lt;br /&gt;        {&lt;br /&gt;            FileStream fs = new FileStream(fileName, FileMode.Open);&lt;br /&gt;            Image im = Image.FromStream(fs);&lt;br /&gt;            Size szMax = new Size(300, 300);&lt;br /&gt;            Size sz = getProportionalSize(szMax, im.Size);&lt;br /&gt;            // superior image quality   &lt;br /&gt;            Bitmap bmpResized = new Bitmap(sz.Width, sz.Height);&lt;br /&gt;            using (Graphics g = Graphics.FromImage(bmpResized))&lt;br /&gt;            {&lt;br /&gt;                g.InterpolationMode = InterpolationMode.HighQualityBicubic;&lt;br /&gt;                g.DrawImage(&lt;br /&gt;                    im,&lt;br /&gt;                    new Rectangle(Point.Empty, sz),&lt;br /&gt;                    new Rectangle(Point.Empty, im.Size),&lt;br /&gt;                    GraphicsUnit.Pixel);&lt;br /&gt;            }&lt;br /&gt;            im.Dispose(); im = null;&lt;br /&gt;            fs.Close(); fs.Dispose(); fs = null;&lt;br /&gt;            return bmpResized;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;private Size getProportionalSize(Size szMax, Size szReal)&lt;br /&gt;        {&lt;br /&gt;            int nWidth;&lt;br /&gt;            int nHeight;&lt;br /&gt;            double sMaxRatio;&lt;br /&gt;            double sRealRatio;&lt;br /&gt;&lt;br /&gt;            if (szMax.Width &lt; 1 || szMax.Height &lt; 1 || szReal.Width &lt; 1 || szReal.Height &lt; 1)&lt;br /&gt;                return Size.Empty;&lt;br /&gt;&lt;br /&gt;            sMaxRatio = (double)szMax.Width / (double)szMax.Height;&lt;br /&gt;            sRealRatio = (double)szReal.Width / (double)szReal.Height;&lt;br /&gt;&lt;br /&gt;            if (sMaxRatio &lt; sRealRatio)&lt;br /&gt;            {&lt;br /&gt;                nWidth = Math.Min(szMax.Width, szReal.Width);&lt;br /&gt;                nHeight = (int)Math.Round(nWidth / sRealRatio);&lt;br /&gt;            }&lt;br /&gt;            else&lt;br /&gt;            {&lt;br /&gt;                nHeight = Math.Min(szMax.Height, szReal.Height);&lt;br /&gt;                nWidth = (int)Math.Round(nHeight * sRealRatio);&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            return new Size(nWidth, nHeight);&lt;br /&gt;        }&lt;/pre&gt;&lt;p&gt;Now that we know how to draw things on the Bitmap (canvas), we can play around and create framed thumbnails as shown below. The code below will create a frame effect around the thumbnail.&lt;/p&gt;&lt;strong&gt;Option 4: Using GDI+ for framed thumbnail&lt;/strong&gt;&lt;pre class="brush: csharp"&gt;private Image getThumbNailWithFrame(string fileName)&lt;br /&gt;        {&lt;br /&gt;            FileStream fs = new FileStream(fileName, FileMode.Open);&lt;br /&gt;            Image im = Image.FromStream(fs);&lt;br /&gt;            Size szMax = new Size(300, 300);&lt;br /&gt;            Size sz = getProportionalSize(szMax, im.Size);&lt;br /&gt;            // superior image quality   &lt;br /&gt;            Bitmap bmpResized = new Bitmap(sz.Width, sz.Height);&lt;br /&gt;            using (Graphics g = Graphics.FromImage(bmpResized))&lt;br /&gt;            {&lt;br /&gt;                g.InterpolationMode = InterpolationMode.HighQualityBicubic;&lt;br /&gt;                g.FillRectangle(Brushes.White, 0, 0, sz.Width, sz.Height);&lt;br /&gt;                int FrameWidth = 5;//decides the frame border width&lt;br /&gt;                g.DrawRectangle(new Pen(Color.Silver, FrameWidth - 2), 0, 0, sz.Width - 1, sz.Height - 1);&lt;br /&gt;                FrameWidth += 5;//decide the frame width&lt;br /&gt;                g.DrawImage(im, new Rectangle(FrameWidth, FrameWidth, sz.Width - FrameWidth * 2, sz.Height - FrameWidth * 2), new Rectangle(Point.Empty, im.Size), GraphicsUnit.Pixel);&lt;br /&gt;            }&lt;br /&gt;            im.Dispose(); im = null;&lt;br /&gt;            fs.Close(); fs.Dispose(); fs = null;&lt;br /&gt;            return bmpResized;&lt;br /&gt;        }&lt;/pre&gt;&lt;p&gt;We can even extend this concept to create shades around the generated thumbnail. The below code demonstrates that on a white background.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Option 5: Using GDI+ for shaded thumbnail&lt;/strong&gt;&lt;/p&gt;&lt;pre class="brush: csharp"&gt;private Image createThumbnailUsingGDI(ref Image imgPhoto, int destWidth, int destHeight)&lt;br /&gt;        {&lt;br /&gt;            int sourceX = 0;&lt;br /&gt;            int sourceY = 0;&lt;br /&gt;&lt;br /&gt;            int destX = 0;&lt;br /&gt;            int destY = 0;&lt;br /&gt;            int sourceWidth = imgPhoto.Width;&lt;br /&gt;            int sourceHeight = imgPhoto.Height;&lt;br /&gt;          &lt;br /&gt;            Bitmap b = new Bitmap(destWidth, destHeight);&lt;br /&gt;&lt;br /&gt;            Graphics grPhoto = Graphics.FromImage(b);&lt;br /&gt;&lt;br /&gt;            grPhoto.FillRectangle(Brushes.DarkGray, new Rectangle(destX, destY, destWidth, destHeight));&lt;br /&gt;            grPhoto.DrawLine(new Pen(Brushes.LightGray), new Point(0, destHeight - 1), new Point(destWidth, destHeight - 1));&lt;br /&gt;            grPhoto.DrawLine(new Pen(Brushes.LightGray), new Point(destWidth - 1, 0), new Point(destWidth - 1, destHeight));&lt;br /&gt;            //shade right&lt;br /&gt;            grPhoto.FillRectangle(Brushes.White, new Rectangle(destWidth - 3, 0, 7, 2));&lt;br /&gt;            grPhoto.FillRectangle(Brushes.White, new Rectangle(destWidth - 2, 0, 7, 4));&lt;br /&gt;            grPhoto.FillRectangle(Brushes.White, new Rectangle(destWidth - 1, 0, 7, 6));&lt;br /&gt;&lt;br /&gt;            //shade botton&lt;br /&gt;            grPhoto.FillRectangle(Brushes.White, new Rectangle(0, destHeight - 3, 2, 7));&lt;br /&gt;            grPhoto.FillRectangle(Brushes.White, new Rectangle(0, destHeight - 2, 4, 7));&lt;br /&gt;            grPhoto.FillRectangle(Brushes.White, new Rectangle(0, destHeight - 1, 6, 7));&lt;br /&gt;            grPhoto.DrawImage(imgPhoto, new Rectangle(destX + 2, destY + 2, destWidth - 7, destHeight - 7), new Rectangle(sourceX, sourceY, sourceWidth, sourceHeight), GraphicsUnit.Pixel);&lt;br /&gt;&lt;br /&gt;            grPhoto.Dispose();&lt;br /&gt;            return b;&lt;br /&gt;&lt;br /&gt;        }&lt;/pre&gt;&lt;p&gt;These methods do provides some flexibility and they are efficient enough for small scale applications. But, if we're talking about large number of images where memory and performance are critical factors, these may not suffice. We can fine tune the above methods by any/all of the following approaches and of course, lot others.&lt;/p&gt;&lt;p&gt;1. Having proper &amp;quot;using&amp;quot; keywords&lt;br /&gt;2. making sure that the objects are destroyed properly&lt;br /&gt;3. Having the thumbnail creating method loaded as static so that is always ready for you.&lt;br /&gt;4. Get yourself equipped with knowledge on Graphics class which has numerous drawing capabilities and various brushes.&lt;/p&gt;&lt;p&gt;Once you have your thumbnail generation code ready, use it with extensive multi-threading concepts to give the user a pleasant feeling. If you're looking for any basic threading knowledge, look at my other article &lt;a href="http://sanalksankar.blogspot.com/2009/10/threading-in-net-for-beginners.html" target="_blank"&gt;here&lt;/a&gt;. &lt;br/&gt;&lt;br/&gt;I know, there may be few who might be hoping that we could've had something simple like GetThumbnailImage which didn't had any pitfalls. Well, there may be. &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.aspx" target="_blank"&gt;System.Windows.Media.Imaging&lt;/a&gt; might be the place to look at for these capabilities.&lt;br /&gt;&lt;br /&gt;Please note that this article is for learning purposes. If you are here for quick code to be used for production purposes, please look elsewhere.&lt;br /&gt;&lt;br /&gt;Reference:   &lt;br /&gt;&lt;a href="http://danbystrom.se" target="_blank"&gt;http://danbystrom.se&lt;/a&gt;&lt;/p&gt;&lt;div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:f1a9f240-691c-469f-a3cf-0e156962d7c9" style="float:none; display:inline; margin:0px; padding:0px 0px 0px 0px;"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/thumbnail" rel="tag"&gt;thumbnail&lt;/a&gt;,&lt;a href="http://technorati.com/tags/.net" rel="tag"&gt;.net&lt;/a&gt;,&lt;a href="http://technorati.com/tags/c%23" rel="tag"&gt;c#&lt;/a&gt;,&lt;a href="http://technorati.com/tags/GDI%2b" rel="tag"&gt;GDI+&lt;/a&gt;,&lt;a href="http://technorati.com/tags/performance" rel="tag"&gt;performance&lt;/a&gt;,&lt;a href="http://technorati.com/tags/simple" rel="tag"&gt;simple&lt;/a&gt;,&lt;a href="http://technorati.com/tags/efficient" rel="tag"&gt;efficient&lt;/a&gt;,&lt;a href="http://technorati.com/tags/GetThumbnailImage" rel="tag"&gt;GetThumbnailImage&lt;/a&gt;,&lt;a href="http://technorati.com/tags/metadata" rel="tag"&gt;metadata&lt;/a&gt;,&lt;a href="http://technorati.com/tags/PropertyItem" rel="tag"&gt;PropertyItem&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Bitmap" rel="tag"&gt;Bitmap&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Image" rel="tag"&gt;Image&lt;/a&gt;,&lt;a href="http://technorati.com/tags/fast" rel="tag"&gt;fast&lt;/a&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9148728900153461678-2061376144185131504?l=sanalksankar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanalksankar.blogspot.com/feeds/2061376144185131504/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sanalksankar.blogspot.com/2009/12/create-thumbnail-image-c-net-gdi.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/2061376144185131504'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/2061376144185131504'/><link rel='alternate' type='text/html' href='http://sanalksankar.blogspot.com/2009/12/create-thumbnail-image-c-net-gdi.html' title='Simple and advanced methods for creating thumbnail images in .net using c#'/><author><name>Sanal K. Sankar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_3Q-bcUHukBM/St8fSV6o0aI/AAAAAAAAC_g/DlPlN2Wpwzo/S220/sanal2_edited.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148728900153461678.post-3856492318766186040</id><published>2009-11-21T01:20:00.000+05:30</published><updated>2009-12-09T01:23:34.810+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='submit'/><category scheme='http://www.blogger.com/atom/ns#' term='server'/><category scheme='http://www.blogger.com/atom/ns#' term='__VIEWSTATE'/><category scheme='http://www.blogger.com/atom/ns#' term='event'/><category scheme='http://www.blogger.com/atom/ns#' term='detect'/><category scheme='http://www.blogger.com/atom/ns#' term='UseSubmitBehavior'/><category scheme='http://www.blogger.com/atom/ns#' term='process'/><category scheme='http://www.blogger.com/atom/ns#' term='post'/><category scheme='http://www.blogger.com/atom/ns#' term='form'/><category scheme='http://www.blogger.com/atom/ns#' term='method'/><category scheme='http://www.blogger.com/atom/ns#' term='__EVENTVALIDATION'/><category scheme='http://www.blogger.com/atom/ns#' term='__doPostBack'/><category scheme='http://www.blogger.com/atom/ns#' term='handler'/><category scheme='http://www.blogger.com/atom/ns#' term='client'/><category scheme='http://www.blogger.com/atom/ns#' term='function'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.net'/><category scheme='http://www.blogger.com/atom/ns#' term='code'/><category scheme='http://www.blogger.com/atom/ns#' term='postback'/><category scheme='http://www.blogger.com/atom/ns#' term='logic'/><title type='text'>How events are detected and triggered by ASP.net server during Form Submit or Postback</title><content type='html'>Remember those days when we had only a single communication to the server where we had to handle all the related events? We were not having the flexibility to attach events to each and every control and use specific event handlers in the server that time. Well, we all know those days are long gone after ASP.net came in. Given the fact that the underlying communication architecture between the client browser and server remains almost the same, have you ever wondered how ASP.net managed to attach these events and call the appropriate event handler method in the server. If you're curious, go ahead with this article. We will try to understand the basics of what is going on and how we can override and use them, in case the need arises.&lt;br /&gt;&lt;br /&gt;Here is sample asp.net page with one text box control and two server (runat="server") buttons that has server events. They are having their default properties.&lt;br /&gt;&lt;br /&gt;Here is the &lt;span style="font-weight:bold;"&gt;designer code:&lt;/span&gt;&lt;pre class="brush: xml"&gt;&amp;lt;%@ Page Language=&amp;quot;C#&amp;quot; AutoEventWireup=&amp;quot;true&amp;quot; CodeFile=&amp;quot;postback.aspx.cs&amp;quot; Inherits=&amp;quot;postback&amp;quot; %&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD XHTML 1.0 Transitional//EN&amp;quot; &amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&amp;quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot; &amp;gt;&lt;br /&gt;&amp;lt;head runat=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;title&amp;gt;Events and Postback&amp;lt;/title&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;form id=&amp;quot;form1&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;div&amp;gt;&lt;br /&gt;&amp;lt;asp:TextBox ID=&amp;quot;TextBox1&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;br /&gt;&amp;lt;asp:Button ID=&amp;quot;Button1&amp;quot; runat=&amp;quot;server&amp;quot; OnClick=&amp;quot;Button1_Click&amp;quot; Text=&amp;quot;Button 1&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;asp:Button ID=&amp;quot;Button2&amp;quot; runat=&amp;quot;server&amp;quot; OnClick=&amp;quot;Button2_Click&amp;quot; Text=&amp;quot;Button 2&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Here is the &lt;span style="font-weight:bold;"&gt;server code&lt;/span&gt;:&lt;br /&gt;&lt;pre class="brush: csharp"&gt;using System;&lt;br /&gt;using System.Data;&lt;br /&gt;using System.Configuration;&lt;br /&gt;using System.Collections;&lt;br /&gt;using System.Web;&lt;br /&gt;using System.Web.Security;&lt;br /&gt;using System.Web.UI;&lt;br /&gt;using System.Web.UI.WebControls;&lt;br /&gt;using System.Web.UI.WebControls.WebParts;&lt;br /&gt;using System.Web.UI.HtmlControls;&lt;br /&gt;&lt;br /&gt;public partial class postback : System.Web.UI.Page&lt;br /&gt;{&lt;br /&gt;protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;protected void Button1_Click(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;TextBox1.Text = "1";&lt;br /&gt;}&lt;br /&gt;protected void Button2_Click(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;TextBox1.Text = "2";&lt;br /&gt;}&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Here is &lt;span style="font-weight:bold;"&gt;client source code&lt;/span&gt; that was pushed by ASP.net:&lt;br /&gt;&lt;pre class="brush: xml"&gt;&amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD XHTML 1.0 Transitional//EN&amp;quot; &amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&amp;quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot; &amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;&lt;br /&gt;Events and Postback&lt;br /&gt;&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;form name=&amp;quot;form1&amp;quot; method=&amp;quot;post&amp;quot; action=&amp;quot;postback.aspx&amp;quot; id=&amp;quot;form1&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;div&amp;gt;&lt;br /&gt;&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;__VIEWSTATE&amp;quot; id=&amp;quot;__VIEWSTATE&amp;quot; value=&amp;quot;/wEPDwUKMTk0MTQ1MTcxMWRkFKmiofOm3t+a1FeTyiSsorNM4sk=&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;div&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;__EVENTVALIDATION&amp;quot; id=&amp;quot;__EVENTVALIDATION&amp;quot; value=&amp;quot;/wEWBAKWt63zDALs0bLrBgKM54rGBgK7q7GGCNoGUvTkiMJt3F6eDcqfS57GMOdl&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;div&amp;gt;&lt;br /&gt;&amp;lt;input name=&amp;quot;TextBox1&amp;quot; type=&amp;quot;text&amp;quot; id=&amp;quot;TextBox1&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;Button1&amp;quot; value=&amp;quot;Button 1&amp;quot; id=&amp;quot;Button1&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;Button2&amp;quot; value=&amp;quot;Button 2&amp;quot; id=&amp;quot;Button2&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Wait, here there are some additional hidden variables auto rendered by ASP.net. Let's skip that part for now and see that our buttons are rendered as submit buttons. This is because of the reason that the Button's UseSubmitBehavior property was true, which is the default setting. Here for every events like an ENTER press in the textbox or CLICK in any of the buttons, there is a submit happening to the server. The form post data already has the information regarding the events, based on which ASP.net can process and call the appropriate event associated.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now, let's change the UseSubmitBehavior property for the first button and see what happens.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Designer code&lt;/span&gt;:&lt;br /&gt;&lt;pre class="brush: xml"&gt;&amp;lt;%@ Page Language=&amp;quot;C#&amp;quot; AutoEventWireup=&amp;quot;true&amp;quot; CodeFile=&amp;quot;postback.aspx.cs&amp;quot; Inherits=&amp;quot;postback&amp;quot; %&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD XHTML 1.0 Transitional//EN&amp;quot; &amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&amp;quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot; &amp;gt;&lt;br /&gt;&amp;lt;head runat=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;title&amp;gt;Events and Postback&amp;lt;/title&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;form id=&amp;quot;form1&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;div&amp;gt;&lt;br /&gt;&amp;lt;asp:TextBox ID=&amp;quot;TextBox1&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;br /&gt;&amp;lt;asp:Button ID=&amp;quot;Button1&amp;quot; runat=&amp;quot;server&amp;quot; OnClick=&amp;quot;Button1_Click&amp;quot; Text=&amp;quot;Button 1&amp;quot; UseSubmitBehavior=&amp;quot;False&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;asp:Button ID=&amp;quot;Button2&amp;quot; runat=&amp;quot;server&amp;quot; OnClick=&amp;quot;Button2_Click&amp;quot; Text=&amp;quot;Button 2&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Server code&lt;/span&gt;:&lt;br /&gt;[This is same as the previous server code]&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Client source code&lt;/span&gt; that was pushed by ASP.net:&lt;br /&gt;&lt;pre class="brush: xml"&gt;&amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD XHTML 1.0 Transitional//EN&amp;quot; &amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&amp;quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot; &amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;&lt;br /&gt;Events and Postback&lt;br /&gt;&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;form name=&amp;quot;form1&amp;quot; method=&amp;quot;post&amp;quot; action=&amp;quot;postback.aspx&amp;quot; id=&amp;quot;form1&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;div&amp;gt;&lt;br /&gt;&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;__EVENTTARGET&amp;quot; id=&amp;quot;__EVENTTARGET&amp;quot; value=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;__EVENTARGUMENT&amp;quot; id=&amp;quot;__EVENTARGUMENT&amp;quot; value=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;__VIEWSTATE&amp;quot; id=&amp;quot;__VIEWSTATE&amp;quot; value=&amp;quot;/wEPDwUKMTk0MTQ1MTcxMWRkFKmiofOm3t+a1FeTyiSsorNM4sk=&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt; &lt;br /&gt;//&amp;lt;![CDATA[&lt;br /&gt;var theForm = document.forms['form1'];&lt;br /&gt;if (!theForm) {&lt;br /&gt;theForm = document.form1;&lt;br /&gt;}&lt;br /&gt;function __doPostBack(eventTarget, eventArgument) {&lt;br /&gt;if (!theForm.onsubmit || (theForm.onsubmit() != false)) {&lt;br /&gt;theForm.__EVENTTARGET.value = eventTarget;&lt;br /&gt;theForm.__EVENTARGUMENT.value = eventArgument;&lt;br /&gt;theForm.submit();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;//]]&amp;gt;&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;div&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;__EVENTVALIDATION&amp;quot; id=&amp;quot;__EVENTVALIDATION&amp;quot; value=&amp;quot;/wEWBAKWt63zDALs0bLrBgKM54rGBgK7q7GGCNoGUvTkiMJt3F6eDcqfS57GMOdl&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;div&amp;gt;&lt;br /&gt;&amp;lt;input name=&amp;quot;TextBox1&amp;quot; type=&amp;quot;text&amp;quot; id=&amp;quot;TextBox1&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;input type=&amp;quot;button&amp;quot; name=&amp;quot;Button1&amp;quot; value=&amp;quot;Button 1&amp;quot; onclick=&amp;quot;javascript:__doPostBack('Button1','')&amp;quot; id=&amp;quot;Button1&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;Button2&amp;quot; value=&amp;quot;Button 2&amp;quot; id=&amp;quot;Button2&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;We can see that there is more code from server. There are few more hidden variables and some Javascript coding. The ones that we are interested in are "__EVENTTARGET", "__EVENTARGUMENT" and the "__doPostBack" function that seems to be mimicking a submit operation. This particular function is being associated to the button to which we set a false UseSubmitBehavior. The same button is now rendered as a BUTTON type. From this, we can cut down all the drama that was happening above and infer the logic as below:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;ASP. net’s event handling logic:&lt;/span&gt;&lt;br /&gt;1. Controls that are tied with a server event are rendered with a client JavaScript event associated.&lt;br /&gt;2. This client code mimics a server submit operation after filling the hidden variables [Note that the name is being filled in "__EVENTTARGET" field.&lt;br /&gt;3. The ASP.net server, when receives the post data, process the hidden variables to understand the event was triggered from a non-submit button and calls the method associated to the event.&lt;br /&gt;&lt;br /&gt;Now that we've got a glimpse of what is happening, let's try to go a little deeper. By having a small code in the Page_Load event, as shown below, we can actually get these parameters. There are multiple ways to get these. Here is one:&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp"&gt;protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;string eventControlName = Request.Params.Get("__EVENTTARGET");&lt;br /&gt;string eventArguments = Request.Params.Get("__EVENTARGUMENT");&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;It may seem that there is pretty much a straight forward process and we can go ahead with our implementations thinking that this will work always. But, it doesn't. Even though pretty basic, there are some quirks and points to be noted. Below are few among them.&lt;br /&gt;a. By any means if you disable this control in the client before a submit operation, submit to the server will not happen. That is, for example, if a button gets disabled on its click event, in the client, the submit will not happen at all. The good news is that, now that we know that this happens through our favorite function "__doPostBack", we can call the same from your client code, if needed.&lt;br /&gt;b. If none of these controls have their visible property set to false, the server will not render with those functions and associate them. It is understandable that we don't need to do anything with an invisible control. But, in case, if you're looking for a "__doPostBack" function and you cannot find it, this may be a reason.&lt;br /&gt;c. For dynamic controls with server events, these ideas will come handy, because now we now, how to identify, trigger and disable the events and its arguments.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Note&lt;/span&gt;: For the sake of simplicity, I haven't covered the events related to other controls and their arguments. Also, the hidden controls "__VIEWSTATE" and “__EVENTVALIDATION" does play a role in the server communication. So, if you're looking for extended information, try searching for those two. ASP.net may change this logic in future versions. Watch out for that too.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9148728900153461678-3856492318766186040?l=sanalksankar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanalksankar.blogspot.com/feeds/3856492318766186040/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sanalksankar.blogspot.com/2009/12/event-asp-net-form-submit-postback-page.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/3856492318766186040'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/3856492318766186040'/><link rel='alternate' type='text/html' href='http://sanalksankar.blogspot.com/2009/12/event-asp-net-form-submit-postback-page.html' title='How events are detected and triggered by ASP.net server during Form Submit or Postback'/><author><name>Sanal K. Sankar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_3Q-bcUHukBM/St8fSV6o0aI/AAAAAAAAC_g/DlPlN2Wpwzo/S220/sanal2_edited.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148728900153461678.post-1577696415573995240</id><published>2009-11-15T01:15:00.000+05:30</published><updated>2009-12-09T01:24:38.893+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='elephant'/><category scheme='http://www.blogger.com/atom/ns#' term='kerala'/><category scheme='http://www.blogger.com/atom/ns#' term='festival'/><category scheme='http://www.blogger.com/atom/ns#' term='gold'/><category scheme='http://www.blogger.com/atom/ns#' term='god'/><category scheme='http://www.blogger.com/atom/ns#' term='india'/><category scheme='http://www.blogger.com/atom/ns#' term='panchavadyam'/><category scheme='http://www.blogger.com/atom/ns#' term='nettipattam'/><category scheme='http://www.blogger.com/atom/ns#' term='thrissur'/><category scheme='http://www.blogger.com/atom/ns#' term='pooram'/><category scheme='http://www.blogger.com/atom/ns#' term='snaps'/><category scheme='http://www.blogger.com/atom/ns#' term='temple'/><title type='text'>Elephants with Ornaments (Nettipattam), accompanied by Panchavadyam</title><content type='html'>&lt;div&gt;This happens in God's own Country, Kerala, India. The Hindu Gods (usually a symbol called ‘Thidambu’, which has the power and goodness of the God) visits the neighborhood. A group of elephants are used for this purpose and the biggest elephant in the group is the chosen one to carry the God. These elephants are decorated with gold coated (Some times made of Gold) ornaments called "Nettipattam". They are accompanied by an orchestra consisting of traditional instruments which is named as "Panchavadyam". The same is also done when there is an important ceremony in the temple. Below are few snaps on these.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For more information, search for Thrissur pooram on the web, which is the biggest among these.&lt;/div&gt;&lt;br /&gt;&lt;a href="http://picasaweb.google.com/lh/photo/6dIHX_cjK4A3Ki6j6V5TTw?feat=directlink"&gt;&lt;img src="http://lh6.ggpht.com/_3Q-bcUHukBM/Sv7fc0VkPuI/AAAAAAAADGE/q_2DfgxGycQ/s288/Elephant_nettipattam%20%281%29.jpg" style="border:solid 1px #C0C0C0;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://picasaweb.google.com/lh/photo/4IPjPg6fLu9-ON2FgjyzpQ?feat=directlink"&gt;&lt;img src="http://lh6.ggpht.com/_3Q-bcUHukBM/Sv7gjYRmajI/AAAAAAAADGo/_Q1BA760emk/s288/Elephant_nettipattam%20%289%29.jpg" style="border:solid 1px #C0C0C0;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://picasaweb.google.com/lh/photo/jqIO1WU895piPOH5hkphJQ?feat=directlink"&gt;&lt;img src="http://lh5.ggpht.com/_3Q-bcUHukBM/Sv7gjtKU7UI/AAAAAAAADGs/2JMeF6Bwr3w/s288/Elephant_nettipattam%20%2810%29.jpg" style="border:solid 1px #C0C0C0;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://picasaweb.google.com/lh/photo/z2HWRvWrwordDYP-DTi7DA?feat=directlink"&gt;&lt;img src="http://lh6.ggpht.com/_3Q-bcUHukBM/Sv7hAp0RccI/AAAAAAAADGw/eqqddcWE24I/s288/Elephant_nettipattam%20%2811%29.jpg" style="border:solid 1px #C0C0C0;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://picasaweb.google.com/lh/photo/3DNa6v4fbMZMX-TTx3CrMw?feat=directlink"&gt;&lt;img src="http://lh5.ggpht.com/_3Q-bcUHukBM/Sv7hA18Dk6I/AAAAAAAADG0/oHJDFhGV3UQ/s288/Elephant_nettipattam%20%2812%29.jpg" style="border:solid 1px #C0C0C0;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://picasaweb.google.com/lh/photo/vRqCPl6V3Idm8ZGXpI70mw?feat=directlink"&gt;&lt;img src="http://lh6.ggpht.com/_3Q-bcUHukBM/Sv7hA-wk2NI/AAAAAAAADG4/xMbown7RAJQ/s288/Elephant_nettipattam%20%2813%29.jpg" style="border:solid 1px #C0C0C0;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://picasaweb.google.com/lh/photo/-zPrCLsPa5p6eYH_zHhT0Q?feat=directlink"&gt;&lt;img src="http://lh4.ggpht.com/_3Q-bcUHukBM/Sv7fc0h6DOI/AAAAAAAADGI/_sI3_lDhWMs/s288/Elephant_nettipattam%20%282%29.jpg" style="border:solid 1px #C0C0C0;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://picasaweb.google.com/lh/photo/HQWR2tle6p4VnmcoY3nolw?feat=directlink"&gt;&lt;img src="http://lh5.ggpht.com/_3Q-bcUHukBM/Sv7fdGA-CzI/AAAAAAAADGM/3nX2HwxClpo/s288/Elephant_nettipattam%20%283%29.jpg" style="border:solid 1px #C0C0C0;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://picasaweb.google.com/lh/photo/2YsFiMAh-hhKcb7wpoC5XQ?feat=directlink"&gt;&lt;img src="http://lh6.ggpht.com/_3Q-bcUHukBM/Sv7fdysQJyI/AAAAAAAADGQ/VygVldanGus/s288/Elephant_nettipattam%20%284%29.jpg" style="border:solid 1px #C0C0C0;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://picasaweb.google.com/lh/photo/BBgx7-kdiJs3xB1FYZNd8A?feat=directlink"&gt;&lt;img src="http://lh6.ggpht.com/_3Q-bcUHukBM/Sv7feBp3DwI/AAAAAAAADGU/lG8V2dJFOHQ/s288/Elephant_nettipattam%20%285%29.jpg" style="border:solid 1px #C0C0C0;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://picasaweb.google.com/lh/photo/fDqleQlcgHsBYwDCq1ZonA?feat=directlink"&gt;&lt;img src="http://lh6.ggpht.com/_3Q-bcUHukBM/Sv7giyDwRUI/AAAAAAAADGc/ZK6abCqM-94/s288/Elephant_nettipattam%20%286%29.jpg" style="border:solid 1px #C0C0C0;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://picasaweb.google.com/lh/photo/iSsK58mGEx5JmnJzSHzmeQ?feat=directlink"&gt;&lt;img src="http://lh5.ggpht.com/_3Q-bcUHukBM/Sv7gjJbOR0I/AAAAAAAADGg/aEt0aasCCkM/s288/Elephant_nettipattam%20%287%29.jpg" style="border:solid 1px #C0C0C0;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://picasaweb.google.com/lh/photo/JMjNndx5Bz73giNgNMgJEA?feat=directlink"&gt;&lt;img src="http://lh4.ggpht.com/_3Q-bcUHukBM/Sv7gjYS0HnI/AAAAAAAADGk/AxPzdpKqF6I/s288/Elephant_nettipattam%20%288%29.jpg" style="border:solid 1px #C0C0C0;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://picasaweb.google.com/lh/photo/nsjCuajX1XkKq2e6PgXaVA?feat=directlink"&gt;&lt;img src="http://lh6.ggpht.com/_3Q-bcUHukBM/SwV3wlp2UvI/AAAAAAAADIQ/pW8eyFj-BWU/s288/elephant_ornament_nettipattam.jpg" alt="Nettipattam" style="border:solid 1px #C0C0C0;" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9148728900153461678-1577696415573995240?l=sanalksankar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanalksankar.blogspot.com/feeds/1577696415573995240/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sanalksankar.blogspot.com/2009/12/elephant-ornament-kerala-nettipattam.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/1577696415573995240'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/1577696415573995240'/><link rel='alternate' type='text/html' href='http://sanalksankar.blogspot.com/2009/12/elephant-ornament-kerala-nettipattam.html' title='Elephants with Ornaments (Nettipattam), accompanied by Panchavadyam'/><author><name>Sanal K. Sankar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_3Q-bcUHukBM/St8fSV6o0aI/AAAAAAAAC_g/DlPlN2Wpwzo/S220/sanal2_edited.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_3Q-bcUHukBM/Sv7fc0VkPuI/AAAAAAAADGE/q_2DfgxGycQ/s72-c/Elephant_nettipattam%20%281%29.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148728900153461678.post-2800258821697516187</id><published>2009-10-29T00:11:00.000+05:30</published><updated>2009-12-09T01:25:02.858+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='array'/><category scheme='http://www.blogger.com/atom/ns#' term='multiple'/><category scheme='http://www.blogger.com/atom/ns#' term='free'/><category scheme='http://www.blogger.com/atom/ns#' term='ascending'/><category scheme='http://www.blogger.com/atom/ns#' term='column'/><category scheme='http://www.blogger.com/atom/ns#' term='2D'/><category scheme='http://www.blogger.com/atom/ns#' term='dimension'/><category scheme='http://www.blogger.com/atom/ns#' term='two'/><category scheme='http://www.blogger.com/atom/ns#' term='bubble'/><category scheme='http://www.blogger.com/atom/ns#' term='multi'/><category scheme='http://www.blogger.com/atom/ns#' term='sort'/><category scheme='http://www.blogger.com/atom/ns#' term='table'/><title type='text'>Two dimensional Array (Table Array) Multiple column sorting using JavaScript</title><content type='html'>Here is a JavaScript implementation for multi-column ascending sort on a table array. &lt;br /&gt;&lt;br /&gt;Below is the code for this.&lt;br /&gt;&lt;pre class="brush:javascript"&gt;var tempArray = new Array();&lt;br /&gt;//main function&lt;br /&gt;function do2DArraySort(arrayToBeSorted, sortColumnArray)&lt;br /&gt;{&lt;br /&gt;if (arrayToBeSorted == "undefined" || arrayToBeSorted == "null") return arrayToBeSorted;&lt;br /&gt;if (arrayToBeSorted.length == 0) return arrayToBeSorted;&lt;br /&gt;if (sortColumnArray.length == 0) return arrayToBeSorted;&lt;br /&gt;tempArray = arrayToBeSorted; &lt;br /&gt;var totalLength = sortColumnArray.length; &lt;br /&gt;for(var m = 0; m &lt; totalLength; m++)&lt;br /&gt;{&lt;br /&gt;if (m == 0)&lt;br /&gt;{   &lt;br /&gt;doBubbleSort(tempArray, tempArray.length, sortColumnArray[m]);         &lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{     &lt;br /&gt;doMultipleSort(tempArray, sortColumnArray[m], sortColumnArray[m-1]);&lt;br /&gt;}&lt;br /&gt;} &lt;br /&gt;return tempArray;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;//basic bubble sort implementation&lt;br /&gt;function doBubbleSort(arrayName, length, element) &lt;br /&gt;{&lt;br /&gt;for (var i = 0; i &lt; (length-1); i++)&lt;br /&gt;{&lt;br /&gt;for (var j = i+1; j &lt; length; j++)            &lt;br /&gt;{&lt;br /&gt;if (arrayName[j][element] &lt; arrayName[i][element]) &lt;br /&gt;{&lt;br /&gt;var dummy = arrayName[i];&lt;br /&gt;arrayName[i] = arrayName[j];&lt;br /&gt;arrayName[j] = dummy;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}  &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;//appends an array content to the original array&lt;br /&gt;function addToArray(originalArray, addArray)&lt;br /&gt;{&lt;br /&gt;if (addArray.length != 0)&lt;br /&gt;{&lt;br /&gt;var curLength = 0;&lt;br /&gt;curLength = originalArray.length;&lt;br /&gt;var maxLength = 0;&lt;br /&gt;maxLength = curLength + addArray.length;  &lt;br /&gt;var itrerateArray = 0;&lt;br /&gt;for (var r = curLength; r &lt; maxLength; r++)&lt;br /&gt;{   &lt;br /&gt;originalArray[r] = addArray[itrerateArray];&lt;br /&gt;itrerateArray++;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;//check if a value exists in a single dimensional array&lt;br /&gt;function checkIfExists(arrayToSearch, valueToSearch)&lt;br /&gt;{&lt;br /&gt;if (arrayToSearch == "undefined" || arrayToSearch == "null") return false;&lt;br /&gt;if (arrayToSearch.length == 0) return false;&lt;br /&gt;for (var k = 0; k &lt; arrayToSearch.length; k++)&lt;br /&gt;{&lt;br /&gt;if (arrayToSearch[k] == valueToSearch)&lt;br /&gt;return true;&lt;br /&gt;}&lt;br /&gt;return false;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;//sorts an 2D array based on the distinct values of the previous column&lt;br /&gt;function doMultipleSort(sortedArray, currentCol, prevCol)&lt;br /&gt;{&lt;br /&gt;var resultArray = new Array(); &lt;br /&gt;var newdistinctValuesArray = new Array();&lt;br /&gt;//finding distinct previous column values &lt;br /&gt;for (var n = 0; n &lt; sortedArray.length; n++)&lt;br /&gt;{ &lt;br /&gt;if (checkIfExists(newdistinctValuesArray, sortedArray[n][prevCol]) == false)&lt;br /&gt;newdistinctValuesArray.push(sortedArray[n][prevCol]);&lt;br /&gt;}  &lt;br /&gt;var recCursor = 0;&lt;br /&gt;var newTempArray = new Array(); var toStoreArray = 0; &lt;br /&gt;//for each of the distinct values&lt;br /&gt;for (var pp = 0; pp &lt; newdistinctValuesArray.length; pp++)&lt;br /&gt;{&lt;br /&gt;toStoreArray = 0;&lt;br /&gt;newTempArray = new Array();  &lt;br /&gt;//find the rows with the same previous column value&lt;br /&gt;for (var qq = recCursor; qq &lt; sortedArray.length; qq++)&lt;br /&gt;{&lt;br /&gt;if (sortedArray[qq][prevCol] != newdistinctValuesArray[pp]) break;&lt;br /&gt;newTempArray[toStoreArray] = sortedArray[qq];&lt;br /&gt;toStoreArray++; recCursor++;&lt;br /&gt;}&lt;br /&gt;//sort the row based on the current column   &lt;br /&gt;doBubbleSort(newTempArray, newTempArray.length, currentCol);&lt;br /&gt;//append it to the result array&lt;br /&gt;addToArray(resultArray, newTempArray);&lt;br /&gt;}&lt;br /&gt;tempArray = resultArray;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;The above code can be stored as TableArrayMultipleSort.js for our example usage shown below:&lt;pre class="brush:html"&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&amp;lt;title&amp;gt;Invoking Multiple Array Sort&amp;lt;/title&amp;gt;&lt;br /&gt;&amp;lt;script language=&amp;quot;javascript&amp;quot; src=&amp;quot;TableArrayMultipleSort.js&amp;quot; type=&amp;quot;text/javascript&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;script language=&amp;quot;javascript&amp;quot; type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;function createSampleArray()&lt;br /&gt;{ &lt;br /&gt;var myArr = new Array( &lt;br /&gt;new Array(&amp;quot;Ashley&amp;quot;,&amp;quot;13&amp;quot;,&amp;quot;Male&amp;quot;,&amp;quot;Texas&amp;quot;),&lt;br /&gt;new Array(&amp;quot;Smith&amp;quot;, &amp;quot;32&amp;quot;, &amp;quot;Male&amp;quot;,&amp;quot;Colorado&amp;quot;),&lt;br /&gt;new Array(&amp;quot;Jane&amp;quot;, &amp;quot;21&amp;quot;, &amp;quot;Female&amp;quot;,&amp;quot;South Carolina&amp;quot;),&lt;br /&gt;new Array(&amp;quot;Anna&amp;quot;, &amp;quot;12&amp;quot;, &amp;quot;Female&amp;quot;,&amp;quot;Maryland&amp;quot;),&lt;br /&gt;new Array(&amp;quot;Ashley&amp;quot;,&amp;quot;13&amp;quot;,&amp;quot;Male&amp;quot;,&amp;quot;Delaware&amp;quot;),&lt;br /&gt;new Array(&amp;quot;Ashley&amp;quot;,&amp;quot;46&amp;quot;,&amp;quot;Male&amp;quot;,&amp;quot;Newyork&amp;quot;)&lt;br /&gt;); &lt;br /&gt;return myArr;&lt;br /&gt;}&lt;br /&gt;function showDataByRow(arrayToBeShown)&lt;br /&gt;{&lt;br /&gt;for(var a=0;a&amp;lt;arrayToBeShown.length;a++)&lt;br /&gt;{&lt;br /&gt;document.write(arrayToBeShown[a]+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;document.write(&amp;quot;&amp;lt;b&amp;gt;Original Array: (Input)&amp;lt;/b&amp;gt;&amp;quot; + &amp;quot;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;quot;);&lt;br /&gt;showDataByRow(createSampleArray());&lt;br /&gt;document.write(&amp;quot;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;quot;);&lt;br /&gt;var sortColumnArray = new Array('0','1','3'); &lt;br /&gt;&lt;!-- can also be used like: var sortColumnArray = new Array(0,1); --&gt;&lt;br /&gt;document.write(&amp;quot;&amp;lt;b&amp;gt;Sorted Array: (Output)&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;Order: First column, then by second column and then by Last Column&amp;quot; + &amp;quot;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;quot;);&lt;br /&gt;showDataByRow(do2DArraySort(createSampleArray(),sortColumnArray));&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/pre&gt;When the above code is executed, this will show the input table array and output table array as shown below.&lt;span style="font-weight:bold;"&gt;Original Array: (Input)&lt;/span&gt;&lt;pre class="brush:text"&gt;Ashley,13,Male,Texas&lt;br /&gt;Smith,32,Male,Colorado&lt;br /&gt;Jane,21,Female,South Carolina&lt;br /&gt;Anna,12,Female,Maryland&lt;br /&gt;Ashley,13,Male,Delaware&lt;br /&gt;Ashley,46,Male,Newyork&lt;br /&gt;&lt;/pre&gt;&lt;span style="font-weight:bold;"&gt;Sorted Array: (Output)&lt;/span&gt;Order: First column, then by second column and then by Last Column&lt;pre class="brush:text"&gt;Anna,12,Female,Maryland&lt;br /&gt;Ashley,13,Male,Delaware&lt;br /&gt;Ashley,13,Male,Texas&lt;br /&gt;Ashley,46,Male,Newyork&lt;br /&gt;Jane,21,Female,South Carolina&lt;br /&gt;Smith,32,Male,Colorado&lt;br /&gt;&lt;/pre&gt;&lt;span style="font-weight:bold;"&gt;Enhancements:&lt;/span&gt;1. The code can be enhanced to accomodate sort order for each of the sort columns by having a seperate array to specify that. &lt;br /&gt;2. It can be relooked for performance improvements and enhanced variable handling.&lt;br /&gt;3. There are few issues related to null/empty-value, if it exists in any of the columns being sorted.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Note: The objective of this article is to assist in learning the Javascript array concepts and it's usage. This code is not intended to be used for production purposes as it is not written with that aspect in mind. So, if you want to use it, use it at your own risk.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9148728900153461678-2800258821697516187?l=sanalksankar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanalksankar.blogspot.com/feeds/2800258821697516187/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sanalksankar.blogspot.com/2009/12/two-dimension-array-sort-javascript.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/2800258821697516187'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/2800258821697516187'/><link rel='alternate' type='text/html' href='http://sanalksankar.blogspot.com/2009/12/two-dimension-array-sort-javascript.html' title='Two dimensional Array (Table Array) Multiple column sorting using JavaScript'/><author><name>Sanal K. Sankar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_3Q-bcUHukBM/St8fSV6o0aI/AAAAAAAAC_g/DlPlN2Wpwzo/S220/sanal2_edited.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148728900153461678.post-4253305815285772707</id><published>2009-10-25T15:05:00.000+05:30</published><updated>2009-10-25T18:11:07.836+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='grasshopper'/><category scheme='http://www.blogger.com/atom/ns#' term='eat'/><category scheme='http://www.blogger.com/atom/ns#' term='leaves'/><category scheme='http://www.blogger.com/atom/ns#' term='large'/><category scheme='http://www.blogger.com/atom/ns#' term='big'/><category scheme='http://www.blogger.com/atom/ns#' term='plant'/><title type='text'>Large Grasshopper</title><content type='html'>This big one was just sitting there having all the food that he can; finished a major portion of the plant's leaves. It's pretty colorful and is around 9.5 cm long.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If someone, who study these, is looking for a nice snap of this one, here it is. Please comment on the scientific name so that others can find this.&lt;/div&gt;&lt;br /&gt;&lt;a href="http://picasaweb.google.com/lh/photo/I378URA79ug7WomNPnwhrg?feat=embedwebsite"&gt;&lt;img src="http://lh6.ggpht.com/_3Q-bcUHukBM/SuQt3H-ZmkI/AAAAAAAADD0/APgyfvh3HwY/s288/IMG_1253_grasshopper.JPG" /&gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://picasaweb.google.com/lh/photo/Iv1vWQ2z0CWg2XhdllrLZQ?feat=embedwebsite"&gt;&lt;img src="http://lh6.ggpht.com/_3Q-bcUHukBM/SuQt3SzUiaI/AAAAAAAADD4/4LFT6bHUCqM/s288/IMG_1254_grasshopper.JPG" /&gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://picasaweb.google.com/lh/photo/mqO7WEGyOgbjNDzb1SHRQw?feat=embedwebsite"&gt;&lt;img src="http://lh3.ggpht.com/_3Q-bcUHukBM/SuQt3yKfl5I/AAAAAAAADD8/Jq_aESjai20/s288/IMG_1255_grasshopper.JPG" /&gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://picasaweb.google.com/lh/photo/UJHK5p_99w1xvhJik_GccQ?feat=embedwebsite"&gt;&lt;img src="http://lh6.ggpht.com/_3Q-bcUHukBM/SuQt4GUB93I/AAAAAAAADEA/6ubr_JXOCv4/s288/IMG_1257_grasshopper.JPG" /&gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://picasaweb.google.com/lh/photo/Hg6NruKeTi5SM0xErNo77A?feat=embedwebsite"&gt;&lt;img src="http://lh3.ggpht.com/_3Q-bcUHukBM/SuQt4RBFrLI/AAAAAAAADEE/v0GNnX6Mwow/s288/IMG_1259_grasshopper.JPG" /&gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://picasaweb.google.com/lh/photo/trbl_TzziA1mZCKAoR9Q3A?feat=embedwebsite"&gt;&lt;img src="http://lh6.ggpht.com/_3Q-bcUHukBM/SuQxAsBzsoI/AAAAAAAADEM/FjWwPwffAb8/s288/IMG_1261_grasshopper.JPG" /&gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://picasaweb.google.com/lh/photo/ope3CQqwogfBnS3DC7kbew?feat=embedwebsite"&gt;&lt;img src="http://lh5.ggpht.com/_3Q-bcUHukBM/SuQxA2fV2fI/AAAAAAAADEQ/VT4mf1HzEa8/s288/IMG_1262_grasshopper.JPG" /&gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://picasaweb.google.com/lh/photo/BKaPAZ_8x1EomsG1EM1ItA?feat=embedwebsite"&gt;&lt;img src="http://lh5.ggpht.com/_3Q-bcUHukBM/SuQxBB288WI/AAAAAAAADEU/j7RenOqGtew/s288/IMG_1263_grasshopper.JPG" /&gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://picasaweb.google.com/lh/photo/vThSOhyppPPEeQz3tgvdig?feat=embedwebsite"&gt;&lt;img src="http://lh6.ggpht.com/_3Q-bcUHukBM/SuQxBtIP_rI/AAAAAAAADEY/WhhUiO4dkBg/s288/IMG_1264_grasshopper.JPG" /&gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://picasaweb.google.com/lh/photo/WShe7m8ZZNBVp1zcHW54aQ?feat=embedwebsite"&gt;&lt;img src="http://lh5.ggpht.com/_3Q-bcUHukBM/SuQxByoVuzI/AAAAAAAADEc/D1kx-0ohs5g/s288/IMG_1265_grasshopper.JPG" /&gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://picasaweb.google.com/lh/photo/grDeMdjCiA9gW14KXCmwKw?feat=embedwebsite"&gt;&lt;img src="http://lh4.ggpht.com/_3Q-bcUHukBM/SuQyjyOQrGI/AAAAAAAADEk/O3wlagkUrw4/s288/IMG_1266_grasshopper.JPG" /&gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://picasaweb.google.com/lh/photo/jGVMTCOp7WppaS_urHmU6Q?feat=embedwebsite"&gt;&lt;img src="http://lh6.ggpht.com/_3Q-bcUHukBM/SuQykDN5dQI/AAAAAAAADEo/aJWZMZ0iuaw/s288/IMG_1267_grasshopper.JPG" /&gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://picasaweb.google.com/lh/photo/wnZLh7AUn8B7TdnCRMygvA?feat=embedwebsite"&gt;&lt;img src="http://lh3.ggpht.com/_3Q-bcUHukBM/SuQykn2QFWI/AAAAAAAADEs/8L9cuYjJ6yM/s288/IMG_1269_grasshopper.JPG" /&gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9148728900153461678-4253305815285772707?l=sanalksankar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanalksankar.blogspot.com/feeds/4253305815285772707/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sanalksankar.blogspot.com/2009/10/large-grasshopper.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/4253305815285772707'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/4253305815285772707'/><link rel='alternate' type='text/html' href='http://sanalksankar.blogspot.com/2009/10/large-grasshopper.html' title='Large Grasshopper'/><author><name>Sanal K. Sankar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_3Q-bcUHukBM/St8fSV6o0aI/AAAAAAAAC_g/DlPlN2Wpwzo/S220/sanal2_edited.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_3Q-bcUHukBM/SuQt3H-ZmkI/AAAAAAAADD0/APgyfvh3HwY/s72-c/IMG_1253_grasshopper.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148728900153461678.post-5343559685958416457</id><published>2009-10-21T12:02:00.000+05:30</published><updated>2009-10-27T17:32:51.734+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='ThreadPool'/><category scheme='http://www.blogger.com/atom/ns#' term='thread'/><category scheme='http://www.blogger.com/atom/ns#' term='.net'/><category scheme='http://www.blogger.com/atom/ns#' term='ThreadAbortException'/><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><category scheme='http://www.blogger.com/atom/ns#' term='ThreadPriority'/><category scheme='http://www.blogger.com/atom/ns#' term='ParameterizedThreadStart'/><category scheme='http://www.blogger.com/atom/ns#' term='ThreadStart'/><category scheme='http://www.blogger.com/atom/ns#' term='Beginner'/><category scheme='http://www.blogger.com/atom/ns#' term='QueueUserWorkItem'/><category scheme='http://www.blogger.com/atom/ns#' term='WaitCallback'/><category scheme='http://www.blogger.com/atom/ns#' term='background'/><category scheme='http://www.blogger.com/atom/ns#' term='simple'/><category scheme='http://www.blogger.com/atom/ns#' term='threading'/><title type='text'>Threading in .net  - for Beginners</title><content type='html'>&lt;strong&gt;&lt;br /&gt;Method 1: Using ThreadPool.QueueUserWorkItem&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;There may be scenarios, in which you want to have an asynchronous operation to be performed without the need of a handle on the function being called. For example, this can be an audit log or a process log operation which can be a background process while your main application performs the important operations. There is a simple single line code to achieve this using ThreadPool.QueueUserWorkItem call. Typical usage is as follows.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;span style="color:#3333ff;"&gt;&lt;pre class="brush:csharp;"&gt;&lt;br /&gt;private void button1_Click(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;    string argument = "Process started";&lt;br /&gt;    ThreadPool.QueueUserWorkItem(new WaitCallback(WriteLog), input);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;private void WriteLog(object o)&lt;br /&gt;{&lt;br /&gt;     string argument = o as string;&lt;br /&gt;     // Your code to log the argument&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;In this method:&lt;br /&gt;1. With a single line code, you are getting the basic benefits of threading without having to worry about creating, managing and terminating a threaded operation.&lt;br /&gt;2. QueueUserWorkItem call is in control of .net runtime. You will not be able to control the time at which it gets executed.&lt;br /&gt;3. You cannot control the state and priority of the function being executed.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style="color:#000000;"&gt;Method 2. Using ThreadStart, ParameterizedThreadStart and Thread&lt;/span&gt;&lt;/strong&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;&lt;br /&gt;&lt;br /&gt;Below is another method that will give more control on your asynchronous operation.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;a) Without having a Parameter&lt;/span&gt;&lt;/strong&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;&lt;br /&gt;&lt;br /&gt;Class level decleration&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="color:#3333ff;"&gt;&lt;pre class="brush:csharp;"&gt;&lt;br /&gt;private Thread t = null;&lt;/pre&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;This can be used for later tracking of the thread being executed.&lt;/span&gt;&lt;br /&gt;&lt;pre class="brush:csharp;"&gt;&lt;br /&gt;private void button2_Click(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt; ThreadStart ts = new ThreadStart(WriteStartLog);&lt;br /&gt; t = new Thread(ts);&lt;br /&gt; t.IsBackground = true;&lt;br /&gt; t.Priority = ThreadPriority.Normal;&lt;br /&gt; t.Start();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;private void WriteStartLog()&lt;br /&gt;{&lt;br /&gt; // Your code to log the process start&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;To track the thread, the thread object can be used. A sample usage is provided below:&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&lt;span style="font-family:courier new;"&gt;&lt;pre class="brush:csharp;"&gt;&lt;br /&gt;private void button3_Click(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;if (t != null)&lt;br /&gt;{&lt;br /&gt;     if (t.IsAlive)&lt;br /&gt;          t.Abort();&lt;br /&gt;}&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;b) Passing parameters using ParameterizedThreadStart&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;&lt;br /&gt;When parameters are to be passed to the invoked method, this can be done using ParameterizedThreadStart using the medium as objects.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;span style="color:#3333ff;"&gt;&lt;pre class="brush:csharp;"&gt;&lt;br /&gt;private void button2_Click(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt; ParameterizedThreadStart pts = new ParameterizedThreadStart(WriteLog);&lt;br /&gt; t = new Thread(pts);&lt;br /&gt; t.IsBackground = true;&lt;br /&gt; t.Priority = ThreadPriority.Normal;&lt;br /&gt; t.Start("Process started");&lt;br /&gt;}&lt;/pre&gt;&lt;/span&gt;&lt;br /&gt;&lt;pre class="brush:csharp;"&gt;&lt;br /&gt;private void WriteLog(object o)&lt;br /&gt;{&lt;br /&gt; string argument = o as string;&lt;br /&gt; // Your code to log the argument&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;Now that we have covered the basic skeleton of our article, let’s see the other important aspects of threading.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;Handling ThreadAbortException&lt;/span&gt;&lt;/strong&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;&lt;br /&gt;&lt;br /&gt;There might be a need to abort the thread being executed at any instant of time. This can happen due to the user cancellation of the process or any other action like the primary thread being closed due to a various reason. At these scenarios (even when there is no need), it is mandatory to have a ThreadAbortException to be handled in the method which is being called. This can be as follows:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#3333ff;"&gt;&lt;pre class="brush:csharp;"&gt;&lt;br /&gt;private void WriteLog()&lt;br /&gt;{&lt;br /&gt; try&lt;br /&gt; {&lt;br /&gt;  // Your code to log the argument&lt;br /&gt; }&lt;br /&gt; catch (ThreadAbortException tae)&lt;br /&gt; {&lt;br /&gt;  //handles the thread abort exception&lt;br /&gt;  //code to cleanup - let know the user that thread got cancelled, if necessary.&lt;br /&gt; }&lt;br /&gt; catch (Exception e)&lt;br /&gt; {&lt;br /&gt;  //handle other exceptions&lt;br /&gt; }&lt;br /&gt;}&lt;/pre&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;Communicating between main and background thread.&lt;/span&gt;&lt;/strong&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;&lt;br /&gt;&lt;br /&gt;Consider, this scenario:&lt;br /&gt;You are having a background thread to create thumbnails for pictures in a folder. For each thumbnail being created, you have to draw it on the form. That is, to communicate from the background thread to the parent thread with the output from the background thread. This is pretty simple using delegates. Here it is how it’s done.&lt;br /&gt;&lt;br /&gt;Class level declarations:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="color:#3333ff;"&gt;&lt;pre class="brush:csharp;"&gt;&lt;br /&gt;private delegate void addPictureBox2Main_Delegate(PictureBox pbb);&lt;br /&gt;private Thread t = null;&lt;/pre&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="color:#3333ff;"&gt;&lt;pre class="brush:csharp;"&gt;&lt;br /&gt;private void button2_Click(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt; ThreadStart ts = new ThreadStart(LoadImageThumbNails);&lt;br /&gt; t = new Thread(ts);&lt;br /&gt; t.IsBackground = true;&lt;br /&gt; t.Priority = ThreadPriority.Normal;&lt;br /&gt; t.Start();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;private void LoadImageThumbNails()&lt;br /&gt;{&lt;br /&gt; try&lt;br /&gt; {&lt;br /&gt;   //for each of the thumbnails being created&lt;br /&gt;   //generate picturebox with thumbnail here&lt;br /&gt;   PictureBox pb = //function to load thumbnail&lt;br /&gt;   this.Invoke(new addPictureBox2Main_Delegate(addPictureBox2Main), new Object[] { pb });&lt;br /&gt; }&lt;br /&gt; catch (ThreadAbortException tae)&lt;br /&gt; {&lt;br /&gt;   //handles the thread abort exception&lt;br /&gt;   //code to cleanup - let know the user that thread got cancelled, if necessary.&lt;br /&gt; }&lt;br /&gt; catch (Exception e)&lt;br /&gt; {&lt;br /&gt;   //hanlde other exceptions&lt;br /&gt; }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;color:#3333ff;"&gt;&lt;pre class="brush:csharp;"&gt;private void addPictureBox2Main(PictureBox pb)&lt;br /&gt;{&lt;br /&gt; //add the picture box pb to the parent control as needed&lt;br /&gt;}&lt;/pre&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;** Code samples are in C#**&lt;br /&gt;&lt;br /&gt;Note: This article only covers the basic aspect of threading and it aims to help beginners understand the threading concepts. There is more to it. So, keep learning.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9148728900153461678-5343559685958416457?l=sanalksankar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanalksankar.blogspot.com/feeds/5343559685958416457/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sanalksankar.blogspot.com/2009/10/threading-in-net-for-beginners.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/5343559685958416457'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/5343559685958416457'/><link rel='alternate' type='text/html' href='http://sanalksankar.blogspot.com/2009/10/threading-in-net-for-beginners.html' title='Threading in .net  - for Beginners'/><author><name>Sanal K. Sankar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_3Q-bcUHukBM/St8fSV6o0aI/AAAAAAAAC_g/DlPlN2Wpwzo/S220/sanal2_edited.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148728900153461678.post-1090138989538125787</id><published>2007-03-06T09:22:00.000+05:30</published><updated>2007-03-06T09:38:50.579+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Print Error'/><category scheme='http://www.blogger.com/atom/ns#' term='Solution'/><category scheme='http://www.blogger.com/atom/ns#' term='Script error'/><category scheme='http://www.blogger.com/atom/ns#' term='Outlook 2003'/><title type='text'>Unable to print in Outlook 2003</title><content type='html'>Issue:&lt;br /&gt;&lt;br /&gt;Unable to print from outlook 2003. When selected to print, a script error will pop up saying the following.&lt;br /&gt;&lt;br /&gt;Error Invalid argument&lt;br /&gt;URL res://C:\\WINNT\system32\shdoclc.dll/preview.dlg&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Solution:&lt;br /&gt;&lt;br /&gt;The following solution worked for me.&lt;br /&gt;1)    Close Outlook 2003 if it is running&lt;br /&gt;2)    From the “Start” Menu, select “Run”&lt;br /&gt;3)    Type: regsvr32 ole32.dll&lt;br /&gt;4)    After the registration becomes successful, Open outlook 2003, open the mail and try printing&lt;br /&gt;&lt;br /&gt;Sanal K. Sankar&lt;br /&gt;&lt;a href="http://www.sanalks.com/"&gt;http://www.sanalks.com&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9148728900153461678-1090138989538125787?l=sanalksankar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanalksankar.blogspot.com/feeds/1090138989538125787/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sanalksankar.blogspot.com/2007/03/unable-to-print-in-outlook-2003.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/1090138989538125787'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/1090138989538125787'/><link rel='alternate' type='text/html' href='http://sanalksankar.blogspot.com/2007/03/unable-to-print-in-outlook-2003.html' title='Unable to print in Outlook 2003'/><author><name>Sanal K. Sankar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_3Q-bcUHukBM/St8fSV6o0aI/AAAAAAAAC_g/DlPlN2Wpwzo/S220/sanal2_edited.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148728900153461678.post-3368905701195683840</id><published>2007-03-05T01:04:00.000+05:30</published><updated>2009-12-09T01:26:50.213+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='signtool'/><category scheme='http://www.blogger.com/atom/ns#' term='application'/><category scheme='http://www.blogger.com/atom/ns#' term='.net'/><category scheme='http://www.blogger.com/atom/ns#' term='framework'/><category scheme='http://www.blogger.com/atom/ns#' term='signcode'/><category scheme='http://www.blogger.com/atom/ns#' term='digitally sign'/><category scheme='http://www.blogger.com/atom/ns#' term='assembly'/><title type='text'>Digitally signing your .net Applications/Assemblies</title><content type='html'>For signing .net applications/assemblies with a digital signature, use signcode.exe OR SignTool.exe.&lt;br /&gt;&lt;br /&gt;Signcode.exe is applicable for applications created with .NET Framework SDK version 1.0 and 1.1. For versions ahead of this, use SignTool.exe. These tools are available in your .NET Framework SDK Installation path.&lt;br /&gt;&lt;br /&gt;SignCode.exe&lt;br /&gt;&lt;a href="http://msdn2.microsoft.com/en-gb/library/9sh96ycy(VS.80).aspx"&gt;http://msdn2.microsoft.com/en-gb/library/9sh96ycy(VS.80).aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;SignTool.exe&lt;br /&gt;&lt;a href="http://msdn2.microsoft.com/en-gb/library/8s9b9yaz(VS.80).aspx"&gt;http://msdn2.microsoft.com/en-gb/library/8s9b9yaz(VS.80).aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Sanal K. Sankar&lt;br /&gt;&lt;a href="http://www.sanalks.com"&gt;http://www.sanalks.com&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9148728900153461678-3368905701195683840?l=sanalksankar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanalksankar.blogspot.com/feeds/3368905701195683840/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sanalksankar.blogspot.com/2009/12/digital-sign-net-assembly-application.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/3368905701195683840'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/3368905701195683840'/><link rel='alternate' type='text/html' href='http://sanalksankar.blogspot.com/2009/12/digital-sign-net-assembly-application.html' title='Digitally signing your .net Applications/Assemblies'/><author><name>Sanal K. Sankar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_3Q-bcUHukBM/St8fSV6o0aI/AAAAAAAAC_g/DlPlN2Wpwzo/S220/sanal2_edited.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148728900153461678.post-6167129345992122819</id><published>2007-03-05T01:01:00.000+05:30</published><updated>2009-12-09T01:27:10.702+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='sucessfull'/><category scheme='http://www.blogger.com/atom/ns#' term='location'/><category scheme='http://www.blogger.com/atom/ns#' term='install'/><category scheme='http://www.blogger.com/atom/ns#' term='.net'/><category scheme='http://www.blogger.com/atom/ns#' term='registry'/><category scheme='http://www.blogger.com/atom/ns#' term='framework'/><title type='text'>Ideal way to detect the version of .net Framework Installed</title><content type='html'>Reading the registry for appropriate values seems to be the ideal way to detect the version of .net framework installed in a PC. Following are the registry keys for each of the successful installation of .net framework.&lt;br /&gt;&lt;br /&gt;Version: 3.0&lt;br /&gt;Registry Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Settup\NDP\v3.0\Setup&lt;br /&gt;Name: InstallSuccess (DWORD value = 1)&lt;br /&gt;&lt;br /&gt;Version: 2.0&lt;br /&gt;Registry Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727&lt;br /&gt;Name: Install (DWORD value = 1)&lt;br /&gt;&lt;br /&gt;Version: 1.1&lt;br /&gt;Registry Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322&lt;br /&gt;Name: Install (DWORD value = 1)&lt;br /&gt;&lt;br /&gt;Version: 1.0&lt;br /&gt;Registry Key: KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\policy\v1.0&lt;br /&gt;Name: 3705 (REG_SZ value = 3321-3705)&lt;br /&gt;&lt;br /&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/aa480198.aspx"&gt;click here&lt;/a&gt; for more info.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Sanal K. Sankar&lt;br /&gt;&lt;a href="http://www.sanalks.com"&gt;http://www.sanalks.com&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9148728900153461678-6167129345992122819?l=sanalksankar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanalksankar.blogspot.com/feeds/6167129345992122819/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sanalksankar.blogspot.com/2009/12/version-net-framework-install-registry.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/6167129345992122819'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/6167129345992122819'/><link rel='alternate' type='text/html' href='http://sanalksankar.blogspot.com/2009/12/version-net-framework-install-registry.html' title='Ideal way to detect the version of .net Framework Installed'/><author><name>Sanal K. Sankar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_3Q-bcUHukBM/St8fSV6o0aI/AAAAAAAAC_g/DlPlN2Wpwzo/S220/sanal2_edited.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148728900153461678.post-7036446197722243920</id><published>2007-03-04T22:10:00.000+05:30</published><updated>2009-12-09T01:28:04.116+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='call'/><category scheme='http://www.blogger.com/atom/ns#' term='create'/><category scheme='http://www.blogger.com/atom/ns#' term='single'/><category scheme='http://www.blogger.com/atom/ns#' term='gmail'/><category scheme='http://www.blogger.com/atom/ns#' term='click'/><category scheme='http://www.blogger.com/atom/ns#' term='chat'/><category scheme='http://www.blogger.com/atom/ns#' term='shortcut'/><title type='text'>Create Shortcuts to connect to your GMail talk contacts</title><content type='html'>Create shortcut with the following command and you are only single click away from your gmail talk contact. Try Changing the shortcut icon also to gmail talk icon.&lt;br /&gt;&lt;br /&gt;To chat:&lt;br /&gt;gtalk:chat?jid=[Gmail address]@gmail.com&lt;br /&gt;&lt;br /&gt;To Talk:&lt;br /&gt;gtalk:call?jid=[Gmail address]@gmail.com&lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;gtalk:chat?jid=sanal.sankar@gmail.com&lt;br /&gt;&lt;br /&gt;Requirements:&lt;br /&gt;You need to be logged in to gmail with the gmail talk application&lt;br /&gt;&lt;br /&gt;Sanal K. Sankar&lt;br /&gt;&lt;a href="http://www.sanalks.com"&gt;http://www.sanalks.com&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9148728900153461678-7036446197722243920?l=sanalksankar.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanalksankar.blogspot.com/feeds/7036446197722243920/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sanalksankar.blogspot.com/2009/12/shortcut-connect-gmail-talk-contact.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/7036446197722243920'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148728900153461678/posts/default/7036446197722243920'/><link rel='alternate' type='text/html' href='http://sanalksankar.blogspot.com/2009/12/shortcut-connect-gmail-talk-contact.html' title='Create Shortcuts to connect to your GMail talk contacts'/><author><name>Sanal K. Sankar</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_3Q-bcUHukBM/St8fSV6o0aI/AAAAAAAAC_g/DlPlN2Wpwzo/S220/sanal2_edited.jpg'/></author><thr:total>0</thr:total></entry></feed>
