<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="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" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-12081526</atom:id><lastBuildDate>Fri, 25 Oct 2024 08:43:22 +0000</lastBuildDate><category>waffle</category><category>ruby</category><category>java</category><category>web</category><category>argible</category><category>jruby</category><category>rails</category><category>action</category><category>maven</category><category>release</category><category>rspec</category><category>1.0</category><category>annotations</category><category>attributes</category><category>blog</category><category>blogger.com</category><category>chirb</category><category>codehaus</category><category>cygwin</category><category>error</category><category>formats</category><category>framework</category><category>gui</category><category>java 6</category><category>locate</category><category>method_added</category><category>mock</category><category>osx</category><category>osx java jni</category><category>parameters</category><category>paranamer</category><category>partial</category><category>plugin</category><category>publish</category><category>safety</category><category>shoes</category><category>test</category><category>thread</category><category>vraptor</category><title>blog.invoke(m2ward);</title><description></description><link>http://m2ward.blogspot.com/</link><managingEditor>noreply@blogger.com (Michael Ward)</managingEditor><generator>Blogger</generator><openSearch:totalResults>34</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-12081526.post-6131060616435405250</guid><pubDate>Fri, 22 May 2009 11:41:00 +0000</pubDate><atom:updated>2009-05-22T06:58:30.361-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">osx java jni</category><title>Building a c++ dynamic library on 64-bit Intel OSX</title><description>It seems like every JNI example for OSX depends on XCode.  So here is a simple example of how to build a dynamic library, for OSX, from the command line:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;    g++ -m64 -c -I/System/Library/Frameworks/JavaVM.framework/Headers Foo.cpp&lt;br /&gt;    g++ -m64 -dynamiclib -o libfoojni.jnilib Foo.o -framework JavaVM&lt;/pre&gt;&lt;br /&gt;Without the &lt;b&gt;-m64&lt;/b&gt; argument you will receive the unintuitive error:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;    Exception in thread &quot;main&quot; java.lang.UnsatisfiedLinkError: /development/sandbox/libfoojni.jnilib: &lt;br /&gt;        at java.lang.ClassLoader$NativeLibrary.load(Native Method)&lt;br /&gt;        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1822)&lt;br /&gt;        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1739)&lt;br /&gt;        at java.lang.Runtime.loadLibrary0(Runtime.java:823)&lt;br /&gt;        at java.lang.System.loadLibrary(System.java:1030)&lt;br /&gt;        at Foo.&lt;clinit&gt;(Foo.java:7)&lt;/pre&gt;</description><link>http://m2ward.blogspot.com/2009/05/building-c-dynamic-library-on-64-bit.html</link><author>noreply@blogger.com (Michael Ward)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-12081526.post-1902991503500558896</guid><pubDate>Tue, 22 Jan 2008 03:35:00 +0000</pubDate><atom:updated>2008-01-22T07:53:53.696-06:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">1.0</category><category domain="http://www.blogger.com/atom/ns#">release</category><category domain="http://www.blogger.com/atom/ns#">waffle</category><title>Waffle 1.0 released</title><description>I am very happy to announce that after many months of hard work the &lt;a href=&quot;http://waffle.codehaus.org/team-list.html&quot;&gt;Waffle team&lt;/a&gt; has released version &lt;a href=&quot;http://waffle.codehaus.org/download.html&quot;&gt;1.0 of Waffle&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Some of Waffle&#39;s features include:&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;Zero XML configuration&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Minimal annotations&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Convention over configuration&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Easy to develop and test with (simple POJOs)&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Built in support for Dependency Injection&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Easily extensible architecture&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;If you haven&#39;t tried Waffle I urge you to take a look and see what you&#39;ve been missing.  As always any comments or suggestion are appreciated.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;a href=&quot;http://waffle.codehaus.org&quot;&gt;Waffle: Java based web development doesn&#39;t have to suck.&lt;/a&gt;&lt;/i&gt;</description><link>http://m2ward.blogspot.com/2008/01/waffle-10-released.html</link><author>noreply@blogger.com (Michael Ward)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-12081526.post-8265001866032795299</guid><pubDate>Tue, 08 Jan 2008 14:14:00 +0000</pubDate><atom:updated>2008-01-08T07:52:58.817-06:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">maven</category><category domain="http://www.blogger.com/atom/ns#">plugin</category><category domain="http://www.blogger.com/atom/ns#">release</category><title>Maven release:prepare not prompting for version</title><description>I ran into a particular annoying bug the other day when trying to use the &lt;a href=&quot; http://maven.apache.org/plugins/maven-release-plugin&quot;&gt;Maven release plugin&lt;/a&gt;.  The goal &lt;b&gt;release:prepare&lt;/b&gt; is suppose to prompt you for the version you wish to give the release (the version in the poms from x-SNAPSHOT to a new version).  However, on my machine I was never prompted by the plugin.&lt;br /&gt;&lt;br /&gt;After spending more time than I care to admit trying to resolve this issue I was finally able to trace it to my &lt;b&gt;~/.m2/settings.xml&lt;/b&gt; file.  My settings.xml file included a few empty nodes, after removing these my issue went away.</description><link>http://m2ward.blogspot.com/2008/01/maven-releaseprepare-not-prompting-for.html</link><author>noreply@blogger.com (Michael Ward)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-12081526.post-6359554471922999931</guid><pubDate>Fri, 28 Dec 2007 17:55:00 +0000</pubDate><atom:updated>2007-12-28T12:02:55.622-06:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java 6</category><category domain="http://www.blogger.com/atom/ns#">osx</category><title>Java SE 6 developer preview released for OSX Leopard</title><description>It looks like Apple has quietly released Java SE 6 for Leopard through their &lt;a href=&quot;http://developer.apple.com/java/&quot;&gt;Apple Developer Connection&lt;/a&gt;.  The release is only for Leopard (10.5.1) and requires 64-bit Intel Macs (sorry PowerPC and 32-bit Intel based machines).</description><link>http://m2ward.blogspot.com/2007/12/java-se-6-developer-preview-released.html</link><author>noreply@blogger.com (Michael Ward)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-12081526.post-5878623494778347566</guid><pubDate>Tue, 18 Sep 2007 04:03:00 +0000</pubDate><atom:updated>2007-09-17T23:06:18.058-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">attributes</category><category domain="http://www.blogger.com/atom/ns#">jruby</category><category domain="http://www.blogger.com/atom/ns#">parameters</category><category domain="http://www.blogger.com/atom/ns#">waffle</category><title>Waffle and JRuby: Accessing parameters and attributes from request, session and servlet context</title><description>In the last &lt;a href=&quot;http://m2ward.blogspot.com/2007/09/waffle-how-to-access-your-java.html&quot;&gt;post&lt;/a&gt; I quickly explained how easy it is to access a component registered with &lt;a href=&quot;http://waffle.codehaus.org&quot;&gt;Waffle&lt;/a&gt; from your &lt;a href=&quot;http://jruby.codehaus.org&quot;&gt;JRuby&lt;/a&gt; based controllers.  Now we need to understand how to access GET and POST parameters in order service a visitor&#39;s request.  This is easily done through the &lt;b&gt;parameters&lt;/b&gt; variable (also aliased as &lt;b&gt;params&lt;/b&gt;) on your Ruby based Controllers.  This variable is a simple Hash, so looking up parameter values from your Actions as easy as:&lt;br /&gt;&lt;pre class=&quot;textmate-source idle&quot;&gt;&lt;span class=&quot;source source_ruby&quot;&gt;&lt;span class=&quot;meta meta_function meta_function_method meta_function_method_without-arguments meta_function_method_without-arguments_ruby&quot;&gt;&lt;span class=&quot;keyword keyword_control keyword_control_def keyword_control_def_ruby&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;entity entity_name entity_name_function entity_name_function_ruby&quot;&gt;example_one&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  foo &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; params&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;&#39;&lt;/span&gt;foo&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;&#39;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; request parameter&lt;br /&gt;&lt;/span&gt;  &lt;span class=&quot;keyword keyword_control keyword_control_pseudo-method keyword_control_pseudo-method_ruby&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;&quot;&lt;/span&gt;&amp;lt;h1&amp;gt;FOO: &lt;span class=&quot;source source_ruby source_ruby_embedded source_ruby_embedded_source&quot;&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;#{&lt;/span&gt;foo&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&amp;lt;/h1&amp;gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;h4&gt;Accessing Request, Session and ServletContext attributes&lt;/h4&gt;It might also be useful to access attribute values from either &lt;i&gt;javax.servlet.ServletRequest&lt;/i&gt;, &lt;i&gt;javax.servlet.http.HttpSession&lt;/i&gt; or &lt;i&gt;javax.servlet.ServletContext&lt;/i&gt;.  This is, as you should expect, very easy to do.  But Waffle automatically wraps each of these as a Ruby Hash.  This provides the correct Ruby &quot;feel&quot; when writing your Actions.  The following code snippet give an example of how you can access attribute values from each of the 3 contexts:&lt;br /&gt;&lt;pre class=&quot;textmate-source idle&quot;&gt;&lt;span class=&quot;source source_ruby&quot;&gt;&lt;span class=&quot;meta meta_function meta_function_method meta_function_method_without-arguments meta_function_method_without-arguments_ruby&quot;&gt;&lt;span class=&quot;keyword keyword_control keyword_control_def keyword_control_def_ruby&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;entity entity_name entity_name_function entity_name_function_ruby&quot;&gt;example_two&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  foo &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; params&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;&#39;&lt;/span&gt;foo&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;&#39;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; request parameter&lt;br /&gt;&lt;/span&gt;  fuu &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; request&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;&#39;&lt;/span&gt;fuu&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;&#39;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; request attribute&lt;br /&gt;&lt;/span&gt;  bar &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; session&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;&#39;&lt;/span&gt;bar&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;&#39;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; session attribute&lt;br /&gt;&lt;/span&gt;  baz &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; application&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;&#39;&lt;/span&gt;baz&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;&#39;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; servlet context attribute&lt;br /&gt;&lt;/span&gt;  &lt;span class=&quot;keyword keyword_control keyword_control_pseudo-method keyword_control_pseudo-method_ruby&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;&quot;&lt;/span&gt;&amp;lt;h1&amp;gt;FOO: &lt;span class=&quot;source source_ruby source_ruby_embedded source_ruby_embedded_source&quot;&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;#{&lt;/span&gt;foo&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;}&lt;/span&gt;&lt;/span&gt; FUU: &lt;span class=&quot;source source_ruby source_ruby_embedded source_ruby_embedded_source&quot;&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;#{&lt;/span&gt;fuu&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;}&lt;/span&gt;&lt;/span&gt; BAR: &lt;span class=&quot;source source_ruby source_ruby_embedded source_ruby_embedded_source&quot;&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;#{&lt;/span&gt;bar&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;}&lt;/span&gt;&lt;/span&gt; BAZ: &lt;span class=&quot;source source_ruby source_ruby_embedded source_ruby_embedded_source&quot;&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;#{&lt;/span&gt;baz&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&amp;lt;/h1&amp;gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;Additionally, you can also call any of the Java methods these instances provide (you are NOT limited to methods exposed by Hash).&lt;br /&gt;&lt;h4&gt;Auto-resolve values&lt;/h4&gt;Now those of you familiar with Waffle realize that Waffle provides a built-in means to &lt;a href=&quot;http://waffle.codehaus.org/action-methods.html&quot;&gt;auto-resolve a variables value&lt;/a&gt;.  Waffle will search each of the following (in order) until the value is found, otherwise null (or in the case of JRuby nil) will be returned:&lt;ol type=&quot;1&quot;&gt;&lt;li&gt;HttpServletRequest Parameter (HttpServletRequest.getParameter(&quot;foo&quot;))&lt;/li&gt;&lt;li&gt;HttpServletRequest Attribute (HttpServletRequest.getAttribute(&quot;foo&quot;))&lt;/li&gt;&lt;li&gt;HttpSession Attribute (HttpSession.getAttribute(&quot;foo&quot;))&lt;/li&gt;&lt;li&gt;ServletContext Attribute (ServletContext.getAttribute(&quot;foo&quot;))&lt;/li&gt;&lt;li&gt;return nil&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;So with that in mind we can simplify the previous example down to &lt;b&gt;one line&lt;/b&gt;.  Waffle will attempt to resolve the value of any unknown variable through this means.  The following shows the previous method simplified because it relies on Waffle auto resolving each value:&lt;pre class=&quot;textmate-source idle&quot;&gt;&lt;span class=&quot;source source_ruby&quot;&gt;&lt;span class=&quot;meta meta_function meta_function_method meta_function_method_without-arguments meta_function_method_without-arguments_ruby&quot;&gt;&lt;span class=&quot;keyword keyword_control keyword_control_def keyword_control_def_ruby&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;entity entity_name entity_name_function entity_name_function_ruby&quot;&gt;example_three&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;keyword keyword_control keyword_control_pseudo-method keyword_control_pseudo-method_ruby&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;&quot;&lt;/span&gt;&amp;lt;h1&amp;gt;FOO: &lt;span class=&quot;source source_ruby source_ruby_embedded source_ruby_embedded_source&quot;&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;#{&lt;/span&gt;foo&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;}&lt;/span&gt;&lt;/span&gt; FUU: &lt;span class=&quot;source source_ruby source_ruby_embedded source_ruby_embedded_source&quot;&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;#{&lt;/span&gt;fuu&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;}&lt;/span&gt;&lt;/span&gt; BAR: &lt;span class=&quot;source source_ruby source_ruby_embedded source_ruby_embedded_source&quot;&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;#{&lt;/span&gt;bar&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;}&lt;/span&gt;&lt;/span&gt; BAZ: &lt;span class=&quot;source source_ruby source_ruby_embedded source_ruby_embedded_source&quot;&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;#{&lt;/span&gt;baz&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&amp;lt;/h1&amp;gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;In my next blog post I&#39;ll begin discussing how you can integrate JSPs or even RHTML with your applications.</description><link>http://m2ward.blogspot.com/2007/09/waffle-and-jruby-accessing-parameters.html</link><author>noreply@blogger.com (Michael Ward)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-12081526.post-970793730075587324</guid><pubDate>Fri, 14 Sep 2007 12:19:00 +0000</pubDate><atom:updated>2007-09-14T07:56:45.556-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">action</category><category domain="http://www.blogger.com/atom/ns#">jruby</category><category domain="http://www.blogger.com/atom/ns#">locate</category><category domain="http://www.blogger.com/atom/ns#">waffle</category><title>Waffle: How to access your Java components from your Ruby Actions.</title><description>In my last &lt;a href=&quot;http://m2ward.blogspot.com/2007/09/ever-wish-you-could-utilize-ruby-from.html&quot;&gt;post&lt;/a&gt; I gave an overview of how you can easily integrate &lt;a href=&quot;http://jruby.codehaus.org&quot;&gt;JRuby&lt;/a&gt; with &lt;a href=&quot;http://waffle.codehaus.org&quot;&gt;Waffle&lt;/a&gt;.  Now we will examine Ruby based controller in a bit more depth.  Lets assume we have the following Waffle &lt;a href=&quot;http://waffle.codehaus.org/registrar.html&quot;&gt;Registrar&lt;/a&gt; for our application:&lt;br /&gt;&lt;pre class=&quot;textmate-source idle&quot;&gt;&lt;span class=&quot;source source_java&quot;&gt;&lt;span class=&quot;meta meta_definition meta_definition_class meta_definition_class_java&quot;&gt;&lt;span class=&quot;storage storage_modifier storage_modifier_java&quot;&gt;public &lt;/span&gt;&lt;span class=&quot;storage storage_type storage_type_java&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;entity entity_name entity_name_type entity_name_type_class entity_name_type_class_java&quot;&gt;MyRegistrar&lt;/span&gt; &lt;span class=&quot;meta meta_definition meta_definition_class meta_definition_class_extends meta_definition_class_extends_java&quot;&gt;&lt;span class=&quot;storage storage_modifier storage_modifier_java&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;storage storage_type storage_type_java&quot;&gt;AbstractRubyAwareRegistrar&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;{&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;meta meta_definition meta_definition_constructor meta_definition_constructor_java&quot;&gt;  &lt;span class=&quot;storage storage_modifier storage_modifier_java&quot;&gt;public &lt;/span&gt;&lt;span class=&quot;entity entity_name entity_name_function entity_name_function_constructor entity_name_function_constructor_java&quot;&gt;MyRegistrar&lt;/span&gt;&lt;span class=&quot;meta meta_definition meta_definition_param-list meta_definition_param-list_java&quot;&gt;(&lt;span class=&quot;storage storage_type storage_type_java&quot;&gt;Registrar&lt;/span&gt; delegate&lt;/span&gt;) &lt;/span&gt;{&lt;br /&gt;    &lt;span class=&quot;variable variable_language variable_language_java&quot;&gt;super&lt;/span&gt;(delegate);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  @&lt;span class=&quot;support support_type support_type_built-ins support_type_built-ins_java&quot;&gt;Override&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;meta meta_definition meta_definition_method meta_definition_method_java&quot;&gt;  &lt;span class=&quot;storage storage_modifier storage_modifier_java&quot;&gt;public &lt;/span&gt;&lt;span class=&quot;storage storage_type storage_type_java&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;entity entity_name entity_name_function entity_name_function_java&quot;&gt;application&lt;/span&gt;&lt;span class=&quot;meta meta_definition meta_definition_param-list meta_definition_param-list_java&quot;&gt;(&lt;/span&gt;) &lt;/span&gt;{&lt;br /&gt;    register(&lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_java&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_java&quot;&gt;&quot;&lt;/span&gt;the_dao&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_java&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;storage storage_type storage_type_java&quot;&gt;PersonDAOImpl&lt;/span&gt;.&lt;span class=&quot;storage storage_type storage_type_java&quot;&gt;class&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;    registerRubyScript(&lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_java&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_java&quot;&gt;&quot;&lt;/span&gt;person&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_java&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_java&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_java&quot;&gt;&quot;&lt;/span&gt;PersonController&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_java&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;);&lt;br /&gt;  }&lt;br /&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;A DAO, &lt;i&gt;PersonDAOImpl&lt;/i&gt;, is registered under the name &lt;i&gt;&quot;the_dao&quot;&lt;/i&gt; and we have one Ruby based controller available.  Now its probably safe to assume that this Ruby &lt;i&gt;PersonController&lt;/i&gt; will need access to the DAO.  Gaining access to this DAO from the controller is easy in Waffle, just call the &lt;b&gt;locate&lt;/b&gt; method:&lt;br /&gt;&lt;pre class=&quot;textmate-source idle&quot;&gt;&lt;span class=&quot;source source_ruby&quot;&gt;&lt;span class=&quot;meta meta_class meta_class_ruby&quot;&gt;&lt;span class=&quot;keyword keyword_control keyword_control_class keyword_control_class_ruby&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;entity entity_name entity_name_type entity_name_type_class entity_name_type_class_ruby&quot;&gt;PersonController&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span class=&quot;meta meta_function meta_function_method meta_function_method_without-arguments meta_function_method_without-arguments_ruby&quot;&gt;&lt;span class=&quot;keyword keyword_control keyword_control_def keyword_control_def_ruby&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;entity entity_name entity_name_function entity_name_function_ruby&quot;&gt;index&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_ruby&quot;&gt;@&lt;/span&gt;person_dao&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; locate&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;example&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;variable variable_other variable_other_constant variable_other_constant_ruby&quot;&gt;PersonDAO&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_ruby&quot;&gt;@&lt;/span&gt;people&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_ruby&quot;&gt;@&lt;/span&gt;person_dao&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;findAll&lt;br /&gt;    render &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;&#39;&lt;/span&gt;person.rhtml&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;&#39;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;Notice that we were able to retrieve the DAO by its interface. Additionally, since this DAO was registered with a key you can use a convention to retrieve the component.  The convention is &quot;&lt;b&gt;locate_&amp;lt;component key&amp;gt;&lt;/b&gt;&quot;, here is the same controller using the locate_ convention:&lt;br /&gt;&lt;pre class=&quot;textmate-source idle&quot;&gt;&lt;span class=&quot;source source_ruby&quot;&gt;&lt;span class=&quot;meta meta_class meta_class_ruby&quot;&gt;&lt;span class=&quot;keyword keyword_control keyword_control_class keyword_control_class_ruby&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;entity entity_name entity_name_type entity_name_type_class entity_name_type_class_ruby&quot;&gt;PersonController&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span class=&quot;meta meta_function meta_function_method meta_function_method_without-arguments meta_function_method_without-arguments_ruby&quot;&gt;&lt;span class=&quot;keyword keyword_control keyword_control_def keyword_control_def_ruby&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;entity entity_name entity_name_function entity_name_function_ruby&quot;&gt;index&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_ruby&quot;&gt;@&lt;/span&gt;person_dao&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; locate_the_dao&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_ruby&quot;&gt;@&lt;/span&gt;people&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_ruby&quot;&gt;@&lt;/span&gt;person_dao&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;findAll&lt;br /&gt;    render &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;&#39;&lt;/span&gt;person.rhtml&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;&#39;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;As you can see this makes writing Ruby based Controllers/Actions with Waffle really easy.  In my next post I&#39;ll detail how to access request parameter and context attributes with ease.</description><link>http://m2ward.blogspot.com/2007/09/waffle-how-to-access-your-java.html</link><author>noreply@blogger.com (Michael Ward)</author><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-12081526.post-4660744041511802031</guid><pubDate>Wed, 12 Sep 2007 12:55:00 +0000</pubDate><atom:updated>2007-09-12T07:54:08.814-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">jruby</category><category domain="http://www.blogger.com/atom/ns#">ruby</category><category domain="http://www.blogger.com/atom/ns#">waffle</category><title>Ever wish you could utilize Ruby from your Java based web applications?</title><description>&lt;a href=&quot;http://waffle.codehaus.org&quot;&gt;Waffle&lt;/a&gt;, a Java based Web Framework, now provides built in support for &lt;a href=&quot;http://jruby.codehaus.org&quot;&gt;JRuby&lt;/a&gt;.  This will allow you to easily write your Controllers in &lt;a href=&quot;http://www.ruby-lang.org/&quot;&gt;Ruby&lt;/a&gt;.  The integration is simple and straightforward, taking advantage of functionality Waffle provides (without being a Rails clone). &lt;br /&gt;&lt;br /&gt;A key feature of Waffle has always been its &lt;a href=&quot;http://waffle.codehaus.org/pluggability.html&quot;&gt;pluggable&lt;/a&gt; architecture.  From the beginning we believed that the default behavior defined by the Waffle team might not be suitable for every situation.  Therefor Waffle was built following an Interface driven approach.  Practically all of Waffle&#39;s built-in functionality can easily be extended or replaced.  This design made integrating JRuby support quite easy.  The next 3 steps give a brief overview of how to integrate JRuby support into your Waffle based applications.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Step 1&lt;/span&gt; - configure Waffle to be &quot;Ruby Aware&quot;&lt;br /&gt;&lt;br /&gt;Waffle avoids XML like the plague but we still need to have a &lt;span style=&quot;font-weight:bold;&quot;&gt;web.xml&lt;/span&gt; for our applications.  This web.xml is where we can take advantage of Waffle&#39;s pluggability.  The following three &lt;i&gt;context-param&lt;/i&gt; nodes need to be added to your applications &lt;a href=&quot;http://waffle.codehaus.org/webxml.html&quot;&gt;web.xml&lt;/a&gt;.  This alerts Waffle that a few of its foundational components should be replaced with alternate implementations.&lt;br /&gt;&lt;pre class=&quot;textmate-source idle&quot;&gt;&lt;span class=&quot;text text_html text_html_basic&quot;&gt;&lt;span class=&quot;meta meta_tag meta_tag_other meta_tag_other_html&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;entity entity_name entity_name_tag entity_name_tag_other entity_name_tag_other_html&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;entity entity_other entity_other_attribute-name entity_other_attribute-name_html&quot;&gt;-param&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;meta meta_tag meta_tag_inline meta_tag_inline_any meta_tag_inline_any_html&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;entity entity_name entity_name_tag entity_name_tag_inline entity_name_tag_inline_any entity_name_tag_inline_any_html&quot;&gt;param&lt;/span&gt;&lt;span class=&quot;entity entity_other entity_other_attribute-name entity_other_attribute-name_html&quot;&gt;-name&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;org.codehaus.waffle.context.ContextContainerFactory&lt;span class=&quot;meta meta_tag meta_tag_inline meta_tag_inline_any meta_tag_inline_any_html&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;entity entity_name entity_name_tag entity_name_tag_inline entity_name_tag_inline_any entity_name_tag_inline_any_html&quot;&gt;param&lt;/span&gt;&lt;span class=&quot;entity entity_other entity_other_attribute-name entity_other_attribute-name_html&quot;&gt;-name&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;meta meta_tag meta_tag_inline meta_tag_inline_any meta_tag_inline_any_html&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;entity entity_name entity_name_tag entity_name_tag_inline entity_name_tag_inline_any entity_name_tag_inline_any_html&quot;&gt;param&lt;/span&gt;&lt;span class=&quot;entity entity_other entity_other_attribute-name entity_other_attribute-name_html&quot;&gt;-value&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;org.codehaus.waffle.context.pico.RubyAwarePicoContextContainerFactory&lt;span class=&quot;meta meta_tag meta_tag_inline meta_tag_inline_any meta_tag_inline_any_html&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;entity entity_name entity_name_tag entity_name_tag_inline entity_name_tag_inline_any entity_name_tag_inline_any_html&quot;&gt;param&lt;/span&gt;&lt;span class=&quot;entity entity_other entity_other_attribute-name entity_other_attribute-name_html&quot;&gt;-value&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;meta meta_tag meta_tag_other meta_tag_other_html&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;entity entity_name entity_name_tag entity_name_tag_other entity_name_tag_other_html&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;entity entity_other entity_other_attribute-name entity_other_attribute-name_html&quot;&gt;-param&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;meta meta_tag meta_tag_other meta_tag_other_html&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;entity entity_name entity_name_tag entity_name_tag_other entity_name_tag_other_html&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;entity entity_other entity_other_attribute-name entity_other_attribute-name_html&quot;&gt;-param&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;meta meta_tag meta_tag_inline meta_tag_inline_any meta_tag_inline_any_html&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;entity entity_name entity_name_tag entity_name_tag_inline entity_name_tag_inline_any entity_name_tag_inline_any_html&quot;&gt;param&lt;/span&gt;&lt;span class=&quot;entity entity_other entity_other_attribute-name entity_other_attribute-name_html&quot;&gt;-name&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;org.codehaus.waffle.bind.DataBinder&lt;span class=&quot;meta meta_tag meta_tag_inline meta_tag_inline_any meta_tag_inline_any_html&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;entity entity_name entity_name_tag entity_name_tag_inline entity_name_tag_inline_any entity_name_tag_inline_any_html&quot;&gt;param&lt;/span&gt;&lt;span class=&quot;entity entity_other entity_other_attribute-name entity_other_attribute-name_html&quot;&gt;-name&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;meta meta_tag meta_tag_inline meta_tag_inline_any meta_tag_inline_any_html&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;entity entity_name entity_name_tag entity_name_tag_inline entity_name_tag_inline_any entity_name_tag_inline_any_html&quot;&gt;param&lt;/span&gt;&lt;span class=&quot;entity entity_other entity_other_attribute-name entity_other_attribute-name_html&quot;&gt;-value&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;org.codehaus.waffle.bind.RubyDataBinder&lt;span class=&quot;meta meta_tag meta_tag_inline meta_tag_inline_any meta_tag_inline_any_html&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;entity entity_name entity_name_tag entity_name_tag_inline entity_name_tag_inline_any entity_name_tag_inline_any_html&quot;&gt;param&lt;/span&gt;&lt;span class=&quot;entity entity_other entity_other_attribute-name entity_other_attribute-name_html&quot;&gt;-value&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;meta meta_tag meta_tag_other meta_tag_other_html&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;entity entity_name entity_name_tag entity_name_tag_other entity_name_tag_other_html&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;entity entity_other entity_other_attribute-name entity_other_attribute-name_html&quot;&gt;-param&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;meta meta_tag meta_tag_other meta_tag_other_html&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;entity entity_name entity_name_tag entity_name_tag_other entity_name_tag_other_html&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;entity entity_other entity_other_attribute-name entity_other_attribute-name_html&quot;&gt;-param&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;meta meta_tag meta_tag_inline meta_tag_inline_any meta_tag_inline_any_html&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;entity entity_name entity_name_tag entity_name_tag_inline entity_name_tag_inline_any entity_name_tag_inline_any_html&quot;&gt;param&lt;/span&gt;&lt;span class=&quot;entity entity_other entity_other_attribute-name entity_other_attribute-name_html&quot;&gt;-name&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;org.codehaus.waffle.controller.ControllerDefinitionFactory&lt;span class=&quot;meta meta_tag meta_tag_inline meta_tag_inline_any meta_tag_inline_any_html&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;entity entity_name entity_name_tag entity_name_tag_inline entity_name_tag_inline_any entity_name_tag_inline_any_html&quot;&gt;param&lt;/span&gt;&lt;span class=&quot;entity entity_other entity_other_attribute-name entity_other_attribute-name_html&quot;&gt;-name&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;meta meta_tag meta_tag_inline meta_tag_inline_any meta_tag_inline_any_html&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;entity entity_name entity_name_tag entity_name_tag_inline entity_name_tag_inline_any entity_name_tag_inline_any_html&quot;&gt;param&lt;/span&gt;&lt;span class=&quot;entity entity_other entity_other_attribute-name entity_other_attribute-name_html&quot;&gt;-value&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;org.codehaus.waffle.controller.RubyControllerDefinitionFactory&lt;span class=&quot;meta meta_tag meta_tag_inline meta_tag_inline_any meta_tag_inline_any_html&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;entity entity_name entity_name_tag entity_name_tag_inline entity_name_tag_inline_any entity_name_tag_inline_any_html&quot;&gt;param&lt;/span&gt;&lt;span class=&quot;entity entity_other entity_other_attribute-name entity_other_attribute-name_html&quot;&gt;-value&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;meta meta_tag meta_tag_other meta_tag_other_html&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;entity entity_name entity_name_tag entity_name_tag_other entity_name_tag_other_html&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;entity entity_other entity_other_attribute-name entity_other_attribute-name_html&quot;&gt;-param&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Step 2&lt;/span&gt; - Your application&#39;s &lt;i&gt;Registrar&lt;/i&gt; should extended &lt;span style=&quot;font-style:italic;&quot;&gt;AbstractRubyAwareRegistrar&lt;/span&gt;.  This exposes a new registration method to use within your Registrar ...  &lt;b&gt;registerRubyScript(String key, String className)&lt;/b&gt;.  See the example below: &lt;br /&gt;&lt;pre class=&quot;textmate-source idle&quot;&gt;&lt;span class=&quot;source source_java&quot;&gt;&lt;span class=&quot;meta meta_definition meta_definition_class meta_definition_class_java&quot;&gt;&lt;span class=&quot;storage storage_modifier storage_modifier_java&quot;&gt;public &lt;/span&gt;&lt;span class=&quot;storage storage_type storage_type_java&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;entity entity_name entity_name_type entity_name_type_class entity_name_type_class_java&quot;&gt;MyRegistrar&lt;/span&gt; &lt;span class=&quot;meta meta_definition meta_definition_class meta_definition_class_extends meta_definition_class_extends_java&quot;&gt;&lt;span class=&quot;storage storage_modifier storage_modifier_java&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;storage storage_type storage_type_java&quot;&gt;AbstractRubyAwareRegistrar&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;{&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;meta meta_definition meta_definition_constructor meta_definition_constructor_java&quot;&gt;  &lt;span class=&quot;storage storage_modifier storage_modifier_java&quot;&gt;public &lt;/span&gt;&lt;span class=&quot;entity entity_name entity_name_function entity_name_function_constructor entity_name_function_constructor_java&quot;&gt;MyRegistrar&lt;/span&gt;&lt;span class=&quot;meta meta_definition meta_definition_param-list meta_definition_param-list_java&quot;&gt;(&lt;span class=&quot;storage storage_type storage_type_java&quot;&gt;Registrar&lt;/span&gt; delegate&lt;/span&gt;) &lt;/span&gt;{&lt;br /&gt;    &lt;span class=&quot;variable variable_language variable_language_java&quot;&gt;super&lt;/span&gt;(delegate);&lt;br /&gt;  }&lt;br /&gt;    &lt;br /&gt;  @&lt;span class=&quot;support support_type support_type_built-ins support_type_built-ins_java&quot;&gt;Override&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;meta meta_definition meta_definition_method meta_definition_method_java&quot;&gt;  &lt;span class=&quot;storage storage_modifier storage_modifier_java&quot;&gt;public &lt;/span&gt;&lt;span class=&quot;storage storage_type storage_type_java&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;entity entity_name entity_name_function entity_name_function_java&quot;&gt;application&lt;/span&gt;&lt;span class=&quot;meta meta_definition meta_definition_param-list meta_definition_param-list_java&quot;&gt;(&lt;/span&gt;) &lt;/span&gt;{&lt;br /&gt;    registerRubyScript(&lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_java&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_java&quot;&gt;&quot;&lt;/span&gt;foobar&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_java&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_java&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_java&quot;&gt;&quot;&lt;/span&gt;FooBar&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_java&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;);&lt;br /&gt;  }&lt;br /&gt;  ...&lt;br /&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;In this example the Ruby class named &#39;FooBar&#39; will be exposed as a Controller under the name &#39;foobar&#39; (e.g. http://localhost:8080/jruby/foobar.waffle).&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;&lt;br /&gt;Step 3&lt;/span&gt; - Write your Ruby Controller class.  Notice in the following example that your class does not need to extend or include anything.&lt;br /&gt;&lt;pre class=&quot;textmate-source idle&quot;&gt;&lt;span class=&quot;source source_ruby&quot;&gt;&lt;span class=&quot;meta meta_class meta_class_ruby&quot;&gt;&lt;span class=&quot;keyword keyword_control keyword_control_class keyword_control_class_ruby&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;entity entity_name entity_name_type entity_name_type_class entity_name_type_class_ruby&quot;&gt;FooBar&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span class=&quot;meta meta_function meta_function_method meta_function_method_without-arguments meta_function_method_without-arguments_ruby&quot;&gt;&lt;span class=&quot;keyword keyword_control keyword_control_def keyword_control_def_ruby&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;entity entity_name entity_name_function entity_name_function_ruby&quot;&gt;index&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; This is the default action&lt;br /&gt;&lt;/span&gt;    &lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;&quot;&lt;/span&gt;&amp;lt;h1&amp;gt;Hello World&amp;lt;/h1&amp;gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;&lt;br /&gt;  &lt;br /&gt;&lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;And that is all the steps required to integrate JRuby within your Waffle Applications.  In my next post I will uncover details on how to access registered components from your Ruby based controllers as well as explain the built in conventions that make writing Ruby controllers so easy.</description><link>http://m2ward.blogspot.com/2007/09/ever-wish-you-could-utilize-ruby-from.html</link><author>noreply@blogger.com (Michael Ward)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-12081526.post-1140850360340902821</guid><pubDate>Tue, 11 Sep 2007 04:01:00 +0000</pubDate><atom:updated>2007-09-10T22:38:13.182-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">argible</category><category domain="http://www.blogger.com/atom/ns#">chirb</category><category domain="http://www.blogger.com/atom/ns#">method_added</category><category domain="http://www.blogger.com/atom/ns#">ruby</category><title>Argible: impromptu presentation at chirb</title><description>Tonight I ended up giving an impromptu overview of &lt;a href=&quot;http://argible.rubyforge.org&quot;&gt;Argible&lt;/a&gt; at the monthly &lt;a href=&quot;http://chirb.org&quot;&gt;Chicago Area Ruby Group&lt;/a&gt;.  Utilizing &lt;span style=&quot;font-style:italic;&quot;&gt;annotations&lt;/span&gt; in Ruby code seemed foreign to several of the folks there.  So, I quickly went over the Argible source code to illustrate how annotations can be implemented in Ruby (via the &lt;b&gt;Module#method_added(name)&lt;/b&gt; callback).  This code alone seemed to interest several of the people there.&lt;br /&gt;&lt;br /&gt;Additionally, I tried to stress that the concept of using an argument name as meta-data is what I personally find most interesting about Argible.  The idea behind Argible should NOT be limited simply to Rails based applications.  Anyone have ideas for other situation where this might be useful?</description><link>http://m2ward.blogspot.com/2007/09/argible-impromptu-presentation-at-chirb.html</link><author>noreply@blogger.com (Michael Ward)</author><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-12081526.post-849627070491520070</guid><pubDate>Tue, 11 Sep 2007 03:00:00 +0000</pubDate><atom:updated>2007-09-10T22:01:34.036-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">gui</category><category domain="http://www.blogger.com/atom/ns#">ruby</category><category domain="http://www.blogger.com/atom/ns#">shoes</category><title>Shoes: Cross-platform Ruby GUI Toolkit</title><description>Tonight I attended the monthly &lt;a href=&quot;http://chirb.org&quot;&gt;Chicago Area Ruby Group&lt;/a&gt;.  A fellow ThoughtWorker, &lt;a href=&quot;http://www.cuberick.com/&quot;&gt;Josh Cronemeyer&lt;/a&gt;, gave an overview of Why&#39;s &lt;a href=&quot;http://code.whytheluckystiff.net/shoes/&quot;&gt;Shoes&lt;/a&gt; project.&lt;br /&gt;&lt;br /&gt;Many of the attendees seemed to question the need for a Ruby based HTML-like GUI toolkit.  While Shoes is by no means ready, nor possibly even intended for, business applications I did find it interesting.  A &lt;span style=&quot;font-weight:bold;&quot;&gt;viable&lt;/span&gt; Ruby GUI toolkit would improve Ruby adoption even further.  Of course &lt;a href=&quot;http://jruby.codehaus.org/&quot;&gt;JRuby&lt;/a&gt; and Swing integration could be sufficient enough to fill that gap (i.e. &lt;a href=&quot;http://www.alef1.org/jean/swiby/&quot;&gt;Swiby&lt;/a&gt;).</description><link>http://m2ward.blogspot.com/2007/09/shoes-cross-platform-ruby-gui-toolkit.html</link><author>noreply@blogger.com (Michael Ward)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-12081526.post-5476921283995374415</guid><pubDate>Thu, 30 Aug 2007 12:31:00 +0000</pubDate><atom:updated>2007-08-30T08:14:44.948-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">formats</category><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">safety</category><category domain="http://www.blogger.com/atom/ns#">thread</category><title>Are your Java projects misusing java.text.Format?</title><description>As a consultant with ThoughtWorks I get the opportunity to see many different code bases at a variety of client.  A common mistake I see again and again is that developers do not realize that sub-classes of &lt;i&gt;java.text.Format&lt;/i&gt; (e.g. NumberFormat, SimpleDateFormat) are not thread safe.  If your project defines a static instance of a formatter, like so:&lt;br /&gt;&lt;pre&gt;public static final SimpleDateFormat SIMPLE_DATE_FORMAT &lt;br /&gt;    = new SimpleDateFormat(&quot;MM-dd-yyyy&quot;);&lt;/pre&gt;&lt;br /&gt;Then chances are you have a bug.&lt;br /&gt;&lt;br /&gt;As is the case with many threading issues, this might not be easily identified because it probably doesn&#39;t happen consistently (we are at the mercy of the Thread Scheduler).    &lt;br /&gt;&lt;br /&gt;Recently on a project I created a test to prove that using such Formats can cause problems.  We then fixed the issue and decided to keep the test in the code base to ensure that no developers &#39;accidentally&#39; re-introduces it.  &lt;span style=&quot;font-weight:bold;&quot;&gt;NOTE:&lt;/span&gt; A Continuous Integration server, &lt;a href=&quot;http://studios.thoughtworks.com/cruisecontrol&quot;&gt;CruiseControl&lt;/a&gt;, ensures that our tests are run continuously.&lt;br /&gt;&lt;br /&gt;Below is a simple, self-contained, test you can use to see the issue for yourself.  Remember that the test might not fail every time because it is dependent on how the threads are scheduled.  I have found that the test fails with more consistency when executed a single CPU (or single-core) machine.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;import junit.framework.TestCase;&lt;br /&gt;&lt;br /&gt;import java.text.SimpleDateFormat;&lt;br /&gt;import java.util.Date;&lt;br /&gt;&lt;br /&gt;public class ThreadSafetyTest extends TestCase {&lt;br /&gt;    private static final SimpleDateFormat FORMAT &lt;br /&gt;        = new SimpleDateFormat();&lt;br /&gt;&lt;br /&gt;    public void testSimpleDateFormat() throws InterruptedException {&lt;br /&gt;        for (int i = 0; i &lt; 50; i++) {&lt;br /&gt;            MyRunnable[] runnables = {&lt;br /&gt;                    new MyRunnable(new Date(-1)),&lt;br /&gt;                    new MyRunnable(new Date(1))&lt;br /&gt;            };&lt;br /&gt;&lt;br /&gt;            Thread one = new Thread(runnables[0]);&lt;br /&gt;            Thread two = new Thread(runnables[1]);&lt;br /&gt;&lt;br /&gt;            one.start();&lt;br /&gt;            two.start();&lt;br /&gt;&lt;br /&gt;            one.join();&lt;br /&gt;            two.join();&lt;br /&gt;&lt;br /&gt;            assertFalse(&quot;Values should not be equal&quot;,&lt;br /&gt;                    runnables[0].value.equals(runnables[1].value));&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    private static class MyRunnable implements Runnable {&lt;br /&gt;        private Date date = null;&lt;br /&gt;        public String value = null;&lt;br /&gt;&lt;br /&gt;        MyRunnable(Date date) {&lt;br /&gt;            this.date = date;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        public void run() {&lt;br /&gt;            value = FORMAT.format(date);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;</description><link>http://m2ward.blogspot.com/2007/08/are-your-java-projects-misusing.html</link><author>noreply@blogger.com (Michael Ward)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-12081526.post-6807948503458462301</guid><pubDate>Wed, 29 Aug 2007 12:40:00 +0000</pubDate><atom:updated>2007-08-29T08:37:01.360-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">action</category><category domain="http://www.blogger.com/atom/ns#">argible</category><category domain="http://www.blogger.com/atom/ns#">rails</category><category domain="http://www.blogger.com/atom/ns#">ruby</category><category domain="http://www.blogger.com/atom/ns#">test</category><title>Argible: testing argible-ized actions</title><description>Last week &lt;a href=&quot;http://blog.jayfields.com/&quot;&gt;Jay Fields&lt;/a&gt; and I were discussing &lt;a href=&quot;http://rubyforge.org/projects/argible&quot;&gt;Argible&lt;/a&gt; and he asked, &quot;How&#39;s testing an action that uses Argible?&quot;, the answer ... easy.&lt;br /&gt;&lt;br /&gt;Suppose we have the following Controller with an &lt;i&gt;argible-ized&lt;/i&gt; action:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;class CalculatorController &lt; ApplicationController&lt;br /&gt;&lt;br /&gt;  argible(:first =&gt; :to_i, :second =&gt; :to_i)&lt;br /&gt;  def add(first, second)&lt;br /&gt;    @result = first + second&lt;br /&gt;  end&lt;br /&gt;&lt;br /&gt;end&lt;/pre&gt;&lt;br /&gt;And here is the associated &lt;a href=&quot;http://rspec.rubyforge.org&quot;&gt;RSpec&lt;/a&gt; test:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;describe CalculatorController, &quot;add action&quot; do&lt;br /&gt;  controller_name :calculator&lt;br /&gt;&lt;br /&gt;  it &quot;should add argument values&quot; do&lt;br /&gt;    post :add, :first =&gt; &quot;18&quot;, :second =&gt; &quot;2&quot;&lt;br /&gt;    controller.instance_variable_get(:@result).should == 20&lt;br /&gt;  end&lt;br /&gt;&lt;br /&gt;end&lt;/pre&gt;&lt;br /&gt;You can see from the test that you do not need to do anything special to test your &lt;i&gt;argible&lt;/i&gt; annotated action methods.  Just call the action with whatever parameter name and values your action requires.</description><link>http://m2ward.blogspot.com/2007/08/argible-testing-argible-ized-actions.html</link><author>noreply@blogger.com (Michael Ward)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-12081526.post-151100643305716269</guid><pubDate>Thu, 23 Aug 2007 01:33:00 +0000</pubDate><atom:updated>2007-08-22T17:40:11.571-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">blog</category><category domain="http://www.blogger.com/atom/ns#">blogger.com</category><category domain="http://www.blogger.com/atom/ns#">publish</category><title>Blogger.com: unable to edit a post without publishing</title><description>Today I went back through my blog and added some labels (aka tags) to older posts.  Soon afterwards I realized that adding these labels forced those post to be re-published.  I found this annoying because visitors to sites like &lt;a href=&quot;http://blogs.thoughtworks.com/&quot;&gt;ThoughtBlogs&lt;/a&gt; would now have to sift through this &quot;noise&quot;, obscuring the most &lt;a href=&quot;http://m2ward.blogspot.com/2007/08/argible-automatically-set-instance.html&quot;&gt;recent post&lt;/a&gt; I&#39;m most interested in sharing.&lt;br /&gt;&lt;br /&gt;I think Blogger.com should provide a way to make minor edits to previously published posts without forcing these posts to be re-published.  I understand that WordPress offers this functionality (right?).  Is there a way this can be done that I might have missed? Or would I need to wait for such functionality to be introduced?  Maybe it&#39;ll be easier if I just move my blog WordPress?</description><link>http://m2ward.blogspot.com/2007/08/bloggercom-unable-to-edit-post-without.html</link><author>noreply@blogger.com (Michael Ward)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-12081526.post-5808758942755429861</guid><pubDate>Wed, 22 Aug 2007 16:30:00 +0000</pubDate><atom:updated>2007-08-22T15:03:52.146-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">argible</category><category domain="http://www.blogger.com/atom/ns#">rails</category><category domain="http://www.blogger.com/atom/ns#">ruby</category><title>Argible: automatically set instance variables</title><description>As I discussed in my last post &lt;a href=&quot;http://rubyforge.org/projects/argible&quot;&gt;Argible&lt;/a&gt; makes it easy to resolve method argument values through simple convention.  &lt;a href=&quot;http://www.peterryan.net/category/geek/&quot;&gt;Peter Ryan&lt;/a&gt; had an excellent idea of using Argible to automatically set an instance variable&#39;s value through simple convention.  Have a look at the example below:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;class MyController &lt; ApplicationController&lt;br /&gt;&lt;br /&gt;  argible(:foo =&gt; :@bar)&lt;br /&gt;  def action_one&lt;br /&gt;    p &quot;Bar instance variable was set to: #{@bar}&quot; &lt;br /&gt;  end&lt;br /&gt;&lt;br /&gt;end&lt;/pre&gt;&lt;br /&gt;Notice that the action method, &lt;span style=&quot;font-weight:bold;&quot;&gt;action_one&lt;/span&gt;, has NO arguments.  But the argible annotation was passed &lt;span style=&quot;font-style:italic;&quot;&gt;:foo =&gt; :@bar&lt;/span&gt;.  Argible will interpret that you want the resolved value of &lt;span style=&quot;font-style:italic;&quot;&gt;&#39;foo&#39;&lt;/span&gt; to be set upon the instance variable named &lt;span style=&quot;font-style:italic;&quot;&gt;&#39;@bar&#39;&lt;/span&gt;.  This happens because the symbol on the right hand side is prefixed with the character &#39;@&#39;.  Without this Argible will raise an Error informing you that there is no such argument.</description><link>http://m2ward.blogspot.com/2007/08/argible-automatically-set-instance.html</link><author>noreply@blogger.com (Michael Ward)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-12081526.post-2947212840163061300</guid><pubDate>Tue, 21 Aug 2007 04:43:00 +0000</pubDate><atom:updated>2007-08-22T15:05:08.976-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">argible</category><category domain="http://www.blogger.com/atom/ns#">rails</category><category domain="http://www.blogger.com/atom/ns#">ruby</category><title>Introducing Argible: Simplifing your Ruby on Rails Controllers</title><description>&lt;a href=&quot;http://rubyforge.org/projects/argible&quot;&gt;Argible&lt;/a&gt; is a RubyForge project that was created to simplify Action methods within your Ruby on Rails Controllers.  Argible annotated action methods will allow your Actions to define argument.  These argument names will be used in conjunction with request parameters to automatically resolve these argument values.  Have a look at the FoobarController code below:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;  class FoobarController &lt; ApplicationController&lt;br /&gt;&lt;br /&gt;    argible&lt;br /&gt;    def action_one(alpha)&lt;br /&gt;      ...&lt;br /&gt;    end&lt;br /&gt;&lt;br /&gt;    argible(:date =&gt; Date.method(:parse))&lt;br /&gt;    def action_two(date)&lt;br /&gt;      ...&lt;br /&gt;    end&lt;br /&gt;&lt;br /&gt;    argible(:date =&gt; lambda {|v| Date.parse(v) } )&lt;br /&gt;    def action_three(date)&lt;br /&gt;      ...&lt;br /&gt;    end&lt;br /&gt;&lt;br /&gt;    argible(:value =&gt; :to_i)&lt;br /&gt;    def action_four(value)&lt;br /&gt;      ...&lt;br /&gt;    end&lt;br /&gt;  end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The first method &lt;span style=&quot;font-weight:bold;&quot;&gt;action_one(alpha)&lt;/span&gt; is annotated with the method &lt;span style=&quot;font-weight:bold;&quot;&gt;argible&lt;/span&gt;.  When the &lt;span style=&quot;font-weight:bold;&quot;&gt;action_one&lt;/span&gt; method is executed Argible will intercept the call and look up the request parameter value associated with &lt;span style=&quot;font-weight:bold;&quot;&gt;alpha&lt;/span&gt;.  Next the &lt;span style=&quot;font-weight:bold;&quot;&gt;action_one&lt;/span&gt; method will be called with this resolved value.&lt;br /&gt;&lt;br /&gt;The second action, &lt;span style=&quot;font-weight:bold;&quot;&gt;action_two(date)&lt;/span&gt;, provides an example of how more complex processing can occur on argument values.  As in the first example the argument, this time named &lt;span style=&quot;font-weight:bold;&quot;&gt;date&lt;/span&gt;,  is resolved against the request parameters.  The resulting value will then be passed to the &lt;span style=&quot;font-style:italic;&quot;&gt;Date#parse&lt;/span&gt; method.  The result from &lt;span style=&quot;font-style:italic;&quot;&gt;Date#parse&lt;/span&gt; will then be used when &lt;span style=&quot;font-weight:bold;&quot;&gt;action_two&lt;/span&gt; is called. &lt;span style=&quot;font-style:italic;&quot;&gt;**NOTE: any method can be used, Date#parse is simply used as an example.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The action &lt;span style=&quot;font-weight:bold;&quot;&gt;action_three(date)&lt;/span&gt; provides an example of using a &lt;span style=&quot;font-style:italic;&quot;&gt;Proc (lambda)&lt;/span&gt; as alternative to a named method.&lt;br /&gt;&lt;br /&gt;The fourth example action &lt;span style=&quot;font-weight:bold;&quot;&gt;action_four(value)&lt;/span&gt; illustrates how you can call methods directly on the string value returned from&lt;br /&gt;the request parameter.&lt;br /&gt;&lt;br /&gt;Argible 0.1.0 is available for immediate use from &lt;a href=&quot;http://rubyforge.org/projects/argible&quot;&gt;http://rubyforge.org/projects/argible&lt;/a&gt;.  RDoc can be found at &lt;a href=&quot;http://argible.rubyforge.org&quot;&gt;http://argible.rubyforge.org&lt;/a&gt;.</description><link>http://m2ward.blogspot.com/2007/08/introducing-argible-simplifing-your.html</link><author>noreply@blogger.com (Michael Ward)</author><thr:total>5</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-12081526.post-7223688444259951067</guid><pubDate>Thu, 26 Jul 2007 14:15:00 +0000</pubDate><atom:updated>2007-07-26T11:30:44.185-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">jruby</category><category domain="http://www.blogger.com/atom/ns#">maven</category><category domain="http://www.blogger.com/atom/ns#">rspec</category><title>Run your JRuby RSpec tests from Maven</title><description>On my most recent project we made heavy use of &lt;a href=&quot;http://rspec.rubyforge.org/&quot;&gt;RSpec&lt;/a&gt;.  After 6+ months of using it I must admit that I am a big fan.  Therefor I was very happy to see that &lt;a href=&quot;http://jruby.codehaus.org/&quot;&gt;JRuby&lt;/a&gt; included RSpec within its distro (see &lt;a href=&quot;http://blog.aslakhellesoy.com/2007/5/23/jruby-bundles-rspec&quot;&gt;JRuby bundles RSpec&lt;/a&gt;). &lt;br /&gt;&lt;br /&gt;I have also been working on adding JRuby support for &lt;a href=&quot;http://waffle.codehaus.org/&quot;&gt;Waffle&lt;/a&gt;.  So I decided to write my Ruby tests for Waffle with RSpec.  Additionally, I wanted these RSpec tests to run as part of the build.  Waffle, like many Java open source projects, uses &lt;a href=&quot;http://maven.apache.org/&quot;&gt;Maven 2&lt;/a&gt;.  Regardless of whether you love or hate Maven its dependency and repository convention have became a standard way to easily distribute jars.  So I wrote an Maven plug-in that allows you to execute your RSpec tests from Maven.  We have since contributed this to &lt;a href=&quot;http://snapshots.repository.codehaus.org/org/codehaus/mojo/rspec-maven-plugin/&quot;&gt;Codehaus&#39; Mojo Project&lt;/a&gt;.  So give it a look if you have the need. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-style:italic;&quot;&gt;** Ruby support within Waffle will allow developers to write their Controllers, and other objects, with straight Ruby syntax.  Look for more info on this functionality soon.&lt;/span&gt;</description><link>http://m2ward.blogspot.com/2007/07/run-your-jruby-rspec-tests-from-maven.html</link><author>noreply@blogger.com (Michael Ward)</author><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-12081526.post-3703046663695225027</guid><pubDate>Wed, 23 May 2007 04:16:00 +0000</pubDate><atom:updated>2007-05-22T23:36:02.224-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">codehaus</category><category domain="http://www.blogger.com/atom/ns#">vraptor</category><category domain="http://www.blogger.com/atom/ns#">waffle</category><title>Waffle Haus ...</title><description>&lt;a href=&quot;http://waffle.codehaus.org&quot;&gt;Waffle&lt;/a&gt; is moving from SourceForge to &lt;a href=&quot;http://codehaus.org&quot;&gt;Codehaus&lt;/a&gt;.  Additionally, and more importantly &lt;a href=&quot;http://waffle.codehaus.org&quot;&gt;Waffle&lt;/a&gt; and &lt;a href=&quot;http://vraptor.org&quot;&gt;VRaptor&lt;/a&gt; teams have decided to join forces.&lt;br /&gt;&lt;br /&gt;The Waffle web framework will provide the core architecture for this joint effort.  As the first step we have has begun porting Waffle to Codehaus (renaming it to use org.codehaus.waffle package instead of com.thoughtworks.waffle).  Next we will begin to gradually port features from &lt;a href=&quot;http://vraptor.org&quot;&gt;VRaptor&lt;/a&gt;.  The vision of this effort is to create a larger and more consolidated community around a lean web application framework which honours the least-common-denominator principle.</description><link>http://m2ward.blogspot.com/2007/05/waffle-haus.html</link><author>noreply@blogger.com (Michael Ward)</author><thr:total>6</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-12081526.post-7993674402154211241</guid><pubDate>Tue, 20 Mar 2007 22:28:00 +0000</pubDate><atom:updated>2007-04-09T18:04:30.919-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">mock</category><category domain="http://www.blogger.com/atom/ns#">partial</category><category domain="http://www.blogger.com/atom/ns#">rails</category><category domain="http://www.blogger.com/atom/ns#">rspec</category><category domain="http://www.blogger.com/atom/ns#">ruby</category><title>RSpec:Rails - How to mock partials when testing a View.</title><description>When developing Ruby on Rails (RoR) applications I prefer to use RSpec over the built in testing framework provided with RoR.  The biggest benefit is that RSpec easily allows you to test your application layers in isolation (e.g. when testing a Controller you should not be interested in testing the Model).  So with that in mind when I am testing a View I am only interested in testing that View and not any of the potential partials that View may try to render.&lt;br /&gt;&lt;br /&gt;Suppose we have the View &lt;span style=&quot;font-weight: bold;&quot;&gt;/example/hello_world.rhtml&lt;/span&gt;:&lt;br /&gt;&lt;pre class=&quot;code&quot;&gt;&lt;br /&gt;&amp;lt;div id=&quot;person&quot;&amp;gt;&lt;br /&gt; &amp;lt;h2 class=&quot;title&quot;&amp;gt;Hello &amp;lt;%= @person.name %&amp;gt;&amp;lt;/h2&amp;gt;&lt;br /&gt; &amp;lt;%= render :partial =&amp;gt; &#39;address&#39;, :locals =&amp;gt; {:person =&gt; @person} %&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;/pre&gt;&lt;br /&gt;Often in RSpec when testing a view such as this the spec ends up testing the partial as well.  This is less than desirable because any change to the partial could break test for other views that render that partial.  After some investigation I discovered that I could mock the calls to &lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;%= render :partial =&gt; &#39;address&#39;... %&gt;&lt;/span&gt;.  Have a look at the following spec:&lt;br /&gt;&lt;pre class=&quot;code&quot;&gt;&lt;br /&gt;specify &#39;should call mock and not the actual partial&#39; do&lt;br /&gt; person = mock(&#39;person&#39;)&lt;br /&gt; person.should_receive(:name).and_return(&#39;Regan&#39;)&lt;br /&gt; assigns[:person] = person&lt;br /&gt;&lt;br /&gt; # Mock the call to &#39;render_partial&#39;...&lt;br /&gt; @controller.template.should_receive(:render).with(:partial =&amp;gt; &#39;address&#39;, :locals =&amp;gt; {:person =&amp;gt; person})&lt;br /&gt;&lt;br /&gt; render &#39;/example/hello_world&#39;&lt;br /&gt; response.should_have_tag(:h2, :content =&gt; &quot;Hello Regan&quot;)&lt;br /&gt;end&lt;/pre&gt;&lt;br /&gt;You can grab a handle to the ActionView through &lt;span style=&quot;font-weight:bold;&quot;&gt;@controller.template&lt;/span&gt; as is done in the example above.  Then I mock the call to the &#39;render&#39; method only when the &#39;address&#39; partial is requested.&lt;br /&gt;&lt;br /&gt;As you can see my spec only needs to be concerned with testing the &lt;span style=&quot;font-weight:bold;&quot;&gt;/example/hello_world.rhtml&lt;/span&gt; View.  The partial will have it&#39;s own separate spec.  The side effect is that my view  specification becomes much more manageable and far less brittle.</description><link>http://m2ward.blogspot.com/2007/03/rspecrails-how-to-mock-partials-when.html</link><author>noreply@blogger.com (Michael Ward)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-12081526.post-320149603983466647</guid><pubDate>Thu, 05 Oct 2006 21:19:00 +0000</pubDate><atom:updated>2006-10-05T16:27:17.101-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">annotations</category><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">paranamer</category><category domain="http://www.blogger.com/atom/ns#">waffle</category><title>ParaNamer support in Waffle as an alternative to annotations</title><description>The latest release of &lt;a href=&quot;http://waffle.sourceforge.net&quot;&gt;Waffle (0.7)&lt;/a&gt; can now fully support &lt;a href=&quot;http://paranamer.codehaus.org/&quot;&gt;ParaNamer&lt;/a&gt; as an alternative to annotations.  ParaNamer provides &quot;method parameter name access for versions of Java PRIOR TO Java 7.0&quot;.  ParaNamer combined with Waffle will allow you to utilize your &lt;a href=&quot;http://waffle.sourceforge.net/action-methods.html&quot;&gt;ActionMethod&lt;/a&gt; parameter names directly.  In the example below Waffle will use &quot;itemId&quot; and &quot;quantity&quot; to resolve the arguments for the &lt;span style=&quot;font-weight:bold;&quot;&gt;void removeFromCart(Long, int)&lt;/span&gt; action method.&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;code&quot;&gt;public class ShoppingCartAction implements Serializable {  &lt;br /&gt;    ...  &lt;br /&gt;&lt;br /&gt;    // No annotation is necessary when utilizing ParaNamer  &lt;br /&gt;    public void removeFromCart(Long itemId, int quantity) {  &lt;br /&gt;        cart.remove(itemId, quantity);  &lt;br /&gt;    }  &lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;For complete details on this please see the documentation on &lt;a href=&quot;http://waffle.sourceforge.net/action-methods.html&quot;&gt;Waffle ActionMethods&lt;/a&gt;.</description><link>http://m2ward.blogspot.com/2006/10/paranamer-support-in-waffle-as.html</link><author>noreply@blogger.com (Michael Ward)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-12081526.post-6865522746869874545</guid><pubDate>Thu, 05 Oct 2006 03:34:00 +0000</pubDate><atom:updated>2006-10-04T22:40:52.873-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">framework</category><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">waffle</category><category domain="http://www.blogger.com/atom/ns#">web</category><title>Describing Waffle with one picture</title><description>The &lt;a href=&quot;http://waffle.sourceforge.net&quot;&gt;Waffle&lt;/a&gt; team has been busy over the last few months adding features and simplifying the overall design.  Much of the documentation has been updated to reflect these changes.  Many times however, it is easier to describe something with a simple drawing or a picture.  So have a look at the following to get a clear idea of what Waffle provides:&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://waffle.sourceforge.net/images/waffle-in-a-nut-shell.png&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px;&quot; src=&quot;http://waffle.sourceforge.net/images/waffle-in-a-nut-shell.png&quot; border=&quot;0&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;</description><link>http://m2ward.blogspot.com/2006/10/describing-waffle-with-one-picture.html</link><author>noreply@blogger.com (Michael Ward)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-12081526.post-3609139346916492095</guid><pubDate>Wed, 04 Oct 2006 22:22:00 +0000</pubDate><atom:updated>2006-10-04T17:28:18.806-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">cygwin</category><category domain="http://www.blogger.com/atom/ns#">error</category><category domain="http://www.blogger.com/atom/ns#">ruby</category><title>Ruby on Cygwin error (*** unable to remap)</title><description>I had an annoying issue occuring when running Ruby under Cygwin.  The error was reproducable every time that I attempted to run the &lt;span style=&quot;font-weight:bold;&quot;&gt;ri&lt;/span&gt; command.&lt;br /&gt;&lt;pre class=&quot;code&quot;&gt;&lt;br /&gt;C:\cygwin\lib\ruby\1.8\i386-cygwin\readline.so to same address as parent(0x370000) != 0x2760000&lt;br /&gt;C:\cygwin\bin\ruby.exe (3132): *** unable to remap C:\cygwin\lib\ruby\1.8\i386-cygwin\readline.so to same address as parent(0x370000) != 0x2760000&lt;/pre&gt;&lt;br /&gt;I was finally able to resolve the issue with the following steps:&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;exit from cygwin&lt;/li&gt;&lt;br /&gt;&lt;li&gt;enter the dos command prompt&lt;/li&gt;&lt;br /&gt;&lt;li&gt;cd to you cygwin bin directory (c:\cygwin\bin)&lt;/li&gt;&lt;br /&gt;&lt;li&gt;run &lt;span style=&quot;font-weight:bold;&quot;&gt;ash rebaseall&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;restart cygwin ... problem solved&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;</description><link>http://m2ward.blogspot.com/2006/10/ruby-on-cygwin-error-unable-to-remap_04.html</link><author>noreply@blogger.com (Michael Ward)</author><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-12081526.post-115073870437403973</guid><pubDate>Mon, 19 Jun 2006 17:37:00 +0000</pubDate><atom:updated>2007-08-22T15:05:38.772-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">waffle</category><title>Waffle: define a default event in your Action</title><description>Waffle now provides a new &lt;i&gt;DefaultEvent&lt;/i&gt; method level annotation for use in your Actions.  This allows you to mark a particular method as the default event to fire when no other event was signalled.  This is particularly useful when a user is directed to a page for the first time.  Until now, the previous page was responsible for setting up for the page that preceeds it.  Either that or all links within your application would be required to define exactly which event should be triggered through request parameters (e.g. &quot;/application/myaction.htm?EVENT=init|{request}&quot;).&lt;br /&gt;&lt;br /&gt;The following Action example (MyAction) has its &lt;i&gt;init(HttpServletRequest)&lt;/i&gt; method annotated as the default event.&lt;br /&gt;&lt;pre class=&quot;code&quot;&gt;&lt;br /&gt;public class MyAction {&lt;br /&gt;   @DefaultEvent(&quot;{request}&quot;)&lt;br /&gt;   public void init(HttpServletRequest request) {&lt;br /&gt;       // ...&lt;br /&gt;   }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;Notice the value &quot;{request}&quot; set on the DefaultEvent annotation.  This provides a hint to Waffle to help it satisfy the method arguments.  If you are familiar with Waffle you should realize that this is similar to how events are defined from Views.  This in fact is not just similar it is identical.  You can define the event arguments for the DefaultEvent annotation in the same way described in the Advanced Events section of the &lt;a href=&quot;http://waffle.sourceforge.net/tutorial-two.html&quot;&gt;tutorial&lt;/a&gt;.</description><link>http://m2ward.blogspot.com/2006/06/waffle-define-default-event-in-your.html</link><author>noreply@blogger.com (Michael Ward)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-12081526.post-114550821778561047</guid><pubDate>Thu, 20 Apr 2006 03:51:00 +0000</pubDate><atom:updated>2007-08-22T15:06:24.172-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">waffle</category><category domain="http://www.blogger.com/atom/ns#">web</category><title>Waffle on TheServerSide.com</title><description>Waffle was recently posted on TheServerSide.com under the heading &lt;a href=&quot;http://www.theserverside.com/news/thread.tss?thread_id=39731&quot;&gt;Another Rails-like web framework: Waffle&lt;/a&gt;.  I was happy to see it posted and really appreciated the responses from those that are interested in Waffle.&lt;br /&gt;&lt;br /&gt;I&#39;m grateful for the comparison of Waffle to &lt;a href=&quot;http://www.rubyonrails.org/&quot;&gt;Ruby on Rails&lt;/a&gt; but Waffle is &lt;b&gt;NOT&lt;/b&gt; a Java version of Rails.  I think the only viable comparison I can make between Waffle and Ruby on Rails is:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;convention based&lt;/li&gt;&lt;li&gt;simplicity&lt;br /&gt;&lt;/li&gt;&lt;li&gt;both take advantage of their respective languages&lt;/li&gt;&lt;li&gt;increased development productivity&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Many, if not most, of the clients I consult at have made a significant investment in either Java or .NET (specifically C#) and for that reason alone Ruby on Rails is not a viable option.  So next time you are about to begin work on a Java based web framework make sure you take a look at &lt;a href=&quot;http://waffle.sourceforge.net/tutorial-one.html&quot;&gt;Waffle&lt;/a&gt;.</description><link>http://m2ward.blogspot.com/2006/04/waffle-on-theserversidecom.html</link><author>noreply@blogger.com (Michael Ward)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-12081526.post-114360979479814592</guid><pubDate>Wed, 29 Mar 2006 04:41:00 +0000</pubDate><atom:updated>2006-03-28T23:52:25.846-06:00</atom:updated><title>Try using FreeMarker to generate XML documents</title><description>Generating XML from code is a very common development task.  There are a multitude of ways it can be accomplished.   Recently, at a client, we needed to generate an XML message which had to conform to a rather complicated XML schema.  We already had an object model that worked well with our code base.  We considered using XML binding API&#39;s like:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://jaxb.dev.java.net/&quot;&gt;JAXB&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://jibx.sourceforge.net/&quot;&gt;JiBX&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://xstream.codehaus.org/&quot;&gt;XStream&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;Each of these had its own limitations which reduced their feasibility within our application.  Next we considered hand-coding the XML directly with API&#39;s like:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://www.dom4j.org/&quot;&gt;DOM4J&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://jdom.org&quot;&gt;JDOM&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://java.sun.com/j2se/1.5.0/docs/api/org/w3c/dom/package-summary.html&quot;&gt;org.w3c.dom&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;The amount of code required to create an XML document with these API&#39;s was excessive.  Code like this was not fun to write nor easy to follow.&lt;br /&gt;&lt;br /&gt;So we decided to take a different approach and use a templating engine, specifically &lt;a href=&quot;http://freemarker.sf.net&quot;&gt;FreeMarker&lt;/a&gt;.  Using FreeMarker to generate the XML response messages turned out to be a great decision.  This is a list of some of the advantages we have noticed:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;The FreeMarker template we wrote to create the XML response message is an XML document.  This simple fact should not be overlooked.&lt;/li&gt;&lt;li&gt;Easy to integrate into any application.  Very little code was required to utilize FreeMarker in our application.&lt;/li&gt;&lt;li&gt;Excellent performance.&lt;/li&gt;&lt;li&gt;The &lt;a href=&quot;http://freemarker.sourceforge.net/docs/ref_builtins.html&quot;&gt;built-in&lt;/a&gt; functionality that FreeMarker provides is very powerful.&lt;/li&gt;&lt;/ol&gt;</description><link>http://m2ward.blogspot.com/2006/03/try-using-freemarker-to-generate-xml.html</link><author>noreply@blogger.com (Michael Ward)</author><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-12081526.post-114360699001233824</guid><pubDate>Wed, 29 Mar 2006 04:21:00 +0000</pubDate><atom:updated>2007-08-22T15:06:24.172-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">waffle</category><category domain="http://www.blogger.com/atom/ns#">web</category><title>Tutorials for Waffle</title><description>I have been spending my free time updating Waffle with functionality and documentation.  Two tutorials have been added to the &lt;a href=&quot;http://waffle.sf.net&quot;&gt;Waffle web site&lt;/a&gt;  which should provide a good overview of how to use Waffle and what makes it different. &lt;br /&gt;&lt;br /&gt;The examples in the tutorials show how to use Waffle with JSP&#39;s.   This was done based on feedback I have had when talking about Waffle with developers.   At this point you should get latest Waffle code directly from subversion and build it with &lt;a href=&quot;http://maven.apache.org/&quot;&gt;Maven 2.0&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;I would appreciate any comments or feedback you could offer.</description><link>http://m2ward.blogspot.com/2006/03/tutorials-for-waffle.html</link><author>noreply@blogger.com (Michael Ward)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-12081526.post-114067023357875246</guid><pubDate>Thu, 23 Feb 2006 04:28:00 +0000</pubDate><atom:updated>2006-02-22T22:50:33.616-06:00</atom:updated><title>Sourceforge and subversion</title><description>I logged into &lt;a href=&quot;http://sourceforge.net/&quot;&gt;SourceForge.net&lt;/a&gt; today and noticed that a &lt;b&gt;Subversion&lt;/b&gt; link was now available when I went to the Administration page.   I&#39;m not sure when this feature became available or how long it took me to actually notice it but I think it is great news that SourceForge now provides it.&lt;br /&gt;&lt;br /&gt;Look for &lt;a href=&quot;http://waffle.sourceforge.net&quot;&gt;Waffle&#39;s&lt;/a&gt; code base to be moved to Subversion shortly.</description><link>http://m2ward.blogspot.com/2006/02/sourceforge-and-subversion.html</link><author>noreply@blogger.com (Michael Ward)</author><thr:total>1</thr:total></item></channel></rss>