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

<channel>
	<title>MCODER, Swapnonil Mukherjee's Blog</title>
	<atom:link href="http://mcoder.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://mcoder.wordpress.com</link>
	<description>The Mechanical Coder.</description>
	<lastBuildDate>Wed, 11 Nov 2009 11:08:06 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='mcoder.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/e8cff075f55aeb8d69b32adeb046e747?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>MCODER, Swapnonil Mukherjee's Blog</title>
		<link>http://mcoder.wordpress.com</link>
	</image>
			<item>
		<title>BB Apps I downloaded from App World</title>
		<link>http://mcoder.wordpress.com/2009/11/11/bb-apps-for-india/</link>
		<comments>http://mcoder.wordpress.com/2009/11/11/bb-apps-for-india/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 11:04:16 +0000</pubDate>
		<dc:creator>Swapnonil Mukherjee</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[blackberry]]></category>
		<category><![CDATA[india]]></category>

		<guid isPermaLink="false">http://mcoder.wordpress.com/?p=189</guid>
		<description><![CDATA[Blackberry launched their App World in India a few a days ago, and so I went ahead and did a bit of look into.
First thing. Paid apps are not available. Only free apps. While this may be a good thing to draw more people in, there are a whole lot of users willing to spend [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcoder.wordpress.com&blog=747792&post=189&subd=mcoder&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Blackberry launched their App World in India a few a days ago, and so I went ahead and did a bit of look into.</p>
<p>First thing. Paid apps are not available. Only free apps. While this may be a good thing to draw more people in, there are a whole lot of users willing to spend money to buy some great paid apps. Allowing paid apps would have also given Indian Developers a platform to showcase their India Specific Blackberry apps.</p>
<p>Anyway, over to free apps.<br />
<span id="more-189"></span><br />
I downloaded quite a few of them and here&#8217;s a list of the must haves. </p>
<ol>
<li><strong>BEIKS Keyboard Locker.</strong> This locks your BB screen automatically after a certain interval. So no more pocket calls to people whose names begin with A! BEIKS is actually not a separate application, but just adds an option to the default Keyboard locker. To configure BEIKS go to Options&gt;Keyboard Locker from your home screen.</li>
<li><strong>Uber Twitter.</strong> The best twitter client as of now. Get it.</li>
<li><strong>Viigo. RSS News Reader.</strong> A RSS Reader for BB. It also integrates with Google Reader. So you can read all your Google Reader feeds from inside Viigo.</li>
<li><strong>Dictionary.</strong> Built by dictionary.com this adds a dictionary to BB. However note that it will connect to the internet to fetch the meanings of words. But a handy application for all occasions.</li>
<li><strong>Facebook.</strong> Built by RIM themselves this brings Facebook to BB. Quite a nice application. Much better than the application Nokia offers through it&#8217;s 5800 Express Music.</li>
<li><strong>Snaptu.</strong> Snaptu is really a collection of Widgets. You have widgets for facebook, twitter, cricinfo, EPL Scores. Here&#8217;s a screenshot.<br /><img src="http://farm3.static.flickr.com/2552/4095267482_c4454e8d29_o.jpg" alt="Snaptu" /></li>
<li><strong>Quick Pull Free.</strong> This one reboots the device and frees memory. Using it once a day should be enough to keep your BB fit and fine.</li>
</ol>
<p>All the above are in addition to the  apps <a href="http://mcoder.wordpress.com/2009/08/31/screenshots-of-my-favorite-blackberry-apps/">I have already mentioned in a previous blog post</a>.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mcoder.wordpress.com/189/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mcoder.wordpress.com/189/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mcoder.wordpress.com/189/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mcoder.wordpress.com/189/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mcoder.wordpress.com/189/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mcoder.wordpress.com/189/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mcoder.wordpress.com/189/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mcoder.wordpress.com/189/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mcoder.wordpress.com/189/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mcoder.wordpress.com/189/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcoder.wordpress.com&blog=747792&post=189&subd=mcoder&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mcoder.wordpress.com/2009/11/11/bb-apps-for-india/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fdeb5edecfbbb1c14de4d77161095c2b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">swapnonil</media:title>
		</media:content>

		<media:content url="http://farm3.static.flickr.com/2552/4095267482_c4454e8d29_o.jpg" medium="image">
			<media:title type="html">Snaptu</media:title>
		</media:content>
	</item>
		<item>
		<title>Decided to re-join Facebook</title>
		<link>http://mcoder.wordpress.com/2009/11/07/decided-to-re-join-facebook/</link>
		<comments>http://mcoder.wordpress.com/2009/11/07/decided-to-re-join-facebook/#comments</comments>
		<pubDate>Sat, 07 Nov 2009 12:25:02 +0000</pubDate>
		<dc:creator>Swapnonil Mukherjee</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[facebook]]></category>

		<guid isPermaLink="false">http://mcoder.wordpress.com/?p=182</guid>
		<description><![CDATA[I have written a lot about the negative aspects of Facebook over the past few weeks. My chief concerns were that

Facebook in the last few years have allowed in a lot of spoky and shoddy advertisers. Some of these are openly and brazenly duping a lot of people.
Facebook is sharing too much data about our [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcoder.wordpress.com&blog=747792&post=182&subd=mcoder&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I have written a lot about the negative aspects of Facebook over the past few weeks. My chief concerns were that</p>
<ol>
<li>Facebook in the last few years have allowed in a lot of spoky and shoddy advertisers. Some of these are openly and brazenly duping a lot of people.</li>
<li>Facebook is sharing too much data about our personal lives and the conversations that we have with our friends with it&#8217;s partners.</li>
<li>Facebook is closed. You can get your photos, videos and other stuff in, but will not be able to export them out of Facebook.</li>
</ol>
<p><span id="more-182"></span><br />
But while all of the above is true, I have decided to comeback. Why? I will give you 2 reasons.</p>
<ol>
<li>The alternatives to Facebook are dying. Orkut takes forever to load my scrapbook. Hi5 is designed to look like horse shit.</li>
<li>My friends are leaving Orkut, Hi5, MySpace in droves. A lot of these are like people I have known since we were 5 years old.</li>
</ol>
<p>So given Facebook still works reasonably well (it at least loads and works unlike Orkut) and that I am loosing touch my friends, makes me come back to Facebook.<br />
Of course, there is twitter. But a lot of my friends still don&#8217;t tweet at least not actively. For me twitter and Facebook complement each other. They don&#8217;t compete.</p>
<p>But I have a mission to accomplish this time around. I will test and develop a set of conduct guidelines for me and my friends. Our <a href="http://www.npr.org/templates/story/story.php?storyId=114187478">aim is to avoid this</a>. I will be publishing our Facebook conduct guidelines over the next few weeks that will try and solve or alleviate some of the privacy and data portability related problems that I have listed above.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mcoder.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mcoder.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mcoder.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mcoder.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mcoder.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mcoder.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mcoder.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mcoder.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mcoder.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mcoder.wordpress.com/182/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcoder.wordpress.com&blog=747792&post=182&subd=mcoder&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mcoder.wordpress.com/2009/11/07/decided-to-re-join-facebook/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fdeb5edecfbbb1c14de4d77161095c2b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">swapnonil</media:title>
		</media:content>
	</item>
		<item>
		<title>Some new eateries in Kolkata</title>
		<link>http://mcoder.wordpress.com/2009/11/06/some-new-eateries-in-kolkata/</link>
		<comments>http://mcoder.wordpress.com/2009/11/06/some-new-eateries-in-kolkata/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 14:32:58 +0000</pubDate>
		<dc:creator>Swapnonil Mukherjee</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Kolkata]]></category>

		<guid isPermaLink="false">http://mcoder.wordpress.com/?p=169</guid>
		<description><![CDATA[In the past few weeks, I have been to a few new eateries in Kolkata. While some where good others were, well not so good. The trend that I am seeing is that there is a definite leaning towards Indian Food. Kebabs are in and Chieeenich Chicken is out. Bengali isn&#8217;t doing well either.
Ok so [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcoder.wordpress.com&blog=747792&post=169&subd=mcoder&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>In the past few weeks, I have been to a few new eateries in Kolkata. While some where good others were, well not so good. The trend that I am seeing is that there is a definite leaning towards Indian Food. Kebabs are in and Chieeenich Chicken is out. Bengali isn&#8217;t doing well either.</p>
<p>Ok so here&#8217;s the first one, and do remember that these are generally all buffet lunches that we tried out<br />
<span id="more-169"></span></p>
<ol>
<li><strong>Sigree, at Silver Spring.</strong> Only two items in Starters, one a Chicken Kebab and the other a Mutton Kebab (This one was delicious). Main course was ok. The choice of items isn&#8217;t as varied as Flame and Grill but not as limited as Barbequeue Nation either. Food tastes good, but nothing special. Desert was ok, but not great either.There are again just 2 items in the desert. One thing about Sigree at Silver Spring is that parking space here is quite adequate unlike the mess that is Barbequeue Nation at Sector V. Overall a nice experience for Rs 300 per head.</li>
<li><strong>Five Rivers at Mani Square Mall.</strong> Heard a lot about this place and so had high expectations. Unfortunately I was left completely disappointed. We ordered Mutton Rogan Josh with some other Chicken curry. For a restaurant which says it serves authentic Punjabi and Kashmiri food the Rogan Josh was far from authentic. It was cooked in mustard oil and it definitely had onion or garlic in some form. Most Kashmiri food that I am aware of are cooked without garlic or onion, or am I wrong? The ambiance of the place is good, but the prices are too high for the quality they serve. A lunch for two will set you back by Rs 900-1200 at the very least. Take my advice, there&#8217;s a Flame and Grill just next door. Try that!</li>
<li><strong>Barbequeue Nation, Saltlake, Sector -V. </strong>They have upped their prices quite a bit since they started , but at 325+taxes its still a decent bargain for the quality they serve. I have been there a number of times, over lunch and dinner both and their level of service has always been bad. Their staff just don&#8217;t seem to be interested in doing anything. Having said that, if you can be patient, the food they serve isn&#8217;t bad at all. In fact the kebabs are plentiful and tastes good as well. Main course is ok, but not great. Ask them to serve roti, at your table. Their biryani tastes awful. Desert is really good with about 5 items to choose from.</li>
</ol>
<p>Of the 3 listed above, I would rank Sigree as the best. You can get in and get out easily. There&#8217;s ample parking space. Food isn&#8217;t fantastic but is definitely above average. The place isn&#8217;t over crowed, and therefore it&#8217;s pretty easy to find a quiet corner. Although we only tried the buffet, we were pleasantly surprised that they serve it on the table. So unlike Barbequeue Nation there&#8217;s no Ration Shop Line at the ice cream stand!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mcoder.wordpress.com/169/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mcoder.wordpress.com/169/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mcoder.wordpress.com/169/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mcoder.wordpress.com/169/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mcoder.wordpress.com/169/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mcoder.wordpress.com/169/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mcoder.wordpress.com/169/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mcoder.wordpress.com/169/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mcoder.wordpress.com/169/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mcoder.wordpress.com/169/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcoder.wordpress.com&blog=747792&post=169&subd=mcoder&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mcoder.wordpress.com/2009/11/06/some-new-eateries-in-kolkata/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fdeb5edecfbbb1c14de4d77161095c2b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">swapnonil</media:title>
		</media:content>
	</item>
		<item>
		<title>How to store passwords in Java</title>
		<link>http://mcoder.wordpress.com/2009/10/09/how-to-store-passwords-in-java/</link>
		<comments>http://mcoder.wordpress.com/2009/10/09/how-to-store-passwords-in-java/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 19:03:56 +0000</pubDate>
		<dc:creator>Swapnonil Mukherjee</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[bcrypt]]></category>
		<category><![CDATA[cryptography]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[md5]]></category>

		<guid isPermaLink="false">http://mcoder.wordpress.com/?p=157</guid>
		<description><![CDATA[There are two choices
Jasypt
Here are the cardinals rules of storing user passwords, and these not only apply to Java but to all other programming language as well.How to encrypt user passwords.Read this before going any further
To summarize, you must use an secure hashing algorithm which which allows for a random salt as an input, and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcoder.wordpress.com&blog=747792&post=157&subd=mcoder&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>There are two choices</p>
<h3>Jasypt</h3>
<p>Here are the cardinals rules of storing user passwords, and these not only apply to Java but to all other programming language as well.<a href="http://www.jasypt.org/howtoencryptuserpasswords.html">How to encrypt user passwords.</a>Read this before going any further</p>
<p>To summarize, you must use an secure hashing algorithm which which allows for a random salt as an input, and one which hashes the resultant output at least 1000 times.</p>
<p>The generic form of any secure hashing works like this.</p>
<p><strong>Generating a Hash</strong></p>
<pre class="brush: ruby;">
salt = GET salt
hash_bytes = algo(&quot;data to hash&quot;,salt,number of rounds)
hash_string = base64 ecnode(hash_bytes)
store(hash_string)
</pre>
<p><span id="more-157"></span><br />
You supply a salt using any random salt generator. The number of rounds must be more than 1000. This is to make brute force reversal computationly expensive. The algorithm therefore takes 3 parameters the data itself, the random salt, and number of rounds. The resulting hash is in bytes. The raw bytes however cannot be stored easily to databases. Therefore we convert it to a hexadecimal string which can be easily stored.</p>
<p><strong>Checking passwords</strong></p>
<pre class="brush: ruby;">
submitted_password = GET passwords
hash_bytes = algo(submitted_password,salt,number of rounds)
hash_string = base64 ecnode(hash_bytes)
stored_hash = GET stored hash
IF hash_string = stored_hash
	password is valid
</pre>
<p>Checking a password involves generating the hash again from the submitted password and then comparing the hash to the stored hash. The basic premise is that the same password, with the same salt and using the same number of rounds always generates the same hash.</p>
<p>However Jasypt makes all this super easy. It hides all that complexity. Here&#8217;s how you use it.</p>
<pre class="brush: java;">
import org.jasypt.util.password.*;

import java.util.*;

/**
 * @author $Author$
 * @version $Revision$
 *          Created on Oct 8, 2009-3:01:49 PM
 */
public class JasyptDemo
{
	private static final String username = &quot;testuser&quot;;
	private static final String userpass = &quot;testpass&quot;;
	private static LinkedHashMap&lt;String, String&gt; database = new LinkedHashMap&lt;String, String&gt;();

	public String encryptPassword()
	{
		StrongPasswordEncryptor passwordEncryptor = new StrongPasswordEncryptor();
		String encryptedPassword = passwordEncryptor.encryptPassword(userpass);
		storePasswordForUser(username, encryptedPassword);
		return encryptedPassword;
	}

	public boolean checkPassword(String username, String submittedPassword)
	{
		StrongPasswordEncryptor passwordEncryptor = new StrongPasswordEncryptor();
		String encryptedPassword = database.get(username);
		return passwordEncryptor.checkPassword(submittedPassword, encryptedPassword);
	}

	public void storePasswordForUser(String username, String hashedPassword)
	{
		// use jdbc to store the username and hashed password in the database.
		database.put(username, hashedPassword);
	}

	public String getPasswordForUser(String username)
	{
		// use jdbc to retrieve the password for this username,
		return database.get(username);
	}

	public static void main(String[] args)
	{
		JasyptDemo encrypter = new JasyptDemo();
		encrypter.encryptPassword();

		JasyptDemo checker = new JasyptDemo();
		System.out.println(&quot;Passwords Matched &quot; + (checker.checkPassword(username, userpass)));
	}
}
</pre>
<p>What Jasypt does is that it stores the salt inside the hash itself. This means there is no need to store the salt seprately. You just store the hashed password and retrieve it each time for comparision when the user supplies their login credentials. It can&#8217;t get easier than this.</p>
<h3>JBcrypt</h3>
<p>If you thought Jasypt was simple there something even simpler than this. It&#8217;s called <a href="http://www.mindrot.org/projects/jBCrypt/">JBcrypt</a>. JBcrypt is a Java implementation of OpenBSD&#8217;s Blowfish password hashing scheme. Here&#8217;s example of using JBcrypt.</p>
<pre class="brush: java;">
// Hash a password for the first time
String hashed = BCrypt.hashpw(password, BCrypt.gensalt());

// gensalt's log_rounds parameter determines the complexity
// the work factor is 2**log_rounds, and the default is 10
String hashed = BCrypt.hashpw(password, BCrypt.gensalt(12));

// Check that an unencrypted password matches one that has
// previously been hashed
if (BCrypt.checkpw(candidate, hashed))
	System.out.println(&quot;It matches&quot;);
else i
	System.out.println(&quot;It does not match&quot;);
</pre>
<h3>Comparision Between JBcrypt and Jasypt</h3>
<p><strong>Now comes the fun part. Which is more secure Jasypt or JBcrypt?</strong></p>
<p>Well, out of the box and both are as secure and may be as fast.  Bcrypt&#8217;s strengths and weaknesses are outlined in this paper <a href="http://www.openbsd.org/papers/bcrypt-paper.ps">&#8220;A Future-Adaptable Password Scheme&#8221;</a> by Niels Provos and David Mazières. On the other hand StrongPasswordEncryptor uses SHA-256 as it&#8217;s hashing algorithm. No you do a search of SHA256 VS Bcrypt and decide which to use. I am not suggesting anything.</p>
<p>Jasypt is also configurable. The ConfigurablePasswordEncryptor allows to you change the hashing algorithm. For example let&#8217;s use SHA-512. But since the JDK does not supply a SHA-512 hashing algorithm, you can use the setProvider(&#8220;provider name&#8221;) method of the ConfigurablePasswordEncryptor to set the JCE provider as <a href="http://www.bouncycastle.org/java.html">Bouncy Castle</a> which does support SHA-512.</p>
<p>Here&#8217;s how you use ConfigurablePasswordEncryptor with BouncyCastleProvider and SHA-512 as the hashing algorithm.</p>
<pre class="brush: java;">
import org.bouncycastle.jce.provider.*;
import org.jasypt.util.password.*;

import java.util.*;

/**
 * @author $Author$
 * @version $Revision$
 *          Created on Oct 8, 2009-3:01:49 PM
 */
public class JasyptDemo
{
	private static final String username = &quot;testuser&quot;;
	private static final String userpass = &quot;testpass&quot;;
	private static LinkedHashMap&lt;String, String&gt; database = new LinkedHashMap&lt;String, String&gt;();

	public String encryptPassword()
	{
		ConfigurablePasswordEncryptor passwordEncryptor = new ConfigurablePasswordEncryptor();
		passwordEncryptor.setProvider(new BouncyCastleProvider());
		passwordEncryptor.setAlgorithm(&quot;SHA-512&quot;);
		String encryptedPassword = passwordEncryptor.encryptPassword(userpass);
		storePasswordForUser(username, encryptedPassword);
		return encryptedPassword;
	}

	public boolean checkPassword(String username, String submittedPassword)
	{
		ConfigurablePasswordEncryptor passwordEncryptor = new ConfigurablePasswordEncryptor();
		passwordEncryptor.setProvider(new BouncyCastleProvider());
		passwordEncryptor.setAlgorithm(&quot;SHA-512&quot;);
		String encryptedPassword = database.get(username);
		return passwordEncryptor.checkPassword(submittedPassword, encryptedPassword);
	}

	public void storePasswordForUser(String username, String hashedPassword)
	{
		// use jdbc to store the username and hashed password in the database.
		database.put(username,hashedPassword);
	}

	public String getPasswordForUser(String username)
	{
		// use jdbc to retrieve the password for this username,
		return database.get(username);
	}

	public static void main(String[] args)
	{
		JasyptDemo encrypter = new JasyptDemo();
		encrypter.encryptPassword();

		JasyptDemo checker = new JasyptDemo();
		System.out.println(&quot;Passwords Matched &quot; + (checker.checkPassword(username, userpass)));
	}
}
</pre>
<p>Which one of Jasypt or JBcrypt do I use? I use JBcrypt, because it is just one Java File. However Jasypt is more than just one algorithm. It&#8217;s a complete framework. Just make sure that you don&#8217;t use the BasicPasswordEncryptor as this uses MD5 as it&#8217;s hashing algorithm. Use the StrongPasswordEncryptor class or the ConfigurablePasswordEncryptor class instead with SHA-512 as the hashing algorithm. Do also remember that SHA and MD5 type algorithms are fixed cost algorithms while Bcrypt is not.</p>
<h3>Summary</h3>
<p>Use JBcrypt.It only does one thing but does it right. Use Jasypt when you want to have a more fine grained control of the entire process.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mcoder.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mcoder.wordpress.com/157/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mcoder.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mcoder.wordpress.com/157/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mcoder.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mcoder.wordpress.com/157/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mcoder.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mcoder.wordpress.com/157/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mcoder.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mcoder.wordpress.com/157/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcoder.wordpress.com&blog=747792&post=157&subd=mcoder&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mcoder.wordpress.com/2009/10/09/how-to-store-passwords-in-java/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fdeb5edecfbbb1c14de4d77161095c2b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">swapnonil</media:title>
		</media:content>
	</item>
		<item>
		<title>Web Development 2.0</title>
		<link>http://mcoder.wordpress.com/2009/09/18/web-development-20/</link>
		<comments>http://mcoder.wordpress.com/2009/09/18/web-development-20/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 05:59:52 +0000</pubDate>
		<dc:creator>Swapnonil Mukherjee</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://mcoder.wordpress.com/?p=73</guid>
		<description><![CDATA[Traditional all purpose programming languages like Java, C# and PHP have long been the subject of flame wars in the web development community over these years. They have been backed by standard bodies, big corporations and in some cases millions of die hard fans.
The big corporations have inevitably build entire software development stacks around them. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcoder.wordpress.com&blog=747792&post=73&subd=mcoder&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Traditional all purpose programming languages like Java, C# and PHP have long been the subject of flame wars in the web development community over these years. They have been backed by standard bodies, big corporations and in some cases millions of die hard fans.</p>
<p>The big corporations have inevitably build entire software development stacks around them. Most notably there is Microsoft with its Windows, Sql Server, VB and .Net portfolio or IBM with its Java, Webshpere,DB2 combination. Sun, Oracle and Redhat also offer competing stacks. PHP on the other hand is thought to be a part of LAMP &#8220;the build your own stack&#8221; which SMEs and startups find so attractive.</p>
<p>The stacks themselves are like mousetraps. Once you get in  you will find it really difficult to get out. Of course if you chose standards such as J2EE, then shifting from say Oracle to IBM or to Redhat would still be possible.<br />
<span id="more-73"></span><br />
<strong>The Old Web Development Stack</strong></p>
<p>Fundamentally the main parts of a web development stack have been the following</p>
<ol>
<li>An Operating System</li>
<li>A Relational Database</li>
<li>A set of Developer tools consisting of SDKs, APIs and an Integrated Development Environment like Eclipse or Visual Studio.</li>
<li>Documentation, Tutorials and Commercial and/or Community support.</li>
</ol>
<p>Microsoft have got all of the above. Oracle (now with Sun)  and IBM apart from owning all of the above, can even provide you the required hardware if so you wish. Of course there are companies which are not full stack providers. Like Jetbrains or Adobe which produce kick-ass development tools but are not concerned about the rest.</p>
<p>All that however was the past. That was Web Development 1.0.</p>
<p><strong>The New Web Development Stack</strong></p>
<p>The emerging web development stack however is completely different. Sure it has everything that Web Development 1.0 had, but the way it is packaged and sold is entirely different.</p>
<p>Let me give you a concrete example. Google. Now Google also sells a web development stack but in a different way.<br />
They want you to build Web Applications using their tools and would also like to host them for you. If you are  poor they will even host it for free <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Their stack consists of the following.</p>
<ol>
<li>Google Web Toolkit or GWT. GWT allows you to build data entry oriented Web Applications at a fairly fast pace. Please remember  data entry and workflow oriented software comprise of bulk of enterprise software in use today. Google of course wants us to stop building fat clients like Powerbuilder or VB Apps and replace them with Web Oriented ones.</li>
<li>Google App Engine. With it&#8217;s Java and Python runtime, what we have here is fast maturing Enterprise SDK. There is persistence through JPA or JDO, messaging with XMPP and caching through Memcache.</li>
<li>Google Android. While the success of Android still hinges on the quality of handsets and eventual carrier response, there&#8217;s no denying that Android is an exceptional piece of Engineering. With their Dalvik VM Google have managed to attract hordes of Java developers, while at the same time avoid some of the limitations of J2ME.</li>
<li>And to finally complete the Jigsaw, all development tools are built on Eclipse and are provided for free.</li>
</ol>
<p>It&#8217;s not just Google, Salesforce, Amazon, IBM are all more or less doing same things. Curiously though Salesforce has gone and created their own programming language named Apex. Will Google respond?</p>
<p>So there you are. The new web development stack does not look fundamentally different from the older one, but here are the key differences.</p>
<ol>
<li>Platform Independence: It&#8217;s no longer important where you write your code. You can write GWT code on the Mac using Eclipse and deploy it on the App Engine. For Web Development 2.0 the OS does not matter anymore. The sooner Microsoft and Apple realize this, the better it would be for them.</li>
<li>Database: In web development 1.0 the code we wrote to read write data was always limited by the features provided by the database and limitations imposed by SQL. With the new stack, one is no longer limited to the Relational Model. There&#8217;s Hadoop+HBase, Big Table, Amazon S3+SimpleDB, Cassandra and many more who offer different options. And yes, have you heard of the <a href="http://www.eflorenzano.com/blog/post/my-thoughts-nosql/">NoSQL movement</a>?</li>
<li>Pay as you grow: Pioneered by Amazon, this model does not force you to pay upfront fees to web hosts. It does lower the entry barrier considerably. With Google one can host for free up to a limit.</li>
<li>Mobile Apps:Having a mobile presence with a customized application and user experience for Android,iPhone and the Blackberry is no longer a luxury. It&#8217;s a must.</li>
<li>Development Tools:A new development stack requires a new set of development tools. Aptana Javascript Studio is a step in the right direction. GWT plugins for Eclipse are also OK. But we need more of those. Plain Old Ides are passé.</li>
</ol>
<p>I expect the landscape to evolve over the next few years. There are companies like Amazon who have built massive cloud infrastructures but don&#8217;t have mature development tools. Other like Google have good development tools but don&#8217;t have nearly the kind of market share like Amazon.</p>
<p>It is going to be an interesting journey.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mcoder.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mcoder.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mcoder.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mcoder.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mcoder.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mcoder.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mcoder.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mcoder.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mcoder.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mcoder.wordpress.com/73/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcoder.wordpress.com&blog=747792&post=73&subd=mcoder&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mcoder.wordpress.com/2009/09/18/web-development-20/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fdeb5edecfbbb1c14de4d77161095c2b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">swapnonil</media:title>
		</media:content>
	</item>
		<item>
		<title>Cattle Class; What really happened?</title>
		<link>http://mcoder.wordpress.com/2009/09/17/cattle-class-what-really-happened/</link>
		<comments>http://mcoder.wordpress.com/2009/09/17/cattle-class-what-really-happened/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 09:15:04 +0000</pubDate>
		<dc:creator>Swapnonil Mukherjee</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://mcoder.wordpress.com/?p=122</guid>
		<description><![CDATA[Here&#8217;s what really happened with regards to Shashi Tharoor&#8217;s comment on travelling cattle class.
Tweet Post 1
Kanchan Gupta a Delhi based journalist asks this innocent looking question to Sashi Tharoor

Tweet Post 2
To this, Sashi Tharoor gave a typical Tongue-in-cheek answer, which I must say he does often. In fact it is this sense of humor that [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcoder.wordpress.com&blog=747792&post=122&subd=mcoder&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Here&#8217;s what really happened with regards to Shashi Tharoor&#8217;s comment on travelling cattle class.</p>
<p><strong>Tweet Post 1</strong><br />
Kanchan Gupta a Delhi based journalist asks this innocent looking question to Sashi Tharoor</p>
<p><img class="aligncenter size-full wp-image-123" title="Kanchan Gupta's Question" src="http://mcoder.files.wordpress.com/2009/09/kgimg1.png?w=546&#038;h=60" alt="Kanchan Gupta's Question" width="546" height="60" /></p>
<p><strong>Tweet Post 2</strong><br />
To this, Sashi Tharoor gave a typical <a href="http://en.wikipedia.org/wiki/Tongue-in-cheek">Tongue-in-cheek</a> answer, which I must say he does often. In fact it is this sense of humor that makes him one of the most followed Indians on Twitter.</p>
<p><img class="aligncenter size-full wp-image-124" title="Sashi Tharoor's Answer" src="http://mcoder.files.wordpress.com/2009/09/stimg1.png?w=522&#038;h=58" alt="Sashi Tharoor's Answer" width="522" height="58" /><br />
<span id="more-122"></span><br />
<strong>Tweet Posts 3</strong><br />
After this answer Kanchan Gupta continues to ask questions to Sashi Tharror about the state of affairs in his ministry.</p>
<p><img src="http://mcoder.files.wordpress.com/2009/09/rest1.png?w=491&#038;h=66" alt="rest1" title="rest1" width="491" height="66" class="aligncenter size-full wp-image-128" /><br />
<img src="http://mcoder.files.wordpress.com/2009/09/rest2.png?w=491&#038;h=70" alt="rest2" title="rest2" width="491" height="70" class="aligncenter size-full wp-image-129" /><br />
<img src="http://mcoder.files.wordpress.com/2009/09/rest3.png?w=491&#038;h=71" alt="rest3" title="rest3" width="491" height="71" class="aligncenter size-full wp-image-130" /><br />
<img src="http://mcoder.files.wordpress.com/2009/09/rest4.png?w=491&#038;h=80" alt="rest4" title="rest4" width="491" height="80" class="aligncenter size-full wp-image-131" /></p>
<p>My interpretation of how the events unfolded is; that Kanchan was either intentionally or un intentionally trying to wind up the Minister regarding over spending and the lack of accountability in his Ministry, which of course could be true or entirely fabricated.<br />
The Minister unfortunately fell for this bait, and hence the &#8220;Tweet Back&#8221;.</p>
<p>Our media, corrupt and ignorant as they are interpreted the entire chain of events differently. They virtually instigated the Congress party into this reaction.</p>
<p><a href="http://timesofindia.indiatimes.com/news/india/Cong-slams-Tharoors-twits-on-cattle-class/articleshow/5020004.cms">http://timesofindia.indiatimes.com/news/india/Cong-slams-Tharoors-twits-on-cattle-class/articleshow/5020004.cms</a></p>
<p>What do you think? Is my interpretation wrong?</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mcoder.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mcoder.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mcoder.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mcoder.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mcoder.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mcoder.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mcoder.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mcoder.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mcoder.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mcoder.wordpress.com/122/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcoder.wordpress.com&blog=747792&post=122&subd=mcoder&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mcoder.wordpress.com/2009/09/17/cattle-class-what-really-happened/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fdeb5edecfbbb1c14de4d77161095c2b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">swapnonil</media:title>
		</media:content>

		<media:content url="http://mcoder.files.wordpress.com/2009/09/kgimg1.png" medium="image">
			<media:title type="html">Kanchan Gupta's Question</media:title>
		</media:content>

		<media:content url="http://mcoder.files.wordpress.com/2009/09/stimg1.png" medium="image">
			<media:title type="html">Sashi Tharoor's Answer</media:title>
		</media:content>

		<media:content url="http://mcoder.files.wordpress.com/2009/09/rest1.png" medium="image">
			<media:title type="html">rest1</media:title>
		</media:content>

		<media:content url="http://mcoder.files.wordpress.com/2009/09/rest2.png" medium="image">
			<media:title type="html">rest2</media:title>
		</media:content>

		<media:content url="http://mcoder.files.wordpress.com/2009/09/rest3.png" medium="image">
			<media:title type="html">rest3</media:title>
		</media:content>

		<media:content url="http://mcoder.files.wordpress.com/2009/09/rest4.png" medium="image">
			<media:title type="html">rest4</media:title>
		</media:content>
	</item>
		<item>
		<title>4 Reasons why Chrome could be ready for Mac and Linux</title>
		<link>http://mcoder.wordpress.com/2009/09/07/4-reasons-why-chrome-could-be-ready-for-mac-and-linux/</link>
		<comments>http://mcoder.wordpress.com/2009/09/07/4-reasons-why-chrome-could-be-ready-for-mac-and-linux/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 17:06:21 +0000</pubDate>
		<dc:creator>Swapnonil Mukherjee</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[chrome]]></category>

		<guid isPermaLink="false">http://mcoder.wordpress.com/?p=112</guid>
		<description><![CDATA[Now here&#8217;s what people have been waiting to hear for a long time.
Google Chrome may be ready for both Linux and Mac. How do I know? Well it&#8217;s a guess based on these facts.

Flash Integration.Having used Chromium with Flash enabled on both Linux and Mac, I can report to you that it is very stable. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcoder.wordpress.com&blog=747792&post=112&subd=mcoder&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Now here&#8217;s what people have been waiting to hear for a long time.</p>
<p>Google Chrome may be ready for both Linux and Mac. How do I know? Well it&#8217;s a guess based on these facts.</p>
<ol>
<li>Flash Integration.Having used Chromium with Flash enabled on both Linux and Mac, I can report to you that it is very stable. You can start stop videos, play Flash based arcade games and so on. There were those pesky scroll problems on pages which had flash movies embedded in them, but those are now gone. Pages scroll like a hot knife through butter now. I haven&#8217;t had any crashes due to Flash in quite some time now.</li>
<p></p>
<li>Chrome&#8217;s Privacy policy changes as reported by <a href="http://www.readwriteweb.com/archives/google_chrome_privacy_policy_changes_hint_at_public_launch_of_mac_linux_versions.php">Read Write Web.</a></li>
<p></p>
<li>There hasn&#8217;t been a update for Chromium for Ubuntu for about 6 days now. Why is that important? Well prior to this, there was a new version of Chromium for Ubuntu available everyday. This has now stopped.</li>
<p></p>
<li>The &#8220;Options&#8221; dialog has no more ToDos left To Be Done.</li>
</ol>
<p>Having said all of the above, there is still no Java Integration. Would they be releasing this without Java support? I don&#8217;t think so.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mcoder.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mcoder.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mcoder.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mcoder.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mcoder.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mcoder.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mcoder.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mcoder.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mcoder.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mcoder.wordpress.com/112/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcoder.wordpress.com&blog=747792&post=112&subd=mcoder&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mcoder.wordpress.com/2009/09/07/4-reasons-why-chrome-could-be-ready-for-mac-and-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fdeb5edecfbbb1c14de4d77161095c2b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">swapnonil</media:title>
		</media:content>
	</item>
		<item>
		<title>Building a very simple version of Google Analytics.</title>
		<link>http://mcoder.wordpress.com/2009/08/31/very-simple-version-of-google-analytics/</link>
		<comments>http://mcoder.wordpress.com/2009/08/31/very-simple-version-of-google-analytics/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 11:37:12 +0000</pubDate>
		<dc:creator>Swapnonil Mukherjee</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[browsers]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://mcoder.wordpress.com/2009/08/31/the-browser-property-user-agent-is-a/</guid>
		<description><![CDATA[Let me tell you what I am trying to do. I am trying to build a simple version of Google Analytics that will tell me the following
Must Have

The browser and the version of the browser an user is using.
The Operating System and if possible the version of the OS they are using.
The screen resolution.
The plugins [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcoder.wordpress.com&blog=747792&post=95&subd=mcoder&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Let me tell you what I am trying to do. I am trying to build a simple version of Google Analytics that will tell me the following</p>
<p>Must Have</p>
<ol>
<li>The browser and the version of the browser an user is using.</li>
<li>The Operating System and if possible the version of the OS they are using.</li>
<li>The screen resolution.</li>
<li>The plugins their browser supports. (Whether it is Java and Flash enabled or not)</li>
<li>The IP (user or proxy) from which the request was made.</li>
</ol>
<p>Nice to Have</p>
<ol>
<li>The time at which a page was requested.</li>
<li>The total time spent by the user on a particular page.</li>
<li>Total number of clicks on each out going link.</li>
</ol>
<p>I have spent almost my entire day today addressing the first 2 points in the &#8220;Must Have&#8221; category.</p>
<p>The browser property &#8220;user-agent&#8221; is a can of worms. The specs say this http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43. The operative word here is that the tokens should appear in their order of importance. Then why does Chrome report it&#8217;s &#8220;user-agent&#8221; string as</p>
<p><code>Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/4.0.203.0 Safari/532.0.</code></p>
<p>Can&#8217;t it just begin with <code>Chrome/4.0.203.0</code> and put whatever is left in the sentence later on.</p>
<p>A good read on the subject is<br />
<code>http://www.jibbering.com/faq/faq_notes/not_browser_detect.html</code></p>
<p>So since there is no perfect solution to the subject, I have settled on this compromise.<code>http://www.quirksmode.org/js/detect.html</code> to address point number 1&amp;2.</p>
<p>As for point number 3 this piece of code is good enough.</p>
<pre class="brush: jscript;">
document.write('&lt;p class=&quot;accent&quot;&gt;'+screen.width+','+screen.height+'&lt;/p&gt;');
</pre>
<p>Point number 4 can be addressed by using this piece of code.</p>
<pre class="brush: jscript;">
document.write(navigator.javaEnabled());
</pre>
<p>I know this is not perfect. A better method would have been to try and run the smallest possible applet on the client&#8217;s computer. For reference see <code>http://javatester.org</code></p>
<p>Now for the remaining which is point number 5 on the list, the remote IP Address can be determined on the server side quite easily in any programming language whether it be Java,.Net or PHP.<br />
The rest will be tackled tomorrow. Stay Tuned.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mcoder.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mcoder.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mcoder.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mcoder.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mcoder.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mcoder.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mcoder.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mcoder.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mcoder.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mcoder.wordpress.com/95/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcoder.wordpress.com&blog=747792&post=95&subd=mcoder&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mcoder.wordpress.com/2009/08/31/very-simple-version-of-google-analytics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fdeb5edecfbbb1c14de4d77161095c2b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">swapnonil</media:title>
		</media:content>
	</item>
		<item>
		<title>Screenshots of my favorite Blackberry Apps</title>
		<link>http://mcoder.wordpress.com/2009/08/31/screenshots-of-my-favorite-blackberry-apps/</link>
		<comments>http://mcoder.wordpress.com/2009/08/31/screenshots-of-my-favorite-blackberry-apps/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 19:42:21 +0000</pubDate>
		<dc:creator>Swapnonil Mukherjee</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[blackberry]]></category>

		<guid isPermaLink="false">http://mcoder.wordpress.com/?p=85</guid>
		<description><![CDATA[I bought my first Blackberry a 8520 Curve about 7 days ago and since then I have downloaded over 20 apps.  Some have become my favorite and pretty much indispensable.




UberTwitter


Google Maps




Viigo Feed Reader


Opera Mini




Flickr Uploader


Google Search and Apps




Google Talk






       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcoder.wordpress.com&blog=747792&post=85&subd=mcoder&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I bought my first Blackberry a 8520 Curve about 7 days ago and since then I have downloaded over 20 apps.  Some have become my favorite and pretty much indispensable.</p>
<table border="0">
<tbody>
<tr>
<td>
<h3>UberTwitter</h3>
<p><a title="Ubertwitter: BB 8520 by Swapnonil Mukherjee, on Flickr" href="http://www.flickr.com/photos/smukherjee/3871661558/"><img src="http://farm3.static.flickr.com/2609/3871661558_939f7be75c_o.jpg" alt="Ubertwitter: BB 8520" width="320" height="240" /></a></td>
<td>
<h3>Google Maps</h3>
<p><a title="Google Maps: BB 8520 by Swapnonil Mukherjee, on Flickr" href="http://www.flickr.com/photos/smukherjee/3870878771/"><img src="http://farm4.static.flickr.com/3472/3870878771_21861821ab_o.jpg" alt="Google Maps: BB 8520" width="320" height="240" /></a></td>
</tr>
<tr>
<td>
<h3>Viigo Feed Reader</h3>
<p><a title="Viigo: BB 8520 by Swapnonil Mukherjee, on Flickr" href="http://www.flickr.com/photos/smukherjee/3870880929/"><img src="http://farm3.static.flickr.com/2628/3870880929_1b4d351f00_o.jpg" alt="Viigo: BB 8520" width="320" height="240" /></a></td>
<td>
<h3>Opera Mini</h3>
<p><a title="Opera Mini: BB 8520 by Swapnonil Mukherjee, on Flickr" href="http://www.flickr.com/photos/smukherjee/3871667436/"><img src="http://farm3.static.flickr.com/2482/3871667436_5d33685a55_o.jpg" alt="Opera Mini: BB 8520" width="320" height="240" /></a></td>
</tr>
<tr>
<td>
<h3>Flickr Uploader</h3>
<p><a title="Flickr Uploader: BB 8520 by Swapnonil Mukherjee, on Flickr" href="http://www.flickr.com/photos/smukherjee/3870885265/"><img src="http://farm3.static.flickr.com/2532/3870885265_e626b98ed4_o.jpg" alt="Flickr Uploader: BB 8520" width="320" height="240" /></a></td>
<td>
<h3>Google Search and Apps</h3>
<p><a title="Google Apps: BB 8520 by Swapnonil Mukherjee, on Flickr" href="http://www.flickr.com/photos/smukherjee/3870887613/"><img src="http://farm4.static.flickr.com/3506/3870887613_219d757ff0_o.jpg" alt="Google Apps: BB 8520" width="320" height="240" /></a></td>
</tr>
<tr>
<td>
<h3>Google Talk</h3>
<p><a href="http://www.flickr.com/photos/smukherjee/3870889419/" title="GTalk: BB 8520 by Swapnonil Mukherjee, on Flickr"><img src="http://farm3.static.flickr.com/2566/3870889419_eac42a1200_o.jpg" width="320" height="240" alt="GTalk: BB 8520" /></a>
</td>
<td></td>
</tr>
</tbody>
</table>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mcoder.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mcoder.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mcoder.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mcoder.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mcoder.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mcoder.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mcoder.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mcoder.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mcoder.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mcoder.wordpress.com/85/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcoder.wordpress.com&blog=747792&post=85&subd=mcoder&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mcoder.wordpress.com/2009/08/31/screenshots-of-my-favorite-blackberry-apps/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fdeb5edecfbbb1c14de4d77161095c2b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">swapnonil</media:title>
		</media:content>

		<media:content url="http://farm3.static.flickr.com/2609/3871661558_939f7be75c_o.jpg" medium="image">
			<media:title type="html">Ubertwitter: BB 8520</media:title>
		</media:content>

		<media:content url="http://farm4.static.flickr.com/3472/3870878771_21861821ab_o.jpg" medium="image">
			<media:title type="html">Google Maps: BB 8520</media:title>
		</media:content>

		<media:content url="http://farm3.static.flickr.com/2628/3870880929_1b4d351f00_o.jpg" medium="image">
			<media:title type="html">Viigo: BB 8520</media:title>
		</media:content>

		<media:content url="http://farm3.static.flickr.com/2482/3871667436_5d33685a55_o.jpg" medium="image">
			<media:title type="html">Opera Mini: BB 8520</media:title>
		</media:content>

		<media:content url="http://farm3.static.flickr.com/2532/3870885265_e626b98ed4_o.jpg" medium="image">
			<media:title type="html">Flickr Uploader: BB 8520</media:title>
		</media:content>

		<media:content url="http://farm4.static.flickr.com/3506/3870887613_219d757ff0_o.jpg" medium="image">
			<media:title type="html">Google Apps: BB 8520</media:title>
		</media:content>

		<media:content url="http://farm3.static.flickr.com/2566/3870889419_eac42a1200_o.jpg" medium="image">
			<media:title type="html">GTalk: BB 8520</media:title>
		</media:content>
	</item>
		<item>
		<title>The Hindu redesign their homepage.</title>
		<link>http://mcoder.wordpress.com/2009/08/15/the-hindu-redesign-their-homepage/</link>
		<comments>http://mcoder.wordpress.com/2009/08/15/the-hindu-redesign-their-homepage/#comments</comments>
		<pubDate>Sat, 15 Aug 2009 11:07:34 +0000</pubDate>
		<dc:creator>Swapnonil Mukherjee</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[newspapers]]></category>

		<guid isPermaLink="false">http://mcoder.wordpress.com/?p=76</guid>
		<description><![CDATA[Have a look at http://beta.thehindu.com/. The Hindu, one of India&#8217;s oldest and most respected newspapers have redesigned their home page and it looks fantastic. Having said that, here are a few things which I would like

Typefaces. Serif fonts like &#8220;Times&#8221; look good when applied at larger sizes. They are appropriate for Headline text. But I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcoder.wordpress.com&blog=747792&post=76&subd=mcoder&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Have a look at <a href="http://beta.thehindu.com/" target="_blank">http://beta.thehindu.com/</a>. The Hindu, one of India&#8217;s oldest and most respected newspapers have redesigned their home page and it looks fantastic. Having said that, here are a few things which I would like</p>
<ol>
<li><strong>Typefaces. </strong>Serif fonts like &#8220;Times&#8221; look good when applied at larger sizes. They are appropriate for Headline text. But I would prefer sans-serif for body text. Normal body text is usually smaller in size and serif fonts don&#8217;t generally render well at small sizes. For reference have a look at <a href="http://www.guardian.co.uk/">http://www.guardian.co.uk/</a> and <a href="http://www.nytimes.com/">http://www.nytimes.com/</a>. Which site is more readable? The Guardian uses sans-serif for body text while The New York Times uses serif. I would prefer sans-serif anyday.</li>
<li><strong>Sections.</strong> They have sections like Business, Sports, Arts, Health, Life &amp; Style. Why not color code each section. For example all headlines under Business could be blue in color, while all headlines under Health could be in green and so on. Color coding is a proven way to help people find things faster. Again The Guardian is a good example of this. Their <a href="http://www.guardian.co.uk/environment" target="_blank">page on environment</a> is in green while their page on <a href="http://www.guardian.co.uk/money" target="_blank">money is in purple</a>.</li>
</ol>
<p>I really don&#8217;t want to antagonize The Hindu readers, but <a href="http://timesofindia.indiatimes.com/" target="_blank">http://timesofindia.indiatimes.com/</a> already has implemented both my suggestions. Of course, The Hindu&#8217;s homepage is aesthetically 100 times better. TOI has tried to cram in too much information on their homepage, thereby raising the cognition challenge, whereas The Hindu&#8217;s homepage has a nice balance between information and cognition of all that is displayed.</p>
<p>Once again congrats to The Hindu.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mcoder.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mcoder.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mcoder.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mcoder.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mcoder.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mcoder.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mcoder.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mcoder.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mcoder.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mcoder.wordpress.com/76/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mcoder.wordpress.com&blog=747792&post=76&subd=mcoder&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mcoder.wordpress.com/2009/08/15/the-hindu-redesign-their-homepage/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fdeb5edecfbbb1c14de4d77161095c2b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">swapnonil</media:title>
		</media:content>
	</item>
	</channel>
</rss>