<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-26660993</id><updated>2012-01-27T15:48:34.792+05:30</updated><category term='Personal'/><category term='MKV'/><category term='My SQL'/><category term='Connection Pooling'/><category term='BDP-S370'/><category term='SQL'/><category term='XMLParsing'/><category term='Sony'/><category term='Blu Ray'/><category term='Winamp'/><category term='Tomcat SSL'/><category term='Review'/><category term='Hibernate'/><category term='Info'/><category term='Criteria Query'/><category term='Windows'/><category term='2TB'/><category term='Poem'/><category term='Java'/><category term='Inspiration'/><category term='Interceptors'/><category term='Issue'/><category term='Tomcat'/><category term='My Book'/><category term='RSS'/><category term='Google Talk'/><category term='Broken Pipe'/><category term='Eclipse'/><category term='Debug'/><category term='Spring'/><category term='WD'/><category term='Goa'/><category term='Show Current Music Track'/><title type='text'>Mayank Singh</title><subtitle type='html'>A self taught software engineer blogging with some sense and a lot of non-sense !!! :)</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://mayankgsingh.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://mayankgsingh.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Mayank</name><uri>http://www.blogger.com/profile/02296414032387537182</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://4.bp.blogspot.com/-6qN1dd-Rkso/TyJ57bvquzI/AAAAAAAAP-c/653D-b68f6c/s220/DSC_2303_up.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>24</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-26660993.post-8005454159681016555</id><published>2012-01-23T22:41:00.000+05:30</published><updated>2012-01-23T23:01:31.296+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Broken Pipe'/><category scheme='http://www.blogger.com/atom/ns#' term='Hibernate'/><title type='text'>Broken Pipe Issue in Hibernate</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Hey guys, here is one of the many key issues which I was facing in one the web based java application on which I am currently working on. Here is the development environment.&lt;br /&gt;&lt;ul style="text-align: left;"&gt;&lt;li&gt;Java 1.6&lt;/li&gt;&lt;li&gt;Struts 2&lt;/li&gt;&lt;li&gt;Hibernate with C3p0&lt;/li&gt;&lt;li&gt;Postgres&lt;/li&gt;&lt;li&gt;Tomcat 6&lt;/li&gt;&lt;/ul&gt;Assuming database server &amp;amp; tomcat are both up an running and are on different machines. At any point if there is any network issues or for some reason database server goes down for few seconds, the &lt;u&gt;&lt;b&gt;c3p0/hibernate&lt;/b&gt;&lt;/u&gt; connection pool goes into bad state. And application keeps on throwing &lt;u&gt;&lt;b&gt;"Socket Exception" / "Broken Pipe"&lt;/b&gt;&lt;/u&gt; issue. And even if the database server comes up, it is not able to re-create the connection pool. The only solution to this issue is to re-start the tomcat server. There are other users who faced this issue with MySQL database.&lt;br /&gt;&lt;br /&gt;There is key entry which was missing from my &lt;u&gt;"hibernate.cfg.xml"&lt;/u&gt;. Adding this entry resolves this issue.&lt;br /&gt;&lt;div class="codeTextSmall"&gt;&amp;lt;property name="hibernate.connection.provider_class"&amp;gt;org.hibernate.connection.C3P0ConnectionProvider&amp;lt;/property&amp;gt;&lt;/div&gt;&lt;br /&gt;Along with the above I do have following properties in my application&lt;div class="codeTextSmall"&gt;&amp;lt;property name="hibernate.c3p0.min_size"&amp;gt;5&amp;lt;/property&amp;gt;&lt;br /&gt;&amp;lt;property name="hibernate.c3p0.max_size"&amp;gt;10&amp;lt;/property&amp;gt;&lt;br /&gt; &amp;lt;property name="hibernate.c3p0.max_statements"&amp;gt;50&amp;lt;/property&amp;gt;&lt;br /&gt; &amp;lt;property name="hibernate.c3p0.timeout"&amp;gt;1800&amp;lt;/property&amp;gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;I tested this setting and it works fine.&lt;br /&gt;I just fixed my broken pipe !!! :)&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26660993-8005454159681016555?l=mayankgsingh.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mayankgsingh.blogspot.com/feeds/8005454159681016555/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26660993&amp;postID=8005454159681016555' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/8005454159681016555'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/8005454159681016555'/><link rel='alternate' type='text/html' href='http://mayankgsingh.blogspot.com/2012/01/broken-pipe-issue-in-hibernate.html' title='Broken Pipe Issue in Hibernate'/><author><name>Mayank</name><uri>http://www.blogger.com/profile/02296414032387537182</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://4.bp.blogspot.com/-6qN1dd-Rkso/TyJ57bvquzI/AAAAAAAAP-c/653D-b68f6c/s220/DSC_2303_up.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26660993.post-1727999292632475989</id><published>2011-12-15T11:49:00.001+05:30</published><updated>2011-12-15T11:49:26.322+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Eclipse'/><title type='text'>Eclipse Memory Enhancements</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Default Eclipse settings are optimal for machines running on 1 GB/low memory. So if you have a machine with high memory, you can use below settings to optimize performance. Add the following settings in &lt;u&gt;eclipse.ini&lt;/u&gt;(residing in your eclipse home directory) file and start/restart the eclipse.&lt;br /&gt;&lt;br /&gt;&lt;div class="codeText"&gt;-Xmn128m&lt;br /&gt;-Xms1024m&lt;br /&gt;-Xmx1024m&lt;br /&gt;-Xss2m&lt;br /&gt;-XX:PermSize=128m&lt;br /&gt;-XX:MaxPermSize=128m&lt;br /&gt;-XX:+UseParallelGC&lt;/div&gt;&lt;br /&gt;Thanks.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26660993-1727999292632475989?l=mayankgsingh.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mayankgsingh.blogspot.com/feeds/1727999292632475989/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26660993&amp;postID=1727999292632475989' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/1727999292632475989'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/1727999292632475989'/><link rel='alternate' type='text/html' href='http://mayankgsingh.blogspot.com/2011/12/eclipse-memory-enhancements.html' title='Eclipse Memory Enhancements'/><author><name>Mayank</name><uri>http://www.blogger.com/profile/02296414032387537182</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://4.bp.blogspot.com/-6qN1dd-Rkso/TyJ57bvquzI/AAAAAAAAP-c/653D-b68f6c/s220/DSC_2303_up.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26660993.post-8096923661681116532</id><published>2011-10-04T22:57:00.001+05:30</published><updated>2011-10-04T22:57:21.402+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Criteria Query'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='Hibernate'/><title type='text'>SQL Restriction In Hibernate Criteria Query</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Here is an example to add a SQL Restriction in hibernate Criteria query.&lt;br /&gt;Let's consider we have &lt;br /&gt;&lt;ul&gt;&lt;li&gt;A Student.java entity &lt;/li&gt;&lt;li&gt;A stored procedure in place which returns total marks obtained by a student in each subject.&lt;/li&gt;&lt;/ul&gt;&lt;div class="codeTextSmall"&gt;&lt;pre&gt;&lt;br /&gt;public Class Student {&lt;br /&gt;    private Integer id;&lt;br /&gt;    private String name;&lt;br /&gt;    .&lt;br /&gt;    .&lt;br /&gt;    //getters &amp;amp; setters methods&lt;br /&gt;}&lt;/pre&gt;&lt;/div&gt;Assuming &lt;i&gt;get_marks()&lt;/i&gt; stored procedure will result records in following format.&lt;span class="codeTextSmall"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="codeTextSmall"&gt;&lt;table align="center" width="100%" border="1" rules="all"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th&gt;id&lt;/th&gt;&lt;th&gt;Maths&lt;/th&gt;&lt;th&gt;Enlish&lt;/th&gt;&lt;th&gt;Science&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;78&lt;/td&gt;&lt;td&gt;75&lt;/td&gt;&lt;td&gt;23&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;74&lt;/td&gt;&lt;td&gt;70&lt;/td&gt;&lt;td&gt;97&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;I want to list down the Students who has got more than 90 in Maths.Here goes the Hibernate Criteria query.&lt;div class="codeTextSmall"&gt;&lt;pre&gt;&lt;br /&gt;Criteria c = session.createCriteria(Student.class)&lt;br /&gt;		.addSqlrestriction(" {alias}.id in (SELECT id FROM get_marks() WHERE maths_total &amp;gt; ? ) ", new Double(90.0), Hibernate.Double);&lt;/pre&gt;&lt;/div&gt;&lt;br/&gt;In above statement &lt;b&gt;{alias}.id&lt;/b&gt; will refer to the &lt;b&gt;id&lt;/b&gt; column of Student table.The above &lt;b&gt;addSqlrestriction&lt;/b&gt; example shows the SQL restriction statement with only one parameter.&lt;br/&gt;What if you have to pass multiple arguments?&lt;br/&gt;In such cases you need to pass array of Objects &amp; array of Type as second &amp; third parameter to the &lt;i&gt;addSqlrestriction(String, Object[], Type[])&lt;/i&gt;. And in SQL String have &lt;b&gt;?&lt;/b&gt; where ever argument is required, as shown in above example.&lt;br/&gt;&lt;br/&gt;I hope this helps.&lt;br&gt;Thanks.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26660993-8096923661681116532?l=mayankgsingh.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mayankgsingh.blogspot.com/feeds/8096923661681116532/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26660993&amp;postID=8096923661681116532' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/8096923661681116532'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/8096923661681116532'/><link rel='alternate' type='text/html' href='http://mayankgsingh.blogspot.com/2011/10/sql-restriction-in-hibernate-criteria.html' title='SQL Restriction In Hibernate Criteria Query'/><author><name>Mayank</name><uri>http://www.blogger.com/profile/02296414032387537182</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://4.bp.blogspot.com/-6qN1dd-Rkso/TyJ57bvquzI/AAAAAAAAP-c/653D-b68f6c/s220/DSC_2303_up.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26660993.post-1454338966139148970</id><published>2011-08-27T20:29:00.002+05:30</published><updated>2011-08-27T22:55:48.050+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Google Talk'/><category scheme='http://www.blogger.com/atom/ns#' term='Show Current Music Track'/><category scheme='http://www.blogger.com/atom/ns#' term='Issue'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows'/><category scheme='http://www.blogger.com/atom/ns#' term='Winamp'/><title type='text'>GTalk - Show Current Music Track - Bug: Workaround Fix</title><content type='html'>Hi All,&lt;br /&gt;&lt;br /&gt;I have Windows XP, Google Talk 1.0.0.104 and Winamp 5.6.&lt;br /&gt;&lt;br /&gt;GTalk is crashing whenever I'm setting my status message to "&lt;i&gt;Show Current Music Track&lt;/i&gt;" (&lt;i&gt;Winamp Playing&lt;/i&gt;). Here is a simple fix for this issue.&lt;br /&gt;&lt;br /&gt;1. Open notepad&lt;br /&gt;2. Click on File --&gt; Save&lt;br /&gt;3. Save file it under Winamp installation directory [ &lt;i&gt;"C:\Program Files\Winamp" - in my case&lt;/i&gt;] with file name as "&lt;i&gt;&lt;b&gt;winamp.m3u&lt;/b&gt;&lt;/i&gt;".&lt;br /&gt;&lt;br /&gt;Restart Winamp &amp; GTalk.&lt;br /&gt;&lt;br /&gt;This is it !!! :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26660993-1454338966139148970?l=mayankgsingh.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mayankgsingh.blogspot.com/feeds/1454338966139148970/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26660993&amp;postID=1454338966139148970' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/1454338966139148970'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/1454338966139148970'/><link rel='alternate' type='text/html' href='http://mayankgsingh.blogspot.com/2011/08/gtalk-show-current-music-track-bug.html' title='GTalk - Show Current Music Track - Bug: Workaround Fix'/><author><name>Mayank</name><uri>http://www.blogger.com/profile/02296414032387537182</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://4.bp.blogspot.com/-6qN1dd-Rkso/TyJ57bvquzI/AAAAAAAAP-c/653D-b68f6c/s220/DSC_2303_up.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26660993.post-8086188903880833893</id><published>2011-08-23T14:56:00.001+05:30</published><updated>2011-08-23T22:20:02.413+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Poem'/><category scheme='http://www.blogger.com/atom/ns#' term='Personal'/><title type='text'>Khatarkun, Khatarkun, Khatarkun</title><content type='html'>Last Friday, I got bored of regular work. I was working with a colleague(and a good friend) at work and after a while our discussion turned into gossip. And my wickedly awesome head created what you are about to read...he he he !!! :D&lt;br /&gt;&lt;br /&gt;&lt;i&gt;khatarkun, khatarkun, khatarkun&lt;br /&gt;mere dil ki aawaz sun...&lt;br /&gt;&lt;br /&gt;tattos hai latest addiction uske,&lt;br /&gt;naam uska lete he, sabke kaan hote hai suuunnnn,&lt;br /&gt;khatarkun, khatarkun, khatarkun&lt;br /&gt;mere dil ki aawaz sun...&lt;br /&gt;&lt;br /&gt;log kehte hain, log kehte hain pj ko pyaar hua hai,&lt;br /&gt;kabhi wo bhi to bole, meri ishq ki kisse sun,&lt;br /&gt;khatarkun, khatarkun, khatarkun&lt;br /&gt;mere dil ki aawaz sun...&lt;br /&gt;&lt;br /&gt;hairband chode hai usne,&lt;br /&gt;system me ghus coding karti hai wo,&lt;br /&gt;kalyan kar uska bhi,&lt;br /&gt;mere khuda, dua hum sab ki sun&lt;br /&gt;khatarkun, khatarkun, khatarkun&lt;br /&gt;mere dil ki aawaz sun...&lt;br /&gt;&lt;br /&gt;naye hai additions, nayi hai value,&lt;br /&gt;internal to internal,&lt;br /&gt;external sources bhi hua hai guum,&lt;br /&gt;khatarkun, khatarkun, khatarkun,&lt;br /&gt;mere dil ki aawaz sun...&lt;br /&gt;&lt;br /&gt;bade dino baad aaya koi chera nazar me&lt;br /&gt;aaj pata chala hai naam uska, aaj hai dil me naya junoon&lt;br /&gt;khatarkun, khatarkun, khatarkun&lt;br /&gt;mere "bhi" dil ki aawaz sun...&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This is just for fun, no offense !!!! :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26660993-8086188903880833893?l=mayankgsingh.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mayankgsingh.blogspot.com/feeds/8086188903880833893/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26660993&amp;postID=8086188903880833893' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/8086188903880833893'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/8086188903880833893'/><link rel='alternate' type='text/html' href='http://mayankgsingh.blogspot.com/2011/08/khatarkun-khatarkun-khatarkun.html' title='Khatarkun, Khatarkun, Khatarkun'/><author><name>Mayank</name><uri>http://www.blogger.com/profile/02296414032387537182</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://4.bp.blogspot.com/-6qN1dd-Rkso/TyJ57bvquzI/AAAAAAAAP-c/653D-b68f6c/s220/DSC_2303_up.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26660993.post-6918801827855371915</id><published>2011-08-10T15:12:00.003+05:30</published><updated>2011-08-10T22:26:58.002+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Interceptors'/><category scheme='http://www.blogger.com/atom/ns#' term='Hibernate'/><title type='text'>Hibernate Interceptors</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Are you using hibernate and thinking of using Database Triggers? Then wait....&lt;br /&gt;&lt;br /&gt;If most of your database operations are done via stored procedures then having triggers in place is the only choice to intercept any DML calls.&lt;br /&gt;&lt;br /&gt;But since we are using hibernate we need a more object oriented way of handling things. &lt;br /&gt;Hibernate interceptors is similar to triggers in database. Monitoring DML operations via triggers is the most efficient way, but it won't be easy to maintain, understand and manipulate business logic when all database operations are done via hibernate.&lt;br /&gt;&lt;br /&gt;Coming straight to the point, hibernate provides "org.hibernate.Interceptor" interface to have the business logic to perform pre or post operations around DML hibernate calls. Following methods are required to be implemented against "org.hibernate.Interceptor".&lt;br /&gt;&lt;div class="codeText"&gt;&lt;code&gt;&lt;br /&gt;public interface Interceptor {&lt;br /&gt;&lt;br /&gt;public void afterTransactionBegin(Transaction arg0) {&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void afterTransactionCompletion(Transaction arg0) {&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void beforeTransactionCompletion(Transaction arg0) {&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public int[] findDirty(Object arg0, Serializable arg1, Object[] arg2,&lt;br /&gt;Object[] arg3, String[] arg4, Type[] arg5) {&lt;br /&gt;return null;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public Object getEntity(String arg0, Serializable arg1)&lt;br /&gt;throws CallbackException {&lt;br /&gt;return null;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public String getEntityName(Object arg0) throws CallbackException {&lt;br /&gt;return null;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public Object instantiate(String arg0, EntityMode arg1, Serializable arg2)&lt;br /&gt;throws CallbackException {&lt;br /&gt;return null;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public Boolean isTransient(Object arg0) {&lt;br /&gt;return null;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void onDelete(Object arg0, Serializable arg1, Object[] arg2,&lt;br /&gt;String[] arg3, Type[] arg4) throws CallbackException {&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public boolean onFlushDirty(Object arg0, Serializable arg1, Object[] arg2,&lt;br /&gt;Object[] arg3, String[] arg4, Type[] arg5) throws CallbackException 		{&lt;br /&gt;return false;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public boolean onLoad(Object arg0, Serializable arg1, Object[] arg2,&lt;br /&gt;String[] arg3, Type[] arg4) throws CallbackException {&lt;br /&gt;return false;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public boolean onSave(Object arg0, Serializable arg1, Object[] arg2,&lt;br /&gt;String[] arg3, Type[] arg4) throws CallbackException {&lt;br /&gt;return false;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void postFlush(Iterator arg0) throws CallbackException {&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void preFlush(Iterator arg0) throws CallbackException {&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;Since you won't be interested in implementing all of the methods, hibernate provides "org.hibernate.EmptyInterceptor" class which has empty implementation of the Interceptor interface. Now, as per your need you can override any of the desired method. Below is the sample class which I plugged in hibernate configuration to print out the primary key of any object which is getting saved.&lt;br /&gt;&lt;div class="codeText"&gt;&lt;code&gt;&lt;br /&gt;package com.test.interceptor;&lt;br /&gt;&lt;br /&gt;import java.io.Serializable;&lt;br /&gt;&lt;br /&gt;import org.hibernate.EmptyInterceptor;&lt;br /&gt;import org.hibernate.type.Type;&lt;br /&gt;&lt;br /&gt;public class InsertMonitorInterceptor extends EmptyInterceptor{&lt;br /&gt;&lt;br /&gt;@Override&lt;br /&gt;public boolean onSave(Object entity, Serializable id, Object[] state,&lt;br /&gt;String[] propertyNames, Type[] types) {&lt;br /&gt;System.out.println("Saving..." + id + ": " entity);&lt;br /&gt;return super.onSave(entity, id, state, propertyNames, types);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;Once you have your Interceptor class implementation ready it can be very easily plugged with any existing hibernate configuration as shown below.&lt;br /&gt;&lt;br /&gt;&lt;div class="codeText"&gt;&lt;code&gt;&lt;br /&gt;new Configuration().configure(DBUtil.class.getResource("hibernate.cfg.xml"))&lt;br /&gt;&lt;b&gt;.setInterceptor(new InsertMonitorInterceptor())&lt;/b&gt;&lt;br /&gt;.buildSessionFactory();&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;That's it. You can have different interceptor implementation plug it in to start using them.&lt;br /&gt;Hope this article will be helpful. happy Intercepting.&lt;br /&gt;&lt;br /&gt;Thanks.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26660993-6918801827855371915?l=mayankgsingh.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mayankgsingh.blogspot.com/feeds/6918801827855371915/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26660993&amp;postID=6918801827855371915' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/6918801827855371915'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/6918801827855371915'/><link rel='alternate' type='text/html' href='http://mayankgsingh.blogspot.com/2011/08/hibernate-interceptors.html' title='Hibernate Interceptors'/><author><name>Mayank</name><uri>http://www.blogger.com/profile/02296414032387537182</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://4.bp.blogspot.com/-6qN1dd-Rkso/TyJ57bvquzI/AAAAAAAAP-c/653D-b68f6c/s220/DSC_2303_up.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26660993.post-7488388518371699582</id><published>2010-09-25T12:09:00.002+05:30</published><updated>2010-09-26T01:06:43.642+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Blu Ray'/><category scheme='http://www.blogger.com/atom/ns#' term='BDP-S370'/><category scheme='http://www.blogger.com/atom/ns#' term='MKV'/><category scheme='http://www.blogger.com/atom/ns#' term='Sony'/><title type='text'>Blu Ray Player</title><content type='html'>&lt;b&gt;!!! WOW !!!&lt;/b&gt; &lt;br /&gt;That was the first expression when I played a Blu ray disc on my BDP-S370 connected to Bravia  LCD.&lt;br /&gt;It’s a feature packed Blu Ray HD player which comes at a decent price. I know the "Sony" and "Price" can't be decent but then it's worth.&lt;br /&gt;&lt;br /&gt;Starting with the list of features&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;b&gt;Audio/Video formats: &lt;/b&gt;It supports a lot of audio and video format including MKV and MT2S which are basically high definition video format files. Apart from this it also supports DivX HD which is pretty common.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;USB Connectivity: &lt;/b&gt;It has got two USB ports. One can put up all A/V media and stills onto a USB drive and can enjoy them on a big screen.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;LAN Connectivity: &lt;/b&gt;I connected Blu Ray PLayer and my WB 2 TB disk via switch. And my player detects the Media Server (twonky) running on my WD Disk(DLNA Capability of the player) which hosts all my Audio, Video and Stills.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Wireless LAN: &lt;/b&gt;It also supports wireless LAN but then you have to purchase Sony's wireless USB stick separately. It will gonna cost you around Rs. 4500/-. It's a big disappointment. Also it will not support any other wireless USB adapter.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Misc: &lt;/b&gt;This player is can access Gracenote server and BD Live enabled. So if your disk player is connected to internet you can definitely make use of this feature. Also it can stream video from popular video sites like www.youtube.com. Well there couple of more sites listed from which videos can be streamed.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Pretty good customer support just in case if you run into any issue (highly unlikely with Sony :) ).&lt;/li&gt;&lt;/ol&gt;Well those are the good points. &lt;br /&gt;&lt;b&gt;MKV File Problem&lt;/b&gt;&lt;br /&gt;I had some issues with playing MKV files larger than 4 GB with Twonky media sever; I complained about this at Sony’s customer support. They kept me informed for two weeks, after that I didn’t heared from them. I guess they were not able to resolve the problem. Well I did some RnD on playing MKV files and here are some of my findings to play those on Sony’s BDP-S370.&lt;br /&gt;&lt;b&gt;Solution&lt;/b&gt;&lt;br /&gt;When talking about USB support on BDP-S370, it only supports USB drives with FAT32 file system. It doesn’t support NTFS file system. Now if you have some high definition video files, mostly MKV, whose size mostly exceeds 4GB, you will gonna run into problem as you won't be able to copy those files to FAT 32 USB disk. [ &lt;i&gt;A single file on FAT 32 file system cannot be larger than 4 GB&lt;/i&gt; ].&lt;br /&gt;Well, now you can't play the MKV files using USB drive so you can go ahead with one the following options&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;Option 1:&lt;/b&gt; You can split those large files into smaller chunks and then copy it to USB disk. That will work. But then the splitting process will gonna take some time. &lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Option 2:&lt;/b&gt; Connect the player via LAN to a computer or other device hosting a Media Server. Now the player might not detect MKV files hosted by your media server. In my case it's Twonky. So I tried Serviio and Wild Media Server. Serviio didn’t work out but Wild Media Server works like a Charm. The Blu Ray player played my MKV file, which is of 11 GB is size, very smoothly.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Now, there is couple of things to be taken into consideration when you are going with second approach.&lt;br /&gt;Wild Media Sever is not free. Trail version is available for download and test things out.&lt;br /&gt;Wild media server basically does on-the-fly transcoding. So it will gonna eat a lot of CPU, in my case the CPU usage was 98%. So make sure that you have a decent CPU power. Also, when you are dealing with such large files over the network make sure that you running at least on 100 Mbps LAN.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Purchasing tips for a Blu Ray player.&lt;/b&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;b&gt;Check For Region Code: &lt;/b&gt; [&lt;i&gt;Very Very important if you plan to buy Blu Ray discs from different regions of the world&lt;/i&gt;]&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;Blu Ray Region Encoding&lt;/b&gt; The World is divided into 3 regions A, B &amp;amp; C. The Blu Ray discs coming in the market are region encoded. The Blu Ray player sold will support only the region where it is being sold. So a Blu Ray player purchased from Region C will not gonna play a Blu Ray Disc purchased from Region A or B, until and unless it has got Multi-Region support. :)&lt;br /&gt;Now I'm not really sure if there are Blu Ray player available in market with Multi-Region support.&lt;br /&gt;&lt;br /&gt;&lt;table rules="all" style="border: thin; border-style: solid; border-color: gray"&gt;&lt;tbody&gt;&lt;tr&gt; &lt;th&gt;Region Code&lt;/th&gt; &lt;th&gt;Area&lt;/th&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;A/1&lt;/td&gt; &lt;td&gt;The Americas, and their dependencies, Japan, East Asia (except the People's Republic of China and Mongolia), and Southeast Asia.&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;&lt;td&gt;B/2&lt;/td&gt; &lt;td&gt;Africa, Middle East, Southwest Asia, Europe (except Belarus, Russia and Ukraine), Australia, New Zealand, and their dependencies.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;C/3&lt;/td&gt; &lt;td&gt;Central Asia, East Asia (China and Mongolia only), South Asia, Eastern Europe, and their dependencies.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;DVD Region Encoding: &lt;/b&gt;Don't get confused "Multi-region Blu Ray" with "Multi-Region DVD". For DVD's we have 7 Region codes.&lt;br /&gt;Well there are hacks available to make a player play "Multi-Region" DVD's. But these hacks may not work for Blu Ray discs. Google it and try it at your own risk.&lt;br /&gt;You can find the Region Codes on Blu Ray player manual. In case of Sony's BDP-S370, these code are mentioned at the back side of the player.&lt;br /&gt;&lt;br /&gt;&lt;table rules="all" style="border: thin; border-style: solid; border-color: gray"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th&gt;Region Code&lt;/th&gt; &lt;th&gt;Area&lt;/th&gt; &lt;/tr&gt;&lt;tr&gt;&lt;td&gt;0&lt;/td&gt; &lt;td&gt;Informal term meaning "worldwide". Region 0 is not an official setting; discs that bear the region 0 symbol either have no flag set or have region 1–6 flags set.&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;&lt;td&gt;1&lt;/td&gt; &lt;td&gt;United States, Canada, Bermuda, U.S. territories&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;2&lt;/td&gt; &lt;td&gt;Europe (except Russia, Ukraine, and Belarus), Middle East, Egypt, Japan, South Africa, Swaziland, Lesotho, Greenland&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;3&lt;/td&gt; &lt;td&gt;Southeast Asia, South Korea, Republic of China (Taiwan), Hong Kong, Macau&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;4&lt;/td&gt;&lt;td&gt;Mexico, South America, Australia, New Zealand, Oceania&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;5&lt;/td&gt;&lt;td&gt;Afghanistan, Ukraine, Belarus, Russia, Africa (except Egypt, South Africa, Swaziland, and Lesotho), Central and South Asia, Mongolia, North Korea&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;6&lt;/td&gt;&lt;td&gt;People's Republic of China, Hong Kong&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;7&lt;/td&gt;&lt;td&gt;Reserved for future use (found in use on protected screener copies of MPAA-related DVDs and "media copies" of pre-releases in Asia)&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;8&lt;/td&gt;&lt;td&gt;International venues such as aircraft, cruise ships, etc.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;ALL&lt;/td&gt;&lt;td&gt;Region ALL discs have all 8 flags set, allowing the disc to be played in any locale on any player.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;USB Support: &lt;/b&gt;Check for file system that a Blu Ray supports for the USB disks. Also check for the maximum size of the USB disk that will be supported by the player. This will come handy when you want to play high-def video files which are typically very large in size.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Make sure that you get all your accessories comes with your Blu Ray player. &lt;br /&gt;FYI, Wi-Fi adapter doesn't come with Sony's BDP-S370 Blu Ray player.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;That's It !!!&lt;br /&gt;You might get couple of Blu Ray disk free with your purchase. :)&lt;br /&gt;Opps … forgot to mention, I got two disks free. :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26660993-7488388518371699582?l=mayankgsingh.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mayankgsingh.blogspot.com/feeds/7488388518371699582/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26660993&amp;postID=7488388518371699582' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/7488388518371699582'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/7488388518371699582'/><link rel='alternate' type='text/html' href='http://mayankgsingh.blogspot.com/2010/09/blu-ray-player.html' title='Blu Ray Player'/><author><name>Mayank</name><uri>http://www.blogger.com/profile/02296414032387537182</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://4.bp.blogspot.com/-6qN1dd-Rkso/TyJ57bvquzI/AAAAAAAAP-c/653D-b68f6c/s220/DSC_2303_up.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26660993.post-6314384351674174879</id><published>2010-05-30T09:45:00.007+05:30</published><updated>2010-07-18T09:19:24.851+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Review'/><category scheme='http://www.blogger.com/atom/ns#' term='My Book'/><category scheme='http://www.blogger.com/atom/ns#' term='WD'/><category scheme='http://www.blogger.com/atom/ns#' term='2TB'/><title type='text'>WD My Book World Edition 2TB</title><content type='html'>!!! I've got some space !!!&lt;br /&gt;&lt;br /&gt;WD My Book World Edition 2TB White Light Edition (WDH1NC20000)&lt;br /&gt;Yippeee!!! I got my disk.&lt;br /&gt;&lt;br /&gt;This disk basically a NAS(Network Attached Storage) drive. It comes with a pre-installed Linux. It is a cut down version of Linux. That means Users, file permission groups etc etc basic features of Linux comes into the picture. So you can be pretty sure that only authorized users will be accessing your data. And its pretty good once you have your data on Network.&lt;br /&gt;&lt;br /&gt;As I said Linux, no need to worry to all those who don't have knowledge of Linux. It's has got a pretty decent web interface to control &amp; configure the disk properties. Thanks to the httpd service running on it. :)&lt;br /&gt;&lt;br /&gt;Apart from that it has got a licensed version of Twonky media server. You can configure Twonky media server to share videos, music and pictures. And the same can be accessed by any PC, cellphone or any other device in the Network. Using web interface you can also enable services like NFS, AFP and FTP.&lt;br /&gt;&lt;br /&gt;It has also got iTunes media sharing service running. So iTunes lovers will see this disk under "Sharing" section of iTunes. :)&lt;br /&gt;&lt;br /&gt;Cons:&lt;br /&gt;Although this unit Gigabit LAN capable, the data transfer rate is pretty slow over the network. I got max speed of 1350 kB/s while transferring data from my PC/USB Drive to the disk over the 100Mbps LAN card. &lt;br /&gt;&lt;br /&gt;Initially I thought I didn't configure the disk properly but after going through blogs &amp; forums I got to know that this disk is powered by ARM9 processor running at 200 MHz. Well I'm still not sure that this is the bottle neck in my case. I google on this a bit more and found that this processor can be over clocked to 500MHz. Probabilily this could improve the data transfer rate. But I didn't tried.&lt;br /&gt;&lt;br /&gt;Anyways I got most of data on WD 160 GB USB disk. So I connect my USB disk to the USB port available at the back of the 2TB unit. This basically exposes the USB disk as a network share. To transfer the data logged in to the disk using SSH and fired "cp" command to transfer all my data. And guess what I transferred 50 GB of data in approximately 53 minutes. Pretty impressive...huh !!! ;)&lt;br /&gt;&lt;br /&gt;Now since all my data is a one place I really don't need to do a lot of bulk transfer over the LAN. All that data dumping stuff was a one time task and I'm done with that.&lt;br /&gt;&lt;br /&gt;To summarize, it's a pretty impressive unit to have your data at one place and share it in home with different PC's/devices(I use my cellphone a lot ;) ). With the Linux in place adds data security. Twonky &amp; iTunes software makes this disk a perfect media server and I'm pretty happy with it after backing up my data.&lt;br /&gt;&lt;br /&gt;And special thanks to Mini who brought this for me. :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26660993-6314384351674174879?l=mayankgsingh.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mayankgsingh.blogspot.com/feeds/6314384351674174879/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26660993&amp;postID=6314384351674174879' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/6314384351674174879'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/6314384351674174879'/><link rel='alternate' type='text/html' href='http://mayankgsingh.blogspot.com/2010/05/wd-my-book-world-edition-2tb.html' title='WD My Book World Edition 2TB'/><author><name>Mayank</name><uri>http://www.blogger.com/profile/02296414032387537182</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://4.bp.blogspot.com/-6qN1dd-Rkso/TyJ57bvquzI/AAAAAAAAP-c/653D-b68f6c/s220/DSC_2303_up.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26660993.post-1405727156213733360</id><published>2010-02-23T11:39:00.003+05:30</published><updated>2010-02-23T11:46:20.682+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='RSS'/><title type='text'>RSS - Really Simple Syndication</title><content type='html'>With RSS, it is possible to distribute up-to-date web content from one web site to several other web sites or other applications. RSS has been designed to show selected data.&lt;br /&gt;There are several web sites which provide RSS feeds. A consumer can consume these RSS feeds from multiple web sites and can view a consolidated information in his application. If you are designing your own application and wondering how to consume these RSS feeds, then you are at right spot. &lt;br /&gt;RSS feeds are nothing but XML data, so either you can write your own parser to parse this XML data or you use a third party library to parse it for you.&lt;br /&gt;A RSS feed may look like:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&amp;lt;?xml version="1.0" encoding="ISO-8859-1" ?&amp;gt;&lt;br /&gt;&amp;lt;rss version="2.0"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;channel&amp;gt;&lt;br /&gt;  &amp;lt;title&amp;gt;RSS Test&amp;lt;/title&amp;gt;&lt;br /&gt;  &amp;lt;link&amp;gt;http://www.rsstest.com&amp;lt;/link&amp;gt;&lt;br /&gt;  &amp;lt;description&amp;gt;RSS sample file&amp;lt;/description&amp;gt;&lt;br /&gt;  &amp;lt;item&amp;gt;&lt;br /&gt;    &amp;lt;title&amp;gt;RSS Introduction&amp;lt;/title&amp;gt;&lt;br /&gt;    &amp;lt;link&amp;gt;http://www.rsstest.com/rssintro&amp;lt;/link&amp;gt;&lt;br /&gt;    &amp;lt;description&amp;gt;RSS Introduction&amp;lt;/description&amp;gt;&lt;br /&gt;  &amp;lt;/item&amp;gt;&lt;br /&gt;  &amp;lt;item&amp;gt;&lt;br /&gt;    &amp;lt;title&amp;gt;RSS Java Code&amp;lt;/title&amp;gt;&lt;br /&gt;    &amp;lt;link&amp;gt;http://www.rsstest.com/java&amp;lt;/link&amp;gt;&lt;br /&gt;    &amp;lt;description&amp;gt;How to consume RSS in java&amp;lt;/description&amp;gt;&lt;br /&gt;  &amp;lt;/item&amp;gt;&lt;br /&gt;&amp;lt;/channel&amp;gt;&lt;br /&gt;&amp;lt;/rss&amp;gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;In the following example, I have used &lt;i&gt;informa.jar&lt;/i&gt;. A third party library, as I don't want to get into details of parsing XML.&lt;br /&gt;I have used a feed from discovery site, which will display the top stories from the discovery site.&lt;br /&gt;&lt;p&gt;&lt;code&gt;public class Client {&lt;br /&gt; public static void main(String[] args) {&lt;br /&gt;  Client client = new Client();&lt;br /&gt;  client.readRSS();&lt;br /&gt;  &lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public void readRSS() {&lt;br /&gt;  try {&lt;br /&gt;   ChannelIF channel = FeedParser.parse(new ChannelBuilder(), new URL("http://dsc.discovery.com/news/subjects/animals/xdb/topstories.xml"));&lt;br /&gt;   //Collection feeds = OPMLParser.parse(inpFile);&lt;br /&gt;   &lt;br /&gt;   Collection&lt;ItemIF&gt; collection = channel.getItems();&lt;br /&gt;   Iterator it = collection.iterator();&lt;br /&gt;   ItemIF itemIF;&lt;br /&gt;   while(it.hasNext()) {&lt;br /&gt;    itemIF = (ItemIF)it.next();&lt;br /&gt;&lt;br /&gt;    System.out.println("Title: " + itemIF.getTitle());&lt;br /&gt;    System.out.println("Link: " + itemIF.getLink());&lt;br /&gt;    System.out.println(itemIF.getDate());&lt;br /&gt;    System.out.println("Description: " + itemIF.getDescription());&lt;br /&gt;   }&lt;br /&gt;   &lt;br /&gt;   System.out.println("Title: " + channel.getTitle());&lt;br /&gt;   System.out.println("Copyright: " + channel.getCopyright());&lt;br /&gt;   &lt;br /&gt;   &lt;br /&gt;   &lt;br /&gt;   System.out.println("DONE");&lt;br /&gt;   }&lt;br /&gt;   catch(Exception e){&lt;br /&gt;    e.printStackTrace();&lt;br /&gt;   }&lt;br /&gt; }&lt;br /&gt;}&lt;/code&gt;&lt;/p&gt;That's all.&lt;br /&gt;Enjoy!!! Have Fun !!! :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26660993-1405727156213733360?l=mayankgsingh.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mayankgsingh.blogspot.com/feeds/1405727156213733360/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26660993&amp;postID=1405727156213733360' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/1405727156213733360'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/1405727156213733360'/><link rel='alternate' type='text/html' href='http://mayankgsingh.blogspot.com/2010/02/rss-really-simple-syndication.html' title='RSS - Really Simple Syndication'/><author><name>Mayank</name><uri>http://www.blogger.com/profile/02296414032387537182</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://4.bp.blogspot.com/-6qN1dd-Rkso/TyJ57bvquzI/AAAAAAAAP-c/653D-b68f6c/s220/DSC_2303_up.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26660993.post-1339221778335052501</id><published>2009-10-10T19:46:00.006+05:30</published><updated>2011-08-23T15:14:29.390+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Debug'/><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat'/><title type='text'>Configure debug port in Tomcat 5.5</title><content type='html'>I have installed Tomcat 5.5 using setup.exe. After the installation I get following two executable files in my &lt;i&gt;%TOMCAT_HOME%/bin&lt;/i&gt; directory:&lt;ul&gt;&lt;li&gt;tomcat5.exe - which launches the server.&lt;/li&gt;&lt;li&gt;tomcat5w.exe - which allows you to configure tomcat.&lt;/li&gt;&lt;/ul&gt;Launch &lt;i&gt;tomcat5w.exe&lt;/i&gt; and click on &lt;i&gt;Java&lt;/i&gt; tab. Under java options add the following line: &lt;br /&gt;&lt;br /&gt;&lt;i&gt;-Xrunjdwp:transport=dt_socket,address=8453,server=y,suspend=n&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;where 8453 is your socket number. Now in eclipse or any other IDE you can easily configure options to debug the application.&lt;br /&gt;&lt;br /&gt;I haven't tried this on tomcat's other distribution in which you simple unzip the files for installation. In this case you have to edit &lt;i&gt;catalina.bat&lt;/i&gt; file. That's all information I got from various forums.&lt;br /&gt;&lt;br /&gt;Smile !!! :)&lt;br /&gt;-- Updated 23rd August, 2011--&lt;br /&gt;In case if you have unzipped tomcat or your are on Linux machine, then "tomcat5w.exe" won't work. In that case, instead of starting tomcat with "startup.sh" script, execute the following command.&lt;br /&gt;&lt;i&gt;catalina.bat jpda start&lt;/i&gt;&lt;br /&gt;You can do the same on windows as well. By default your debug port will be 8000.&lt;br /&gt;Thanks.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26660993-1339221778335052501?l=mayankgsingh.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mayankgsingh.blogspot.com/feeds/1339221778335052501/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26660993&amp;postID=1339221778335052501' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/1339221778335052501'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/1339221778335052501'/><link rel='alternate' type='text/html' href='http://mayankgsingh.blogspot.com/2009/10/configure-debug-port-in-tomcat-55.html' title='Configure debug port in Tomcat 5.5'/><author><name>Mayank</name><uri>http://www.blogger.com/profile/02296414032387537182</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://4.bp.blogspot.com/-6qN1dd-Rkso/TyJ57bvquzI/AAAAAAAAP-c/653D-b68f6c/s220/DSC_2303_up.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26660993.post-5683600387719152809</id><published>2009-09-21T12:01:00.004+05:30</published><updated>2009-09-21T12:14:50.646+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='My SQL'/><title type='text'>ERROR 2003: Can't connect to MySQL server (10060)</title><content type='html'>ERROR 2003: Can't connect to MySQL server (10060)&lt;br /&gt;&lt;br /&gt;Well, finally I rectified this error after doing google and research for 3.5 Hours.&lt;br /&gt;&lt;br /&gt;I installed mysql database on my machine and I was trying to access it from the remote machine using MySQL query browser. But it was giving the error. If you are also facing the same problem then here are couple of things you can try.&lt;ul&gt;&lt;br /&gt;&lt;li&gt;If you have antivirus/firewall installed then make sure that it is not blocking traffic for port 3306(default port for mysql).&lt;/li&gt;&lt;br /&gt;&lt;li&gt;I have installed/configured MySQL to run as a service in windows box. If you have the same configuration, then open the Computer Management by &lt;code.Rt. Click on My Computer --&gt; Manage&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;Go to Service under Services And Applicaton.&lt;br /&gt;&lt;br /&gt;Look for mysql service and double click it to check the properties.&lt;br /&gt;&lt;br /&gt;The executable path should be like this: &lt;code&gt;"C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld-nt" --defaults-file="C:\Program Files\MySQL\MySQL Server 5.0\my.ini" MySQL&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Now it uses "my.ini" file for the configuration. Open this file on text editor. Under &lt;code&gt;[mysqld]&lt;/code&gt; section add following line:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;bind-address=0.0.0.0&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;You can give any ip address, if you want to listen only to localhost then you can give 127.0.0.1. The above configuration will listen to all ip addresses.&lt;br /&gt;&lt;br /&gt;If you are on linux machine, then you have to edit &lt;code&gt;/etc/mysql/my.cnf&lt;/code&gt; file.&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;Hope this helps !!!&lt;br /&gt;Enjoy !! :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26660993-5683600387719152809?l=mayankgsingh.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mayankgsingh.blogspot.com/feeds/5683600387719152809/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26660993&amp;postID=5683600387719152809' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/5683600387719152809'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/5683600387719152809'/><link rel='alternate' type='text/html' href='http://mayankgsingh.blogspot.com/2009/09/error-2003-cant-connect-to-mysql-server.html' title='ERROR 2003: Can&apos;t connect to MySQL server (10060)'/><author><name>Mayank</name><uri>http://www.blogger.com/profile/02296414032387537182</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://4.bp.blogspot.com/-6qN1dd-Rkso/TyJ57bvquzI/AAAAAAAAP-c/653D-b68f6c/s220/DSC_2303_up.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26660993.post-8205811327244509732</id><published>2009-06-18T12:46:00.003+05:30</published><updated>2009-06-18T13:35:24.033+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Special characters in web application</title><content type='html'>I've been adding text resources in my application so as to display the web application in differnt languages. The problem I faced was that whenever a special characted comes the browser display's "?". The browser is not able to display the special character inspite of selecting UTF-8 language.&lt;br /&gt;&lt;br /&gt;So I made some changes in the code to handle UTF-8 character set.&lt;br /&gt;&lt;br /&gt;Make sure that all JSP pages have &lt;br /&gt;&lt;code&gt;&amp;lt;%@ page contentType="text/html; charset=UTF-8"%&amp;gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;In case if you are having html pages, use meta tag to add character set information.&lt;br /&gt;&lt;code&gt;&amp;lt;meta http-equiv="Content-Type" content="text/html;charset=utf-8" /&amp;gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Second, Make changes in the server's configuraton file. I am using Sun's web server. So in my &lt;i&gt;sun-web.xml&lt;/i&gt; file I added &lt;code&gt;&amp;lt;parameter-encoding default-charset="UTF-8"/&amp;gt;&lt;/code&gt; to look like&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;sun-web-app&amp;gt;&lt;br /&gt; &amp;lt;parameter-encoding default-charset="UTF-8"/&amp;gt;&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;&amp;lt;/sun-web-app&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;In case of apache tomcat, you have specify &lt;code&gt;URIEncoding&lt;/code&gt; attribute in &lt;code&gt;Connector&lt;/code&gt; tag in &lt;i&gt;server.xml&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;But this is what something server will be handling, and it's in not our hand. To make sure that application uses UTF-8 character set, a filter can bge added to web application.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;import javax.servlet.http.HttpServletRequest;&lt;br /&gt;import javax.servlet.http.HttpServletResponse;&lt;br /&gt; &lt;br /&gt;import javax.servlet.ServletRequest;&lt;br /&gt;import javax.servlet.ServletResponse;&lt;br /&gt;import javax.servlet.ServletException;&lt;br /&gt;import javax.servlet.Filter;&lt;br /&gt;import javax.servlet.FilterConfig;&lt;br /&gt;import javax.servlet.FilterChain;&lt;br /&gt; &lt;br /&gt;import java.io.IOException;&lt;br /&gt; &lt;br /&gt;public class CharacterEncodingFilter implements Filter &lt;br /&gt;{    &lt;br /&gt; &lt;br /&gt; private FilterConfig fc;    &lt;br /&gt; &lt;br /&gt; public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException &lt;br /&gt; {        &lt;br /&gt;  &lt;br /&gt;  HttpServletRequest request = (HttpServletRequest) req;        &lt;br /&gt;  HttpServletResponse response = (HttpServletResponse) res;        &lt;br /&gt;  &lt;br /&gt;  response.setContentType("text/html; charset=UTF-8");        &lt;br /&gt;  request.setCharacterEncoding("UTF8");        &lt;br /&gt;  &lt;br /&gt;  chain.doFilter(request, response);        //do it again, since JSPs will set it to the default        &lt;br /&gt;  &lt;br /&gt;  response.setContentType("text/html; charset=UTF-8");        &lt;br /&gt;  request.setCharacterEncoding("UTF8");    &lt;br /&gt; }        &lt;br /&gt; &lt;br /&gt; public void init(FilterConfig filterConfig) &lt;br /&gt; {        &lt;br /&gt;  &lt;br /&gt;  this.fc = filterConfig;    &lt;br /&gt; }        &lt;br /&gt; &lt;br /&gt; public void destroy() &lt;br /&gt; {        &lt;br /&gt;  &lt;br /&gt;  this.fc = null;    &lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Once you are done writiing the java class, add the filter configuration to the &lt;i&gt;web.xml&lt;/i&gt; file.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;filter&amp;gt;        &lt;br /&gt; &amp;lt;filter-name&amp;gt;CharacterEncodingFilter&amp;lt;/filter-name&amp;gt;        &lt;br /&gt; &amp;lt;filter-class&amp;gt;com.its.struts.action.CharacterEncodingFilter&amp;lt;/filter-class&amp;gt;    &lt;br /&gt;&amp;lt;/filter&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;filter-mapping&amp;gt;        &lt;br /&gt; &amp;lt;filter-name&amp;gt;CharacterEncodingFilter&amp;lt;/filter-name&amp;gt;        &lt;br /&gt; &amp;lt;servlet-name&amp;gt;action&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;&amp;lt;/filter-mapping&amp;gt; &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;That's all !!! :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26660993-8205811327244509732?l=mayankgsingh.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mayankgsingh.blogspot.com/feeds/8205811327244509732/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26660993&amp;postID=8205811327244509732' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/8205811327244509732'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/8205811327244509732'/><link rel='alternate' type='text/html' href='http://mayankgsingh.blogspot.com/2009/06/special-characters-in-web-application.html' title='Special characters in web application'/><author><name>Mayank</name><uri>http://www.blogger.com/profile/02296414032387537182</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://4.bp.blogspot.com/-6qN1dd-Rkso/TyJ57bvquzI/AAAAAAAAP-c/653D-b68f6c/s220/DSC_2303_up.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26660993.post-8822330324680705872</id><published>2009-03-13T21:59:00.004+05:30</published><updated>2009-04-02T09:41:29.287+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Spring'/><title type='text'>Array Binding In Spring</title><content type='html'>Sending data from JSP to controller in easy no matter whether it is string, integer or an array. Problem occurs in displaying JSP page if the data in present in command class and it is an array.&lt;br /&gt;Following is sample JSP code to bind an array of names to the command class in spring. The code will both send and display the data.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&amp;gt;&lt;br /&gt;&amp;lt;%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %&amp;gt;&lt;br /&gt;&amp;lt;%@ taglib prefix="core" uri="http://java.sun.com/jstl/core" %&amp;gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&amp;lt;title&amp;gt;Test&amp;lt;/title&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;form:form commandName="test" method="post" action="welcome.do" &amp;gt;&lt;br /&gt;    &amp;lt;core:set var="flag" value="false" /&amp;gt;&lt;br /&gt;    &amp;lt;!-- Create the n number of name fields if data is present --&amp;gt;&lt;br /&gt;    &amp;lt;core:forEach items="${test.name}" var="n" varStatus="status"&amp;gt;&lt;br /&gt;        &amp;lt;form:input path="name[${status.index}]"  /&amp;gt;&lt;br /&gt;        &amp;lt;core:set var="flag" value="true" /&amp;gt;&lt;br /&gt;    &amp;lt;/core:forEach&amp;gt;&lt;br /&gt;    &amp;lt;!-- If data is not present then create 2(default) name fields --&amp;gt;&lt;br /&gt;    &amp;lt;core:if test="${flag eq false}"&amp;gt;&lt;br /&gt;            &amp;lt;form:input path="name"  /&amp;gt;&lt;br /&gt;            &amp;lt;form:input path="name"  /&amp;gt;&lt;br /&gt;    &amp;lt;/core:if&amp;gt;&lt;br /&gt;    &amp;lt;input type="submit" value="submit" /&amp;gt;&lt;br /&gt;&amp;lt;/form:form&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;In the above example &lt;code&gt;String[] name;&lt;/code&gt; is used in the command class.&lt;br /&gt;That All !!! :)&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26660993-8822330324680705872?l=mayankgsingh.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mayankgsingh.blogspot.com/feeds/8822330324680705872/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26660993&amp;postID=8822330324680705872' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/8822330324680705872'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/8822330324680705872'/><link rel='alternate' type='text/html' href='http://mayankgsingh.blogspot.com/2009/03/array-binding-in-spring.html' title='Array Binding In Spring'/><author><name>Mayank</name><uri>http://www.blogger.com/profile/02296414032387537182</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://4.bp.blogspot.com/-6qN1dd-Rkso/TyJ57bvquzI/AAAAAAAAP-c/653D-b68f6c/s220/DSC_2303_up.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26660993.post-3606013010496626848</id><published>2009-02-28T16:45:00.002+05:30</published><updated>2009-04-02T09:51:39.441+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='XMLParsing'/><title type='text'>XML Parsing</title><content type='html'>There is a high rise in information exchange between application and XML has become the standard. Here is an simple basic XML parsing example which gives an basic idea of fetching information from an XML file.&lt;br /&gt;&lt;br /&gt;The sample XML file:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&amp;lt;?xml version="1.0"?&amp;gt;&lt;br /&gt;&amp;lt;company name="my comapany"&amp;gt;&lt;br /&gt;&amp;lt;employee id="1"&amp;gt;&lt;br /&gt;&amp;lt;name&amp;gt;Mike&amp;lt;/name&amp;gt;&lt;br /&gt;&amp;lt;/employee&amp;gt;&lt;br /&gt;&amp;lt;employee id="2"&amp;gt;&lt;br /&gt;&amp;lt;name&gt;Mark&amp;lt;/name&amp;gt;&lt;br /&gt;&amp;lt;/employee&amp;gt; &amp;lt;/company&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div&gt;&lt;div&gt;Java code to read the XML file:&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; "&gt;package pkg;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;import java.io.File;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;import java.io.IOException;&lt;br /&gt;import javax.xml.parsers.DocumentBuilder;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;import javax.xml.parsers.DocumentBuilderFactory;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;import javax.xml.parsers.ParserConfigurationException;&lt;br /&gt;import org.w3c.dom.Document;import org.w3c.dom.Element;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;import org.w3c.dom.NodeList;import org.xml.sax.SAXException;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;public class XMLReader { &lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;public void readXML(String fileName) throws ParserConfigurationException, SAXException, IOException { &lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;DocumentBuilder documentBuilder = factory.newDocumentBuilder();&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Document document = documentBuilder.parse(new File(fileName));&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;//GET THE ROOT ELEMENT&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Element root = document.getDocumentElement();&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;System.out.println("Root: " + root.getNodeName());&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;System.out.println("Company Name: " + root.getAttribute("name"));&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;//GET THE LIST OF CHILD ELEMENTS UNDER ROOT&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;NodeList employeeList = root.getElementsByTagName("employee");&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;System.out.println("Total employees: " + employeeList.getLength());&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Element employee;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;String name = null, id = null;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;for(int i=0;i&amp;lt;employeeList.getLength();i++) {&lt;employeelist.getlength();i++)&gt;&lt;/employeelist.getlength();i++)&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;employee = (Element)employeeList.item(i);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;//FETCH ID OF EMPLOYEE&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;if(employee.hasAttributes()) {    &lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;id = employee.getAttributes().getNamedItem("id").getNodeValue();&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;//GET NAME OF THE EMPLOYEE   name = employee.getElementsByTagName("name").item(0).getTextContent();&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;System.out.println("Id: " + id + "\tName: " + name);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;pre&gt;&lt;span class="Apple-style-span"   style="  white-space: normal; font-family:Georgia;font-size:16px;"&gt;&lt;div&gt;&lt;employeelist.getlength();i++)&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/employeelist.getlength();i++)&gt;&lt;/div&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia; font-size: 16px; "&gt;Happy parsing !!! :)&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26660993-3606013010496626848?l=mayankgsingh.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mayankgsingh.blogspot.com/feeds/3606013010496626848/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26660993&amp;postID=3606013010496626848' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/3606013010496626848'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/3606013010496626848'/><link rel='alternate' type='text/html' href='http://mayankgsingh.blogspot.com/2009/02/xml-parsing.html' title='XML Parsing'/><author><name>Mayank</name><uri>http://www.blogger.com/profile/02296414032387537182</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://4.bp.blogspot.com/-6qN1dd-Rkso/TyJ57bvquzI/AAAAAAAAP-c/653D-b68f6c/s220/DSC_2303_up.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26660993.post-6040305092354653068</id><published>2008-11-11T22:16:00.007+05:30</published><updated>2009-04-02T09:42:41.261+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Goa'/><category scheme='http://www.blogger.com/atom/ns#' term='Personal'/><title type='text'>Awesome Goa Trip</title><content type='html'>Goa Trip !!! It was amazing !!!&lt;br /&gt;&lt;br /&gt;This was the first time I went for a long trip and it was great.&lt;br /&gt;We were three Soumak, Sunny and me. It was friday, and we all left our offices in hurry to catch train. Thank god the train was late by 20 minutes. We met at the station and we were in highly excited state and a big smile but also there was a little bit of concern that we haven't book the hotel in Goa. But after sometime we forgot that thing and we boarded the train. Here are some pics that I took while traveling.&lt;div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_6Y9P7zH5Xgs/SRm9XYIBvDI/AAAAAAAAJrA/qbcK9ohuVIY/s1600-h/IMG_7369.JPG"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="http://2.bp.blogspot.com/_6Y9P7zH5Xgs/SRm9XYIBvDI/AAAAAAAAJrA/qbcK9ohuVIY/s320/IMG_7369.JPG" border="0" alt="" id="BLOGGER_PHOTO_ID_5267449448497265714" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_6Y9P7zH5Xgs/SRm9XGXH2wI/AAAAAAAAJq4/0btGW_Odpjk/s1600-h/IMG_6452.JPG"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="http://3.bp.blogspot.com/_6Y9P7zH5Xgs/SRm9XGXH2wI/AAAAAAAAJq4/0btGW_Odpjk/s320/IMG_6452.JPG" border="0" alt="" id="BLOGGER_PHOTO_ID_5267449443728743170" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_6Y9P7zH5Xgs/SRm9WuxOUFI/AAAAAAAAJqw/h3RTL8OSpn8/s1600-h/IMG_7359.JPG"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 240px; height: 320px;" src="http://4.bp.blogspot.com/_6Y9P7zH5Xgs/SRm9WuxOUFI/AAAAAAAAJqw/h3RTL8OSpn8/s320/IMG_7359.JPG" border="0" alt="" id="BLOGGER_PHOTO_ID_5267449437395767378" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_6Y9P7zH5Xgs/SRm_NAzlpqI/AAAAAAAAJrI/kGZmJ0vLFvc/s1600-h/IMG_7385.JPG"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="http://1.bp.blogspot.com/_6Y9P7zH5Xgs/SRm_NAzlpqI/AAAAAAAAJrI/kGZmJ0vLFvc/s320/IMG_7385.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5267451469462087330" /&gt;&lt;/a&gt;&lt;br /&gt;I never took out camera in train but I really wanted to click some shots in and of the train and I took some shots, after all train my favorite. I just love to travel by train. As journey begins we also get in form of our masti, &lt;i&gt;raste bhar masti karte gaye&lt;/i&gt;, and finally next morning we reach Madgaon at 6.30 in the morning.&lt;br /&gt;&lt;br /&gt;We decided to stay near beach, so we directly went to Calangute beach by changing couple of busses. And guess what the very first person we met at Calangute solved our all issues that mean we got a decent hotel with a very decent price and bikes to ride. After getting refresh at hotel that too in just couple of hours we were ready to ride to our first destination i.e. Chapora Fort(DCH fort). And we were three and it was perfect. The scenic beauty was amazing, and then I and my camera came into action. he he.&lt;br /&gt;&lt;br /&gt;After this fort we went to Auguda fort. It was also nice. We spent some time at this fort did some masti and came back to Baga beach. We reach there just in time to watch an awesome sunset in the Arabian Sea. It was great. We then had a long walk on the beach. We were so tired that we had our dinner and we came back to hotel. We had a plan for the disc but couldn't execute it.&lt;br /&gt;&lt;br /&gt;But the very next morning we were again ready for the ride. This time we decided to cover South Goa. And we started it all with Baslica Of Bom Jeasus chruch. It was sunday so it was bit crowded. In front of the chruch there was St. Cathaderal Chruch. We just roam in the premises of the chruch and then we went to Shanta Durga temple. It was also nice. That's it enough of temples and churches, now we want to have some fun, so lets go to the Colva beach. Now we saw the parachute up in the air. So me and Soumak went for it. &lt;i&gt;by god hawa me udne ka bhaut mann tha, to socha khwaish puri kar he leni chaheye&lt;/i&gt;. We went for it and enjoyed the glide. Soumak and Sunny enjoyed the bath in sea and in the mean while I clicked some amazing shots at Colva beach. That's it now we decided to go to Dona Paula. We heard that it's a good point to see sunset. Thats it we were again on the run to reach Dona Paula before sunset as it was already 1630 Hrs. The sunset from the view point was spectacular. We spent an approximately an hour at the This is not it. We had a plan for the Cruise also :). So went to the cruise. They have arrangement for 3 regional dances and disc. It was great. That's all for the Sunday evening. We came back and slept.&lt;br /&gt;Next morning we had to leave by 1200 Hrs so in the morning we spent some time on Anjuna, Vagator and Calangute Beach.&lt;br /&gt;&lt;br /&gt;That's all. We just roamed and roamed in goa for 2.5 days and enjoyed a lot.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26660993-6040305092354653068?l=mayankgsingh.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mayankgsingh.blogspot.com/feeds/6040305092354653068/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26660993&amp;postID=6040305092354653068' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/6040305092354653068'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/6040305092354653068'/><link rel='alternate' type='text/html' href='http://mayankgsingh.blogspot.com/2008/11/awesome-goa-trip.html' title='Awesome Goa Trip'/><author><name>Mayank</name><uri>http://www.blogger.com/profile/02296414032387537182</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://4.bp.blogspot.com/-6qN1dd-Rkso/TyJ57bvquzI/AAAAAAAAP-c/653D-b68f6c/s220/DSC_2303_up.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_6Y9P7zH5Xgs/SRm9XYIBvDI/AAAAAAAAJrA/qbcK9ohuVIY/s72-c/IMG_7369.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26660993.post-3823086975268468800</id><published>2008-07-24T17:11:00.003+05:30</published><updated>2009-04-02T09:43:39.490+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Inspiration'/><title type='text'>A Speech By Chetan Bhagat</title><content type='html'>I came across this mail, a speech by Chetan Bhagat.&lt;br /&gt;Couldn't stop myself from posting it. Enjoy !!!&lt;br /&gt;&lt;br /&gt;Good Morning everyone and thank you for giving me this chance to speak&lt;br /&gt;to you. This day is about you. You, who have come to this college,&lt;br /&gt;leaving the comfort of your homes (or in some cases discomfort), to&lt;br /&gt;become something in your life. I am sure you are excited. There are&lt;br /&gt;few days in human life when one is truly elated.  The first day in&lt;br /&gt;college is one of them.  When you were getting ready today, you felt a&lt;br /&gt;tingling in your stomach. What would the auditorium be like, what&lt;br /&gt;would the teachers be like, who are my new classmates - there is so&lt;br /&gt;much to be curious about. I call this excitement, the spark within you&lt;br /&gt;that makes you feel truly alive today. Today I am going to talk about&lt;br /&gt;keeping the spark shining. Or to put it another way, how to be happy&lt;br /&gt;most, if not all the time.&lt;br /&gt;&lt;br /&gt;Where do these sparks start? I think we are born with them. My 3-year&lt;br /&gt;old twin boys  have a million sparks. A little Spiderman toy can make&lt;br /&gt;them jump on the bed. They get thrills from creaky swings in the park.&lt;br /&gt;A story from daddy gets them excited. They do a daily countdown for&lt;br /&gt;birthday party – several months in advance – just for the day they&lt;br /&gt;will cut their own birthday cake.&lt;br /&gt;&lt;br /&gt;I see students like you, and I still see some sparks. But when  I see&lt;br /&gt;older people,  the spark is difficult to find. That means as we age,&lt;br /&gt;the spark fades. People whose spark has faded too much are dull,&lt;br /&gt;dejected, aimless and bitter. Remember Kareena in the first half of&lt;br /&gt;Jab We Met vs the second half? That is what happens when the spark is&lt;br /&gt;lost.   So how to save the spark?&lt;br /&gt;&lt;br /&gt;Imagine the spark to be a lamp's flame. The first aspect is nurturing&lt;br /&gt;- to give your spark the fuel, continuously. The second is to guard&lt;br /&gt;against storms.&lt;br /&gt;&lt;br /&gt;To nurture, always have goals. It is human nature to strive, improve&lt;br /&gt;and achieve full potential. In fact, that is success. It is what is&lt;br /&gt;possible for you. It isn't any external measure - a certain cost to&lt;br /&gt;company pay package, a particular car or house.&lt;br /&gt;&lt;br /&gt;Most of us are from middle class families. To us, having material&lt;br /&gt;landmarks is success and rightly so. When you have grown up where&lt;br /&gt;money constraints force everyday choices, financial freedom is a big&lt;br /&gt;achievement.&lt;br /&gt;&lt;br /&gt;But it isn't the purpose of life. If that was the case, Mr Ambani&lt;br /&gt;would not show up for work. Shah Rukh Khan would stay at home and not&lt;br /&gt;dance anymore. Steve Jobs won't be working hard to make a better&lt;br /&gt;iPhone, as he sold Pixar for billions of dollars already. Why do they&lt;br /&gt;do it? What makes them come to work everyday?&lt;br /&gt;&lt;br /&gt;They do it because it makes them happy. They do it because it makes&lt;br /&gt;them feel alive. Just getting better from current levels feels good.&lt;br /&gt;If you study hard, you can improve your rank. If you make an effort to&lt;br /&gt;interact with people, you will do better in interviews. If you&lt;br /&gt;practice, your cricket will get better. You may also know that you&lt;br /&gt;cannot become Tendulkar, yet. But you can get to the next level.&lt;br /&gt;Striving for that next level is important.&lt;br /&gt;&lt;br /&gt;Nature designed  with a random set of genes and circumstances in which&lt;br /&gt;we were born. To be happy, we have to accept it and make the most of&lt;br /&gt;nature's design. Are you? Goals will help you do that.&lt;br /&gt;&lt;br /&gt;I must add, don't just have career or academic goals. Set goals to&lt;br /&gt;give you a balanced, successful life. I use the word balanced before&lt;br /&gt;successful. Balanced means ensuring your health, relationships, mental&lt;br /&gt;peace are all in good order.&lt;br /&gt;&lt;br /&gt;There is no point of getting a promotion on the day of your breakup.&lt;br /&gt;There is no fun in driving a car if your back hurts. Shopping is not&lt;br /&gt;enjoyable if your mind is full of tensions.&lt;br /&gt;&lt;br /&gt;You must have read some quotes -  Life is a  tough race, it is a&lt;br /&gt;marathon or whatever. No, from what I have seen so far, life is one of&lt;br /&gt;those races in nursery school. Where you have to run with a marble in&lt;br /&gt;a spoon kept in your mouth. If the marble falls, there is no point&lt;br /&gt;coming first. Same with life, where health and relationships are the&lt;br /&gt;marble. Your striving is only worth it if there is harmony in your&lt;br /&gt;life. Else, you may achieve the success, but this spark, this feeling&lt;br /&gt;of being excited and alive, will start to die.&lt;br /&gt;&lt;br /&gt;One last thing about nurturing the spark - don't take life seriously.&lt;br /&gt;One of my yoga teachers used to make students laugh during classes.&lt;br /&gt;One student asked him if these jokes would take away something from&lt;br /&gt;the yoga practice. The teacher said  - don't be serious, be sincere.&lt;br /&gt;This quote has defined my work ever since. Whether its my writing, my&lt;br /&gt;job, my relationships or any of my goals. I get thousands of opinions&lt;br /&gt;on my writing everyday. There is heaps of praise, there is intense&lt;br /&gt;criticism. If I take it all seriously, how will I write? Or rather,&lt;br /&gt;how will I live? Life is not to be taken seriously, as we are really&lt;br /&gt;temporary here. We are like a pre-paid card with limited validity. If&lt;br /&gt;we are lucky, we may last another 50 years. And 50 years is just 2,500&lt;br /&gt;weekends. Do we really need to get so worked up? It's ok, bunk a few&lt;br /&gt;classes, goof up a few interviews, fall in love. We are people, not&lt;br /&gt;programmed devices.&lt;br /&gt;&lt;br /&gt;I've told you three things - reasonable goals, balance and not taking&lt;br /&gt;it too seriously that will nurture the spark. However, there are four&lt;br /&gt;storms in life that will threaten to completely put out the flame.&lt;br /&gt;These must be guarded against. These are disappointment, frustration,&lt;br /&gt;unfairness and loneliness of purpose.&lt;br /&gt;&lt;br /&gt;Disappointment will come when your effort does not give you the&lt;br /&gt;expected return. If things don't go as planned or if you face failure.&lt;br /&gt;Failure is extremely difficult to handle, but those that do come out&lt;br /&gt;stronger. What did this failure teach me? is the question you will&lt;br /&gt;need to ask. You will feel miserable. You will want to quit, like I&lt;br /&gt;wanted to when nine publishers rejected my first book. Some IITians&lt;br /&gt;kill themselves over low grades – how silly is that? But that is how&lt;br /&gt;much failure can hurt you.&lt;br /&gt;&lt;br /&gt;But it's life. If challenges could always be overcome, they would&lt;br /&gt;cease to be a challenge. And remember - if you are failing at&lt;br /&gt;something, that means you are at your limit or potential. And that's&lt;br /&gt;where you want to be.&lt;br /&gt;&lt;br /&gt;Disappointment's cousin is  frustration, the second storm.  Have you&lt;br /&gt;ever been frustrated? It happens when things are stuck. This is&lt;br /&gt;especially relevant in India. From traffic jams to getting that job&lt;br /&gt;you deserve, sometimes things take so long that you don't know if you&lt;br /&gt;chose the right goal. After books, I set the goal of writing for&lt;br /&gt;Bollywood, as I thought they needed writers. I am called extremely&lt;br /&gt;lucky, but it took me five years to get close to  a release.&lt;br /&gt;&lt;br /&gt;Frustration saps excitement, and turns your initial energy into&lt;br /&gt;something negative, making you a bitter person. How did I deal with&lt;br /&gt;it? A realistic assessment of the time involved – movies take a long&lt;br /&gt;time to make even though they are watched quickly, seeking a certain&lt;br /&gt;enjoyment in the process rather than the end result – at least I was&lt;br /&gt;learning how to write scripts  , having a side plan – I had my third&lt;br /&gt;book to write and even something as simple as pleasurable distractions&lt;br /&gt;in your life  - friends, food, travel can help you overcome it.&lt;br /&gt;Remember, nothing is to be taken seriously. Frustration is a sign&lt;br /&gt;somewhere, you took it too seriously.&lt;br /&gt;&lt;br /&gt;Unfairness - this is hardest to deal with, but unfortunately that is&lt;br /&gt;how our country works. People with connections, rich dads, beautiful&lt;br /&gt;faces, pedigree find it easier to make it – not just in Bollywood, but&lt;br /&gt;everywhere. And sometimes it is just plain luck. There are so few&lt;br /&gt;opportunities in India, so many stars need to be aligned for you to&lt;br /&gt;make it happen. Merit and hard work is not always linked to&lt;br /&gt;achievement in the short term, but the long term correlation is high,&lt;br /&gt;and ultimately things do work out. But realize, there will be some&lt;br /&gt;people luckier than you.&lt;br /&gt;&lt;br /&gt;In fact, to have an opportunity to go to college and understand this&lt;br /&gt;speech in English means you are pretty darn lucky by Indian standards.&lt;br /&gt;Let's be grateful for what we have and get the strength to accept what&lt;br /&gt;we don't. I have so much love from my readers that other writers&lt;br /&gt;cannot even imagine it. However, I don't get literary praise. It's ok.&lt;br /&gt;I don't look like Aishwarya Rai, but I have two boys who I think are&lt;br /&gt;more beautiful than her. It's ok. Don't let unfairness kill your&lt;br /&gt;spark.&lt;br /&gt;&lt;br /&gt;Finally, the last point that can kill your spark is isolation. As you&lt;br /&gt;grow older you will realize you are unique. When you are little, all&lt;br /&gt;kids want Ice cream and Spiderman. As you grow older to college, you&lt;br /&gt;still are a lot like your friends. But ten years later and you realize&lt;br /&gt;you are unique. What you want, what you believe in, what makes you&lt;br /&gt;feel, may be different from even the people closest to you. This can&lt;br /&gt;create conflict as your goals may not match with others. . And you may&lt;br /&gt;drop some of them. Basketball captains in college invariably stop&lt;br /&gt;playing basketball by the time they have their second child. They give&lt;br /&gt;up something that meant so much to them. They do it for their family.&lt;br /&gt;But in doing that, the spark dies. Never, ever make that compromise.&lt;br /&gt;Love yourself first, and then others.&lt;br /&gt;&lt;br /&gt;There you go. I've told you the four thunderstorms - disappointment,&lt;br /&gt;frustration, unfairness and isolation. You cannot avoid them, as like&lt;br /&gt;the monsoon they will come into your life at regular intervals. You&lt;br /&gt;just need to keep the raincoat handy to not let the spark die.&lt;br /&gt;&lt;br /&gt;I welcome you again to the most wonderful  years of your life. If&lt;br /&gt;someone gave me the choice to go back in time, I will surely choose&lt;br /&gt;college. But I also hope that ten years later as well, you eyes will&lt;br /&gt;shine the same way as they do today. That you will Keep the Spark&lt;br /&gt;alive, not only through college, but through the next 2,500 weekends.&lt;br /&gt;And I hope not just you, but my whole country will keep that spark&lt;br /&gt;alive, as we really need it now more than any moment in history. And&lt;br /&gt;there is something cool about saying - I come from the land of a&lt;br /&gt;billion sparks.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26660993-3823086975268468800?l=mayankgsingh.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mayankgsingh.blogspot.com/feeds/3823086975268468800/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26660993&amp;postID=3823086975268468800' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/3823086975268468800'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/3823086975268468800'/><link rel='alternate' type='text/html' href='http://mayankgsingh.blogspot.com/2008/07/speech-by-chetan-bhagat.html' title='A Speech By Chetan Bhagat'/><author><name>Mayank</name><uri>http://www.blogger.com/profile/02296414032387537182</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://4.bp.blogspot.com/-6qN1dd-Rkso/TyJ57bvquzI/AAAAAAAAP-c/653D-b68f6c/s220/DSC_2303_up.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26660993.post-7432920254355957420</id><published>2008-05-19T23:38:00.003+05:30</published><updated>2009-04-02T09:44:06.617+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Personal'/><title type='text'>A good Sunday</title><content type='html'>Well I'm back for self; after a long time.&lt;br /&gt;So a lot of new since last post. Most importantly I made a switch and change the place, both are good and I'm happy with both. :)&lt;br /&gt;&lt;br /&gt;Well last Sunday I met Supriet and Neeraj. My school friends. We were all together in 7th Std., KV 2 Jalahalli, Bangalore. I had a lot of fun with both of these characters. Well Supriet is kindda all rounder guy. Very good in studies infact a rank holder in class. He is good at sports, man i still can't forget the way he hit the sixes in my over. Well about Neeraj and me, we both were average. Niether holding a rank when it comes to studies nor at cricket. Yeah but we did all sort non-sense things in the class. Neeraj and me played all chapri kindda games and we were almost masters in those games.&lt;br /&gt;&lt;br /&gt;So coming back to the story, I was with neeraj on his way to his place, suddenly Neeraj told me, a few blocks before his house, you see that house, that's where the Supriet is staying. I got so excited, I didn't even looked at the watch nor think for a second, I just accelerated my bike and straight away stop at in front of the supriet's house. I rang the bell, aunty opened the door and I asked, "Is Supriet at home??", aunty said yes. Now one thing I did was that I didn't tell my name to aunty. Supriet walked in the room, as he was still sleeping, rubbing is eyes and he just looked at me for about 3 seconds and without any mistake he said my name. Mannnn I was so happy to see him. We met after 12 years. We just started taking and we were like talking talking and talking and time just passed. I was with him for over 2.5 hours. I wish I could stay for some more time but I had to come back home.&lt;br /&gt;&lt;br /&gt;Anyways I'll go and meet him again as soon as possible.&lt;br /&gt;Ohh one more thing I drove approximately 60-70 km with in city. I just enjoyed the ride. :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26660993-7432920254355957420?l=mayankgsingh.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mayankgsingh.blogspot.com/feeds/7432920254355957420/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26660993&amp;postID=7432920254355957420' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/7432920254355957420'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/7432920254355957420'/><link rel='alternate' type='text/html' href='http://mayankgsingh.blogspot.com/2008/05/good-sunday.html' title='A good Sunday'/><author><name>Mayank</name><uri>http://www.blogger.com/profile/02296414032387537182</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://4.bp.blogspot.com/-6qN1dd-Rkso/TyJ57bvquzI/AAAAAAAAP-c/653D-b68f6c/s220/DSC_2303_up.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26660993.post-2310535301093907588</id><published>2007-06-08T11:27:00.001+05:30</published><updated>2009-04-02T09:44:24.997+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Personal'/><title type='text'>Numb !!!</title><content type='html'>Numb - that's what my gtalk status message is !&lt;br /&gt;&lt;br /&gt;Friends ask, "Numb ??" and I reply, "Yeah...Numb !!"&lt;br /&gt;I never set these kind of status message before, I did't even think of putting it before. The word just came in mind and I just set it. I thought about it later when friends started asking, "why numb ??". The first thing I realise when I gave a thought is that, I was just better. It feels good. I don't know why this feeling is there but its just there. It might be just because of the last month's nonsense, which I faced, and it will not gonna effect me anymore if it happens again. That nonsense was horrible, I was just fighting against my own emotions. &lt;br /&gt;NUMB-nothing like that effects me anymore, no matter what happens good or bad, it's fine with me. Hope everything will be fine soon, just the way it was before. Till then I'm enjoying what is around...  ;-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26660993-2310535301093907588?l=mayankgsingh.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mayankgsingh.blogspot.com/feeds/2310535301093907588/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26660993&amp;postID=2310535301093907588' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/2310535301093907588'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/2310535301093907588'/><link rel='alternate' type='text/html' href='http://mayankgsingh.blogspot.com/2007/06/numb.html' title='Numb !!!'/><author><name>Mayank</name><uri>http://www.blogger.com/profile/02296414032387537182</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://4.bp.blogspot.com/-6qN1dd-Rkso/TyJ57bvquzI/AAAAAAAAP-c/653D-b68f6c/s220/DSC_2303_up.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26660993.post-116350396099548955</id><published>2006-11-14T16:42:00.001+05:30</published><updated>2009-04-02T09:46:55.901+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Info'/><title type='text'>Want to sing...</title><content type='html'>Ah ha!  So finally after a long time I got something interesting to do...&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;I remember last time when I started RnD work on decoding MP3 file...uff!!! that was so frustating. I banged my head for around 5 days continously, but all in vain, except that I learn to read at least ID3 Tag Information. Atleast I got something...&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;I have been to mumbai last weekend, the trip was awesome, enjoyed a lot. Tonnes of thanks to my fosla friends in Mumbai and Gyanu. There I came across an article on Ogg Vorbis another audio file format equivalent to MP3 files. The most interesting thing is that it is open source where as MP3 is patented that means you have to pay but this one is totally free for both commercial and non-commercial use. The compression ratio is also high. Good naaa  ;-) &lt;br /&gt;   &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Hope my code will sing this format.  :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26660993-116350396099548955?l=mayankgsingh.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mayankgsingh.blogspot.com/feeds/116350396099548955/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26660993&amp;postID=116350396099548955' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/116350396099548955'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/116350396099548955'/><link rel='alternate' type='text/html' href='http://mayankgsingh.blogspot.com/2006/11/want-to-sing.html' title='Want to sing...'/><author><name>Mayank</name><uri>http://www.blogger.com/profile/02296414032387537182</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://4.bp.blogspot.com/-6qN1dd-Rkso/TyJ57bvquzI/AAAAAAAAP-c/653D-b68f6c/s220/DSC_2303_up.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26660993.post-116012838649093370</id><published>2006-10-06T15:21:00.001+05:30</published><updated>2009-04-02T09:48:06.707+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Connection Pooling'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Pool connection</title><content type='html'>Here is a quick way to make a connection pool...&lt;ol start="a"&gt;&lt;li&gt;Get the jar file, that will be specific to the database to which you want to connect and place it in the &lt;i&gt;/WEB-INF/lib&lt;/i&gt; folder. &lt;/li&gt;&lt;br /&gt;&lt;li&gt;And edit &lt;i&gt;/META-INF/context.xml&lt;/i&gt;...&lt;br /&gt;&lt;code&gt;&amp;lt;Context reloadable="true"&amp;gt;&lt;br /&gt;....&lt;br /&gt;&amp;lt;Resource&lt;br /&gt;  name    =  "jdbc/dbtest"&lt;br /&gt;  auth    = "Container"&lt;br /&gt;  type    = "javax.sql.DataSource"&lt;br /&gt;  factory   = "org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"&lt;br /&gt;  driverClassName  = "org.postgresql.Driver"&lt;br /&gt;  url   = "jdbc:postgresql://IPAddress:port/databasename"&lt;br /&gt;  username   = "root"&lt;br /&gt;  password  = "root"&lt;br /&gt;  maxActive  = "5"&lt;br /&gt;  initialSize  = "3"&lt;br /&gt;  maxIdle   = "2"&lt;br /&gt;  maxWait   = "10000"&lt;br /&gt;  removeAbandoned  = "true"&lt;br /&gt;  removeAbandonedTimeout = "60"&lt;br /&gt;  logAbandoned  = "true"&lt;br /&gt; /&amp;gt;&lt;br /&gt;....&lt;br /&gt;&amp;lt;/Context&amp;gt;&lt;/code&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Java code to get connection from the pool...&lt;br /&gt;&lt;code&gt;InitialContext initCtx = new InitialContext();&lt;br /&gt; Context ctx = (Context) initCtx.lookup("java:comp/env");&lt;br /&gt; DataSource ds = (DataSource) ctx.lookup("jdbc/dbtest");&lt;br /&gt; conn = ds.getConnection();&lt;/code&gt;&lt;/li&gt;&lt;/ol&gt;That's it. Start the tomcat server and launch the application...&lt;br /&gt;Here are the details of the attributes used in xml file.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-weight:bold;"&gt;Name:&lt;/span&gt; The java:comp/env prefix is the name of the JNDI context for the component. This is used in the Java code. The jdbc/dbtest string is the JNDI name for the resource reference. The JNDI names for JDBC DataSource objects are stored in the java:comp/env/jdbc subcontext.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-weight:bold;"&gt;auth:&lt;/span&gt;  Authration will be done by container. I don't know much about this. Will update soon.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-weight:bold;"&gt;driverClassName:&lt;/span&gt; Fully qualified Java class name of the JDBC driver to be used.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-weight:bold;"&gt;url:&lt;/span&gt; Connection URL to be passed to JDBC driver.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-weight:bold;"&gt;username:&lt;/span&gt; Database login username.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-weight:bold;"&gt;password:&lt;/span&gt; Database login password.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-weight:bold;"&gt;maxActive:&lt;/span&gt; (Default: 8) The maximum number of active instances that can be allocated from this pool at the same time.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-weight:bold;"&gt;maxIdle:&lt;/span&gt; (Default: 8) The maximum number of connections that can sit idle in this pool at the same time.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-weight:bold;"&gt;maxWait:&lt;/span&gt; (Deafult: indefinitely) The maximum number of milliseconds that the pool will wait (when there are no available connections) for a connection to be returned before throwing an exception.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-weight:bold;"&gt;initialSize:&lt;/span&gt; (Default: 0) The initial size of the pool.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-weight:bold;"&gt;removeAbandoned:&lt;/span&gt; (Default: false) Flag to remove abandoned connections if they exceed the removeAbandonedTimout. If set to true a connection is considered abandoned and eligible for removal if it has been idle longer than the &lt;span style="font-style:italic;"&gt;removeAbandonedTimeout&lt;/span&gt;. Setting this to true can recover db connections from poorly written applications which fail to close a connection.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-weight:bold;"&gt;removeAbandonedTimeout:&lt;/span&gt; (Default 300) Timeout in seconds before an abandoned connection can be removed.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-weight:bold;"&gt;logAbandoned:&lt;/span&gt; (Default: false) Flag to log stack traces for application code which abandoned a Statement or Connection.&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;&lt;i&gt;Note: For more details check commons-dbcp documentation.&lt;/i&gt;&lt;br&gt;Thanks &lt;br /&gt;&lt;span style="font-weight:bold;"&gt;E ñ j Ô ÿ !!!&lt;/span&gt;&lt;span style="font-weight:bold;"&gt; iN D &lt;br /&gt;p&lt;/span&gt; &lt;b&gt;&lt;i&gt;0 o&lt;/i&gt;&lt;/b&gt; &lt;span style="font-weight:bold;"&gt;l&lt;/span&gt; &lt;br /&gt;:-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26660993-116012838649093370?l=mayankgsingh.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mayankgsingh.blogspot.com/feeds/116012838649093370/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26660993&amp;postID=116012838649093370' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/116012838649093370'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/116012838649093370'/><link rel='alternate' type='text/html' href='http://mayankgsingh.blogspot.com/2006/10/pool-connection.html' title='Pool connection'/><author><name>Mayank</name><uri>http://www.blogger.com/profile/02296414032387537182</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://4.bp.blogspot.com/-6qN1dd-Rkso/TyJ57bvquzI/AAAAAAAAP-c/653D-b68f6c/s220/DSC_2303_up.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26660993.post-115856779112444148</id><published>2006-09-18T13:44:00.001+05:30</published><updated>2009-04-02T09:48:50.218+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat SSL'/><title type='text'>Enabling SSL in Tomcat</title><content type='html'>I have done this in windows, didn’t tried this on Linux machine.&lt;br /&gt;Its easy and simple, just follow these steps:&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;First we will need to generate a keystore file, containing a self-signed certificate. Execute the following command on the prompt&lt;br /&gt;&lt;code style="font-size: medium"&gt;&lt;br /&gt;%JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;li&gt;Open file &lt;span style="font-weight:bold;"&gt;&amp;lt;tomcat-home-dir&amp;gt;\conf\server.xml&lt;/span&gt;. &lt;br /&gt;&lt;li&gt;Find and uncomment the following code:&lt;br /&gt;&lt;code style="font-size: medium"&gt;&lt;br /&gt;&amp;lt;Connector port="8443" &lt;br /&gt;               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"&lt;br /&gt;               enableLookups="false" disableUploadTimeout="true"&lt;br /&gt;               acceptCount="100" debug="0" scheme="https" secure="true"&lt;br /&gt;               clientAuth="false" sslProtocol="SSL" /&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;li&gt; Change the value of the port if you need.&lt;br /&gt;&lt;li&gt; In this &lt;span style="font-weight:bold;"&gt;clientAuth&lt;/span&gt; is set to &lt;span style="font-weight:bold;"&gt;false&lt;/span&gt;. Change its value to &lt;span style="font-weight:bold;"&gt;true&lt;/span&gt; if you want client authentication. In this case if client authentication fails then it won’t let you to proceed. Set it then it to &lt;span style="font-weight:bold;"&gt;want&lt;/span&gt; if you you want to proceed even if authentication fails.&lt;br /&gt;&lt;li&gt; If the &lt;span style="font-weight:bold;"&gt;sslProtocol&lt;/span&gt; is set to &lt;span style="font-weight:bold;"&gt;TLS&lt;/span&gt; then set it to &lt;span style="font-weight:bold;"&gt;SSL&lt;/span&gt;. TLS is an IBM’s implementation and is not compatible with some browsers.&lt;br /&gt;&lt;li&gt; Now try opening &lt;a href="https://localhost:8443" target="_blank"&gt;https://localhost:8443&lt;/a&gt;. It should display the tomcat’s home page. If it is not installed, try running some other application that you have deployed with &lt;span style="font-weight:bold;"&gt;https&lt;/span&gt;.&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;For more details you can view the SSL documentation that comes with the tomcat on your local machine or you can logon to the website &lt;a href="http://localhost:8080/tomcat-docs/ssl-howto.html" target="_blank"&gt;http://localhost:8080/tomcat-docs/ssl-howto.html&lt;/a&gt;.&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;b&gt;E &amp;ntilde; j &amp;Ocirc; &amp;yuml; !!!&lt;/b&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26660993-115856779112444148?l=mayankgsingh.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mayankgsingh.blogspot.com/feeds/115856779112444148/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26660993&amp;postID=115856779112444148' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/115856779112444148'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/115856779112444148'/><link rel='alternate' type='text/html' href='http://mayankgsingh.blogspot.com/2006/09/enabling-ssl-in-tomcat.html' title='Enabling SSL in Tomcat'/><author><name>Mayank</name><uri>http://www.blogger.com/profile/02296414032387537182</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://4.bp.blogspot.com/-6qN1dd-Rkso/TyJ57bvquzI/AAAAAAAAP-c/653D-b68f6c/s220/DSC_2303_up.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26660993.post-114828721703794570</id><published>2006-05-22T14:02:00.001+05:30</published><updated>2009-04-02T09:49:06.131+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Personal'/><title type='text'>I never did this before...</title><content type='html'>Yes, I have never done this before.... &lt;br /&gt;&lt;br /&gt;March In Protest Rally !!! &lt;br /&gt;&lt;br /&gt;    It was 21st of May 2006, I wake up late around 0900 Hrs, and I was ready after having bath. I was hungry, and just getting ready to go out to have breakfast, and my phone ranged. That was a missed call from Swati. The clock was 0945Hrs. &lt;br /&gt;I thought came to my mind, this girl will not gonna stop, she will definitely join rally. I reached at om at 1000 Hrs. The sun was shining high up in the sky and it was bit hot. My friends were waiting for all to gather. I was not expecting from them, that they will gonna join rally. At around 1020 Hrs we left for Pune University, from where the rally is going to start. &lt;br /&gt;    When we reached there were around 150-200 protestors and police. &lt;br /&gt;Suddenly a FOSLA comment came "Ye rally Policewale nikal rahe hain ki students, kyunki yahan students se jyada to policewale hain". We started laughing... &lt;br /&gt;    The rally started at around 1120 Hrs. We came to know that this is a peace rally; you cannot shout slogans and all. For next 15-20 minutes we were clapping. Then suddenly at the back people started shouting slogans. And all get energized. Now once it started, who could stop easily. Then the students who were leading/managing the rally asked them not shout slogans. In between the rally we got chart papers and sketch, and we also raised our banners. Then as the rally proceeds, some more people joined the rally. And rally peacefully moves forward with shouting slogans/singing song Hum honge kamiyaab ek din... and Oye hoye tune... of Rang De Basanti after every 5-10 minutes. The rally is about to reach it's destination i.e. corporation, we passes by Congress Bhavan. Energy level of crowd was at the peak at that time. Each and everyone was shouting and showing banners to people working there at that time. &lt;br /&gt;I really enjoyed that...because I never did that before. &lt;br /&gt;After that within 5 minutes we reached at corporation gate and dispersed. &lt;br /&gt;It was 1330 Hrs and we were really exhausted and hungry and came had our lunch at Delhi Kitchen. After 5 minutes Swati, Vishal and Jassi came. They were in a mood to join the second rally that was from SNDT College to Sambhaji Park. &lt;br /&gt;    I was exhausted, but after lunch I told them that I would also join. But that was supposed to start at 1600 Hrs. Then we went to Vishal's place to take rest. &lt;br /&gt;Now I was totally new company, except Swati. Vishal and Jassi were almost new to me. &lt;br /&gt;After sometime one of their friend Pallavi came , sweet and simple girl, she was going for her SCDL exam. She was not feeling well because of stone problem. So Jassi went with her to the college, but after some they both came back, as she was having severe pain. &lt;br /&gt;After sometime their roommate Anurag also came at room. Jassi was saying some or the other thing to Anurag and we all were laughing. He was after him like anything. &lt;br /&gt;    It was around 1600 Hrs, and Swati started forcing Vishal and me to join rally. But Vishal and I were really tired. And we started acting that we don't have to go. But she didn’t stop, finally at 1630 Hrs we left Vishal's place, had tea and we were at SNDT college in 15 minutes. &lt;br /&gt;    When we reached there, we were happy after looking at the strength. There were around 800-1000 students. &lt;br /&gt;    The rally started at around 1700 Hrs. And we joined, this one was really a peaceful rally, no slogans nothing. We just marched to the Sambhaji Park. After that we were asked to disperse. Then we rest at the bench in Sambhaji Park only, had bhel, then milkshakes at FC Road. It was around 1930 Hrs, when we thought that we should take dinner and then go home. Then Swati and Jassi called Anurag and Jassi for dinner plan. After 15-20 minutes we were at Vishal's place as there was no plan. &lt;br /&gt;Pallavi was not fine, but she was feeling better after taking pills. And Jassi was again in action with his naughty face. &lt;br /&gt;We had dinner around 2030 Hrs and after that icecream. And we were back to home after some chat.&lt;br /&gt;&lt;br /&gt;Huh!!! On this day I really squeezed out my energy.&lt;br /&gt;&lt;br /&gt;Lets see what happens to this quota !&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26660993-114828721703794570?l=mayankgsingh.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mayankgsingh.blogspot.com/feeds/114828721703794570/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26660993&amp;postID=114828721703794570' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/114828721703794570'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/114828721703794570'/><link rel='alternate' type='text/html' href='http://mayankgsingh.blogspot.com/2006/05/i-never-did-this-before.html' title='I never did this before...'/><author><name>Mayank</name><uri>http://www.blogger.com/profile/02296414032387537182</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://4.bp.blogspot.com/-6qN1dd-Rkso/TyJ57bvquzI/AAAAAAAAP-c/653D-b68f6c/s220/DSC_2303_up.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26660993.post-114596265706654295</id><published>2006-04-25T15:48:00.001+05:30</published><updated>2009-04-02T09:49:59.572+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Personal'/><title type='text'>Another Boring Day</title><content type='html'>&lt;span &gt;It's end of April, and I joined this company in January as a trainee.&lt;br /&gt;We got assignments in our traning, that we have finished in 2.5 months.&lt;br /&gt;After that we have nothing to do here. I never had this much chatting and e-mailing. Well this lasted for 4-5 days, and after that I am back on my schedule i.e. turn on music and start RnD.&lt;br /&gt;&lt;br /&gt;Finally we got project in mid April.&lt;br /&gt;We were really excited.&lt;br /&gt;We kicked off our project with database designing and after that we all got modules to code.&lt;br /&gt;&lt;br /&gt;I got the searching part; I did that in four days with the required code reusability and other requirements.&lt;br /&gt;&lt;br /&gt;Now, from the last Friday we are waiting for the design team to complete their job.&lt;br /&gt;&lt;br /&gt;And as our Project Manager has given the spec. that is indicating that we might have to change our code.&lt;br /&gt;&lt;br /&gt;So I am still searching for some interesting topic on which I can do some RnD.&lt;br /&gt;&lt;br /&gt;Anyways, let's see what will gonna happen...&lt;br /&gt;as who knows what life will gonna bring next.... &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26660993-114596265706654295?l=mayankgsingh.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mayankgsingh.blogspot.com/feeds/114596265706654295/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26660993&amp;postID=114596265706654295' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/114596265706654295'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/114596265706654295'/><link rel='alternate' type='text/html' href='http://mayankgsingh.blogspot.com/2006/04/another-boring-day.html' title='Another Boring Day'/><author><name>Mayank</name><uri>http://www.blogger.com/profile/02296414032387537182</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://4.bp.blogspot.com/-6qN1dd-Rkso/TyJ57bvquzI/AAAAAAAAP-c/653D-b68f6c/s220/DSC_2303_up.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26660993.post-114568403057871353</id><published>2006-04-22T11:01:00.000+05:30</published><updated>2006-05-02T11:36:01.533+05:30</updated><title type='text'>Humm....</title><content type='html'>So finally I have cretead a blog.&lt;br /&gt;Now It comes to management...&lt;br /&gt;&lt;br /&gt;Lets see how well I can manage this.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/26660993-114568403057871353?l=mayankgsingh.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mayankgsingh.blogspot.com/feeds/114568403057871353/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26660993&amp;postID=114568403057871353' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/114568403057871353'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26660993/posts/default/114568403057871353'/><link rel='alternate' type='text/html' href='http://mayankgsingh.blogspot.com/2006/04/humm.html' title='Humm....'/><author><name>Mayank</name><uri>http://www.blogger.com/profile/02296414032387537182</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://4.bp.blogspot.com/-6qN1dd-Rkso/TyJ57bvquzI/AAAAAAAAP-c/653D-b68f6c/s220/DSC_2303_up.jpg'/></author><thr:total>0</thr:total></entry></feed>
