<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>learn(n*share(n,learn(n+1)))</title>
	
	<link>http://praveenlobo.com/techblog</link>
	<description>Learn, Share, Grow!</description>
	<lastBuildDate>Tue, 13 Mar 2012 01:49:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/LoboPraveen/blog/Technical" /><feedburner:info uri="lobopraveen/blog/technical" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license><feedburner:emailServiceId>LoboPraveen/blog/Technical</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>How To Convert JavaScript Local Date to UTC And UTC To Local Date</title>
		<link>http://feedproxy.google.com/~r/LoboPraveen/blog/Technical/~3/ac9T_6OHjk8/</link>
		<comments>http://praveenlobo.com/techblog/how-to-convert-javascript-local-date-to-utc-and-utc-to-local-date/#comments</comments>
		<pubDate>Tue, 27 Dec 2011 07:04:40 +0000</pubDate>
		<dc:creator>Lobo</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[epoch]]></category>
		<category><![CDATA[GMT]]></category>
		<category><![CDATA[Locale]]></category>
		<category><![CDATA[time]]></category>
		<category><![CDATA[UTC]]></category>

		<guid isPermaLink="false">http://praveenlobo.com/techblog/?p=2094</guid>
		<description><![CDATA[DST is such a pain when it comes to programming. I wish they just get rid of it. It’d be helpful, however, the programmers will still have to deal with the timezones. I was answering questions related to the timers &#8230; <a href="http://praveenlobo.com/techblog/how-to-convert-javascript-local-date-to-utc-and-utc-to-local-date/">Continue reading <span class="meta-nav">&#8594;</span></a>
No related posts.]]></description>
			<content:encoded><![CDATA[<p>DST is such a pain when it comes to programming. I wish they just get rid of it. It’d be helpful, however, the programmers will still have to deal with the timezones. I was answering questions related to the <a href="http://praveenlobo.com/techblog/tag/timer/" title="Simple JavaScript Timers">timers</a> on this website and I keep getting a lot of questions on DST and the timezones. Even though it seems easy, this topic is very confusing. There are lot many sources on the Internet and reading them confuses the hell out of me. </p>
<p>To avoid conflicts when dealing with the transactions from many different timezones, it is essential to normalize the dates and by normalizing I mean converting it to UTC. Let me take an example in JavaScript. </p>
<p><strong>Let the date in question be in Indian Standard Time (IST) </strong>
<pre class="brush: jscript; collapse: false; light: false; title: ; toolbar: true; notranslate">January 02, 2012 22:00:00 GMT+0530</pre>
<p><br/><br />
<strong>How to convert the date into a local time(CST)?</strong></p>
<pre class="brush: jscript; collapse: false; light: false; title: ; toolbar: true; notranslate">var now = new Date(&quot;January 02, 2012 22:00:00 GMT+0530&quot;);
// now = Mon Jan 02 2012 10:30:00 GMT-0600 (CST)</pre>
<p><br/><br />
<strong>How to convert a date to UTC?</strong> This is where many of the online sources go wrong. The simple answer is to convert the date into milliseconds since Epoch and add the timezone offset and convert it back to a date object. Simple?<strong> No, this is partially correct</strong>. When the calculated milliseconds are converted back to a date, you get a local date.</p>
<pre class="brush: jscript; collapse: false; light: false; title: ; toolbar: true; notranslate">var nowUtc = new Date( now.getTime() + (now.getTimezoneOffset() * 60000));
//nowUtc = Mon Jan 02 2012 16:30:00 GMT-0600 (CST)</pre>
<p><br/><br />
Notice the GMT-0600 (CST) part at the end. That means the resulting date is not GMT, it is CST. If you convert this date to GMT it will read &#8211; Mon Jan 02 2012 22:30:00 GMT but we want it to be Mon Jan 02 2012 16:30:00 GMT.</p>
<p>There is also another incorrect way mentioned all over the Internet &#8211; </p>
<pre class="brush: jscript; collapse: false; light: false; title: ; toolbar: true; notranslate">var nowUtc = new Date(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(),  now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds());
</pre>
<p><br/><br />
The result will be no different than the one that you see above.</p>
<p><strong>How to convert the local date to UTC date?</strong></p>
<pre class="brush: jscript; collapse: false; light: false; title: ; toolbar: true; notranslate">now.toUTCString()
//now = Mon, 02 Jan 2012 16:30:00 GMT</pre>
<p><br/><br />
<strong>How to get the local date from the UTC date?</strong></p>
<pre class="brush: jscript; collapse: false; light: false; title: ; toolbar: true; notranslate">now = new Date(now.toUTCString());
//now = Mon Jan 02 2012 10:30:00 GMT-0600 (CST)</pre>
<p><br/><br />
That is a long string to store, is there any <strong>alternative to store the UTC time?</strong> Just store the number of milliseconds since Epoch converted to UTC by adding the timezone offset.</p>
<pre class="brush: jscript; collapse: false; light: false; title: ; toolbar: true; notranslate">var millis = now.getTime() + (now.getTimezoneOffset() * 60000)
//millis = 1325543400000</pre>
<p><br/><br />
<strong>How to convert the milliseconds in UTC to local date?</strong> Subtract the timezone offset.</p>
<pre class="brush: jscript; collapse: false; light: false; title: ; toolbar: true; notranslate">now.setTime(millis - (now.getTimezoneOffset() * 60000))
//now = Mon Jan 02 2012 10:30:00 GMT-0600 (CST)</pre>
<p><br/><br />
Let me know if you have any questions or comments. </p>
<hr/>
I just used the below HTML to test the above mentioned code. If you wish, create an HTML file out of it and open it in a browser.</p>
<pre class="brush: xml; light: false; title: ; toolbar: true; notranslate">
&lt;html&gt;
&lt;body&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
document.write(&quot;IST time - January 02, 2012 22:00:00 GMT+0530&quot;);

var now = new Date(&quot;January 02, 2012 22:00:00 GMT+0530&quot;);
document.write(&quot;&lt;br/&gt;IST converted to local time: &quot; + now);

var nowUtc = new Date( now.getTime() + (now.getTimezoneOffset() * 60000));
document.write(&quot;&lt;br/&gt;Local time converted to UTC:&quot; + nowUtc);

nowUtc = new Date(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(),  now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds());
document.write(&quot;&lt;br/&gt;Local time converted to UTC:&quot; + nowUtc);

document.write(&quot;&lt;br/&gt;Local to GMT &quot; + now.toUTCString());

document.write(&quot;&lt;br/&gt;GMT to Local &quot; + new Date(now.toUTCString()));

var millis = (now.getTime() + (now.getTimezoneOffset() * 60000));
document.write(&quot;&lt;br/&gt;GMT in millis &quot; + millis);

document.write(&quot;&lt;br/&gt;Local in millis &quot; + ( millis - (now.getTimezoneOffset() * 60000)));

now.setTime(( millis - (now.getTimezoneOffset() * 60000)));
document.write(&quot;&lt;br/&gt;Local from millis &quot; + now);
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>This code prints the following &#8211;<br />
IST time &#8211; January 02, 2012 22:00:00 GMT+0530<br />
IST converted to local time: Mon Jan 02 2012 10:30:00 GMT-0600 (CST)<br />
Local time converted to UTC:Mon Jan 02 2012 16:30:00 GMT-0600 (CST)<br />
Local time converted to UTC:Mon Jan 02 2012 16:30:00 GMT-0600 (CST)<br />
Local to GMT Mon, 02 Jan 2012 16:30:00 GMT<br />
GMT to Local Mon Jan 02 2012 10:30:00 GMT-0600 (CST)<br />
GMT in millis 1325543400000<br />
Local in millis 1325521800000<br />
Local from millis Mon Jan 02 2012 10:30:00 GMT-0600 (CST)</p>
<div id="tweetbutton2094" class="tw_button" style="float:left;margin-right:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fhow-to-convert-javascript-local-date-to-utc-and-utc-to-local-date%2F%3FUA-20788457-1&amp;via=lobopraveen&amp;text=How%20To%20Convert%20JavaScript%20Local%20Date%20to%20UTC%20And%20UTC%20To%20Local%20Date&amp;related=&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fhow-to-convert-javascript-local-date-to-utc-and-utc-to-local-date%2F" class="twitter-share-button" rel="external nofollow"  style="width:55px;height:22px;background:transparent url('http://praveenlobo.com/techblog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>No related posts.</p><img src="http://feeds.feedburner.com/~r/LoboPraveen/blog/Technical/~4/ac9T_6OHjk8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://praveenlobo.com/techblog/how-to-convert-javascript-local-date-to-utc-and-utc-to-local-date/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://praveenlobo.com/techblog/how-to-convert-javascript-local-date-to-utc-and-utc-to-local-date/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=how-to-convert-javascript-local-date-to-utc-and-utc-to-local-date</feedburner:origLink></item>
		<item>
		<title>Daylight Saving Time (DST) Should Be A Part of Our History</title>
		<link>http://feedproxy.google.com/~r/LoboPraveen/blog/Technical/~3/o5Tmk6iTupM/</link>
		<comments>http://praveenlobo.com/techblog/daylight-saving-time-dst-should-be-a-part-of-our-history/#comments</comments>
		<pubDate>Wed, 21 Dec 2011 02:03:14 +0000</pubDate>
		<dc:creator>Lobo</dc:creator>
				<category><![CDATA[InterWeb]]></category>
		<category><![CDATA[change]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[Daylight]]></category>
		<category><![CDATA[DST]]></category>
		<category><![CDATA[time]]></category>

		<guid isPermaLink="false">http://praveenlobo.com/techblog/?p=2086</guid>
		<description><![CDATA[I was having a conversation with a friend of mine who is convinced that the Daylight Saving Time (DST) change is good and makes perfect sense. I, for one, think that the DST is not useful anymore and it could &#8230; <a href="http://praveenlobo.com/techblog/daylight-saving-time-dst-should-be-a-part-of-our-history/">Continue reading <span class="meta-nav">&#8594;</span></a>
No related posts.]]></description>
			<content:encoded><![CDATA[<p>I was having a conversation with a friend of mine who is convinced that the Daylight Saving Time (DST) change is good and makes perfect sense. I, for one, think that the DST is not useful anymore and it could have been avoided altogether. Just imagine if we didn’t have clocks and a way to time. We would have adjusted out lifestyles automatically to adapt to the nature. Instead of adjusting the clock, we should have adjusted the schedules. </p>
<p>The idea of DST was to save energy and people more social time, but the technology and the lifestyles have changed. The definition of <em>social</em> itself has changed; it’s all online now. With the advanced technology compared to the time when DST was first introduced, the problem with forgetting to spring forward and fall back, the pain it causes to the programmers who deal with the date and time functions, the global workforces and so on, I completely oppose DST.</p>
<p>DST is so last century that it should be a part of history. Definitely not present. </p>
<p>If you think, I could have explained more about DST, don’t worry, someone else already has. Check out the video below. Don’t miss it after 4:30 into the video.</p>
<p><iframe width="560" height="315" src="http://www.youtube.com/embed/84aWtseb2-4?rel=0" frameborder="0" allowfullscreen></iframe></p>
<div id="tweetbutton2086" class="tw_button" style="float:left;margin-right:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fdaylight-saving-time-dst-should-be-a-part-of-our-history%2F%3FUA-20788457-1&amp;via=lobopraveen&amp;text=Daylight%20Saving%20Time%20%28DST%29%20Should%20Be%20A%20Part%20of%20Our%20History&amp;related=&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fdaylight-saving-time-dst-should-be-a-part-of-our-history%2F" class="twitter-share-button" rel="external nofollow"  style="width:55px;height:22px;background:transparent url('http://praveenlobo.com/techblog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>No related posts.</p><img src="http://feeds.feedburner.com/~r/LoboPraveen/blog/Technical/~4/o5Tmk6iTupM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://praveenlobo.com/techblog/daylight-saving-time-dst-should-be-a-part-of-our-history/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://praveenlobo.com/techblog/daylight-saving-time-dst-should-be-a-part-of-our-history/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=daylight-saving-time-dst-should-be-a-part-of-our-history</feedburner:origLink></item>
		<item>
		<title>Will Google Voice be free in 2012 and beyond?</title>
		<link>http://feedproxy.google.com/~r/LoboPraveen/blog/Technical/~3/u39Q-Xlilrg/</link>
		<comments>http://praveenlobo.com/techblog/will-google-voice-be-free-in-2012-and-beyond/#comments</comments>
		<pubDate>Fri, 09 Dec 2011 17:41:50 +0000</pubDate>
		<dc:creator>Lobo</dc:creator>
				<category><![CDATA[InterWeb]]></category>
		<category><![CDATA[call management]]></category>
		<category><![CDATA[carrier]]></category>
		<category><![CDATA[cellphone]]></category>
		<category><![CDATA[cellular]]></category>
		<category><![CDATA[charge]]></category>
		<category><![CDATA[cost]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[Google Talk]]></category>
		<category><![CDATA[Google Voice]]></category>
		<category><![CDATA[GrooVe IP]]></category>
		<category><![CDATA[messages]]></category>
		<category><![CDATA[minutes]]></category>
		<category><![CDATA[speculation]]></category>
		<category><![CDATA[Talkatone]]></category>
		<category><![CDATA[text]]></category>
		<category><![CDATA[unlimited]]></category>
		<category><![CDATA[VOIP]]></category>

		<guid isPermaLink="false">http://praveenlobo.com/techblog/?p=2078</guid>
		<description><![CDATA[From the recent notes I made on the Google Voice and how it uses the carrier minutes and data to operate, it should be free in 2012 and beyond. Why? Currently, Google Voice is not a VOIP service and it &#8230; <a href="http://praveenlobo.com/techblog/will-google-voice-be-free-in-2012-and-beyond/">Continue reading <span class="meta-nav">&#8594;</span></a>
Related posts:<ol>
<li><a href='http://praveenlobo.com/techblog/does-google-voice-use-minutes-or-data/' rel='bookmark' title='Does Google Voice Use Minutes or Data?'>Does Google Voice Use Minutes or Data?</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>From the <a href="http://praveenlobo.com/techblog/does-google-voice-use-minutes-or-data/" title="Does Google Voice use minutes or data?">recent notes</a> I made on the Google Voice and how it uses the carrier minutes and data to operate, it should be free in 2012 and beyond.</p>
<p>Why? Currently, Google Voice is not a VOIP service and it uses the carrier minutes and data to operate which means to make or receive calls the subscriber has to pay the carrier. See the image in <a href="http://praveenlobo.com/techblog/does-google-voice-use-minutes-or-data/" title="Does Google Voice use minutes or data?">that</a> post. If Google Voice doesn&#8217;t offer VOIP service and starts charging for the voice calls, the subscriber will be <strong><em>double charged</em></strong>. For every call made or received, the subscriber has to pay to use Google Voice and then, since Google Voice uses the carrier minutes, has pay the carrier for using the minutes. If this is exactly how it works, it will be very difficult to justify Google Voice. I&#8217;d definitely drop Google Voice and, I think, many other will too.</p>
<p>Charging Google Voice makes sense if either Google Voice offers VOIP services (like Skype which uses just data) or if it charges on a monthly basis &#8211; an amount for using their services. The free text messages and the call management service are worth paying for, but if it&#8217;s too pricey, one would rather pay the carrier and get rid of call management service. Many plans offer unlimited text messaging ( and do you really need unlimited?) and the call management service isn&#8217;t something that one can&#8217;t live without. Lo and behold, the biggest benefit would be that you won&#8217;t be providing any more self-data to Google than you already have or are.</p>
<p>There are some apps (Talkatone, GrooVe IP etc) which use VOIP services like Google Talk along with Google Voice and allow for free calls over data. What happens if Google decides to get rid of the free calling service in 2012? Even these third party application will not be able to make free calls. The applications will use only data (and save carrier minutes), but Google Voice will not be free. It will be interesting to see what direction those third party applications take at that time.</p>
<p>All this will just be opinions/guesses/rumors, until Google comes out and announces their plan, which should happen not too far from now. </p>
<div id="tweetbutton2078" class="tw_button" style="float:left;margin-right:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fwill-google-voice-be-free-in-2012-and-beyond%2F%3FUA-20788457-1&amp;via=lobopraveen&amp;text=Will%20Google%20Voice%20be%20free%20in%202012%20and%20beyond%3F&amp;related=&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fwill-google-voice-be-free-in-2012-and-beyond%2F" class="twitter-share-button" rel="external nofollow"  style="width:55px;height:22px;background:transparent url('http://praveenlobo.com/techblog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>Related posts:<ol>
<li><a href='http://praveenlobo.com/techblog/does-google-voice-use-minutes-or-data/' rel='bookmark' title='Does Google Voice Use Minutes or Data?'>Does Google Voice Use Minutes or Data?</a></li>
</ol></p><img src="http://feeds.feedburner.com/~r/LoboPraveen/blog/Technical/~4/u39Q-Xlilrg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://praveenlobo.com/techblog/will-google-voice-be-free-in-2012-and-beyond/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://praveenlobo.com/techblog/will-google-voice-be-free-in-2012-and-beyond/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=will-google-voice-be-free-in-2012-and-beyond</feedburner:origLink></item>
		<item>
		<title>Does Google Voice Use Minutes or Data?</title>
		<link>http://feedproxy.google.com/~r/LoboPraveen/blog/Technical/~3/lMIGV1drKSc/</link>
		<comments>http://praveenlobo.com/techblog/does-google-voice-use-minutes-or-data/#comments</comments>
		<pubDate>Thu, 01 Dec 2011 05:55:41 +0000</pubDate>
		<dc:creator>Lobo</dc:creator>
				<category><![CDATA[InterWeb]]></category>
		<category><![CDATA[call forwarding]]></category>
		<category><![CDATA[call management]]></category>
		<category><![CDATA[carrier]]></category>
		<category><![CDATA[cellphone]]></category>
		<category><![CDATA[cellular]]></category>
		<category><![CDATA[computer]]></category>
		<category><![CDATA[cost]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[Google Talk]]></category>
		<category><![CDATA[Google Voice]]></category>
		<category><![CDATA[GrooVe IP]]></category>
		<category><![CDATA[messages]]></category>
		<category><![CDATA[minutes]]></category>
		<category><![CDATA[setup]]></category>
		<category><![CDATA[Talkatone]]></category>
		<category><![CDATA[text]]></category>
		<category><![CDATA[voicemails]]></category>
		<category><![CDATA[VOIP]]></category>
		<category><![CDATA[wifi]]></category>
		<category><![CDATA[workaround]]></category>

		<guid isPermaLink="false">http://praveenlobo.com/techblog/?p=2059</guid>
		<description><![CDATA[Does Google Voice Use Minutes or Data? Does Google Voice cost money? How does Google Voice calling or texting work? The answer is Yes, Yes and I don&#8217;t know. Google Voice is an awesome idea and piece of software (if &#8230; <a href="http://praveenlobo.com/techblog/does-google-voice-use-minutes-or-data/">Continue reading <span class="meta-nav">&#8594;</span></a>
Related posts:<ol>
<li><a href='http://praveenlobo.com/techblog/will-google-voice-be-free-in-2012-and-beyond/' rel='bookmark' title='Will Google Voice be free in 2012 and beyond?'>Will Google Voice be free in 2012 and beyond?</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Does Google Voice Use Minutes or Data? Does Google Voice cost money? How does Google Voice calling or texting work? The answer is Yes, Yes and I don&#8217;t know.</p>
<p>Google Voice is an awesome idea and piece of software (if you are willing to give away more self information to Google than you already have). It is not a VOIP service like Google Talk; it is a call management service. It will always cost you money in one way or the other (cellular minutes or data) and you will not be able to make free calls. If you consider cellular data to be free or use wifi, there are workarounds to make it free like using Talkatone or GrooVe IP or other third party apps. These applications use Google Talk free calling feature(VOIP) along with Google Voice, which integrates with Google Talk, to make free calls using only data. Keep in mind that by using more services, you are distributing your own information all over the Internet companies.</p>
<p>Let us recap. <strong>Google by itself doesn&#8217;t allow free calls on the cellphones. Google allows free calls on the computer using Google Talk. Third party applications allow free calls on the cellphone using the cellular data and Google Voice + Talk.</strong></p>
<p>Are text messages free on Google Voice? Yes. Whether you use it from a cellphone or a computer, messages are free.</p>
<p>But, hey how does Google Voice use your minutes or data to send/make or receive calls/texts? From what I read about it on Google forums, I put together a simple diagram. Notice the color coding in the image.</p>
<a  href="http://praveenlobo.com/techblog/wp-content/uploads/2011/11/googlevoice/GoogleVoiceCarrierMinutesData.png"><img class="colorbox-2059"  alt='Google Voice and Carrier Minutes or Data'  title='Google Voice and Carrier Minutes or Data' src="http://praveenlobo.com/techblog/wp-content/uploads/2011/11/googlevoice/GoogleVoiceCarrierMinutesData.png" style="width:99%;"/></a>
<p><strong>Incoming and voicemails</strong> &#8211; Google transfers the call to your cellphone which costs carrier minutes. If you are using Google for voicemail, whenever you miss a call, your carrier forwards the call to Google voicemail. Call forwarding uses carrier minutes.</p>
<p><strong>Outgoing and voicemails</strong> &#8211; First, if you notice a voicemail and call your voicemail box, you are using carrier minutes. Second, whenever you initiate a outgoing call, Google Voice uses data (a tiny bit) to connect to the server and initiates the call by calling your cellphone, which costs carrier minutes, and then connecting the call to the other phone. </p>
<p><strong>Text message and voicemail</strong> &#8211; Why is voicemail mentioned here? Because Google transcribes the voicemails which can be accessed as email or text messages. Now, all text messaging happens over the cellular data or wifi and it doesn&#8217;t use any cellular minutes. </p>
<p>Oh, why did I say I don&#8217;t know how Google Voice works? Because I really don&#8217;t know how it works. I just know how they use the carrier minutes/texts (on high level) and I hope by now you do too. Let me know in the comments below.</p>
<p><strong>Note about setup</strong> &#8211;<br />
You are using Google Voice number as primary and transferring calls to your cellphone number.<br />
You have disabled the carrier voicemail and set it to forward to Google Voice voicemail.<br />
You have disabled text message forwarding (to cellphone) on Google Voice.<br />
You have free calls within US/Canada using Google Voice.</p>
<div id="tweetbutton2059" class="tw_button" style="float:left;margin-right:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fdoes-google-voice-use-minutes-or-data%2F%3FUA-20788457-1&amp;via=lobopraveen&amp;text=Does%20Google%20Voice%20Use%20Minutes%20or%20Data%3F&amp;related=&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fdoes-google-voice-use-minutes-or-data%2F" class="twitter-share-button" rel="external nofollow"  style="width:55px;height:22px;background:transparent url('http://praveenlobo.com/techblog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>Related posts:<ol>
<li><a href='http://praveenlobo.com/techblog/will-google-voice-be-free-in-2012-and-beyond/' rel='bookmark' title='Will Google Voice be free in 2012 and beyond?'>Will Google Voice be free in 2012 and beyond?</a></li>
</ol></p><img src="http://feeds.feedburner.com/~r/LoboPraveen/blog/Technical/~4/lMIGV1drKSc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://praveenlobo.com/techblog/does-google-voice-use-minutes-or-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://praveenlobo.com/techblog/does-google-voice-use-minutes-or-data/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=does-google-voice-use-minutes-or-data</feedburner:origLink></item>
		<item>
		<title>Java: Get Sub List of Elements between two elements (instead of indexes) in a List</title>
		<link>http://feedproxy.google.com/~r/LoboPraveen/blog/Technical/~3/VRNdcdjV9BA/</link>
		<comments>http://praveenlobo.com/techblog/java-get-sub-list-of-elements-between-two-elements-instead-of-indexes-in-a-list/#comments</comments>
		<pubDate>Tue, 25 Oct 2011 04:51:59 +0000</pubDate>
		<dc:creator>Lobo</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[arraylist]]></category>
		<category><![CDATA[binary search]]></category>
		<category><![CDATA[collections]]></category>
		<category><![CDATA[elements]]></category>
		<category><![CDATA[index]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[sort]]></category>
		<category><![CDATA[sublist]]></category>

		<guid isPermaLink="false">http://praveenlobo.com/techblog/?p=2045</guid>
		<description><![CDATA[Java List APIs provides a way to get the elements (sub-list) in a List between two indexes using List subList(int fromIndex, int toIndex). However, there is no API to get the elements in a List between two list elements List &#8230; <a href="http://praveenlobo.com/techblog/java-get-sub-list-of-elements-between-two-elements-instead-of-indexes-in-a-list/">Continue reading <span class="meta-nav">&#8594;</span></a>
No related posts.]]></description>
			<content:encoded><![CDATA[<p>Java List APIs provides a way to get the elements (sub-list) in a List between two indexes using <code>List<E> subList(int fromIndex, int toIndex)</code>. However, there is no API to get the elements in a List between two list elements <code>List<E> subList(Object fromElement, Object toElement)</code> . The following code is an example to get the elements (sub-list) &#8220;between two list elements&#8221;. This works even if the given element doesn&#8217;t exist in the List. Imagine a list of items with different prices and a sub-list of items between price X and price Y when ,say, there are no items with price X or Y.</p>
<p>The following code, sorts the list and creates a clone just to make sure the original list is unaffected by the method. If the list of items are always expected to be in sorted order, then the clone and sort can be removed. Also, note that this method uses binary search; if the size of the list if small, brute force approach would be efficient than this.</p>
<p>Note that the Item needs compareTo() and equals() override for binary searching and Collection.sort() respectively.</p>
<pre class="brush: java; light: false; title: Item Class (click to expand); toolbar: true; notranslate">
import java.math.BigDecimal;

public class Item implements Comparable&lt;Item&gt; {

 private String name;
 private BigDecimal price;

 @Override
 public int compareTo(Item item) {
  return this.price.compareTo(item.price);
 }

 @Override
 public boolean equals(Object o) {
  return this.price.equals(((Item)o).getPrice());
 }

 @Override
 public String toString() {
  return this.name + &quot; - &quot; + this.price;
 }

 Item(String name, BigDecimal price) {
  setName(name);
  setPrice(price);
 }

 public String getName() {
  return name;
 }

 public void setName(String name) {
  this.name = name;
 }

 public BigDecimal getPrice() {
  return price;
 }

 public void setPrice(BigDecimal price) {
  this.price = price;
 }
}
</pre>
<pre class="brush: java; light: false; title: Store Class (click to expand); toolbar: true; notranslate">
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Store {

 // list to hold the items in stock
 private List&lt;Item&gt; itemsInStock;

 public List&lt;Item&gt; getItemsInStock() {
  return itemsInStock;
 }

 public void setItemsInStock(List&lt;Item&gt; itemsInStock) {
  if (this.itemsInStock == null) {
   this.itemsInStock = itemsInStock;
  } else {
   this.itemsInStock.addAll(itemsInStock);
  }
 }

 public void setItemInStock(Item item) {
  if (this.itemsInStock == null) {
   this.itemsInStock = new ArrayList&lt;Item&gt;();
  }
  this.itemsInStock.add(item);
 }

 /**
  * Answers a List of Items from the items in stock between the low price and
  * the high price passed to it. The List returned is &lt;b&gt;backed by&lt;/b&gt; the
  * actual items in stock so changes to one are reflected by the other.
  *
  *
  * @param lowPrice
  *            the lowest price of the items to fetch
  * @param highPrice
  *            the highest price of the items to fetch
  *
  * @return a List of Items in stock; null if there are no items between the
  *         lowest and the highest price.
  */
 public List&lt;Item&gt; getItemsInStock(BigDecimal lowPrice, BigDecimal highPrice) {

  // create dummy items for search
  Item startItem = new Item(null, lowPrice);
  Item endItem = new Item(null, highPrice);

  // clone the list so that the ordering of the items in the list is not affected
  List&lt;Item&gt; itemsClone = new ArrayList&lt;Item&gt;(this.itemsInStock);

  // sort the items for binary search
  Collections.sort(itemsClone);

  // Read binary search() documentation for more details.
  int fromIndex = Collections.binarySearch(itemsClone, startItem);
  int toIndex = Collections.binarySearch(itemsClone, endItem);

  // If the low price is not found, get insertion point
  if (fromIndex &lt; 0) {
   // After this, fromIndex will be between ( 0...total items)
   fromIndex = -(fromIndex + 1);
  } else {
   // binary search doesn't necessarily return first matching item
   while (fromIndex &gt; 0 &amp;&amp; itemsClone.get(fromIndex).equals(itemsClone.get(fromIndex - 1))) {
    fromIndex--;
   }
  }

  // If the high price is not found, get (insertion point - 1 )
  if (toIndex &lt; 0) {
   // After this, toIndex will be between ( -1...total items-1)
   toIndex = -(toIndex + 2);
  } else {
   // binary search doesn't necessarily return last matching item
   while (toIndex &lt; (itemsClone.size() - 1) &amp;&amp; itemsClone.get(toIndex).equals(itemsClone.get(toIndex + 1))) {
    toIndex++;
   }
  }

  /*
   * We have items between start and end ONLY IF fromIndex is &lt;= toIndex
   * and fromIndex is != total items and toIndex is != -1
   */
  if (toIndex &lt; fromIndex) {
   return null;
  }

  // Return a view of the list
  return itemsClone.subList(fromIndex, toIndex + 1);
 }
}
</pre>
<pre class="brush: java; light: false; title: Test Class (click to expand); toolbar: true; notranslate">
import java.math.BigDecimal;
import java.util.List;

public class Test {

 public static void main(String args[]) {

  Store s = new Store();
  s.setItemInStock(new Item(&quot;Nexus S&quot;, new BigDecimal(300)));
  s.setItemInStock(new Item(&quot;Galaxy S 4G&quot;, new BigDecimal(400)));
  s.setItemInStock(new Item(&quot;Nexus S 4G&quot;, new BigDecimal(400)));
  s.setItemInStock(new Item(&quot;Galaxy S2&quot;, new BigDecimal(700)));
  s.setItemInStock(new Item(&quot;Xperia Arc&quot;, new BigDecimal(500)));
  s.setItemInStock(new Item(&quot;Sensation 4G&quot;, new BigDecimal(600)));
  s.setItemInStock(new Item(&quot;Galaxy Nexus&quot;, new BigDecimal(750)));
  s.setItemInStock(new Item(&quot;iPhone 5&quot;, new BigDecimal(&quot;799.99&quot;)));

  // Get items from Store between 299 and 799
  List&lt;Item&gt; itemsInRange = (List&lt;Item&gt;) s.getItemsInStock(new BigDecimal(299), new BigDecimal(799));

  if (itemsInRange != null) {
   for (Item i : itemsInRange) {
    System.out.println(i);
   }
  } else {
   System.out.println(&quot;Sorry, no items found in the price range!&quot;);
  }
 }
}

/* OUTPUT for items between 299 &amp; 799
Nexus S - 300
Galaxy S 4G - 400
Nexus S 4G - 400
Xperia Arc - 500
Sensation 4G - 600
Galaxy S2 - 700
Galaxy Nexus - 750
*/
</pre>
<div id="tweetbutton2045" class="tw_button" style="float:left;margin-right:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fjava-get-sub-list-of-elements-between-two-elements-instead-of-indexes-in-a-list%2F%3FUA-20788457-1&amp;via=lobopraveen&amp;text=Java%3A%20Get%20Sub%20List%20of%20Elements%20between%20two%20elements%20%28instead%20of%20indexes%29%20in%20a%20List&amp;related=&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fjava-get-sub-list-of-elements-between-two-elements-instead-of-indexes-in-a-list%2F" class="twitter-share-button" rel="external nofollow"  style="width:55px;height:22px;background:transparent url('http://praveenlobo.com/techblog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>No related posts.</p><img src="http://feeds.feedburner.com/~r/LoboPraveen/blog/Technical/~4/VRNdcdjV9BA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://praveenlobo.com/techblog/java-get-sub-list-of-elements-between-two-elements-instead-of-indexes-in-a-list/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://praveenlobo.com/techblog/java-get-sub-list-of-elements-between-two-elements-instead-of-indexes-in-a-list/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=java-get-sub-list-of-elements-between-two-elements-instead-of-indexes-in-a-list</feedburner:origLink></item>
		<item>
		<title>Your Influence Is Ubiquitous – R.I.P. Dennis Ritchie</title>
		<link>http://feedproxy.google.com/~r/LoboPraveen/blog/Technical/~3/T6L_HtXLuFY/</link>
		<comments>http://praveenlobo.com/techblog/your-influence-is-ubiquitous-r-i-p-dennis-ritchie/#comments</comments>
		<pubDate>Fri, 14 Oct 2011 02:53:02 +0000</pubDate>
		<dc:creator>Lobo</dc:creator>
				<category><![CDATA[InterWeb]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Dennis Ritchie]]></category>
		<category><![CDATA[obituary]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://praveenlobo.com/techblog/?p=2041</guid>
		<description><![CDATA[I didn&#8217;t post it on my technical blog, but on personal blog for a reason. TweetNo related posts.
No related posts.]]></description>
			<content:encoded><![CDATA[<p>I didn&#8217;t post it on my technical blog, but on <a href="http://praveenlobo.com/blog/it-needs-a-genius-to-understand-the-simplicity-r-i-p-dennis-ritchie/" title="R.I.P Dennis Ritchie">personal blog</a> for a reason. </p>
<div id="tweetbutton2041" class="tw_button" style="float:left;margin-right:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fyour-influence-is-ubiquitous-r-i-p-dennis-ritchie%2F%3FUA-20788457-1&amp;via=lobopraveen&amp;text=Your%20Influence%20Is%20Ubiquitous%20%26%238211%3B%20R.I.P.%20Dennis%20Ritchie&amp;related=&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fyour-influence-is-ubiquitous-r-i-p-dennis-ritchie%2F" class="twitter-share-button" rel="external nofollow"  style="width:55px;height:22px;background:transparent url('http://praveenlobo.com/techblog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>No related posts.</p><img src="http://feeds.feedburner.com/~r/LoboPraveen/blog/Technical/~4/T6L_HtXLuFY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://praveenlobo.com/techblog/your-influence-is-ubiquitous-r-i-p-dennis-ritchie/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://praveenlobo.com/techblog/your-influence-is-ubiquitous-r-i-p-dennis-ritchie/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=your-influence-is-ubiquitous-r-i-p-dennis-ritchie</feedburner:origLink></item>
		<item>
		<title>A couple of ways to tokenize a delimited String in Java</title>
		<link>http://feedproxy.google.com/~r/LoboPraveen/blog/Technical/~3/5Ipwc9EOO64/</link>
		<comments>http://praveenlobo.com/techblog/a-couple-of-ways-to-tokenize-a-delimited-string-in-java/#comments</comments>
		<pubDate>Fri, 12 Aug 2011 03:54:41 +0000</pubDate>
		<dc:creator>Lobo</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[benchmark]]></category>
		<category><![CDATA[crazy]]></category>
		<category><![CDATA[csv]]></category>
		<category><![CDATA[delimiter]]></category>
		<category><![CDATA[for-loop]]></category>
		<category><![CDATA[nanoTime]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[string.split]]></category>
		<category><![CDATA[tokenizer]]></category>
		<category><![CDATA[while-loop]]></category>

		<guid isPermaLink="false">http://praveenlobo.com/techblog/?p=2008</guid>
		<description><![CDATA[StringTokenizer: It is a legacy class and its use is discouraged in new code. I don&#8217;t like to use this class even if it weren&#8217;t a legacy class because it ignores blank tokens. Below code will not output the blank(&#8220;&#8221;) &#8230; <a href="http://praveenlobo.com/techblog/a-couple-of-ways-to-tokenize-a-delimited-string-in-java/">Continue reading <span class="meta-nav">&#8594;</span></a>
No related posts.]]></description>
			<content:encoded><![CDATA[<li>StringTokenizer:</li>
<p> It is a legacy class and its use is discouraged in new code. I don&#8217;t like to use this class even if it weren&#8217;t a legacy class because it ignores blank tokens. Below code will not output the blank(&#8220;&#8221;) between <em>A</em> and <em>In</em> and the last blank token after <em>Me</em>. </p>
<pre class="brush: java; light: false; title: ; toolbar: true; notranslate">
		StringTokenizer st = new StringTokenizer(&quot;I,Have,A,,In,Me,&quot;, &quot;,&quot;);
		while (st.hasMoreTokens()) {
			System.out.println(st.nextToken());
		}
</pre>
<li>split method:</li>
<p>Javadoc suggets split method of String or the java.util.regex package as alternatives. The split method returns the blank tokens in-between two tokens, however, the last blank token(after <em>Me</em>) will stll be missing. We need some extra code to get the last token.</p>
<pre class="brush: java; light: false; title: ; toolbar: true; notranslate">
		final String DELIMITER = &quot;,&quot;;
		String string = &quot;I,Have,A,,In,Me,&quot;;
		for (String value : string.split(DELIMITER)) {
			System.out.println(value);
		}

		// Check for last token
		int lastIndex = string.lastIndexOf(DELIMITER);
		if (lastIndex == string.length()-1) {
			System.out.println(string.substring(lastIndex + 1));
		}
</pre>
<li>Write your own tokenizer code:</li>
<pre class="brush: java; light: false; title: ; toolbar: true; notranslate">
		String string = &quot;I,Have,A,,In,Me,&quot;;
		final String DELIMITER = &quot;,&quot;;

		int i = 0,  j = string.indexOf(DELIMITER);

		// while there are tokens
		while (j != -1) {
			System.out.println(string.substring(i, j));
			i = j + 1;
			j = string.indexOf(DELIMITER, i);
		}

		// extract the last token
		if (i &lt;= string.length()) {
			System.out.println(string.substring(i));
		}
</pre>
<p>I got a little crazy and changed the above code.</p>
<pre class="brush: java; light: false; title: ; toolbar: true; notranslate">
		String string = &quot;I,Have,A,,In,Me,&quot;;
		final String DELIMITER = &quot;,&quot;;

		int i = 0, j = -1;

		// while there are tokens
		while ((j = string.indexOf(DELIMITER, (i = ++j))) != -1) {
			System.out.println(string.substring(i, j));
		}

		// extract the last token
		if (i &lt;= string.length()) {
			System.out.println(string.substring(i));
		}
</pre>
<p>Same thing using for.</p>
<pre class="brush: java; light: false; title: ; toolbar: true; notranslate">
		String string = &quot;I,Have,A,,In,Me,&quot;;
		final String DELIMITER = &quot;,&quot;;

		int i = 0;

		// for each token in the string
		for (int j = -1; (j = string.indexOf(DELIMITER, (i = ++j))) != -1;) {
			System.out.println(string.substring(i, j));
		}

		// extract the last token
		if (i &lt;= string.length()) {
			System.out.println(string.substring(i));
		}
</pre>
<p>The most basic benchmarking &#8211; using System.nanoTime() in while loop with 1,000,000 iterations. The average of 5 such runs are below.</p>
<table>
<tr>
<td>Tokenizer</td>
<td>2.569156437(quicker but doesn&#8217;t give the desired output.)</td>
</tr>
<tr>
<td>String.split()</td>
<td>4.567683168(remember the last token?)</td>
</tr>
<tr>
<td>While</td>
<td>2.690626660</td>
</tr>
<tr>
<td>2nd While</td>
<td>2.765533696</td>
</tr>
<tr>
<td>For</td>
<td>2.717799994</td>
</tr>
</table>
<div id="tweetbutton2008" class="tw_button" style="float:left;margin-right:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fa-couple-of-ways-to-tokenize-a-delimited-string-in-java%2F%3FUA-20788457-1&amp;via=lobopraveen&amp;text=A%20couple%20of%20ways%20to%20tokenize%20a%20delimited%20String%20in%20Java&amp;related=&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fa-couple-of-ways-to-tokenize-a-delimited-string-in-java%2F" class="twitter-share-button" rel="external nofollow"  style="width:55px;height:22px;background:transparent url('http://praveenlobo.com/techblog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>No related posts.</p><img src="http://feeds.feedburner.com/~r/LoboPraveen/blog/Technical/~4/5Ipwc9EOO64" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://praveenlobo.com/techblog/a-couple-of-ways-to-tokenize-a-delimited-string-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://praveenlobo.com/techblog/a-couple-of-ways-to-tokenize-a-delimited-string-in-java/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=a-couple-of-ways-to-tokenize-a-delimited-string-in-java</feedburner:origLink></item>
		<item>
		<title>How to scroll elements smoothly in JavaScript/jQuery without plugins</title>
		<link>http://feedproxy.google.com/~r/LoboPraveen/blog/Technical/~3/HcmVhWMBTGk/</link>
		<comments>http://praveenlobo.com/techblog/how-to-scroll-elements-smoothly-in-javascript-jquery-without-plugins/#comments</comments>
		<pubDate>Thu, 11 Aug 2011 02:08:01 +0000</pubDate>
		<dc:creator>Lobo</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[align]]></category>
		<category><![CDATA[anchor]]></category>
		<category><![CDATA[animate]]></category>
		<category><![CDATA[element]]></category>
		<category><![CDATA[height]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[id]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[offset]]></category>
		<category><![CDATA[parent]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[scroll]]></category>
		<category><![CDATA[scrollbar]]></category>
		<category><![CDATA[scrollIntoView]]></category>
		<category><![CDATA[scrollTo]]></category>
		<category><![CDATA[scrollTop]]></category>
		<category><![CDATA[smooth]]></category>
		<category><![CDATA[viewport]]></category>
		<category><![CDATA[window]]></category>

		<guid isPermaLink="false">http://praveenlobo.com/techblog/?p=1915</guid>
		<description><![CDATA[There are multitude of ways to scroll the page to bring certain elements to view through code. A few of them below. The code given below can be used to scroll any element with an ID on the page. The &#8230; <a href="http://praveenlobo.com/techblog/how-to-scroll-elements-smoothly-in-javascript-jquery-without-plugins/">Continue reading <span class="meta-nav">&#8594;</span></a>
Related posts:<ol>
<li><a href='http://praveenlobo.com/techblog/html-selectdropdown-with-javascript-jquery/' rel='bookmark' title='HTML SELECT/Dropdown with JavaScript/jQuery'>HTML SELECT/Dropdown with JavaScript/jQuery</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>There are multitude of ways to scroll the page to bring certain elements to view through code. A few of them below. The code given below can be used to scroll any element with an ID on the page. The <a href="http://praveenlobo.com/techblog/wp-content/uploads/2011/08/scroll/ScrollDemo.html">demo</a> scrolls the page as well as the contents of a DIV and bring an element to view. These methods also use jQuery&#8217;s animate() method. To best view the code in action click on RESET before clicking on the buttons.</p>
<p>Do you have a better way of scrolling elements? Ideas/comments/suggestions are always welcome.</p>
<hr />
<ul>
<li>The simplest one will be to use <strong>an anchor tag</strong>. Note that the anchor can be used on any element with an ID. This works exactly the same as scrollIntoView(true) &#8211; see [2] below
<pre class="brush: xml; collapse: false; light: false; title: ; toolbar: true; notranslate">
&lt;A href=&quot;#element&quot;&gt;Scroll to element&lt;/A&gt;
..
&lt;DIV id=&quot;element&quot;&gt;...&lt;/DIV&gt;
</pre>
</li>
<li>
<strong>[1] JavaScript scrollTo method</strong>:<br />
 This method takes coordinates on x and y axis to scroll.  The problem with this approach is that if the element to scroll is inside another element which has a scrollbar, it will not work as one might expect.</p>
<pre class="brush: jscript; collapse: false; light: false; title: ; toolbar: true; notranslate">
function scroll(element){
  var ele = document.getElementById(element);
  window.scrollTo(ele.offsetLeft,ele.offsetTop);
}
</pre>
<p>
</li>
<li><strong>[2] JavaScript scrollIntoView(alignWithTop) method</strong>:<br />
 alignWithTop=true will align the element with the top of the scroll area. </p>
<pre class="brush: jscript; collapse: false; light: false; title: ; toolbar: true; notranslate">
function scroll(element, parent){
    $(element)[0].scrollIntoView(true);
}
</pre>
<p>
</li>
<li><strong>[3] JavaScript scrollIntoView(alignWithTop) method</strong>:<br />
 alignWithTop=false will align the element with the bottom of the scroll area.</p>
<pre class="brush: jscript; collapse: false; light: false; title: ; toolbar: true; notranslate">
function scroll(element, parent){
    $(element)[0].scrollIntoView(false);
}
</pre>
<p>
</li>
<li><strong>[4] By adjusting scrollTop</strong>:<br />
 I think, this is the most commonly used/suggested way. However, if you try to scroll again, the scrolling goes for a toss. Try clicking on scroll twice on the demo page.  </p>
<pre class="brush: jscript; collapse: false; light: false; title: ; toolbar: true; notranslate">
function scroll(element, parent){
     $(parent).animate({ scrollTop: $(element).offset().top - $(parent).offset().top }, { duration: 'slow', easing: 'swing'});
}
</pre>
</li>
<li><strong>[5] scrollIntoView(alignWithTop) and by adjusting scrollTop</strong>:<br />
 This is just a combination of [2] and [4]   </p>
<pre class="brush: jscript; collapse: false; light: false; title: ; toolbar: true; notranslate">
function scroll(element, parent){
     $(parent)[0].scrollIntoView(true);
     $(parent).animate({ scrollTop: $(parent).scrollTop() + $(element).offset().top - $(parent).offset().top }, { duration: 'slow', easing: 'swing'});
}
</pre>
</li>
<li><strong>[6] scrollIntoView(alignWithTop) and by adjusting scrollTop</strong>:<br />
 This is a combination of [3] and [4]</p>
<pre class="brush: jscript; collapse: false; light: false; title: ; toolbar: true; notranslate">
function scroll(element, parent){
     $(parent)[0].scrollIntoView(false);
     $(parent).animate({ scrollTop: $(parent).scrollTop() + $(element).offset().top - $(parent).offset().top }, { duration: 'slow', easing: 'swing'});
}
</pre>
</li>
<li><strong>[7] Using scrollTop and animation</strong>:<br />
 This is same as [5] but scrolls smoothly.</p>
<pre class="brush: jscript; collapse: false; light: false; title: ; toolbar: true; notranslate">
function scroll(element, parent){
     $(parent).animate({ scrollTop: $(parent).scrollTop() + $(element).offset().top - $(parent).offset().top }, { duration: 'slow', easing: 'swing'});
     $('html,body').animate({ scrollTop: $(parent).offset().top }, { duration: 1000, easing: 'swing'});
}
</pre>
</li>
<li><strong>[8] Using scrollTop and animation</strong>:<br />
 This is same as [6] but scrolls smoothly.</p>
<pre class="brush: jscript; collapse: false; light: false; title: ; toolbar: true; notranslate">
function scroll(element, parent){
     $(parent).animate({ scrollTop: $(parent).scrollTop() + $(element).offset().top - $(parent).offset().top }, { duration: 'slow', easing: 'swing'});
     $('html,body').animate({ scrollTop: $(parent).offset().top - $(window).height() + $(element).height() }, { duration: 1000, easing: 'swing'});
}
</pre>
</li>
<li><strong>[9] Using scrollTop and animation</strong>:<br />
 This is essentially same as the last two methods except that this one will scroll the the page to bring the parent element to align the top with 1/3rd of the viewport.  </p>
<pre class="brush: jscript; collapse: false; light: false; title: ; toolbar: true; notranslate">
function scroll(element, parent){
     $(parent).animate({ scrollTop: $(parent).scrollTop() + $(element).offset().top - $(parent).offset().top }, { duration: 'slow', easing: 'swing'});
     $('html,body').animate({ scrollTop: $(parent).offset().top - ($(window).height()/3) }, { duration: 1000, easing: 'swing'});
}
</pre>
</li>
<li><strong>Reset scroll</strong>:<br />
 This method will remove scroll from all elements on the page. </p>
<pre class="brush: jscript; collapse: false; light: false; title: ; toolbar: true; notranslate">
function resetAllScroll(){
  $(&quot;*&quot;).animate({ scrollTop: 0}, { duration: 'slow', easing: 'swing'});
}
</pre>
</li>
</ul>
<hr />
Check out the demo and let me know what you think. <a href="http://praveenlobo.com/techblog/wp-content/uploads/2011/08/scroll/ScrollDemo.html">demo</a>. To best view the code in action click on RESET before clicking on the buttons.</p>
<div id="tweetbutton1915" class="tw_button" style="float:left;margin-right:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fhow-to-scroll-elements-smoothly-in-javascript-jquery-without-plugins%2F%3FUA-20788457-1&amp;via=lobopraveen&amp;text=How%20to%20scroll%20elements%20smoothly%20in%20JavaScript%2FjQuery%20without%20plugins&amp;related=&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fhow-to-scroll-elements-smoothly-in-javascript-jquery-without-plugins%2F" class="twitter-share-button" rel="external nofollow"  style="width:55px;height:22px;background:transparent url('http://praveenlobo.com/techblog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>Related posts:<ol>
<li><a href='http://praveenlobo.com/techblog/html-selectdropdown-with-javascript-jquery/' rel='bookmark' title='HTML SELECT/Dropdown with JavaScript/jQuery'>HTML SELECT/Dropdown with JavaScript/jQuery</a></li>
</ol></p><img src="http://feeds.feedburner.com/~r/LoboPraveen/blog/Technical/~4/HcmVhWMBTGk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://praveenlobo.com/techblog/how-to-scroll-elements-smoothly-in-javascript-jquery-without-plugins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://praveenlobo.com/techblog/how-to-scroll-elements-smoothly-in-javascript-jquery-without-plugins/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=how-to-scroll-elements-smoothly-in-javascript-jquery-without-plugins</feedburner:origLink></item>
		<item>
		<title>Comments are beautiful</title>
		<link>http://feedproxy.google.com/~r/LoboPraveen/blog/Technical/~3/YCqrTfBgGcs/</link>
		<comments>http://praveenlobo.com/techblog/comments-are-beautiful/#comments</comments>
		<pubDate>Wed, 10 Aug 2011 12:57:52 +0000</pubDate>
		<dc:creator>Lobo</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[beautiful]]></category>
		<category><![CDATA[clean]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[comments]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[instructions]]></category>
		<category><![CDATA[it]]></category>
		<category><![CDATA[legacy]]></category>
		<category><![CDATA[machines]]></category>
		<category><![CDATA[programmer]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[respect]]></category>
		<category><![CDATA[support]]></category>

		<guid isPermaLink="false">http://praveenlobo.com/techblog/?p=2002</guid>
		<description><![CDATA[Knowing what the hell you are doing is very important and in the world of programming, letting others know what the hell you are doing is just as important. We, well most of us, code for a living. We cannot &#8230; <a href="http://praveenlobo.com/techblog/comments-are-beautiful/">Continue reading <span class="meta-nav">&#8594;</span></a>
Related posts:<ol>
<li><a href='http://praveenlobo.com/techblog/why-are-comments-important/' rel='bookmark' title='Why Are Comments Important?'>Why Are Comments Important?</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Knowing what the hell you are doing is very important and in the world of programming, letting others know what the hell you are doing is just as important. </p>
<p>We, well most of us, code for a living. We cannot support it forever. We might change profession, move on to a &#8216;grass is greener&#8217; place, worst yet we might not exist at all! There will always be another person working on our code, making a living trying to fix the issues (that we thought will never exist), making it better suite the &#8216;current world&#8217;. </p>
<p>This job is certainly not easy. Code is a way for us to let the machines know what we want them to do. They don&#8217;t understand it, they just follow your instructions blindly. A human can not change these instructions without first understanding them. Understanding these instructions are like understanding the thought process of the original programmer and you know how messed up our thoughts are. How is one supposed to understand it? </p>
<p>This is exactly where comments are life savers(literally). They are not ugly; they are beautiful. They let the lesser mortals know what the creator was thinking when he created his masterpieces. They make someone else&#8217;s life easy. I&#8217;m not kidding you, they earn you respect. </p>
<p>We will not exist forever, neither do these code that we create. However, they might outlive our short IT lives. What kind of a legacy do we want to leave behind?   </p>
<div id="tweetbutton2002" class="tw_button" style="float:left;margin-right:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fcomments-are-beautiful%2F%3FUA-20788457-1&amp;via=lobopraveen&amp;text=Comments%20are%20beautiful&amp;related=&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fcomments-are-beautiful%2F" class="twitter-share-button" rel="external nofollow"  style="width:55px;height:22px;background:transparent url('http://praveenlobo.com/techblog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>Related posts:<ol>
<li><a href='http://praveenlobo.com/techblog/why-are-comments-important/' rel='bookmark' title='Why Are Comments Important?'>Why Are Comments Important?</a></li>
</ol></p><img src="http://feeds.feedburner.com/~r/LoboPraveen/blog/Technical/~4/YCqrTfBgGcs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://praveenlobo.com/techblog/comments-are-beautiful/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://praveenlobo.com/techblog/comments-are-beautiful/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=comments-are-beautiful</feedburner:origLink></item>
		<item>
		<title>WordPress: Moving Some Old Posts To A New Blog</title>
		<link>http://feedproxy.google.com/~r/LoboPraveen/blog/Technical/~3/md3bgfxMKuA/</link>
		<comments>http://praveenlobo.com/techblog/wordpress-moving-some-old-posts-to-a-new-blog/#comments</comments>
		<pubDate>Wed, 10 Aug 2011 05:16:33 +0000</pubDate>
		<dc:creator>Lobo</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[301]]></category>
		<category><![CDATA[404]]></category>
		<category><![CDATA[adsense]]></category>
		<category><![CDATA[analytics]]></category>
		<category><![CDATA[Categories]]></category>
		<category><![CDATA[checklist]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[export]]></category>
		<category><![CDATA[feedburner]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[import]]></category>
		<category><![CDATA[installation]]></category>
		<category><![CDATA[Media]]></category>
		<category><![CDATA[move]]></category>
		<category><![CDATA[new]]></category>
		<category><![CDATA[Permanent Redirect]]></category>
		<category><![CDATA[pipes]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[redirect]]></category>
		<category><![CDATA[RSS]]></category>
		<category><![CDATA[Subscription]]></category>
		<category><![CDATA[Tags]]></category>
		<category><![CDATA[todo]]></category>
		<category><![CDATA[yahoo]]></category>

		<guid isPermaLink="false">http://praveenlobo.com/techblog/?p=1806</guid>
		<description><![CDATA[I recently moved a bunch of blog posts to a new blog installation. This wasn&#8217;t necessary but just an exercise to learn what it takes to move the posts. It was easy after a lot of reading. Here is a &#8230; <a href="http://praveenlobo.com/techblog/wordpress-moving-some-old-posts-to-a-new-blog/">Continue reading <span class="meta-nav">&#8594;</span></a>
Related posts:<ol>
<li><a href='http://praveenlobo.com/techblog/how-to-remove-the-blog-slug-from-the-permalinksurl-in-wordpress-multisite-installation-without-a-plugin/' rel='bookmark' title='How To Remove The /blog/ slug From The Permalinks(URL) in WordPress Multisite Installation Without A Plugin'>How To Remove The /blog/ slug From The Permalinks(URL) in WordPress Multisite Installation Without A Plugin</a></li>
<li><a href='http://praveenlobo.com/techblog/working-on-the-blog/' rel='bookmark' title='Working on The Blog'>Working on The Blog</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I recently moved a bunch of blog posts to a new blog installation. This wasn&#8217;t necessary but just an exercise to learn what it takes to move the posts. It was easy after a lot of reading. Here is a checklist I prepared. Hope it helps someone looking for similar stuff. Comments and suggestions are welcome. Use it at your own risk!</p>
<hr />
<ol>
<li><strong>WordPress:</strong> Install WordPress.</li>
<li><strong>Plugins:</strong> Install necessary plugins. Enable all of them and set them up. Some plugins do provide an option to import/export settings. Export settings from old blog to a file and replace all occurrences of old blog URL to new blog if needed.</li>
<li><strong>Export Database:</strong> Using MyPHP Admin from CPanel export the all tables from old WordPress database except wp_options. (I&#8217;m not sure about other tables but this one gave me some problems when I imported). Also export the entire database for the new blog before next step so that you can clean it up by importing the new database SQL in case anything goes wrong.</li>
<li><strong>Import database:</strong> Replace all occurrences of old blog URL in the backup file and import the tables(basically run the SQL file). If you see anything amiss, try exporting and importing the tables excluded in previous step!</li>
<li><strong>Permanent Redirect:</strong> Once the old blog is gone, all links on the web pointing to the old blog posts will throw 404 error and will affect the site rankings. To avoid the side effect and to keep all traffic to the new blog, redirect the old URLs to new ones. This can be done via plugins. However, I noticed that the plugin needed me to keep the posts on old blog as well for it to work which I didn&#8217;t like. There were also other problems. So, I ended up adding 301(permanent) redirects in the .htaccess file.</li>
<li><strong>Check redirect:</strong> test a couple of old blog post links and see if 301 redirect works correct. </li>
<li><strong>Test new blog:</strong> go to new blog and just click on links and mess around a bit to make sure nothing is broken esp. the tags, categories and other meta stuff.</li>
<li><strong>Delete old blog post:</strong> Delete(move to trash) the old blog posts on the old blog. Don&#8217;t remove them completely yet; you can keep that task when you are sure everything is setup correctly.</li>
<li><strong>Update Tags and Categories:</strong> Go to the old blog and delete all tags and categories that were unique to the moved posts. Easiest way is to check if they have any posts associated with them. If there are none, just get rid of them. The new blog will have tags and categories from old blog due to import. Delete orphan tags and categories from new blog as well.</li>
<li><strong>Update other settings:</strong> if you are using custom search engines, AdSense, Analytics etc, make sure you update the settings on the new blog.</li>
<li><strong>Media:</strong> Move the media(such as images, videos, documents etc) to new blog. Since we did a replace all  on the SQL file, the image URLs will be pointing to the new blog.</li>
<li><strong>RSS:</strong> The most important task. Provide correct RSS. If you do not want your old blog RSS subscribers to get new blog RSS, you don&#8217;t need to do anything. If you want to provide old as well as new posts to the subscribers, you need some more settings. This is where services like FeedBurner are valuable. If you are using FeedBurner and want the original RSS to include both old and new blog posts, create a combined RSS feed using Yahoo Pipes. You can update the FeedBurner settings to include the Yahoo piped RSS so that RSS readers will continue to get all posts.<br />
Don&#8217;t fret if you are not using FeedBurner. You can create one now and redirect your old RSS link to FeedBurner&#8217;s link using htaccess. Once that is done, just use pipes as described above.  The Subscribe All option I provide uses Yahoo Pipes.</li>
</ol>
<hr />
Comments and suggestions are welcome.</p>
<div id="tweetbutton1806" class="tw_button" style="float:left;margin-right:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fwordpress-moving-some-old-posts-to-a-new-blog%2F%3FUA-20788457-1&amp;via=lobopraveen&amp;text=WordPress%3A%20Moving%20Some%20Old%20Posts%20To%20A%20New%20Blog&amp;related=&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fwordpress-moving-some-old-posts-to-a-new-blog%2F" class="twitter-share-button" rel="external nofollow"  style="width:55px;height:22px;background:transparent url('http://praveenlobo.com/techblog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>Related posts:<ol>
<li><a href='http://praveenlobo.com/techblog/how-to-remove-the-blog-slug-from-the-permalinksurl-in-wordpress-multisite-installation-without-a-plugin/' rel='bookmark' title='How To Remove The /blog/ slug From The Permalinks(URL) in WordPress Multisite Installation Without A Plugin'>How To Remove The /blog/ slug From The Permalinks(URL) in WordPress Multisite Installation Without A Plugin</a></li>
<li><a href='http://praveenlobo.com/techblog/working-on-the-blog/' rel='bookmark' title='Working on The Blog'>Working on The Blog</a></li>
</ol></p><img src="http://feeds.feedburner.com/~r/LoboPraveen/blog/Technical/~4/md3bgfxMKuA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://praveenlobo.com/techblog/wordpress-moving-some-old-posts-to-a-new-blog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://praveenlobo.com/techblog/wordpress-moving-some-old-posts-to-a-new-blog/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=wordpress-moving-some-old-posts-to-a-new-blog</feedburner:origLink></item>
		<item>
		<title>Why Are Comments Important?</title>
		<link>http://feedproxy.google.com/~r/LoboPraveen/blog/Technical/~3/GjkpnHy3f1s/</link>
		<comments>http://praveenlobo.com/techblog/why-are-comments-important/#comments</comments>
		<pubDate>Wed, 10 Aug 2011 03:04:53 +0000</pubDate>
		<dc:creator>Lobo</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[boring]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[comments]]></category>
		<category><![CDATA[it]]></category>
		<category><![CDATA[maintenance]]></category>
		<category><![CDATA[naked code]]></category>
		<category><![CDATA[support]]></category>
		<category><![CDATA[team]]></category>

		<guid isPermaLink="false">http://praveenlobo.com/techblog/?p=1996</guid>
		<description><![CDATA[Around three months ago: I was shocked looking at some newly added code in one of our applications. It was naked. Not a single line of comment whatsoever!! I asked the person who wrote it to explain the code and &#8230; <a href="http://praveenlobo.com/techblog/why-are-comments-important/">Continue reading <span class="meta-nav">&#8594;</span></a>
Related posts:<ol>
<li><a href='http://praveenlobo.com/techblog/comments-are-beautiful/' rel='bookmark' title='Comments are beautiful'>Comments are beautiful</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><strong>Around three months ago:</strong> I was shocked looking at some newly added code in one of our applications. It was naked. Not a single line of comment whatsoever!! I asked the person who wrote it to explain the code and it turned out that the code is indeed very cleverly written. I&#8217;d rate the code as top notch if only it had comments. When I demanded an explanation, it turned out that he thinks commenting is an utterly boring task. We had a small chat and after explaining how difficult it is to maintain the code without comments, he agreed to add comments, albeit reluctantly. I had a plan and saved a copy of the code.</p>
<p><strong>Back to present:</strong> The end users had an issue in the existing application and also had a change request to the functionality. It was to be assigned to the person who wrote it originally. I sat with him and pulled the copy of the code I had saved. He had trouble understanding the code and asked himself, &#8216;what am I doing here?&#8217;, a couple of times. He eventually figured it out and when we pulled the code with comments, he agreed that it was difficult without comments to figure out what was going on.</p>
<p>This is not a one off case. I&#8217;m sure this is the deal with most of the IT world. If it is difficult to understand your own code just after a couple of months, imagine what the life will be for another guy trying to support it after you are gone. Now, why are comments important?  </p>
<div id="tweetbutton1996" class="tw_button" style="float:left;margin-right:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fwhy-are-comments-important%2F%3FUA-20788457-1&amp;via=lobopraveen&amp;text=Why%20Are%20Comments%20Important%3F&amp;related=&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fwhy-are-comments-important%2F" class="twitter-share-button" rel="external nofollow"  style="width:55px;height:22px;background:transparent url('http://praveenlobo.com/techblog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>Related posts:<ol>
<li><a href='http://praveenlobo.com/techblog/comments-are-beautiful/' rel='bookmark' title='Comments are beautiful'>Comments are beautiful</a></li>
</ol></p><img src="http://feeds.feedburner.com/~r/LoboPraveen/blog/Technical/~4/GjkpnHy3f1s" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://praveenlobo.com/techblog/why-are-comments-important/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://praveenlobo.com/techblog/why-are-comments-important/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=why-are-comments-important</feedburner:origLink></item>
		<item>
		<title>Three Rules to Excel at Work</title>
		<link>http://feedproxy.google.com/~r/LoboPraveen/blog/Technical/~3/rP8gHPgMb-0/</link>
		<comments>http://praveenlobo.com/techblog/three-rules-to-excel-at-work/#comments</comments>
		<pubDate>Tue, 09 Aug 2011 04:23:03 +0000</pubDate>
		<dc:creator>Lobo</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[advise]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[rules]]></category>
		<category><![CDATA[senior]]></category>
		<category><![CDATA[success]]></category>
		<category><![CDATA[wise]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://praveenlobo.com/techblog/?p=1983</guid>
		<description><![CDATA[I think this is just as important as any technical stuff hence posting it here! :o) My day at work had just began, when I overheard a colleague of mine talking about rule number two. He is very senior to &#8230; <a href="http://praveenlobo.com/techblog/three-rules-to-excel-at-work/">Continue reading <span class="meta-nav">&#8594;</span></a>
No related posts.]]></description>
			<content:encoded><![CDATA[<p>I think this is just as important as any technical stuff hence posting it here! :o)</p>
<p>My day at work had just began, when I overheard a colleague of mine talking about rule number two. He is very senior to me and is dangerously intelligent! I couldn&#8217;t stop myself from asking him what the rule number two was.</p>
<p>&#8220;Hey, what is rule number two?&#8221;, I asked.<br />
&#8220;Well, do you know rule number one?&#8221;, he questioned.<br />
I replied, &#8220;Nope&#8221;, thinking why didn&#8217;t I ask about rule number one first!<br />
Wicked a smile he said, &#8220;Rule number one &#8211; <strong>know what the hell you are doing</strong>. Rule number two &#8211; <strong>if something goes wrong, always find someone else to blame</strong>.&#8221;<br />
Then walking towards his cubicle he announced, &#8220;and there&#8217;s a third rule, <strong>take all the credit</strong>.&#8221;</p>
<p>The smart man had proved himself again!<br />
<hr />
<div id="tweetbutton1983" class="tw_button" style="float:left;margin-right:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fthree-rules-to-excel-at-work%2F%3FUA-20788457-1&amp;via=lobopraveen&amp;text=Three%20Rules%20to%20Excel%20at%20Work&amp;related=&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fthree-rules-to-excel-at-work%2F" class="twitter-share-button" rel="external nofollow"  style="width:55px;height:22px;background:transparent url('http://praveenlobo.com/techblog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>No related posts.</p><img src="http://feeds.feedburner.com/~r/LoboPraveen/blog/Technical/~4/rP8gHPgMb-0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://praveenlobo.com/techblog/three-rules-to-excel-at-work/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://praveenlobo.com/techblog/three-rules-to-excel-at-work/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=three-rules-to-excel-at-work</feedburner:origLink></item>
		<item>
		<title>HTML SELECT/Dropdown with JavaScript/jQuery</title>
		<link>http://feedproxy.google.com/~r/LoboPraveen/blog/Technical/~3/W0e1gFvdz-E/</link>
		<comments>http://praveenlobo.com/techblog/html-selectdropdown-with-javascript-jquery/#comments</comments>
		<pubDate>Fri, 05 Aug 2011 03:54:08 +0000</pubDate>
		<dc:creator>Lobo</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[dropdown]]></category>
		<category><![CDATA[dynamic]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[index]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[new]]></category>
		<category><![CDATA[option]]></category>
		<category><![CDATA[remove]]></category>
		<category><![CDATA[reset]]></category>
		<category><![CDATA[select]]></category>
		<category><![CDATA[selectedIndex]]></category>
		<category><![CDATA[text]]></category>
		<category><![CDATA[value]]></category>

		<guid isPermaLink="false">http://praveenlobo.com/techblog/?p=1804</guid>
		<description><![CDATA[A list of commonly needed operations on HTML SELECT/Dropdown using JavaScript/jQuery. Let me know if you find it useful or if you have additions/suggestions to improve the list. JavaScript jQuery TweetRelated posts: How to scroll elements smoothly in JavaScript/jQuery without &#8230; <a href="http://praveenlobo.com/techblog/html-selectdropdown-with-javascript-jquery/">Continue reading <span class="meta-nav">&#8594;</span></a>
Related posts:<ol>
<li><a href='http://praveenlobo.com/techblog/how-to-scroll-elements-smoothly-in-javascript-jquery-without-plugins/' rel='bookmark' title='How to scroll elements smoothly in JavaScript/jQuery without plugins'>How to scroll elements smoothly in JavaScript/jQuery without plugins</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>A list of commonly needed operations on HTML SELECT/Dropdown using JavaScript/jQuery. Let me know if you find it useful or if you have additions/suggestions to improve the list.</p>
<h2>JavaScript</h2>
<pre class="brush: jscript; light: false; title: ; toolbar: true; notranslate">

// get the element
var dd =  document.getElementById(&quot;dropdown&quot;);

// Get the total number of options
dd.length;

// Get the index of selected option
dd.selectedIndex;

// get the value of selected option
dd.options[dd.selectedIndex].value;

// Get the selected option/text
dd.options[dd.selectedIndex].text;

// Reset the dropdoown option; select first option
dd.selectedIndex = 0;

// Reset the dropdoown option; select last option
dd.selectedIndex = dd.length-1;

// Create and attach an option dynamically
    var newOption = document.createElement('option');
    // create option/text
    newOption.text=&quot;new option&quot;;
    // create option value
    newOption.value=&quot;new value&quot;;
    // attach the option to the dropdown
    dd.options[dd.options.length] = newOption;  

// Create and attach an option dynamically
dd.options[dd.options.length] =
            new Option(&quot;new option&quot;,&quot;new value&quot;);

// Create and attach an option dynamically
dd.add(new Option(&quot;new option 2&quot;,&quot;new value 2&quot;));

// Remove all options from the dropdown
dd.length = 0;

// Remove all options from the dropdown
dd.options.length = 0;

// Remove the first option from the dropdown
dd.remove(0);

// Remove the last option from the dropdown
dd.remove(dd.options.length-1);

// Remove the last option from the dropdown
dd.remove(dd.length-1);

// Remove the dropdown/select element.
// ParentID must be an ID of the parent element.
document.getElementById(&quot;ParentID&quot;).removeChild(dd);
</pre>
<h2>jQuery</h2>
<pre class="brush: jscript; light: false; title: ; toolbar: true; notranslate">

// Reset the dropdoown option; select first option
$(&quot;#dropdown&quot;).prop(&quot;selectedIndex&quot;,0);

// Reset the options on all SELECT/Drodown elements.
$(&quot;select&quot;).each(function(){
    $(this).find(&quot;option:first&quot;).prop(&quot;selected&quot;,&quot;selected&quot;);
});  

// Reset the options on all SELECT/Drodown
// elements to last option
$(&quot;select&quot;).each(function(){
    $(this).val($(&quot;option:last&quot;,this).val());
});  

// Get the value of the selected option/text
$(&quot;#dropdown&quot;).val(); 

// Get the index of selected option
$(&quot;#dropdown&quot;).prop(&quot;selectedIndex&quot;);

//  Get the selected text
$(&quot;#dropdown option:selected&quot;).text();

// Get ALL text in the SELECT element; space separated
$(&quot;#dropdown&quot;).text();

// Select an option with value
// selects the option with value=&quot;value-2&quot;
$(&quot;#dropdown&quot;).val(&quot;value-2&quot;); 

// Add an option
$(&quot;#dropdown&quot;).append(&quot;&lt;OPTION value=\&quot;value-new\&quot;&gt;option-new&lt;/OPTION&gt;&quot;);

// Remove the last option from SELECT
$(&quot;#dropdown option:last&quot;).remove();

// Remove all options from SELECT
$(&quot;#dropdown option&quot;).remove()

// Remove the SELECT element from DOM
$(&quot;#dropdown&quot;).remove()
</pre>
<div id="tweetbutton1804" class="tw_button" style="float:left;margin-right:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fhtml-selectdropdown-with-javascript-jquery%2F%3FUA-20788457-1&amp;via=lobopraveen&amp;text=HTML%20SELECT%2FDropdown%20with%20JavaScript%2FjQuery&amp;related=&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fhtml-selectdropdown-with-javascript-jquery%2F" class="twitter-share-button" rel="external nofollow"  style="width:55px;height:22px;background:transparent url('http://praveenlobo.com/techblog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>Related posts:<ol>
<li><a href='http://praveenlobo.com/techblog/how-to-scroll-elements-smoothly-in-javascript-jquery-without-plugins/' rel='bookmark' title='How to scroll elements smoothly in JavaScript/jQuery without plugins'>How to scroll elements smoothly in JavaScript/jQuery without plugins</a></li>
</ol></p><img src="http://feeds.feedburner.com/~r/LoboPraveen/blog/Technical/~4/W0e1gFvdz-E" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://praveenlobo.com/techblog/html-selectdropdown-with-javascript-jquery/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://praveenlobo.com/techblog/html-selectdropdown-with-javascript-jquery/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=html-selectdropdown-with-javascript-jquery</feedburner:origLink></item>
		<item>
		<title>O_o: You have no “null” items says Google Reader</title>
		<link>http://feedproxy.google.com/~r/LoboPraveen/blog/Technical/~3/VaG3wRR6Eek/</link>
		<comments>http://praveenlobo.com/techblog/o_o-you-have-no-null-items-google-reader/#comments</comments>
		<pubDate>Wed, 03 Aug 2011 13:22:37 +0000</pubDate>
		<dc:creator>Lobo</dc:creator>
				<category><![CDATA[O_o code]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[error message]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[null]]></category>
		<category><![CDATA[reader]]></category>

		<guid isPermaLink="false">http://praveenlobo.com/techblog/?p=1919</guid>
		<description><![CDATA[I was browsing through my RSS subscriptions on Google Reader when it confirmed that I have no null items. TweetRelated posts: O_o: Never Return null For A Collection in Java
Related posts:<ol>
<li><a href='http://praveenlobo.com/techblog/o_o-never-return-null-for-a-collection-in-java/' rel='bookmark' title='O_o: Never Return null For A Collection in Java'>O_o: Never Return null For A Collection in Java</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I was browsing through my RSS subscriptions on Google Reader when it confirmed that I have no <strong><em>null</em></strong> items. </p>
<div class="wp-caption aligncenter" style="width: 510px"><a  href="http://praveenlobo.com/techblog/wp-content/uploads/2011/08/oops/Google Err Msg.jpg"><img class="colorbox-1919"  alt='Google Reader - "null" items'  title='Google Reader - "null" items' src="http://praveenlobo.com/techblog/wp-content/uploads/2011/08/oops/Google Err Msg.jpg" style="width:99%;"/></a><p class="wp-caption-text">Google Reader - "null" items</p></div>
<div id="tweetbutton1919" class="tw_button" style="float:left;margin-right:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fo_o-you-have-no-null-items-google-reader%2F%3FUA-20788457-1&amp;via=lobopraveen&amp;text=O_o%3A%20You%20have%20no%20%26%238220%3Bnull%26%238221%3B%20items%20says%20Google%20Reader&amp;related=&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fo_o-you-have-no-null-items-google-reader%2F" class="twitter-share-button" rel="external nofollow"  style="width:55px;height:22px;background:transparent url('http://praveenlobo.com/techblog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>Related posts:<ol>
<li><a href='http://praveenlobo.com/techblog/o_o-never-return-null-for-a-collection-in-java/' rel='bookmark' title='O_o: Never Return null For A Collection in Java'>O_o: Never Return null For A Collection in Java</a></li>
</ol></p><img src="http://feeds.feedburner.com/~r/LoboPraveen/blog/Technical/~4/VaG3wRR6Eek" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://praveenlobo.com/techblog/o_o-you-have-no-null-items-google-reader/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://praveenlobo.com/techblog/o_o-you-have-no-null-items-google-reader/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=o_o-you-have-no-null-items-google-reader</feedburner:origLink></item>
		<item>
		<title>Penny Auction Sites Auto Bidding Script(Sniper) – How To – Building and Using the script</title>
		<link>http://feedproxy.google.com/~r/LoboPraveen/blog/Technical/~3/NTa5zd3Rycg/</link>
		<comments>http://praveenlobo.com/techblog/penny-auction-sites-auto-bidding-scriptsniper-how-to-building-and-using-the-script/#comments</comments>
		<pubDate>Sat, 30 Jul 2011 23:24:11 +0000</pubDate>
		<dc:creator>Lobo</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[auto bidder]]></category>
		<category><![CDATA[automate]]></category>
		<category><![CDATA[bid sniper]]></category>
		<category><![CDATA[bidding]]></category>
		<category><![CDATA[bookmarklet]]></category>
		<category><![CDATA[bots]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[penny auction]]></category>
		<category><![CDATA[scam]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[snipe]]></category>

		<guid isPermaLink="false">http://praveenlobo.com/techblog/?p=1892</guid>
		<description><![CDATA[Part I and II of this post series can be found here and here respectively. Build the script: Assume that the HTML skeleton given in previous post is indeed the code and when the bid ends the timer gets a &#8230; <a href="http://praveenlobo.com/techblog/penny-auction-sites-auto-bidding-scriptsniper-how-to-building-and-using-the-script/">Continue reading <span class="meta-nav">&#8594;</span></a>
Related posts:<ol>
<li><a href='http://praveenlobo.com/techblog/penny-auction-sites-auto-bidding-scriptsniper-how-to-requirements-preparation/' rel='bookmark' title='Penny Auction Sites Auto Bidding Script(Sniper) &#8211; How To &#8211; Requirements &amp; Preparation'>Penny Auction Sites Auto Bidding Script(Sniper) &#8211; How To &#8211; Requirements &#038; Preparation</a></li>
<li><a href='http://praveenlobo.com/techblog/penny-auction-sites-auto-bidding-scriptbid-sniper-how-to-introduction/' rel='bookmark' title='Penny Auction Sites Auto Bidding Script(Bid Sniper) &#8211; How To &#8211; Introduction'>Penny Auction Sites Auto Bidding Script(Bid Sniper) &#8211; How To &#8211; Introduction</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Part I and II of this post series can be found <a href="http://praveenlobo.com/techblog/penny-auction-sites-auto-bidding-scriptbid-sniper-how-to-introduction/">here</a> and <a href="http://praveenlobo.com/techblog/penny-auction-sites-auto-bidding-scriptsniper-how-to-requirements-preparation/">here</a> respectively.</p>
<hr />
<ol start="5">
<li><strong>Build the script:</strong><br />
Assume that the HTML skeleton given in <a href="http://praveenlobo.com/techblog/penny-auction-sites-auto-bidding-scriptsniper-how-to-requirements-preparation/">previous post</a> is indeed the code and when the bid ends the timer gets a class called <span style="background:#FFFF99;">BIDEND</span>. Finally, say the code used by the site to place a bid is <span style="background:#FFFF99;">PennyAuction.placeBid(itemCode);</span>. With this information build a script.</p>
<pre class="brush: jscript; collapse: false; light: false; title: ; toolbar: true; notranslate">
// Get the codes from the user
// Note : If it's integer then parseInt method can be used around the prompt.
var itemCode = prompt(&quot;Please enter the item code:&quot;);
var lowPrice = parseInt(prompt(&quot;Please enter the price at which you want to start bidding:&quot;), 10);
var highPrice = parseInt(prompt(&quot;Please enter the price at which you want to stop bidding:&quot;), 10);
var maxBids = parseInt(prompt(&quot;Please enter the maximum number of bids you want to place:&quot;), 10);
var secondsToPlaceBid = parseInt(prompt(&quot;Please enter the remaining time below which a bid should be placed:&quot;), 10);

// Build the identifiers
var who = &quot;Winning_&quot; + itemCode;
var priceID = &quot;Price_&quot; + itemCode;
var timerID = &quot;Timer_&quot; + itemCode;

/*
 * This method places a bid if the item is in the price range if the timer goes below
 * &quot;secondsToPlaceBid&quot; and if the maximum number of bids has not been reached.
 *
 * Note that the &quot;BIDEND&quot; and the &quot;USERNAME&quot; needs to be updated for the site in question.
 *
*/
function placeBid() {
    if (document.getElementsByClassName(&quot;BIDEND&quot;).length == 1) {
        // The bid ended; stop bidding.
        return;
    }

    // Get the price; strip $ sign
    var currPrice = parseInt((document.getElementById(priceID).innerHTML.substring(1)),10);

    if (currPrice &lt;= lowPrice) {
        // Price limit not reached; wake up just in time for next bid
        setTimeout(&quot;placeBid()&quot;, 8000);
    }

    if (document.getElementById(who).innerHTML != &quot;USERNAME&quot;) {
        // You are not the current bidder

        if (maxBids == 0) {
            alert(&quot;All of the allocated bids have been placed!&quot;);
            return;
        }

        if (currPrice &gt; highPrice) {
            alert(&quot;Price of the item has exceeded the high price set!&quot;);
            return;
        }

        secondsRemaining = parseInt(document.getElementById(timerID).innerHTML.split(&quot;:&quot;)[2], 10);

        if (secondsRemaining &lt; secondsToPlaceBid) {
            // Time to place a bid; update counter &amp; wake up just in time for next bid
            PennyAuction.placeBid(itemCode);
            maxBids = (maxBids - 1);
            setTimeout(&quot;placeBid()&quot;, 8000);

        } else {
            // Enough time left; wake up later to try
            setTimeout(&quot;placeBid()&quot;, 500);
        }

    } else {
        // You are the current bidder; wake up just in time for next bid(if exists)
        setTimeout(&quot;placeBid()&quot;, 8000);
    }
}

// Call the method defined above to take care of the dirty business
placeBid();
</pre>
<p>This is it. This code should do the trick; Note that  &#8216;BIDEND&#8217;, &#8216;USERNAME&#8217; and <span style="background:#FFFF99;">PennyAuction.placeBid(itemCode);</span> needs to be updated with respect to the auction site in question.
</li>
<p></p>
<hr />
<li><strong>Using the script:</strong><br />
<ins datetime="2011-11-17T02:12:58+00:00"><em>update: Executing code from address bar as described below has been blocked in newer browsers. Please read one of the comments below for more info.</em></ins></p>
<p>Now that you have all the weapons, you should know how to use them. The above script can be saved as a bookmarklet and can be invoked on the auction site&#8217;s bidding page. Of course, you should update the above mentioned values before you do that. Or you can simply copy paste the updated script in the address bar of the browser. </p>
<p>To run the script from the address bar -</p>
<ol>
<li>Remove all comments. The lines starting with // </li>
<li>Remove all new line characters &#8211; the script should be in a single line. Some text editors allow Replacing newline character. Just perform a &#8216;Replace All&#8217; to replace <span style="background:#FFFF99;">\n</span> with nothing.</li>
<li>Append <span style="background:#FFFF99;">javascript:</span> in front of the script</li>
<li>Copy and paste the script line in the address bar and hit enter.</li>
</ol>
<p>&nbsp;</p>
<p>Just copy, paste the below line in the address bar of the browser and hit enter and see how it works -<br />
<code>javascript:var response = prompt('How is your day today?');alert('and you typed - ' + response);</code></p>
</li>
</ol>
<hr />
<p>That&#8217;s all. I hope it was helpful and you know how to build and use a snipe bot yourself now. <strong>I did try this on one of the famous bidding sites and it placed bids as it was designed to.</strong> However, I didn&#8217;t win because I had very less bids to place and exhausted all of it. Let me reiterate, this script or anything for that matter won&#8217;t guarantee winning. It all depends on the auction sites. <span style="background:#FFFF99;">They control the bidding with bots on the server side which keeps bidding until there is no one else to place a bid thus keeping the item as well as the price for bidding.</span> However, they do frequently give some items away to make it look legitimate and fool people into participating. I&#8217;m not guessing this. I&#8217;m convinced that this is what they do. Their business model doesn&#8217;t make sense otherwise!</p>
<p><ins datetime="2011-07-31T17:44:18+00:00">Edit: Don&#8217;t believe me? Take a look at what Joshua Stein found &#8211; <a target="_blank" rel="external nofollow" href="http://jcs.org/notaweblog/2009/03/06/trying_to_game_swoopo_com/">link</a>.</ins></p>
<p><strong>Use the information found here at your own risk. I shall not be held liable for any losses or damages – monetary or otherwise.</strong></p>
<div id="tweetbutton1892" class="tw_button" style="float:left;margin-right:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fpenny-auction-sites-auto-bidding-scriptsniper-how-to-building-and-using-the-script%2F%3FUA-20788457-1&amp;via=lobopraveen&amp;text=Penny%20Auction%20Sites%20Auto%20Bidding%20Script%28Sniper%29%20%26%238211%3B%20How%20To%20%26%238211%3B%20Building%20and%20Using%20the%20script&amp;related=&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fpenny-auction-sites-auto-bidding-scriptsniper-how-to-building-and-using-the-script%2F" class="twitter-share-button" rel="external nofollow"  style="width:55px;height:22px;background:transparent url('http://praveenlobo.com/techblog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>Related posts:<ol>
<li><a href='http://praveenlobo.com/techblog/penny-auction-sites-auto-bidding-scriptsniper-how-to-requirements-preparation/' rel='bookmark' title='Penny Auction Sites Auto Bidding Script(Sniper) &#8211; How To &#8211; Requirements &amp; Preparation'>Penny Auction Sites Auto Bidding Script(Sniper) &#8211; How To &#8211; Requirements &#038; Preparation</a></li>
<li><a href='http://praveenlobo.com/techblog/penny-auction-sites-auto-bidding-scriptbid-sniper-how-to-introduction/' rel='bookmark' title='Penny Auction Sites Auto Bidding Script(Bid Sniper) &#8211; How To &#8211; Introduction'>Penny Auction Sites Auto Bidding Script(Bid Sniper) &#8211; How To &#8211; Introduction</a></li>
</ol></p><img src="http://feeds.feedburner.com/~r/LoboPraveen/blog/Technical/~4/NTa5zd3Rycg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://praveenlobo.com/techblog/penny-auction-sites-auto-bidding-scriptsniper-how-to-building-and-using-the-script/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		<feedburner:origLink>http://praveenlobo.com/techblog/penny-auction-sites-auto-bidding-scriptsniper-how-to-building-and-using-the-script/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=penny-auction-sites-auto-bidding-scriptsniper-how-to-building-and-using-the-script</feedburner:origLink></item>
		<item>
		<title>Penny Auction Sites Auto Bidding Script(Sniper) – How To – Requirements &amp; Preparation</title>
		<link>http://feedproxy.google.com/~r/LoboPraveen/blog/Technical/~3/80b6RUjwuxQ/</link>
		<comments>http://praveenlobo.com/techblog/penny-auction-sites-auto-bidding-scriptsniper-how-to-requirements-preparation/#comments</comments>
		<pubDate>Sat, 30 Jul 2011 18:26:40 +0000</pubDate>
		<dc:creator>Lobo</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[auto bidder]]></category>
		<category><![CDATA[automate]]></category>
		<category><![CDATA[bid sniper]]></category>
		<category><![CDATA[bidding]]></category>
		<category><![CDATA[bots]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[penny auction]]></category>
		<category><![CDATA[scam]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[snipe]]></category>

		<guid isPermaLink="false">http://praveenlobo.com/techblog/?p=1864</guid>
		<description><![CDATA[Part I of this post series can be found here. Requirements for the script: The script shall have a lower limit to start bidding i.e. the script should not start bidding if the actual price in the bid hasn&#8217;t crossed &#8230; <a href="http://praveenlobo.com/techblog/penny-auction-sites-auto-bidding-scriptsniper-how-to-requirements-preparation/">Continue reading <span class="meta-nav">&#8594;</span></a>
Related posts:<ol>
<li><a href='http://praveenlobo.com/techblog/penny-auction-sites-auto-bidding-scriptbid-sniper-how-to-introduction/' rel='bookmark' title='Penny Auction Sites Auto Bidding Script(Bid Sniper) &#8211; How To &#8211; Introduction'>Penny Auction Sites Auto Bidding Script(Bid Sniper) &#8211; How To &#8211; Introduction</a></li>
<li><a href='http://praveenlobo.com/techblog/penny-auction-sites-auto-bidding-scriptsniper-how-to-building-and-using-the-script/' rel='bookmark' title='Penny Auction Sites Auto Bidding Script(Sniper) &#8211; How To &#8211; Building and Using the script'>Penny Auction Sites Auto Bidding Script(Sniper) &#8211; How To &#8211; Building and Using the script</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Part I of this post series can be found <a href="http://praveenlobo.com/techblog/penny-auction-sites-auto-bidding-scriptbid-sniper-how-to-introduction/">here</a>.<br />
<hr />
<ol start="3">
<li><strong>Requirements for the script:</strong>
<ol>
<li>The script shall have a lower limit to start bidding i.e. the script should not start bidding if the actual price in the bid hasn&#8217;t crossed a set limit.</li>
<li>The script shall have an upper limit to bidding i.e. it shall stop bidding if the bid price crosses certain limit.</li>
<li>The script shall bid a fixed number of times i.e. the script shall stop bidding if the total number bids placed by it exceeds a preset number even if the upper limit has not been reached.</li>
<li>The script shall place a bid only if the time to bid is less than a predetermined number of seconds.</li>
<li>The script shall not place a bid if the last bidder is self.</li>
<li>The script shall stop bidding if there is a winner.</li>
</ol>
</li>
<p></p>
<hr />
<li><strong>Preparation for the script:</strong><br />
This is a bit tricky because there is no one-script-works-on-all-auction-site solution. There would be one if only all penny auction sites are built by the same team and used same code. So, this is where the basic of HTML will come into play. Look up the code using inspect element and find out the following.</p>
<ol>
<li>Item identifier &#8211; there migh not be a seperate identifier for this. Some sites use a number for this and just append it to all other identifiers mentioned below.</li>
<li>Price  identifier.</li>
<li>Timer identifier.</li>
<li>Current winning bidder identifier.</li>
<li>Identifier or class used to denote the winner when the bid ends. This can be found when the bidding ends. Usually there will be a style(class) applied to the timer or winner DIV element. Just keep the Inspect Element window open and notice the change at the end of the bid.</li>
<li>Last but not least, find out how a bid is placed. This could be a bit tricky. Once you are logged in, inspect the bid button and find out how the bid is being placed. All sites use AJAX call so it must be through a JavaScript method call. </li>
</ol>
<p></p>
<p>The following is a bare-bone structure. The actual site&#8217;s code might have a lot more style/class and other elements in between.</p>
<pre class="brush: xml; collapse: false; light: false; title: ; toolbar: true; notranslate">
&lt;div id=&quot;MainBiddingDIV&quot;&gt;
    &lt;div id=&quot;Price_XXXX&quot;&gt;$0.01&lt;/div&gt;
    &lt;div id=&quot;Timer_XXXX&quot;&gt;00:00:22&lt;/div&gt;

    &lt;div id=&quot;CurrentWinningBidDIV&quot;&gt;
        &lt;img src=&quot;user_image.png&quot; id=&quot;UserImage&quot;&gt;
        &lt;div id=&quot;Winning_XXXX&quot;&gt;WinningBidderName&lt;/div&gt;
    &lt;/div&gt;

    &lt;div&gt;
        &lt;input type=&quot;button&quot;&gt;Place A Bid&lt;/a&gt;
        OR [ &lt;a href=&quot;&quot;&gt;Place a bid&lt;/a&gt; ]
    &lt;/div&gt;
&lt;/div&gt;
</pre>
<p>The above code doesn&#8217;t have styles assigned whereas the penny auction sites will definitely have classes assigned. The bidding button can be any element, just inspect element and find out what it is and what it does, which method it calls etc.
</li>
</ol>
<p>Building the script and using it in the <a href="http://praveenlobo.com/techblog/penny-auction-sites-auto-bidding-scriptsniper-how-to-building-and-using-the-script/">next post</a>. Enjoy.</p>
<div id="tweetbutton1864" class="tw_button" style="float:left;margin-right:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fpenny-auction-sites-auto-bidding-scriptsniper-how-to-requirements-preparation%2F%3FUA-20788457-1&amp;via=lobopraveen&amp;text=Penny%20Auction%20Sites%20Auto%20Bidding%20Script%28Sniper%29%20%26%238211%3B%20How%20To%20%26%238211%3B%20Requirements%20%26%23038%3B%20Preparation&amp;related=&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fpenny-auction-sites-auto-bidding-scriptsniper-how-to-requirements-preparation%2F" class="twitter-share-button" rel="external nofollow"  style="width:55px;height:22px;background:transparent url('http://praveenlobo.com/techblog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>Related posts:<ol>
<li><a href='http://praveenlobo.com/techblog/penny-auction-sites-auto-bidding-scriptbid-sniper-how-to-introduction/' rel='bookmark' title='Penny Auction Sites Auto Bidding Script(Bid Sniper) &#8211; How To &#8211; Introduction'>Penny Auction Sites Auto Bidding Script(Bid Sniper) &#8211; How To &#8211; Introduction</a></li>
<li><a href='http://praveenlobo.com/techblog/penny-auction-sites-auto-bidding-scriptsniper-how-to-building-and-using-the-script/' rel='bookmark' title='Penny Auction Sites Auto Bidding Script(Sniper) &#8211; How To &#8211; Building and Using the script'>Penny Auction Sites Auto Bidding Script(Sniper) &#8211; How To &#8211; Building and Using the script</a></li>
</ol></p><img src="http://feeds.feedburner.com/~r/LoboPraveen/blog/Technical/~4/80b6RUjwuxQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://praveenlobo.com/techblog/penny-auction-sites-auto-bidding-scriptsniper-how-to-requirements-preparation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://praveenlobo.com/techblog/penny-auction-sites-auto-bidding-scriptsniper-how-to-requirements-preparation/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=penny-auction-sites-auto-bidding-scriptsniper-how-to-requirements-preparation</feedburner:origLink></item>
		<item>
		<title>Penny Auction Sites Auto Bidding Script(Bid Sniper) – How To – Introduction</title>
		<link>http://feedproxy.google.com/~r/LoboPraveen/blog/Technical/~3/dQF1A-4spKU/</link>
		<comments>http://praveenlobo.com/techblog/penny-auction-sites-auto-bidding-scriptbid-sniper-how-to-introduction/#comments</comments>
		<pubDate>Wed, 27 Jul 2011 04:11:36 +0000</pubDate>
		<dc:creator>Lobo</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[auto bidder]]></category>
		<category><![CDATA[automate]]></category>
		<category><![CDATA[bid sniper]]></category>
		<category><![CDATA[bidding]]></category>
		<category><![CDATA[bots]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[penny auction]]></category>
		<category><![CDATA[scam]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[snipe]]></category>

		<guid isPermaLink="false">http://praveenlobo.com/techblog/?p=1833</guid>
		<description><![CDATA[I wrote a prologue to penny auction sites beginning of this year, but never posted the bot script I promised I would! I didn&#8217;t because I didn&#8217;t want others to lose money, but shouldn&#8217;t one use his own judgment before &#8230; <a href="http://praveenlobo.com/techblog/penny-auction-sites-auto-bidding-scriptbid-sniper-how-to-introduction/">Continue reading <span class="meta-nav">&#8594;</span></a>
Related posts:<ol>
<li><a href='http://praveenlobo.com/techblog/penny-auction-sites-auto-bidding-scriptsniper-how-to-requirements-preparation/' rel='bookmark' title='Penny Auction Sites Auto Bidding Script(Sniper) &#8211; How To &#8211; Requirements &amp; Preparation'>Penny Auction Sites Auto Bidding Script(Sniper) &#8211; How To &#8211; Requirements &#038; Preparation</a></li>
<li><a href='http://praveenlobo.com/techblog/penny-auction-sites-auto-bidding-scriptsniper-how-to-building-and-using-the-script/' rel='bookmark' title='Penny Auction Sites Auto Bidding Script(Sniper) &#8211; How To &#8211; Building and Using the script'>Penny Auction Sites Auto Bidding Script(Sniper) &#8211; How To &#8211; Building and Using the script</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I wrote a prologue to penny auction sites <a href="http://praveenlobo.com/blog/penny-auction-sites/">beginning of this year</a>, but never posted the bot script I promised I would! I didn&#8217;t because I didn&#8217;t want others to lose money, but shouldn&#8217;t one use his own judgment before using any advice found on the Internet? Before anything else I would like to warn readers. Use the information found here at your own risk. <strong>I shall not be held liable for any damage &#8211; monetary or otherwise</strong>. Also, this will not guarantee winning; the auction sites are built smart enough to <strong>cheat most users and pick winners rarely and randoml</strong>y!</p>
<p>I will explain the idea for automatically bidding on most penny auction sites on behalf of the user. I will also give an example script for a virtual auction site. At the end of this post series, one should be able to build a script on their own. I hope.  </p>
<hr />
<ol>
<li>Basics of HTML</li>
<li>How to dissect a web page</li>
<li>Requirements for the script</li>
<li>Preparation for the script</li>
<li>Build the script</li>
<li>Using the script</li>
</ol>
<p><ins datetime="2011-07-31T17:23:36+00:00">update &#8211; [ <a href="http://praveenlobo.com/techblog/penny-auction-sites-auto-bidding-scriptsniper-how-to-requirements-preparation/" title="Penny Auction Sites Auto Bidding Script(Sniper) – How To – Requirements &#038; Preparation">Part II</a> ] &#038; [ <a href="http://praveenlobo.com/techblog/penny-auction-sites-auto-bidding-scriptsniper-how-to-building-and-using-the-script/" title="Penny Auction Sites Auto Bidding Script(Sniper) – How To – Building and Using the script">Part III</a> ]</ins></p>
<hr />
<ol>
<li><strong>Basics of HTML</strong><br />
HTML basic are necessary to make this idea work. Google may be a good start. I will, however, explain the least basic thing needed. </p>
<p>HTML is a markup language used to build the websites. Each page on the website is made up of a number of different <strong>elements</strong> such as dropdowns, input text boxes, radio buttons, checkboxes, paragraphs of text etc. Each of these elements will be represented by a element tag in HTML. Dropdowns are &lt;SELECT&gt;; paragraphs are &lt;p&gt;; a group of elements in a container &#8211; called div &#8211; are &lt;DIV&gt;.</p>
<p>Each and every element in the mark up language can be given an identifier. This identifier can be used to fetch the element and it&#8217;s children using JavaScript.<br />
For e.g. a button is <span style="background:#FFFF99;">&lt;input type=&#8221;button&#8221; id=&#8221;btnID&#8221;&gt;</span> can be identified using <span style="background:#FFFF99;">document.getElementById(&#8220;btnID&#8221;)</span> in JavaScript or simply <span style="background:#FFFF99;">$(&#8220;#btnID&#8221;)</span> in jQuery. </p>
<p>Similarly there are methods and properties around these elements that can be used to read, write, manipulate the elements. For e.g. the following code will click the button using the script &#8211; <span style="background:#FFFF99;">document.getElementById(&#8220;btnID&#8221;).click() or $(&#8220;#btnID&#8221;).click()</span>.</p>
<p>Then, there are <strong>styles</strong>. Styles are used to decorate the elements on a web page. A text in big red font is a style; a underlined text is also through a style. These styles are usually placed in .css files, also called as style-sheets.</p>
<pre class="brush: jscript; collapse: false; light: false; title: ; toolbar: true; notranslate">
//a line in style sheet
.styleName {font-size:100px;}

// An element in web page
&lt;DIV id=&quot;divID&quot; class=&quot;styleName&quot;&gt;
    This is 100px text!
&lt;/DIV&gt;

// accessing it using JavaScript
document.getElementById(&quot;divID&quot;)
//OR
document.getElementsByClassName(&quot;styleName&quot;)
//OR
$(&quot;#divID&quot;)
//OR
$(&quot;.styleName&quot;)
</pre>
<p>These basics should help one in extracting the fields that show the bid timer, last bidder, item code, last bid amount elements and their identifiers. Why on earth would I write about them here in this how to? :-P</li>
<li ><strong>How to dissect a web page</strong>
<p>Once the basics of HTML are familiar, one need to know how to dissect the web pages at a very high level. This is needed so that one can get the elements, identifiers of the bidding site and build a bot to bid without any manual intervention. There are many ways of looking at the internals of the web pages. </p>
<p>Most basic will be to right click on the page and <strong>view page source</strong> and searching for the element using the text. This, however, is not the best that is available. <strong>FireBug</strong> can be used on the FireFox browser to get to the internals. Similarly, on Chromium browser, any element can be directly reached by right-clicking on the element and selecting <strong>Inspect Element</strong>. I&#8217;d suggest using Chromium browser because of it&#8217;s simplicity in this matter. Go right ahead and <em>Inspect Element</em> for the bid timer. See how the timer keeps changing in the source as well. Give particular emphasis on the element tags, the identifiers and the styles(class).</li>
</ol>
<p><ins datetime="2011-07-30T18:04:24+00:00"><a href="http://praveenlobo.com/techblog/penny-auction-sites-auto-bidding-scriptsniper-how-to-requirements-preparation/">more to follow&#8230;</a></ins></p>
<div id="tweetbutton1833" class="tw_button" style="float:left;margin-right:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fpenny-auction-sites-auto-bidding-scriptbid-sniper-how-to-introduction%2F%3FUA-20788457-1&amp;via=lobopraveen&amp;text=Penny%20Auction%20Sites%20Auto%20Bidding%20Script%28Bid%20Sniper%29%20%26%238211%3B%20How%20To%20%26%238211%3B%20Introduction&amp;related=&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fpenny-auction-sites-auto-bidding-scriptbid-sniper-how-to-introduction%2F" class="twitter-share-button" rel="external nofollow"  style="width:55px;height:22px;background:transparent url('http://praveenlobo.com/techblog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>Related posts:<ol>
<li><a href='http://praveenlobo.com/techblog/penny-auction-sites-auto-bidding-scriptsniper-how-to-requirements-preparation/' rel='bookmark' title='Penny Auction Sites Auto Bidding Script(Sniper) &#8211; How To &#8211; Requirements &amp; Preparation'>Penny Auction Sites Auto Bidding Script(Sniper) &#8211; How To &#8211; Requirements &#038; Preparation</a></li>
<li><a href='http://praveenlobo.com/techblog/penny-auction-sites-auto-bidding-scriptsniper-how-to-building-and-using-the-script/' rel='bookmark' title='Penny Auction Sites Auto Bidding Script(Sniper) &#8211; How To &#8211; Building and Using the script'>Penny Auction Sites Auto Bidding Script(Sniper) &#8211; How To &#8211; Building and Using the script</a></li>
</ol></p><img src="http://feeds.feedburner.com/~r/LoboPraveen/blog/Technical/~4/dQF1A-4spKU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://praveenlobo.com/techblog/penny-auction-sites-auto-bidding-scriptbid-sniper-how-to-introduction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://praveenlobo.com/techblog/penny-auction-sites-auto-bidding-scriptbid-sniper-how-to-introduction/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=penny-auction-sites-auto-bidding-scriptbid-sniper-how-to-introduction</feedburner:origLink></item>
		<item>
		<title>O_o: Better Logging To Solve Problems</title>
		<link>http://feedproxy.google.com/~r/LoboPraveen/blog/Technical/~3/YlJD6IzZfpU/</link>
		<comments>http://praveenlobo.com/techblog/o_o-better-logging-to-solve-problems/#comments</comments>
		<pubDate>Wed, 13 Jul 2011 03:52:23 +0000</pubDate>
		<dc:creator>Lobo</dc:creator>
				<category><![CDATA[O_o code]]></category>
		<category><![CDATA[failure]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://praveenlobo.com/techblog/?p=1802</guid>
		<description><![CDATA[Logging helps in pinpointing the code block that threw an error. Only if they are used correctly. During once such failure, a guy noticed that a script lacked logging and ever promptly promoted the updated script with better logging. A &#8230; <a href="http://praveenlobo.com/techblog/o_o-better-logging-to-solve-problems/">Continue reading <span class="meta-nav">&#8594;</span></a>
No related posts.]]></description>
			<content:encoded><![CDATA[<p>Logging helps in pinpointing the code block that threw an error. Only if they are used correctly. During once such failure, a guy noticed that a script lacked logging and ever promptly promoted the updated script with better logging. A part of the script is shown below.</p>
<p>Script before:
<pre class="brush: bash; collapse: false; light: false; title: ; toolbar: true; notranslate">
1&gt;&gt;${LOG} 2&gt;&gt;${ERRLOG} ${BINPATH}/${PROGRAMNAME}
if [ $? -ne 0 ]; then
  print &quot;ERROR: Something failed&quot;
  exit 101
fi
</pre>
<p>Script after:
<pre class="brush: bash; collapse: false; highlight: [2]; light: false; title: ; toolbar: true; notranslate">
1&gt;&gt;${LOG} 2&gt;&gt;${ERRLOG} ${BINPATH}/${PROGRAMNAME}
echo &quot;Program completed successfully.&quot;
if [ $? -ne 0 ]; then
  print &quot;ERROR: Something failed&quot;
  exit 101
fi
</pre>
<p>
<strong>Sure, it is a better script. It never failed again!</strong></p>
<div id="tweetbutton1802" class="tw_button" style="float:left;margin-right:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fo_o-better-logging-to-solve-problems%2F%3FUA-20788457-1&amp;via=lobopraveen&amp;text=O_o%3A%20Better%20Logging%20To%20Solve%20Problems&amp;related=&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fo_o-better-logging-to-solve-problems%2F" class="twitter-share-button" rel="external nofollow"  style="width:55px;height:22px;background:transparent url('http://praveenlobo.com/techblog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>No related posts.</p><img src="http://feeds.feedburner.com/~r/LoboPraveen/blog/Technical/~4/YlJD6IzZfpU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://praveenlobo.com/techblog/o_o-better-logging-to-solve-problems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://praveenlobo.com/techblog/o_o-better-logging-to-solve-problems/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=o_o-better-logging-to-solve-problems</feedburner:origLink></item>
		<item>
		<title>Why I choose to go against using WordPress Multisite?</title>
		<link>http://feedproxy.google.com/~r/LoboPraveen/blog/Technical/~3/9obYFmwktd4/</link>
		<comments>http://praveenlobo.com/techblog/why-i-choose-to-go-against-using-wordpress-multisite/#comments</comments>
		<pubDate>Sat, 09 Jul 2011 07:58:39 +0000</pubDate>
		<dc:creator>Lobo</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[advantages]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[disadvantages]]></category>
		<category><![CDATA[maintainability]]></category>
		<category><![CDATA[multisite]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://praveenlobo.com/techblog/?p=1793</guid>
		<description><![CDATA[When you start out with the WordPress, it&#8217;s common to assume that each blog needs a separate WordPress installation. But there&#8217;s a simpler way. WordPress Multisite installation. This lets one have different blogs with just one installation of WordPress. But, &#8230; <a href="http://praveenlobo.com/techblog/why-i-choose-to-go-against-using-wordpress-multisite/">Continue reading <span class="meta-nav">&#8594;</span></a>
Related posts:<ol>
<li><a href='http://praveenlobo.com/techblog/keeping-personal-and-technical-blogs-separate/' rel='bookmark' title='Keeping Personal and Technical Blogs Separate'>Keeping Personal and Technical Blogs Separate</a></li>
<li><a href='http://praveenlobo.com/techblog/keeping-personal-and-technical-blogs-separate-contd/' rel='bookmark' title='Keeping Personal and Technical Blogs Separate(Contd.)'>Keeping Personal and Technical Blogs Separate(Contd.)</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>When you start out with the WordPress, it&#8217;s common to assume that each blog needs a separate WordPress installation. But there&#8217;s a simpler way. WordPress Multisite installation. This lets one have different blogs with just one installation of WordPress. But, why did I choose not to use it? </p>
<h2>Advantges and Disadvantages of WordPress Multisite</h2>
<p><strong>Advantages</strong>:
<ol>
<li>The multisite blogs have all features of a regular blog with just one isntallation i.e only one database and one set of code-base. Easy to back-up all blogs.</li>
<li>Easy on maintainability &#8211; Since it uses only one database and one set of code-base, it&#8217;s easy to upgrade and apply patches. There is no need to update blogs individually.</li>
</ol>
<p><strong>Disadvantages</strong>:</p>
<ol>
<li>You break one thing/blog and entire network of blogs will come down.</li>
<li>Not all plugins support multisite installation.(most of the high rated plugins do.)</li>
<li>If you ever need to move one blog out to separate domain, it&#8217;s a pain in the neck process.</li>
<li>With WordPress multisite it is not possible install a blog in a directory and have another networked blog in a <a href="http://praveenlobo.com/techblog/multisite-wordpress-installation-on-sibling-directories-of-an-existing-single-installation/" title="Multisite WordPress Installation On Sibling Directories Of An Existing Single Installation">sibling directory</a>. If you don&#8217;t want to install WordPress in the root directory, it is not possible to have domain/blog and domain/techblog kind of setup.</li>
</ol>
<p>The last point was the nail in the coffin of WordPress multisite for me.    </p>
<div id="tweetbutton1793" class="tw_button" style="float:left;margin-right:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fwhy-i-choose-to-go-against-using-wordpress-multisite%2F%3FUA-20788457-1&amp;via=lobopraveen&amp;text=Why%20I%20choose%20to%20go%20against%20using%20WordPress%20Multisite%3F&amp;related=&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fwhy-i-choose-to-go-against-using-wordpress-multisite%2F" class="twitter-share-button" rel="external nofollow"  style="width:55px;height:22px;background:transparent url('http://praveenlobo.com/techblog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>Related posts:<ol>
<li><a href='http://praveenlobo.com/techblog/keeping-personal-and-technical-blogs-separate/' rel='bookmark' title='Keeping Personal and Technical Blogs Separate'>Keeping Personal and Technical Blogs Separate</a></li>
<li><a href='http://praveenlobo.com/techblog/keeping-personal-and-technical-blogs-separate-contd/' rel='bookmark' title='Keeping Personal and Technical Blogs Separate(Contd.)'>Keeping Personal and Technical Blogs Separate(Contd.)</a></li>
</ol></p><img src="http://feeds.feedburner.com/~r/LoboPraveen/blog/Technical/~4/9obYFmwktd4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://praveenlobo.com/techblog/why-i-choose-to-go-against-using-wordpress-multisite/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://praveenlobo.com/techblog/why-i-choose-to-go-against-using-wordpress-multisite/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=why-i-choose-to-go-against-using-wordpress-multisite</feedburner:origLink></item>
		<item>
		<title>JavaScript CountUp/CountDown Timer</title>
		<link>http://feedproxy.google.com/~r/LoboPraveen/blog/Technical/~3/6WY4J8EW7L0/</link>
		<comments>http://praveenlobo.com/techblog/javascript-countup-countdown-timer/#comments</comments>
		<pubDate>Mon, 27 Jun 2011 20:57:51 +0000</pubDate>
		<dc:creator>Lobo</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[count down]]></category>
		<category><![CDATA[count down timer]]></category>
		<category><![CDATA[count up]]></category>
		<category><![CDATA[count up timer]]></category>
		<category><![CDATA[counter]]></category>

		<guid isPermaLink="false">http://praveenlobo.com/techblog/?p=1762</guid>
		<description><![CDATA[This might be the last one in the JavaScript Counter posts unless I make all-in-one script or a jQuery plugin off of these scripts. This counter acts as a count down as well as count up timer. As soon as &#8230; <a href="http://praveenlobo.com/techblog/javascript-countup-countdown-timer/">Continue reading <span class="meta-nav">&#8594;</span></a>
Related posts:<ol>
<li><a href='http://praveenlobo.com/techblog/javascript-countdown-timer/' rel='bookmark' title='JavaScript CountDown Timer'>JavaScript CountDown Timer</a></li>
<li><a href='http://praveenlobo.com/techblog/javascript-countup-timer/' rel='bookmark' title='JavaScript CountUp Timer'>JavaScript CountUp Timer</a></li>
<li><a href='http://praveenlobo.com/techblog/javascript-countup-timer-comments-and-requests/' rel='bookmark' title='JavaScript CountUp Timer &#8211; Requests and Comments'>JavaScript CountUp Timer &#8211; Requests and Comments</a></li>
<li><a href='http://praveenlobo.com/techblog/javascript-counter-count-days-hours-minutes-seconds/' rel='bookmark' title='JavaScript Counter &#8211; Count Days Hours Minutes Seconds'>JavaScript Counter &#8211; Count Days Hours Minutes Seconds</a></li>
<li><a href='http://praveenlobo.com/techblog/javascript-counter-count-days/' rel='bookmark' title='Javascript Counter &#8211; Count Days'>Javascript Counter &#8211; Count Days</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><small><em>This might be the last one in the JavaScript Counter posts unless I make all-in-one script or a jQuery plugin off of these scripts.</em></small></p>
<p>This counter acts as a<strong> count down as well as count up</strong> timer. As soon as the count down goes to 0 i.e. the future date is hit, the counter turns into a count up timer and keeps going. This counter takes a date to count the time to, an ID to put the timer in. It is possible to have more than one timer on a page. <a href="http://praveenlobo.com/techblog/wp-content/uploads/2010/04/counters_demo.html">Demo page</a>.</p>
<p>Please do leave me a comment. Thanks!</p>
<div id="countupdown" style="background-color:#f7f7f7;border:2px dotted #adadad; text-align:center; padding:5px 0 5px 0;cursor:hand;">
<script src="/techblog/wp-content/uploads/2010/04/Counter.js" type="text/javascript"></script> <script type="text/javascript">// <![CDATA[
new Counter(((new Date()).getTime()+10000), 'countupdown')
// ]]&gt;</script></div>
<p>&nbsp;</p>
<pre class="brush: jscript; light: false; title: ; toolbar: true; notranslate">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en&quot; lang=&quot;en&quot;&gt;
&lt;head&gt;
&lt;title&gt;JavaScript CountUp/CountDown Timer - Praveen Lobo&lt;/title&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
/**********************************************************************************************
* CountUp/CountDown Timer script by Praveen Lobo
* (http://PraveenLobo.com/techblog/javascript-countup-countdown-timer/)
* This notice MUST stay intact(in both JS file and SCRIPT tag) for legal use.
* http://praveenlobo.com/blog/disclaimer/
**********************************************************************************************/
function Counter(initDate, id){
    this.counterDate = new Date(initDate);
    this.countainer = document.getElementById(id);
    this.numOfDays = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];
    this.borrowed = 0, this.years = 0, this.months = 0, this.days = 0;
    this.hours = 0, this.minutes = 0, this.seconds = 0;
    this.updateNumOfDays();
    this.updateCounter();
}

Counter.prototype.updateNumOfDays=function(){
    var dateNow = new Date();
    var currYear = dateNow.getFullYear();
    if ( (currYear % 4 == 0 &amp;&amp; currYear % 100 != 0 ) || currYear % 400 == 0 ) {
        this.numOfDays[1] = 29;
    }
    var self = this;
    setTimeout(function(){self.updateNumOfDays();}, (new Date((currYear+1), 1, 2) - dateNow));
}

Counter.prototype.datePartDiff=function(then, now, MAX){
    var diff = now - then - this.borrowed;
    this.borrowed = 0;
    if ( diff &gt; -1 ) return diff;
    this.borrowed = 1;
    return (MAX + diff);
}

Counter.prototype.calculate=function(){
    var futureDate = this.counterDate &gt; new Date()? this.counterDate : new Date();
    var pastDate = this.counterDate == futureDate? new Date() : this.counterDate;
    this.seconds = this.datePartDiff(pastDate.getSeconds(), futureDate.getSeconds(), 60);
    this.minutes = this.datePartDiff(pastDate.getMinutes(), futureDate.getMinutes(), 60);
    this.hours = this.datePartDiff(pastDate.getHours(), futureDate.getHours(), 24);
    this.days = this.datePartDiff(pastDate.getDate(), futureDate.getDate(), this.numOfDays[futureDate.getMonth()]);
    this.months = this.datePartDiff(pastDate.getMonth(), futureDate.getMonth(), 12);
    this.years = this.datePartDiff(pastDate.getFullYear(), futureDate.getFullYear(), 0);
}

Counter.prototype.addLeadingZero=function(value){
    return value &lt; 10 ? (&quot;0&quot; + value) : value;
}

Counter.prototype.formatTime=function(){
    this.seconds = this.addLeadingZero(this.seconds);
    this.minutes = this.addLeadingZero(this.minutes);
    this.hours = this.addLeadingZero(this.hours);
}

Counter.prototype.updateCounter=function(){
    this.calculate();
    this.formatTime();
    this.countainer.innerHTML =&quot;&lt;strong&gt;&quot; + this.years + &quot;&lt;/strong&gt; &quot; + (this.years == 1? &quot;year&quot; : &quot;years&quot;) +
        &quot; &lt;strong&gt;&quot; + this.months + &quot;&lt;/strong&gt; &quot; + (this.months == 1? &quot;month&quot; : &quot;months&quot;) +
        &quot; &lt;strong&gt;&quot; + this.days + &quot;&lt;/strong&gt; &quot; + (this.days == 1? &quot;day&quot; : &quot;days&quot;) +
        &quot; &lt;strong&gt;&quot; + this.hours + &quot;&lt;/strong&gt; &quot; + (this.hours == 1? &quot;hour&quot; : &quot;hours&quot;) +
        &quot; &lt;strong&gt;&quot; + this.minutes + &quot;&lt;/strong&gt; &quot; + (this.minutes == 1? &quot;minute&quot; : &quot;minutes&quot;) +
        &quot; &lt;strong&gt;&quot; + this.seconds + &quot;&lt;/strong&gt; &quot; + (this.seconds == 1? &quot;second&quot; : &quot;seconds&quot;);
    var self = this;
    setTimeout(function(){self.updateCounter();}, 1000);
}

window.onload=function(){ new Counter(((new Date()).getTime()+10000), 'counter'); }

&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;counter&quot;&gt;Contents of this DIV will be replaced by the timer&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<div id="tweetbutton1762" class="tw_button" style="float:left;margin-right:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fjavascript-countup-countdown-timer%2F%3FUA-20788457-1&amp;via=lobopraveen&amp;text=JavaScript%20CountUp%2FCountDown%20Timer&amp;related=&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fjavascript-countup-countdown-timer%2F" class="twitter-share-button" rel="external nofollow"  style="width:55px;height:22px;background:transparent url('http://praveenlobo.com/techblog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>Related posts:<ol>
<li><a href='http://praveenlobo.com/techblog/javascript-countdown-timer/' rel='bookmark' title='JavaScript CountDown Timer'>JavaScript CountDown Timer</a></li>
<li><a href='http://praveenlobo.com/techblog/javascript-countup-timer/' rel='bookmark' title='JavaScript CountUp Timer'>JavaScript CountUp Timer</a></li>
<li><a href='http://praveenlobo.com/techblog/javascript-countup-timer-comments-and-requests/' rel='bookmark' title='JavaScript CountUp Timer &#8211; Requests and Comments'>JavaScript CountUp Timer &#8211; Requests and Comments</a></li>
<li><a href='http://praveenlobo.com/techblog/javascript-counter-count-days-hours-minutes-seconds/' rel='bookmark' title='JavaScript Counter &#8211; Count Days Hours Minutes Seconds'>JavaScript Counter &#8211; Count Days Hours Minutes Seconds</a></li>
<li><a href='http://praveenlobo.com/techblog/javascript-counter-count-days/' rel='bookmark' title='Javascript Counter &#8211; Count Days'>Javascript Counter &#8211; Count Days</a></li>
</ol></p><img src="http://feeds.feedburner.com/~r/LoboPraveen/blog/Technical/~4/6WY4J8EW7L0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://praveenlobo.com/techblog/javascript-countup-countdown-timer/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		<feedburner:origLink>http://praveenlobo.com/techblog/javascript-countup-countdown-timer/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=javascript-countup-countdown-timer</feedburner:origLink></item>
		<item>
		<title>JavaScript CountDown Timer</title>
		<link>http://feedproxy.google.com/~r/LoboPraveen/blog/Technical/~3/FY64WnPHC28/</link>
		<comments>http://praveenlobo.com/techblog/javascript-countdown-timer/#comments</comments>
		<pubDate>Mon, 27 Jun 2011 06:44:13 +0000</pubDate>
		<dc:creator>Lobo</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[count down]]></category>
		<category><![CDATA[count down timer]]></category>
		<category><![CDATA[counter]]></category>
		<category><![CDATA[timer]]></category>

		<guid isPermaLink="false">http://praveenlobo.com/techblog/?p=1745</guid>
		<description><![CDATA[This counter takes a date to count the time to, an ID to put the timer in. It is possible to have more than one timer on a page. Demo page. As soon as the count down goes to 0 &#8230; <a href="http://praveenlobo.com/techblog/javascript-countdown-timer/">Continue reading <span class="meta-nav">&#8594;</span></a>
Related posts:<ol>
<li><a href='http://praveenlobo.com/techblog/javascript-countup-countdown-timer/' rel='bookmark' title='JavaScript CountUp/CountDown Timer'>JavaScript CountUp/CountDown Timer</a></li>
<li><a href='http://praveenlobo.com/techblog/javascript-countup-timer/' rel='bookmark' title='JavaScript CountUp Timer'>JavaScript CountUp Timer</a></li>
<li><a href='http://praveenlobo.com/techblog/javascript-countup-timer-comments-and-requests/' rel='bookmark' title='JavaScript CountUp Timer &#8211; Requests and Comments'>JavaScript CountUp Timer &#8211; Requests and Comments</a></li>
<li><a href='http://praveenlobo.com/techblog/javascript-counter-count-days-hours-minutes-seconds/' rel='bookmark' title='JavaScript Counter &#8211; Count Days Hours Minutes Seconds'>JavaScript Counter &#8211; Count Days Hours Minutes Seconds</a></li>
<li><a href='http://praveenlobo.com/techblog/javascript-counter-count-days/' rel='bookmark' title='Javascript Counter &#8211; Count Days'>Javascript Counter &#8211; Count Days</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>This counter takes a date to count the time to, an ID to put the timer in. It is possible to have more than one timer on a page. <a href="http://praveenlobo.com/techblog/wp-content/uploads/2010/04/counters_demo.html">Demo page</a>.</p>
<p>As soon as the count down goes to 0 i.e. the future date is hit, the counter stops at <strong>0 years 0 months 0 days 00 hours 00 minutes 00 seconds</strong></p>
<p>Please do leave me a comment. Thanks!</p>
<div id="countdown" style="background-color:#f7f7f7;border:2px dotted #adadad; text-align:center; padding:5px 0 5px 0;cursor:hand;">
<script src="/techblog/wp-content/uploads/2010/04/CountDown.js" type="text/javascript"></script> <script type="text/javascript">// <![CDATA[
new CountDown('January 01, 2100 00:00:00', 'countdown')
// ]]&gt;</script></div>
<p>&nbsp;</p>
<pre class="brush: jscript; light: false; title: ; toolbar: true; notranslate">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en&quot; lang=&quot;en&quot;&gt;
&lt;head&gt;
&lt;title&gt;JavaScript CountDown Timer - Praveen Lobo&lt;/title&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
/**********************************************************************************************
* CountDown Timer script by Praveen Lobo (http://PraveenLobo.com/techblog/javascript-CountDown-timer/)
* This notice MUST stay intact(in both JS file and SCRIPT tag) for legal use.
* http://praveenlobo.com/blog/disclaimer/
**********************************************************************************************/
function CountDown(initDate, id){
    this.endDate = new Date(initDate);
    this.countainer = document.getElementById(id);
    this.numOfDays = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];
    this.borrowed = 0, this.years = 0, this.months = 0, this.days = 0;
    this.hours = 0, this.minutes = 0, this.seconds = 0;
    this.updateNumOfDays();
    this.updateCounter();
}

CountDown.prototype.updateNumOfDays=function(){
    var dateNow = new Date();
    var currYear = dateNow.getFullYear();
    if ( (currYear % 4 == 0 &amp;&amp; currYear % 100 != 0 ) || currYear % 400 == 0 ) {
        this.numOfDays[1] = 29;
    }
    var self = this;
    setTimeout(function(){self.updateNumOfDays();}, (new Date((currYear+1), 1, 2) - dateNow));
}

CountDown.prototype.datePartDiff=function(then, now, MAX){
    var diff = now - then - this.borrowed;
    this.borrowed = 0;
    if ( diff &gt; -1 ) return diff;
    this.borrowed = 1;
    return (MAX + diff);
}

CountDown.prototype.calculate=function(){
    var futureDate = this.endDate;
    var currDate = new Date();
    this.seconds = this.datePartDiff(currDate.getSeconds(), futureDate.getSeconds(), 60);
    this.minutes = this.datePartDiff(currDate.getMinutes(), futureDate.getMinutes(), 60);
    this.hours = this.datePartDiff(currDate.getHours(), futureDate.getHours(), 24);
    this.days = this.datePartDiff(currDate.getDate(), futureDate.getDate(), this.numOfDays[futureDate.getMonth()]);
    this.months = this.datePartDiff(currDate.getMonth(), futureDate.getMonth(), 12);
    this.years = this.datePartDiff(currDate.getFullYear(), futureDate.getFullYear(),0);
}

CountDown.prototype.addLeadingZero=function(value){
    return value &lt; 10 ? (&quot;0&quot; + value) : value;
}

CountDown.prototype.formatTime=function(){
    this.seconds = this.addLeadingZero(this.seconds);
    this.minutes = this.addLeadingZero(this.minutes);
    this.hours = this.addLeadingZero(this.hours);
}

CountDown.prototype.updateCounter=function(){
    this.calculate();
    this.formatTime();
    this.countainer.innerHTML =&quot;&lt;strong&gt;&quot; + this.years + &quot;&lt;/strong&gt; &lt;small&gt;&quot; + (this.years == 1? &quot;year&quot; : &quot;years&quot;) + &quot;&lt;/small&gt;&quot; +
       &quot; &lt;strong&gt;&quot; + this.months + &quot;&lt;/strong&gt; &lt;small&gt;&quot; + (this.months == 1? &quot;month&quot; : &quot;months&quot;) + &quot;&lt;/small&gt;&quot; +
       &quot; &lt;strong&gt;&quot; + this.days + &quot;&lt;/strong&gt; &lt;small&gt;&quot; + (this.days == 1? &quot;day&quot; : &quot;days&quot;) + &quot;&lt;/small&gt;&quot; +
       &quot; &lt;strong&gt;&quot; + this.hours + &quot;&lt;/strong&gt; &lt;small&gt;&quot; + (this.hours == 1? &quot;hour&quot; : &quot;hours&quot;) + &quot;&lt;/small&gt;&quot; +
       &quot; &lt;strong&gt;&quot; + this.minutes + &quot;&lt;/strong&gt; &lt;small&gt;&quot; + (this.minutes == 1? &quot;minute&quot; : &quot;minutes&quot;) + &quot;&lt;/small&gt;&quot; +
       &quot; &lt;strong&gt;&quot; + this.seconds + &quot;&lt;/strong&gt; &lt;small&gt;&quot; + (this.seconds == 1? &quot;second&quot; : &quot;seconds&quot;) + &quot;&lt;/small&gt;&quot;;
    if ( this.endDate &gt; (new Date()) ) {
        var self = this;
        setTimeout(function(){self.updateCounter();}, 1000);
    }
}

window.onload=function(){ new CountDown('January 01, 2100 00:00:00', 'counter'); }

&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;counter&quot;&gt;Contents of this DIV will be replaced by Count Down&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<div id="tweetbutton1745" class="tw_button" style="float:left;margin-right:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fjavascript-countdown-timer%2F%3FUA-20788457-1&amp;via=lobopraveen&amp;text=JavaScript%20CountDown%20Timer&amp;related=&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fjavascript-countdown-timer%2F" class="twitter-share-button" rel="external nofollow"  style="width:55px;height:22px;background:transparent url('http://praveenlobo.com/techblog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>Related posts:<ol>
<li><a href='http://praveenlobo.com/techblog/javascript-countup-countdown-timer/' rel='bookmark' title='JavaScript CountUp/CountDown Timer'>JavaScript CountUp/CountDown Timer</a></li>
<li><a href='http://praveenlobo.com/techblog/javascript-countup-timer/' rel='bookmark' title='JavaScript CountUp Timer'>JavaScript CountUp Timer</a></li>
<li><a href='http://praveenlobo.com/techblog/javascript-countup-timer-comments-and-requests/' rel='bookmark' title='JavaScript CountUp Timer &#8211; Requests and Comments'>JavaScript CountUp Timer &#8211; Requests and Comments</a></li>
<li><a href='http://praveenlobo.com/techblog/javascript-counter-count-days-hours-minutes-seconds/' rel='bookmark' title='JavaScript Counter &#8211; Count Days Hours Minutes Seconds'>JavaScript Counter &#8211; Count Days Hours Minutes Seconds</a></li>
<li><a href='http://praveenlobo.com/techblog/javascript-counter-count-days/' rel='bookmark' title='Javascript Counter &#8211; Count Days'>Javascript Counter &#8211; Count Days</a></li>
</ol></p><img src="http://feeds.feedburner.com/~r/LoboPraveen/blog/Technical/~4/FY64WnPHC28" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://praveenlobo.com/techblog/javascript-countdown-timer/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://praveenlobo.com/techblog/javascript-countdown-timer/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=javascript-countdown-timer</feedburner:origLink></item>
		<item>
		<title>JavaScript Counter – Count Days Hours Minutes Seconds</title>
		<link>http://feedproxy.google.com/~r/LoboPraveen/blog/Technical/~3/yWrnB1iAIOY/</link>
		<comments>http://praveenlobo.com/techblog/javascript-counter-count-days-hours-minutes-seconds/#comments</comments>
		<pubDate>Mon, 27 Jun 2011 05:44:31 +0000</pubDate>
		<dc:creator>Lobo</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[count down]]></category>
		<category><![CDATA[count up]]></category>
		<category><![CDATA[counter]]></category>
		<category><![CDATA[days]]></category>
		<category><![CDATA[hours]]></category>
		<category><![CDATA[minutes]]></category>
		<category><![CDATA[seconds]]></category>
		<category><![CDATA[timer]]></category>

		<guid isPermaLink="false">http://praveenlobo.com/techblog/?p=1734</guid>
		<description><![CDATA[I keep getting requests and I can&#8217;t help but post another JavaScript related counter! As always, in case of any issues/doubts/suggestions or you just want to appreciate, feel free to leave a comment. Javascript Counter to Count Days Hours Minutes &#8230; <a href="http://praveenlobo.com/techblog/javascript-counter-count-days-hours-minutes-seconds/">Continue reading <span class="meta-nav">&#8594;</span></a>
Related posts:<ol>
<li><a href='http://praveenlobo.com/techblog/javascript-counter-count-days/' rel='bookmark' title='Javascript Counter &#8211; Count Days'>Javascript Counter &#8211; Count Days</a></li>
<li><a href='http://praveenlobo.com/techblog/javascript-countup-countdown-timer/' rel='bookmark' title='JavaScript CountUp/CountDown Timer'>JavaScript CountUp/CountDown Timer</a></li>
<li><a href='http://praveenlobo.com/techblog/javascript-countdown-timer/' rel='bookmark' title='JavaScript CountDown Timer'>JavaScript CountDown Timer</a></li>
<li><a href='http://praveenlobo.com/techblog/javascript-countup-timer-comments-and-requests/' rel='bookmark' title='JavaScript CountUp Timer &#8211; Requests and Comments'>JavaScript CountUp Timer &#8211; Requests and Comments</a></li>
<li><a href='http://praveenlobo.com/techblog/javascript-countup-timer/' rel='bookmark' title='JavaScript CountUp Timer'>JavaScript CountUp Timer</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I keep getting requests and I can&#8217;t help but post another JavaScript related counter! As always, in case of any issues/doubts/suggestions or you just want to appreciate, feel free to leave a comment.</p>
<hr/>
<h2>Javascript Counter to Count Days Hours Minutes Seconds &#8211; </h2>
<p>This script is very simple; it takes a date to count the time <strong>from/to</strong>, an ID to put the timer in. To be very precise, this counter shows the total number of 24 hours intervals between the date-time given and current date-time. It is also possible to have more than one timer on a page. <a href="http://praveenlobo.com/techblog/wp-content/uploads/2010/04/counters_demo.html">Demo page</a>.</p>
<p><strong>JavaScript Day, Hours, Minutes, Seconds Counter &#8211; This works with past as well as future days.</strong> If a future date is used, it acts as a countdown timer and when the date is reached it just rolls over and acts as a countup timer.</p>
<div id="countDHMS" style="background-color:#f7f7f7;border:2px dotted #adadad; text-align:center; padding:5px 0 5px 0;cursor:hand;">
<script src="/techblog/wp-content/uploads/2010/04/DaysHMSCounter.js" type="text/javascript"></script> <script type="text/javascript">// <![CDATA[
new DaysHMSCounter('January 01, 2000 00:00:00', 'countDHMS')
// ]]&gt;</script></div>
<p>&nbsp;</p>
<pre class="brush: jscript; light: false; title: ; toolbar: true; notranslate">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en&quot; lang=&quot;en&quot;&gt;
&lt;head&gt;
&lt;title&gt;JavaScript Days-Hours-Minutes-Seconds Counter - Praveen Lobo&lt;/title&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
/**********************************************************************************************
* Days-Hours-Minutes-Seconds Counter script by Praveen Lobo
* (http://PraveenLobo.com/techblog/javascript-counter-count-days-hours-minutes-seconds/)
* This notice MUST stay intact(in both JS file and SCRIPT tag) for legal use.
* http://praveenlobo.com/blog/disclaimer/
**********************************************************************************************/
function DaysHMSCounter(initDate, id){
    this.counterDate = new Date(initDate);
    this.container = document.getElementById(id);
    this.update();
}

DaysHMSCounter.prototype.calculateUnit=function(secDiff, unitSeconds){
    var tmp = Math.abs((tmp = secDiff/unitSeconds)) &lt; 1? 0 : tmp;
    return Math.abs(tmp &lt; 0 ? Math.ceil(tmp) : Math.floor(tmp));
}

DaysHMSCounter.prototype.calculate=function(){
    var secDiff = Math.abs(Math.round(((new Date()) - this.counterDate)/1000));
    this.days = this.calculateUnit(secDiff,86400);
    this.hours = this.calculateUnit((secDiff-(this.days*86400)),3600);
    this.mins = this.calculateUnit((secDiff-(this.days*86400)-(this.hours*3600)),60);
    this.secs = this.calculateUnit((secDiff-(this.days*86400)-(this.hours*3600)-(this.mins*60)),1);
}

DaysHMSCounter.prototype.update=function(){
    this.calculate();
    this.container.innerHTML =
        &quot; &lt;strong&gt;&quot; + this.days + &quot;&lt;/strong&gt; &quot; + (this.days == 1? &quot;day&quot; : &quot;days&quot;) +
        &quot; &lt;strong&gt;&quot; + this.hours + &quot;&lt;/strong&gt; &quot; + (this.hours == 1? &quot;hour&quot; : &quot;hours&quot;) +
        &quot; &lt;strong&gt;&quot; + this.mins + &quot;&lt;/strong&gt; &quot; + (this.mins == 1? &quot;min&quot; : &quot;mins&quot;) +
        &quot; &lt;strong&gt;&quot; + this.secs + &quot;&lt;/strong&gt; &quot; + (this.secs == 1? &quot;sec&quot; : &quot;secs&quot;);
    var self = this;
    setTimeout(function(){self.update();}, (1000));
}

window.onload=function(){ new DaysHMSCounter('January 01, 2000 00:00:00', 'counter'); }

&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;counter&quot;&gt;Contents of this DIV will be replaced by the timer&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<div id="tweetbutton1734" class="tw_button" style="float:left;margin-right:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fjavascript-counter-count-days-hours-minutes-seconds%2F%3FUA-20788457-1&amp;via=lobopraveen&amp;text=JavaScript%20Counter%20%26%238211%3B%20Count%20Days%20Hours%20Minutes%20Seconds&amp;related=&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fpraveenlobo.com%2Ftechblog%2Fjavascript-counter-count-days-hours-minutes-seconds%2F" class="twitter-share-button" rel="external nofollow"  style="width:55px;height:22px;background:transparent url('http://praveenlobo.com/techblog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>Related posts:<ol>
<li><a href='http://praveenlobo.com/techblog/javascript-counter-count-days/' rel='bookmark' title='Javascript Counter &#8211; Count Days'>Javascript Counter &#8211; Count Days</a></li>
<li><a href='http://praveenlobo.com/techblog/javascript-countup-countdown-timer/' rel='bookmark' title='JavaScript CountUp/CountDown Timer'>JavaScript CountUp/CountDown Timer</a></li>
<li><a href='http://praveenlobo.com/techblog/javascript-countdown-timer/' rel='bookmark' title='JavaScript CountDown Timer'>JavaScript CountDown Timer</a></li>
<li><a href='http://praveenlobo.com/techblog/javascript-countup-timer-comments-and-requests/' rel='bookmark' title='JavaScript CountUp Timer &#8211; Requests and Comments'>JavaScript CountUp Timer &#8211; Requests and Comments</a></li>
<li><a href='http://praveenlobo.com/techblog/javascript-countup-timer/' rel='bookmark' title='JavaScript CountUp Timer'>JavaScript CountUp Timer</a></li>
</ol></p><img src="http://feeds.feedburner.com/~r/LoboPraveen/blog/Technical/~4/yWrnB1iAIOY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://praveenlobo.com/techblog/javascript-counter-count-days-hours-minutes-seconds/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://praveenlobo.com/techblog/javascript-counter-count-days-hours-minutes-seconds/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=javascript-counter-count-days-hours-minutes-seconds</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 3.941 seconds. --><!-- Cached page generated by WP-Super-Cache on 2012-05-09 03:32:12 -->

