<?xml version="1.0" encoding="ISO-8859-1"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
> <channel><title>Bruno P. Kinoshita</title> <atom:link href="http://www.kinoshita.eti.br/feed/" rel="self" type="application/rss+xml" /><link>http://www.kinoshita.eti.br</link> <description>A paulistano geek website</description> <lastBuildDate>Tue, 10 Apr 2012 12:53:11 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <item><title>Maven site tips: Maven Fluido Skin and Javadoc class diagrams</title><link>http://www.kinoshita.eti.br/2012/04/06/maven-site-tips-maven-fluido-skin-and-javadoc-class-diagrams/</link> <comments>http://www.kinoshita.eti.br/2012/04/06/maven-site-tips-maven-fluido-skin-and-javadoc-class-diagrams/#comments</comments> <pubDate>Sat, 07 Apr 2012 00:01:52 +0000</pubDate> <dc:creator>Bruno Kinoshita</dc:creator> <category><![CDATA[Blog]]></category> <guid
isPermaLink="false">http://www.kinoshita.eti.br/?p=934</guid> <description><![CDATA[I have been using Maven sites for a while, and am very happy with it. I didn&#8217;t like to have to update my projects after Maven 3, but that was all right, Maven 3 brought many new cool things. However, there were two things that annoyed me: lack of a nice and modern skin, and [...]]]></description> <content:encoded><![CDATA[<p>I have been using Maven sites for a while, and am very happy with it. I didn&#8217;t like to have to update my projects after Maven 3, but that was all right, Maven 3 brought many new cool things. However, there were two things that annoyed me: lack of a nice and modern skin, and browsing Javadoc of complex code. The thought of creating a custom Maven skin even crossed my mind, but I never had time to read about it.</p><p>But the world is full of good and talented people!  Like the guys from <a
title="99soft" href="http://www.99soft.org/">99soft</a>. They created <a
title="Maven Fluido Skin" href="http://maven.apache.org/skins/maven-fluido-skin/">Maven Fluido Skin</a>, and donated it to <a
title="Apache Software Foundation" href="http://apache.org/">Apache Software Foundation</a>. It&#8217;s built on top of <a
title="Twitter Bootstrap" href="http://twitter.github.com/bootstrap/">Twitter&#8217;s Bootstrap</a> and available from Maven central repository. In order to use it in your Maven project, all that you have to do is add the following settings into your src/site/site.xml:</p><pre class="brush: xml; title: ; notranslate">
&lt;skin&gt;
    &lt;groupId&gt;org.apache.maven.skins&lt;/groupId&gt;
    &lt;artifactId&gt;maven-fluido-skin&lt;/artifactId&gt;
    &lt;version&gt;1.2.1&lt;/version&gt;
&lt;/skin&gt;
</pre><p>Here&#8217;s a list of some projects using Maven Fluido Skin (hopefully, in the near future <a
title="Apache Commons" href="http://commons.apache.org/">Apache Commons</a> and other projects will adopt this skin as default too <img
src='http://www.kinoshita.eti.br/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> ):</p><ul><li><a
title="Maven Fluido Skin" href="http://maven.apache.org/skins/maven-fluido-skin/">Maven Fluido Skin</a></li><li><a
title="tap4j" href="http://www.tap4j.org">tap4j</a></li><li><a
title="TestLink Java API" href="http://testlinkjavaapi.sf.net">TestLink Java API</a></li></ul><p
style="text-align: center"><a
href="http://www.kinoshita.eti.br/wp-content/uploads/2012/04/fluido-skin.png" rel="lightbox[934]" title="Maven Fluido Skin"><img
class="size-medium wp-image-937 aligncenter" title="Maven Fluido Skin" src="http://www.kinoshita.eti.br/wp-content/uploads/2012/04/fluido-skin-300x135.png" alt="Maven Fluido Skin" width="300" height="135" /></a></p><p>Regarding the Javadoc browsing, there&#8217;s a nice trick too: add class diagrams. I have seen a new Javadoc template in Apache Commons mailing list, but it was a work in progress, so for now I will stick with class diagrams. These diagrams are generated when you execute the javadoc or the site goals, using <a
title="Graphviz" href="http://www.graphviz.org/">graphviz</a>. And there is more. You can click on the diagram classes, as they have a link to the Java class that they reference to.</p><p>You can find instructions for setting up the diagram generation in <a
href="http://maven.apache.org/maven-1.x/plugins/javadoc/faq.html#classdiagrams">Apache Maven web site</a>, or looking at <a
href="https://github.com/kinow/tap4j/blob/master/pom.xml">examples</a> (I prefer the latter). But basically, you will need graphviz installed, and something like the following XML snippet in your project pom.xml.</p><pre class="brush: xml; title: ; notranslate">&lt;plugin&gt;
    &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
    &lt;artifactId&gt;maven-javadoc-plugin&lt;/artifactId&gt;
    &lt;version&gt;2.7&lt;/version&gt;
    &lt;configuration&gt;
        &lt;doclet&gt;gr.spinellis.umlgraph.doclet.UmlGraphDoc&lt;/doclet&gt;
        &lt;docletArtifact&gt;
            &lt;groupId&gt;gr.spinellis&lt;/groupId&gt;
            &lt;artifactId&gt;UmlGraph&lt;/artifactId&gt;
            &lt;version&gt;4.4&lt;/version&gt;
        &lt;/docletArtifact&gt;
        &lt;additionalparam&gt;
            -inferrel -inferdep -quiet -hide java.*
            -collpackages java.util.* -qualify
            -postfixpackage -nodefontsize 9
            -nodefontpackagesize 7
            -edgefontname &quot;Trebuchet MS&quot;
            -nodefontabstractname &quot;Trebuchet MS&quot;
            -nodefontclassabstractname
            &quot;Trebuchet MS&quot;
            -nodefontclassname &quot;Trebuchet MS&quot;
            -nodefontname
            &quot;Trebuchet MS&quot;
            -nodefontpackagename &quot;Trebuchet MS&quot;
            -nodefonttagname
            &quot;Trebuchet MS&quot;
        &lt;/additionalparam&gt;
    &lt;/configuration&gt;
&lt;/plugin&gt;</pre><p>Here&#8217;s how a diagram looks like (source: <a
href="http://tap4j.org/apidocs/index.html">http://tap4j.org/apidocs/index.html</a>):</p><p
style="text-align: center"><a
href="http://www.kinoshita.eti.br/wp-content/uploads/2012/04/javadoc-graphviz.png" rel="lightbox[934]" title="Javadoc class diagram"><img
class="size-medium wp-image-938 aligncenter" title="Javadoc class diagram" src="http://www.kinoshita.eti.br/wp-content/uploads/2012/04/javadoc-graphviz-300x135.png" alt="Javadoc class diagram" width="300" height="135" /></a></p><p>Have fun! <img
src='http://www.kinoshita.eti.br/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> and remember to check if your CI machine has graphviz installed too, otherwise you will have 404 in your Javadoc pages <img
src='http://www.kinoshita.eti.br/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /></p><p>Cheers</p> ]]></content:encoded> <wfw:commentRss>http://www.kinoshita.eti.br/2012/04/06/maven-site-tips-maven-fluido-skin-and-javadoc-class-diagrams/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Ranges in Apache Commons Functor</title><link>http://www.kinoshita.eti.br/2012/01/22/ranges-in-apache-functor/</link> <comments>http://www.kinoshita.eti.br/2012/01/22/ranges-in-apache-functor/#comments</comments> <pubDate>Sun, 22 Jan 2012 22:54:36 +0000</pubDate> <dc:creator>Bruno Kinoshita</dc:creator> <category><![CDATA[Blog]]></category> <category><![CDATA[Software]]></category> <guid
isPermaLink="false">http://www.kinoshita.eti.br/?p=903</guid> <description><![CDATA[This is a long post. So here is a TL;DR: Apache Commons Functor has no Double or Float Range (yet) Apache Commons Functor IntegerRange and LongRange treat the low value as inclusive, and the high value as exclusive. How does that compare to other languages/APIs? (you will have to read to see some comparison) Perl [...]]]></description> <content:encoded><![CDATA[<p>This is a long post. So here is a <strong>TL;DR</strong>:</p><ul><li>Apache Commons Functor has no Double or Float Range (yet)</li><li>Apache Commons Functor IntegerRange and LongRange treat the low value as inclusive, and the high value as exclusive. How does that compare to other languages/APIs? (you will have to read to see some comparison)</li><li>Perl has support for characters ranges, perhaps we could implement it in Functor too?</li><li>In case we implemented a CharacterRange, it would have to be inclusive for both low and high limits. With &#8216;z&#8217; being the last character, there wouldn&#8217;t have a way to include Z with the current approach. Or we would have to make the CharacterRange a special one. What would go against <a
title="Liskov Substitution Principle" href="http://en.wikipedia.org/wiki/Liskov_substitution_principle">Liskov Substitution Principle</a>.</li><li>You can see a comparison table with Apache Commons Functor, other Java API&#8217;s and other programming languages for ranges clicking <a
href="#ctable" title="Comparison table">here</a>.</li><li>It would be nice to have a clear distinction in Functor documentation among a Sequence, a Generator and a Range. While I was gathering material for this post, I found places using range, others using sequence, and in Apache Commons Functor, an IntegerRange is a Generator.</li></ul><p>Now, if you have some spare time or curiosity, keep reading <img
src='http://www.kinoshita.eti.br/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p><p><span
id="more-903"></span></p><p>This post is about ranges in <a
title="Apache Commons Functor" href="http://commons.apache.org/sandbox/functor/">Apache Commons Functor</a> but first let me explain the context. I am working on <a
title="nebular Java Fuzzy API" href="http://nebular.sourceforge.net/">nebular</a>, an open source fuzzy logic API. This API is written in pure Java, and has <a
title="Matlab Fuzzy Toolbox" href="http://www.mathworks.com/products/fuzzy-logic/index.html">Matlab Fuzzy Toolbox</a> as reference for the initial release. Nebular will use functional programming to let the user to model his/her membership functions. The API chosen for functional programming is Apache Commons Functor.</p><p>Yesterday I finished to port <a
title="Matlab sigmf membership function" href="http://www.mathworks.com/help/toolbox/fuzzy/sigmf.html">sigmf</a> function to nebular, including some tests that compare nebular&#8217;s output to Matlab sigmf function. However, here comes the issue with ranges, sequences and generators. The idea is to plot a graph similar to the one below.</p><p
style="text-align: center;"><a
href="http://www.kinoshita.eti.br/wp-content/uploads/2012/01/sigmf.gif" rel="lightbox[903]" title="sigmf"><img
class="aligncenter size-medium wp-image-904" title="sigmf" src="http://www.kinoshita.eti.br/wp-content/uploads/2012/01/sigmf-300x160.gif" alt="" width="300" height="160" /></a></p><p>The x axis contains values from 0 to 10, increasing by 0.1. In Matlab, I would execute the following command to produce the x vector.</p><pre class="brush: python; title: ; notranslate">x = 0:0.1:10;</pre><p>The : is the range operator in Matlab. It would create a vector with 101 elements. Yup, 101. That&#8217;s because in Matlab the low and high value used creating the range are inclusive. Now let&#8217;s look at how I create similar vector in Apache Commons Functor.</p><pre class="brush: java; title: ; notranslate">IntegerRange range = new IntegerRange(0, 11, 1 /* step */);</pre><p>So now one can realize two things: there is no Double or Float Range, and the high value in the range is exclusive. It means that in order to create an array (I will use vector and array interchangeably here for simplicity) with Functor from 0 to 10, including both values, you have to create a range using 0 and 11.</p><h3>Comparing with other Java functional programming API&#8217;s</h3><p>There are other API&#8217;s to include functional programming features to Java code. In this comparison I will include <a
title="Google Guava" href="http://code.google.com/p/guava-libraries/">Google Guava</a>, <a
title="fun4J" href="http://www.fun4j.org/">fun4j</a>, <a
title="Functional Java" href="http://functionaljava.org/">functionaljava</a>, <a
title="lambdaj" href="http://code.google.com/p/lambdaj/">lambdaj</a> and <a
title="op4j" href="http://www.op4j.org/">op4j</a> (got the list from the fun4f project page).</p><h4>Google Guava</h4><p>Google Guava provides the Range and Ranges classes. The Ranges contains several static methods for creating Range&#8217;s, that can be used as collections. The Ranges class contains methods for creating Range&#8217;s with open, closed, openClosed and closedOpen intervals.</p><pre class="brush: java; title: ; notranslate">public static void main(String[] args) {
 Range&lt;Integer&gt; values = Ranges.closed(0, 10);
 System.out.print(&quot;[ &quot;);
 for(Integer value : values.asSet(DiscreteDomains.integers())) {
 System.out.print(value + &quot; &quot;);
 }
 System.out.print(&quot;]&quot;);
 }</pre><pre class="brush: python; title: ; notranslate">[ 0 1 2 3 4 5 6 7 8 9 10 ]</pre><p>The Google Guava API does not provide a way to create ranges of floats. And I will have to find some time to read about the asSet method and on discrete domains. I am much more comfortable putting Apache Commons Functor API in my code for creating ranges. Specially since it makes the code more readable and easy to understand, helping to receive contributions in nebular from newcomers.</p><h4>fun4j</h4><p>fun4j contains classes to model functions, lambdas and bind LISP code to Java. However it has no objects for ranges.</p><h4>functionaljava</h4><p>Although there is the <a
title="Functional Java Seq class" href="http://code.google.com/p/functionaljava/source/browse/trunk/src/main/fj/data/Seq.java?r=358">Seq</a> class, I don&#8217;t know if that can be used for Ranges. So I will have to skip functionaljava <img
src='http://www.kinoshita.eti.br/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /></p><h4>lambdaj</h4><p>Couldn&#8217;t find a way to create ranges with lambdaj. Not sure if they support it or not.</p><h4>op4j</h4><p>Same as lambdaj, couldn&#8217;t find a way to create ranges with op4j. Not sure if they support it or not.</p><h3>Comparing with other programming languages</h3><p>So let&#8217;s see how we could generate a similar array using other programming languages.</p><h4>Python</h4><p>Python is one of my favorite languages, and has some functional programming features [1]. However it has no built-in mechanism for ranges with floats, only with integers. The functions that I know in Python use low value as inclusive, and high value as exclusive. The built in range functions in 2.7 looks like the following.</p><pre class="brush: python; title: ; notranslate">x = range(0, 11, 1) #inclusive/exclusive
print x;
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]</pre><p>Or you could write something like (remember Perl&#8217;s motto, TIMTOWTDI [2])</p><pre class="brush: python; title: ; notranslate">x = [x * 0.1 for x in range(0, 101)]; #inclusive/exclusive
print len(x);
 print x;
101
 [0.0, 0.1, 0.2, 0.30000000000000004, 0.4, ..., 10.0]</pre><p>There are API&#8217;s in Python too, like numpy, that has arange. However it is complicated specify a range to give similar array as the one produced by Matlab.</p><pre class="brush: python; title: ; notranslate">from numpy import arange;
x = arange(0, 10.1, .1); #inclusive/exclusive
print len(x);
 print x;
101
 [ 0. 0.1 0.2 ... 10.0]</pre><h4>Perl</h4><p>As we mentioned Perl in last section, let&#8217;s see how it works in Perl. First of all, I won&#8217;t use many modules here. Probably Perl is the language with more modules, or at least with a plethora of modules in <a
title="CPAN" href="http://www.cpan.org">CPAN</a> (wait to see <a
title="CJAN" href="http://www.cjan.org">CJAN</a> <img
src='http://www.kinoshita.eti.br/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> . There are books on Perl and Functional programming [3], and Perl has a built in mechanism for ranges. I used Perl 5 built in range operator and List::Gen range function. Both use the low and high value inclusive. It&#8217;s important to point out that Larry Wall and the programmers behind Perl are always keeping an eye on usability, ease of use, and Larry&#8217;s laziness. So that&#8217;s why Perl is a good language for comparisons of this type.</p><pre class="brush: perl; title: ; notranslate">#!/usr/bin/perl
use strict;
use warnings;
use feature 'say';
print &quot;[ &quot;;
for(0..10) { #inclusive/inclusive
 print $_, &quot; &quot;;
}
print &quot; ]&quot;</pre><pre class="brush: python; title: ; notranslate">[ 0 1 2 3 4 5 6 7 8 9 10 ]</pre><p>Or to use floats, we could use <a
title="List::Gen" href="http://search.cpan.org/dist/List-Gen/">List::Gen</a> module.</p><pre class="brush: perl; title: ; notranslate">#!/usr/bin/perl
use strict;
use warnings;
use feature 'say';
use List::Gen;
my $range = range 0, 10, 0.1; #inclusive/inclusive
print &quot;[ &quot;;
print $_, &quot; &quot; for @$range;
print &quot; ]&quot;</pre><pre class="brush: python; title: ; notranslate">[ 0 0.1 0.2 0.3 0.4 ... 10 ]</pre><p>Perl also has support to range of characters. Look at the examples from Perldoc.</p><pre class="brush: perl; title: ; notranslate"> @alphabet = (&quot;A&quot; .. &quot;Z&quot;); # inclusive/inclusive... how would it work if the last argument was not inclusive?
</pre><p>That would be cool if Functor had this feature too <img
src='http://www.kinoshita.eti.br/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /></p><h4>Scala</h4><p>Scala is a language that runs on the Java Virtual Machine, it has some functional programming features as anonymous functions, higher order functions, among others. It has a built in mechanism for ranges with integers or floats. It uses the low value as inclusive, and the high value as exclusive, however when using floats you may have trouble if you don&#8217;t pay attention to float precision.</p><pre class="brush: java; title: ; notranslate">object Test {
def main(args: Array[String]) {
var range = 0.0 until 10.0 by 0.1;
println(range);
}
}</pre><p>&nbsp;</p><pre class="brush: python; title: ; notranslate">NumericRange(0.0, 0.1, 0.2, ..., 9.99999999999998)</pre><h4>Matlab</h4><p>Why, yes sir, we will compare Matlab too. It has built in operator for ranges, and both values, low and high, are inclusive.</p><pre class="brush: python; title: ; notranslate">x=0:0.1:10;
display(x);
x =
Columns 1 through 9
0 0.1000 ...
... 10.0000
</pre><h4>PHP</h4><p>Although famous for its web applications, PHP can be an interesting language for scripting or creating handy utilities. I may be wrong, but I believe the scm_bot in Jenkins project, that posts messages to JIRA when someone commits to a SCM with a special string, is written in PHP. It has a built in function for ranges in 5.3, and both values are inclusive.</p><pre class="brush: php; title: ; notranslate">$range = range(0, 10, 0.1);
 echo &quot;[ &quot;;
 foreach($range as $number) {
 echo $number . &quot; &quot;;
 }
 echo &quot;]&quot;;
[ 0 0.1 0.2 0.3 ... 9.9 10 ]
</pre><h4>Haskell</h4><p>Haskell has gained more attention lately with web frameworks. It has features such as monads, functors and high order function. And also has a built-in range operator. Both, left and right values of the range are inclusive in Haskell&#8217;s range operator.</p><pre class="brush: python; title: ; notranslate">[0 .. 10]
=&gt; [0,1,2,3,4,5,6,7,8,9,10]</pre><p>Unfortunately I don&#8217;t know Haskell so well, and couldn&#8217;t make it work with floats, nor find out whether it is possible or not <img
src='http://www.kinoshita.eti.br/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /></p><h4>lua</h4><p>While lua has no built-in support to ranges, if you search for lua and range functions or operators, probably you will find an entry in lua&#8217;s Wiki with a range function, contributed by a user. The function implemented uses the low and high value inclusively and has support for both integer and floats.</p><pre class="brush: cpp; title: ; notranslate">-- http://lua-users.org/wiki/RangeIterator
function range(from, to, step)
 step = step or 1
 return function(_, lastvalue)
 local nextvalue = lastvalue + step
 if step &gt; 0 and nextvalue &lt;= to or step &lt; 0 and nextvalue &gt;= to or
 step == 0
 then
 return nextvalue
 end
 end, nil, from - step
end
function f() return 0, 10, 0.1 end
io.write(&quot;[ &quot;);
for i in range(f()) do
 io.write(i, &quot; &quot;)
end
io.write(&quot;]&quot;);</pre><pre class="brush: python; title: ; notranslate">[ 0 0.1 0.2 0.3 ...  9.9 10 ]</pre><h4>LISP</h4><p>Lisp is probably one of the oldest programming languages with functional features. Every time I read something about functional programming and collections it reminds me of Lisp recursion with lists. In Lisp you can use loop to iterate over a range of integers or floats, and both values are included for integers, for float, there is some precision problem that I couldn&#8217;t overcome. For integers the following code would do.</p><pre class="brush: python; title: ; notranslate">&gt;(loop for i from 0 to 10 do (print i))
0
1
2
...
10
NIL</pre><p>And for floats.</p><pre class="brush: python; title: ; notranslate">&gt;(loop for i from 0.0 to 10.0 by 0.1 do (print i))
0.0
0.1
0.2
...
9.900002
NIL</pre><p>Again, issues with precision.</p><h4>Clojure</h4><p>Although Clojure is quite similar to LISP, I had some trouble setting up an example for this. My first try was with loop, but as it didn&#8217;t work, I used dorun. It uses the low value as inclusive, and the high value as exclusive. Strange, I thought it would have similar behavior to the loop in LISP. But I only know the very basics of each language, and the explanation is beyond my knowledge. Anyway, it&#8217;s interesting I guess.</p><pre class="brush: python; title: ; notranslate">(dorun (for [i (range 0 10 1)] (println i)))
0
1
...
9
nil</pre><h3><a
name="ctable">Comparison Table</a></h3><p>To simplify the understanding, here is a comparison table.</p><style type="text/css">table {
border: 1px solid #CCCCCC;
}
table tr {
border: 1px solid #CCCCCC;
}
table tr th {
border: 1px solid #EEEEEE;
background-color: #CCCCCC;
}
table tr td {
border: 1px solid #CCCCCC;
}</style><div
class="column span-17" style="overflow: auto;border: 1px solid #CCCCCC;"><table
border="0" cellspacing="0" cellpadding="0" class="ta1"><colgroup><col
width="180"/><col
width="130"/><col
width="134"/><col
width="99"/><col
width="99"/><col
width="99"/><col
width="99"/><col
width="99"/><col
width="135"/><col
width="99"/><col
width="99"/><col
width="99"/><col
width="99"/><col
width="99"/><col
width="99"/><col
width="99"/><col
width="99"/><col
width="99"/></colgroup><tr
class="ro1"><th
style="text-align:left;width:1.6252in; " class="Default"> </th><th
style="text-align:left;width:1.1728in; " class="Default"><p>Apache Commons Functor</p></th><th
style="text-align:left;width:1.2047in; " class="Default"><p>Google Guava</p></th><th
style="text-align:left;width:0.8925in; " class="Default"><p>fun4j</p></th><th
style="text-align:left;width:0.8925in; " class="Default"><p>functionaljava</p></th><th
style="text-align:left;width:0.8925in; " class="Default"><p>lambdaj</p></th><th
style="text-align:left;width:0.8925in; " class="Default"><p>op4j</p></th><th
style="text-align:left;width:0.8925in; " class="Default"><p>Python</p></th><th
style="text-align:left;width:1.2161in; " class="Default"><p>Python – numpy.arange</p></th><th
style="text-align:left;width:0.8925in; " class="Default"><p>Perl</p></th><th
style="text-align:left;width:0.8925in; " class="Default"><p>Perl List::Gen</p></th><th
style="text-align:left;width:0.8925in; " class="Default"><p>Scala</p></th><th
style="text-align:left;width:0.8925in; " class="Default"><p>Matlab</p></th><th
style="text-align:left;width:0.8925in; " class="Default"><p>PHP</p></th><th
style="text-align:left;width:0.8925in; " class="Default"><p>Haskell</p></th><th
style="text-align:left;width:0.8925in; " class="Default"><p>lua (Wiki contrib)</p></th><th
style="text-align:left;width:0.8925in; " class="Default"><p>LISP</p></th><th
style="text-align:left;width:0.8925in; " class="Default"><p>Clojure</p></th></tr><tr
class="ro1"><td
style="text-align:left;width:1.6252in; " class="Default"><p>Integer range</p></td><td
style="text-align:left;width:1.1728in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:1.2047in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>N/A</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>N/A</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>N/A</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>N/A</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:1.2161in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES</p></td></tr><tr
class="ro1"><td
style="text-align:left;width:1.6252in; " class="Default"><p>Float range</p></td><td
style="text-align:left;width:1.1728in; " class="Default"><p>NO</p></td><td
style="text-align:left;width:1.2047in; " class="Default"><p>NO</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>N/A</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>N/A</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>N/A</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>N/A</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>NO</p></td><td
style="text-align:left;width:1.2161in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>NO</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>NO?</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>NO?</p></td></tr><tr
class="ro1"><td
style="text-align:left;width:1.6252in; " class="Default"><p>Includes low limit</p></td><td
style="text-align:left;width:1.1728in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:1.2047in; " class="Default"><p>YES/NO</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>N/A</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>N/A</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>N/A</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>N/A</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:1.2161in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES</p></td></tr><tr
class="ro1"><td
style="text-align:left;width:1.6252in; " class="Default"><p>Includes high limit</p></td><td
style="text-align:left;width:1.1728in; " class="Default"><p>NO</p></td><td
style="text-align:left;width:1.2047in; " class="Default"><p>YES/NO</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>N/A</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>N/A</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>N/A</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>N/A</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>NO</p></td><td
style="text-align:left;width:1.2161in; " class="Default"><p>NO</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>NO</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>YES?</p></td><td
style="text-align:left;width:0.8925in; " class="Default"><p>NO</p></td></tr></table></div><hr
class="space" /><p>That&#8217;s it, I will ping some guys from Apache dev-list to see what they think about the bullets in TL;DR. After writing this post I realized I need to change this blog&#8217;s layout to give more space for code and tables <img
src='http://www.kinoshita.eti.br/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /></p><p>Cheers</p><p>[1] <a
href="http://docs.python.org/howto/functional.html">http://docs.python.org/howto/functional.html</a></p><p>[2] <a
href="http://c2.com/cgi/wiki?ThereIsMoreThanOneWayToDoIt">http://c2.com/cgi/wiki?ThereIsMoreThanOneWayToDoIt</a></p><p>[3] <a
href="http://perl.plover.com/yak/fp/">http://perl.plover.com/yak/fp/</a></p> ]]></content:encoded> <wfw:commentRss>http://www.kinoshita.eti.br/2012/01/22/ranges-in-apache-functor/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Testing shell code and producing TAP using Jenkins?</title><link>http://www.kinoshita.eti.br/2011/12/30/testing-shell-code-and-producing-tap-using-jenkins/</link> <comments>http://www.kinoshita.eti.br/2011/12/30/testing-shell-code-and-producing-tap-using-jenkins/#comments</comments> <pubDate>Sat, 31 Dec 2011 01:41:40 +0000</pubDate> <dc:creator>Bruno Kinoshita</dc:creator> <category><![CDATA[Blog]]></category> <category><![CDATA[Hudson]]></category> <category><![CDATA[TAP]]></category> <category><![CDATA[Testing]]></category> <guid
isPermaLink="false">http://www.kinoshita.eti.br/?p=880</guid> <description><![CDATA[Definitely reading Hacker News before going to bed is a bad idea Same goes for Reddit. So, I found a link about Bats, a tool to execute tests in Shell and output TAP &#8211; Test Anything Protocol. Then I thought; why not ask the author to include Bats under the list of Producers in testanything.org? [...]]]></description> <content:encoded><![CDATA[<p>Definitely reading <a
title="Hacker News" href="http://news.ycombinator.com/">Hacker News</a> before going to bed is a bad idea <img
src='http://www.kinoshita.eti.br/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> Same goes for <a
title="Reddit" href="http://www.reddit.com">Reddit</a>. So, I found a link about <a
title="Bats" href="https://github.com/sstephenson/bats">Bats</a>, a tool to execute tests in Shell and output <a
title="Test Anything Protocol" href="http://testanything.org">TAP</a> &#8211; Test Anything Protocol. Then I thought; why not ask the author to include Bats under the list of <a
title="TAP Producers" href="http://testanything.org/wiki/index.php/TAP_Producers#SH_.2F_Shell_Script">Producers</a> in <a
title="Test Anything Protocol" href="http://testanything.org">testanything.org</a>?</p><p>But you know what? Why not execute execute locally first to check if that&#8217;s working&#8230; moreover, why not use <a
title="Jenkins TAP Plug-in" href="https://wiki.jenkins-ci.org/display/JENKINS/TAP+Plugin">Jenkins TAP Plug-in</a> and see what happens?</p><p>Here&#8217;s what is necessary.</p><ul><li><a
title="Jenkins CI" href="http://www.jenkins-ci.org">Jenkins</a> (duh)</li><li><a
title="Jenkins TAP Plug-in" href="https://wiki.jenkins-ci.org/display/JENKINS/TAP+Plugin">tap plug-in</a></li><li><a
title="Jenkins Git Plugin" href="https://wiki.jenkins-ci.org/display/JENKINS/git+Plugin">git plug-in</a></li><li><a
title="Bast git repository" href="https://github.com/sstephenson/bats">Bats git repository URL</a></li><li><a
title="Baden Baden" href="http://www.badenbaden.com.br/">Baden Baden Red Ale beer</a> (it&#8217;s Friday, almost new years&#8217; eve, c&#8217;mon)</li></ul><p>Install Jenkins, tap plug-in and git plug-in. Create a new free style build. Add Bats git repository url under SCM. This way Jenkins will retrieve Bats code from Github (you don&#8217;t need to install it if you don&#8217;t want to). Add a build step which executes the following shell code: <tt>./bin/bats test/bats.bats &gt; test.t</tt></p><p
style="text-align: center;"><a
href="http://www.kinoshita.eti.br/wp-content/uploads/2011/12/Screenshot-at-2011-12-30-233256.png" rel="lightbox[880]" title="Screenshot at 2011-12-30 23:32:56"><img
class="size-medium wp-image-883 aligncenter" title="Screenshot at 2011-12-30 23:32:56" src="http://www.kinoshita.eti.br/wp-content/uploads/2011/12/Screenshot-at-2011-12-30-233256-300x198.png" alt="" width="300" height="198" /></a></p><p>Before executing the build, you have to check the option to publish TAP results in the end of the configuration screen. That&#8217;s it. Execute your job, chug the remaining of your beer and now you can go to bed&#8230; or just refresh Hacker News and Reddit once more&#8230;</p><p
style="text-align: center;"><a
href="http://www.kinoshita.eti.br/wp-content/uploads/2011/12/Screenshot-at-2011-12-30-233313.png" rel="lightbox[880]" title="Screenshot at 2011-12-30 23:33:13"><img
class="size-medium wp-image-884 aligncenter" title="Screenshot at 2011-12-30 23:33:13" src="http://www.kinoshita.eti.br/wp-content/uploads/2011/12/Screenshot-at-2011-12-30-233313-300x198.png" alt="" width="300" height="198" /></a></p><p
style="text-align: center;"><a
href="http://www.kinoshita.eti.br/wp-content/uploads/2011/12/Screenshot-at-2011-12-30-233323.png" rel="lightbox[880]" title="Screenshot at 2011-12-30 23:33:23"><img
class="aligncenter size-medium wp-image-894" title="Screenshot at 2011-12-30 23:33:23" src="http://www.kinoshita.eti.br/wp-content/uploads/2011/12/Screenshot-at-2011-12-30-233323-300x198.png" alt="" width="300" height="198" /></a></p><p>Bats is a very nice TAP producer for Shell. Haven&#8217;t had time to play with the other producers for Shell, or explore Bats thoroughly, but it looks very promising. Hope to see more people writing tests for shell code.</p><p>Cheers -B</p> ]]></content:encoded> <wfw:commentRss>http://www.kinoshita.eti.br/2011/12/30/testing-shell-code-and-producing-tap-using-jenkins/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Object Caching 458/500 objects using disk: basic

Served from: www.kinoshita.eti.br @ 2012-05-17 20:54:28 -->
