<?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:blogger='http://schemas.google.com/blogger/2008' 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-4772643796095616039</id><updated>2025-06-15T08:00:41.826-07:00</updated><category term="Java"/><category term="MS SQL"/><category term="Spring"/><category term="Tomcat"/><category term="Andy Myint"/><category term="Hibernate"/><category term="Network Programming"/><category term="XML"/><category term="JMeter"/><category term="JSTL"/><category term="practice"/><category term="Apache"/><category term="JConsole"/><category term="javaSript"/><category term="log4j"/><category term="AOP"/><category term="Bit"/><category term="HTTP"/><category term="JAXB"/><category term="JSP"/><category term="XPath"/><category term="creditcard"/><category term="log"/><title type='text'>Pro Programmers</title><subtitle type='html'>Not &lt;b&gt;&lt;u&gt;Professional&lt;/u&gt;&lt;/b&gt; Programmers. But &lt;b&gt;&lt;u&gt;Problematic&lt;/u&gt;&lt;/b&gt; Programmers.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://pro-programmers.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://pro-programmers.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Andy Myint</name><uri>http://www.blogger.com/profile/04441850183513599266</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3VPsxi4TQvEz1pjIvQ2WSePn9YUTgdbzhpiwalmVaJgjsy_bePi6bL9rlGzFov0zzH5CvONg0PpZUciIRLAz8HvQikS0dYL7f6yhMKJy6vEcEvGzMf5Pe3hcrgRDkAgY/s220/WeSheMeFamily.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>72</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4772643796095616039.post-470567163648758142</id><published>2012-08-14T19:26:00.001-07:00</published><updated>2012-08-14T19:41:08.431-07:00</updated><title type='text'>JBoss– Accessible via localhost only</title><content type='html'>&lt;h2&gt;Issue&lt;/h2&gt;  &lt;p&gt;After deployment on newly set-up JBoss (AS-7), the application deployed is accessible via localhost only.&lt;/p&gt;  &lt;h2&gt;Cause&lt;/h2&gt;  &lt;p&gt;Public network interface in JBoss is allowed to localhost only by default.&lt;/p&gt;  &lt;h2&gt;Solution&lt;/h2&gt;  &lt;p&gt;Provide the IP address in server.xml or standalone.xml file:&lt;/p&gt;  &lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;interface&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;public&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;   &amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;inet-address&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;192.168.1.1&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;interface&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;If you are not sure of IP address, allow it to any IP address. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;(Of course this is not that secure if there is no firewall or web server in front of JBoss)&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;interface&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;public&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;any-address&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;/&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;interface&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Socket Binding&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Make sure that you are editing the interface of the socket you want to bind. The interface “public” is edited since I want “standard-sockets” to be accessible. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;socket-binding-group&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;standard-sockets&amp;quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;default-interface&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;public&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;  </content><link rel='replies' type='application/atom+xml' href='http://pro-programmers.blogspot.com/feeds/470567163648758142/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4772643796095616039/470567163648758142' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/470567163648758142'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/470567163648758142'/><link rel='alternate' type='text/html' href='http://pro-programmers.blogspot.com/2012/08/jboss-accessible-via-localhost-only.html' title='JBoss– Accessible via localhost only'/><author><name>Andy Myint</name><uri>http://www.blogger.com/profile/04441850183513599266</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3VPsxi4TQvEz1pjIvQ2WSePn9YUTgdbzhpiwalmVaJgjsy_bePi6bL9rlGzFov0zzH5CvONg0PpZUciIRLAz8HvQikS0dYL7f6yhMKJy6vEcEvGzMf5Pe3hcrgRDkAgY/s220/WeSheMeFamily.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4772643796095616039.post-2153595013966000689</id><published>2012-03-05T18:56:00.001-08:00</published><updated>2012-03-05T18:56:15.403-08:00</updated><title type='text'>Liability of “if”</title><content type='html'>&lt;p&gt;Whenever you write an “if” condition, you are liable to test both scenarios. &lt;/p&gt;  </content><link rel='replies' type='application/atom+xml' href='http://pro-programmers.blogspot.com/feeds/2153595013966000689/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4772643796095616039/2153595013966000689' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/2153595013966000689'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/2153595013966000689'/><link rel='alternate' type='text/html' href='http://pro-programmers.blogspot.com/2012/03/liability-of-if.html' title='Liability of “if”'/><author><name>Andy Myint</name><uri>http://www.blogger.com/profile/04441850183513599266</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3VPsxi4TQvEz1pjIvQ2WSePn9YUTgdbzhpiwalmVaJgjsy_bePi6bL9rlGzFov0zzH5CvONg0PpZUciIRLAz8HvQikS0dYL7f6yhMKJy6vEcEvGzMf5Pe3hcrgRDkAgY/s220/WeSheMeFamily.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4772643796095616039.post-916281553678614437</id><published>2012-02-14T20:43:00.001-08:00</published><updated>2012-02-16T03:44:50.156-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JAXB"/><category scheme="http://www.blogger.com/atom/ns#" term="XML"/><title type='text'>Inheritance Support in JAXB</title><content type='html'>Pardon me if the title of the subject is not comprehensive enough. I wanted to name “Polymorphism support in JAXB” as well. However I chose what I think will be the most common search keyword when one googles. &lt;br /&gt;
In this scenario, We have two XML documents with different root elements and same child-elements as below &lt;br /&gt;
&lt;h3&gt;


XML(Person)&lt;/h3&gt;
&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;?&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;xml&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;version&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;1.0&quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;encoding&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;utf-8&quot;&lt;/span&gt;?&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
   &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;1&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
   &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Andy&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 19px; font-weight: bold;&quot;&gt;XML (Student)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace; white-space: pre;&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace; white-space: pre;&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;?&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;xml&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;version&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;1.0&quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;encoding&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;utf-8&quot;&lt;/span&gt;?&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Student&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
   &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;1&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
   &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Andy&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Student&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
Student XML could even have additional elements to Person XML. I will leave this as an exercise here. &lt;br /&gt;
&lt;br /&gt;
We could have two independent POJO annotated with xml binding.&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 19px; font-weight: bold;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 19px; font-weight: bold;&quot;&gt;Java (Person)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;csharpcode&quot;&gt;@XmlRootElement(name = &lt;span class=&quot;str&quot;&gt;&quot;Person&quot;&lt;/span&gt;)
&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;class&lt;/span&gt; Person {

    @XmlElement(name = &lt;span class=&quot;str&quot;&gt;&quot;id&quot;&lt;/span&gt;)
    &lt;span class=&quot;kwrd&quot;&gt;private&lt;/span&gt; Integer id;
    @XmlElement(name = &lt;span class=&quot;str&quot;&gt;&quot;name&quot;&lt;/span&gt;)
    &lt;span class=&quot;kwrd&quot;&gt;private&lt;/span&gt; String name;        &lt;span class=&quot;rem&quot;&gt;//........&lt;/span&gt;
}&lt;/pre&gt;
&lt;br /&gt;
&lt;style type=&quot;text/css&quot;&gt;
&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }
&lt;/style&gt;&lt;style type=&quot;text/css&quot;&gt;
&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }
&lt;/style&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 19px; font-weight: bold;&quot;&gt;Java (Student)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;csharpcode&quot;&gt;@XmlRootElement(name = &lt;span class=&quot;str&quot;&gt;&quot;Student&quot;&lt;/span&gt;)
&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;class&lt;/span&gt; Student {

    @XmlElement(name = &lt;span class=&quot;str&quot;&gt;&quot;id&quot;&lt;/span&gt;)
    &lt;span class=&quot;kwrd&quot;&gt;private&lt;/span&gt; Integer id;
    @XmlElement(name = &lt;span class=&quot;str&quot;&gt;&quot;name&quot;&lt;/span&gt;)
    &lt;span class=&quot;kwrd&quot;&gt;private&lt;/span&gt; String name;   
   
   &lt;span class=&quot;rem&quot;&gt;//....    &lt;/span&gt;

}&lt;/pre&gt;
&lt;br /&gt;
&lt;style type=&quot;text/css&quot;&gt;
&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }
&lt;/style&gt;&lt;br /&gt;
We want Student class to extend Person as below:&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 19px; font-weight: bold;&quot;&gt;Java (Student extending Person)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;csharpcode&quot;&gt;@XmlRootElement(name = &lt;span class=&quot;str&quot;&gt;&quot;Person&quot;&lt;/span&gt;)
&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;class&lt;/span&gt; Student extends Person {
    
}&lt;/pre&gt;
&lt;br /&gt;
&lt;style type=&quot;text/css&quot;&gt;
&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }
&lt;/style&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;&lt;strong&gt;The issue here is only at the run time, we will notice that values are not bond to id and name fields.&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
The trick here is we need to have super class annotated with &lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;@XmlTransient&lt;/span&gt;. However Person class is still required in XML binding for other usages. So we need to add a dummy class for binding Person XML.. &lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 19px; font-weight: bold;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 19px; font-weight: bold;&quot;&gt;Java (Person Class annotated with @XmlTransient)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;csharpcode&quot;&gt;@XmlTransient
&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;class&lt;/span&gt; Person{

    @XmlElement(name = &lt;span class=&quot;str&quot;&gt;&quot;id&quot;&lt;/span&gt;)
    &lt;span class=&quot;kwrd&quot;&gt;private&lt;/span&gt; Integer id;
    @XmlElement(name = &lt;span class=&quot;str&quot;&gt;&quot;name&quot;&lt;/span&gt;)
    &lt;span class=&quot;kwrd&quot;&gt;private&lt;/span&gt; String name;   

   &lt;span class=&quot;rem&quot;&gt;//....&lt;/span&gt;

}&lt;/pre&gt;
&lt;br /&gt;
&lt;h3&gt;


Java (Dummy Class for Person XML extending Person Class)&lt;/h3&gt;
&lt;br /&gt;
&lt;pre class=&quot;csharpcode&quot;&gt;@XmlRootElement(name = &lt;span class=&quot;str&quot;&gt;&quot;Person&quot;&lt;/span&gt;)
&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;class&lt;/span&gt; PersonXml extends Person{    
    &lt;span class=&quot;rem&quot;&gt;//...&lt;/span&gt;
}&lt;/pre&gt;
&lt;br /&gt;
&lt;style type=&quot;text/css&quot;&gt;
&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }
&lt;/style&gt;&lt;style type=&quot;text/css&quot;&gt;
&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }
&lt;/style&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 19px; font-weight: bold;&quot;&gt;Java (Student extending Person)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace; white-space: pre;&quot;&gt;@XmlRootElement(name = &lt;span class=&quot;str&quot;&gt;&quot;Student&quot;&lt;/span&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;class&lt;/span&gt; Student extends Person{    
    &lt;span class=&quot;rem&quot;&gt;//Additional Fields&lt;/span&gt;
    &lt;span class=&quot;rem&quot;&gt;//...&lt;/span&gt;
}&lt;/pre&gt;
&lt;br /&gt;
With this approach, we can have JAXB bind the values in both Person and Student class while maintaining Person-Student&amp;nbsp;inheritance&amp;nbsp;structure.&lt;br /&gt;
&lt;br /&gt;
In other place of the code (for instance Service class), Person class can be used in the place of PersonXML as below:&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace; white-space: pre;&quot;&gt;@XmlRootElement(name = &lt;span class=&quot;str&quot;&gt;&quot;Student&quot;&lt;/span&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace; white-space: pre;&quot;&gt;Person p = unmarshall(personXml);//Here, instance of p is in fact PersonXML&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace; white-space: pre;&quot;&gt;Int i = p.id();&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace; white-space: pre;&quot;&gt;Person s1 = unmarshall(studnetXml);//instance of student&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;Student s2 = unmarshall(studentXml);//instance of student&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre class=&quot;csharpcode&quot;&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://pro-programmers.blogspot.com/feeds/916281553678614437/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4772643796095616039/916281553678614437' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/916281553678614437'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/916281553678614437'/><link rel='alternate' type='text/html' href='http://pro-programmers.blogspot.com/2012/02/inheritance-support-in-jaxb.html' title='Inheritance Support in JAXB'/><author><name>Andy Myint</name><uri>http://www.blogger.com/profile/04441850183513599266</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3VPsxi4TQvEz1pjIvQ2WSePn9YUTgdbzhpiwalmVaJgjsy_bePi6bL9rlGzFov0zzH5CvONg0PpZUciIRLAz8HvQikS0dYL7f6yhMKJy6vEcEvGzMf5Pe3hcrgRDkAgY/s220/WeSheMeFamily.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4772643796095616039.post-2930507254137511894</id><published>2011-10-18T17:09:00.001-07:00</published><updated>2011-10-18T17:12:35.637-07:00</updated><title type='text'>java.lang.ClassFormatError: Truncated class file=javax.servlet.ServletException</title><content type='html'>&lt;h1&gt;Problem&lt;/h1&gt;  &lt;p&gt;Having above exception after deploying WAR file.&lt;/p&gt;  &lt;h1&gt;Solution&lt;/h1&gt;  &lt;p&gt;Delete [Tomcat]\work\Catalina\localhost.&lt;/p&gt;  &lt;h1&gt;Cause&lt;/h1&gt;  &lt;p&gt;Tomcat’s got crazy with JSP compilation.&lt;/p&gt;  </content><link rel='replies' type='application/atom+xml' href='http://pro-programmers.blogspot.com/feeds/2930507254137511894/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4772643796095616039/2930507254137511894' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/2930507254137511894'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/2930507254137511894'/><link rel='alternate' type='text/html' href='http://pro-programmers.blogspot.com/2011/10/javalangclassformaterror-truncated.html' title='java.lang.ClassFormatError: Truncated class file=javax.servlet.ServletException'/><author><name>Andy Myint</name><uri>http://www.blogger.com/profile/04441850183513599266</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3VPsxi4TQvEz1pjIvQ2WSePn9YUTgdbzhpiwalmVaJgjsy_bePi6bL9rlGzFov0zzH5CvONg0PpZUciIRLAz8HvQikS0dYL7f6yhMKJy6vEcEvGzMf5Pe3hcrgRDkAgY/s220/WeSheMeFamily.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4772643796095616039.post-4109660915451200273</id><published>2011-08-17T19:42:00.001-07:00</published><updated>2012-02-16T03:45:02.055-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Spring"/><title type='text'>Spring Bean as Servlet Filter</title><content type='html'>&lt;h2&gt;&amp;#160;&lt;/h2&gt;  &lt;h2&gt;Wish&lt;/h2&gt;  &lt;p&gt;Want to use a Spring bean as JSP Filter.&lt;/p&gt;  &lt;h2&gt;Solution&lt;/h2&gt;  &lt;p&gt;Use &lt;font face=&quot;Courier New&quot;&gt;DelagatingFilterProxy&lt;/font&gt; from Spring libarry.&lt;/p&gt;  &lt;h2&gt;Details&lt;/h2&gt;  &lt;ul&gt;   &lt;li&gt;Implements the Spring bean from &lt;font face=&quot;Courier New&quot;&gt;javax.servlet.Filter&lt;/font&gt; as usual Filter&lt;/li&gt; &lt;/ul&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color=&quot;#0000ff&quot;&gt;public class &lt;font color=&quot;#000000&quot;&gt;HeaderValidationFilter&lt;/font&gt; implements &lt;font color=&quot;#000000&quot;&gt;Filter&lt;/font&gt;{&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font color=&quot;#0000ff&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ……&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font color=&quot;#0000ff&quot;&gt;}&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;ul&gt;   &lt;li&gt;Create Spring bean (with Spring XML) as usual &lt;/li&gt; &lt;/ul&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color=&quot;#0000ff&quot;&gt;&amp;lt;bean id=&amp;quot;&lt;font color=&quot;#000000&quot;&gt;filterHeader&lt;/font&gt;” class=”&lt;font color=&quot;#000000&quot;&gt;com.proprogrammers.HeaderValidationFilter&lt;/font&gt;”&amp;gt;&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font color=&quot;#0000ff&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ……&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font color=&quot;#0000ff&quot;&gt;&amp;lt;/bean&amp;gt;&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;ul&gt;   &lt;li&gt;In “web.xml” add JSP filter as below:&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;Notice that &amp;lt;filter-name&amp;gt; is the same as bean id above.&lt;/li&gt;   &lt;/ul&gt; &lt;/ul&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color=&quot;#0000ff&quot;&gt;&amp;lt;filter&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;filter-name&amp;gt;&lt;font color=&quot;#000000&quot;&gt;filterHeader&lt;/font&gt;&amp;lt;/filter-name&amp;gt;        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;filter-class&amp;gt;&lt;font color=&quot;#000000&quot;&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/font&gt;&amp;lt;/filter-class&amp;gt;        &lt;br /&gt;&amp;lt;/filter&amp;gt;&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font color=&quot;#0000ff&quot;&gt;&amp;lt;filter-mapping&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;filter-name&amp;gt;&lt;font color=&quot;#000000&quot;&gt;filterHeader&lt;/font&gt;&amp;lt;/filter-name&amp;gt;        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;url-pattern&amp;gt;&lt;font color=&quot;#000000&quot;&gt;*&lt;/font&gt;&amp;lt;/url-pattern&amp;gt;        &lt;br /&gt;&amp;lt;/filter-mapping&amp;gt;&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font color=&quot;#0000ff&quot;&gt;&lt;font color=&quot;#666666&quot;&gt;&amp;lt;servlet&amp;gt;         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;servlet-name&amp;gt;Spring&amp;lt;/servlet-name&amp;gt;          &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;servlet-class&amp;gt;org.springframework.web.servlet.DispatcherServlet&amp;lt;/servlet-class&amp;gt;          &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;load-on-startup&amp;gt;1&amp;lt;/load-on-startup&amp;gt;          &lt;br /&gt;&amp;lt;/servlet&amp;gt;&lt;/font&gt;        &lt;br /&gt;&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;h2&gt;Caveat&lt;/h2&gt;  &lt;p&gt;Filter bean (at step-2) cannot be defined in Spring Servlet XML file; Spring-servlet.xml in the sample. It must be in other Spring XML file.&lt;/p&gt;  &lt;h2&gt;Read More&lt;/h2&gt;  &lt;p&gt;&lt;a href=&quot;http://static.springsource.org/spring-security/site/docs/3.0.x/reference/security-filter-chain.html&quot;&gt;http://static.springsource.org/spring-security/site/docs/3.0.x/reference/security-filter-chain.html&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;Credits&lt;/h2&gt;  &lt;p&gt;Collin Yates&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;http://forum.springsource.org/showthread.php?20230-Howto-The-joy-that-is-DelegatingFilterProxy&quot;&gt;http://forum.springsource.org/showthread.php?20230-Howto-The-joy-that-is-DelegatingFilterProxy&lt;/a&gt;&lt;/p&gt;  </content><link rel='replies' type='application/atom+xml' href='http://pro-programmers.blogspot.com/feeds/4109660915451200273/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4772643796095616039/4109660915451200273' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/4109660915451200273'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/4109660915451200273'/><link rel='alternate' type='text/html' href='http://pro-programmers.blogspot.com/2011/08/spring-bean-as-servlet-filter.html' title='Spring Bean as Servlet Filter'/><author><name>Andy Myint</name><uri>http://www.blogger.com/profile/04441850183513599266</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3VPsxi4TQvEz1pjIvQ2WSePn9YUTgdbzhpiwalmVaJgjsy_bePi6bL9rlGzFov0zzH5CvONg0PpZUciIRLAz8HvQikS0dYL7f6yhMKJy6vEcEvGzMf5Pe3hcrgRDkAgY/s220/WeSheMeFamily.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4772643796095616039.post-3813948104281254294</id><published>2011-08-01T19:04:00.001-07:00</published><updated>2011-08-01T19:05:34.600-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>[Java] How to Make Asynchronous Method</title><content type='html'>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I have a long-running method which I want to run asynchronously. I transform the method into asynchronous method by running it on separate thread. &lt;/p&gt;  &lt;p&gt;Original Code:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; public void mainMethod() throws InterruptedException{     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; System.out.println(&amp;quot;Main Method start&amp;quot;);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; longRunningMethod(&amp;quot;testing&amp;quot;, new Object());      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; otherMethod();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; public Integer longRunningMethod(String param1,Object parm2) throws InterruptedException{      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; System.out.println(&amp;quot;Long running method&amp;quot;);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Thread.sleep(5000);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; //long process      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; return 1;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; public void otherMethod(){      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; System.out.println(&amp;quot;Other Method&amp;quot;);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt; &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;img src=&quot;https://docs.google.com/drawings/pub?id=1qWBSHw8T9dwX3kGJoiwglYLam-HZ-BtYD1JY8wmM9tU&amp;amp;w=1032&amp;amp;&amp;amp;h=497&quot; width=&quot;847&quot; height=&quot;410&quot; /&gt; &lt;/p&gt;  &lt;p&gt;New Code:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;public void mainMethod() throws InterruptedException{     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; System.out.println(&amp;quot;Main Method start&amp;quot;);      &lt;br /&gt;&lt;strong&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; //longRunningMethod(&amp;quot;testing&amp;quot;, new Object());       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; asyncServiceMethod(&amp;quot;testing&amp;quot;,new Object());        &lt;br /&gt;&lt;/strong&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; otherMethod();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; public Integer longRunningMethod(String param1,Object parm2) throws InterruptedException{      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; System.out.println(&amp;quot;Long running method&amp;quot;);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Thread.sleep(5000);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; //long process      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; return 1;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; public void otherMethod(){      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; System.out.println(&amp;quot;Other Method&amp;quot;);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&lt;strong&gt;&amp;#160;&amp;#160;&amp;#160; public void asyncServiceMethod(final String parm1,final Object obj){       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Runnable task = new Runnable() {&lt;/strong&gt;&lt;/p&gt;    &lt;p&gt;&lt;strong&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; @Override       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; public void run() {        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; try {        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; longRunningMethod(parm1,obj);        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; } catch (Exception ex) {        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; //handle error which cannot be thrown back        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; };        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; new Thread(task, &amp;quot;ServiceThread&amp;quot;).start();        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/strong&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;There are few things to consider wrapping a method into asynchronous call. &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Passing Parameters must be final&lt;/li&gt;    &lt;li&gt;Exception from the long-running process cannot be thrown back to mainMethod (main thread). It has to be handled at separate thread (ServiceThread in the sample)&lt;/li&gt;    &lt;li&gt;Returning value cannot be retrieved (Integer value in this sample) from the main Method. (If one wants to retrieve, &lt;font face=&quot;Courier New&quot;&gt;FutureTask&lt;/font&gt; should be used.)&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Other to read &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Asynchronous_method_invocation&quot;&gt;http://en.wikipedia.org/wiki/Asynchronous_method_invocation&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  </content><link rel='replies' type='application/atom+xml' href='http://pro-programmers.blogspot.com/feeds/3813948104281254294/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4772643796095616039/3813948104281254294' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/3813948104281254294'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/3813948104281254294'/><link rel='alternate' type='text/html' href='http://pro-programmers.blogspot.com/2011/08/java-how-to-make-asynchronous-method.html' title='[Java] How to Make Asynchronous Method'/><author><name>Andy Myint</name><uri>http://www.blogger.com/profile/04441850183513599266</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3VPsxi4TQvEz1pjIvQ2WSePn9YUTgdbzhpiwalmVaJgjsy_bePi6bL9rlGzFov0zzH5CvONg0PpZUciIRLAz8HvQikS0dYL7f6yhMKJy6vEcEvGzMf5Pe3hcrgRDkAgY/s220/WeSheMeFamily.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4772643796095616039.post-7806796995836983072</id><published>2011-05-09T18:24:00.001-07:00</published><updated>2011-05-09T18:27:18.692-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="MS SQL"/><title type='text'>MS SQL – Strip Time, Day, Month from DateTime</title><content type='html'>In the database, Date Time values is stored to millisecond level and for many times, I need to group record by Day, Week or Month or Year and I want to get day only or start day of the week or start day of the month, etc. Here I just put a note on SQL for the purpose mentioned. &lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;select&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: magenta; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: magenta; font-size: x-small;&quot;&gt;getdate&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;()&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;as&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-size: x-small;&quot;&gt; CurrentDateTime&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;     &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;select&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: magenta; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: magenta; font-size: x-small;&quot;&gt;DATEADD&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-size: x-small;&quot;&gt;d&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: magenta; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: magenta; font-size: x-small;&quot;&gt;DATEDIFF&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-size: x-small;&quot;&gt;d&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-size: x-small;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: magenta; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: magenta; font-size: x-small;&quot;&gt;getdate&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;()),&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-size: x-small;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;as&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt; CurrentDate;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;select&amp;nbsp;&lt;span style=&quot;color: magenta; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: magenta; font-size: x-small;&quot;&gt;DATEADD&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-size: x-small;&quot;&gt;wk&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: magenta; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: magenta; font-size: x-small;&quot;&gt;DATEDIFF&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-size: x-small;&quot;&gt;wk&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-size: x-small;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: magenta; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: magenta; font-size: x-small;&quot;&gt;getdate&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;()),&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-size: x-small;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;as&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt; CurrentStartDayOftheWeek;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;select&amp;nbsp;&lt;span style=&quot;color: magenta; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: magenta; font-size: x-small;&quot;&gt;DATEADD&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-size: x-small;&quot;&gt;mm&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: magenta; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: magenta; font-size: x-small;&quot;&gt;DATEDIFF&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-size: x-small;&quot;&gt;mm&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-size: x-small;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: magenta; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: magenta; font-size: x-small;&quot;&gt;getdate&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;()),&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-size: x-small;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;as&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt; CurrentStartDayOftheMonth;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;select&amp;nbsp;&lt;span style=&quot;color: magenta; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: magenta; font-size: x-small;&quot;&gt;DATEADD&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-size: x-small;&quot;&gt;yy&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: magenta; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: magenta; font-size: x-small;&quot;&gt;DATEDIFF&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-size: x-small;&quot;&gt;yy&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-size: x-small;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: magenta; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: magenta; font-size: x-small;&quot;&gt;getdate&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;()),&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-size: x-small;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-size: x-small;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-size: x-small;&quot;&gt;as&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt; CurrentStartDayOftheYear;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;strong&gt;Result&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;blockquote&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;strong&gt;CurrentDateTime&lt;/strong&gt;        &lt;br /&gt;
-----------------------        &lt;br /&gt;
2011-05-10 11:18:54.857&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;strong&gt;CurrentDate&lt;/strong&gt;        &lt;br /&gt;
-----------------------        &lt;br /&gt;
2011-05-10 00:00:00.000&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;strong&gt;CurrentStartDayOftheWeek&lt;/strong&gt;        &lt;br /&gt;
------------------------        &lt;br /&gt;
2011-05-09 00:00:00.000&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;strong&gt;CurrentStartDayOftheMonth&lt;/strong&gt;        &lt;br /&gt;
-------------------------        &lt;br /&gt;
2011-05-01 00:00:00.000&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;strong&gt;CurrentStartDayOftheYear&lt;/strong&gt;        &lt;br /&gt;
------------------------        &lt;br /&gt;
2011-01-01 00:00:00.000        &lt;br /&gt;
&lt;/span&gt;&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://pro-programmers.blogspot.com/feeds/7806796995836983072/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4772643796095616039/7806796995836983072' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/7806796995836983072'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/7806796995836983072'/><link rel='alternate' type='text/html' href='http://pro-programmers.blogspot.com/2011/05/ms-sql-strip-time-day-month-from.html' title='MS SQL – Strip Time, Day, Month from DateTime'/><author><name>Andy Myint</name><uri>http://www.blogger.com/profile/04441850183513599266</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3VPsxi4TQvEz1pjIvQ2WSePn9YUTgdbzhpiwalmVaJgjsy_bePi6bL9rlGzFov0zzH5CvONg0PpZUciIRLAz8HvQikS0dYL7f6yhMKJy6vEcEvGzMf5Pe3hcrgRDkAgY/s220/WeSheMeFamily.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4772643796095616039.post-6510218194877475509</id><published>2011-05-03T18:14:00.001-07:00</published><updated>2011-05-04T17:05:37.079-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Network Programming"/><title type='text'>Java byte Array into int Array</title><content type='html'>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color=&quot;#0000ff&quot;&gt;public int&lt;/font&gt;[] toIntArray(&lt;font color=&quot;#0000ff&quot;&gt;byte&lt;/font&gt;[] barr) {       &lt;br /&gt;&lt;font color=&quot;#808080&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; //Pad the size to multiple of 4        &lt;br /&gt;&lt;/font&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;font color=&quot;#0000ff&quot;&gt;int &lt;/font&gt;size = (barr.&lt;font color=&quot;#008040&quot;&gt;length&lt;/font&gt; / 4) + ((barr.&lt;font color=&quot;#008040&quot;&gt;length&lt;/font&gt; % 4 == 0) ? 0 : 1);&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ByteBuffer bb = ByteBuffer.allocate(size *4);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; bb.put(barr);       &lt;br /&gt;&lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;font color=&quot;#808080&quot;&gt;//Java uses Big Endian. Network program uses Little Endian.        &lt;br /&gt;&lt;/font&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; bb.order(ByteOrder.LITTLE_ENDIAN);       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;font color=&quot;#0000ff&quot;&gt;int&lt;/font&gt;[] result = new &lt;font color=&quot;#0000ff&quot;&gt;int&lt;/font&gt;[size];       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; bb.rewind();       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; while (bb.remaining() &amp;gt; 0) {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; result[bb.position()/4] =bb.getInt();       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }       &lt;br /&gt;&lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;font color=&quot;#0000ff&quot;&gt;return&lt;/font&gt; result;       &lt;br /&gt;}&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Disappointed for not seeing shifting? Wanna complain about performance?&lt;/p&gt;  &lt;p&gt;This is definitely not the most efficient method to convert byte array into int array yet it can be done with simple logic and a bit of knowledge in NIO.&lt;/p&gt;  &lt;p&gt;Unless the program is to be used on 1K memory device, using &lt;font face=&quot;Courier New&quot;&gt;ByteBuffer&lt;/font&gt; is acceptable I reckon.&lt;/p&gt;  &lt;p&gt;(I tried to convert to &lt;font face=&quot;Courier New&quot;&gt;IntBuffer&lt;/font&gt; but in vain. If anyone could point out, that’d be great.)&lt;/p&gt;  &lt;p&gt;Peter has mentioned how to use with IntBuffer in comment section as follow:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color=&quot;#0000ff&quot;&gt;public int&lt;/font&gt;[] toIntArray(&lt;font color=&quot;#0000ff&quot;&gt;byte&lt;/font&gt;[] barr) {       &lt;br /&gt;&lt;font color=&quot;#808080&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; //Pad the size to multiple of 4        &lt;br /&gt;&lt;/font&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;font color=&quot;#0000ff&quot;&gt;int &lt;/font&gt;size = (barr.&lt;font color=&quot;#008040&quot;&gt;length&lt;/font&gt; / 4) + ((barr.&lt;font color=&quot;#008040&quot;&gt;length&lt;/font&gt; % 4 == 0) ? 0 : 1);&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ByteBuffer bb = ByteBuffer.allocate(size *4);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; bb.put(barr); &lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;font color=&quot;#808080&quot;&gt;//Java uses Big Endian. Network program uses Little Endian.       &lt;br /&gt;&lt;/font&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; bb.order(ByteOrder.LITTLE_ENDIAN);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; bb.rewind();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; IntBuffer ib =&amp;#160; bb.asIntBuffer();&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;font color=&quot;#0000ff&quot;&gt;int &lt;/font&gt;[] result = new &lt;font color=&quot;#0000ff&quot;&gt;int &lt;/font&gt;[size];      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ib.get(result);      &lt;br /&gt;&lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;font color=&quot;#0000ff&quot;&gt;return&lt;/font&gt; result;       &lt;br /&gt;}&lt;/p&gt;&lt;/blockquote&gt;  </content><link rel='replies' type='application/atom+xml' href='http://pro-programmers.blogspot.com/feeds/6510218194877475509/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4772643796095616039/6510218194877475509' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/6510218194877475509'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/6510218194877475509'/><link rel='alternate' type='text/html' href='http://pro-programmers.blogspot.com/2011/05/java-byte-array-into-int-array.html' title='Java byte Array into int Array'/><author><name>Andy Myint</name><uri>http://www.blogger.com/profile/04441850183513599266</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3VPsxi4TQvEz1pjIvQ2WSePn9YUTgdbzhpiwalmVaJgjsy_bePi6bL9rlGzFov0zzH5CvONg0PpZUciIRLAz8HvQikS0dYL7f6yhMKJy6vEcEvGzMf5Pe3hcrgRDkAgY/s220/WeSheMeFamily.jpg'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4772643796095616039.post-8197355824658743403</id><published>2011-03-01T05:49:00.001-08:00</published><updated>2011-03-01T05:49:44.588-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>BigDecimal equals method</title><content type='html'>&lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;BigDecimal&lt;/font&gt; class from &lt;font face=&quot;Courier New&quot;&gt;java.lang.Math&lt;/font&gt; package is useful for scale manipulation. Be careful though when you want to compare two &lt;font face=&quot;Courier New&quot;&gt;BigDecimal&lt;/font&gt; objects with equals() method since it tests not just the equality of value but also the scale as mentioned in the document as below:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;…..this method considers two BigDecimals equal only if they are equal in value and scale (thus 2.0 is not equal to 2.00 when compared by this method).&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;For the following code&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;BigDecimal a = new BigDecimal(&amp;quot;2.0&amp;quot;);     &lt;br /&gt;BigDecimal b = new BigDecimal(&amp;quot;2.00&amp;quot;);      &lt;br /&gt;if (a.equals(b)){      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; System.out.println(&amp;quot;Equals&amp;quot;);      &lt;br /&gt;}else{      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; System.out.println(&amp;quot;Not Equals&amp;quot;);      &lt;br /&gt;}&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;it will return &amp;quot;Not Equals” as the scales of the objects are different.&lt;/p&gt;  &lt;p&gt;To compare values of the above two objects, &lt;font face=&quot;Courier New&quot;&gt;compareTo&lt;/font&gt; method can be used as it implements &lt;font face=&quot;Courier New&quot;&gt;Comparable&lt;/font&gt; interface like wrappers.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;if (a.compareTo(b)==0)     &lt;br /&gt;{      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; System.out.println(&amp;quot;They have same value&amp;quot;);      &lt;br /&gt;}&lt;/p&gt;&lt;/blockquote&gt;  </content><link rel='replies' type='application/atom+xml' href='http://pro-programmers.blogspot.com/feeds/8197355824658743403/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4772643796095616039/8197355824658743403' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/8197355824658743403'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/8197355824658743403'/><link rel='alternate' type='text/html' href='http://pro-programmers.blogspot.com/2011/03/bigdecimal-equals-method.html' title='BigDecimal equals method'/><author><name>Andy Myint</name><uri>http://www.blogger.com/profile/04441850183513599266</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3VPsxi4TQvEz1pjIvQ2WSePn9YUTgdbzhpiwalmVaJgjsy_bePi6bL9rlGzFov0zzH5CvONg0PpZUciIRLAz8HvQikS0dYL7f6yhMKJy6vEcEvGzMf5Pe3hcrgRDkAgY/s220/WeSheMeFamily.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4772643796095616039.post-777228738686364463</id><published>2010-11-23T20:17:00.001-08:00</published><updated>2010-11-23T20:17:59.367-08:00</updated><title type='text'>Chrome Proxy Setting</title><content type='html'>&lt;p&gt;&lt;span style=&quot;widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font: medium zawgyi-one; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0,0,0); word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span style=&quot;line-height: 19px; border-collapse: collapse; font-family: verdana, arial, helvetica, sans-serif; font-size: 15px; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px&quot; class=&quot;Apple-style-span&quot;&gt;If you change proxy setting in Chrome using Options-&amp;gt;Under the Hood –&amp;gt; [Change Proxy Setting], it will use IE proxy setting and it will change proxy setting for all other browsers. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style=&quot;widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font: medium zawgyi-one; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0,0,0); word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span style=&quot;line-height: 19px; border-collapse: collapse; font-family: verdana, arial, helvetica, sans-serif; font-size: 15px; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px&quot; class=&quot;Apple-style-span&quot;&gt;To avoid this, e&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font: medium zawgyi-one; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0,0,0); word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span style=&quot;line-height: 19px; border-collapse: collapse; font-family: verdana, arial, helvetica, sans-serif; font-size: 15px; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px&quot; class=&quot;Apple-style-span&quot;&gt;xecute chrome.exe using the command line argument below: &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;span style=&quot;widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font: medium zawgyi-one; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0,0,0); word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span style=&quot;line-height: 19px; border-collapse: collapse; font-family: verdana, arial, helvetica, sans-serif; font-size: 15px; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px&quot; class=&quot;Apple-style-span&quot;&gt;&lt;font face=&quot;Courier New&quot;&gt;--proxy-server=PROXYSERVER:PORT&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;span style=&quot;widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font: medium zawgyi-one; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0,0,0); word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span style=&quot;line-height: 19px; border-collapse: collapse; font-family: verdana, arial, helvetica, sans-serif; font-size: 15px; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px&quot; class=&quot;Apple-style-span&quot;&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  </content><link rel='replies' type='application/atom+xml' href='http://pro-programmers.blogspot.com/feeds/777228738686364463/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4772643796095616039/777228738686364463' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/777228738686364463'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/777228738686364463'/><link rel='alternate' type='text/html' href='http://pro-programmers.blogspot.com/2010/11/chrome-proxy-setting.html' title='Chrome Proxy Setting'/><author><name>Andy Myint</name><uri>http://www.blogger.com/profile/04441850183513599266</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3VPsxi4TQvEz1pjIvQ2WSePn9YUTgdbzhpiwalmVaJgjsy_bePi6bL9rlGzFov0zzH5CvONg0PpZUciIRLAz8HvQikS0dYL7f6yhMKJy6vEcEvGzMf5Pe3hcrgRDkAgY/s220/WeSheMeFamily.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4772643796095616039.post-3435718176871050902</id><published>2010-11-04T17:44:00.001-07:00</published><updated>2010-11-04T17:44:53.674-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Andy Myint"/><category scheme="http://www.blogger.com/atom/ns#" term="log4j"/><category scheme="http://www.blogger.com/atom/ns#" term="Spring"/><title type='text'>[Spring] log4J</title><content type='html'>&lt;h2&gt;WEB-INF\web.xml&lt;/h2&gt;  &lt;blockquote&gt;   &lt;p&gt;&amp;lt;context-param&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;param-name&amp;gt;log4jConfigLocation&amp;lt;/param-name&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;param-value&amp;gt;/WEB-INF/log4j.xml&amp;lt;/param-value&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/context-param&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;listener&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;listener-class&amp;gt;org.springframework.web.util.Log4jConfigListener&amp;lt;/listener-class&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/listener&amp;gt;….&lt;/p&gt; &lt;/blockquote&gt;  &lt;h2&gt;WEB-INF\log4j.xml&lt;/h2&gt;  &lt;blockquote&gt;   &lt;p&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; ?&amp;gt;      &lt;br /&gt;&amp;lt;!DOCTYPE log4j:configuration SYSTEM &amp;quot;log4j.dtd&amp;quot;&amp;gt;&lt;/p&gt;    &lt;p&gt;&amp;lt;log4j:configuration xmlns:log4j=&amp;quot;&lt;a href=&quot;http://jakarta.apache.org/log4j/&quot;&gt;http://jakarta.apache.org/log4j/&lt;/a&gt;&amp;quot;&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;!-- An appender which writes to file --&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;appender name=&amp;quot;FILE&amp;quot; class=&amp;quot;org.apache.log4j.DailyRollingFileAppender&amp;quot;&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;param name=&amp;quot;file&amp;quot; value=&amp;quot;../logs/MyApp.log&amp;quot; /&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;param name=&amp;quot;datePattern&amp;quot; value=&amp;quot;&#39;.&#39;yyyy-MM&amp;quot; /&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;param name=&amp;quot;append&amp;quot; value=&amp;quot;true&amp;quot; /&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;layout class=&amp;quot;org.apache.log4j.PatternLayout&amp;quot;&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;param name=&amp;quot;ConversionPattern&amp;quot; value=&amp;quot;%d [%t] %-5p %c{6} - %m%n&amp;quot;/&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/layout&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/appender&amp;gt;&lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;root&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;priority value =&amp;quot;info&amp;quot; /&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;appender-ref ref=&amp;quot;FILE&amp;quot; /&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/root&amp;gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;lt;/log4j:configuration&amp;gt;&lt;/p&gt;&lt;/blockquote&gt;  </content><link rel='replies' type='application/atom+xml' href='http://pro-programmers.blogspot.com/feeds/3435718176871050902/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4772643796095616039/3435718176871050902' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/3435718176871050902'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/3435718176871050902'/><link rel='alternate' type='text/html' href='http://pro-programmers.blogspot.com/2010/11/spring-log4j.html' title='[Spring] log4J'/><author><name>Andy Myint</name><uri>http://www.blogger.com/profile/04441850183513599266</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3VPsxi4TQvEz1pjIvQ2WSePn9YUTgdbzhpiwalmVaJgjsy_bePi6bL9rlGzFov0zzH5CvONg0PpZUciIRLAz8HvQikS0dYL7f6yhMKJy6vEcEvGzMf5Pe3hcrgRDkAgY/s220/WeSheMeFamily.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4772643796095616039.post-3783703731253255475</id><published>2010-10-31T22:01:00.001-07:00</published><updated>2010-10-31T22:01:29.981-07:00</updated><title type='text'>Enable Ping (Windows 2008)</title><content type='html'>&lt;p&gt;According to WiKiPedia&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;strong&gt;Ping&lt;/strong&gt; is a computer network administration utility used to test the reachability of a host on an Internet Protocol (IP) network and to measure the round-trip time for messages sent from the originating host to a destination computer. &lt;/p&gt;    &lt;p&gt;The name comes from active sonar terminology.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;em&gt;Ping&lt;/em&gt; is used to test the hostname/IP address for DNS resolution.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Ping&lt;/em&gt; uses &lt;strong&gt;ICMP&lt;/strong&gt; protocol while &lt;em&gt;telnet&lt;/em&gt; uses &lt;strong&gt;TCP&lt;/strong&gt; protocol on specific port. &lt;/p&gt;  &lt;p&gt;Since Windows 2008, it is disabled by default. To enable it, &lt;em&gt;Networking – Echo Request(ICMPv4In)&lt;/em&gt;, from command prompt, enter following: &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;strong&gt;netsh&lt;/strong&gt; firewall set icmpsetting 8&lt;/p&gt;&lt;/blockquote&gt;  </content><link rel='replies' type='application/atom+xml' href='http://pro-programmers.blogspot.com/feeds/3783703731253255475/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4772643796095616039/3783703731253255475' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/3783703731253255475'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/3783703731253255475'/><link rel='alternate' type='text/html' href='http://pro-programmers.blogspot.com/2010/10/enable-ping-windows-2008.html' title='Enable Ping (Windows 2008)'/><author><name>Andy Myint</name><uri>http://www.blogger.com/profile/04441850183513599266</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3VPsxi4TQvEz1pjIvQ2WSePn9YUTgdbzhpiwalmVaJgjsy_bePi6bL9rlGzFov0zzH5CvONg0PpZUciIRLAz8HvQikS0dYL7f6yhMKJy6vEcEvGzMf5Pe3hcrgRDkAgY/s220/WeSheMeFamily.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4772643796095616039.post-9139098524410374925</id><published>2010-10-25T17:04:00.001-07:00</published><updated>2010-10-25T17:04:52.697-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="MS SQL"/><title type='text'>[MSSQL] Reseed Identity</title><content type='html'>&lt;p&gt;&lt;font color=&quot;#0000ff&quot; size=&quot;2&quot;&gt;&lt;font color=&quot;#0000ff&quot; size=&quot;2&quot;&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color=&quot;#0000ff&quot; size=&quot;2&quot;&gt;&lt;font color=&quot;#0000ff&quot; size=&quot;2&quot;&gt;dbcc&lt;/font&gt;&lt;/font&gt;&lt;font color=&quot;#000000&quot; size=&quot;2&quot;&gt; checkident&lt;/font&gt;&lt;font color=&quot;#808080&quot; size=&quot;2&quot;&gt;&lt;font color=&quot;#808080&quot; size=&quot;2&quot;&gt;(&lt;/font&gt;&lt;/font&gt;&lt;font color=&quot;#000000&quot; size=&quot;2&quot;&gt; &lt;/font&gt;&lt;font color=&quot;#ff0000&quot; size=&quot;2&quot;&gt;&lt;font color=&quot;#ff0000&quot; size=&quot;2&quot;&gt;&#39;TABLENAME&#39;&lt;/font&gt;&lt;/font&gt;&lt;font color=&quot;#808080&quot; size=&quot;2&quot;&gt;&lt;font color=&quot;#808080&quot; size=&quot;2&quot;&gt;,&lt;/font&gt;&lt;/font&gt;&lt;font color=&quot;#000000&quot; size=&quot;2&quot;&gt; RESEED&lt;/font&gt;&lt;font color=&quot;#808080&quot; size=&quot;2&quot;&gt;&lt;font color=&quot;#808080&quot; size=&quot;2&quot;&gt;,&lt;/font&gt;&lt;/font&gt;&lt;font color=&quot;#000000&quot; size=&quot;2&quot;&gt; 200000000&lt;/font&gt;&lt;font color=&quot;#808080&quot; size=&quot;2&quot;&gt;&lt;font color=&quot;#808080&quot; size=&quot;2&quot;&gt;)&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Details in: &lt;a href=&quot;http://blogs.techrepublic.com.com/datacenter/?p=406&quot;&gt;http://blogs.techrepublic.com.com/datacenter/?p=406&lt;/a&gt; (Susan Harkins, 2008)&lt;/p&gt;  </content><link rel='replies' type='application/atom+xml' href='http://pro-programmers.blogspot.com/feeds/9139098524410374925/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4772643796095616039/9139098524410374925' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/9139098524410374925'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/9139098524410374925'/><link rel='alternate' type='text/html' href='http://pro-programmers.blogspot.com/2010/10/mssql-reseed-identity.html' title='[MSSQL] Reseed Identity'/><author><name>Andy Myint</name><uri>http://www.blogger.com/profile/04441850183513599266</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3VPsxi4TQvEz1pjIvQ2WSePn9YUTgdbzhpiwalmVaJgjsy_bePi6bL9rlGzFov0zzH5CvONg0PpZUciIRLAz8HvQikS0dYL7f6yhMKJy6vEcEvGzMf5Pe3hcrgRDkAgY/s220/WeSheMeFamily.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4772643796095616039.post-9125692286798318507</id><published>2010-09-20T18:28:00.001-07:00</published><updated>2010-09-20T18:29:53.015-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="practice"/><category scheme="http://www.blogger.com/atom/ns#" term="Spring"/><title type='text'>[Spring] Initialization Callbacks</title><content type='html'>&lt;p&gt;If you want the Spring container to perform initialization work on your bean after all the properties are set, you may implement &lt;font face=&quot;Courier New&quot;&gt;InitializationBean&lt;/font&gt; and implements &lt;font face=&quot;Courier New&quot;&gt;afterPropertiesSet()&lt;/font&gt; method. &lt;/p&gt;  &lt;p&gt;But just as Spring documentation outlines, &lt;u&gt;that approach will couple the code to Spring&lt;/u&gt;. You should use &lt;font face=&quot;Courier New&quot;&gt;init-metod&lt;/font&gt; instead and call any public method from your bean. You could event pass parameters using &lt;font face=&quot;Courier New&quot;&gt;constructor-arg&lt;/font&gt;.&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;http://static.springsource.org/spring/docs/2.0.x/reference/beans.html#beans-factory-lifecycle&quot;&gt;&lt;font color=&quot;#0000ff&quot;&gt;http://static.springsource.org/spring/docs/2.0.x/reference/beans.html#beans-factory-lifecycle&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  </content><link rel='replies' type='application/atom+xml' href='http://pro-programmers.blogspot.com/feeds/9125692286798318507/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4772643796095616039/9125692286798318507' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/9125692286798318507'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/9125692286798318507'/><link rel='alternate' type='text/html' href='http://pro-programmers.blogspot.com/2010/09/spring-initialization-callbacks.html' title='[Spring] Initialization Callbacks'/><author><name>Andy Myint</name><uri>http://www.blogger.com/profile/04441850183513599266</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3VPsxi4TQvEz1pjIvQ2WSePn9YUTgdbzhpiwalmVaJgjsy_bePi6bL9rlGzFov0zzH5CvONg0PpZUciIRLAz8HvQikS0dYL7f6yhMKJy6vEcEvGzMf5Pe3hcrgRDkAgY/s220/WeSheMeFamily.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4772643796095616039.post-7025150120089992313</id><published>2010-09-02T17:55:00.001-07:00</published><updated>2010-09-02T17:59:12.597-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Tomcat"/><title type='text'>Tomcat 5.5 with Java 1.6</title><content type='html'>&lt;p&gt;If your Tomcat is running with Java 1.5 by default and want to upgrade to Java 1.6, double click TOMCAT\bin\tomcat5w.exe&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYiKj28a7V_vMJtio-qCFXzw9VQ01gKTXN1YzNb_sZQUQgB4nmFOirowNKT2iBAcl9EfPms56h9PGhXpVcD8mOgNSuiOpKpe4jJNCzEu3Hlrxv6_9dTnywQUpCNNbkPiKVM4Z1h_Nb5A8/s1600-h/Tomcat5w.exe%5B3%5D.jpg&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;Tomcat5w.exe&quot; border=&quot;0&quot; alt=&quot;Tomcat5w.exe&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6tOboRQYVvxiHFWLq1306IFxOOfoONon6AXSZbgkvmDrQfNuAmWZvGX5fkBvyGkM7Y5AgZcO3MCvRvZRrD2ntOr34SOu5DIFV3XoUF2g1ur2S38yzaS5tEOcHRD5Q6VQ2rl9fQ13q5sg//?imgmax=800&quot; width=&quot;487&quot; height=&quot;495&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Change Java Virtual Machine by selecting ..\Java\jdk1.6.0_xx\jre\bin\server\jvm.dll. &lt;/li&gt;    &lt;li&gt;There is one more trick to make it work. Copy ..\Java\jdk1.6.0_xx\bin\msvcr71.dll into the same folder as jvm.dll. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&lt;font size=&quot;1&quot;&gt;Thanks to kellyohair &lt;font color=&quot;#7f7f7f&quot;&gt;&lt;a href=&quot;http://forums.java.net/jive/message.jspa?messageID=155421&quot;&gt;http://forums.java.net/jive/message.jspa?messageID=155421&lt;/a&gt;&lt;font color=&quot;#7f7f7f&quot;&gt;&lt;font color=&quot;#7f7f7f&quot;&gt;&lt;/font&gt; for step-2&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  </content><link rel='replies' type='application/atom+xml' href='http://pro-programmers.blogspot.com/feeds/7025150120089992313/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4772643796095616039/7025150120089992313' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/7025150120089992313'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/7025150120089992313'/><link rel='alternate' type='text/html' href='http://pro-programmers.blogspot.com/2010/09/tomcat-55-with-java-16.html' title='Tomcat 5.5 with Java 1.6'/><author><name>Andy Myint</name><uri>http://www.blogger.com/profile/04441850183513599266</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3VPsxi4TQvEz1pjIvQ2WSePn9YUTgdbzhpiwalmVaJgjsy_bePi6bL9rlGzFov0zzH5CvONg0PpZUciIRLAz8HvQikS0dYL7f6yhMKJy6vEcEvGzMf5Pe3hcrgRDkAgY/s220/WeSheMeFamily.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6tOboRQYVvxiHFWLq1306IFxOOfoONon6AXSZbgkvmDrQfNuAmWZvGX5fkBvyGkM7Y5AgZcO3MCvRvZRrD2ntOr34SOu5DIFV3XoUF2g1ur2S38yzaS5tEOcHRD5Q6VQ2rl9fQ13q5sg/s72-c/?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4772643796095616039.post-5597002118150732508</id><published>2010-07-14T18:38:00.001-07:00</published><updated>2010-07-14T18:39:01.390-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Spring"/><title type='text'>Enable connection pooling in Spring Datasource</title><content type='html'>&lt;p&gt;I use Apache Commons DBCP for the above purpose&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color=&quot;#0000ff&quot;&gt;&amp;lt;bean &lt;font color=&quot;#008000&quot;&gt;id&lt;/font&gt;=&lt;font color=&quot;#ff8040&quot;&gt;&amp;quot;poolDataSource&amp;quot;&lt;/font&gt; &lt;font color=&quot;#008000&quot;&gt;class&lt;/font&gt;=&lt;font color=&quot;#ff8040&quot;&gt;&amp;quot;org.apache.commons.dbcp.BasicDataSource&amp;quot;&lt;/font&gt; &lt;font color=&quot;#008000&quot;&gt;destroy-method&lt;/font&gt;=&lt;font color=&quot;#ff8040&quot;&gt;&amp;quot;close&amp;quot;&lt;/font&gt;&amp;gt;        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;property &lt;font color=&quot;#008000&quot;&gt;name&lt;/font&gt;=&lt;font color=&quot;#ff8040&quot;&gt;&amp;quot;driverClassName&amp;quot;&lt;/font&gt; &lt;font color=&quot;#008000&quot;&gt;value&lt;/font&gt;=&lt;font color=&quot;#ff8040&quot;&gt;&amp;quot;net.sourceforge.jtds.jdbc.Driver&amp;quot;&lt;/font&gt;/&amp;gt;        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;property &lt;font color=&quot;#008000&quot;&gt;name&lt;/font&gt;=&lt;font color=&quot;#ff8040&quot;&gt;&amp;quot;url&amp;quot;&lt;/font&gt; &lt;font color=&quot;#008000&quot;&gt;value&lt;/font&gt;=&lt;font color=&quot;#ff8040&quot;&gt;&amp;quot;${url}&amp;quot;&lt;/font&gt;/&amp;gt;        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;property &lt;font color=&quot;#008000&quot;&gt;name&lt;/font&gt;=&lt;font color=&quot;#ff8040&quot;&gt;&amp;quot;username&amp;quot;&lt;/font&gt; &lt;font color=&quot;#008000&quot;&gt;value&lt;/font&gt;=&lt;font color=&quot;#ff8040&quot;&gt;&amp;quot;${username}&amp;quot;&lt;/font&gt;/&amp;gt;        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;property &lt;font color=&quot;#008000&quot;&gt;name&lt;/font&gt;=&lt;font color=&quot;#ff8040&quot;&gt;&amp;quot;password&amp;quot;&lt;/font&gt; &lt;font color=&quot;#008000&quot;&gt;value&lt;/font&gt;=&lt;font color=&quot;#ff8040&quot;&gt;&amp;quot;${password}&amp;quot;&lt;/font&gt;/&amp;gt;        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;property &lt;font color=&quot;#008000&quot;&gt;name&lt;/font&gt;=&lt;font color=&quot;#ff8040&quot;&gt;&amp;quot;poolPreparedStatements&amp;quot;&lt;/font&gt; &lt;font color=&quot;#008000&quot;&gt;value&lt;/font&gt;=&lt;font color=&quot;#ff8040&quot;&gt;&amp;quot;true&amp;quot;&lt;/font&gt;/&amp;gt;        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;property &lt;font color=&quot;#008000&quot;&gt;name&lt;/font&gt;=&lt;font color=&quot;#ff8040&quot;&gt;&amp;quot;maxActive&amp;quot;&lt;/font&gt; &lt;font color=&quot;#008000&quot;&gt;value&lt;/font&gt;=&lt;font color=&quot;#ff8040&quot;&gt;&amp;quot;10&amp;quot;&lt;/font&gt;/&amp;gt;        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;property &lt;font color=&quot;#008000&quot;&gt;name&lt;/font&gt;=&lt;font color=&quot;#ff8040&quot;&gt;&amp;quot;maxIdle&amp;quot;&lt;/font&gt; &lt;font color=&quot;#008000&quot;&gt;value&lt;/font&gt;=&lt;font color=&quot;#ff8040&quot;&gt;&amp;quot;10&amp;quot;&lt;/font&gt;/&amp;gt;        &lt;br /&gt;&amp;lt;/bean&amp;gt;&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;  </content><link rel='replies' type='application/atom+xml' href='http://pro-programmers.blogspot.com/feeds/5597002118150732508/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4772643796095616039/5597002118150732508' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/5597002118150732508'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/5597002118150732508'/><link rel='alternate' type='text/html' href='http://pro-programmers.blogspot.com/2010/07/enable-connection-pooling-in-spring.html' title='Enable connection pooling in Spring Datasource'/><author><name>Andy Myint</name><uri>http://www.blogger.com/profile/04441850183513599266</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3VPsxi4TQvEz1pjIvQ2WSePn9YUTgdbzhpiwalmVaJgjsy_bePi6bL9rlGzFov0zzH5CvONg0PpZUciIRLAz8HvQikS0dYL7f6yhMKJy6vEcEvGzMf5Pe3hcrgRDkAgY/s220/WeSheMeFamily.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4772643796095616039.post-8957168812866028343</id><published>2010-07-09T07:46:00.000-07:00</published><updated>2010-07-09T07:46:08.745-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="XML"/><title type='text'>Caused by: org.xml.sax.SAXException: unable to find FieldDescriptor for &#39;elementName&#39; in ClassDescriptor of ParentElement</title><content type='html'>I got an error similar to the title in the course of XML binding Castor. It happens when there is namespace declared in XML document just like&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&amp;lt;country xmlns=&quot;http://pro-programmers.com/schema&quot;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;lt;city&amp;gt;London&amp;lt;/city&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&amp;lt;/country&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
For the above XML document mapping was designed as&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&amp;lt;mapping xmlns=&quot;http://castor.exolab.org&quot;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;lt;class name=&quot;com.proprogrammers.pojo.Country&quot;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;map-to xml=&quot;country&quot; /&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;field name=&quot;city&quot; type=&quot;string&quot;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;bind-xml name=&quot;city&quot; node=&quot;element&quot;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/field&amp;gt;        &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;lt;/class&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&amp;lt;/mapping&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Solution&lt;/b&gt;: I declared namespace in binding xml element as below:&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&amp;lt;mapping xmlns=&quot;http://castor.exolab.org&quot;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;lt;class name=&quot;com.proprogrammers.pojo.Country&quot;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;map-to xml=&quot;country&quot; /&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;field name=&quot;city&quot; type=&quot;string&quot;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;bind-xml name=&quot;city&quot;&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black;&quot;&gt;&lt;b&gt;xmlns=&quot;http://pro-programmers.com/schema&quot;&lt;/b&gt;&lt;/span&gt; &amp;nbsp;node=&quot;element&quot;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/field&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;lt;/class&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&amp;lt;/mapping&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
See more &lt;a href=&quot;http://www.castor.org/xml-faq.html#How-do-I-specify-a-namespace-in-the-mapping-file?&quot;&gt;here&lt;/a&gt;.</content><link rel='replies' type='application/atom+xml' href='http://pro-programmers.blogspot.com/feeds/8957168812866028343/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4772643796095616039/8957168812866028343' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/8957168812866028343'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/8957168812866028343'/><link rel='alternate' type='text/html' href='http://pro-programmers.blogspot.com/2010/07/caused-by-orgxmlsaxsaxexception-unable.html' title='Caused by: org.xml.sax.SAXException: unable to find FieldDescriptor for &#39;elementName&#39; in ClassDescriptor of ParentElement'/><author><name>Andy Myint</name><uri>http://www.blogger.com/profile/04441850183513599266</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3VPsxi4TQvEz1pjIvQ2WSePn9YUTgdbzhpiwalmVaJgjsy_bePi6bL9rlGzFov0zzH5CvONg0PpZUciIRLAz8HvQikS0dYL7f6yhMKJy6vEcEvGzMf5Pe3hcrgRDkAgY/s220/WeSheMeFamily.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4772643796095616039.post-1584906240567173174</id><published>2010-06-22T22:44:00.001-07:00</published><updated>2010-06-22T22:44:27.971-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="log"/><category scheme="http://www.blogger.com/atom/ns#" term="practice"/><title type='text'>Log File</title><content type='html'>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Application Log files should &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;roll over&lt;/strong&gt; daily or by size &lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;Manual/Scheduled process should be involved to &lt;strong&gt;archive&lt;/strong&gt; log files after a period (for instance every&amp;#160; month). It is necessary to set log file archiving procedure.&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;&lt;strong&gt;analysable&lt;/strong&gt; &lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;for number &lt;strong&gt;hits/requests&lt;/strong&gt; (even if the application is not web app, it should log how many times a module is called). We keep such log in a separate log file – say “access.log”.&lt;/li&gt;      &lt;li&gt;&lt;strong&gt;performance&lt;/strong&gt; profiling - We use perf4j and log the performance in “performance.log” which can be enabled as needed.&lt;/li&gt;      &lt;li&gt;&lt;strong&gt;Database requests&lt;/strong&gt; - Not every developer can tell how many DB access application submit in a certain time or for a request. This is very helpful in optimising performance.&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;follow industrial &lt;strong&gt;standard&lt;/strong&gt;&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;such as &lt;strong&gt;Apache log format&lt;/strong&gt; so that it can be analysed with tools available (e.g; Web Log Expert)&lt;/li&gt;      &lt;li&gt;Even if the log file is not for web application, it may be formatted in Apache log format to be analysed with tool.&lt;/li&gt;      &lt;li&gt;Log file may be formatted in CSV sometimes.&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;be Visible for &lt;strong&gt;Errors&lt;/strong&gt;&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;We keep any application error in a separate log file, “error.log” which improves visibility and we have a monitor program to raise alarm if any given exception is thrown.&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;include &lt;strong&gt;start-up&lt;/strong&gt; states&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;log file should have application restart time,&lt;/li&gt;      &lt;li&gt;which modules are running and which are not&lt;/li&gt;      &lt;li&gt;which configurations are used&lt;/li&gt;      &lt;li&gt;Operation/Production team who starts the system should be able to view the log clearly and should be fully aware of how application is started and how it will behave after start-up. &lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;be &lt;strong&gt;configurable&lt;/strong&gt;&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;from INFO to DEBUG without restarting the system&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;be &lt;strong&gt;Compact&lt;/strong&gt;&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;There were times when application server froze since there was no space left in the HDD. Developers log whatever the want and as a result log file is bloated with unnecessary statements. Apart from consuming storage space, bloated log file reduce the visibility.&lt;/li&gt;      &lt;li&gt;Code review should involve checking log statement.&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;&lt;strong&gt;Conceal &lt;/strong&gt;sensitive data&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;Data like password or credit card number should never be in the log file.&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;viewed by Log file &lt;strong&gt;monitoring tool&lt;/strong&gt;&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;We use BareTail to monitor log file which is very good especially with large size file and searching log statement in regex&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;&lt;/li&gt;    &lt;li&gt;(This post will be updated as I can think of any standard for log file in our team…)&lt;/li&gt; &lt;/ul&gt;  </content><link rel='replies' type='application/atom+xml' href='http://pro-programmers.blogspot.com/feeds/1584906240567173174/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4772643796095616039/1584906240567173174' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/1584906240567173174'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/1584906240567173174'/><link rel='alternate' type='text/html' href='http://pro-programmers.blogspot.com/2010/06/log-file.html' title='Log File'/><author><name>Andy Myint</name><uri>http://www.blogger.com/profile/04441850183513599266</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3VPsxi4TQvEz1pjIvQ2WSePn9YUTgdbzhpiwalmVaJgjsy_bePi6bL9rlGzFov0zzH5CvONg0PpZUciIRLAz8HvQikS0dYL7f6yhMKJy6vEcEvGzMf5Pe3hcrgRDkAgY/s220/WeSheMeFamily.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4772643796095616039.post-3696857026279320109</id><published>2010-06-22T18:15:00.001-07:00</published><updated>2010-06-22T21:27:14.577-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="creditcard"/><title type='text'>Credit Card Track2 Data</title><content type='html'>&lt;img src=&quot;http://docs.google.com/drawings/pub?id=1zTasmncxWK2HEFSOWZxqSTji9mSb7nuNHY3az1FWsF0&amp;amp;w=526&amp;amp;h=389&quot; /&gt;  </content><link rel='replies' type='application/atom+xml' href='http://pro-programmers.blogspot.com/feeds/3696857026279320109/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4772643796095616039/3696857026279320109' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/3696857026279320109'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/3696857026279320109'/><link rel='alternate' type='text/html' href='http://pro-programmers.blogspot.com/2010/06/credit-card-track2-data.html' title='Credit Card Track2 Data'/><author><name>Andy Myint</name><uri>http://www.blogger.com/profile/04441850183513599266</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3VPsxi4TQvEz1pjIvQ2WSePn9YUTgdbzhpiwalmVaJgjsy_bePi6bL9rlGzFov0zzH5CvONg0PpZUciIRLAz8HvQikS0dYL7f6yhMKJy6vEcEvGzMf5Pe3hcrgRDkAgY/s220/WeSheMeFamily.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4772643796095616039.post-3295613823221190420</id><published>2010-05-06T22:53:00.001-07:00</published><updated>2010-05-06T22:53:50.653-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="HTTP"/><category scheme="http://www.blogger.com/atom/ns#" term="Network Programming"/><title type='text'>Remove Transfer-Encoding:chunked from HTTP Response Header</title><content type='html'>&lt;p&gt;Note From &lt;a href=&quot;http://en.wikipedia.org/wiki/Chunked_transfer_encoding&quot; target=&quot;_blank&quot;&gt;Wikipedia&lt;/a&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Chunked Transfer Encoding is a mechanism that allows HTTP messages to be split in several parts. This can be applied to both HTTP requests (from client to server) and HTTP responses (from server to client). &lt;/p&gt;    &lt;p&gt;HTTP Chunked Transfer Encoding allows a server to maintain a HTTP persistent connection for dynamically generated content. &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;If HTTP Response has “&lt;strong&gt;Transfer-Encoding&lt;/strong&gt;” header, it causes client to wait for closing the connection. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Cause&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;If there is no&amp;#160; &lt;strong&gt;“Content-Length”&lt;/strong&gt; is defined in HTTP response header, it will be &lt;em&gt;chunked&lt;/em&gt; transmission. HTTP Response must have either “Transfer-Encoding” or “Content-Length” attribute.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Define “Content-Length” attribute if it can be done.&lt;/p&gt;  </content><link rel='replies' type='application/atom+xml' href='http://pro-programmers.blogspot.com/feeds/3295613823221190420/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4772643796095616039/3295613823221190420' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/3295613823221190420'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/3295613823221190420'/><link rel='alternate' type='text/html' href='http://pro-programmers.blogspot.com/2010/05/remove-transfer-encodingchunked-from.html' title='Remove Transfer-Encoding:chunked from HTTP Response Header'/><author><name>Andy Myint</name><uri>http://www.blogger.com/profile/04441850183513599266</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3VPsxi4TQvEz1pjIvQ2WSePn9YUTgdbzhpiwalmVaJgjsy_bePi6bL9rlGzFov0zzH5CvONg0PpZUciIRLAz8HvQikS0dYL7f6yhMKJy6vEcEvGzMf5Pe3hcrgRDkAgY/s220/WeSheMeFamily.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4772643796095616039.post-7937703474471416895</id><published>2010-04-08T18:27:00.001-07:00</published><updated>2010-04-08T18:35:52.759-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Hibernate"/><category scheme="http://www.blogger.com/atom/ns#" term="practice"/><title type='text'>HibernateSystemException: could not set a field value by reflection setter</title><content type='html'>&lt;p&gt;The above error is caught when NULL value in a database column is attempted to set to a setter in an Entity bean whose attribute mapped to that column type is of primitive type.&lt;/p&gt;  &lt;p&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;HibernateSystemException&quot; border=&quot;0&quot; alt=&quot;HibernateSystemException&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOmbYZu31lNmnqe2X2PnUvsGozX8726PrUNI-49Wx1gX-ndwnNs6dSPNyHoPUNkioLyj8ZbKJYWxTls0qjV0to0K5FxtY90W-IWBeL6Q30Qssh6bNZPYD-BI9ZQ9gOYyiVTOuomTe0iPM//?imgmax=800&quot; width=&quot;493&quot; height=&quot;170&quot; /&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color=&quot;#ff0000&quot;&gt;Never ever use primitive for attribute type in Entity Bean. &lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Since Java 5, with a feature called “&lt;strong&gt;&lt;em&gt;Autoboxing&lt;/em&gt;&lt;/strong&gt;”, we can seamlessly treat wrapper as primitive type as below&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Integer deptId;     &lt;br /&gt;deptId = 5;       &lt;br /&gt;//deptId = new Integer(5);&lt;/p&gt;    &lt;p&gt;     &lt;br /&gt;int a;      &lt;br /&gt;a = deptId;      &lt;br /&gt;//a = deptId.intValue();&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Compiler will handle it.&lt;/p&gt;  </content><link rel='replies' type='application/atom+xml' href='http://pro-programmers.blogspot.com/feeds/7937703474471416895/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4772643796095616039/7937703474471416895' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/7937703474471416895'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/7937703474471416895'/><link rel='alternate' type='text/html' href='http://pro-programmers.blogspot.com/2010/04/hibernatesystemexception-could-not-set.html' title='HibernateSystemException: could not set a field value by reflection setter'/><author><name>Andy Myint</name><uri>http://www.blogger.com/profile/04441850183513599266</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3VPsxi4TQvEz1pjIvQ2WSePn9YUTgdbzhpiwalmVaJgjsy_bePi6bL9rlGzFov0zzH5CvONg0PpZUciIRLAz8HvQikS0dYL7f6yhMKJy6vEcEvGzMf5Pe3hcrgRDkAgY/s220/WeSheMeFamily.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOmbYZu31lNmnqe2X2PnUvsGozX8726PrUNI-49Wx1gX-ndwnNs6dSPNyHoPUNkioLyj8ZbKJYWxTls0qjV0to0K5FxtY90W-IWBeL6Q30Qssh6bNZPYD-BI9ZQ9gOYyiVTOuomTe0iPM/s72-c/?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4772643796095616039.post-2404985737712279484</id><published>2010-04-06T19:28:00.001-07:00</published><updated>2010-04-07T17:07:01.533-07:00</updated><title type='text'>Preventing NullPointerException</title><content type='html'>&lt;p&gt;We have several ways to avoid getting NullPointerException caught such as a method returning empty array or List rather than NULL as following:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color=&quot;#0000ff&quot;&gt;public&lt;/font&gt; String[] getNames(){       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;font color=&quot;#0000ff&quot;&gt;return new&lt;/font&gt; String[0];&lt;font color=&quot;#808080&quot;&gt;//return null        &lt;br /&gt;&lt;/font&gt;}&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;This code will have the method caller in peace who can just write code without having to worry about NULL value something like this:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color=&quot;#0000ff&quot;&gt;for&lt;/font&gt;(String name:getNames()){       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; //Do Something       &lt;br /&gt;}&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;But there could be a scenario where we want to have empty value different from NULL in return, for instance:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color=&quot;#0000ff&quot;&gt;public&lt;/font&gt; String getName(){       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;font color=&quot;#0000ff&quot;&gt;return null;&lt;/font&gt;&lt;font color=&quot;#808080&quot;&gt;        &lt;br /&gt;&lt;/font&gt;}&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;For that reason, we can never assume that a method could not return NULL. Whether a method returns NULL or empty value should be described in Javadoc I believe. Consider this code:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color=&quot;#0000ff&quot;&gt;if&lt;/font&gt;(person.getName().equals(&lt;font color=&quot;#ff8040&quot;&gt;&amp;quot;John&amp;quot;&lt;/font&gt;)){       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; //Do Something       &lt;br /&gt;}&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;The above code will give NullPointerException when getName() returns NULL and it should be written as below if we know that NULL can be returned.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color=&quot;#0000ff&quot;&gt;if&lt;/font&gt; (&lt;font color=&quot;#ff8040&quot;&gt;&amp;quot;John&amp;quot;&lt;/font&gt;.equals(person.getName())){       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; //Do Something       &lt;br /&gt;}&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;The conditional clause above will yield false if getName() returns NULL. &lt;/p&gt;  </content><link rel='replies' type='application/atom+xml' href='http://pro-programmers.blogspot.com/feeds/2404985737712279484/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4772643796095616039/2404985737712279484' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/2404985737712279484'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/2404985737712279484'/><link rel='alternate' type='text/html' href='http://pro-programmers.blogspot.com/2010/04/preventing-nullpointerexception.html' title='Preventing NullPointerException'/><author><name>Andy Myint</name><uri>http://www.blogger.com/profile/04441850183513599266</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3VPsxi4TQvEz1pjIvQ2WSePn9YUTgdbzhpiwalmVaJgjsy_bePi6bL9rlGzFov0zzH5CvONg0PpZUciIRLAz8HvQikS0dYL7f6yhMKJy6vEcEvGzMf5Pe3hcrgRDkAgY/s220/WeSheMeFamily.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4772643796095616039.post-473504335059066966</id><published>2010-02-28T16:53:00.001-08:00</published><updated>2010-02-28T16:54:22.389-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Bit"/><title type='text'>Zip Vs GZip</title><content type='html'>&lt;table border=&quot;1&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; width=&quot;90%&quot;&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign=&quot;top&quot; width=&quot;50%&quot;&gt;         &lt;p align=&quot;center&quot;&gt;&lt;strong&gt;GZip&lt;/strong&gt;&lt;/p&gt;       &lt;/td&gt;        &lt;td valign=&quot;top&quot;&gt;         &lt;p align=&quot;center&quot;&gt;&lt;strong&gt;Zip&lt;/strong&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign=&quot;top&quot;&gt;         &lt;ul&gt;           &lt;li&gt;compresses single file              &lt;br /&gt;(can concatenate the contents to compress multiple files) &lt;/li&gt;            &lt;li&gt;ideal for only one data stream &lt;/li&gt;         &lt;/ul&gt;       &lt;/td&gt;        &lt;td valign=&quot;top&quot;&gt;         &lt;ul&gt;           &lt;li&gt;compresses multiple files &lt;/li&gt;            &lt;li&gt;ideal for &lt;em&gt;archiving&lt;/em&gt; files &lt;/li&gt;         &lt;/ul&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign=&quot;top&quot;&gt;         &lt;ul&gt;           &lt;li&gt;deflates the content &lt;/li&gt;         &lt;/ul&gt;       &lt;/td&gt;        &lt;td valign=&quot;top&quot;&gt;         &lt;ul&gt;           &lt;li&gt;tries to choose which one will product the smallest output (Unix uses “deflate” algorithm) &lt;/li&gt;         &lt;/ul&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign=&quot;top&quot;&gt;         &lt;ul&gt;           &lt;li&gt;Java classes: &lt;font face=&quot;Courier New&quot;&gt;GZipOutputStream&lt;/font&gt;, &lt;font face=&quot;Courier New&quot;&gt;GZipInputStream&lt;/font&gt; &lt;/li&gt;         &lt;/ul&gt;       &lt;/td&gt;        &lt;td valign=&quot;top&quot;&gt;         &lt;ul&gt;           &lt;li&gt;Java classes: &lt;font face=&quot;Courier New&quot;&gt;GZipOutputStream&lt;/font&gt;, &lt;font face=&quot;Courier New&quot;&gt;GZipInputStream&lt;/font&gt; &lt;/li&gt;         &lt;/ul&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  </content><link rel='replies' type='application/atom+xml' href='http://pro-programmers.blogspot.com/feeds/473504335059066966/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4772643796095616039/473504335059066966' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/473504335059066966'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/473504335059066966'/><link rel='alternate' type='text/html' href='http://pro-programmers.blogspot.com/2010/02/zip-vs-gzip.html' title='Zip Vs GZip'/><author><name>Andy Myint</name><uri>http://www.blogger.com/profile/04441850183513599266</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3VPsxi4TQvEz1pjIvQ2WSePn9YUTgdbzhpiwalmVaJgjsy_bePi6bL9rlGzFov0zzH5CvONg0PpZUciIRLAz8HvQikS0dYL7f6yhMKJy6vEcEvGzMf5Pe3hcrgRDkAgY/s220/WeSheMeFamily.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4772643796095616039.post-5935792629775710024</id><published>2009-11-23T20:41:00.001-08:00</published><updated>2009-11-23T20:43:04.091-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>What is faster: System.currentTimeMillis() or new Date().getTime()?</title><content type='html'>&lt;p&gt;For micro-optimisation or trivial memory utilization improvement, &lt;font face=&quot;Courier New&quot;&gt;System.currentTimeMillis()&lt;/font&gt; is faster and better. The constructor in the &lt;font face=&quot;Courier New&quot;&gt;Date&lt;/font&gt; class uses &lt;font face=&quot;Courier New&quot;&gt;System.currentTimeMillis()&lt;/font&gt;. &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color=&quot;#0000ff&quot;&gt;public&lt;/font&gt; Date() {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;font color=&quot;#0000ff&quot;&gt;this&lt;/font&gt;(&lt;em&gt;System.currentTimeMillis()&lt;/em&gt;);      &lt;br /&gt;}&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Thus, just to get a long value for current time in millisecond, it’s good to use &lt;font face=&quot;Courier New&quot;&gt;System.currentTimeMillis()&lt;/font&gt;.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color=&quot;#0000ff&quot;&gt;long&lt;/font&gt; start = &lt;em&gt;System.currentTimeMillis()&lt;/em&gt;;      &lt;br /&gt;&lt;font color=&quot;#808080&quot;&gt;//process&lt;/font&gt;      &lt;br /&gt;&lt;font color=&quot;#0000ff&quot;&gt;long&lt;/font&gt; elapsed = &lt;em&gt;System.currentTimeMillis()&lt;/em&gt; - start;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Above code saves garbage collector from cleaning up a couple of unnecessary Date objects. &lt;/p&gt;  &lt;p&gt;If you want more precision, use &lt;font face=&quot;Courier New&quot;&gt;System.nanoTime()&lt;/font&gt; which returns the current value of the most precise available system timer, in nanoseconds. This is especially useful when the elapsed time is resulted as zero millisecond in the above code.&lt;/p&gt;  </content><link rel='replies' type='application/atom+xml' href='http://pro-programmers.blogspot.com/feeds/5935792629775710024/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4772643796095616039/5935792629775710024' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/5935792629775710024'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/5935792629775710024'/><link rel='alternate' type='text/html' href='http://pro-programmers.blogspot.com/2009/11/what-is-faster-systemcurrenttimemillis.html' title='What is faster: System.currentTimeMillis() or new Date().getTime()?'/><author><name>Andy Myint</name><uri>http://www.blogger.com/profile/04441850183513599266</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3VPsxi4TQvEz1pjIvQ2WSePn9YUTgdbzhpiwalmVaJgjsy_bePi6bL9rlGzFov0zzH5CvONg0PpZUciIRLAz8HvQikS0dYL7f6yhMKJy6vEcEvGzMf5Pe3hcrgRDkAgY/s220/WeSheMeFamily.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4772643796095616039.post-4293073557108549406</id><published>2009-11-19T15:56:00.001-08:00</published><updated>2009-11-19T15:56:44.093-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="MS SQL"/><title type='text'>Database Diagram support object cannot be installed</title><content type='html'>&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt; When using &lt;em&gt;Microsoft SQL Server Management Studio&lt;/em&gt; to create database diagram, I got this error message:&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;http://lh6.ggpht.com/_LFzrs9y4Am8/SwXbMPVQMNI/AAAAAAAADJo/k_0NNDPC0to/s1600-h/DBDiagram%5B7%5D.jpg&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;DBDiagram&quot; border=&quot;0&quot; alt=&quot;DBDiagram&quot; src=&quot;http://lh3.ggpht.com/_LFzrs9y4Am8/SwXbOBrxlAI/AAAAAAAADJs/XxwiGlEw-CM/DBDiagram_thumb%5B3%5D.jpg?imgmax=800&quot; width=&quot;644&quot; height=&quot;150&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;: I run the following query:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;EXEC sp_dbcmptlevel &lt;em&gt;&#39;DB_NAME&#39;&lt;/em&gt;, &#39;90&#39;;      &lt;br /&gt;go      &lt;br /&gt;ALTER AUTHORIZATION ON DATABASE::&lt;em&gt;DB_NAME&lt;/em&gt; TO &amp;quot;&lt;em&gt;LOGIN&lt;/em&gt;&amp;quot;      &lt;br /&gt;go      &lt;br /&gt;use [DB_NAME]      &lt;br /&gt;go      &lt;br /&gt;EXECUTE AS USER = N&#39;dbo&#39; REVERT      &lt;br /&gt;go&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;where DB_NAME and LOGIN are variable. In my case, &lt;em&gt;LOGIN&lt;/em&gt; is NT User name since I’m using Windows Login. &lt;/p&gt;  </content><link rel='replies' type='application/atom+xml' href='http://pro-programmers.blogspot.com/feeds/4293073557108549406/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4772643796095616039/4293073557108549406' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/4293073557108549406'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4772643796095616039/posts/default/4293073557108549406'/><link rel='alternate' type='text/html' href='http://pro-programmers.blogspot.com/2009/11/database-diagram-support-object-cannot.html' title='Database Diagram support object cannot be installed'/><author><name>Andy Myint</name><uri>http://www.blogger.com/profile/04441850183513599266</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3VPsxi4TQvEz1pjIvQ2WSePn9YUTgdbzhpiwalmVaJgjsy_bePi6bL9rlGzFov0zzH5CvONg0PpZUciIRLAz8HvQikS0dYL7f6yhMKJy6vEcEvGzMf5Pe3hcrgRDkAgY/s220/WeSheMeFamily.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/_LFzrs9y4Am8/SwXbOBrxlAI/AAAAAAAADJs/XxwiGlEw-CM/s72-c/DBDiagram_thumb%5B3%5D.jpg?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry></feed>