<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>justsoftwareconsulting.com</title>
	<atom:link href="http://justsoftwareconsulting.com/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://justsoftwareconsulting.com/blog</link>
	<description>nothing in particular</description>
	<lastBuildDate>Wed, 16 Mar 2011 13:09:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>authlogic authentication on different fields</title>
		<link>http://justsoftwareconsulting.com/blog/?p=195</link>
		<comments>http://justsoftwareconsulting.com/blog/?p=195#comments</comments>
		<pubDate>Wed, 13 Oct 2010 23:51:25 +0000</pubDate>
		<dc:creator>rob</dc:creator>
				<category><![CDATA[Ruby On Rails]]></category>
		<category><![CDATA[Great post. really hit the nail on the head.
http://groups.google.com/group/authlogic/browse_thread/thread/9af639591293b0d1/a362802ca4cccecf]]></category>

		<guid isPermaLink="false">http://justsoftwareconsulting.com/blog/?p=195</guid>
		<description><![CDATA[This guy hits the nail on the head in 4 lines: http://groups.google.com/group/authlogic/browse_thread/thread/9af639591293b0d1/a362802ca4cccecf Woot!]]></description>
			<content:encoded><![CDATA[<p>This guy hits the nail on the head in 4 lines:</p>

<p>http://groups.google.com/group/authlogic/browse_thread/thread/9af639591293b0d1/a362802ca4cccecf</p>

<p>Woot!</p>
]]></content:encoded>
			<wfw:commentRss>http://justsoftwareconsulting.com/blog/?feed=rss2&#038;p=195</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>XCode duplicate target deeply broken</title>
		<link>http://justsoftwareconsulting.com/blog/?p=190</link>
		<comments>http://justsoftwareconsulting.com/blog/?p=190#comments</comments>
		<pubDate>Tue, 25 May 2010 15:15:07 +0000</pubDate>
		<dc:creator>rob</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://justsoftwareconsulting.com/blog/?p=190</guid>
		<description><![CDATA[Note to self: Next time you get this: ld: warning: directory '"/Users/rob/Projects/drync/iphonegit"' following -L not found ld: warning: directory '"/Users/rob/Projects/drync/iphonegit/Pinch Analytics"' following -L not found ld: warning: directory '"/Users/rob/Projects/drync/iphonegit/Resources/Pinch Analytics"' following -L not found ld: warning: directory '"/Users/rob/Projects/drync/iphonegit"' following -F not found Remember that &#8216;Duplicate target&#8217; added bonus quotes to the library search path. (Look [...]]]></description>
			<content:encoded><![CDATA[<p>Note to self:</p>

<p>Next time you get this:</p>

<pre><code>    ld: warning: directory '"/Users/rob/Projects/drync/iphonegit"' following -L not found
    ld: warning: directory '"/Users/rob/Projects/drync/iphonegit/Pinch Analytics"' following -L not found
    ld: warning: directory '"/Users/rob/Projects/drync/iphonegit/Resources/Pinch Analytics"' following -L not found
    ld: warning: directory '"/Users/rob/Projects/drync/iphonegit"' following -F not found
</code></pre>

<p>Remember that &#8216;Duplicate target&#8217; added bonus quotes to the library search path. (Look real close above and notice the bonus \&#8221;. Helps if it&#8217;s the first thing you do in the morning after a good nights sleep and fresh coffee). Remove them.</p>
]]></content:encoded>
			<wfw:commentRss>http://justsoftwareconsulting.com/blog/?feed=rss2&#038;p=190</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>BBQ mushrooms and artichokes</title>
		<link>http://justsoftwareconsulting.com/blog/?p=189</link>
		<comments>http://justsoftwareconsulting.com/blog/?p=189#comments</comments>
		<pubDate>Mon, 10 May 2010 01:37:24 +0000</pubDate>
		<dc:creator>rob</dc:creator>
				<category><![CDATA[recipes]]></category>

		<guid isPermaLink="false">http://justsoftwareconsulting.com/blog/?p=189</guid>
		<description><![CDATA[Meat is great, but the chives are growing like gangbusters and actually flowering. The flowers are tasty &#8211; similar to the chives, but colorful (purple!) and lacking the bit, a little juicy and sweet even. I find that if you BBQ portobello mushrooms, and then garnish with chive blossoms and toasted pine nuts, you have [...]]]></description>
			<content:encoded><![CDATA[<p>Meat is great, but the chives are growing like gangbusters and actually flowering. The flowers are tasty &#8211; similar to the chives, but colorful (purple!) and lacking the bit, a little juicy and sweet even.</p>

<p>I find that if you BBQ portobello mushrooms, and then garnish with chive blossoms and toasted pine nuts, you have a really great appetizer.</p>

<p>Smoked Portobello mushroom</p>

<p>The result goes really well with this BBQ artichoke recipe: http://www.foodnetwork.com/recipes/artichoke-bbq-recipe-recipe/reviews/index.html</p>

<p>I roasted/smoked mine over a desultory wood fire (it never quite burned hot) for about 30-45 minutes before it was done.</p>

<p>Good result though.</p>
]]></content:encoded>
			<wfw:commentRss>http://justsoftwareconsulting.com/blog/?feed=rss2&#038;p=189</wfw:commentRss>
		<slash:comments>50</slash:comments>
		</item>
		<item>
		<title>POM.xml for hibernate app</title>
		<link>http://justsoftwareconsulting.com/blog/?p=188</link>
		<comments>http://justsoftwareconsulting.com/blog/?p=188#comments</comments>
		<pubDate>Mon, 26 Apr 2010 12:18:32 +0000</pubDate>
		<dc:creator>rob</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://justsoftwareconsulting.com/blog/?p=188</guid>
		<description><![CDATA[You&#8217;d think that the pom.xml provided in the Hibernate tutorial would like, work. But no, it lacks the version tag, and so you have to googling. And eventually you find someone else with the same problem: http://www.jumpingbean.co.za/blogs/hibernate-maven-dependencies-pom-setup Score 1 for google, 0 for jboss (http://docs.jboss.org/hibernate/stable/core/reference/en/html/tutorial.html#tutorial-firstapp-mvn)]]></description>
			<content:encoded><![CDATA[<p>You&#8217;d think that the pom.xml provided in the Hibernate tutorial would like, work. But no, it lacks the version tag, and so you have to googling.</p>

<p>And eventually you find someone else with the same problem: http://www.jumpingbean.co.za/blogs/hibernate-maven-dependencies-pom-setup</p>

<p>Score 1 for google, 0 for jboss (http://docs.jboss.org/hibernate/stable/core/reference/en/html/tutorial.html#tutorial-firstapp-mvn)</p>
]]></content:encoded>
			<wfw:commentRss>http://justsoftwareconsulting.com/blog/?feed=rss2&#038;p=188</wfw:commentRss>
		<slash:comments>42</slash:comments>
		</item>
		<item>
		<title>Getting Real about NoSQL and the SQL isn&#8217;t scalable lie</title>
		<link>http://justsoftwareconsulting.com/blog/?p=184</link>
		<comments>http://justsoftwareconsulting.com/blog/?p=184#comments</comments>
		<pubDate>Thu, 04 Mar 2010 14:25:13 +0000</pubDate>
		<dc:creator>rob</dc:creator>
				<category><![CDATA[scaling]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://justsoftwareconsulting.com/blog/?p=184</guid>
		<description><![CDATA[This is a fascinating article. Couldn&#8217;t agree more.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.yafla.com/dforbes/Getting_Real_about_NoSQL_and_the_SQL_Isnt_Scalable_Lie/">This</a> is a fascinating article. Couldn&#8217;t agree more.</p>
]]></content:encoded>
			<wfw:commentRss>http://justsoftwareconsulting.com/blog/?feed=rss2&#038;p=184</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>RXML cheat sheet</title>
		<link>http://justsoftwareconsulting.com/blog/?p=180</link>
		<comments>http://justsoftwareconsulting.com/blog/?p=180#comments</comments>
		<pubDate>Fri, 26 Feb 2010 15:10:17 +0000</pubDate>
		<dc:creator>rob</dc:creator>
				<category><![CDATA[Ruby On Rails]]></category>
		<category><![CDATA[rails  xml-api]]></category>

		<guid isPermaLink="false">http://justsoftwareconsulting.com/blog/?p=180</guid>
		<description><![CDATA[So, you want to produce a XML api for your RoR server, and you need to got beyond the defaults? In the controller, change the action from this: format.xml { render ml =&#62; @server_assignment } to this: format.xml (otherwise, your .rxml template never gets called, which is according to spec, but puzzling to the beginner) [...]]]></description>
			<content:encoded><![CDATA[<p>So, you want to produce a XML api for your RoR server, and you need to got beyond the defaults?</p>

<p>In the controller, change the action from this:</p>

<pre><code>format.xml  { render <img src='http://justsoftwareconsulting.com/blog/wp-includes/images/smilies/icon_mad.gif' alt=':x' class='wp-smiley' /> ml =&gt; @server_assignment }
</code></pre>

<p>to this:</p>

<pre><code>format.xml
</code></pre>

<p>(otherwise, your .rxml template never gets called, which is according to spec, but puzzling to the beginner)</p>

<p>The, in the view, create a file called <em>show.xml.rxml</em> (assuming that the action was &#8216;show&#8217;) like this:</p>

<pre><code>xml.instruct!
xml.tag!('resource-assignment') do
    xml.tag!('server-assignment-uri', test_run_server_assignment_path(@server_assignment.test_run,@server_assignment))
    xml.created_at @server_assignment.created_at
    xml.test_resource_uri server_path(@server_assignment.test_resource)
    xml.test_resource_name server_path(@server_assignment.test_resource.name)
    xml.test_run_uri test_run_path(@server_assignment.test_run)
end
</code></pre>

<p>A few things here:</p>

<ul>
<li>RXML doesn&#8217;t allow &#8216;-&#8217; (dashes) in tag names. Ie, you can&#8217;t say <em>xml.server-assignment-uri test_run_server_assignment_path(@server_assignment.test_run,@server_assignment))</em>. Hence the use of the <em>tag!</em> call.</li>
<li>when you do &#8216;render <img src='http://justsoftwareconsulting.com/blog/wp-includes/images/smilies/icon_mad.gif' alt=':x' class='wp-smiley' /> ml => @server_assignment&#8217;, you can&#8217;t add extra attributes, like the URI&#8217;s. Since this is part of a RESTful API, subobjects and related objects need to indicated with a URI. That&#8217;s the reason for the &#8216;xml.test_run_uri&#8217; syntax. </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://justsoftwareconsulting.com/blog/?feed=rss2&#038;p=180</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>Simple XML parsing in Java</title>
		<link>http://justsoftwareconsulting.com/blog/?p=179</link>
		<comments>http://justsoftwareconsulting.com/blog/?p=179#comments</comments>
		<pubDate>Thu, 25 Feb 2010 20:38:18 +0000</pubDate>
		<dc:creator>rob</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://justsoftwareconsulting.com/blog/?p=179</guid>
		<description><![CDATA[Here: http://argonrain.wordpress.com/2009/10/27/000/ Simple XML parser in Java. One class. No framework. No JAXB. Just parse the damn answer easily. Thank you!]]></description>
			<content:encoded><![CDATA[<p>Here: http://argonrain.wordpress.com/2009/10/27/000/</p>

<p>Simple XML parser in Java. One class. No framework. No JAXB. Just parse the damn answer easily.</p>

<p>Thank you!</p>
]]></content:encoded>
			<wfw:commentRss>http://justsoftwareconsulting.com/blog/?feed=rss2&#038;p=179</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Calling Ruby API from Java using Jersey API client</title>
		<link>http://justsoftwareconsulting.com/blog/?p=173</link>
		<comments>http://justsoftwareconsulting.com/blog/?p=173#comments</comments>
		<pubDate>Wed, 24 Feb 2010 20:54:56 +0000</pubDate>
		<dc:creator>rob</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[Ruby On Rails]]></category>

		<guid isPermaLink="false">http://justsoftwareconsulting.com/blog/?p=173</guid>
		<description><![CDATA[Apparently, RESTfull means different things to different folks. In particular, the Rails folks seem to have decided that the correct way to handle object creation is to do a POST to the resource. On successful creation, the server should indicate that by issuing a 302 to the location of the resulting new resource. Actually, I [...]]]></description>
			<content:encoded><![CDATA[<p>Apparently, RESTfull means different things to different folks.</p>

<p>In particular, the Rails folks seem to have decided that the correct way to handle object creation is to do a POST to the resource. On successful creation, the server should indicate that by issuing a 302 to the location of the resulting new resource.</p>

<p>Actually, I pretty sure that this is not the canonical RESTfull api pattern &#8211; reading <a href="http://kenai.com/projects/suncloudapis/pages/CloudAPIClusterRequests#Create_VM">examples from the wikipedia article</a>, I can see that the canonical way to create a resource RESTfully is via a POST, returning a &#8217;201 Created&#8217;, along with a body containing the XML result and a Location header pointing to the resource&#8217;s URL &#8211; but it was the problem I was trying to solve here.</p>

<p>I&#8217;m fine with that, but the folks that wrote the <a href="http://blogs.sun.com/enterprisetechtips/entry/consuming_restful_web_services_with">jersey.api.client</a> package don&#8217;t see it that way, and their package doesn&#8217;t follow that paradigm. You can tell it to follow redirects using <a href="http://www.flamingpenguin.co.uk/blog/2009/07/17/following-redirects-in-jersey-rest-client/">setFollowRedirects(true)</a>- sure, but it&#8217;ll lose the authentication headers and thus you&#8217;ll get a <em>401 Unauthorized</em> instead of display the resulting resource.</p>

<p>Anyway, I ended out writing a ClientFilter that detected the redirector, and followed the redirect after copying the headers. Here it is:</p>

<pre><code>package com.dell.tg;

import com.sun.jersey.api.client.ClientRequest;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.client.filter.ClientFilter;

class RedirectFilter extends ClientFilter {

    /* (non-Javadoc)
     * Handle a redirect by doing a get to the new location, using the same headers (this avoids auth headers being dropped). This handles the common RESTful API case for creation on a POST correctly, 
     * where the POST creates the resource and then 301 redirects to the show page. 
     * @see com.sun.jersey.api.client.filter.ClientFilter#handle(com.sun.jersey.api.client.ClientRequest)
     */
    public ClientResponse handle(ClientRequest cr) {
        ClientResponse clientResponse= this.getNext().handle(cr);
        if(isRedirect(clientResponse))
        {
            cr.setMethod("GET");
            cr.setEntity(null);
            cr.setURI(clientResponse.getLocation());
            return this.getNext().handle(cr);
        }
        else
            return clientResponse;
    }
    // Some sort of 3XX response.
    private boolean isRedirect(ClientResponse clientResponse)
    {
        return clientResponse.getStatus()/100 == 3;
    }

}
</code></pre>

<p>and here is an example of how to use it:</p>

<pre><code>package com.dell.tg;

import java.net.URISyntaxException;
import javax.ws.rs.core.MultivaluedMap;
import sun.misc.BASE64Encoder;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.client.filter.LoggingFilter;
import com.sun.jersey.impl.MultivaluedMapImpl;

class TGClient {
    private static final String AUTHENTICATION_HEADER = "Authorization";

    static TGClient instance;
    Client client = Client.create();
    String authentication;
    String server;

    public TGClient(String iServer, String iUser, String iPassword)
            throws URISyntaxException {
        server = iServer;
        authentication = "Basic " + encodeCredentialsBasic(iUser, iPassword);
        instance = this;
        client.setFollowRedirects(false);
        client.addFilter(new LoggingFilter()); // just for debugging happiness
        client.addFilter(new RedirectFilter());
    }

    public void createTestrun(String iName) {
        WebResource webResource = client.resource(String.format(
                "http://%s/test_runs.xml", server));

        MultivaluedMap&lt;String, String&gt; formData = new MultivaluedMapImpl();
        formData.add("test_run[name]", iName);
        String response = webResource.type("application/x-www-form-urlencoded")
                .header(AUTHENTICATION_HEADER, authentication).post(
                        String.class, formData);
        String fred = response.toString(); // Pretty lame - should tidy this up and get it into an XML document.

    }

    /**
     * &lt;p&gt;
     * Encode the specified credentials into a String as required by HTTP Basic
     * Authentication (&lt;a href="http://www.ietf.org/rfc/rfc2617.txt"&gt;RFC
     * 2617&lt;/a&gt;).
     * &lt;/p&gt;
     * 
     * @param username
     *            Username to be encoded
     * @param password
     *            Password to be encoded
     */
    @SuppressWarnings("deprecation")
    private String encodeCredentialsBasic(String username, String password) {
        String auth = username + ":" + password;
        BASE64Encoder encoder = new BASE64Encoder();
        return encoder.encode(auth.getBytes());
    }
}
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://justsoftwareconsulting.com/blog/?feed=rss2&#038;p=173</wfw:commentRss>
		<slash:comments>92</slash:comments>
		</item>
		<item>
		<title>Rails 2.3 auth solution: authlogic</title>
		<link>http://justsoftwareconsulting.com/blog/?p=172</link>
		<comments>http://justsoftwareconsulting.com/blog/?p=172#comments</comments>
		<pubDate>Thu, 28 Jan 2010 17:44:16 +0000</pubDate>
		<dc:creator>rob</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[rails authentication]]></category>

		<guid isPermaLink="false">http://justsoftwareconsulting.com/blog/?p=172</guid>
		<description><![CDATA[See here: http://www.themomorohoax.com/2009/02/21/rails-2-3-authentication-comparison Then use http://rdoc.info/projects/binarylogic/authlogic It&#8217;s the only rational solution.]]></description>
			<content:encoded><![CDATA[<p>See here: http://www.themomorohoax.com/2009/02/21/rails-2-3-authentication-comparison</p>

<p>Then use http://rdoc.info/projects/binarylogic/authlogic</p>

<p>It&#8217;s the only rational solution.</p>
]]></content:encoded>
			<wfw:commentRss>http://justsoftwareconsulting.com/blog/?feed=rss2&#038;p=172</wfw:commentRss>
		<slash:comments>71</slash:comments>
		</item>
		<item>
		<title>added javascript tag to haml</title>
		<link>http://justsoftwareconsulting.com/blog/?p=168</link>
		<comments>http://justsoftwareconsulting.com/blog/?p=168#comments</comments>
		<pubDate>Fri, 22 Jan 2010 16:52:49 +0000</pubDate>
		<dc:creator>rob</dc:creator>
				<category><![CDATA[Ruby On Rails]]></category>

		<guid isPermaLink="false">http://justsoftwareconsulting.com/blog/?p=168</guid>
		<description><![CDATA[recipe for setting focus: :javascript /* This will get executed whenever the create panel comes to view, picking which form field gets focus first */ window.create_panel_focus_flag=0; $('#reg_create').focus(function() { if(window.create_panel_focus_flag==0) { window.create_panel_focus_flag=1; }} where $(&#8216;&#8216;) is referencing the div#reg_create, hooking into the focus event. window.create_panel_focus_flag is creating a global variable called &#8220;create_panel_focus_flag&#8221;]]></description>
			<content:encoded><![CDATA[<p>recipe for setting focus: 
<pre>
  :javascript
    /* This will get executed whenever the create panel comes to view, picking which form field gets focus first */
    window.create_panel_focus_flag=0;
    $('#reg_create').focus(function() { if(window.create_panel_focus_flag==0) { window.create_panel_focus_flag=1; }}
</pre></p>

<p>where</p>

<ul>
<li>$(&#8216;<id>&#8216;) is referencing the div#reg_create, hooking into the focus event.</li>
<li>window.create_panel_focus_flag is creating a global variable called &#8220;create_panel_focus_flag&#8221;</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://justsoftwareconsulting.com/blog/?feed=rss2&#038;p=168</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

