Tuesday, September 30, 2008

Installing Fonts in Ubuntu 8.04 - Hardy Heron

The way of installing fonts is bit different (must say it is pretty simple too) in Ubuntu 8.04.

You just have to create a .fonts folder (if it does not exist) in your home folder and copy the TTF to that folder.

Well. Thats it :)

Monday, September 22, 2008

Writing a Simple Atompub Client Using Apache Abdera

The atom publishing protocol (similar to RSS but with an enhanced ability) is an application level protocol for editing and publishing web resources for periodically updated web sites, using HTTP. An atom document which adheres to the Atom syndication format spec, is used as an atom feed or entry.

Apache Abdera implements this protocol and exposes a simple API to make the thing easy. The way to create an atom feed and to add an entry is shown below.
Abdera abdera = new Abdera();
Feed fd = abdera.newFeed();

fd.setId("unique feed id");
fd.setTitle("feed title");
fd.setUpdated(new Date());
fd.addAuthor("username");

//adding the entry
Entry entry = fd.addEntry();
entry.setId("unique id");
entry.setTitle("entry title");
entry.setSummary("summary");
entry.setContent("The content goes here");
entry.addSimpleExtension(new QName(namespace, "elementName"), "elementContent");//To add an extra element to the entry
entry.setUpdated(new Date());
Now let's see how to post this feed to the abdera server which contains all business logic.
AbderaClient client = new AbderaClient(abdera);
ClientResponse response = client.post("http://www.somesite.com/collection",fd);
Retrieving feeds is just a matter of calling Abdera client's get method.
ClientResponse response = client.get("http://www.somesite.com/collection/atom1.php");
Document doc = response.getDocument();
Abdera client can call put, delete methods as well. Meanwhile the server side should implement the relevant business logic for these methods.This is a good tutorial with further information to follow.


Related Posts with Thumbnails