Archive for the 'devel' Category

Atom Reference Implementation

atom-logo75px.gifJames Snell: “Just a couple of minutes ago I sent off a new proposal to the Apache Incubator PMC to consider incubation of ‘ARI’, a reference implementation of the Atom Syndication Format and Atom Publishing Protocol specifications.”

I’ve been working with Atom lately, specifically with the Publishing Protocol side of things, and have been using Rome, supplemented by some of Dave Johnson’s code. While Rome is a fine toolkit for all kinds of syndication needs, its support for the many variations of RSS tends to get in the way when all you need is Atom, and Dave’s code is too blog-centric for my needs, which have nothing to do with blogging.

So I welcome ARI and will have a look at the code ASAP but, judging from the latest spat of articles on James’ blog, it looks like it already provides a good set of features on the syndication front and some support on the publishing one. I’ll try to swap it in in place of my homegrown, Rome-based code and see if it works out.

Technorati Tags: , , , , , .

SOAP really stands for…

… no, not Simple Object Access Protocol, that was dropped long ago and with good reason, as “simple” is not a very fitting connotation for it.

Rather, it probably stands for Snakes on a Plane. If there’s something that many people are afraid of is snakes, and another one is flying. There’s no doubt that you should be very afraid of something that tries to combine the two, as in SOAP. Not to mention that scary WS-* stuff that is infested by vendor-pires. Brrrrr ;).

Technorati Tags: , , .

Ruby for Java Programmers, Part VI

In the previous episode from this series, I showed you how to use XML-RPC to call Java code from Ruby over the network. In this article, we will do the same, but using SOAP instead of XML-RPC. One advantage of SOAP over XML-RPC is the fact that SOAP endpoints can be described using WSDL and, by using Ruby’s extensibility, new methods can be created on the fly to mirror the methods declared in the WSDL, therefore giving us a lot of nice loose coupling.

Moreover, toolkits exist to automatically create WSDL descriptions from Java classes, so you won’t have to do it by hand. One of these toolkits, and the one we’ll be using in the examples here, is XFire. The most recent version of XFire available at the time I’m writing this is 1.1-RC1. I suspect this example will work just as well when 1.1 final is released. You’ll also need Java5 and Maven 2.

Maven is handy for automatically downloading all the necessary dependencies and running the demo inside a servlet container, using the Jetty6 plugin, without writing much code or configuration. Of course, you can always download all the necessary JARs by hand and drop them, together with the demo code, into the servlet container of your liking.

You can follow XFire’s Quick Start tutorial to set up a simple SOAP service, or you can simply grab a copy of this archive, which adds some more data to the tutorial sample, unzip it and run mvn jetty6:run from its root directory, once you have Maven installed. Go grab a cup of coffee while Maven downloads all the dependencies. Finally test that everything is OK by requesting a copy of the WSDL file from http://localhost:8080/services/BookService?wsdl.

On Ruby’s side, all that is needed is already provided by Ruby’s own core soap library, in particular SOAP::WSDLDriverFactory.

Here’s how you’d call your service from Ruby:

require 'soap/wsdlDriver'
WSDL_URL = 'http://localhost:8080/services/BookService?wsdl'
driver = SOAP::WSDLDriverFactory.new(WSDL_URL).create_rpc_driver
books = driver.getBooks(nil)
p books.out.book[0].title
book = driver.findBook(:isbn => '222')
p book.out.title

A couple of minor nits:

  1. The BookService#getBooks method in Java takes no arguments, but if you try to call driver.getBooks without arguments, Ruby complains about a missing argument. Apparently, passing a ‘nil’ value fixes it, but I’d like to know why this is so.
  2. XFire add this extra ‘out’ element to its generated schema. This is mildly annoying as you always have to use it in order to access the real values you are interested in.

On the pro side, you can set up all of this with very little configuration. The only configuration that is going to change from one application to another is XFire’s services.xml file which maps service names to service classes, and even this is pretty straightforward:

<beans xmlns="http://xfire.codehaus.org/config/1.0">
  <service>
    <name>BookService</name>
    <namespace>http://sourcesense.com/BookService</namespace>
    <serviceClass>com.sourcesense.xfire.demo.BookService</serviceClass>
  </service>
</beans>

Technorati Tags: , , , , .

Dutch Ministry of Finance website goes live

If you’ve been wondering what I’ve been doing in Amsterdam lately, here’s the scoop. I’ve been working with the Hippo and the Clockwork guys, together with Andrew and other colleagues, to design and implement the new website for the Dutch Ministry of Finance.

This is the first major website to be based on the new, open source version of Hippo CMS and it’s not going to be the last one, as the website for the Ministry of Foreign Affairs is next in line, and then maybe other government sites will follow.

The website strives to be valid XHTML, even though validity checking is not yet complete, and accessible to everyone. Of course, you should be able to read Dutch… ah wait, there’s an English version available.

Congratulations to everyone involved and looking forward to many other big achievements like this one!

Duke Nukem Forever is a Rails application

nukem.jpgThe long wait is finally over. After having been in development since 1997, we finally have a demo version of Duke Nukem Forever. Not being much of a gamer, I’m not that excited, but being a web developer I finally feel vindicated: According to Ars Technica, Duke Nukem Forever is a Ruby on Rails application, runs in a browser and uses Ajax:

From the ReadMe.txt file, I also found out why we’ve been waiting so long for Duke Nukem Forever. Wanting Duke Nukem Forever to run on all platforms, but not wanting to bust a nut writing three different versions (not to mention having to come up with both PowerPC and x86 binaries for Mac OS X), the developers came up with a clever solution. Duke Nukem Forever has been rewritten as an Ajax application written using the Ruby on Rails framework. What it means is that Duke Nukem Forever has skipped a generation and is the first true Web 3.0 application, and it runs entirely in your web browser. Any web browser, on any platform… well almost.

This clearly demonstrates that the Web is the platform for everything, including high-end, 3D games with plenty of sex and gore. Go Rails!


Does Rails want to be enterprisey?

The now infamous post by James McGovern on Ruby’s lack of “enterprise” qualities sparked an interesting thread on the Rails mailing list.

The thread is interesting because it is strangely devoid of flames and name-calling and, apart from the usual FUD about Java being slow being spread by a few clueless people, quite informative. I particularly appreciated the posts by David Johnson.

One thing seems clear to me. In order to become more successful in the enterprise, Ruby needs to overcome some of its current limits, like the lack of serious internationalization and threading features and of a serious threading implementation.

It also seems clear that, contrary to what McGovern writes, Ruby is not a train wreck waiting to happen. If it’s currently lacking in some aspects, there’s no reason not to expect that it will get there, given enough time.

Some people however wondered whether it’s really a good thing for Ruby and Rails to become more “enterprisey” or rather if it would lose its simplicity and appeal by trying to go beyond simple database-backed web applications. To me this looks too limiting. My current approach, as I wrote before, is to try to make the Ruby and Java worlds go hand-in-hand together in harmony. Having Ruby running on the JVM thanks to JRuby might do much towards this, particularly if the objective of having Rails running on JRuby is as close as they say it is.

Technorati Tags: , , .

<a method=”POST”…>

What do we need to do in order to make this happen?

Technorati Tags: , .

Speaking at OSCON

OSCON.gifJust got this in the mail:

Congratulations! You have been accepted as a presenter for the O’Reilly Open Source Convention 2006 at the Oregon Convention Center July 24, 2006 - July 28, 2006.

The following has been accepted as a 45 minute session for the event:

“Ruby for Java Programmers”

I can’t even try do describe how excited I am. OSCON is the Open Source conference to attend if you’re into OSS — not to mention speaking at it — even if someone may consider it a bit too commercial. At the same time, I’m somewhat scared. I’ll have to prepare a kick-ass talk and double-check all my facts if I don’t want to be thoroughly grilled.

Technorati Tags: , , , .

Italy on Rails

italyonrails.gifVia the Ruby on Rails mailing list I just discovered that there’s going to be a Rails conference in Italy: “Open Source Path is proud to announce the first ever Ruby on Rails conference within Europe to be held in Rome, Italy in the Fall of 2006.”

How cool! I will probably miss the RailsConf in Chicago, but this one being so nearby, I’m not going to miss it!

By the way, where’s the Italian Rails community? I know there’s an Italian Ruby users group, but I don’t know of any Rails-specific Italian user group, community or whatever. If you know of some, or would like to organize one, please leave a comment here.

Paul Graham has a new blog … NOT!

Paul Graham has a new blog. Too bad it doesn’t have an RSS feed. Is it still a blog if you cannot read it in your aggregator? Regardless, if I can’t aggregate it, I simply won’t read it, which is a pity.

(Via Rob Sanheim.)

Faulty parallel between Open Source and sports

Matt Asay: “In short, open source = Arsenal. Enterprise bloatware = Juventus.”

If that were true, Arsenal would be the winning team, as Open Source is winning more and more often against enterprise bloatware. Instead, Arsenal is doing so-so and Juventus is about two win the second championship in a row. How comes? Well, I guess we’ll find out on March 28 ;).

Technorati Tags: , , .

Will the real Open Source please stand up?

An interesting debate is going on among a few prominent bloggers, most of whom I know personally, around the concept of Open Source and the risk it runs of being watered down by clueless companies trying to bend and exploit it for their own ends.

It all started with feather (the ASF marketing blog) quoting my friend and colleague Gianugo:

I think I’ve been through enough winters to understand that the world is a competitive pool full of sharks and deal with it, but still I’m disturbed by the number of people trying to exploit the Open Source wave with little to no clue.

Then Sylvain chimed in with:

There’s been a number of companies jumping in the Open Source bandwagon lately, using it merely as a marketing tool to find new creative ways of locking in customers.

Later Matt puts forward his disagreement:

I do think that the “real” open source community tends to view itself through an elitist frame sometimes, and fetishes over what’s being kept back rather than what is being given away. The upshot of even the lamest of open source companies is that a huge amount of code (much more than if the “real” community were left to its own devices - just take a look at the growth in Sourceforge since the mudbloods invaded) is now free. This is a positive thing, whatever the negatives (and I’ve written similarly to Gianugo’s comments before.

Finally, we have Matthew who does not want to take sides:

A bit like quantum physics (if you’ll pardon the glossing over) - the more people look at Open Source (with their varied backgrounds and goals), the more Open Source itself will change to become - well, who knows. Being successful in this marketplace will also mean being able to adapt quickly to the changes within Open Source and within the software business as a whole.

Personally, I too think that community is more important than code and that Darwinian selection will weed out certain companies, or at least their Open Source strategies, in the end. However, I’m not so sure we need to clarify what Open Source really stands for and that we risk being confused with “the suckers out there”. Regardless of the field we’re playing in, we’re bound to find opportunistic players, but we shouldn’t be afraid of being perceived to be one and the same with them, just as Rijkaard shouldn’t be afraid of being lumped together with Mourinho (I guess Matt will agree with me here. By the way, as I’m writing this the match is still 0-0 but Barcelona seems to be able to score sooner or later).

Most of all, I agree with Matthew: “it’s the customer who will, in the end, define what commercial Open Source turns out to be.”

Technorati Tags: , .

We’re hiring…

We still don’t have a logo (more on this later), but yes, we’re hiring.

We’re looking for developers who would like to work for a small company with a strong orientation towards Open Source, as in wanting to actively participate in Open Source communities and give back as well as take. We like agility, focus, getting real. We like to communicate openly: Open Source is mostly about communicating with your peers, after all. We have strong international ties, so you could find yourself traveling a bit, mostly across Europe, but we can also offer telecommuting arrangements if you like working from home.

We would like you to know most of the buzzwords in the enterprise Java world, like JDBC, JMS, JAXP, Spring, Hibernate, JDO; to know your way around the 1st and the 2nd generation Web, starting with HTTP and HTML and going through XML, XSLT, XPath, XQuery, REST, Web Services; to have a strong background in OOP theory and relational databases.

We’re looking for both junior and senior developers, designers and architects. So we expect you to know by heart most of what I listed above, but even if you’re fresh out of college don’t worry. If you have a good background and are willing to learn, we’re ready to teach.

If you’re interested, send your resume (in text, HTML or PDF formats only; any other format will be rejected immediately) to recruitment@sourcesense.com. We’d love to hear your story.

Updated to ping edgeio.

Technorati Tags: , , , .

Book review: Programming Ruby

0974514055.01._AA_SCMZZZZZZZ_.jpgProgramming Ruby, by Dave Thomas.

I finally decided to review this book, having read it quite some time ago. The reason I waited this long is that I feared I wouldn’t have been able to provide a fair assessment of the merits of this book. My problem is that, nowadays, I get easily bored reading yet another programming book. And a book entirely dedicated to a single programming language was bound to bore me infinitely.

That’s what happened, actually. I got so bored that it took me a really long time to finish it, even after skipping entire chapters. I managed to finish it only because I forced myself to do it.

I know Ruby is cute, and has lots of nice and innovative features, but I just can’t stand anymore reading operator precedence tables, variations on the basic control structures and core libraries. Last time I got excited by a programming language was with Java, and that was circa 1995. I’m too old for that.

But I must try to stay objective and think how useful “Programming Ruby” could be to a young programmer and I have to admit the answer would be: a lot! As is customary with titles from The Pragmatic Programmers, quality is very high, both from a content point of view and from a presentation one as well. Well written, it even manages to inject a bit of humor into a dry subject. If you want a one stop shop reference for all Ruby, that’s it! Not much more to say, except that I’d have liked, at times, the code samples to be longer, more structured and less contrived, but it’s a minor nit.

I suggest that you read it in bits and pieces, not cover-to-cover and if boredom gets you, you can always get a little of why’s (poignant) guide to Ruby as an antidote.

It just doesn’t matter

I’m fairly behind on my reading list, as the last two months have been quite busy. I have a few thousand unread messages in various folders, but I’m not worried, as all of them are from some open source project’s mailing lists and I can just “mark all messages as read”. They just don’t matter.

Speaking of things that just don’t matter, while going through my feed aggregator’s backlog (517 unread entries right now and barely managing to read, or mark as read, more old items than new items coming in) I found this great quote by Jason Fried:

Most of the time you spend is wasted time on things that just don’t matter. If you can cut out the work and thinking that just doesn’t matter you’ll achieve productivity you’ve never imagined. It’s there if you just don’t pay attention to the things that don’t matter.

Nuff said.

Ruby for Java Programmers, Part V

If you’ve been following the previous articles in this series (Part I, Part II, Part III and Part IV) but are not yet satisfied with the range of solutions I presented for calling Ruby code from Java, here’s another one for you.

This one involves running your Java code as a separate process and interacting with it using some form of Web service (XML-RPC, SOAP or a RESTful service). We’ll use XML-RPC for this sample, mainly because it’s very easy to set up and use. You’ll need Apache XML-RPC version 2 to make the code run. Here’s the java code:

public class RPCFetcher {
    public static void main(String args[]) throws Exception {
        WebServer server = new WebServer(8080);
        server.addHandler("$default", new RPCFetcher());
        server.start();
    }

    public Vector fetch(String url) throws Exception {
        URL feedUrl = new URL(url);
        FeedFetcherCache feedInfoCache = HashMapFeedInfoCache.getInstance();
        FeedFetcher fetcher = new HttpURLFeedFetcher(feedInfoCache);
        SyndFeed feed = fetcher.retrieveFeed(feedUrl);
        Vector items = new Vector();
        for (Iterator it = feed.getEntries().iterator() ; it.hasNext() ; ) {
            SyndEntry entry = (SyndEntry) it.next();
            Hashtable map = new Hashtable();
            map.put("link", entry.getLink());
            map.put("title", entry.getTitle());
            map.put("publishedDate", entry.getPublishedDate());
            items.add(map);
        }
        return items;
    }
}

Compared to the previous samples, there’s not much else you need to do, besides creating an instance of WebServer to handle incoming HTTP requests and dispatch them to the appropriate method. However, you need to convert your Java types to something that XML-RPC is able to understand, i.e. strings, numbers, dates, Vectors, Hashtables and little else.

The Ruby client code is much simpler:

require 'xmlrpc/client'
server = XMLRPC::Client.new 'localhost', '/', 8080
entries = server.call('fetch', 'http://agylen.com/feed')
entries.each do | entry |
  p "#{entry['publishedDate'].to_time} #{entry['title']}"
end

Possible drawbacks of this technique are the necessity of having a separate process running and the overhead of HTTP communication and XML-RPC protocol encoding and decoding.

Thanks to Nick Stuart and Erik Hatcher for laying down the basics.

Cocoon supports Ajax

Ajax v. InterNo, I’m not referring to Ajax as in Asynchronous Javascript and XMLApache Cocoon has actually been supporting Ajax for quite a long time — but to Ajax as the football team from Amsterdam.

The reason why I’m putting Cocoon supports Ajax in the title of this post is that yesterday a bunch of Apache Cocoon developers (including three committers) went to the Amsterdam Arena to show their support for the home team in the Champions League football match against Inter F.C.

(If you thought that I, as an Italian, should have supported Inter, think again.)

Ajax, with a young and unexperienced lineup, started off briskly and hit Inter twice, with Huntelaar and Rosales in the first 20 minutes. We were cheering together with the other 49,000 people at the Arena, but our enthusiasm lasted only until the beginning of the second half, when Stankovic scored a lucky hit and then, just four minutes before the end of regular time, Julio Cruz (ex-Feyenoord) equalized for Inter from a short distance, thanks to an illuminating pass by Figo and then Cambiasso.

All in all, it was a nice match but I think Ajax has little hope of going through, having to win against Inter in Milan in two weeks: hardly probable. I also managed to shoot a fair number of good photographs (including two of the goals) and finally resolved to upgrade my Flickr account to “pro” level in order to be able to upload most of them. You can see the results in my Ajav vs. Inter set. I must say that my Panasonic DMC-FZ20 performed very well, thanks to its long zoom lens and incredibly useful image stabilizer.

Technorati Tags: ,

Krugle

krugleIt might be a bit early to say something interesting about krugle, given that it hasn’t launched yet, but I’ll try.

Judging from the product brief alone, it should really rock. But of course, all that matters is execution. I think relevance can be a big issue here. One of the screenshots shows search results for “java hash map”. How do you decide that a search result from Eclipse is more relevant than a search result from Apache Portals?

Koders has the same problem here, though. However, searching for “java hash map” is not very meaningful: Any competent Java programmer would just use a java.util.HashMap. It would be more useful to search for, say, “red-black tree algorithm in java”. There Koders fails miserably, whereas Google does find some results which seem relevant. How will Krugle fare? I don’t know, but if I manage to be accepted in the beta program, I will surely report.

I have also some reservations about the emphasis on componentized software:

The world has shifted from inflexible, monolithic applications written in isolation to applications built with components that can easily be modified and leveraged.

Unfortunately, at least in my humble opinion, the promise of reusable, modifiable components has failed to materialize so far, except maybe for VB programmers. It’s true that you can find many freely available libraries, toolkits and frameworks, but try to find an application-level component that you can readily reuse without extensive rewriting and you’re suddenly faced with a much harder task.

Anyway, this shouldn’t detract from the fact that a search engine for Open Source code can actually be useful, if properly implemented. I’m currently thinking whether it would be possible and worthwhile to mash up The Open Source Zone with Krugle. Do they provide an API?

Last but not the least, they have Chris Locke on board as “Blog Wrangler”. Well, this probably shows that they have a clue, at least. ;)

Technorati Tags: , ,

ApacheCon EU 2006 - Dublin, Ireland, June 26-30

Bertrand Delacretaz: “The ApacheCon Planners are pleased to announce that ApacheCon Europe 2006 will be held in Dublin, Ireland, at the Burlington Hotel, June 26-30.”

Hmmm, back to back with the RailsConf, which will be held in Chicago from the 22 to the 25 of June. I wonder if there are direct flights from Chicago to Dublin.

Campfire and AJAX making the web run faster, again

What David Heinemeier Hansson writes today links together the two latest posts I made here:

We’re currently polling every three seconds for every user active in a chat and while we’ll soon be able to regulate that between three and thirty seconds (depending on how active the chat is), it has certainly presented us with ’special needs’.

Exactly. As I wrote yesterday:

A second downside is that AJAX makes it really easy to write web pages that can hog a server much more than a traditional template processing step will ever be able to do. I can already see AJAX widgets constantly polling servers for updated data (news tickers, etc.) and possibly keeping server sockets tied for a long time, which is a usage pattern that most servers were not designed to cope well with.

So much for making the web run faster.

However, even with all this polling going on, Campfire is quite snappy and responsive. It’s really like IRC in a web browser, done right. I’m particularly intrigued by how they managed to have the browser window scrollbar scroll just the chat transcript and not the whole page. Brilliant! This is an application that really sets a new standard for web-based applications.