<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>@InitBinder</title>
	<atom:link href="http://initbinder.com/feed" rel="self" type="application/rss+xml" />
	<link>http://initbinder.com</link>
	<description>My thoughts, notes and ideas as a passionate software engineer</description>
	<lastBuildDate>Sat, 24 Mar 2012 13:29:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Brainteaser: DevOps</title>
		<link>http://initbinder.com/articles/difference_between_continuous_deployment_and_continuous_delivery.html</link>
		<comments>http://initbinder.com/articles/difference_between_continuous_deployment_and_continuous_delivery.html#comments</comments>
		<pubDate>Sat, 24 Sep 2011 10:45:45 +0000</pubDate>
		<dc:creator>Alexander Zagniotov</dc:creator>
				<category><![CDATA[best practices]]></category>
		<category><![CDATA[brainteaser]]></category>
		<category><![CDATA[continuous delivery]]></category>
		<category><![CDATA[continuous deployment]]></category>
		<category><![CDATA[dev ops]]></category>
		<category><![CDATA[devops]]></category>

		<guid isPermaLink="false">http://initbinder.com/?p=1222</guid>
		<description><![CDATA[What is the difference between continuous deployment and continuous delivery? Please describe in one-two lines]]></description>
			<content:encoded><![CDATA[<p>What is the difference between <em>continuous deployment</em> and <em>continuous delivery</em>? Please describe in one-two lines</p>
]]></content:encoded>
			<wfw:commentRss>http://initbinder.com/articles/difference_between_continuous_deployment_and_continuous_delivery.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Unfamiliarity Causes Rejection</title>
		<link>http://initbinder.com/articles/unfamiliarity-causes-rejection.html</link>
		<comments>http://initbinder.com/articles/unfamiliarity-causes-rejection.html#comments</comments>
		<pubDate>Wed, 21 Sep 2011 10:38:35 +0000</pubDate>
		<dc:creator>Alexander Zagniotov</dc:creator>
				<category><![CDATA[best practices]]></category>

		<guid isPermaLink="false">http://initbinder.com/?p=1214</guid>
		<description><![CDATA[Recently I listened to a talk given by an ex-ThoughtWorker, Simon Harris. One of the things that Simon talked about was how we, developers (and generally speaking &#8211; human beings) sometimes tend to reject what is unfamiliar to us. Within &#8230; <a href="http://initbinder.com/articles/unfamiliarity-causes-rejection.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Recently I listened to a talk given by an ex-ThoughtWorker, <a title="Simon Harris - Haruki Zaemon" href="http://twitter.com/haruki_zaemon" target="_blank">Simon Harris</a>. One of the things that Simon talked about was how we, developers (and generally speaking &#8211; human beings) sometimes tend to reject what is unfamiliar to us. Within software development context it can be an existing/legacy application or a module that we need to extend, and which is difficult to understand.</p>
<p>Really, how many times we looked at someone else&#8217;s work (eg:. a developer that has left the company a long time ago) and thought &#8220;Dude, this is so weak &#8230; come one&#8221;?</p>
<p>Instead of just pointing fingers, maybe we should stop for a moment, try to think and understand, what were the reasons for producing that mediocre piece of code? Look at the current software&#8217;s state from a different angle. Sure, sometimes a poorly written software is simply just that &#8211; a poorly written software without a particular reason. But at other times, perhaps there were unknown variables in the equation that prevented developers produce something of a higher quality: technical limitations? Some internal politics? Tight deadlines? Environment?</p>
<p>Understanding the historical/current state of an application, can only help us to come up with better results in the long run. I really enjoyed <a title="Simon Harris - Haruki Zaemon" href="http://twitter.com/haruki_zaemon" target="_blank">Simon</a>&#8216;s talk, he clearly draws from his extensive experience.</p>
]]></content:encoded>
			<wfw:commentRss>http://initbinder.com/articles/unfamiliarity-causes-rejection.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LateX &#8211; Transparent Watermark Image</title>
		<link>http://initbinder.com/articles/latex-transparent-watermark-image.html</link>
		<comments>http://initbinder.com/articles/latex-transparent-watermark-image.html#comments</comments>
		<pubDate>Sun, 04 Sep 2011 07:27:03 +0000</pubDate>
		<dc:creator>Alexander Zagniotov</dc:creator>
				<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[eso-pic]]></category>
		<category><![CDATA[graphicx]]></category>
		<category><![CDATA[latex watermark image]]></category>
		<category><![CDATA[semi opaque background]]></category>
		<category><![CDATA[semi transparent background]]></category>
		<category><![CDATA[tikz]]></category>
		<category><![CDATA[transparent image]]></category>
		<category><![CDATA[watermark]]></category>

		<guid isPermaLink="false">http://initbinder.com/?p=1205</guid>
		<description><![CDATA[If you want to add a watermark image to your LaTeX document, you can achieve it easily using three packages: graphicx, tikz and eso-pic: Graphicx package allows to load images into documents. If you want to add transparency to your &#8230; <a href="http://initbinder.com/articles/latex-transparent-watermark-image.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you want to add a watermark image to your LaTeX document, you can achieve it easily using three packages: <em>graphicx</em>, <em>tikz</em> and <em>eso-pic</em>:</p>
<p><em>Graphicx</em> package allows to load images into documents. If you want to add transparency to your image, you need also to use <em>tikz</em> package. <em>Tikz</em> is used for producing vector graphics from a geometric/algebraic description, but is also allows to play with opacity levels.</p>
<p><em>Eso-pic</em> package provides hooks to inserts the images on one or more pages as a background (in other words &#8211; a watermark).</p>
<p>[xml]<br />
\\usepackage{graphicx}<br />
\\usepackage{tikz}<br />
\\usepackage{eso-pic}</p>
<p>\\newcommand\\BackgroundPicA{\\put(270,440){{%<br />
\\begin{tikzpicture}\\node[opacity=0.1]{%<br />
\\includegraphics[scale=0.80]{letter-watermark.jpg}};%<br />
\\end{tikzpicture}%<br />
}}}</p>
<p>\\newcommand\\BackgroundPicB{\\put(-80,-40){{\\reflectbox{%<br />
\\begin{tikzpicture}%<br />
\\node[opacity=0.1]{%<br />
\\includegraphics[scale=0.80]{letter-watermark.jpg}};%<br />
\\end{tikzpicture}%<br />
}}}}</p>
<p>\\makeatletter%<br />
\\AddToShipoutPicture{\\BackgroundPicA}%<br />
\\AddToShipoutPicture{\\BackgroundPicB}%<br />
\\makeatother</p>
<p>\\begin{document}<br />
.<br />
.<br />
\\newpage<br />
.<br />
.<br />
\\end{document}<br />
[/xml]</p>
<p>I have attached a final result as PDF, so you can see the output: <a href="http://initbinder.com/bunker/wp-content/uploads/2011/09/opaque1.pdf">PDF with semi-opaqued watermark</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://initbinder.com/articles/latex-transparent-watermark-image.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>LateX &#8211; Style Section Title With a Color Filled Box</title>
		<link>http://initbinder.com/articles/latex-style-section-title.html</link>
		<comments>http://initbinder.com/articles/latex-style-section-title.html#comments</comments>
		<pubDate>Sat, 27 Aug 2011 12:09:40 +0000</pubDate>
		<dc:creator>Alexander Zagniotov</dc:creator>
				<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[color box padding]]></category>
		<category><![CDATA[colored box]]></category>
		<category><![CDATA[latex]]></category>
		<category><![CDATA[section]]></category>
		<category><![CDATA[section styling]]></category>
		<category><![CDATA[section title]]></category>

		<guid isPermaLink="false">http://initbinder.com/?p=1197</guid>
		<description><![CDATA[I was playing with LaTeX in order to create a resume template for my self. I was looking for a way to style title generated by the \section command. My goal was to generate color filled box with some text &#8230; <a href="http://initbinder.com/articles/latex-style-section-title.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I was playing with LaTeX in order to create a resume template for my self. I was looking for a way to style title generated by the \section command. My goal was to generate color filled box with some text inside and some padding.</p>
<p>This is what I have came up with:</p>
<p>[java]<br />
\\definecolor{gray}{RGB}{186,186,186}<br />
\\section{\\fcolorbox{black}{gray}{\\color{black}%<br />
{\\parbox{6.5in}{\\vspace{.03in}\\hspace{.03in}\\LaTe X{ is really cool}\\vspace{.03in}}}}}<br />
[/java]</p>
<p>Which produced the following result:</p>
<p><a href="http://initbinder.com/bunker/wp-content/uploads/2011/08/paddedbox.jpg"><img class="alignnone size-full wp-image-1202" title="paddedbox" src="http://initbinder.com/bunker/wp-content/uploads/2011/08/paddedbox.jpg" alt="LaTex - Style section title with a colored filled box" width="736" height="41" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://initbinder.com/articles/latex-style-section-title.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I Have Joined the ThoughtWorks Camp</title>
		<link>http://initbinder.com/articles/i-have-joined-the-thoughtworks-camp.html</link>
		<comments>http://initbinder.com/articles/i-have-joined-the-thoughtworks-camp.html#comments</comments>
		<pubDate>Mon, 25 Jul 2011 10:13:48 +0000</pubDate>
		<dc:creator>Alexander Zagniotov</dc:creator>
				<category><![CDATA[off topic]]></category>
		<category><![CDATA[thoughtworks]]></category>
		<category><![CDATA[working for thoughtworks]]></category>

		<guid isPermaLink="false">http://initbinder.com/?p=1186</guid>
		<description><![CDATA[I have some good news: I am going to be a ThoughtWorker. After two or three weeks of interviews, I have recently accepted their offer and going to start with the company in August. I am really looking forward to &#8230; <a href="http://initbinder.com/articles/i-have-joined-the-thoughtworks-camp.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I have some good news: I am going to be a ThoughtWorker. After two or three weeks of interviews, I have recently accepted their offer and going to start with the company in August.</p>
<p>I am really looking forward to it, since many bright, passionate and talented people work for <a title="ThoughtWorks - Global Leader in Enterprise Agile Developement Services" href="http://www.thoughtworks.com/" target="_blank">ThoughtWorks</a>. The company is known for its cutting-edge technology development and being one of the global leaders in enterprise Agile development services. In other words, I am really happy <img src='http://initbinder.com/bunker/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I will keep writing updates from time to time about my experience at <a title="ThoughtWorks - Global Leader in Enterprise Agile Developement Services" href="http://thoughtworks.com/" target="_blank">ThoughtWorks</a>. Stay tuned.</p>
]]></content:encoded>
			<wfw:commentRss>http://initbinder.com/articles/i-have-joined-the-thoughtworks-camp.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Write Operations in DWR</title>
		<link>http://initbinder.com/articles/write-operations-in-dwr.html</link>
		<comments>http://initbinder.com/articles/write-operations-in-dwr.html#comments</comments>
		<pubDate>Thu, 21 Jul 2011 11:41:50 +0000</pubDate>
		<dc:creator>Alexander Zagniotov</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[servlets]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://javabeans.asia/?p=1061</guid>
		<description><![CDATA[Write operations are not allowed with the default session setting for the OpenViewInSession filter which is commonly defined in web.xml as a hibernate filter. If you want to enable write operations when using DWR (Direct Web Remoting), one of the &#8230; <a href="http://initbinder.com/articles/write-operations-in-dwr.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Write operations are not allowed with the default session setting for the <em>OpenViewInSession</em> filter which is commonly defined in web.xml as a hibernate filter. If you want to enable write operations when using <a title="Direct Web Remoting" href="http://directwebremoting.org/dwr/index.html" target="_blank">DWR (Direct Web Remoting)</a>, one of the ways is to declare a filter for DWR urls. Put the following configuration in your web.xml, also please note the url pattern in <em>filter-mapping</em> element.</p>
<p>[xml]</p>
<p>&lt;filter&gt;<br />
&lt;filter-name&gt;dwrWriteHibernateFilter&lt;/filter-name&gt;<br />
&lt;filter-class&gt;<br />
some.package.name.OpenWriteSessionInViewFilter<br />
&lt;/filter-class&gt;<br />
&lt;init-param&gt;<br />
&lt;param-name&gt;singleSession&lt;/param-name&gt;<br />
&lt;param-value&gt;true&lt;/param-value&gt;<br />
&lt;/init-param&gt;<br />
&lt;init-param&gt;<br />
&lt;param-name&gt;sessionFactoryBeanName&lt;/param-name&gt;<br />
&lt;param-value&gt;sessionFactory&lt;/param-value&gt;<br />
&lt;/init-param&gt;<br />
&lt;/filter&gt;</p>
<p>&lt;filter-mapping&gt;<br />
&lt;filter-name&gt;dwrWriteHibernateFilter&lt;/filter-name&gt;<br />
&lt;url-pattern&gt;*.dwr&lt;/url-pattern&gt;<br />
&lt;/filter-mapping&gt;</p>
<p>[/xml]</p>
<p>The filter class as follows:</p>
<p>[java]<br />
// more imports<br />
import org.springframework.dao.DataAccessResourceFailureException;<br />
import org.springframework.orm.hibernate3.support.OpenSessionInViewFilter;</p>
<p>public class OpenWriteSessionInViewFilter extends OpenSessionInViewFilter {</p>
<p>protected Session getSession(SessionFactory sessionFactory)<br />
throws DataAccessResourceFailureException {<br />
Session session = super.getSession(sessionFactory);<br />
session.setFlushMode(FlushMode.COMMIT);<br />
return session;<br />
}</p>
<p>protected void closeSession(Session session, SessionFactory factory) {<br />
session.flush();<br />
super.closeSession(session, factory);<br />
}<br />
}</p>
<p>[/java]</p>
]]></content:encoded>
			<wfw:commentRss>http://initbinder.com/articles/write-operations-in-dwr.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Is TDD Only for &#8230; Junior Developers??</title>
		<link>http://initbinder.com/articles/is-tdd-only-for-junior-developers.html</link>
		<comments>http://initbinder.com/articles/is-tdd-only-for-junior-developers.html#comments</comments>
		<pubDate>Sun, 24 Apr 2011 03:05:45 +0000</pubDate>
		<dc:creator>Alexander Zagniotov</dc:creator>
				<category><![CDATA[best practices]]></category>
		<category><![CDATA[design patterns]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://javabeans.asia/?p=1027</guid>
		<description><![CDATA[Just before the Easter holidays, I had a discussion with two senior developers from my project about TDD. These guys are experienced software engineers that have been around for some time: they have 11 and 20 years of experience in &#8230; <a href="http://initbinder.com/articles/is-tdd-only-for-junior-developers.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Just before the Easter holidays, I had a discussion with two senior developers from my project about TDD. These guys are experienced software engineers that have been around for some time: they have 11 and 20 years of experience in software development under their belts.</p>
<p>I don&#8217;t claim to be an advocate for TDD. Currently, I do not practice it (yet), but I do recognize and appreciate its importance. TDD really &#8220;forces&#8221; you to have clear understanding about the business requirements to be implemented. You cant implement what you do not understand, right? Because you have to write the test first, your code becomes more solid, less bug prune and you have better test coverage.</p>
<p>Sure, writing the test first its an interesting concept: You start writing a test, and you discoverer that you need a class, and possibly a function. You create the class, function and keep writing the test. Basically, you write few lines of test, and few lines of code, few more lines of test and few more lines of code etc. etc.</p>
<p>Ok, I think I diverted a bit, back to the topic <img src='http://initbinder.com/bunker/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  The discussion took an interesting turn, and I still keep thinking about it. My question to them was &#8211; what do you think about TDD? The responses I received totally surprised me.</p>
<p>One of the claims supported by them, was that TDD does not serve much purpose, and a developer will end up re-factoring the unit tests eventually anyway as a result of re-factoring the concrete classes as the development goes on. So if latter is the case, my colleagues argued that there is no point writing unit tests first. Its better to finish writing concrete class, before attempting to write any unit tests.</p>
<p>Also, one of the developers claimed that many books and articles written on TDD discuss examples that are quite simple to implement, and in reality it is quite difficult to use TDD for complex business scenarios.</p>
<p>Another claim was that TDD should be used to teach junior developers the importance of unit testing, the experienced developers don&#8217;t really need to use it. The developers should follow KISS principles instead.</p>
<p>I respected their opinions about it, but it seemed fundamentally wrong to me that such experienced developers claim that TDD is basically overrated. The feeling that I got from them was that a lot of developers and software engineers in IT industry really got it wrong.</p>
<p>It got me wondering how, after more than ten years of experience in the industry, one does not appreciate one of the best software engineering practices around &#8230;</p>
<p>Offcourse, having said all that, I must point out that TDD is not suitable for every case. TDD can be effective only when it is clear what need to be implemented and there is a deep understanding of requirements.</p>
]]></content:encoded>
			<wfw:commentRss>http://initbinder.com/articles/is-tdd-only-for-junior-developers.html/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Jquery UI: Add a Shadow Line Around a Dialog Box</title>
		<link>http://initbinder.com/articles/jquery-ui-add-a-shadow-around-a-dialog-box.html</link>
		<comments>http://initbinder.com/articles/jquery-ui-add-a-shadow-around-a-dialog-box.html#comments</comments>
		<pubDate>Sat, 23 Apr 2011 13:13:39 +0000</pubDate>
		<dc:creator>Alexander Zagniotov</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[css dialog]]></category>
		<category><![CDATA[css modal dialog]]></category>
		<category><![CDATA[css popup]]></category>
		<category><![CDATA[css popup box]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://javabeans.asia/?p=1000</guid>
		<description><![CDATA[I really like the style of Facebook (or LinkedIn) Javascript popup dialogs &#8211; a thin semi-transparent shadow line around the dialog. It looks nice and from the usability point of view it has a purpose, as it is attracts user&#8217;s &#8230; <a href="http://initbinder.com/articles/jquery-ui-add-a-shadow-around-a-dialog-box.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I really like the style of <a title="Facebook" href="http://facebook.com/" target="_blank">Facebook</a> (or <a title="LinkedIn" href="http://linkedin.com/" target="_blank">LinkedIn</a>) Javascript popup dialogs &#8211; a thin semi-transparent shadow line around the dialog. It looks nice and from the usability point of view it has a purpose, as it is attracts user&#8217;s attention to the important component on the screen.</p>
<p>There are many examples of custom Javascript dialogs on the Internet that explain how to achieve this. While many solutions are really good, I wanted to make use of the dialog provided by jQuery UI library by default.</p>
<p>I have came up with a solution that works, but I don&#8217;t think it is the most elegant way to do it (CSS is not my strong side). The solution is quite simple, and pretty straight forward (I think <img src='http://initbinder.com/bunker/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ). The following are the final results as tested in FF3, IE8, Opera 10 and Chrome 10, please note the shadow line around the dialog:</p>
<div id="attachment_1010" class="wp-caption aligncenter" style="width: 310px"><a href="http://initbinder.com/bunker/wp-content/uploads/2011/04/ff-3.6.16.png"><img class="size-medium wp-image-1010  " title="Firefox - jQuery dialog box with semi-transparent shadow around it" src="http://initbinder.com/bunker/wp-content/uploads/2011/04/ff-3.6.16-300x116.png" alt="Firefox - jQuery dialog box with semi-transparent shadow around it" width="300" height="116" /></a><p class="wp-caption-text">Firefox 3.6.16</p></div>
<div id="attachment_1011" class="wp-caption aligncenter" style="width: 310px"><a href="http://initbinder.com/bunker/wp-content/uploads/2011/04/ie-8.0.76.png"><img class="size-medium wp-image-1011  " title="Internet Explorer - jQuery dialog box with semi-transparent shadow around it" src="http://initbinder.com/bunker/wp-content/uploads/2011/04/ie-8.0.76-300x136.png" alt="Internet Explorer - jQuery dialog box with semi-transparent shadow around it" width="300" height="136" /></a><p class="wp-caption-text">Internet Explorer 8.0.76</p></div>
<div id="attachment_1047" class="wp-caption aligncenter" style="width: 310px"><a href="http://initbinder.com/bunker/wp-content/uploads/2011/04/opera-10.63.jpg"><img class="size-medium wp-image-1047" title="opera-10.63" src="http://initbinder.com/bunker/wp-content/uploads/2011/04/opera-10.63-300x124.jpg" alt="opera-10.63" width="300" height="124" /></a><p class="wp-caption-text">opera-10.63</p></div>
<p><a href="http://initbinder.com/bunker/wp-content/uploads/2011/04/chrome-10.0.648.jpg"><img class="aligncenter size-medium wp-image-1048" title="chrome-10.0.648" src="http://initbinder.com/bunker/wp-content/uploads/2011/04/chrome-10.0.648-300x126.jpg" alt="chrome-10.0.648" width="300" height="126" /></a></p>
<p>First I defined a CSS class that&#8217;s going to have properties for the background shadow (the <em>bg_dialog_modeless_mask.png</em> is an 8&#215;8 gray square image)</p>
<p>[css]<br />
.dialog-mask {<br />
 -moz-border-radius:5px 5px 5px 5px;<br />
 -webkit-border-radius: 5px;<br />
 border-radius: 5px;<br />
 background:url(&quot;../images/bg_dialog_modeless_mask.png&quot;) repeat scroll left top transparent;<br />
}<br />
[/css]</p>
<p>Somewhere on my HTML page, I defined a DIV that&#8217;s going to be the dialog holder:</p>
<p>[html]<br />
&lt;div id=&quot;popup-holder&quot;&gt;&lt;/div&gt;<br />
[/html]</p>
<p>I added jQuery dialog init statement in my global JS file:</p>
<p>[javascript]<br />
$(document).ready(function(){</p>
<p> $( &#8216;#popup-holder&#8217; ).dialog({<br />
       autoOpen: false,<br />
       height: 350,<br />
       width: 530,<br />
       modal: true,<br />
       resizable: true,<br />
       draggable: false,<br />
       buttons: {<br />
         Cancel: function() {<br />
            $( this ).dialog( &quot;close&quot; );<br />
            $( &#8216;#dialog-wrapper&#8217; ).remove();<br />
         }<br />
      },<br />
      close: function() {<br />
            $( &#8216;#dialog-wrapper&#8217; ).remove();<br />
      },<br />
      open: function() {<br />
            wrapJqueryDialog($( this ));<br />
      },<br />
      resize: function() {<br />
            wrapJqueryDialog($( this ));<br />
      }<br />
   });<br />
});<br />
[/javascript]</p>
<p>The <em>#dialog-wrapper</em> is the ID of the DIV that holds the semi-transparent shadow which wraps the dialog. The <em>wrapJqueryDialog</em> function creates the shadow when dialog is opened, and handles the shadow resize when dialog is resized (it is also possible to add an event to drag the shadow when dialog has <em>draggable </em>option set to true).</p>
<p>Now the important part, the <em>wrapJqueryDialog</em> function:</p>
<p>[javascript]<br />
function wrapJqueryDialog(dialogWidgetObj)  {<br />
	//The width and height of the shadow line wrapping the dialog<br />
        var shadowWidth = 20;</p>
<p>        //Lets remove the shadow holder to start clean<br />
	$( &#8216;#dialog-wrapper&#8217; ).remove();</p>
<p>        //Gets the current dialog widget<br />
	var widget = dialogWidgetObj.dialog( &quot;widget&quot; );</p>
<p>        //Create the shadow holder DIV that has the background shadow CSS class<br />
	var dialogwrapper = $(&#8216;&lt;div id=&quot;dialog-wrapper&quot; class=&quot;dialog-mask&quot; /&gt;&#8217;);</p>
<p>	//For IE, the holder must be appended to the body first before any manipulation.<br />
	$(&#8216;body&#8217;).append(dialogwrapper);</p>
<p>        //Lets copy default inline styles from the dialog widget to the shadow holder<br />
	dialogwrapper.attr(&quot;style&quot;, widget.attr(&quot;style&quot;));</p>
<p>        //Lets position the shadow holder before and above the dialog widget<br />
	dialogwrapper.css(&quot;top&quot;, parseInt(dialogwrapper.css(&quot;top&quot;)) &#8211; shadowWidth);<br />
	dialogwrapper.css(&quot;left&quot;, parseInt(dialogwrapper.css(&quot;left&quot;)) &#8211; shadowWidth);</p>
<p>        dialogwrapper.css(&quot;position&quot;, &quot;absolute&quot;);</p>
<p>	//Make sure that the dialog widget is infront of surrounding shadow box and overlay (if there is one set)<br />
	widget.css(&quot;z-index&quot;, (parseInt(widget.css(&quot;z-index&quot;)) + 1));</p>
<p>	//Add to the shadow width default padding value from the class &#8216;.ui-dialog&#8217; and<br />
	//default border width from the class &#8216;.ui-widget-content&#8217; (1px times two)<br />
	var finalShadowWidth = shadowWidth + parseInt(widget.css(&quot;padding-top&quot;)) + 2;</p>
<p>	var widgetHeight = parseInt(widget.css(&quot;height&quot;));<br />
        //Lets extend the shadow holder height<br />
	dialogwrapper.css(&quot;height&quot;, widgetHeight + (finalShadowWidth * 2));</p>
<p>	var widgetWidth = parseInt(widget.css(&quot;width&quot;));<br />
	//Lets extend the shadow holder width<br />
        dialogwrapper.css(&quot;width&quot;, widgetWidth + (finalShadowWidth * 2));<br />
}<br />
[/javascript]</p>
<p>That&#8217;s all when it comes to code (don&#8217;t forget to add to your HTML/JS code a dialog trigger, it can be a link or a button). I am really interested to hear your comments about it and suggestions. If you can suggest a better way of implementation &#8211; please do so, I am really keen to know <img src='http://initbinder.com/bunker/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://initbinder.com/articles/jquery-ui-add-a-shadow-around-a-dialog-box.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Java, Good Ways &#8211; A Book of Unwritten Rules, Tips and Gotchas</title>
		<link>http://initbinder.com/articles/java-good-ways-a-book-of-unwritten-rules-tips-and-gotchas.html</link>
		<comments>http://initbinder.com/articles/java-good-ways-a-book-of-unwritten-rules-tips-and-gotchas.html#comments</comments>
		<pubDate>Tue, 19 Apr 2011 06:37:49 +0000</pubDate>
		<dc:creator>Alexander Zagniotov</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[java book]]></category>
		<category><![CDATA[java tips]]></category>

		<guid isPermaLink="false">http://javabeans.asia/?p=996</guid>
		<description><![CDATA[A colleague of mine, who is currently my tech lead, wrote a book. The book Java, Good Ways is a collection of unwritten rules, tips and gotchas collected over a long period of time. The book comes to minimize the &#8230; <a href="http://initbinder.com/articles/java-good-ways-a-book-of-unwritten-rules-tips-and-gotchas.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A colleague of mine, who is currently my tech lead, wrote a book.</p>
<p>The book <a title="Java, Good Ways" href="http://javagoodways.com/" target="_blank">Java, Good Ways</a> is a collection of unwritten rules, tips and gotchas collected over a long period of time. The book comes to minimize the gap between university studies and what Java developers actually need to know.</p>
<p>Have a look, read through, let me know what you think or simply leave a comment on Java, Good Ways <img src='http://initbinder.com/bunker/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://initbinder.com/articles/java-good-ways-a-book-of-unwritten-rules-tips-and-gotchas.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Integrating Spring MVC with Hibernate Annotation-Based Validation</title>
		<link>http://initbinder.com/articles/integrating-spring-mvc-with-hibernate-annotation-based-validation.html</link>
		<comments>http://initbinder.com/articles/integrating-spring-mvc-with-hibernate-annotation-based-validation.html#comments</comments>
		<pubDate>Sat, 26 Mar 2011 07:55:32 +0000</pubDate>
		<dc:creator>Alexander Zagniotov</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[bean validation]]></category>
		<category><![CDATA[hibernate validator]]></category>
		<category><![CDATA[JSR-303]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[spring mvc]]></category>
		<category><![CDATA[validation]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://javabeans.asia/?p=969</guid>
		<description><![CDATA[In this article, I would like to demonstrate how to integrate Spring MVC, Spring bean validation framework and hibernate validator using annotations. The Hibernate Validator project is implementation of JSR 303 &#8211; Bean Validation standard, which defines a metadata model &#8230; <a href="http://initbinder.com/articles/integrating-spring-mvc-with-hibernate-annotation-based-validation.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In this article, I would like to demonstrate how to integrate Spring MVC, Spring bean validation framework and hibernate validator using annotations. The <a title="Hibernate Vlidator - Implementation of JSR 303  Bean Validation" href="http://www.hibernate.org/412.html" target="_blank">Hibernate Validator</a> project is implementation of <a title="Metadata model and API for JavaBean validation standard" href="http://jcp.org/en/jsr/detail?id=303" target="_blank">JSR 303 &#8211; Bean Validation</a> standard, which defines a metadata model and API for JavaBean validation. For the the purpose of this example, I used Spring Framework v3.0.5 and Hibernate Validator v4.1.0.</p>
<p>What I like about Spring + Hibernate validation, is that this combination eliminates the need to use validator classes in controllers for bean validation. In other words, less code, less classes, everything looks much cleaner.</p>
<p>I am not going to talk about how to build web application from scratch using Spring MVC. I assume that you already have something working in place. I am just going to show the important bits needed, in order to plug hibernate validation in to your code:</p>
<p>1. Define two following beans in your application context XML in your WEB-INF directory:</p>
<p>[xml]<br />
&lt;bean id=&quot;validator&quot;<br />
class=&quot;org.springframework.validation.beanvalidation.LocalValidatorFactoryBean&quot;/&gt;<br />
[/xml]</p>
<p>The basic configuration above will trigger JSR-303 to initialize using its default bootstrap mechanism. A JSR-303 provider, such as Hibernate Validator, is expected to be present in the classpath and will be detected automatically.</p>
<p>[xml]<br />
&lt;bean id=&quot;messageSource&quot;<br />
     class=&quot;org.springframework.context.support.ResourceBundleMessageSource&quot;&gt;<br />
	&lt;property name=&quot;basename&quot; value=&quot;/WEB-INF/message-resources.bundle&quot; /&gt;<br />
&lt;/bean&gt;<br />
[/xml]</p>
<p>The bean above knows how to access resource bundles using specified basenames.</p>
<p>2. Create resource bundle (in this example it is &#8220;message-resources.bundle&#8221;) under WEB-INF. The resource bundle is where you should define your validation messages that the end user sees if his form submission fails validation. Please note that the bundle does not have to be at the root of WEB-INF, it can be placed also in a sub-directory of WEB-INF. The format for validation messages in your bundle should be as follows:</p>
<p>[java]Annotation.bean-variable-name.bean-propery=validation error message.[/java]</p>
<p>For example:</p>
<p>[java]<br />
NotBlank.someFormName.name=Name must not be blank,<br />
Size.someFormName.name=Name must be less than or equal to {1} characters.<br />
NotBlank.someFormName.street=Street name should not be blank. Please enter a value<br />
NotEmpty.someFormName.selectedItem=Item selection is required<br />
[/java]</p>
<p>The example above describes four different validation messages for different validation rules. In case of a particular validation rule disobeyed, its respective validation message will be found based on the validation annotation, bean name and bean property name.</p>
<p>3. In your controller, in the method that validates bean from the POST request, annotate your bean with annotation <em>@Valid</em>. For example:</p>
<p>[java]<br />
@RequestMapping(value = &quot;/update.html&quot;, method = RequestMethod.POST)<br />
 public String update (    @ModelAttribute(&quot;someFormName&quot;)<br />
 @Valid SomeForm someFormName,<br />
 BindingResult result,<br />
 Model model)<br />
 {</p>
<p> if(result.hasErrors()) {<br />
 // Return view name<br />
 }</p>
<p> // Do stuff</p>
<p> // Return view name<br />
 }<br />
[/java]</p>
<p>The <em>@Valid</em> annotation is part of the standard <a title="Metadata model and API for JavaBean validation standard" href="http://jcp.org/en/jsr/detail?id=303" target="_blank">JSR 303 &#8211; Bean Validation</a> API, and is not a Spring-specific construct. The <a title="Hibernate Vlidator - Implementation of JSR 303  Bean Validation" href="http://www.hibernate.org/412.html" target="_blank">Hibernate Validator</a> instance invoked when a <em>@Valid </em>method argument is encountered.</p>
<p><strong>Very important</strong>: your bean variable name in your controller method (in this case its &#8220;<em>someFormName</em>&#8220;) must match the bean variable name in your validation message resource bundle.</p>
<p>4. Annotate your bean member variables with annotations that tell <a title="Hibernate Vlidator - Implementation of JSR 303  Bean Validation" href="http://www.hibernate.org/412.html" target="_blank">Hibernate Validator</a> what should be validated and what are the validation rules:</p>
<p>[java]<br />
public final class SomeForm {</p>
<p> @NotBlank<br />
 @Size(min=0,max=20)<br />
 private String name;</p>
<p> @NotBlank<br />
 private String street;</p>
<p> @NotEmpty<br />
 private String selectedItem;</p>
<p> // Getters</p>
<p> // Setters<br />
}<br />
[/java]</p>
<p>As you can see from the above bean, the three fields that should be validated are annotated with <em>@NotBlank</em>, <em>@NotEmpty</em> and <em></em><em>@Size</em>. The validation rules are simple: the <em>name </em>property must not be blank nor longer than 20 characters, <em>street </em>property must not be blank, while <em>selectedItem </em>must not be empty.</p>
<p>By the way, you can have more complicated validation rules in place using annotations. It is possible to use expressions which decide whether validation rules should fire. Consider the following, which validate an email field:</p>
<p>[java]<br />
@Email(applyIf=&quot;email is not blank&quot;)<br />
@NotBlank<br />
private String email;<br />
[/java]</p>
<p>You don&#8217;t want to display invalid email format error message when the filed is blank. Therefore that above expression in <em>@Email</em> annotation will have the rule fired only when the property is not blank. Expression can be especially very convenient when validating password fields:</p>
<p>[java]<br />
@NotBlank<br />
private String password;</p>
<p>@NotBlank(applyIf = &quot;password is not blank&quot;)<br />
@Expression(value = &quot;confirmedPassword= password&quot;, applyIf = &quot;password is not blank&quot;)<br />
private String confirmedPassword;<br />
[/java]</p>
<p>Validation rules for <em>confirmedPassword</em> property will fire only when <em>password</em> field will not be blank.</p>
<p>That&#8217;s it <img src='http://initbinder.com/bunker/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  If any rule(s) are disobeyed, the BindingResult result object will be populated with appropriate error messages, loaded from your message bundle. The error messages then can be displayed in your JSP using Spring tag:</p>
<p>[xml]<br />
&lt;spring:hasBindErrors name=&quot;someFormName&quot;&gt;<br />
	&lt;c:forEach items=&quot;${errors.allErrors}&quot; var=&quot;error&quot;&gt;<br />
		&lt;spring:message message=&quot;${error}&quot;/&gt;<br />
	&lt;/c:forEach&gt;<br />
&lt;/spring:hasBindErrors&gt;<br />
[/xml]</p>
<p>And that is it! Feel free to post a comment if you run into problems and I iwll try to help you the best I can <img src='http://initbinder.com/bunker/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://initbinder.com/articles/integrating-spring-mvc-with-hibernate-annotation-based-validation.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  initbinder.com/feed ) in 0.27710 seconds, on May 18th, 2012 at 5:47 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on May 18th, 2012 at 6:47 pm UTC -->
<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<!-- Quick Cache Is Fully Functional :-) ... A Quick Cache file was just served for (  initbinder.com/feed ) in 0.00070 seconds, on May 18th, 2012 at 6:24 pm UTC. -->
