Java continuations

"the JVM could very easily support continuations"

XML on the Web Has Failed

The Bile Blogger could learn a thing or two from Mark

Atom in a Nutshell (as of Atom API 0.9)

I've been working to learn Atom as quickly as possible and so I've been reading the developing format and API specifications, following the mailing list, watching the issues list and experimenting with Atom4J and the Blogger.com Atom API implementations. Atom is pretty simple, so I'm going to take a stab at explaining it in a couple of paragraphs. To follow this explanation, you'll need to have a basic understanding of the Web including both HTTP and XML.

Atom is a new standard for publishing on the Web. Atom defines both a data format for Web publishing and a protocol for interacting with a Web publishing system, such as a Weblog server, a Wiki, or a Content Management System.

The Atom format is an XML based format. A file that is formatted according to the Atom Format specification is known as an Atom feed. The top-level XML element is <feed>. An Atom feed is made up of a collection of Atom entries, represented as XML <entry> elements. Each entry has a title, a summary, text content, and other attributes. FYI, an Atom formatted file must be served as application/atom+xml or it won't work.

The Atom API, a Web services protocol, is defined in terms of HTTP URIs and HTTP verbs such as GET, PUT, POST, and DELETE. The Atom API specification defines three classes of URIs: Feed URI, Post URI, and Edit URI.

A Feed URI provides a way to get Atom entries. If you do a GET on a Feed URI, you will receive an Atom feed. If the server knows who you are, this Atom feed may contains a series of <link> elements, just like the ones in HTML, that point to the Feed URIs for each of the Blogs, or Wiki namespaces or Content Management document collections, that you are allowed to edit. If the server knows which Blog you are requesting, then the Atom feed will contain the latest entries from that Blog. In that case, the feed will also contain the Post URI for the Blog, Feed URI for fetching the next and previous batch of entries, and each entry will contain an Edit URI for editing that entry.

A Post URI provides a way to create new entries on a server. You create a new entry by using an HTTP POST to write the that entry to the server as an XML <entry> element.

An Edit URI provides a way to edit an entry on a server. To get a specific entry, you do a GET on the Edit URI for that entry. To update an entry, you POST the <entry> XML representation of that entry to the Edit URI for that entry. To delete an entry you do a DELETE on the entry's Edit URI. The use of the PUT and DELETE verbs is problematic for some devices with limited HTTP support and a workaround is being sought.

Currently, authentication is done via WSSE and each Atom API request must carry an HTTP header that contains a valid WSSE token. Mark Pilgrim explained this in his XML.com column and Claud Montpetit illustrated it with a nice and concise Java example. However, WSSE seems to have fallen out of favor and may not be included in a future version of the spec.

Did I get something wrong? Please correct me. Leave a comment.


Dive into Python... yum

I ate a big ole slab of Dive into Python cake today (thanks Mark). The cake is probably gone by now, but you can buy the book on Amazon so get to it!


Are Blogs Ready for Primetime?

"blog readers are older and richer than many people suppose"

Blogs Proving Effective Team Integation

"Expect to see more blogs at your site among developers, sys admins and system managers"

Bloggers aren't journalists... really?

"journalists sound like a bunch of insecure cry babies"

RSS Growing Pains

InfoWorld needs to work on their plumbing

Longhorn Through the Open Source Lens

"Avalon is the next Active X"

Atom4J, Subversion, and Mac OS X

Happy news today: Lance accepted me as a committer on Atom4J (thanks Lance). I'm going to be helping him to keep Atom4J in line with the developing Atom Format and API specs. Atom4J, by the way, is not just an Atom Format parser, it is also a Atom API server framework. If you want to add Atom API support to your Java-based Web application, all you have to do is to extend the abstract org.osjava.atom4j.servlet.AtomServlet and provide implementions for a handful of abstract methods. I'm interested in adding Atom API client capabilties to Atom4J and I've already made some progress on that front.

Now, on to the less happy part of the story. Atom4J is hosted at OSJava.org in a Subversion archive. This is my first experience with Subversion and getting set up took some time. I ran into some problems on my platform of choice, which is Mac OS X, but I eventually found some level of success. Here's what I did:

  • I use Eclipse 3.0 so I installed Subclipse, the Subversion plugin for Eclipse. Unfortunately, I could not get Subclipse to support SSL. I was able to get Subclipse to checkout Atom4J by using HTTP protocol instead of HTTPS, but, because of this, I could not do a commit via Subclipse.

  • By default, Subclipse uses it's own Java-based Subversion client implementation, but Subclipse can also be configured to use a command line verison of Subversion if one exists on your computer. So I decided to get the command line version of Subversion.

  • I used Fink to install svn with fink install svn. Unfortunately, the version of svn that it installs does not support SSL and is therefore useless to me.

  • After some googling around, I found that what I needed was svn-client-ssl, so I tried to get that from fink. Fink told me that I needed system-java14-dev. After some more googling, I found that I needed to re-install the Java SDK so I did. I tried find again and this time Fink told me that it was unable to upgrade db42-ssl-shlibs because it conflicted with db42-shlibs. So I uninstalled db42-shlibs and ran Fink again. Fink cranked away fetching and building for about 45 minutes and died with some other error that I can't remember. At this point, I gave up on Fink for the day.

  • Finally, I found a blog entry that pointed me in the right direction. Bill Bumgardner wrote about Martin Ott's pre-built Subversion binaries for Mac OS X. So I downloaded and installed those.

  • I went back to Eclipse, configured Subclipse to use my new SSL ready command-line version of Subversion and presto magico, after several hours of flailing around, everything started working.

UPDATE: In his O'Reilly weblog Brian Coyner shows how to build Subversion and Java bindings on Mac OS X. I wonder if his instructions result in an SSL capable client.


Roller tip: Styling Blog entries according to Blog category

Scott Hudson asks "Is there any way to modify Roller to insert the category information around each entry, so we can do additional CSS styling?" The answer is yes, with a little page template hacking you can do almost anything to your Roller Blog.

To add a div around each entry with a style class that varies with the entry category, you need to add some code to your Blog's day template. Find the foreach loop in your day template that iterates over each day's Blog entries and add a div tag around the contents of that foreach, as shown below. To give each category it's own category, you use a Velocity expression to get the category name $entry.category.name.

#foreach( $entry in $entries )
<p>
   <div class="cat_$entry.category.name">

     ... display one weblog entry, code removed for brevity ... 

   </div>
</p>
#end

Now that you've got class, you can add some style. You can do this by adding CSS to your main Blog page or to your CSS template if you have one. For example, if you have categories General, Music, and Java and you'd like ot put a red border around your General entries, a green border around your music entries, and a blue border around your Java entries, you would add the following CSS:

.cat_General {
   padding: 3px;
   border-left: 5px red solid;
   border-right: 1px red solid;
   border-top: 1px red solid;
   border-bottom: 1px red solid;
}
.cat_Music {
   padding: 3px;
   border-left: 5px green solid;
   border-right: 1px green solid;
   border-top: 1px green solid;
   border-bottom: 1px red solid;
}
.cat_Java {
   padding: 3px;
   border-left: 5px blue solid;
   border-right: 1px blue solid;
   border-top: 1px blue solid;
   border-bottom: 1px blue solid;
}

Below is a screenshot that shows what this looks like (and yes, I'm aware of the border mix-up on the Music post):

screenshot showing different styles for each category


Try Roller, it's easy!

To make it easier for folks to try Roller, I have created a standalone Roller demo by bundling Roller with JSPWiki, Tomcat, and the tiny pure-Java HSQLDB database. Everything is preconfigured and ready to run. All you need to do to try Roller is the following:

1. Download roller-demo-0.9.9.2.zip from SourceForge (an 18MB download)

2. Unzip the file into a directory on your hard-drive (directory name should have no spaces)

3. Ensure that the JAVA_HOME environment variable is set to point to your JDK

4. Ensure that CATALINA_HOME is NOT set in your environment

5. To start Roller, either:
     - on Windows: open the Roller bin directory and double-click on startup.bat 
     - on UNIX: cd to the Roller bin directory, chmod +x on all files, run ./startup.sh

6. Point your browser at http://localhost:8080 

7. Login as testuser1/testuser1, admin/admin, or register as a new user

8. Get rollin'



J2EZ

oh god no

XML is tough

yes it is (note the Roller feeds in Marks list)

« Previous page | Main | Next page »