<!DOCTYPE html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <title>Join The Machine</title>
  <meta name="description" content="Personal blog of Antoine Toulme" />
  <meta name="generator" content="Textile" />
  <link href="/stylesheets/main.css" rel="stylesheet" type="text/css" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link href="/feed/atom.xml" rel="alternate" title="Personal blog of Antoine Toulme" type="application/atom+xml" />
  <link rel="apple-touch-icon" href="/images/favicon.ico">
  <link rel="icon" type="image/png" href="/images/favicon.ico" />
  <script type="text/javascript">

    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-2663492-1']);
    _gaq.push(['_trackPageview']);

    (function() {
      var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
      ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();

  </script>
</head>
<body>
    <div id="wrap">  
    <div id="sidebar" class="mobile-hide">
      <a rel="license" href="http://creativecommons.org/licenses/by/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by/3.0/88x31.png" /></a>
      <div id="subscribe">
        <p><a href="/feed/atom.xml">Atom feed</a></p>
      </div>

      <div id="about">
        Personal blog. All ideas expressed my own.
      </div>

      <h2 id="latest_posts">Latest posts</h2>
      <ul>
      
        <li><a href="/2016/01/14/curly-braces.html">Curly braces in Java</a></li>
      
        <li><a href="/2016/01/08/INDEX.LIST-and-java-jar.html">INDEX.LIST and java -jar</a></li>
      
        <li><a href="/2015/12/19/mass-producing-custom-software.html">Mass producing custom software – no longer "mission impossible"</a></li>
      
        <li><a href="/2015/12/11/net-developer.html">How to get a raise if you develop in .NET.</a></li>
      
        <li><a href="/2015/10/22/four-types-of-wine.html">Only four types of wine, and three types of enterprise systems</a></li>
      
        <li><a href="/2015/10/13/buy-or-build.html">Buy or build? It does not matter</a></li>
      
        <li><a href="/2012/02/20/introducing-guesslink.html">Introducing Guesslink</a></li>
      
        <li><a href="/2011/12/08/class-methods-and-private-modifiers.html">Class methods and private modifiers</a></li>
      
        <li><a href="/2011/11/23/praise-for-waze.html">Some praise for Waze</a></li>
      
        <li><a href="/2011/11/23/congrats-mr-stallman.html">Congratulations, Mr Stallman!</a></li>
      
        <li><a href="/2011/11/18/spelling-webapp.html">Spelling webapp online</a></li>
      
        <li><a href="/2011/11/11/spelling-correctly.html">Getting help spelling words - Introducing the spell project</a></li>
      
        <li><a href="/2011/04/08/latest-jenkins-build-info.html">Latest jenkins build info</a></li>
      
        <li><a href="/2011/04/08/detect-git-changes.html">Detect git changes</a></li>
      
        <li><a href="/2011/02/13/query-wikipedia-...-apache-camel.html">Query wikipedia over DNS TXT queries with Apache Camel</a></li>
      
        <li><a href="/2010/11/22/caught-on-tape.html">Caught on tape</a></li>
      
        <li><a href="/2010/11/20/irc-logging.html">IRC logging</a></li>
      
        <li><a href="/2010/10/01/drools-committer.html">Drools Committer</a></li>
      
        <li><a href="/2010/06/22/speaker_tag.html">Eclipse OMG Symposium Speaker Tag</a></li>
      
        <li><a href="/2010/06/22/eclipse-omg-symposium-2010.html">Eclipse OMG symposium 2010</a></li>
      
      </ul>
      
    </div>
    <div id="content">
      <div id="header"><h1><a href="/">Join The Machine</a></h1>
  <p class="description" id="description" style="height: 100px;">
    
  </p>
  <script type="text/javascript">
    var lyrics = ["Welcome my son<br>Welcome to the machine<br>Where have you been?<br>It's alright we know where you've been"
,
    "You've been in the pipeline<br>Filling in time<br>Provided with toys and scouting for boys<br>You brought a guitar to punish your ma"
,
    "And you didn't like school<br>And you know you're nobody's fool<br>So welcome to the machine"
,
    "Welcome my son<br>Welcome to the machine<br>What did you dream?<br>It's alright we told you what to dream"
,
    "You dreamed of a big star<br>He played a mean guitar<br>He always ate in the Steak Bar<br>He loved to drive in his Jaguar<br>So welcome to the machine"]
  var i = 0;
  var fn = function() {
    document.getElementById("description").innerHTML = lyrics[i];
    i++;
    if (i >= lyrics.length) {
      i = 0;
    }
  };
  fn();
  window.setInterval(fn, 5000);
  </script> 
</div>
      
        <div class="entry home">
          <h2 class="entrytitle"><a href="/2016/01/14/curly-braces.html">Curly braces in Java</a></h2>
          <div class="meta">
  <p><span class="date">14 January 2016</span></p>
</div>
           <div class="entrybody"><p>When I started learning Java, I touched upon this <a href="http://stackoverflow.com/questions/4484884/java-just-curly-braces">technique</a> with a more senior programmer. It consists in declaring code in blocks separated by curly braces.</p>
<p>In effect, the programmer used it to debug faster code and copy and paste blocks that used the same variable.</p>
<p>This is really only useful when you deal with rich UI code and you need to declare ten times a label. An example:</p>
<pre><code>{
  vbox.getChildren().add(new Label("A"));
  TextField aBox = new TextField();
  aBox.setPromptText("A stuff");
  vbox.getChildren().add(aBox);
  aBox.setText("A stuff");
}
{
  vbox.getChildren().add(new Label("B"));
  TextField aBox = new TextField();
  aBox.setPromptText("B stuff");
  vbox.getChildren().add(aBox);
  aBox.setText("B value");
}</code></pre>
<p>This stuff is old, but you never know, it might save you from copy/pasta mistakes.</p></div>
            
        </div>
      
    </div>
    
  </div>

  <div id="footer">Powered by <a href="http://textile.thresholdstate.com/">Textile</a> <br /><span xmlns:dct="http://purl.org/dc/terms/" href="http://purl.org/dc/dcmitype/Text" property="dct:title" rel="dct:type">Join the Machine</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="http://www.github.com/atoulme" property="cc:attributionName" rel="cc:attributionURL">Antoine Toulme</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0 Unported License</a>.<br />Based on a work at <a xmlns:dct="http://purl.org/dc/terms/" href="http://www.github.com/atoulme/blog" rel="dct:source">www.github.com/atoulme/blog</a>.</div>
</body>
</html>