<?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-2880666239023372253</id><updated>2026-01-29T00:07:44.664-08:00</updated><category term="Clean Coders"/><category term="for tar"/><title type='text'>Nuts</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://dreborier.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://dreborier.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Drea</name><uri>http://www.blogger.com/profile/12595457983926893287</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>18</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2880666239023372253.post-6077455572590588420</id><published>2012-07-03T09:18:00.002-07:00</published><updated>2012-07-03T10:05:42.207-07:00</updated><title type='text'>Mockito - ArgumentCaptor to check methods arguments equality</title><content type='html'>A link to a very useful post on this topic &lt;a href=&quot;http://www.rapaul.com/2010/06/10/avoiding-brittle-tests-with-mockitos-argument-captor/&quot;&gt;http://www.rapaul.com/2010/06/10/avoiding-brittle-tests-with-mockitos-argument-captor/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;map&gt;&lt;br /&gt;&lt;/map&gt;&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://dreborier.blogspot.com/feeds/6077455572590588420/comments/default' title='Commenti sul post'/><link rel='replies' type='text/html' href='http://dreborier.blogspot.com/2012/07/mockito-argumentcaptor-to-check-methods.html#comment-form' title='0 Commenti'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/6077455572590588420'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/6077455572590588420'/><link rel='alternate' type='text/html' href='http://dreborier.blogspot.com/2012/07/mockito-argumentcaptor-to-check-methods.html' title='Mockito - ArgumentCaptor to check methods arguments equality'/><author><name>Drea</name><uri>http://www.blogger.com/profile/12595457983926893287</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-2880666239023372253.post-4323360619019034305</id><published>2011-11-04T05:59:00.000-07:00</published><updated>2011-11-04T06:45:17.281-07:00</updated><title type='text'>git reset committed and pushed</title><content type='html'>Have you commit something by mistake and also pushed everything?&lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;git log&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;for the list of your log.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;The log output is something like:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;commit d946591753539639548b94b6aa40a875ce09a872&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Author: Andrea Boriero &amp;lt;dreborier@gmail.com&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Date: &amp;nbsp; Fri Nov 4 12:00:38 2011 +0000&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;bla bla bla&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;commit d946591753539639548b94b6aa40a875ce09a872&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Author: Andrea Boriero &amp;lt;dreborier@gmail.com&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;Date: &amp;nbsp; Fri Nov 4 12:00:38 2011 +0000&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: black;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;bla bla bla&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
choose the commit you want to revert back, for example&amp;nbsp;&lt;span style=&quot;background-color: transparent;&quot;&gt;d946591753539639548b94b6aa40a875ce09a872&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent;&quot;&gt;than to remove all commits after that:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;git reset -f --hard&amp;nbsp;d946591753539639548b94b6aa40a875ce09a872&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: inherit;&quot;&gt;and than to remove from origin:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;git push -f&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: inherit;&quot;&gt;Hope this can help someone.&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://dreborier.blogspot.com/feeds/4323360619019034305/comments/default' title='Commenti sul post'/><link rel='replies' type='text/html' href='http://dreborier.blogspot.com/2011/11/git-reset-committed-and-pushed.html#comment-form' title='0 Commenti'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/4323360619019034305'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/4323360619019034305'/><link rel='alternate' type='text/html' href='http://dreborier.blogspot.com/2011/11/git-reset-committed-and-pushed.html' title='git reset committed and pushed'/><author><name>Drea</name><uri>http://www.blogger.com/profile/12595457983926893287</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-2880666239023372253.post-6836252398509354986</id><published>2011-09-20T03:21:00.000-07:00</published><updated>2011-09-20T03:21:41.273-07:00</updated><title type='text'>Git - List all not pushed commits</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, sans-serif; font-size: 14px; line-height: 18px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; font-size: 14px; margin-bottom: 10px; max-height: 600px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; vertical-align: baseline; width: auto;&quot;&gt;&lt;code style=&quot;background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;git log --branches --not --remotes=origin&lt;/code&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; font-size: 14px; margin-bottom: 10px; max-height: 600px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; vertical-align: baseline; width: auto;&quot;&gt;&lt;code style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;shows commits that is not present on remote origin branch&lt;/code&gt;&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://dreborier.blogspot.com/feeds/6836252398509354986/comments/default' title='Commenti sul post'/><link rel='replies' type='text/html' href='http://dreborier.blogspot.com/2011/09/git-list-all-not-pushed-commits.html#comment-form' title='0 Commenti'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/6836252398509354986'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/6836252398509354986'/><link rel='alternate' type='text/html' href='http://dreborier.blogspot.com/2011/09/git-list-all-not-pushed-commits.html' title='Git - List all not pushed commits'/><author><name>Drea</name><uri>http://www.blogger.com/profile/12595457983926893287</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-2880666239023372253.post-197645094119975156</id><published>2011-08-26T05:31:00.000-07:00</published><updated>2011-08-26T05:34:33.411-07:00</updated><title type='text'>Git - restore deleted but not committed files</title><content type='html'>You have deleted the file HelloWorld.java but not yet committed, if you want to restore it :&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;git checkout HEAD&lt;/i&gt;&amp;nbsp;&amp;nbsp;HelloWorld.java</content><link rel='replies' type='application/atom+xml' href='http://dreborier.blogspot.com/feeds/197645094119975156/comments/default' title='Commenti sul post'/><link rel='replies' type='text/html' href='http://dreborier.blogspot.com/2011/08/git-restore-deleted-but-not-committed.html#comment-form' title='0 Commenti'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/197645094119975156'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/197645094119975156'/><link rel='alternate' type='text/html' href='http://dreborier.blogspot.com/2011/08/git-restore-deleted-but-not-committed.html' title='Git - restore deleted but not committed files'/><author><name>Drea</name><uri>http://www.blogger.com/profile/12595457983926893287</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-2880666239023372253.post-6913308212190913987</id><published>2011-08-25T02:08:00.000-07:00</published><updated>2011-08-26T05:33:51.328-07:00</updated><title type='text'>Git, undoing uncommitted changes</title><content type='html'>You have the staged file&amp;nbsp;HelloWorld.java, you have modified it and staged those changes but then you want to unstage those changes :&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;git &lt;b&gt;reset&lt;/b&gt; HEAD -- &lt;/i&gt;HelloWorld.java&lt;br /&gt;
&lt;br /&gt;
You have a new file&amp;nbsp;HelloWorld.java, you have added it to staged files but then you do not want to commit the new file:&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;git &lt;b&gt;rm&lt;/b&gt; --&lt;b&gt;cached&lt;/b&gt;&lt;/i&gt;&amp;nbsp;&amp;nbsp;HelloWorld.java&lt;br /&gt;
&lt;br /&gt;
if you want to undo all changes:&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;git &lt;b&gt;checkout&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;Be careful,&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;i&gt;git checkout&lt;/i&gt;&amp;nbsp;removes all untracked changes and you can&#39;t recover those changes anymore (files never tracked by Git will be deleted).&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://dreborier.blogspot.com/feeds/6913308212190913987/comments/default' title='Commenti sul post'/><link rel='replies' type='text/html' href='http://dreborier.blogspot.com/2011/08/git-undoing-stagingbefore-committing.html#comment-form' title='0 Commenti'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/6913308212190913987'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/6913308212190913987'/><link rel='alternate' type='text/html' href='http://dreborier.blogspot.com/2011/08/git-undoing-stagingbefore-committing.html' title='Git, undoing uncommitted changes'/><author><name>Drea</name><uri>http://www.blogger.com/profile/12595457983926893287</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-2880666239023372253.post-3614655390862587410</id><published>2011-08-17T00:31:00.000-07:00</published><updated>2011-08-17T00:31:48.558-07:00</updated><title type='text'>My personal imaginary interview with The Clean Coder book :-P</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: Arial, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;&lt;i&gt;Me&lt;/i&gt; : I must know my code works but how can I know my code works?&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: Arial, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: Arial, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;&lt;i&gt;Uncle Bob&#39;s book&lt;/i&gt; : That&#39;s easy.&amp;nbsp;Test it. Test it again. Test it up. Test it down. Test it seven ways to Sunday!... and don&#39;t forget to automate your test. &lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Me&lt;/i&gt;: But isn&#39;t code hard to test, my code really is?&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Uncle Bob&#39;s book&lt;/i&gt;: yes but only because that code has been designed to be hard to test.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Me&lt;/i&gt;: how can my code be designed to be easy to test?&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: Arial, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;&lt;br /&gt;
&lt;i&gt;Uncle Bob&#39;s book&lt;/i&gt;: the best way is to write your tests first, before you write the code that passes them (TDD).&amp;nbsp;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://dreborier.blogspot.com/feeds/3614655390862587410/comments/default' title='Commenti sul post'/><link rel='replies' type='text/html' href='http://dreborier.blogspot.com/2011/08/my-personal-imaginary-interview-with.html#comment-form' title='0 Commenti'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/3614655390862587410'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/3614655390862587410'/><link rel='alternate' type='text/html' href='http://dreborier.blogspot.com/2011/08/my-personal-imaginary-interview-with.html' title='My personal imaginary interview with The Clean Coder book :-P'/><author><name>Drea</name><uri>http://www.blogger.com/profile/12595457983926893287</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-2880666239023372253.post-6749988342161846837</id><published>2011-08-07T04:03:00.000-07:00</published><updated>2011-08-07T04:10:40.457-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="for tar"/><title type='text'>A very minimal guide to the tar command</title><content type='html'>to extract from an archive&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;for .&lt;i&gt;tar&lt;/i&gt; use&amp;nbsp;&lt;b&gt;tar -xvf [archiveName]&amp;nbsp;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;for .&lt;i&gt;tar.gz, .tgz&lt;/i&gt; &amp;nbsp;use &lt;b&gt;tar -xvzf [archivefile]&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;for &lt;i&gt;.tar.bz2, .tbz2, .tbz&lt;/i&gt; &amp;nbsp;use &lt;b&gt;tar -xvjf [archivefile]&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-weight: normal; line-height: 20px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif; font-size: 13px;&quot;&gt; .&lt;/span&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;tar&lt;/span&gt;&lt;/i&gt;&lt;i style=&quot;font-family: sans-serif; font-size: 13px;&quot;&gt;.Z&lt;/i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif; font-size: 13px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;than use&amp;nbsp;&lt;b&gt;tar -xv&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: sans-serif; font-size: 13px; font-weight: normal; line-height: 20px;&quot;&gt;&lt;b&gt;Z&lt;/b&gt;&lt;/span&gt;f [&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;b&gt;archivefile&lt;/b&gt;&lt;/span&gt;}&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div&gt;to compress a folder or a list of files&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;for .&lt;i&gt;tar&lt;/i&gt; use&amp;nbsp;&lt;b&gt;tar -cvf [archiveName] [pathname ...]&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;for .&lt;i&gt;tar.gz, .tgz&lt;/i&gt; &amp;nbsp;use&amp;nbsp;&lt;b&gt;tar -cvzf [archiveName] [pathname ...]&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;for&amp;nbsp;&lt;i&gt;.tar.bz2, .tbz2, .tbz&lt;/i&gt; &amp;nbsp;use&amp;nbsp;&lt;b&gt;tar -cvjf [archivename]&amp;nbsp;&lt;/b&gt;&lt;b&gt;[&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;b&gt;pathname&lt;/b&gt;&lt;/span&gt;&amp;nbsp;...]&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-weight: normal; line-height: 20px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Times New Roman&#39;; font-size: small; line-height: normal;&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Times New Roman&#39;; font-size: small; line-height: normal;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif; font-size: 13px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;tar&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif; font-size: 13px;&quot;&gt;.Z&amp;nbsp;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/b&gt;use&amp;nbsp;&lt;b&gt;tar -cv&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: sans-serif; font-size: 13px; font-weight: normal; line-height: 20px;&quot;&gt;&lt;b&gt;Z&lt;/b&gt;&lt;/span&gt;f&amp;nbsp;&lt;/b&gt;&lt;b&gt;[archivename]&amp;nbsp;&lt;/b&gt;&lt;b&gt;[&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;b&gt;pathname&lt;/b&gt;&lt;/span&gt;&amp;nbsp;...]&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div&gt;[pathname ...] can be the path of a folder or the path of a list of files you want to compress.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;to see the content of an archive, without extracting:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;for .&lt;i&gt;tar&lt;/i&gt; use&amp;nbsp;&lt;b&gt;tar -tvf [archiveName]&amp;nbsp;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;for &lt;i&gt;.tar.gz, .tgz &lt;/i&gt;&amp;nbsp;use&amp;nbsp;&lt;b&gt;tar -tvzf [archivefile]&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;for&amp;nbsp;&lt;i&gt;.tar.bz2, .tbz2, .tbz &lt;/i&gt;&amp;nbsp;use&amp;nbsp;&lt;b&gt;tar -tvjf [archivefile]&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-weight: normal; line-height: 20px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Times New Roman&#39;; font-size: small; line-height: normal;&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Times New Roman&#39;; font-size: small; line-height: normal;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif; font-size: 13px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;tar&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif; font-size: 13px;&quot;&gt;.Z&amp;nbsp;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/b&gt;use&amp;nbsp;&lt;b&gt;tar -tv&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: sans-serif; font-size: 13px; font-weight: normal; line-height: 20px;&quot;&gt;&lt;b&gt;Z&lt;/b&gt;&lt;/span&gt;f [&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;b&gt;archivefile&lt;/b&gt;&lt;/span&gt;}&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dreborier.blogspot.com/feeds/6749988342161846837/comments/default' title='Commenti sul post'/><link rel='replies' type='text/html' href='http://dreborier.blogspot.com/2011/08/very-minimal-guide-to-tar-command.html#comment-form' title='0 Commenti'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/6749988342161846837'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/6749988342161846837'/><link rel='alternate' type='text/html' href='http://dreborier.blogspot.com/2011/08/very-minimal-guide-to-tar-command.html' title='A very minimal guide to the tar command'/><author><name>Drea</name><uri>http://www.blogger.com/profile/12595457983926893287</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-2880666239023372253.post-8385253741315981441</id><published>2011-07-04T07:21:00.000-07:00</published><updated>2011-07-04T07:21:56.120-07:00</updated><title type='text'>Mocks and Stubs</title><content type='html'>What&#39;s &amp;nbsp;the difference?&lt;br /&gt;
&lt;br /&gt;
I found a very interesting post on this argument&amp;nbsp;&lt;a href=&quot;http://martinfowler.com/articles/mocksArentStubs.html&quot;&gt;Mocks Aren&#39;t Stubs&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
reading the post I have learned that&amp;nbsp;&lt;b&gt;Stubs&lt;/b&gt; use state verification while &lt;b&gt;Mocks&lt;/b&gt; use behaviour verification.&lt;br /&gt;
&lt;br /&gt;
In few words:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;with a &lt;b&gt;mock&lt;/b&gt; you expect your class calls some mock object methods which in turn will return a particular data, what you&#39;ll check is that the class under test will really call those methods.&lt;/li&gt;
&lt;li&gt;With a &lt;b&gt;stub&lt;/b&gt;, you implement the real object methods your test will use, naturally the implementation will be very easy. Than you&#39;ll check the state of the stub is what you expect (so you need to write some extra methods to access stub instance variables).&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; line-height: 22px;&quot;&gt;&amp;nbsp;Stubs may also record information about calls&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-size: 16px; line-height: 22px;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;I also learned that&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; line-height: 22px;&quot;&gt;&lt;b style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;classical TDD&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; line-height: 22px;&quot;&gt;&amp;nbsp;style uses real objects as much as possible and a &lt;i&gt;Test Double&lt;/i&gt; only if it&#39;s awkward to use the real ones while a&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; line-height: 22px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; line-height: 22px;&quot;&gt;&lt;b style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;mockist TDD&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; line-height: 22px;&quot;&gt;&amp;nbsp;style will always use a mock for all objects except the one under test.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: georgia, &#39;lucida bright&#39;, &#39;times new roman&#39;, serif; font-size: 16px; line-height: 22px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: georgia, &#39;lucida bright&#39;, &#39;times new roman&#39;, serif; line-height: 22px;&quot;&gt;Another couple of things:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: georgia, &#39;lucida bright&#39;, &#39;times new roman&#39;, serif; line-height: 22px;&quot;&gt;A &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: georgia, &#39;lucida bright&#39;, &#39;times new roman&#39;, serif; line-height: 22px;&quot;&gt;&lt;b&gt;Test Double&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: georgia, &#39;lucida bright&#39;, &#39;times new roman&#39;, serif; line-height: 22px;&quot;&gt; is a generic term used for any kind of object used to replace the real one for testing purposes.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: georgia, &#39;lucida bright&#39;, &#39;times new roman&#39;, serif; font-size: 16px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black; font-family: &#39;Times New Roman&#39;; font-size: small; line-height: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: georgia, &#39;lucida bright&#39;, &#39;times new roman&#39;, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 22px;&quot;&gt;Types of Test Doubles, other than stubs and Mock,s are&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black; font-family: &#39;Times New Roman&#39;; font-size: small; line-height: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: georgia, &#39;lucida bright&#39;, &#39;times new roman&#39;, serif; font-size: 16px; line-height: 22px;&quot;&gt;&lt;b style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-size: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;Dummy&lt;/b&gt;&amp;nbsp;objects that are passed around but never actually used, usually they are used just to fill parameter lists.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: georgia, &#39;lucida bright&#39;, &#39;times new roman&#39;, serif; font-size: 16px;&quot;&gt;&lt;b style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-size: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;Fake&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: georgia, &#39;lucida bright&#39;, &#39;times new roman&#39;, serif; font-size: 16px;&quot;&gt;&amp;nbsp;objects that have an implementation not suitable for production&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: georgia, &#39;lucida bright&#39;, &#39;times new roman&#39;, serif; font-size: 16px;&quot;&gt;.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: georgia, &#39;lucida bright&#39;, &#39;times new roman&#39;, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 22px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://dreborier.blogspot.com/feeds/8385253741315981441/comments/default' title='Commenti sul post'/><link rel='replies' type='text/html' href='http://dreborier.blogspot.com/2011/07/mocks-and-stubs.html#comment-form' title='0 Commenti'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/8385253741315981441'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/8385253741315981441'/><link rel='alternate' type='text/html' href='http://dreborier.blogspot.com/2011/07/mocks-and-stubs.html' title='Mocks and Stubs'/><author><name>Drea</name><uri>http://www.blogger.com/profile/12595457983926893287</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-2880666239023372253.post-4065100821814917022</id><published>2011-06-25T03:13:00.000-07:00</published><updated>2011-06-25T04:20:37.172-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Clean Coders"/><title type='text'>Professionalism is all about taking responsibility - First : Do Not Harm to Function</title><content type='html'>I just started reading the new Uncle Bob&#39;s Book &quot;The Clean Coder&quot;.&lt;br /&gt;
&lt;br /&gt;
From the beginning it seems another great book.&lt;br /&gt;
&lt;br /&gt;
Actually I&#39;m reading the first chapter titled &quot;Professionalism&quot;.&lt;br /&gt;
&lt;br /&gt;
I completely agree with Bob when he write &quot;&lt;b&gt;&lt;i&gt;professionalism is all about taking responsibility&lt;/i&gt;&quot;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;i&gt;How do we take responsibility?&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Uncle Bob says &quot;&lt;b&gt;First, Do Not Harm&lt;/b&gt;&quot; :&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;b&gt;do not harm to Function&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;do not harm Structure&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div&gt;&lt;b&gt;Do not harm to Function&lt;/b&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;, &lt;/b&gt;by being responsible for your errors.&lt;br /&gt;
&lt;br /&gt;
because the only way to not harm the function of our SW is not creating bugs therefore&lt;i&gt; &lt;b&gt;to be professional we&amp;nbsp;must not create bugs&lt;/b&gt;&lt;/i&gt; .&lt;br /&gt;
&lt;br /&gt;
You must apology for every bug QA or even worst users find.&lt;br /&gt;
But this is not enough, you have to struggle for decreasing your bug rate towards the asymptote of zero.... we know zero is impossible but this is not an excuse for not trying to be as close as possible to it. &amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
He tell us that it&#39;s unprofessional to send to QA &quot;&lt;i&gt;code you aren&#39;t &lt;b&gt;certain&lt;/b&gt; about&lt;/i&gt;&quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;YOU MUST KNOW IT WORKS&lt;/b&gt; and you have only a way to be sure it works:&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;You have to Test it, Test it and Test it .&lt;br /&gt;
&lt;br /&gt;
Uncle Bob &lt;i&gt;demand&lt;/i&gt;, not only suggest, for 100% test coverage.&lt;br /&gt;
&lt;br /&gt;
Naturally he tell us 100% is an asymptote as for 0 bugs.&lt;br /&gt;
&lt;br /&gt;
He tell us that if code is hard to test the only reason is that &quot;&lt;i&gt;code has been designed to be hard to test&lt;/i&gt;&quot; so &amp;nbsp;&quot;&lt;i&gt;design your code to be easy to test&lt;/i&gt;&quot;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Uncle Bob naturally tell us which is the best way to design our code for easy testing, &quot;&lt;i&gt;&lt;b&gt;write your test first&lt;/b&gt;&lt;/i&gt;&quot;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Here ends the first part of the story, in a future post I will talk about the Uncle Bob advise on how Do Not Harm Structure.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;This is only a very short and raw summary of the Do Not Harm to Function&amp;nbsp;topic, the book is full of explanations,&amp;nbsp;examples and&amp;nbsp;great stories... so I can only say buy the Book&amp;nbsp;&lt;a href=&quot;http://www.amazon.co.uk/Clean-Coder-Conduct-Professional-Programmers/dp/0137081073/ref=sr_1_1?ie=UTF8&amp;amp;qid=1308995753&amp;amp;sr=8-1&quot;&gt;The Clean Coder Book&lt;/a&gt;&amp;nbsp;and start reading it, for me is a must.&lt;br /&gt;
&lt;br /&gt;
A second advice is to visit&amp;nbsp;&lt;a href=&quot;http://www.cleancoders.com/&quot;&gt;The Clean Coders Web Site&lt;/a&gt;&amp;nbsp;the videos&amp;nbsp;are cheap and great.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dreborier.blogspot.com/feeds/4065100821814917022/comments/default' title='Commenti sul post'/><link rel='replies' type='text/html' href='http://dreborier.blogspot.com/2011/06/professionalism-is-all-about-taking.html#comment-form' title='0 Commenti'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/4065100821814917022'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/4065100821814917022'/><link rel='alternate' type='text/html' href='http://dreborier.blogspot.com/2011/06/professionalism-is-all-about-taking.html' title='Professionalism is all about taking responsibility - First : Do Not Harm to Function'/><author><name>Drea</name><uri>http://www.blogger.com/profile/12595457983926893287</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-2880666239023372253.post-2743260906881992017</id><published>2011-06-23T18:04:00.000-07:00</published><updated>2011-06-23T19:30:27.086-07:00</updated><title type='text'>goto statement - bad or not?</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;span class=&quot;hps&quot; title=&quot;Click for alternate translations&quot;&gt;I just&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;hps&quot; title=&quot;Click for alternate translations&quot;&gt;started reading&lt;/span&gt;&amp;nbsp;some stuff about&amp;nbsp;Go programming Language (&lt;/span&gt;&lt;a href=&quot;http://golang.org/&quot;&gt;http://golang.org/&lt;/a&gt;)&amp;nbsp;&lt;span class=&quot;hps&quot; title=&quot;Click for alternate translations&quot;&gt;and I discovered&lt;/span&gt;&amp;nbsp;it supports the goto statement.&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;hps&quot; title=&quot;Click for alternate translations&quot;&gt;But goto statement is bad..... a good programming language should not have a goto statement or not????&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 16px;&quot;&gt;&lt;span class=&quot;hps&quot; title=&quot;Click for alternate translations&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 16px;&quot;&gt;&lt;span class=&quot;hps&quot; title=&quot;Click for alternate translations&quot;&gt;So I started surfing the web trying to understand why smart guys like those at Google could create a &amp;nbsp;new language with a goto and I found&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://groups.google.com/group/golang-nuts/browse_thread/thread/d5638dd10010cef4/9641f94edc9209db?lnk=gst&amp;amp;q=goto#9641f94edc9209db&quot;&gt;golang-nuts&lt;/a&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 16px;&quot;&gt;&lt;span class=&quot;hps&quot; title=&quot;Click for alternate translations&quot;&gt;&amp;nbsp;and than the&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 19px;&quot;&gt;Linus Torvalds&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 19px;&quot;&gt;&amp;nbsp;opinion on this topic&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;a href=&quot;http://kerneltrap.org/node/553/2131&quot;&gt;http://kerneltrap.org/node/553/2131&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
I think it&#39;s worth reading.</content><link rel='replies' type='application/atom+xml' href='http://dreborier.blogspot.com/feeds/2743260906881992017/comments/default' title='Commenti sul post'/><link rel='replies' type='text/html' href='http://dreborier.blogspot.com/2011/06/goto-statement.html#comment-form' title='0 Commenti'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/2743260906881992017'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/2743260906881992017'/><link rel='alternate' type='text/html' href='http://dreborier.blogspot.com/2011/06/goto-statement.html' title='goto statement - bad or not?'/><author><name>Drea</name><uri>http://www.blogger.com/profile/12595457983926893287</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-2880666239023372253.post-7178997295836304034</id><published>2011-06-22T02:32:00.000-07:00</published><updated>2011-06-22T02:38:31.557-07:00</updated><title type='text'>Constant Interface Antipattern</title><content type='html'>I thought was a good practice to&amp;nbsp;&amp;nbsp;put static members into an interface and inherit from that interface.&lt;br /&gt;
&lt;br /&gt;
But it&#39;s&amp;nbsp;a very bad idea or even more an Antipattern :&amp;nbsp;&lt;i&gt;&lt;b&gt;Constant Interface Antipattern&lt;/b&gt; (see &lt;a href=&quot;http://java.sun.com/docs/books/effective/&quot;&gt;Effective Java&lt;/a&gt;)&amp;nbsp;.&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;Why is it so bad?&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;The use of static member from another class is an implementation details and interfaces are used to abstract from implementation details.&lt;/i&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;In other words:&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;The use of static member&amp;nbsp;&lt;/i&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-style: normal; line-height: 18px;&quot;&gt;causes a leakage of implementation details into many unrelated classes, because any of the defined static constant will be available to all of your classes that implement this interface.&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-style: normal; line-height: 18px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-style: normal; line-height: 18px;&quot;&gt;So remember:&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;I&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse; line-height: 18px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;nterfaces are for defining contracts, not for constants&lt;/b&gt;.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;br /&gt;
Why do you want to declare static members into an interface?&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;May be to avoid putting class names in front of constants while accessing them or&amp;nbsp;&lt;/i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse; line-height: 18px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;to group related constants&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse; font-family: Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, sans-serif; font-size: 14px; line-height: 18px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;i&gt;.&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;Solutions?&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;Put constants into class and use&amp;nbsp;&lt;/i&gt;&lt;i&gt;static import but&amp;nbsp;&lt;/i&gt;&lt;b&gt;Very sparingly!&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
Use only&amp;nbsp;when you require frequent access to static members from one or two classes.&lt;br /&gt;
&lt;br /&gt;
If you overuse the static import feature, it can make your program unreadable and unmaintainable, you&amp;nbsp;not know which class a static member comes from but used appropriately, static import can make your code&amp;nbsp;&lt;i&gt;more&lt;/i&gt;&amp;nbsp;readable, by removing the boilerplate of repetition of class names.&lt;br /&gt;
&lt;br /&gt;
Interesting link :&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://download.oracle.com/javase/1,5.0/docs/guide/language/static-import.html&quot;&gt;http://download.oracle.com/javase/1,5.0/docs/guide/language/static-import.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.jroller.com/ksevindik/entry/some_thoughts_about_constant_interface&quot;&gt;http://www.jroller.com/ksevindik/entry/some_thoughts_about_constant_interface&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://stackoverflow.com/questions/3547792/grouping-related-constants-shared-between-classes&quot;&gt;http://stackoverflow.com/questions/3547792/grouping-related-constants-shared-between-classes&lt;/a&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;</content><link rel='replies' type='application/atom+xml' href='http://dreborier.blogspot.com/feeds/7178997295836304034/comments/default' title='Commenti sul post'/><link rel='replies' type='text/html' href='http://dreborier.blogspot.com/2011/06/java-static-import.html#comment-form' title='0 Commenti'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/7178997295836304034'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/7178997295836304034'/><link rel='alternate' type='text/html' href='http://dreborier.blogspot.com/2011/06/java-static-import.html' title='Constant Interface Antipattern'/><author><name>Drea</name><uri>http://www.blogger.com/profile/12595457983926893287</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-2880666239023372253.post-2220435097706756255</id><published>2011-06-18T06:09:00.000-07:00</published><updated>2011-06-18T06:09:53.306-07:00</updated><title type='text'>Linux - which program is using a device</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px;&quot;&gt;There has never happened to not be able to unmount a device because of a message tells you some program is using it?&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px;&quot;&gt;But which program?&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small;&quot;&gt;The&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px;&quot;&gt;&lt;b&gt;lsof &lt;/b&gt;command&amp;nbsp;is what you need.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px;&quot;&gt;For example if I mount a device as /media/disk&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px;&quot;&gt;typing&amp;nbsp;&lt;b&gt;lsof /media/disk&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small;&quot;&gt;I obtain the following result:&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small;&quot;&gt;COMMAND &amp;nbsp;PID &amp;nbsp;USER &amp;nbsp; FD &amp;nbsp; TYPE DEVICE SIZE/OFF NODE NAME&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small;&quot;&gt;Thunar &amp;nbsp;1448 drea &amp;nbsp; 20r &amp;nbsp; DIR &amp;nbsp; 8,16 &amp;nbsp; &amp;nbsp;32768 &amp;nbsp; &amp;nbsp;1 /&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small;&quot;&gt;Thunar &amp;nbsp;1448 drea &amp;nbsp; 21r &amp;nbsp; DIR &amp;nbsp; 8,16 &amp;nbsp; &amp;nbsp;32768 &amp;nbsp; &amp;nbsp;1 /media/disk&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;font-weight: bold;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small;&quot;&gt;pretty useful information :-)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://dreborier.blogspot.com/feeds/2220435097706756255/comments/default' title='Commenti sul post'/><link rel='replies' type='text/html' href='http://dreborier.blogspot.com/2011/06/linux-which-program-is-using-device.html#comment-form' title='0 Commenti'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/2220435097706756255'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/2220435097706756255'/><link rel='alternate' type='text/html' href='http://dreborier.blogspot.com/2011/06/linux-which-program-is-using-device.html' title='Linux - which program is using a device'/><author><name>Drea</name><uri>http://www.blogger.com/profile/12595457983926893287</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-2880666239023372253.post-6928428271409879843</id><published>2011-05-24T06:29:00.000-07:00</published><updated>2011-05-24T06:33:11.004-07:00</updated><title type='text'>GWT ToggleButton ActionCell</title><content type='html'>GWT with version 2.1 introduced Cell widgets, we can find CellList, CellTable, CellTree and CellBrowser and a lot of Cell Types : TextCell,EditTextCell, ButtonCell ... &lt;a href=&quot;http://code.google.com/intl/it/webtoolkit/doc/latest/DevGuideUiCellWidgets.html#custom-cell&quot;&gt;GWT Developerr&#39;s Guide&lt;/a&gt;, what I wasn&#39;t able to find is a ToggleButton Cell Type so I decided to implement my own version. &lt;br /&gt;
&lt;br /&gt;
I called it ToggleButtonActionCell and the following is the code I wrote: &lt;br /&gt;
&lt;br /&gt;
&lt;c&gt;&lt;c&gt;&lt;c&gt;&lt;c&gt;&lt;c&gt;&lt;/c&gt;&lt;/c&gt;&lt;/c&gt;&lt;/c&gt;&lt;/c&gt;&lt;br /&gt;
public class ToggleButtonActionCell&amp;lt;C&amp;gt; extends AbstractCell&amp;lt;C&amp;gt; {&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private SelectionModel&amp;lt;C&amp;gt; selectionModel;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;/**&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; * An html string representation of a pressed button.&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; */&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private static final SafeHtml TOGGLE_BUTTON_UP = SafeHtmlUtils&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;.fromSafeConstant(&quot;&amp;lt;button type=\&quot;button\&quot; class=\&quot;toggleButton toggleButton-up\&quot; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tabindex=\&quot;-1\&quot; aria-pressed=\&quot;true\&quot;&amp;gt;&quot;);&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;/**&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; * An html string representation of an unpressed.&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; */&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private static final SafeHtml TOGGLE_BUTTON_DOWN = SafeHtmlUtils&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;.fromSafeConstant(&quot;&amp;lt;button type=\&quot;button\&quot; class=\&quot;toggleButton toggleButton-down\&quot; tabindex=\&quot;-1\&quot; aria-pressed=\&quot;false\&quot;&amp;gt;&quot;);&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;/**&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; * The delegate that will handle events from the cell.&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; *&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; * @param &amp;lt;T&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; * &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;the type that this delegate acts on&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; */&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static interface Delegate&amp;lt;T&amp;gt; {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;/**&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; * Perform the desired action on the given object.&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; *&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; * @param object&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; * &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;the object to be acted upon&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; */&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;void execute(T object, Boolean wasPressed);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private final SafeHtml upImage;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private final SafeHtml downImage;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected final SafeHtml htmlPressed;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected final SafeHtml htmlUnPpressed;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private final Delegate&amp;lt;C&amp;gt; delegate;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;SafeHtmlBuilder sb;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public ToggleButtonActionCell(Image upImage, Image downImage,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;SelectionModel&amp;lt;C&amp;gt; selectionModel, Delegate&amp;lt;C&amp;gt; delegate) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;super(&quot;click&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;this.upImage = new SafeHtmlBuilder().appendHtmlConstant(&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;upImage.toString()).toSafeHtml();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;this.downImage = new SafeHtmlBuilder().appendHtmlConstant(&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;downImage.toString()).toSafeHtml();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;this.delegate = delegate;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;this.htmlPressed = new SafeHtmlBuilder().append(TOGGLE_BUTTON_UP)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;.append(this.downImage).appendHtmlConstant(&quot;&amp;lt;/button&amp;gt;&quot;)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;.toSafeHtml();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;this.htmlUnPpressed = new SafeHtmlBuilder().append(TOGGLE_BUTTON_DOWN)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;.append(this.upImage).appendHtmlConstant(&quot;&amp;lt;/button&amp;gt;&quot;)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;.toSafeHtml();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;this.selectionModel = selectionModel;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;@Override&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void render(Context context, C value, SafeHtmlBuilder sb) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;this.sb = sb;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if (selectionModel.isSelected(value)) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;sb.append(htmlPressed);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} else {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;sb.append(htmlUnPpressed);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;@Override&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void onBrowserEvent(Context context, Element parent, C value,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;NativeEvent event, ValueUpdater&amp;lt;C&amp;gt; valueUpdater) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if (&quot;click&quot;.equals(event.getType())) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;super.onBrowserEvent(context, parent, value, event, valueUpdater);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;onEnterKeyDown(context, parent, value, event, valueUpdater);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;selectionModel.setSelected(value, !selectionModel.isSelected(value));&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;toggleButtonImage(parent, context,selectionModel.isSelected(value));&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;@Override&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;protected void onEnterKeyDown(Context context, Element parent, C value,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;NativeEvent event, ValueUpdater&amp;lt;C&amp;gt; valueUpdater) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;delegate.execute(value, selectionModel.isSelected(value));&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private void toggleButtonImage(Element parent, Context context, Boolean setPressed) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;com.google.gwt.user.client.Element button = getButton(parent);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if (setPressed) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;setPressed(button, true);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;setButtonImage(button, downImage);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} else {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;setPressed(button, false);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;setButtonImage(button, upImage);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private void setPressed(com.google.gwt.user.client.Element button, boolean isPressed) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;DOM.setElementAttribute(button, &quot;aria-pressed&quot;, Boolean.toString(isPressed));&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if(isPressed){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;DOM.setElementAttribute(button, &quot;class&quot;, &quot;toggleButton toggleButton-down&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}else{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;DOM.setElementAttribute(button, &quot;class&quot;, &quot;toggleButton toggleButton-up&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private void setButtonImage(Element button, SafeHtml image) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Element img = button.getFirstChildElement();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;button.removeChild(img);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;button.setInnerHTML(image.asString());&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private com.google.gwt.user.client.Element getButton(Element parent) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;com.google.gwt.user.client.Element button = parent&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;.getFirstChildElement().cast();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return button;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
I hope someone can find this code useful and any comment and suggestion is welcome.</content><link rel='replies' type='application/atom+xml' href='http://dreborier.blogspot.com/feeds/6928428271409879843/comments/default' title='Commenti sul post'/><link rel='replies' type='text/html' href='http://dreborier.blogspot.com/2011/05/gwt-togglebutton-actioncell.html#comment-form' title='0 Commenti'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/6928428271409879843'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/6928428271409879843'/><link rel='alternate' type='text/html' href='http://dreborier.blogspot.com/2011/05/gwt-togglebutton-actioncell.html' title='GWT ToggleButton ActionCell'/><author><name>Drea</name><uri>http://www.blogger.com/profile/12595457983926893287</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-2880666239023372253.post-1032115281385908579</id><published>2011-04-22T02:07:00.000-07:00</published><updated>2011-04-22T02:20:14.337-07:00</updated><title type='text'>Linux how to generate a ssh key and copy it to a server</title><content type='html'>This morning I had to generate a key for a ssh connection to a remote machine where we have our remote internal git repository. &lt;br /&gt;
&lt;br /&gt;
The first step is to generate the key using the &lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;command &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #cccccc;&quot;&gt;ssh-keygen -t rsa&lt;/span&gt;&amp;nbsp;which prompt to enter the key file name, I typed &lt;i&gt;&amp;nbsp;~/.ssh/id_rsa&lt;/i&gt; and to enter a passphrase (remember if you enter it you will be asked for it every time you want connect to the remote machine)&lt;br /&gt;
&lt;br /&gt;
now in the folder&amp;nbsp;&lt;i&gt;~/.ssh&lt;/i&gt;&amp;nbsp;there are 2 files:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;i&gt;id_rsa&lt;/i&gt;, the private key&lt;/li&gt;
&lt;li&gt;&lt;i&gt;id_rsa.pub&lt;/i&gt;, the public key&lt;/li&gt;
&lt;/ul&gt;&lt;div&gt;The second step is to copy the public key to the remote machine, to do that use the command &lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #cccccc;&quot;&gt;ssh-copy-id -i&amp;nbsp;~/.ssh/id_rsa&lt;b&gt;.pub &lt;/b&gt;user@remote_machine&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: #cccccc;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;This is all.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;In my case I had an old previous key with a differente name, I deleted it and so the ssh wasn&#39;t able to find my key. I discovered becouse every time I tryed to connect to the remote machine with &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #cccccc;&quot;&gt;ssh user@remote_machine&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;&amp;nbsp;my password (not my passphrase) was required. So I modified the &lt;i&gt;/etc/ssh/ssh-config&lt;/i&gt; file&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse; font-family: Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, sans-serif; font-size: 14px; line-height: 18px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; font-size: 14px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; max-height: 600px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; vertical-align: baseline; width: auto;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse; font-family: Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, sans-serif; font-size: 14px; line-height: 18px;&quot;&gt;&lt;code style=&quot;background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; font-family: &#39;Times New Roman&#39;; font-size: small; line-height: normal; white-space: normal;&quot;&gt;Host *&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; font-size: 14px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; max-height: 600px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; vertical-align: baseline; width: auto;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse; font-family: Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, sans-serif; font-size: 14px; line-height: 18px;&quot;&gt;&lt;code style=&quot;background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; font-family: &#39;Times New Roman&#39;; font-size: small; line-height: normal; white-space: normal;&quot;&gt;&lt;/span&gt;IdentityFile ~/.ssh/id_rsa #the private key location&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse; font-family: Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, sans-serif; font-size: 14px; line-height: 18px;&quot;&gt;to use multiple private keys to connect to different servers check&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://stackoverflow.com/questions/2419566/best-way-to-use-multiple-ssh-private-keys-on-one-client&quot;&gt;http://stackoverflow.com/questions/2419566/best-way-to-use-multiple-ssh-private-keys-on-one-client&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dreborier.blogspot.com/feeds/1032115281385908579/comments/default' title='Commenti sul post'/><link rel='replies' type='text/html' href='http://dreborier.blogspot.com/2011/04/linux-how-to-generate-ssh-key-and-copy.html#comment-form' title='0 Commenti'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/1032115281385908579'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/1032115281385908579'/><link rel='alternate' type='text/html' href='http://dreborier.blogspot.com/2011/04/linux-how-to-generate-ssh-key-and-copy.html' title='Linux how to generate a ssh key and copy it to a server'/><author><name>Drea</name><uri>http://www.blogger.com/profile/12595457983926893287</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-2880666239023372253.post-4070568148498786514</id><published>2011-04-21T08:51:00.000-07:00</published><updated>2011-04-21T08:54:17.744-07:00</updated><title type='text'>Delete all svn directory quickly in linux</title><content type='html'>Sometimes I had the need to remove all .svn folders from a project, a friend of mine told me a quick and easy way (if you are so lucky to work on linux).&lt;br /&gt;
From mc (Midnight commander)&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;navigate to the root folder of the project&amp;nbsp;&lt;/li&gt;
&lt;li&gt;press F9 and choose from the menu bar Command --&amp;gt; Find File&amp;nbsp;&lt;/li&gt;
&lt;li&gt;in the File name field enter .svn&lt;/li&gt;
&lt;li&gt;delete all from the Content field (leave it empty)&lt;/li&gt;
&lt;li&gt;press ok&lt;/li&gt;
&lt;li&gt;when the search end select the option Panelize ... all the finded folder will be shown in the classic mc directory panel&lt;/li&gt;
&lt;li&gt;select all with the insert keyboard button&lt;/li&gt;
&lt;li&gt;press F8&lt;/li&gt;
&lt;/ul&gt;&lt;div&gt;All the .svn folders will be removed.&lt;br /&gt;
&lt;br /&gt;
I hope this will be useful for some novice linux user like me :-)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;A quick mc tutorial&amp;nbsp;&lt;a href=&quot;http://www.trembath.co.za/mctutorial.html&quot;&gt;http://www.trembath.co.za/mctutorial.html&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dreborier.blogspot.com/feeds/4070568148498786514/comments/default' title='Commenti sul post'/><link rel='replies' type='text/html' href='http://dreborier.blogspot.com/2011/04/delete-all-svn-directory-quickly-with.html#comment-form' title='0 Commenti'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/4070568148498786514'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/4070568148498786514'/><link rel='alternate' type='text/html' href='http://dreborier.blogspot.com/2011/04/delete-all-svn-directory-quickly-with.html' title='Delete all svn directory quickly in linux'/><author><name>Drea</name><uri>http://www.blogger.com/profile/12595457983926893287</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-2880666239023372253.post-977337652976728765</id><published>2011-03-25T02:54:00.000-07:00</published><updated>2011-06-22T02:50:50.727-07:00</updated><title type='text'>Hibernate load vs get</title><content type='html'>The load method returns a proxy and hits the database only when you access a filed of the entity. If any entity is found the load method throws an ObjectNotFounfException but only when you try to access the entity fields.&lt;br /&gt;
&lt;br /&gt;
The get method hits the database as soon as it&#39;s called and if no entity is found returns null.&lt;br /&gt;
&lt;br /&gt;
When to use get and when load?&lt;br /&gt;
&lt;br /&gt;
The load method increases perfromance (hits the database only when necessary) so if you know your entity will be used only within the unit of work where it&#39;s retrieved than the load method is probably the best choice but if the retrieved entity is used outsite the transactional unit of work, e.g. it&#39;s displayed on a web page, using the get method is probably better.</content><link rel='replies' type='application/atom+xml' href='http://dreborier.blogspot.com/feeds/977337652976728765/comments/default' title='Commenti sul post'/><link rel='replies' type='text/html' href='http://dreborier.blogspot.com/2011/03/hibernate-load-vs-get.html#comment-form' title='0 Commenti'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/977337652976728765'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/977337652976728765'/><link rel='alternate' type='text/html' href='http://dreborier.blogspot.com/2011/03/hibernate-load-vs-get.html' title='Hibernate load vs get'/><author><name>Drea</name><uri>http://www.blogger.com/profile/12595457983926893287</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-2880666239023372253.post-7580965350949409538</id><published>2011-03-24T06:04:00.000-07:00</published><updated>2011-03-25T04:13:28.622-07:00</updated><title type='text'>Hibernate HQL and fetch=&quot;join&quot;</title><content type='html'>Mapping a relationship between two entities with fetch=&quot;join&quot; has two different behaviours depending on the type of query.&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;As an example if you have an entity Author&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;public class Author {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private long id;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private String name;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private Set&lt;book&gt; books = new HashSet&lt;book&gt;();&lt;/book&gt;&lt;/book&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public String getName() {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return name;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void setName(String name) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;this.name = name;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public Set&lt;book&gt; getBooks() {&lt;/book&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return books;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void setBooks(Set&lt;book&gt; books) {&lt;/book&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;this.books = books;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public long getId() {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return id;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;void setId(long id) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;this.id = id;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void addBook(Book b){&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;books.add(b);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;with his mapping file Author.hbm.xml :&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;class name=&quot;Author&quot; table=&quot;AUTHOR&quot;&gt;&lt;set cascade=&quot;save-update&quot; name=&quot;books&quot; table=&quot;BOOK&quot;&gt;&lt;hibernate-mapping package=&quot;org.dreborier.domain&quot;&gt;&lt;hibernate-mapping package=&quot;org.dreborier.domain&quot;&gt;&lt;class name=&quot;Author&quot; table=&quot;AUTHOR&quot;&gt;&lt;id column=&quot;AUTHOR_ID&quot; name=&quot;id&quot;&gt; &lt;generator class=&quot;native&quot;&gt;&lt;/generator&gt;   &lt;/id&gt;      &lt;property column=&quot;NAME&quot; name=&quot;name&quot;&gt;&lt;/property&gt;      &lt;set cascade=&quot;save-update&quot; fetch=&quot;join&quot; name=&quot;books&quot; table=&quot;BOOK&quot;&gt;   &lt;/set&gt;&lt;/class&gt;&lt;/hibernate-mapping&gt;&lt;/hibernate-mapping&gt;&lt;/set&gt;&lt;/class&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;class name=&quot;Author&quot; table=&quot;AUTHOR&quot;&gt;&lt;set cascade=&quot;save-update&quot; name=&quot;books&quot; table=&quot;BOOK&quot;&gt;&lt;hibernate-mapping package=&quot;org.dreborier.domain&quot;&gt;&lt;hibernate-mapping package=&quot;org.dreborier.domain&quot;&gt;&lt;class name=&quot;Author&quot; table=&quot;AUTHOR&quot;&gt;&lt;set cascade=&quot;save-update&quot; fetch=&quot;join&quot; name=&quot;books&quot; table=&quot;BOOK&quot;&gt;&amp;lt;hibernate-mapping package=&quot;org.dreborier.domain&quot;&amp;gt;  &amp;lt;class name=&quot;Author&quot; table=&quot;AUTHOR&quot;&amp;gt;   &amp;lt;id name=&quot;id&quot; column=&quot;AUTHOR_ID&quot;&amp;gt;    &amp;lt;generator class=&quot;native&quot;&amp;gt;&amp;lt;/generator&amp;gt;   &amp;lt;/id&amp;gt;      &amp;lt;property name=&quot;name&quot; column=&quot;NAME&quot;&amp;gt;&amp;lt;/property&amp;gt;      &amp;lt;set name=&quot;books&quot; table=&quot;BOOK&quot; cascade=&quot;save-update&quot; &lt;b&gt;fetch=&quot;join&quot;&lt;/b&gt;&amp;gt;    &amp;lt;key column=&quot;AUTHOR_ID&quot;&amp;gt;&amp;lt;/key&amp;gt;    &amp;lt;one-to-many class=&quot;Book&quot;/&amp;gt;   &amp;lt;/set&amp;gt;  &amp;lt;/class&amp;gt;  &amp;lt;/hibernate-mapping&amp;gt; &lt;key column=&quot;BOOK_ID&quot;&gt;&lt;/key&gt;  &amp;nbsp;&lt;/set&gt;&lt;/class&gt;&lt;/hibernate-mapping&gt;&lt;/hibernate-mapping&gt;&lt;/set&gt;&lt;/class&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;class name=&quot;Author&quot; table=&quot;AUTHOR&quot;&gt;&lt;set cascade=&quot;save-update&quot; name=&quot;books&quot; table=&quot;BOOK&quot;&gt;&lt;hibernate-mapping package=&quot;org.dreborier.domain&quot;&gt;&lt;hibernate-mapping package=&quot;org.dreborier.domain&quot;&gt;&lt;class name=&quot;Author&quot; table=&quot;AUTHOR&quot;&gt;&lt;set cascade=&quot;save-update&quot; fetch=&quot;join&quot; name=&quot;books&quot; table=&quot;BOOK&quot;&gt;&lt;/set&gt;&lt;/class&gt;&lt;/hibernate-mapping&gt;&lt;class name=&quot;Author&quot; table=&quot;AUTHOR&quot;&gt;   &lt;id column=&quot;AUTHOR_ID&quot; name=&quot;id&quot;&gt;  &lt;/id&gt;&lt;set cascade=&quot;save-update&quot; fetch=&quot;join&quot; name=&quot;books&quot; table=&quot;BOOK&quot;&gt; &lt;key column=&quot;BOOK_ID&quot;&gt;&lt;/key&gt;    &lt;one-to-many class=&quot;Book&quot;&gt;   &lt;/one-to-many&gt;&lt;/set&gt;  &lt;/class&gt;  &lt;/hibernate-mapping&gt; &lt;key column=&quot;BOOK_ID&quot;&gt;&lt;/key&gt;    &lt;one-to-many class=&quot;Book&quot;&gt;   &lt;/one-to-many&gt;&lt;/set&gt; &amp;nbsp;&lt;/class&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;class name=&quot;Author&quot; table=&quot;AUTHOR&quot;&gt;&lt;/class&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;and the entity Book :&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;public class Book {&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private long id;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private String title;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public String getTitle() {&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return title;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void setTitle(String title) {&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;this.title = title;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public long getId() {&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return id;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;void setId(long id) {&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;this.id = id;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;along with the mapping file Book.hbm.xml :&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&amp;lt;hibernate-mapping package=&quot;org.dreborier.domain&quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;  &amp;lt;class name=&quot;Book&quot; table=&quot;BOOK&quot;&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;  &amp;lt;id name=&quot;id&quot; column=&quot;BOOK_ID&quot;&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;   &amp;lt;generator class=&quot;native&quot;&amp;gt;&amp;lt;/generator&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;  &amp;lt;/id&amp;gt;   &amp;lt;property name=&quot;title&quot; column=&quot;TITLE&quot;&amp;gt;&amp;lt;/property&amp;gt;  &amp;lt;/class&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt; &amp;lt;/hibernate-mapping&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;class name=&quot;Book&quot; table=&quot;BOOK&quot;&gt; &lt;property column=&quot;TITLE&quot; name=&quot;title&quot;&gt;&lt;/property&gt;  &lt;/class&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;if you use a query by Criteria :&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;                Criteria criteria = session.createCriteria(Author.class);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;                List&lt;author&gt; authors = criteria.list();&lt;/author&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;with the &lt;i&gt;fecth=&quot;join&quot;&lt;/i&gt; attribute hibernate will execute the following query :&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; white-space: pre;&quot;&gt;select this_.AUTHOR_ID as AUTHOR1_0_1_, this_.NAME as NAME0_1_, books2_.BOOK_ID as BOOK1_0_3_, books2_.BOOK_ID as BOOK1_3_, books2_.BOOK_ID as BOOK1_1_0_, books2_.TITLE as TITLE1_0_ from AUTHOR this_ left outer join BOOK books2_ on this_.AUTHOR_ID=books2_.BOOK_ID&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;so books are loaded along with authors.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;while if you use HQL :&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;                Query query = session.createQuery(&quot;from Author&quot;);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;                List&lt;author&gt; authors = query.list();&lt;/author&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;hibernate will execute the following query:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; white-space: pre;&quot;&gt;select author0_.AUTHOR_ID as AUTHOR1_0_, author0_.NAME as NAME0_ from AUTHOR author0_&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;as you can see the &lt;b&gt;&lt;i&gt;fetch=&quot;join&quot;&lt;/i&gt; do not affect the HQL query &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;and a second query wiil be executed when an author&#39;s book is accessed&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;so if  you want to fetch eagerly the Book&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;using HQL &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;you have to use&lt;i&gt; left join fetch&lt;/i&gt; : &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;Query query = session.createQuery(&quot;from Author as author left join fetch&amp;nbsp;author.books&quot;);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;Hibernate Reference Documentation recommends &lt;/span&gt;&lt;br /&gt;
&lt;blockquote&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;Usually, the mapping document is not used to customize fetching. Instead, we keep the default&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;behavior, and override it for a particular transaction, using left join fetch in HQL. This tells&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;Hibernate to fetch the association eagerly in the first select, using an outer join. In the Criteria&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;query API, you would use setFetchMode(FetchMode.JOIN).&lt;/span&gt;&lt;/blockquote&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;The fetch=&quot;join&quot; attibute defined in the mapping file affects get and load methods.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;The following code:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;Author author = (Author) session.get(Author.class, 1L);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Set&lt;book&gt; books = author.getBooks();&lt;/book&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;books.size();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;without the fetch attribute will produce two database hits&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;select author0_.AUTHOR_ID as AUTHOR1_0_0_, author0_.NAME as NAME0_0_ from AUTHOR author0_ where author0_.AUTHOR_ID=?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;and&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;select books0_.AUTHOR_ID as AUTHOR3_0_1_, books0_.BOOK_ID as BOOK1_1_, books0_.BOOK_ID as BOOK1_1_0_, books0_.TITLE as TITLE1_0_ from BOOK books0_ where books0_.AUTHOR_ID=?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;while with fetch=&quot;join&quot; the database is hit only one time&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;select author0_.AUTHOR_ID as AUTHOR1_0_1_, author0_.NAME as NAME0_1_, books1_.AUTHOR_ID as AUTHOR3_0_3_, books1_.BOOK_ID as BOOK1_3_, books1_.BOOK_ID as BOOK1_1_0_, books1_.TITLE as TITLE1_0_ from AUTHOR author0_ left outer join BOOK books1_ on author0_.AUTHOR_ID=books1_.AUTHOR_ID where author0_.AUTHOR_ID=?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dreborier.blogspot.com/feeds/7580965350949409538/comments/default' title='Commenti sul post'/><link rel='replies' type='text/html' href='http://dreborier.blogspot.com/2011/03/hibernate-fetchjoin-different-behaviour.html#comment-form' title='0 Commenti'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/7580965350949409538'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/7580965350949409538'/><link rel='alternate' type='text/html' href='http://dreborier.blogspot.com/2011/03/hibernate-fetchjoin-different-behaviour.html' title='Hibernate HQL and fetch=&quot;join&quot;'/><author><name>Drea</name><uri>http://www.blogger.com/profile/12595457983926893287</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-2880666239023372253.post-2229117161209325602</id><published>2009-04-23T05:38:00.000-07:00</published><updated>2009-07-15T05:49:00.368-07:00</updated><title type='text'>Scelte</title><content type='html'>Prima domanda che mi sono posto, che cosa me ne faccio io di un blog? scrivere non mi è mai piaciuto, il foglio bianco mi ha sempre messo ansia.... Bah in effetti di fogli qui non ce ne sono quindi potrei provare. Deciso quindi di avere un blog nasce la seconda domanda che c... ci scrivo sopra, di che cosa parlo beh per ora attendo un illuminazione e in caso non arrivasse questo resterà l&#39;unico post e il mondo di sicuro non se ne dispiacerà</content><link rel='replies' type='application/atom+xml' href='http://dreborier.blogspot.com/feeds/2229117161209325602/comments/default' title='Commenti sul post'/><link rel='replies' type='text/html' href='http://dreborier.blogspot.com/2009/04/scelte.html#comment-form' title='1 Commenti'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/2229117161209325602'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2880666239023372253/posts/default/2229117161209325602'/><link rel='alternate' type='text/html' href='http://dreborier.blogspot.com/2009/04/scelte.html' title='Scelte'/><author><name>Drea</name><uri>http://www.blogger.com/profile/12595457983926893287</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></feed>