<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Out of my mind...: Category General</title>
    <link>http://blog.fredjean.net/articles/category/general</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Frederic Jean's Random Thoughts</description>
    <item>
      <title>Back on blogs.sun.com</title>
      <description>&lt;p&gt;I have been back at Sun for almost a year now. Still, there are a few things that I have yet to take care of. Things like unsubscribing from the Sun Alumni Yahoo! group. Or moving my RSS feed back to blogs.sun.com.&lt;/p&gt;
&lt;p&gt;Well, one of these things have been taken care of since I am now syndicated on blogs.sun.com instead of alumni.sun.com. It will be interesting to see how this affects my FeedBurner numbers...&lt;/p&gt;


</description>
      <pubDate>Thu, 17 Jul 2008 15:09:52 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:97bf2e1d-2cfc-4642-ae29-5d98ae42f20b</guid>
      <author>fred@fredjean.net (Frederic Jean)</author>
      <link>http://blog.fredjean.net/articles/2008/07/17/back-on-blogs-sun-com</link>
      <category>Work</category>
      <category>General</category>
    </item>
    <item>
      <title>Groovy Fizz and Buzz</title>
      <description>&lt;p&gt;The &lt;a href="http://tickletux.wordpress.com/2007/01/24/using-fizzbuzz-to-find-developers-who-grok-coding/"&gt;FizzBuzz programming interview&lt;/a&gt; question &lt;a href="http://www.dougalstanton.net/blog/index.php/2008/02/26/my-shame-is-complete"&gt;raised it's head again&lt;/a&gt;. I've managed to resist the temptation to implement it in any languages so far. Until this morning that is...&lt;/p&gt;
&lt;p&gt;So I fired up the Groovy Console and played a little. A nice feature of the console is that it displays a history of the scripts it ran. This allows me to present an evolution of my FizzBuzz program.&lt;/p&gt;
&lt;p&gt;I first started with a rather naive implementation:&lt;/p&gt;
&lt;pre&gt;
(1..100).each { 
  def out = "" 
  if ((it % 3) == 0) { out += "Fizz" } 
  if ((it % 5) == 0) { out += "Buzz" } 
  if (out == "" ) { out = it } 
  println out
}
&lt;/pre&gt;
&lt;p&gt;Not bad for something that I came up with in about 10 minutes. It doesn't really take advantage of Groovy's features though. So I refined it a bit by using the ternary operator:&lt;/p&gt;
&lt;pre&gt;
(1..100).each {
  def out = (it % 3) == 0 ? "Fizz" : ""
  out += (it % 5) == 0 ? "Buzz" : ""
  println (out == "" ? it : out)
}
&lt;/pre&gt;
&lt;p&gt;This is a slight improvement over the first version. I still didn't feel that this was Groovy enough for me. I decided to play with the List collect method. This applies a closure to all items in a collection. The first pass was the following code segment:&lt;/p&gt;
&lt;pre&gt;
println ((1..100).collect {
  def out = (it % 3) == 0 ? "Fizz" : ""
  out += (it % 5) == 0 ? "Buzz" : ""
  out == "" ? it : out
})
&lt;/pre&gt;
&lt;p&gt;This ended up printing the list returned by the collect method. Really close, but not quite what I was hoping for. After all, the challenge is to print the results, not quite a string representation of a list. It was easy then to go from the code above to the code below:&lt;/p&gt;
&lt;pre&gt;
(1..100).collect {
  def out = (it % 3) == 0 ? "Fizz" : ""
  out += (it % 5) == 0 ? "Buzz" : ""
  out ?: it
}.each { println it }
&lt;/pre&gt;
&lt;p&gt;This printed the list just like the first pass. It's definitively Groovier (in my opinion) than the original implementation. It still does fall short of the capabilities of Groovy.&lt;/p&gt;
&lt;p&gt;So here's my final implementation:&lt;/p&gt;
&lt;pre&gt;
(1..100).collect {
     ((it % 3) == 0 ? "Fizz" : "") &amp;lt;&amp;lt; ((it % 5) == 0 ? "Buzz" : "") ?: it
}.each { println it }
&lt;/pre&gt;
&lt;p&gt;This takes full advantage of Groovy's power. It is a little harder to read, which is a downside. It does take full advantage of many of Groovy's powerful features:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;A range to generate the list of numbers to process. Ranges return an iterator that iterates from the start of the range to the end of the range.&lt;/li&gt;

  &lt;li&gt;The collect method which applies a closure to each item in the collection (or iterator) and returns the results as a list.&lt;/li&gt;

  &lt;li&gt;The each method, which iterates through a list and applies a closure to it. It returns the collection that it iterated through.&lt;/li&gt;

  &lt;li&gt;Closures, which are implemented quite well in Groovy.&lt;/li&gt;

  &lt;li&gt;Operator overloading. The &amp;lt;&amp;lt; operator is overloaded on the String class to concatenate two Strings together.&lt;/li&gt;

  &lt;li&gt;The brand new Elvis operator (?:) which returns the alternate value if the expression evaluates to false.&lt;/li&gt;

  &lt;li&gt;Groovy returns the last expression of a block as the result of the block. This includes closures and methods.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I do think that I'll incorporate this question in future interviews. It has quite a few interesting subtleties and implementations that are only rivaled by the Singleton pattern. I guess that the last group of interviewees got it a little easier...&lt;/p&gt;&lt;br /&gt;


</description>
      <pubDate>Thu, 28 Feb 2008 06:57:02 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:f4b7533a-6d5e-4188-b95e-6747b2903c15</guid>
      <author>fred@fredjean.net (Frederic Jean)</author>
      <link>http://blog.fredjean.net/articles/2008/02/28/groovy-fizz-and-buzz</link>
      <category>Groovy</category>
      <category>General</category>
      <category>groovy</category>
      <category>programming</category>
      <category>fizzbuzz</category>
    </item>
    <item>
      <title>Groovy Fizz and Buzz</title>
      <description>&lt;p&gt;The &lt;a href="http://tickletux.wordpress.com/2007/01/24/using-fizzbuzz-to-find-developers-who-grok-coding/"&gt;FizzBuzz programming interview&lt;/a&gt; question &lt;a href="http://www.dougalstanton.net/blog/index.php/2008/02/26/my-shame-is-complete"&gt;raised it's head again&lt;/a&gt;. I've managed to resist the temptation to implement it in any languages so far. Until this morning that is...&lt;/p&gt;
&lt;p&gt;So I fired up the Groovy Console and played a little. A nice feature of the console is that it displays a history of the scripts it ran. This allows me to present an evolution of my FizzBuzz program.&lt;/p&gt;
&lt;p&gt;I first started with a rather naive implementation:&lt;/p&gt;
&lt;pre&gt;
(1..100).each { 
  def out = "" 
  if ((it % 3) == 0) { out += "Fizz" } 
  if ((it % 5) == 0) { out += "Buzz" } 
  if (out == "" ) { out = it } 
  println out
}
&lt;/pre&gt;
&lt;p&gt;Not bad for something that I came up with in about 10 minutes. It doesn't really take advantage of Groovy's features though. So I refined it a bit by using the ternary operator:&lt;/p&gt;
&lt;pre&gt;
(1..100).each {
  def out = (it % 3) == 0 ? "Fizz" : ""
  out += (it % 5) == 0 ? "Buzz" : ""
  println (out == "" ? it : out)
}
&lt;/pre&gt;
&lt;p&gt;This is a slight improvement over the first version. I still didn't feel that this was Groovy enough for me. I decided to play with the List collect method. This applies a closure to all items in a collection. The first pass was the following code segment:&lt;/p&gt;
&lt;pre&gt;
println ((1..100).collect {
  def out = (it % 3) == 0 ? "Fizz" : ""
  out += (it % 5) == 0 ? "Buzz" : ""
  out == "" ? it : out
})
&lt;/pre&gt;
&lt;p&gt;This ended up printing the list returned by the collect method. Really close, but not quite what I was hoping for. After all, the challenge is to print the results, not quite a string representation of a list. It was easy then to go from the code above to the code below:&lt;/p&gt;
&lt;pre&gt;
(1..100).collect {
  def out = (it % 3) == 0 ? "Fizz" : ""
  out += (it % 5) == 0 ? "Buzz" : ""
  out ?: it
}.each { println it }
&lt;/pre&gt;
&lt;p&gt;This printed the list just like the first pass. It's definitively Groovier (in my opinion) than the original implementation. It still does fall short of the capabilities of Groovy.&lt;/p&gt;
&lt;p&gt;So here's my final implementation:&lt;/p&gt;
&lt;pre&gt;
(1..100).collect {
     ((it % 3) == 0 ? "Fizz" : "") &amp;lt;&amp;lt; ((it % 5) == 0 ? "Buzz" : "") ?: it
}.each { println it }
&lt;/pre&gt;
&lt;p&gt;This takes full advantage of Groovy's power. It is a little harder to read, which is a downside. It does take full advantage of many of Groovy's powerful features:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;A range to generate the list of numbers to process. Ranges return an iterator that iterates from the start of the range to the end of the range.&lt;/li&gt;

  &lt;li&gt;The collect method which applies a closure to each item in the collection (or iterator) and returns the results as a list.&lt;/li&gt;

  &lt;li&gt;The each method, which iterates through a list and applies a closure to it. It returns the collection that it iterated through.&lt;/li&gt;

  &lt;li&gt;Closures, which are implemented quite well in Groovy.&lt;/li&gt;

  &lt;li&gt;Operator overloading. The &amp;lt;&amp;lt; operator is overloaded on the String class to concatenate two Strings together.&lt;/li&gt;

  &lt;li&gt;The brand new Elvis operator (?:) which returns the alternate value if the expression evaluates to false.&lt;/li&gt;

  &lt;li&gt;Groovy returns the last expression of a block as the result of the block. This includes closures and methods.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I do think that I'll incorporate this question in future interviews. It has quite a few interesting subtleties and implementations that are only rivaled by the Singleton pattern. I guess that the last group of interviewees got it a little easier...&lt;/p&gt;&lt;br /&gt;


</description>
      <pubDate>Thu, 28 Feb 2008 06:57:02 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:f4b7533a-6d5e-4188-b95e-6747b2903c15</guid>
      <author>fred@fredjean.net (Frederic Jean)</author>
      <link>http://blog.fredjean.net/articles/2008/02/28/groovy-fizz-and-buzz</link>
      <category>Groovy</category>
      <category>General</category>
      <category>groovy</category>
      <category>programming</category>
      <category>fizzbuzz</category>
    </item>
    <item>
      <title>New Countertops and Sink</title>
      <description>&lt;p style="text-align: center;"&gt;&lt;img src="http://blog.fredjean.net/files/P1200003.jpg" width="480" height="360" alt="Our new kitchen"/&gt;&lt;/p&gt;
&lt;p&gt;Our old countertops where in really bad shape, and it was driving my wife to insanity (or so she claims). We had done everything we could think of to extend their life. We painted them, we glued the old formica in place. But the paint started to chip and the formica didn't stay glued on very long. So we decided that we had to address the countertop situation.&lt;/p&gt;
&lt;p&gt;We remembered passing by a booth at the Flatiron Mall advertising an engineered granite solution by &lt;a href="http://www.granitetransformations.com/" title="Granite Transformations Home Page"&gt;Granite Transformations&lt;/a&gt;. It happens that I occasionally drive by their local franchise. We stopped by on a Saturday afternoon, got some information and scheduled an estimate. We did have a little sticker shock at first so we decided to compare other options before going ahead. It turns out that they were competitive with other options from Lowes and Home Depots.&lt;/p&gt;
&lt;p&gt;I had to take out the sink before the installation could occur, so we decided to upgrade the sink at the same time.&lt;/p&gt;
&lt;p&gt;The installation itself is a two step process. First, a template is built to facilitate the fabrication process. The team showed up right on time for the appointment and created the template. Three days later, they showed up for the installation proper. There was very little demolition involved. The old countertops didn't need to be ripped out since this is an overlay product. They were done right on time for lunch.&lt;/p&gt;
&lt;p&gt;I decided to install the sink myself. It did turn into a bit of a saga, like any home improvement projects that I take on. It was promptly resolved once I found the right feed lines for the sink. Within a few hours the sink and new faucets were installed and tested.&lt;/p&gt;
&lt;p&gt;My lovely wife is simply in love with the new kitchen and raves about it. I love it too and feel a lot of pride in having installed the sink myself. We are already compiling a list of projects to do next. It never really stops...&lt;/p&gt;


</description>
      <pubDate>Sun, 20 Jan 2008 19:02:13 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:4b61e8bf-df33-4fd5-acff-53105394b9dc</guid>
      <author>fred@fredjean.net (Frederic Jean)</author>
      <link>http://blog.fredjean.net/articles/2008/01/20/new-countertops-and-sink</link>
      <category>Personal</category>
      <category>General</category>
      <category>kitchen</category>
      <category>countertops</category>
    </item>
    <item>
      <title>Creating a Remote Mercurial Repository</title>
      <description>&lt;p&gt;I wanted to play with the metaprogramming abilities of Groovy. So I started a new project in NetBeans and created a Mercurial repository to version it. I had a few files committed eventually.&lt;/p&gt;
&lt;p&gt;I am really nervous about keeping code in a single location. This is why I do Time Machine backups on my mac. This is also why I keep a clone of Mercurial repositories on my workstation at work. Well, except for my personal projects. I keep a clone on the same server that is hosting this blog. I decided that this new project was worth cloning remotely.&lt;/p&gt;
&lt;p&gt;It turns out that you can clone a repository to a remote system just as easily that you can clone a repository from a remote system. The syntax is simply:&lt;/p&gt;&lt;code&gt;hg clone [local-repo] [remote-repo]&lt;/code&gt; &lt;span style="font-family: Monaco;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;p&gt;This even works over ssh. It also leads to a little more peace of mind on my part.&lt;/p&gt;


</description>
      <pubDate>Mon, 14 Jan 2008 07:04:06 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:6bf8198b-1d16-4abe-8b8e-6e5fd60d801a</guid>
      <author>fred@fredjean.net (Frederic Jean)</author>
      <link>http://blog.fredjean.net/articles/2008/01/14/creating-a-remote-mercurial-repository</link>
      <category>Personal</category>
      <category>General</category>
      <category>mercurial</category>
      <category>hg</category>
    </item>
    <item>
      <title>Creating a Remote Mercurial Repository</title>
      <description>&lt;p&gt;I wanted to play with the metaprogramming abilities of Groovy. So I started a new project in NetBeans and created a Mercurial repository to version it. I had a few files committed eventually.&lt;/p&gt;
&lt;p&gt;I am really nervous about keeping code in a single location. This is why I do Time Machine backups on my mac. This is also why I keep a clone of Mercurial repositories on my workstation at work. Well, except for my personal projects. I keep a clone on the same server that is hosting this blog. I decided that this new project was worth cloning remotely.&lt;/p&gt;
&lt;p&gt;It turns out that you can clone a repository to a remote system just as easily that you can clone a repository from a remote system. The syntax is simply:&lt;/p&gt;&lt;code&gt;hg clone [local-repo] [remote-repo]&lt;/code&gt; &lt;span style="font-family: Monaco;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;p&gt;This even works over ssh. It also leads to a little more peace of mind on my part.&lt;/p&gt;


</description>
      <pubDate>Mon, 14 Jan 2008 07:04:06 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:6bf8198b-1d16-4abe-8b8e-6e5fd60d801a</guid>
      <author>fred@fredjean.net (Frederic Jean)</author>
      <link>http://blog.fredjean.net/articles/2008/01/14/creating-a-remote-mercurial-repository</link>
      <category>Personal</category>
      <category>General</category>
      <category>mercurial</category>
      <category>hg</category>
    </item>
    <item>
      <title>Creating a Remote Mercurial Repository</title>
      <description>&lt;p&gt;I wanted to play with the metaprogramming abilities of Groovy. So I started a new project in NetBeans and created a Mercurial repository to version it. I had a few files committed eventually.&lt;/p&gt;
&lt;p&gt;I am really nervous about keeping code in a single location. This is why I do Time Machine backups on my mac. This is also why I keep a clone of Mercurial repositories on my workstation at work. Well, except for my personal projects. I keep a clone on the same server that is hosting this blog. I decided that this new project was worth cloning remotely.&lt;/p&gt;
&lt;p&gt;It turns out that you can clone a repository to a remote system just as easily that you can clone a repository from a remote system. The syntax is simply:&lt;/p&gt;&lt;code&gt;hg clone [local-repo] [remote-repo]&lt;/code&gt; &lt;span style="font-family: Monaco;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;p&gt;This even works over ssh. It also leads to a little more peace of mind on my part.&lt;/p&gt;


</description>
      <pubDate>Mon, 14 Jan 2008 07:04:06 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:6bf8198b-1d16-4abe-8b8e-6e5fd60d801a</guid>
      <author>fred@fredjean.net (Frederic Jean)</author>
      <link>http://blog.fredjean.net/articles/2008/01/14/creating-a-remote-mercurial-repository</link>
      <category>Personal</category>
      <category>General</category>
      <category>mercurial</category>
      <category>hg</category>
    </item>
    <item>
      <title>Creating a Remote Mercurial Repository</title>
      <description>&lt;p&gt;I wanted to play with the metaprogramming abilities of Groovy. So I started a new project in NetBeans and created a Mercurial repository to version it. I had a few files committed eventually.&lt;/p&gt;
&lt;p&gt;I am really nervous about keeping code in a single location. This is why I do Time Machine backups on my mac. This is also why I keep a clone of Mercurial repositories on my workstation at work. Well, except for my personal projects. I keep a clone on the same server that is hosting this blog. I decided that this new project was worth cloning remotely.&lt;/p&gt;
&lt;p&gt;It turns out that you can clone a repository to a remote system just as easily that you can clone a repository from a remote system. The syntax is simply:&lt;/p&gt;&lt;code&gt;hg clone [local-repo] [remote-repo]&lt;/code&gt; &lt;span style="font-family: Monaco;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;p&gt;This even works over ssh. It also leads to a little more peace of mind on my part.&lt;/p&gt;


</description>
      <pubDate>Mon, 14 Jan 2008 07:04:06 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:6bf8198b-1d16-4abe-8b8e-6e5fd60d801a</guid>
      <author>fred@fredjean.net (Frederic Jean)</author>
      <link>http://blog.fredjean.net/articles/2008/01/14/creating-a-remote-mercurial-repository</link>
      <category>Personal</category>
      <category>General</category>
      <category>mercurial</category>
      <category>hg</category>
    </item>
    <item>
      <title>Creating a Remote Mercurial Repository</title>
      <description>&lt;p&gt;I wanted to play with the metaprogramming abilities of Groovy. So I started a new project in NetBeans and created a Mercurial repository to version it. I had a few files committed eventually.&lt;/p&gt;
&lt;p&gt;I am really nervous about keeping code in a single location. This is why I do Time Machine backups on my mac. This is also why I keep a clone of Mercurial repositories on my workstation at work. Well, except for my personal projects. I keep a clone on the same server that is hosting this blog. I decided that this new project was worth cloning remotely.&lt;/p&gt;
&lt;p&gt;It turns out that you can clone a repository to a remote system just as easily that you can clone a repository from a remote system. The syntax is simply:&lt;/p&gt;&lt;code&gt;hg clone [local-repo] [remote-repo]&lt;/code&gt; &lt;span style="font-family: Monaco;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;p&gt;This even works over ssh. It also leads to a little more peace of mind on my part.&lt;/p&gt;


</description>
      <pubDate>Mon, 14 Jan 2008 07:04:06 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:6bf8198b-1d16-4abe-8b8e-6e5fd60d801a</guid>
      <author>fred@fredjean.net (Frederic Jean)</author>
      <link>http://blog.fredjean.net/articles/2008/01/14/creating-a-remote-mercurial-repository</link>
      <category>Personal</category>
      <category>General</category>
      <category>mercurial</category>
      <category>hg</category>
    </item>
    <item>
      <title>Enjoying The Rich Web Experience</title>
      <description>&lt;p&gt;
I am now in California. It should be sunny, but I can hardly tell since I'm engrossed into the most excellent &lt;a href="http://www.therichwebexperience.com/"&gt;Rich Web Experience&lt;/a&gt; conference put together by the &lt;a href="http://www.nofluffjuststuff.com/"&gt;No Fluff, Just Stuff&lt;/a&gt; team. 
&lt;/p&gt;&lt;p&gt;
The focus of this conference is on building rich internet based applications, whether they are written in pure HTML + CSS + JavaScript, Flex, AIR or Silverlight. There are discussions around security, performance, design sprinkled around talks about frameworks.
&lt;/p&gt;&lt;p&gt;
Access to the speakers is amazing just like any NFJS events. I had conversations with Greg Wilkins (Jetty), Dean H. Saxe (Security) and the usual suspect: Scott Davis, David Geary and Neal Ford. I even indulged in a little bit of hero worship by meeting Douglas Crockford, Yahoo's JavaScript architect. He gave talks on JavaScript and JSON in addition to giving a keynote speech.
&lt;/p&gt;&lt;p&gt;
The conference itself is a fast paced mix of keynotes, expert panels, presentations and networking. The caliber of the presenters and attendees is quite impressive. This is definitively my type of crowd. Where else would you be discussing and arguing about the meaning of HTTP response codes, the merits of Prototype versus Yahoo! UI Toolkit or Paranoids at Yahoo!? Right here at the Rich Web Experience in San Jose.
&lt;/p&gt;

</description>
      <pubDate>Sat, 08 Sep 2007 06:49:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:a988a571-4008-4a45-9305-eae1808203c4</guid>
      <author>fred@fredjean.net (Frederic Jean)</author>
      <link>http://blog.fredjean.net/articles/2007/09/08/enjoying-the-rich-web-experience</link>
      <category>Agile Development</category>
      <category>Development Process</category>
      <category>Javascript</category>
      <category>Web Development</category>
      <category>Java</category>
      <category>General</category>
      <category>richweb</category>
      <trackback:ping>http://blog.fredjean.net/articles/trackback/98</trackback:ping>
    </item>
  </channel>
</rss>
