<?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-13990222</id><updated>2024-10-09T15:13:38.975-07:00</updated><category term="coding convention"/><category term="java"/><category term="tips"/><category term="agile"/><category term="crucible"/><category term="demo"/><category term="eclipse"/><category term="intellij"/><category term="iteration"/><category term="process"/><category term="programming"/><category term="xp"/><title type='text'>Coding mystery!</title><subtitle type='html'>Talking about mysteries of programming!</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://codingmystery.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13990222/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://codingmystery.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Karthikeyan Marudhachalam</name><uri>http://www.blogger.com/profile/03745933648178305172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>8</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-13990222.post-4669445489618551235</id><published>2015-10-15T06:50:00.001-07:00</published><updated>2015-10-15T06:52:09.405-07:00</updated><title type='text'>Example daily rolling file appender Log4j2 configuration using YAML</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Log4j 2 can be configured using XML, JSON and YAML files. Despite YAML being the most readable format of all these, there are not many documentation available on configuring log4j2 using YAML.&lt;br /&gt;
&lt;br /&gt;
The following is an example configuration, if you&#39;re interested in using YAML.&lt;br /&gt;
&lt;pre style=&quot;background-color: #2b2b2b; color: #a9b7c6; font-family: &#39;Menlo&#39;; font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;color: #9876aa;&quot;&gt;Configuration&lt;/span&gt;:
  &lt;span style=&quot;color: #9876aa;&quot;&gt;status&lt;/span&gt;: warn

  &lt;span style=&quot;color: #9876aa;&quot;&gt;Properties&lt;/span&gt;:
    &lt;span style=&quot;color: #9876aa;&quot;&gt;Property&lt;/span&gt;:
      &lt;span style=&quot;color: #9876aa;&quot;&gt;name&lt;/span&gt;: logPath
      &lt;span style=&quot;color: #9876aa;&quot;&gt;value&lt;/span&gt;: /app/logs

  &lt;span style=&quot;color: #9876aa;&quot;&gt;Appenders&lt;/span&gt;:
    &lt;span style=&quot;color: #9876aa;&quot;&gt;Console&lt;/span&gt;:
      &lt;span style=&quot;color: #9876aa;&quot;&gt;name&lt;/span&gt;: Console
      &lt;span style=&quot;color: #9876aa;&quot;&gt;target&lt;/span&gt;: SYSTEM_OUT
      &lt;span style=&quot;color: #9876aa;&quot;&gt;ThresholdFilter&lt;/span&gt;:
        &lt;span style=&quot;color: #9876aa;&quot;&gt;level&lt;/span&gt;: info
      &lt;span style=&quot;color: #9876aa;&quot;&gt;PatternLayout&lt;/span&gt;:
        &lt;span style=&quot;color: #9876aa;&quot;&gt;Pattern&lt;/span&gt;: &lt;span style=&quot;color: #6a8759;&quot;&gt;&#39;%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] [%-5level] %c{1} - %msg%n&#39;&lt;/span&gt;&lt;span style=&quot;color: #6a8759;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #6a8759;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #9876aa;&quot;&gt;RollingFile&lt;/span&gt;:
      &lt;span style=&quot;color: #9876aa;&quot;&gt;name&lt;/span&gt;: File
      &lt;span style=&quot;color: #9876aa;&quot;&gt;fileName&lt;/span&gt;: ${logPath}/app.log
      &lt;span style=&quot;color: #9876aa;&quot;&gt;filePattern&lt;/span&gt;: ${logPath}/app-%d{yy-MM-dd}.log.gz
      &lt;span style=&quot;color: #9876aa;&quot;&gt;PatternLayout&lt;/span&gt;:
        &lt;span style=&quot;color: #9876aa;&quot;&gt;Pattern&lt;/span&gt;: &lt;span style=&quot;color: #6a8759;&quot;&gt;&#39;%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] [%-5level] %c{1} - %msg%n&#39;&lt;/span&gt;&lt;span style=&quot;color: #6a8759;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #6a8759;&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #9876aa;&quot;&gt;TimeBasedTriggeringPolicy&lt;/span&gt;:
        &lt;span style=&quot;color: #9876aa;&quot;&gt;interval&lt;/span&gt;: 1
        &lt;span style=&quot;color: #9876aa;&quot;&gt;modulate&lt;/span&gt;: &lt;span style=&quot;color: #cc7832; font-weight: bold;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: #cc7832; font-weight: bold;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #9876aa;&quot;&gt;Loggers&lt;/span&gt;:
    &lt;span style=&quot;color: #9876aa;&quot;&gt;Root&lt;/span&gt;:
      &lt;span style=&quot;color: #9876aa;&quot;&gt;level&lt;/span&gt;: info
      &lt;span style=&quot;color: #9876aa;&quot;&gt;AppenderRef&lt;/span&gt;:
        - &lt;span style=&quot;color: #9876aa;&quot;&gt;ref&lt;/span&gt;: Console
        - &lt;span style=&quot;color: #9876aa;&quot;&gt;ref&lt;/span&gt;: File
    &lt;span style=&quot;color: #9876aa;&quot;&gt;Logger&lt;/span&gt;:
      &lt;span style=&quot;color: #9876aa;&quot;&gt;name&lt;/span&gt;: com.mylogger
      &lt;span style=&quot;color: #9876aa;&quot;&gt;level&lt;/span&gt;: info&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://codingmystery.blogspot.com/feeds/4669445489618551235/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codingmystery.blogspot.com/2015/10/example-daily-rolling-file-log4j2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13990222/posts/default/4669445489618551235'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13990222/posts/default/4669445489618551235'/><link rel='alternate' type='text/html' href='http://codingmystery.blogspot.com/2015/10/example-daily-rolling-file-log4j2.html' title='Example daily rolling file appender Log4j2 configuration using YAML'/><author><name>Karthikeyan Marudhachalam</name><uri>http://www.blogger.com/profile/03745933648178305172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13990222.post-250064524136244295</id><published>2015-04-24T23:11:00.000-07:00</published><updated>2015-04-24T23:12:18.215-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="coding convention"/><category scheme="http://www.blogger.com/atom/ns#" term="eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="intellij"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="tips"/><title type='text'>Preventing IntelliJ/Eclipse from formatting a block of code</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
IntelliJ has extensively configurable code style settings, which can be adopted for pretty much for any project team. However, once in a while we need to have explicit control of formatting for a few lines of code to make them more readable.&lt;br /&gt;
&lt;br /&gt;
For instance, the following code snippet for configuring Spring Security is better formatted manually (taken from Spring boot documentation).&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint highlight prettyprinted&quot; style=&quot;background-color: whitesmoke; border-radius: 0px; border: 1px solid rgba(0, 0, 0, 0.14902); color: #333333; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 13px; line-height: 20px; margin-bottom: 20px; margin-top: -10px; overflow-x: auto; padding: 9.5px; text-align: left; width: 654.453125px; word-break: normal; word-wrap: normal;&quot;&gt;&lt;code class=&quot;language-java&quot; data-lang=&quot;java&quot; style=&quot;background-color: transparent; border-radius: 3px; border: 0px; color: inherit; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; padding: 0px;&quot;&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;color: #006666;&quot;&gt;@Override&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;color: #000088;&quot;&gt;protected&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;color: #000088;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt; configure&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: #660066;&quot;&gt;HttpSecurity&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt; http&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;color: #000088;&quot;&gt;throws&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: #660066;&quot;&gt;Exception&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt;
        http
            &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt;authorizeRequests&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt;antMatchers&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;color: #008800;&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;color: #008800;&quot;&gt;&quot;/home&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600;&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt;permitAll&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt;anyRequest&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600;&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt;authenticated&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt;and&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt;formLogin&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt;loginPage&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;color: #008800;&quot;&gt;&quot;/login&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt;permitAll&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt;and&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt;logout&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt;permitAll&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600;&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black;&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
However, when we invoke &quot;Reformat code&quot; in IntelliJ, it&#39;ll align all the chained calls at the same indentation line.&lt;br /&gt;
&lt;br /&gt;
This can be prevented by using formatter marker feature of IntelliJ. For this, first we need to enable this feature in IntelliJ. Go to Settings -&amp;gt; Editor -&amp;gt; Code Style. Select &quot;Enable formatter markers in comments&quot; check box.&lt;br /&gt;
&lt;br /&gt;
Once that is done, the block of code not to be formatted by IntelliJ has to be surrounded by &quot;@formatter:off&quot; &amp;amp; &quot;@formatter:on&quot; text as comments. The above code after this will look as below:&lt;br /&gt;
&lt;br class=&quot;Apple-interchange-newline&quot; /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint highlight prettyprinted&quot; style=&quot;background-color: whitesmoke; border-radius: 0px; border: 1px solid rgba(0, 0, 0, 0.14902); margin-bottom: 20px; margin-top: -10px; overflow-x: auto; padding: 9.5px; width: 654.453125px; word-break: normal; word-wrap: normal;&quot;&gt;&lt;code class=&quot;language-java&quot; data-lang=&quot;java&quot; style=&quot;background-color: transparent; border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border-radius: 3px; border: 0px; padding: 0px;&quot;&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;color: #006666; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;@Override&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;color: #000088; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;protected&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;color: #000088; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt; configure&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: #660066; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;HttpSecurity&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt; http&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;color: #000088; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;throws&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;color: #660066; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;Exception&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;span style=&quot;font-family: Monaco, Menlo, Consolas, Courier New, monospace;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 20px;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;        // @formatter:off&lt;/span&gt;
        http
            &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;authorizeRequests&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;antMatchers&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;color: #008800; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;color: #008800; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;&quot;/home&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;permitAll&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;anyRequest&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;authenticated&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;and&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;formLogin&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;loginPage&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;color: #008800; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;&quot;/login&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;permitAll&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;and&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;logout&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;permitAll&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;span style=&quot;font-family: Monaco, Menlo, Consolas, Courier New, monospace;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 20px;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;        // @formatter:on&lt;/span&gt;
    &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;color: #666600; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;color: black; font-family: Monaco, Menlo, Consolas, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 20px;&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
All code outside this block will still be formatted the usual way.&lt;br /&gt;
&lt;br /&gt;
A few things to keep in mind:&lt;br /&gt;
* All developers in the team should have this feature turned on. Otherwise, IntelliJ used by a second developer will mess up the formatting.&lt;br /&gt;
* If you use Eclipse IDE, apparently the same can be configured in Eclipse too:&amp;nbsp;http://archive.eclipse.org/eclipse/downloads/drops/R-3.6-201006080911/eclipse-news-part2.html#JavaFormatter&lt;br /&gt;
&lt;br /&gt;
Credit: Found this tip via&amp;nbsp;&lt;a href=&quot;http://myshittycode.com/2014/08/19/intellij-selectively-disable-line-wrap/&quot;&gt;http://myshittycode.com/2014/08/19/intellij-selectively-disable-line-wrap/&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://codingmystery.blogspot.com/feeds/250064524136244295/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codingmystery.blogspot.com/2015/04/preventing-intellijeclipse-from.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13990222/posts/default/250064524136244295'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13990222/posts/default/250064524136244295'/><link rel='alternate' type='text/html' href='http://codingmystery.blogspot.com/2015/04/preventing-intellijeclipse-from.html' title='Preventing IntelliJ/Eclipse from formatting a block of code'/><author><name>Karthikeyan Marudhachalam</name><uri>http://www.blogger.com/profile/03745933648178305172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13990222.post-3030025836227002073</id><published>2013-01-17T21:19:00.000-08:00</published><updated>2013-01-22T02:23:31.176-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="agile"/><category scheme="http://www.blogger.com/atom/ns#" term="crucible"/><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><category scheme="http://www.blogger.com/atom/ns#" term="tips"/><title type='text'>Adding a whole directory tree to a Crucible review</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Crucible is an excellent tool for code reviews. Ideally code reviews should be done periodically after completing each feature. This is supported nicely by Crucible. All you&#39;ve to do is select the commits to be reviewed.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
However, quite often we need to add all the files in a branch in entirety to a review. This could be because that is the first review &amp;amp; a lot of changes have been committed before the code is in a shape to review. Or an expert from outside the team wants to review the code. Crucible doesn&#39;t support any straight forward way to add complete tree hierarchy to a review. The easiest solution to this is to write a EyeQL query &amp;amp; add all the revisions. The query I normally use is&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
select revisions from dir your/directory where is head and not deleted on branch your_branch&lt;/blockquote&gt;
For instance, it could be&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
select revisions from dir trunk where is head and not deleted on branch trunk&amp;nbsp;&lt;/blockquote&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://codingmystery.blogspot.com/feeds/3030025836227002073/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codingmystery.blogspot.com/2013/01/adding-directory-to-crucible-review.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13990222/posts/default/3030025836227002073'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13990222/posts/default/3030025836227002073'/><link rel='alternate' type='text/html' href='http://codingmystery.blogspot.com/2013/01/adding-directory-to-crucible-review.html' title='Adding a whole directory tree to a Crucible review'/><author><name>Karthikeyan Marudhachalam</name><uri>http://www.blogger.com/profile/03745933648178305172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13990222.post-5987784626436483164</id><published>2012-03-29T06:12:00.001-07:00</published><updated>2013-01-17T20:27:36.663-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="coding convention"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><title type='text'>Should all arguments be marked as final in Java?</title><content type='html'>Once in a while, someone suggests me to define all method arguments as final in Java. As per this suggestion, the code &lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;public void foo(int bar, MyObject baz) {  
    // do something  
 }  
&lt;/pre&gt;should be changed to &lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;public void foo(final int bar, final MyObject baz) {  
    // do something  
 }  
&lt;/pre&gt;&lt;br /&gt;
I hear many reasons in favor of this.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Methods that don&#39;t modify input arguments are more reliable. This translates to more maintainable &amp; easily testable methods.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Java always passes by value (refer &lt;a href=&quot;http://stackoverflow.com/a/40523&quot;&gt;this&lt;/a&gt; for details). Hence, if a different value is assigned to the argument variable in the called method body, the variable in the caller method will still point to the same old value/object. If an argument is not defined as final, a different object/value can be assigned. However, this will not affect the caller in anyway. &lt;br /&gt;
&lt;br /&gt;
In addition to that, even if a variable is defined as final, the fields of that object can still be modified. So, the question of a method modifying the input arguments can&#39;t be prevented by defining the argument as final. Hence, this will not make a method more reliable.&lt;br /&gt;
&lt;br /&gt;
A method can be made reliable by making the arguments immutable. Defining the arguments final has nothing to do with that.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Changing the value of argument will make the code harder to read.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Actually, I believe multiple assignments to any variable, not just arguments, can make the code difficult to read. Still, I do that very often for assigning a default value, if an argument or a variable, retrieved from another method, is null. Otherwise, I&#39;ve to define a new variable for the same purpose and copy the argument value conditionally to the new variable. This doesn&#39;t appeal to me very much. Of course, I very rarely change the argument/variable in other cases. If the argument is multiple assignments, then the suggestion should be to define all local variables as final. However, we&#39;ll need static code analyzers to warn if a developer didn&#39;t declare a variable as final. I believe writing a new rule for checking multiple assignments by static code analyzers shouldn&#39;t be very difficult. Then why to clutter the code with no advantage?&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;PMD rule set mandates this&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
PMD rule set categorized this under Java optimization. Actually, Java compiler will remove the final keyword for argument &amp; local variables. Hence, there is no way JVM can optimize a final variable access. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;In interface definition, final keyword is used to specify the variable is not changed&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
This is a very good idea; only problem is it is broken. As explained earlier, Java doesn&#39;t make the argument immutable on declaring it as final. So, it is up to the developers to make sure they don&#39;t change the fields of the arguments.&lt;br /&gt;
&lt;br /&gt;
If an argument, whose value is changed in a method, has to be accessed from an anonymous inner class, will you define that argument final? Then you&#39;re breaking this convention. Or will you define another final local variable for that purpose? Ugh... Ugly.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Conclusion:&lt;/b&gt;
IMO, there is no advantage in defining all arguments as final. To me, it looks like adding syntactic noise to an already very noisy language. Please stop doing that.</content><link rel='replies' type='application/atom+xml' href='http://codingmystery.blogspot.com/feeds/5987784626436483164/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codingmystery.blogspot.com/2012/03/should-all-arguments-be-marked-as-final.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13990222/posts/default/5987784626436483164'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13990222/posts/default/5987784626436483164'/><link rel='alternate' type='text/html' href='http://codingmystery.blogspot.com/2012/03/should-all-arguments-be-marked-as-final.html' title='Should all arguments be marked as final in Java?'/><author><name>Karthikeyan Marudhachalam</name><uri>http://www.blogger.com/profile/03745933648178305172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13990222.post-2427383252440517928</id><published>2011-02-26T13:09:00.000-08:00</published><updated>2011-02-26T13:10:33.563-08:00</updated><title type='text'>Lazy loading of properties using Hibernate/JPA</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;If a persisted object has heavy properties like Blobs, we may want to load them only when needed. This can be achieved in many ways in hibernate.&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Use projection in criteria query or&amp;nbsp;HQL&amp;nbsp;to fetch only the required columns. (&lt;a href=&quot;http://docs.jboss.org/hibernate/core/3.3/reference/en/html/querycriteria.html#querycriteria-projection&quot;&gt;http://docs.jboss.org/hibernate/core/3.3/reference/en/html/querycriteria.html#querycriteria-projection&lt;/a&gt; &amp;amp; &lt;a href=&quot;http://docs.jboss.org/hibernate/core/3.3/reference/en/html/queryhql.html#queryhql-select&quot;&gt;http://docs.jboss.org/hibernate/core/3.3/reference/en/html/queryhql.html#queryhql-select&lt;/a&gt;)&lt;br /&gt;
Pros: Very easy to implement. Different code can fetch different set of fields.&lt;br /&gt;
Cons: Values will be returned as Object[], not as our persistent object.&lt;/li&gt;
&lt;li&gt;Use lazy loading of properties. This requires instrumenting the byte codes during build time. (More info @&lt;a href=&quot;http://docs.jboss.org/hibernate/core/3.5/reference/en/html/performance.html#performance-fetching-lazyproperties&quot;&gt;http://docs.jboss.org/hibernate/core/3.5/reference/en/html/performance.html#performance-fetching-lazyproperties&lt;/a&gt;)&lt;br /&gt;
Pros: Most natural solution from OOP point of view.&lt;br /&gt;
Cons: Change in building procedure.&lt;/li&gt;
&lt;li&gt;Trick hibernate to think your class is instrumented &amp;amp; implement your own lazy loading. More info @&lt;a href=&quot;http://justonjava.blogspot.com/2010/09/lazy-one-to-one-and-one-to-many.html&quot;&gt;http://justonjava.blogspot.com/2010/09/lazy-one-to-one-and-one-to-many.html&lt;/a&gt;&lt;br /&gt;
Pros: Build procedure doesn&#39;t have to change. Still we&#39;re dealing with objects.&lt;br /&gt;
Cons: Using internals of a third-party library has its own disadvantages like future incompatibilities, vendor lock-in.&lt;/li&gt;
&lt;li&gt;Use runtime byte code instrumentation by defining hibernate.ejb.use_class_enhancer to true. (Refer &lt;a href=&quot;http://justonjava.blogspot.com/2010/09/lazy-one-to-one-and-one-to-many.html&quot;&gt;http://justonjava.blogspot.com/2010/09/lazy-one-to-one-and-one-to-many.html&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Extract the blob property as an independent entity &amp;amp; refer to that using one-to-many from PrimitiveRequest (More info @&lt;a href=&quot;http://community.jboss.org/wiki/Someexplanationsonlazyloadingone-to-one&quot;&gt;http://community.jboss.org/wiki/Someexplanationsonlazyloadingone-to-one&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Define a new entity class, which is mapped to the same table &amp;amp; has only relevant properties defined.&lt;br /&gt;
Pros: Different pieces of code can fetch different objects. Each object can have its own domain logic.&lt;br /&gt;
Cons: Could be confusing. No single object may have all the required domain logic. Possibility of code duplication related to domain logic.&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codingmystery.blogspot.com/feeds/2427383252440517928/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codingmystery.blogspot.com/2011/02/lazy-loading-of-properties-using.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13990222/posts/default/2427383252440517928'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13990222/posts/default/2427383252440517928'/><link rel='alternate' type='text/html' href='http://codingmystery.blogspot.com/2011/02/lazy-loading-of-properties-using.html' title='Lazy loading of properties using Hibernate/JPA'/><author><name>Karthikeyan Marudhachalam</name><uri>http://www.blogger.com/profile/03745933648178305172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13990222.post-8748034196885214414</id><published>2010-07-23T20:50:00.000-07:00</published><updated>2010-07-23T20:50:18.304-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="demo"/><category scheme="http://www.blogger.com/atom/ns#" term="iteration"/><category scheme="http://www.blogger.com/atom/ns#" term="process"/><category scheme="http://www.blogger.com/atom/ns#" term="xp"/><title type='text'>Iteration demo guidelines</title><content type='html'>Iteration demos are really important in many of the agile methodologies like Scrum &amp;amp; XP. This post is an introduction, in my understanding, on what to demo &amp;amp; how to demo features during iteration demos. I&#39;m writing this to communicate the best practices I want my team to follow. There may be a few things that won&#39;t be applicable to other teams depending upon who their customer is.&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #003366; font-family: Helvetica, Arial, sans-serif; font-size: 28px; font-weight: bold;&quot;&gt;What is iteration demo&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: black; font-family: Helvetica, Arial, sans-serif; font-size: 10pt; font-weight: normal; line-height: 13pt; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Iteration demo is meant for&lt;/div&gt;&lt;ul style=&quot;font-family: Helvetica, Arial, sans-serif; font-size: 10pt; line-height: 13pt; list-style-type: disc;&quot;&gt;&lt;li style=&quot;font-size: 10pt; line-height: 13pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Demonstrating requirements that were implemented in that iteration&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; line-height: 13pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Getting feedback from customer on how to improve that behavior&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; line-height: 13pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Giving enough information to testers so that they can write test spec for that feature &amp;amp; test it in next iteration&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; line-height: 13pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Giving high level idea on how further developments related to a functionality will shape up &amp;amp; discuss that with customer&lt;/li&gt;
&lt;/ul&gt;&lt;div style=&quot;color: black; font-family: Helvetica, Arial, sans-serif; font-size: 10pt; font-weight: normal; line-height: 13pt; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Iteration demo is&amp;nbsp;&lt;b&gt;NOT&lt;/b&gt;&amp;nbsp;meant for&lt;/div&gt;&lt;ul style=&quot;font-family: Helvetica, Arial, sans-serif; font-size: 10pt; line-height: 13pt; list-style-type: disc;&quot;&gt;&lt;li style=&quot;font-size: 10pt; line-height: 13pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Testing the newly implemented feature&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; line-height: 13pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Demonstrating/explaining technical level task (task of a story) to customer. For instance, performance improvement activities like caching implementation, index creation, etc. Demos should be on features/requirements that end user/customer can see/experience.&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; line-height: 13pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Code review sessions &amp;amp; scrutinizing if a developer has done what he/she claims to have done&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; line-height: 13pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Development demos. For instance, a major refactoring or a new utility that could be useful to other developers can be demoed in a developers only meeting. This will avoid wasting time of non-developers like customer &amp;amp; testers.&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; line-height: 13pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Design discussions. Though this can be brought up, it has to be followed up in a seperate meeting.&lt;/li&gt;
&lt;/ul&gt;&lt;h1 style=&quot;border-bottom-color: rgb(102, 153, 204); color: #003366; font-family: Helvetica, Arial, sans-serif; font-size: 21pt; font-weight: bold; line-height: normal; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 38px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; width: 1186px;&quot;&gt;&lt;a href=&quot;&quot; name=&quot;Iterationdemoguidelines-Whattoshowiniterationdemos&quot;&gt;&lt;/a&gt;What to show in iteration demos&lt;/h1&gt;&lt;div style=&quot;color: black; font-family: Helvetica, Arial, sans-serif; font-size: 10pt; font-weight: normal; line-height: 13pt; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Iteration demos should concentrate on things customer will see/experience. Only if no customer facing interfaces are available to demonstrate a feature, other means can be used. The following are the standard interfaces used in demos.&lt;/div&gt;&lt;ul style=&quot;font-family: Helvetica, Arial, sans-serif; font-size: 10pt; line-height: 13pt; list-style-type: disc;&quot;&gt;&lt;li style=&quot;font-size: 10pt; line-height: 13pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;GUI&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; line-height: 13pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Web services (preferably using SoapUI)&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; line-height: 13pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Logging&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; line-height: 13pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Database (used as the last choice)&lt;/li&gt;
&lt;/ul&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Helvetica, Arial, sans-serif; font-size: 13px; line-height: 17px;&quot;&gt;Note: If the product is exposing API for some developers to use (say a library), code utilizing that API can be used. Client code or test cases should not be used if the product is going to be used by non-developers.&lt;/span&gt;&lt;br /&gt;
&lt;h1 style=&quot;border-bottom-color: rgb(102, 153, 204); color: #003366; font-family: Helvetica, Arial, sans-serif; font-size: 21pt; font-weight: bold; line-height: normal; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 38px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; width: 1186px;&quot;&gt;&lt;a href=&quot;&quot; name=&quot;Iterationdemoguidelines-Bestpractices&quot;&gt;&lt;/a&gt;Best practices&lt;/h1&gt;&lt;ul style=&quot;font-family: Helvetica, Arial, sans-serif; font-size: 10pt; line-height: 13pt; list-style-type: disc;&quot;&gt;&lt;li style=&quot;font-size: 10pt; line-height: 13pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Only features/requirements that were completed end-to-end should be Demonstrated. Otherwise, it&#39;ll be more of a technical demo.&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; line-height: 13pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Demonstrate only the features that were already checked-in to version control. This will avoid confusion to customer &amp;amp; testers if that feature is available &amp;amp; can be tested with that iteration build or not.&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; line-height: 13pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;Preferably all developers should demonstrate features using a single installation of iteration build. Demonstrating using developer builds should be avoided. This will ensure that uncommitted check-ins are not used. This way developer can continue with the next activity without worrying about breaking the feature temporarily in his/her working copy.&lt;/li&gt;
&lt;/ul&gt;</content><link rel='replies' type='application/atom+xml' href='http://codingmystery.blogspot.com/feeds/8748034196885214414/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codingmystery.blogspot.com/2010/07/iteration-demo-guidelines.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13990222/posts/default/8748034196885214414'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13990222/posts/default/8748034196885214414'/><link rel='alternate' type='text/html' href='http://codingmystery.blogspot.com/2010/07/iteration-demo-guidelines.html' title='Iteration demo guidelines'/><author><name>Karthikeyan Marudhachalam</name><uri>http://www.blogger.com/profile/03745933648178305172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13990222.post-111986692277741857</id><published>2005-06-27T03:07:00.000-07:00</published><updated>2005-06-27T03:31:27.613-07:00</updated><title type='text'>GMail aliases</title><content type='html'>Gmail offers users a feature similar to account aliases. Messages sent to &#39;username+alias@gmail.com.&#39; are delivered to &#39;username@gmail.com.&#39; For example, messages sent to &#39;GoogleAmy+notes@gmail.com&#39; are delivered to &#39;GoogleAmy@gmail.com.&#39;&lt;br /&gt;&lt;br /&gt;You can set up filters to automatically direct these messages to &#39;Trash,&#39; apply a label or star, skip the inbox, or forward to another email account.&lt;br /&gt;&lt;br /&gt;Taken from &lt;a class=&quot;moz-txt-link-rfc2396E&quot; href=&quot;http://gmail.google.com/support/bin/answer.py?answer=12096&amp;query=aliases&amp;amp;amp;amp;amp;topic=0&amp;type=f&amp;amp;ctx=en:search&quot;&gt;&lt;http: answer=&quot;12096&amp;query=aliases&amp;amp;amp;amp;amp;topic=0&amp;type=f&amp;amp;ctx=en:search&quot;&gt;&lt;/http:&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://gmail.google.com/support/bin/answer.py?answer=12096&amp;query=aliases&amp;amp;amp;amp;topic=0&amp;type=f&amp;amp;ctx=en:search&quot;&gt;GMail Help center&lt;/a&gt;&lt;br /&gt;(via &lt;a href=&quot;http://kiruba.com/2005/06/using-gmail-as-your-personal-diary.html&quot;&gt;Kiruba&lt;/a&gt; comments section)</content><link rel='replies' type='application/atom+xml' href='http://codingmystery.blogspot.com/feeds/111986692277741857/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codingmystery.blogspot.com/2005/06/gmail-aliases.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13990222/posts/default/111986692277741857'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13990222/posts/default/111986692277741857'/><link rel='alternate' type='text/html' href='http://codingmystery.blogspot.com/2005/06/gmail-aliases.html' title='GMail aliases'/><author><name>Karthikeyan Marudhachalam</name><uri>http://www.blogger.com/profile/03745933648178305172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13990222.post-111986682903643997</id><published>2005-06-27T03:04:00.000-07:00</published><updated>2005-06-27T03:15:39.943-07:00</updated><title type='text'>Introduction</title><content type='html'>I&#39;m basically a Java/J2EE guy with considerable persistence/database exposure. Currently working in a DSL project following XP development methodology. So, chances are more that my posting will also revolve around these areas.&lt;br /&gt;&lt;br /&gt;I&#39;m creating this blog to share interesting technical stuff that I come across over net or at my work with everybody.&lt;br /&gt;&lt;br /&gt;Hope I&#39;ll do enough reading to keep this blog alive!</content><link rel='replies' type='application/atom+xml' href='http://codingmystery.blogspot.com/feeds/111986682903643997/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codingmystery.blogspot.com/2005/06/introduction.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13990222/posts/default/111986682903643997'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13990222/posts/default/111986682903643997'/><link rel='alternate' type='text/html' href='http://codingmystery.blogspot.com/2005/06/introduction.html' title='Introduction'/><author><name>Karthikeyan Marudhachalam</name><uri>http://www.blogger.com/profile/03745933648178305172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>