<?xml version="1.0" encoding="UTF-8"?>
<!--Generated by Squarespace Site Server v5.8.0 (http://www.squarespace.com/) on Sat, 07 Nov 2009 16:39:39 GMT--><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rss="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:cc="http://web.resource.org/cc/"><rss:channel rdf:about="http://hopper.squarespace.com/blog/"><rss:title>Blog</rss:title><rss:link>http://hopper.squarespace.com/blog/</rss:link><rss:description></rss:description><dc:language>en-GB</dc:language><dc:date>2009-11-07T16:39:39Z</dc:date><admin:generatorAgent rdf:resource="http://www.squarespace.com/">Squarespace Site Server v5.8.0 (http://www.squarespace.com/)</admin:generatorAgent><rss:items><rdf:Seq><rdf:li rdf:resource="http://hopper.squarespace.com/blog/2009/8/31/hotspot-arithmetic.html"/><rdf:li rdf:resource="http://hopper.squarespace.com/blog/2009/6/7/scalarizing-velocity.html"/><rdf:li rdf:resource="http://hopper.squarespace.com/blog/2009/1/26/work-distribution-in-rabbitmq.html"/><rdf:li rdf:resource="http://hopper.squarespace.com/blog/2009/1/22/capabilities-for-messaging.html"/><rdf:li rdf:resource="http://hopper.squarespace.com/blog/2008/11/15/how-i-install-rabbitmq-on-osx.html"/><rdf:li rdf:resource="http://hopper.squarespace.com/blog/2008/11/9/flow-control-in-rabbitmq.html"/><rdf:li rdf:resource="http://hopper.squarespace.com/blog/2008/11/7/measuring-scalability.html"/><rdf:li rdf:resource="http://hopper.squarespace.com/blog/2008/10/7/consumer-driven-messaging.html"/><rdf:li rdf:resource="http://hopper.squarespace.com/blog/2008/10/6/multithreading-amqp-clients.html"/><rdf:li rdf:resource="http://hopper.squarespace.com/blog/2008/7/22/simple-amqp-library-for-ruby.html"/></rdf:Seq></rss:items></rss:channel><rss:item rdf:about="http://hopper.squarespace.com/blog/2009/8/31/hotspot-arithmetic.html"><rss:title>HotSpot Arithmetic</rss:title><rss:link>http://hopper.squarespace.com/blog/2009/8/31/hotspot-arithmetic.html</rss:link><dc:creator>0x6e6562</dc:creator><dc:date>2009-08-30T23:49:51Z</dc:date><dc:subject>Java</dc:subject><content:encoded><![CDATA[<p>Recently I was tracking down a spurious issue in the RabbitMQ Java client library that was returning null values from a call where it just didn't seem possible that it could return null. This is a brief article about a very curious issue in the Java Hotspot compiler. If you are just interested in the HotSpot issue, then just skip the section about it was discovered in the client library.</p>
]]></content:encoded></rss:item><rss:item rdf:about="http://hopper.squarespace.com/blog/2009/6/7/scalarizing-velocity.html"><rss:title>Scalarizing Velocity</rss:title><rss:link>http://hopper.squarespace.com/blog/2009/6/7/scalarizing-velocity.html</rss:link><dc:creator>0x6e6562</dc:creator><dc:date>2009-06-07T21:28:47Z</dc:date><dc:subject>Scala</dc:subject><content:encoded><![CDATA[<p>It is quite well documented that <a href="http://www.scala-lang.org/">Scala</a> is a boon to those who need to extend or integrate Java based applications and libraries. Recently, I found myself implementing some some new back end functionality for a website that uses <a href="http://velocity.apache.org/">Velocity</a> to render its frontend. Whilst doing this, a few gotchas arose:</p>

<ul>
<li>Scala collections do not work out of the box with a Velocity foreach loop;</li>
<li>Velocity expects the attributes of an object instance to be exposed via the JavaBean getter/setter convention;</li>
</ul>

<p>However, a small amount of googling some simple solutions for these problems.</p>

<h3>Automatically Convert Scala Collections To Java</h3>

<p>Whilst the reverse operation is well documented, there does not appear to be an inbuilt mechanism to convert Scala collections to Java. The solution to this has been provided by Jorge Ortiz's <a href="http://github.com/jorgeortiz85/scala-javautils/tree/master">scala-javautils</a> library on Github.</p>

<p>This uses an implicit conversion that allows you to invoke a function called <em>asJava</em> on any Scala collection to get it converted to a Java collection. Just refer to the README on the Github project page to see how easy this is. After applying this to my Scala collections, the Velocity templates are now able to iterate through them.</p>

<h3>Expose Attributes As JavaBean accessors</h3>

<p>One of the nice things about Scala is the paradigm shift away from unnecessary JavaBean accessors. However, Velocity, unless I'm unaware of of some magical configuration parameter, follows the JavaBean mantra, which can be a hassle when you just want your template to read the properties of a class instance.</p>

<p>Thankfully there is an on-board feature that can auto-generate getters and setters for your attributes. By annotating a field with the @BeanProperty annotation, the Scala compiler will automatically generate these methods for you, thus saving you from unnecessary boilerplate in your Scala code. An example looks like this:</p>

<pre><code>package foo

import reflect.BeanProperty

class Bar {
  @BeanProperty var id:Long = -1
}
</code></pre>

<p>This allows you to use plain jane JavaBean accessors in your Velocity templates.</p>

<h3>If Scala Can Drive Velocity</h3>

<p>A third option may be of interest to you, if you are invoking the template application from within Scala code. Martin Kneissl wrote this <a href="http://www.familie-kneissl.org/open-source/scala-velocity">Scala wrapper for Velocity</a>, which addresses the Java collection issue in Scala.</p>

<p>YMMV.</p>
]]></content:encoded></rss:item><rss:item rdf:about="http://hopper.squarespace.com/blog/2009/1/26/work-distribution-in-rabbitmq.html"><rss:title>Work Distribution in RabbitMQ</rss:title><rss:link>http://hopper.squarespace.com/blog/2009/1/26/work-distribution-in-rabbitmq.html</rss:link><dc:creator>0x6e6562</dc:creator><dc:date>2009-01-26T22:37:56Z</dc:date><dc:subject>AMQP RabbitMQ</dc:subject><content:encoded><![CDATA[<p>The next major release RabbitMQ contains a feature called QoS, which means egress flow control in AMQP parlance. This article describes a practical application of this feature using a competing consumer work distribution pattern. The example code uses the RabbitMQ Java client, but this feature is not Java-specific and the same principles apply to any language client.</p>
]]></content:encoded></rss:item><rss:item rdf:about="http://hopper.squarespace.com/blog/2009/1/22/capabilities-for-messaging.html"><rss:title>Capabilities For Messaging</rss:title><rss:link>http://hopper.squarespace.com/blog/2009/1/22/capabilities-for-messaging.html</rss:link><dc:creator>0x6e6562</dc:creator><dc:date>2009-01-22T07:49:01Z</dc:date><dc:subject>AMQP</dc:subject><content:encoded><![CDATA[<p>This article introduces the potential usage of capabilities as an access control mechanism in messaging middleware. It describes the motivation behind a proof-of-concept implementation that demonstrates the feasibility of a capability based approach to securing access in the RabbitMQ message broker. Whilst it was decided not to further develop this paradigm in Rabbit, the experiences gained from it may be valuable for anybody contemplating using capabilities to implement access control. Though not strictly necessary, a basic understanding of the AMQP execution model can be advantageous to appreciate the implications of this article.</p>
]]></content:encoded></rss:item><rss:item rdf:about="http://hopper.squarespace.com/blog/2008/11/15/how-i-install-rabbitmq-on-osx.html"><rss:title>How I Install RabbitMQ On OSX</rss:title><rss:link>http://hopper.squarespace.com/blog/2008/11/15/how-i-install-rabbitmq-on-osx.html</rss:link><dc:creator>0x6e6562</dc:creator><dc:date>2008-11-15T22:07:47Z</dc:date><dc:subject>Erlang OS X RabbitMQ</dc:subject><content:encoded><![CDATA[<p>A little while ago, Rany Keddo wrote an article about how to get RabbitMQ up and running on OSX. If you are looking for a super easy way to install RabbitMQ, please read that article rather than this one. This article is just a description of how a RabbitMQ developer runs RabbitMQ on OSX.</p>
]]></content:encoded></rss:item><rss:item rdf:about="http://hopper.squarespace.com/blog/2008/11/9/flow-control-in-rabbitmq.html"><rss:title>Flow Control In RabbitMQ</rss:title><rss:link>http://hopper.squarespace.com/blog/2008/11/9/flow-control-in-rabbitmq.html</rss:link><dc:creator>0x6e6562</dc:creator><dc:date>2008-11-09T15:25:57Z</dc:date><dc:subject>AMQP RabbitMQ</dc:subject><content:encoded><![CDATA[<p>Recently I wrote an article about an item that the RabbitMQ team has been working on lately, in which the scalability of routing was discussed. Mildly related to this is a further piece of work that has been carried out over the last few months - introducing producer flow control. This article describes what it is and how you can use it in RabbitMQ. It is assumed that the reader has some familiarity with the AMQP model and also having some knowledge of Erlang would be useful, but not essential. Readers who are not interested in the background of the protocol can jump forward to the practical side of this article.</p>
]]></content:encoded></rss:item><rss:item rdf:about="http://hopper.squarespace.com/blog/2008/11/7/measuring-scalability.html"><rss:title>Measuring Scalability</rss:title><rss:link>http://hopper.squarespace.com/blog/2008/11/7/measuring-scalability.html</rss:link><dc:creator>0x6e6562</dc:creator><dc:date>2008-11-07T01:10:44Z</dc:date><dc:subject>AMQP RabbitMQ</dc:subject><content:encoded><![CDATA[<p>One of the items that the RabbitMQ team has been concentrating on recently, is a major piece of refactoring that intends to achieve linear scalability of routing within the message broker. Actually doing the refactoring work turned out to be a lot less effort than designing and implementing a strategy to verify that the resulting patch set did indeed scale linearly. This is an article about the approach that was taken in order to measure the scalability of the system. It is assumed that the reader is familiar with the execution model of AMQP.</p>
]]></content:encoded></rss:item><rss:item rdf:about="http://hopper.squarespace.com/blog/2008/10/7/consumer-driven-messaging.html"><rss:title>Consumer Driven Messaging</rss:title><rss:link>http://hopper.squarespace.com/blog/2008/10/7/consumer-driven-messaging.html</rss:link><dc:creator>0x6e6562</dc:creator><dc:date>2008-10-07T00:39:42Z</dc:date><dc:subject>AMQP</dc:subject><content:encoded><![CDATA[<p>A fair while ago, Kirk Wylie wrote an article about some of the conceptual mistakes he felt were made in the specification of the AMQP protocol. Amongst other observations, he made the point that a producer <em>should</em> require no knowledge of the routing semantics of an exchange in order to send a message. He observes that this currently may not be the case, and hence questions the consistency of the model.</p>
]]></content:encoded></rss:item><rss:item rdf:about="http://hopper.squarespace.com/blog/2008/10/6/multithreading-amqp-clients.html"><rss:title>Multithreading AMQP Clients</rss:title><rss:link>http://hopper.squarespace.com/blog/2008/10/6/multithreading-amqp-clients.html</rss:link><dc:creator>0x6e6562</dc:creator><dc:date>2008-10-06T23:11:47Z</dc:date><dc:subject>AMQP</dc:subject><content:encoded><![CDATA[<p>Although this is not stated explicitly in the protocol, a channel is the smallest unit of parallelism in AMQP. You <em>should</em> bind an AMQP channel to a client thread, so that a channel is managed as a thread-local object. But what if you're using the same channel in multiple threads? The short answer: don't. This article summarizes some questions that have asked by people writing and using AMQP client libraries in a multithreaded fashion and provides some general advice about how to deal with parallelism in this context.</p>
]]></content:encoded></rss:item><rss:item rdf:about="http://hopper.squarespace.com/blog/2008/7/22/simple-amqp-library-for-ruby.html"><rss:title>Simple AMQP Library for Ruby</rss:title><rss:link>http://hopper.squarespace.com/blog/2008/7/22/simple-amqp-library-for-ruby.html</rss:link><dc:creator>0x6e6562</dc:creator><dc:date>2008-07-22T06:43:43Z</dc:date><dc:subject>AMQP Ruby</dc:subject><content:encoded><![CDATA[<p>Aman Gupta has just completed a Ruby client implementation of AMQP that is now available on his Github repository. This article describes the background of this project, the motivation behind a Ruby AMQP implementation and demonstrates some working code examples. This article will be of interest to you if you are looking for a simple Rubyesque API for interfacing with enterprise grade messaging.</p>
]]></content:encoded></rss:item></rdf:RDF>