<?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/"
	>

<channel>
	<title>Genius-Field</title>
	<atom:link href="http://blog.genius-field.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.genius-field.com</link>
	<description>Your world starts from here</description>
	<lastBuildDate>Fri, 22 Jan 2010 03:03:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>RAID on the Cheap: Windows 7 Software RAID vs. inexpensive “fake RAID” at Kevin’s Blog</title>
		<link>http://blog.genius-field.com/2010/01/22/raid-on-the-cheap-windows-7-software-raid-vs-inexpensive-%e2%80%9cfake-raid%e2%80%9d-at-kevin%e2%80%99s-blog/</link>
		<comments>http://blog.genius-field.com/2010/01/22/raid-on-the-cheap-windows-7-software-raid-vs-inexpensive-%e2%80%9cfake-raid%e2%80%9d-at-kevin%e2%80%99s-blog/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 03:03:20 +0000</pubDate>
		<dc:creator>Icyfish</dc:creator>
				<category><![CDATA[Computer Technology]]></category>

		<guid isPermaLink="false">http://blog.genius-field.com/?p=120</guid>
		<description><![CDATA[spinning the seattleites via RAID on the Cheap: Windows 7 Software RAID vs. inexpensive “fake RAID” at Kevin’s Blog.]]></description>
			<content:encoded><![CDATA[<p>spinning the seattleites</p>
<p>via <a href="http://kmwoley.com/blog/?p=429">RAID on the Cheap: Windows 7 Software RAID vs. inexpensive “fake RAID” at Kevin’s Blog</a>.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save" target="_blank"><img src="http://blog.genius-field.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.genius-field.com/2010/01/22/raid-on-the-cheap-windows-7-software-raid-vs-inexpensive-%e2%80%9cfake-raid%e2%80%9d-at-kevin%e2%80%99s-blog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Genius-Field Database Connection Pool API 0.2(RC) Release</title>
		<link>http://blog.genius-field.com/2009/10/19/genius-field-database-connection-pool-api-0-2rc-release/</link>
		<comments>http://blog.genius-field.com/2009/10/19/genius-field-database-connection-pool-api-0-2rc-release/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 13:41:41 +0000</pubDate>
		<dc:creator>Icyfish</dc:creator>
				<category><![CDATA[Java Technology]]></category>

		<guid isPermaLink="false">http://blog.genius-field.com/?p=114</guid>
		<description><![CDATA[0.2-rc (2009-10-19) New features: Add a new method which can load properties from a variable instead of from a file Download dbcp-0.2-rc]]></description>
			<content:encoded><![CDATA[<p>0.2-rc (2009-10-19)<br />
New features:<br />
Add a new method which can load properties from a variable instead of from a file</p>
<p><strong>Download </strong><a href="http://blog.genius-field.com/wp-content/uploads/2009/10/dbcp-0.2-rc.zip"><strong>dbcp-0.2-rc</strong></a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save" target="_blank"><img src="http://blog.genius-field.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.genius-field.com/2009/10/19/genius-field-database-connection-pool-api-0-2rc-release/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Genius-Field Database Connection Pool API 0.2(beta) Release</title>
		<link>http://blog.genius-field.com/2009/10/08/genius-field-database-connection-pool-api-0-2beta-release/</link>
		<comments>http://blog.genius-field.com/2009/10/08/genius-field-database-connection-pool-api-0-2beta-release/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 13:11:13 +0000</pubDate>
		<dc:creator>Icyfish</dc:creator>
				<category><![CDATA[Java Technology]]></category>

		<guid isPermaLink="false">http://blog.genius-field.com/?p=103</guid>
		<description><![CDATA[0.2-beta (2009-10-08) Bugfixes and minor changes: Fix an error which may throw IllegalMonitorStateException Download dbcp-0.2-beta]]></description>
			<content:encoded><![CDATA[<p>0.2-beta (2009-10-08)<br />
Bugfixes and minor changes:<br />
Fix an error which may throw <span style="WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: medium 'Times New Roman'; WHITE-SPACE: normal; ORPHANS: 2; LETTER-SPACING: normal; COLOR: #000000; WORD-SPACING: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="TEXT-ALIGN: justify; LINE-HEIGHT: 16px; FONT-FAMILY: 'Lucida Grande', Verdana, Arial, sans-serif; COLOR: #333333; FONT-SIZE: 12px">IllegalMonitorStateException</span></span></p>
<p><span style="WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: medium 'Times New Roman'; WHITE-SPACE: normal; ORPHANS: 2; LETTER-SPACING: normal; COLOR: #000000; WORD-SPACING: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="TEXT-ALIGN: justify; LINE-HEIGHT: 16px; FONT-FAMILY: 'Lucida Grande', Verdana, Arial, sans-serif; COLOR: #333333; FONT-SIZE: 12px"><strong>Download </strong><strong><a href="http://blog.genius-field.com/wp-content/uploads/2009/10/dbcp-0.2-beta.zip">dbcp-0.2-beta</a></strong></span></span></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save" target="_blank"><img src="http://blog.genius-field.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.genius-field.com/2009/10/08/genius-field-database-connection-pool-api-0-2beta-release/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use Eclipse+SVN to Do Team Work</title>
		<link>http://blog.genius-field.com/2009/10/02/use-eclipsesvn-to-do-team-work/</link>
		<comments>http://blog.genius-field.com/2009/10/02/use-eclipsesvn-to-do-team-work/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 12:21:00 +0000</pubDate>
		<dc:creator>Icyfish</dc:creator>
				<category><![CDATA[Programming Technology]]></category>

		<guid isPermaLink="false">http://blog.genius-field.com/?p=90</guid>
		<description><![CDATA[Subversion is an open source version control system. It will make you safe and efficient to do collaboration work with your team members. We use eclipse plugin Subversive to integrate SVN to eclipse platform. Here we use eclipse 3.5.1+Subversive 0.7.8. &#8230; <a href="http://blog.genius-field.com/2009/10/02/use-eclipsesvn-to-do-team-work/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Subversion is an open source version control system. It will make you safe and efficient to do collaboration work with your team members. We use eclipse plugin Subversive to integrate SVN to eclipse platform.<br />
Here we use eclipse 3.5.1+Subversive 0.7.8.<span id="more-90"></span></p>
<p style="text-align: left;"><strong>Step 1:<br />
</strong>Download Subversive from here: <a href="http://www.eclipse.org/subversive/downloads.php" target="_blank">http://www.eclipse.org/subversive/downloads.php</a><br />
<a href="http://blog.genius-field.com/wp-content/uploads/2009/10/01.PNG" target="_blank"><img class="alignnone size-medium wp-image-91" title="01" src="http://blog.genius-field.com/wp-content/uploads/2009/10/01-300x182.PNG" alt="01" width="300" height="182" /></a><br />
Choose a suitable version for your eclipse platform.<br />
Here we download Subversive-incubation-0.7.8.I20090904-1300.zip.<br />
Download Subversive Connector from here: <a href="http://community.polarion.com/projects/subversive/download/eclipse/2.0/builds/" target="_blank">http://community.polarion.com/projects/subversive/download/eclipse/2.0/builds/</a><a href="http://blog.genius-field.com/wp-content/uploads/2009/10/02.PNG" target="_blank"><br />
<img class="alignnone size-medium wp-image-92" title="02" src="http://blog.genius-field.com/wp-content/uploads/2009/10/02-300x123.PNG" alt="02" width="300" height="123" /></a><br />
Choose the latest stable version or other suitable version.<br />
Here we download Subversive-connectors-2.2.1.I20090925-2100.zip.</p>
<p><strong>Step 2:<br />
</strong>Unzip these two zip files and fire up eclipse.<br />
Click Help&gt;Install New Software.<br />
Click Add&gt;Local and select the location of Subversive-incubation folder.<br />
<a href="http://blog.genius-field.com/wp-content/uploads/2009/10/03.PNG" target="_blank"><img class="alignnone size-medium wp-image-93" title="03" src="http://blog.genius-field.com/wp-content/uploads/2009/10/03-300x230.PNG" alt="03" width="300" height="230" /></a><br />
Select all the components from the list and follow the installation guide.<br />
After installation, restart eclipse and repeat it for Subversive Connector.</p>
<p><strong>Step 3:</strong><br />
Configure a SVN server in the eclipse.<br />
Click Window&gt;Show View&gt;Other&gt;SVN&gt;SVN Repositories.<br />
Then in the SVN Repositories view, right click and select New&gt;Repository Location.<br />
Define the SVN repository location information and click Finish.<br />
<a href="http://blog.genius-field.com/wp-content/uploads/2009/10/04.PNG" target="_blank"><img class="alignnone size-medium wp-image-94" title="04" src="http://blog.genius-field.com/wp-content/uploads/2009/10/04-287x300.PNG" alt="04" width="287" height="300" /></a><br />
Then a new repository location is created. Right click it and you can check out it as a local project.<br />
When you are ready to share code with others, you may right click your project and Select Team&gt;Share Project.<br />
When you want to synchronize your local resource with your team members, you may use Team&gt;Update.<br />
When you want to commit your code, you may use Team&gt;Commit.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save" target="_blank"><img src="http://blog.genius-field.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.genius-field.com/2009/10/02/use-eclipsesvn-to-do-team-work/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Genius-Field Database Connection Pool API 0.2(alpha) Release</title>
		<link>http://blog.genius-field.com/2009/09/07/genius-field-database-connection-pool-api-0-2alpha-release/</link>
		<comments>http://blog.genius-field.com/2009/09/07/genius-field-database-connection-pool-api-0-2alpha-release/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 03:25:32 +0000</pubDate>
		<dc:creator>Icyfish</dc:creator>
				<category><![CDATA[Java Technology]]></category>

		<guid isPermaLink="false">http://blog.genius-field.com/?p=85</guid>
		<description><![CDATA[We are glad to inform you that our new version of Genius-Field Database Connection Pool is released. From now on, we will post the change logs here as well as the jar distribution and put other stuff on Google Code. &#8230; <a href="http://blog.genius-field.com/2009/09/07/genius-field-database-connection-pool-api-0-2alpha-release/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>We are glad to inform you that our new version of Genius-Field Database Connection Pool is released. From now on, we will post the change logs here as well as the jar distribution and put other stuff on Google Code. You may visit <a href="http://code.google.com/p/dbconnectionpool/" target="_blank">here</a>.</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">0.2-dev (2009-09-03)</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">New features:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Initial release</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">0.2-alpha (2009-09-07)</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Bugfixes and minor changes:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Compatible with JDK 1.5</div>
<p>0.2-dev (2009-09-03)</p>
<p>New features:</p>
<p>Initial release</p>
<p><strong>Download </strong><a href="http://blog.genius-field.com/wp-content/uploads/2009/09/dbcp-0.2-dev.zip"><strong>dbcp-0.2-dev</strong></a></p>
<p>0.2-alpha (2009-09-07)</p>
<p>Bugfixes and minor changes:</p>
<p>Compatible with JDK 1.5</p>
<p><strong>Download </strong><a href="http://blog.genius-field.com/wp-content/uploads/2009/09/dbcp-0.2-alpha.zip"><strong>dbcp-0.2-alpha</strong></a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save" target="_blank"><img src="http://blog.genius-field.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.genius-field.com/2009/09/07/genius-field-database-connection-pool-api-0-2alpha-release/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Genius-Field Database Connection Pool API Coming Soon</title>
		<link>http://blog.genius-field.com/2009/08/01/new-genius-field-database-connection-pool-api-coming-soon/</link>
		<comments>http://blog.genius-field.com/2009/08/01/new-genius-field-database-connection-pool-api-coming-soon/#comments</comments>
		<pubDate>Sat, 01 Aug 2009 10:29:00 +0000</pubDate>
		<dc:creator>Icyfish</dc:creator>
				<category><![CDATA[Java Technology]]></category>

		<guid isPermaLink="false">http://blog.genius-field.com/?p=78</guid>
		<description><![CDATA[We are developing new version of Genius-Field Database Connection Pool in order to make it more stable and efficient. In the new version, the entire structure will be changed and it hopefully will be easy to use and easy to &#8230; <a href="http://blog.genius-field.com/2009/08/01/new-genius-field-database-connection-pool-api-coming-soon/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>We are developing new version of Genius-Field Database Connection Pool in order to make it more stable and efficient. In the new version, the entire structure will be changed and it hopefully will be easy to use and easy to control.</p>
<p>We are not going to make any updates for the old API and the new version will be open-source and hosted on Google Code under <a rel="nofollow" href="http://www.gnu.org/licenses/gpl.html" target="_blank">GNU General Public License v3</a>. We have already created the project home on Google Code, but nothing in it. You may visit <a href="http://code.google.com/p/dbconnectionpool/" target="_blank">here</a> if you like. There is no ETA for the new version release. We will make announcement when it arrives.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save" target="_blank"><img src="http://blog.genius-field.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.genius-field.com/2009/08/01/new-genius-field-database-connection-pool-api-coming-soon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Basic Knowledge of Cygwin</title>
		<link>http://blog.genius-field.com/2009/05/06/basic-knowledge-of-cygwin/</link>
		<comments>http://blog.genius-field.com/2009/05/06/basic-knowledge-of-cygwin/#comments</comments>
		<pubDate>Wed, 06 May 2009 03:21:49 +0000</pubDate>
		<dc:creator>Icyfish</dc:creator>
				<category><![CDATA[Computer Technology]]></category>

		<guid isPermaLink="false">http://blog.genius-field.com/?p=69</guid>
		<description><![CDATA[Cygwin is a Linux-like environment for Windows. It is something like a Linux simulator, but actually it is NOT. Cygwin is not a way to run native linux apps on Windows. You have to rebuild your application from source if &#8230; <a href="http://blog.genius-field.com/2009/05/06/basic-knowledge-of-cygwin/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Cygwin is a Linux-like environment for Windows. It is something like a Linux simulator, but actually it is NOT. Cygwin is not a way to run native linux apps on Windows. You have to rebuild your application from source if you want it to run on Windows. Cygwin is not a way to magically make native Windows apps aware of UNIX ® functionality, like signals, ptys, etc. Again, you need to build your apps from source if you want to take advantage of Cygwin functionality.</p>
<p>Because it is simple to use and you don&#8217;t need to install a real Linux on your computer, it is widely used for Windows user. The most common situation to use Cygwin is when you want to use g++ in Windows.<span id="more-69"></span></p>
<p>When you install Cygwin, you may see the following figure. You can choose whatever packages you like if you know their functions. You may expand the category to find what you need. If you want to install g++ and other related components such as gdb and make, you may see the post <a href="http://blog.genius-field.com/2009/04/20/build-up-cc-environment-on-eclipse-using-cdt-cygwin/" target="_blank">here</a>.<br />
<a href="http://blog.genius-field.com/wp-content/uploads/2009/05/01.png" target="_blank"><img class="alignnone size-medium wp-image-70" title="01" src="http://blog.genius-field.com/wp-content/uploads/2009/05/01-300x182.png" alt="01" width="300" height="182" /></a></p>
<p>To be mentioned, although Cygwin contains most of commands in Linux, there will be some missing. For example diff is not included by default. You may find it in the Utils category, and it is diffutils: A GNU collection of diff utilities. See the figure below.<br />
<a href="http://blog.genius-field.com/wp-content/uploads/2009/05/02.png" target="_blank"><img class="alignnone size-medium wp-image-71" title="02" src="http://blog.genius-field.com/wp-content/uploads/2009/05/02-300x182.png" alt="02" width="300" height="182" /></a></p>
<p>Click on the skip once, it will show a current version, then press Next to install it. After installation, you may use diff command in Cygwin.<br />
<a href="http://blog.genius-field.com/wp-content/uploads/2009/05/03.png" target="_blank"><img class="alignnone size-medium wp-image-72" title="03" src="http://blog.genius-field.com/wp-content/uploads/2009/05/03-228x300.png" alt="03" width="228" height="300" /></a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save" target="_blank"><img src="http://blog.genius-field.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.genius-field.com/2009/05/06/basic-knowledge-of-cygwin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Genius-Field Database Connection Pool API 0.1 Release</title>
		<link>http://blog.genius-field.com/2009/04/28/genius-field-database-connection-pool-api-01-release/</link>
		<comments>http://blog.genius-field.com/2009/04/28/genius-field-database-connection-pool-api-01-release/#comments</comments>
		<pubDate>Tue, 28 Apr 2009 05:04:45 +0000</pubDate>
		<dc:creator>Icyfish</dc:creator>
				<category><![CDATA[Java Technology]]></category>

		<guid isPermaLink="false">http://blog.genius-field.com/?p=64</guid>
		<description><![CDATA[New features: Allow user to release all conns at one time Allow user to watch some basic status of the connection pool Allow user to manually drop a conn if it works abnormally Bugfixes and minor changes: Fix the number &#8230; <a href="http://blog.genius-field.com/2009/04/28/genius-field-database-connection-pool-api-01-release/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>New features:<br />
Allow user to release all conns at one time<br />
Allow user to watch some basic status of the connection pool<br />
Allow user to manually drop a conn if it works abnormally</p>
<p>Bugfixes and minor changes:<br />
Fix the number of conns may be less than the minimum requirement</p>
<p><strong>Download </strong><a href="http://blog.genius-field.com/wp-content/uploads/2009/04/sql-01.zip"><strong>sql-01</strong></a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save" target="_blank"><img src="http://blog.genius-field.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.genius-field.com/2009/04/28/genius-field-database-connection-pool-api-01-release/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Further study on duplicate elements of HashSet</title>
		<link>http://blog.genius-field.com/2009/04/22/further-study-on-duplicate-elements-of-hashset/</link>
		<comments>http://blog.genius-field.com/2009/04/22/further-study-on-duplicate-elements-of-hashset/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 13:30:50 +0000</pubDate>
		<dc:creator>Icyfish</dc:creator>
				<category><![CDATA[Java Technology]]></category>

		<guid isPermaLink="false">http://blog.genius-field.com/?p=40</guid>
		<description><![CDATA[In mathematics, it is trivial to check duplicate elements because the properties of an element are simple. It may just contain numbers, letters, and colors and so on. However, it is complicated to check whether two elements (objects) are the &#8230; <a href="http://blog.genius-field.com/2009/04/22/further-study-on-duplicate-elements-of-hashset/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In mathematics, it is trivial to check duplicate elements because the properties of an element are simple. It may just contain numbers, letters, and colors and so on. However, it is complicated to check whether two elements (objects) are the &#8220;same&#8221; in computer programming.<br />
In Java language, the Set interface is defined as &#8220;A collection that contains no duplicate elements. More formally, sets contain no pair of elements e1 and e2 such that e1.equals(e2), and at most one null element&#8221;. The HashSet class implements the Set interface. How does it check? Does it really use equals method? Let&#8217;s have a look.<span id="more-40"></span><br />
We may first think there&#8217;re two ways to check the equality of two objects: using &#8220;=&#8221; operation or using equals method. The former is checked by the addresses of two objects. If they refer to the same address, they are equal. The latter usually returns the same result as &#8220;=&#8221; operation, but many classes override this method so that we may get different result. To be mentioned, hashCode method is also used here. Let&#8217;s see what actually happens.<br />
We write a class and override both equals method and hashCode method. The equals method can return true or false and the hashCode method may return the same or two different integers on two objects. So, there&#8217;re four combinations:<br />
1. true same<br />
2. true different<br />
3. false same<br />
4. false different<br />
We create two instances of the class and put them into a HashSet. Then change the combination one by one to see how they influence the result of HashSet, and the corresponding results are listed below:<br />
1. one element<br />
2. two elements<br />
3. two elements<br />
4. two elements<br />
Hence, we may conclude that two objects are the &#8220;same&#8221; if and only if hashCodes are equal and equals method return true.</p>
<p>Actually, this is part of the right answer.<br />
Now, we look into the source of JDK to see the truth.</p>
<p>The add method in HashSet:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">transient</span> HashMap<span style="color: #339933;">&lt;</span>E,Object<span style="color: #339933;">&gt;</span> map<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> add<span style="color: #009900;">&#40;</span>E e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> map.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span>e, PRESENT<span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>We know from documentation that &#8220;This class(HashSet) implements the Set interface, backed by a hash table (actually a HashMap instance)&#8221;. So, it invokes the put method in HashMap. We trace into it and find:</p>
<p>The put method in HashMap:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> V put<span style="color: #009900;">&#40;</span>K key, V value<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>key <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
        <span style="color: #000000; font-weight: bold;">return</span> putForNullKey<span style="color: #009900;">&#40;</span>value<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">int</span> hash <span style="color: #339933;">=</span> hash<span style="color: #009900;">&#40;</span>key.<span style="color: #006633;">hashCode</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> indexFor<span style="color: #009900;">&#40;</span>hash, table.<span style="color: #006633;">length</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>Entry<span style="color: #339933;">&lt;</span>K,V<span style="color: #339933;">&gt;</span> e <span style="color: #339933;">=</span> table<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> e <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span> e <span style="color: #339933;">=</span> e.<span style="color: #006633;">next</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003399;">Object</span> k<span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>e.<span style="color: #006633;">hash</span> <span style="color: #339933;">==</span> hash <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>k <span style="color: #339933;">=</span> e.<span style="color: #006633;">key</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> key <span style="color: #339933;">||</span> key.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span>k<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            V oldValue <span style="color: #339933;">=</span> e.<span style="color: #006633;">value</span><span style="color: #339933;">;</span>
            e.<span style="color: #006633;">value</span> <span style="color: #339933;">=</span> value<span style="color: #339933;">;</span>
            e.<span style="color: #006633;">recordAccess</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000000; font-weight: bold;">return</span> oldValue<span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    modCount<span style="color: #339933;">++;</span>
    addEntry<span style="color: #009900;">&#40;</span>hash, key, value, i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Pay attention to the key statement &#8220;if (e.hash == hash &amp;&amp; ((k = e.key) == key || key.equals(k)))&#8221;. From this sentence, we can know the truth:<br />
Two objects are the &#8220;same&#8221; when they satisfy both of the following conditions:<br />
1. hashCode are the same<br />
2. They refer to the same address or equals method returns true</p>
<p>You may look up the source of TreeSet or other sets to see how they check duplicate elements. They differ from each other.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save" target="_blank"><img src="http://blog.genius-field.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.genius-field.com/2009/04/22/further-study-on-duplicate-elements-of-hashset/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Build up C/C++ environment on eclipse using CDT + cygwin</title>
		<link>http://blog.genius-field.com/2009/04/20/build-up-cc-environment-on-eclipse-using-cdt-cygwin/</link>
		<comments>http://blog.genius-field.com/2009/04/20/build-up-cc-environment-on-eclipse-using-cdt-cygwin/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 14:22:54 +0000</pubDate>
		<dc:creator>Icyfish</dc:creator>
				<category><![CDATA[Programming Technology]]></category>

		<guid isPermaLink="false">http://blog.genius-field.com/?p=21</guid>
		<description><![CDATA[More and more people want to use open source IDE instead of Visual Studio to writing C/C++ because it&#8217;s clean and free. Here, we introduce eclipse to writing C/C++ program. Eclipse is an excellent IDE for Java programming. Due to &#8230; <a href="http://blog.genius-field.com/2009/04/20/build-up-cc-environment-on-eclipse-using-cdt-cygwin/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>More and more people want to use open source IDE instead of Visual Studio to writing C/C++ because it&#8217;s clean and free. Here, we introduce eclipse to writing C/C++ program. Eclipse is an excellent IDE for Java programming. Due to its open source platform, we may use it for C/C++ programming as well. CDT(C/C++ Development Tool) is a plugin that allows eclipse to support C/C++. Cygwin is a Linux-like environment for Windows and it allows you to use gcc/g++ compiler. There&#8217;re just several steps to build up your own eclipse. Now, let&#8217;s go.<span id="more-21"></span></p>
<p><strong>Step 1:</strong><br />
Download Cygwin setup here: <a href="http://www.cygwin.com/setup.exe">http://www.cygwin.com/setup.exe</a><br />
Install it according to the following guide:</p>
<p><a href="http://blog.genius-field.com/wp-content/uploads/2009/04/01.png" target="_blank"><img class="alignnone size-medium wp-image-22" title="01" src="http://blog.genius-field.com/wp-content/uploads/2009/04/01-300x232.png" alt="01" width="300" height="232" /></a></p>
<p><a href="http://blog.genius-field.com/wp-content/uploads/2009/04/02.png" target="_blank"><img class="alignnone size-medium wp-image-23" title="02" src="http://blog.genius-field.com/wp-content/uploads/2009/04/02-300x232.png" alt="02" width="300" height="232" /></a></p>
<p>Recommend to choose a short path and a simple name of the root directory<br />
<a href="http://blog.genius-field.com/wp-content/uploads/2009/04/03.png" target="_blank"><img class="alignnone size-medium wp-image-24" title="03" src="http://blog.genius-field.com/wp-content/uploads/2009/04/03-300x232.png" alt="03" width="300" height="232" /></a></p>
<p>Choose a location to download the installation file(not necessary be a subfolder of root directory)<br />
<a href="http://blog.genius-field.com/wp-content/uploads/2009/04/04.png" target="_blank"><img class="alignnone size-medium wp-image-25" title="04" src="http://blog.genius-field.com/wp-content/uploads/2009/04/04-300x232.png" alt="04" width="300" height="232" /></a></p>
<p><a href="http://blog.genius-field.com/wp-content/uploads/2009/04/05.png" target="_blank"><img class="alignnone size-medium wp-image-26" title="05" src="http://blog.genius-field.com/wp-content/uploads/2009/04/05-300x232.png" alt="05" width="300" height="232" /></a></p>
<p>Choose a mirror site you like. You may view the mirror site list here: <a href="http://cygwin.com/mirrors.html">http://cygwin.com/mirrors.html</a><br />
<a href="http://blog.genius-field.com/wp-content/uploads/2009/04/06.png" target="_blank"><img class="alignnone size-medium wp-image-27" title="06" src="http://blog.genius-field.com/wp-content/uploads/2009/04/06-300x232.png" alt="06" width="300" height="232" /></a></p>
<p>Expand Devel and select these components (by clicking skip label):<br />
gcc-core: C compiler<br />
gcc-g++: C++ compiler<br />
gdb: The GNU Debugger<br />
make: The GNU version of the make utility<br />
<a href="http://blog.genius-field.com/wp-content/uploads/2009/04/07.png" target="_blank"><img class="alignnone size-medium wp-image-28" title="07" src="http://blog.genius-field.com/wp-content/uploads/2009/04/07-300x232.png" alt="07" width="300" height="232" /></a><br />
Note: When you choose these components, Cygwin will automatically choose some other dependence for you. Just keep them.</p>
<p>Then it will download these packages and install them. When it completes, click Finish.</p>
<p><strong>Step 2:</strong><br />
Add bin folder in the root directory of Cygwin to the environment variables named path. Either user variable or system variable is fine. In the above example, you should use E:\cygwin\bin.</p>
<p><strong>Step 3:</strong><br />
If you download Eclipse IDE for C/C++ Developers, you may skip Step 3 and directly use it.<br />
Download CDT here: <a href="http://www.eclipse.org/cdt/downloads.php">http://www.eclipse.org/cdt/downloads.php</a><br />
Make sure you select the suitable version for your eclipse.<br />
Installing CDT may differ from its version. Here we use eclipse 3.4.2+CDT 5.0.2.<br />
Unzip CDT zip file into a folder and fire up eclipse.<br />
Click Help&gt;Software Updates and choose Available Software.<br />
Click Add site&gt;Local and select the location of the CDT folder.<br />
<a href="http://blog.genius-field.com/wp-content/uploads/2009/04/08.png" target="_blank"><img class="alignnone size-medium wp-image-29" title="08" src="http://blog.genius-field.com/wp-content/uploads/2009/04/08-300x202.png" alt="08" width="300" height="202" /></a></p>
<p>You will see the CDT is added to the Available Software list. Choose it and click Install.<br />
<a href="http://blog.genius-field.com/wp-content/uploads/2009/04/09.png" target="_blank"><img class="alignnone size-medium wp-image-30" title="09" src="http://blog.genius-field.com/wp-content/uploads/2009/04/09-300x202.png" alt="09" width="300" height="202" /></a></p>
<p>Wait until it completes installation and enjoy it after restarting eclipse.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save" target="_blank"><img src="http://blog.genius-field.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.genius-field.com/2009/04/20/build-up-cc-environment-on-eclipse-using-cdt-cygwin/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>
