<?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: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-9512814</id><updated>2011-04-21T15:55:52.385-07:00</updated><title type='text'>Rob's Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://robsmith1976.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9512814/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://robsmith1976.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Rob Smith</name><uri>http://www.blogger.com/profile/09029450617125482159</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-9512814.post-113278599918155376</id><published>2005-11-23T14:35:00.000-08:00</published><updated>2005-11-26T10:56:01.610-08:00</updated><title type='text'>Concise Java Collection Syntax with varargs</title><content type='html'>Here's some utility methods that makes declaring and initializing Collections in Java 5 more concise. Note that this does not make sense to use for Collections that contain a lot of items. Here's the utility methods.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public static &amp;lt;T&amp;gt; List&amp;lt;T&amp;gt; newArrayList(T... elems) {&lt;br /&gt;    List&amp;lt;t&amp;gt; newList = new ArrayList&amp;lt;T&amp;gt;(elems.length);&lt;br /&gt;    fillCollection(newList, elems);&lt;br /&gt;    return newList;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static &amp;lt;T&amp;gt; List&amp;lt;T&amp;gt; newLinkedList(T... elems) {&lt;br /&gt;    List&amp;lt;T&amp;gt; newList = new LinkedList&amp;lt;T&amp;gt;(elems.length);&lt;br /&gt;    fillCollection(newList, elems);&lt;br /&gt;    return newList;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;private static &amp;lt;T&amp;gt; void fillCollection(Collection&amp;lt;T&amp;gt; coll, T... elems) {&lt;br /&gt;    for (T elem : elems) {&lt;br /&gt;        coll.add(elem);&lt;br /&gt;    }    &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;...&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;So code that looked like this before:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;List&amp;lt;String&amp;gt; programmingLanguages = new ArrayList&amp;lt;String&amp;gt;(3);&lt;br /&gt;programmingLanguages.add("Java");&lt;br /&gt;programmingLanguages.add("C++");&lt;br /&gt;programmingLanguages.add("Ruby");&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;Now looks like this:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;List&amp;lt;String&amp;gt; programmingLanguages = CollectionUtils.newList(&lt;br /&gt;      "Java", "C++", "Ruby");&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9512814-113278599918155376?l=robsmith1976.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://robsmith1976.blogspot.com/feeds/113278599918155376/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9512814&amp;postID=113278599918155376' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9512814/posts/default/113278599918155376'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9512814/posts/default/113278599918155376'/><link rel='alternate' type='text/html' href='http://robsmith1976.blogspot.com/2005/11/concise-java-collection-syntax-with.html' title='Concise Java Collection Syntax with varargs'/><author><name>Rob Smith</name><uri>http://www.blogger.com/profile/09029450617125482159</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9512814.post-112465545106513927</id><published>2005-08-21T13:07:00.000-07:00</published><updated>2005-08-21T13:30:06.186-07:00</updated><title type='text'>Cygwin tips</title><content type='html'>One feature that I could not live without when developing on Windows is the "Open Command Window Here" Windows Explorer context menu. I also use &lt;a href="http://www.cygwin.com/"&gt;Cygwin&lt;/a&gt; a lot when developing on Windows and wanted this same functionality for opening a Cygwin window.&lt;br /&gt;&lt;br /&gt;I found this &lt;a href="http://www.ibiblio.org/sbw/blog/index.php?p=9"&gt;blog entry&lt;/a&gt; discussing how this can be done. I ended up tweaking this solution a bit so that I could open the rxvt terminal window rather than the bash shell in a DOS window. Here's what I came up with:&lt;br /&gt;&lt;br /&gt;[HKEY_CLASSES_ROOT\Directory\shell\bash]&lt;br /&gt;@="Open Bash Shell Here"&lt;br /&gt;&lt;br /&gt;[HKEY_CLASSES_ROOT\Directory\shell\bash\command]&lt;br /&gt;@="c:\\cygwin\\bin\\rxvt.exe -e bash --login -I -c 'cd \"`cygpath \"$*\"`\";bash' bash %L"&lt;br /&gt;&lt;br /&gt;[HKEY_CLASSES_ROOT\Drive\shell\bash]&lt;br /&gt;@="Open Bash Shell Here"&lt;br /&gt;&lt;br /&gt;[HKEY_CLASSES_ROOT\Drive\shell\bash\command]&lt;br /&gt;@="c:\\cygwin\\bin\\rxvt.exe -e bash --login -I -c 'cd \"`cygpath \"$*\"`\";bash' bash %L"&lt;br /&gt;&lt;br /&gt;You will need to copy and paste this to a .reg file and import it into your Window's registry. You also need the rxvt package for Cygwin.&lt;br /&gt;&lt;br /&gt;Another Cygwin tip I came across the other day that is useful for &lt;a href="http://ant.apache.org/"&gt;Ant&lt;/a&gt; users is adding the following line to your .bash_rc file:&lt;br /&gt;export ANT_ARGS='-logger org.apache.tools.ant.listener.AnsiColorLogger'&lt;br /&gt;&lt;br /&gt;This will add color to the output from Ant running in terminals that support ANSI color codes.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9512814-112465545106513927?l=robsmith1976.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://robsmith1976.blogspot.com/feeds/112465545106513927/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9512814&amp;postID=112465545106513927' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9512814/posts/default/112465545106513927'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9512814/posts/default/112465545106513927'/><link rel='alternate' type='text/html' href='http://robsmith1976.blogspot.com/2005/08/cygwin-tips.html' title='Cygwin tips'/><author><name>Rob Smith</name><uri>http://www.blogger.com/profile/09029450617125482159</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9512814.post-110990943160406642</id><published>2005-03-03T19:41:00.000-08:00</published><updated>2005-03-03T20:10:31.606-08:00</updated><title type='text'>Translets</title><content type='html'>At my current client I have been working on and off on a legacy Java web application utilizing a Servlets-&gt;XML-&gt;XSLT architecture. The users were complaining that the application seemed sluggish. After profiling the application, I found that our bottleneck was in the XML-&gt;XSLT transformation process. I started looking around for some XSL performance tips and came across Xalan's &lt;a href="http://xml.apache.org/xalan-j/xsltc_usage.html"&gt;XSLTC&lt;/a&gt;. XSLTC is a compiler and runtime processor for XSLT. The compiler compiles a stylesheet to a Translet and the runtime processor applies the translet to an XML document to perform the transformation. Translets can be accessed through the JAXP API, so I did not have to modify much of the existing source code.&lt;br /&gt;&lt;br /&gt;The bulk of the work was streamlining the use of XSLTC into our build process. There is not an Ant task available and the command line interface is lacking. I implemented  some utilities wrapping the XSLTC process, including a good command line interface and dependency checking for stylesheet compilation. The reason for the dependency checking is to prevent from having to compile all approx. 400 stylesheets in the application during each compilation phase. Although there are nearly 400 stylesheets in the app the bulk of the XSL is contained in a common collection of 30-40 stylesheets that are imported by locale and customer specific stylesheets.&lt;br /&gt;&lt;br /&gt;Using the XSLTC compiler and runtime processor showed an approx. 3X performance gain in stylesheet transformations. Our previous implementation utilized the JAXP API to create and cache Templates objects for each stylesheet in the app.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9512814-110990943160406642?l=robsmith1976.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://robsmith1976.blogspot.com/feeds/110990943160406642/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9512814&amp;postID=110990943160406642' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9512814/posts/default/110990943160406642'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9512814/posts/default/110990943160406642'/><link rel='alternate' type='text/html' href='http://robsmith1976.blogspot.com/2005/03/translets.html' title='Translets'/><author><name>Rob Smith</name><uri>http://www.blogger.com/profile/09029450617125482159</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9512814.post-110297522330512760</id><published>2004-12-13T13:50:00.000-08:00</published><updated>2004-12-13T14:33:31.763-08:00</updated><title type='text'> How Many Days Ago in Ruby</title><content type='html'>So &lt;a href="http://www.weiqigao.com/blog/"&gt;Weiqi&lt;/a&gt; wondered &lt;a href="http://www.weiqigao.com/blog/2004/12/11/1102828893000.html"&gt;How Many Days Ago was that&lt;/a&gt;. Then &lt;a href="http://www.ericburke.com/blog/"&gt;Eric&lt;/a&gt; posted a &lt;a href="http://www.ericburke.com/blog/2004/12/how-many-days-ago-in-java.html"&gt;Java solution&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Since I have been attempting to learn &lt;a href="http://www.ruby-lang.org/"&gt;Ruby&lt;/a&gt;, I figured I would attempt to implement a solution in Ruby. I would like to preface this post by stating that I am a Ruby &lt;strong&gt;novice&lt;/strong&gt; and I'm sure there is a better way to do this. Here's the "How Many Days Ago Was That" in Ruby.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;require "parsedate"&lt;br /&gt;require "date"&lt;br /&gt;&lt;br /&gt;def usage()&lt;br /&gt; puts "Usage: daysago.rb date"&lt;br /&gt; exit 1&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;def computeDaysBetween(from, to)&lt;br /&gt; from, to = to, from if (from &gt; to) # Swaps the two variables&lt;br /&gt; daysAgo = 0&lt;br /&gt; from.upto(to) {|day|daysAgo+=1}&lt;br /&gt; return daysAgo&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;from = Date.parse(ARGV.shift || usage())&lt;br /&gt;puts "It has been #{computeDaysBetween(from, Date.today)} since #{from}"&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9512814-110297522330512760?l=robsmith1976.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://robsmith1976.blogspot.com/feeds/110297522330512760/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9512814&amp;postID=110297522330512760' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9512814/posts/default/110297522330512760'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9512814/posts/default/110297522330512760'/><link rel='alternate' type='text/html' href='http://robsmith1976.blogspot.com/2004/12/how-many-days-ago-in-ruby.html' title=' How Many Days Ago in Ruby'/><author><name>Rob Smith</name><uri>http://www.blogger.com/profile/09029450617125482159</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9512814.post-110265413264508569</id><published>2004-12-09T20:43:00.000-08:00</published><updated>2004-12-09T20:48:52.646-08:00</updated><title type='text'>Tapestry Presentation from St. Louis JUG</title><content type='html'>I presented on &lt;a href="http://jakarta.apache.org/tapestry/"&gt;Tapestry&lt;/a&gt; tonight at the &lt;a href="http://www.ociweb.com/javasig/"&gt;St. Louis Java Users Group&lt;/a&gt;. Here's a link to the &lt;a href="http://www.ociweb.com/javasig/knowledgebase.html"&gt;presentation&lt;/a&gt; in pdf format.&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9512814-110265413264508569?l=robsmith1976.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://robsmith1976.blogspot.com/feeds/110265413264508569/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9512814&amp;postID=110265413264508569' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9512814/posts/default/110265413264508569'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9512814/posts/default/110265413264508569'/><link rel='alternate' type='text/html' href='http://robsmith1976.blogspot.com/2004/12/tapestry-presentation-from-st-louis.html' title='Tapestry Presentation from St. Louis JUG'/><author><name>Rob Smith</name><uri>http://www.blogger.com/profile/09029450617125482159</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
