Book Review: RSS and Atom

Posted by Martin Homik | Posted in Java | Posted on 02-06-2008

1

Like most of Manning’s books, RSS and Atom in Action is a high quality book. Beginning with some real-world scenarios, Dave Johnson introduces the interested reader into the world of blogging. Often, he talks about examples and points to ideas on how to (re-) use weblogs in a sophisticated way.

The book consists of two parts, the first part introduces related technical knowledge, the second part is a hands-on tutorial which presents various application ideas.

In the technical part, Dave Johnson presents details  on the history of different newsfeed formats (RSS and Atom), the ROME newsfeed utilities, a BlogClient API (known as Propono), how to serve newsfeeds, and how to publish with XML-RPC based APIs (MetaWeblog)  as well as with Atom protocol. All examples are accompanied by code snippets either in Java or in C#. The full code is available from the website.

In the application part, you’ll learn how to implement diverse applications such as as group aggregator, searching and monitoring the web, keeping your blog in sync, blog by sending an email (from your mobile), sending a daily digest by email, blog your software build process, blog from a chat room, distribute files podcast style, automatically download podcasts, automatically validate newsfeeds, and lots more.

You get the idea, this book is written for a practitioner who need to grasp the idea and learn by training. I highly recommend this book if you are interested in blogging, syndication, aggregation, etc.

If you need more details about software and if you are a Java developer, have also a look at Roller, Propono, and Rome. Dave is involved in all three quite popular frameworks. Follow his blog to get the latest news.

Scamper

Posted by Martin Homik | Posted in E-Learning | Posted on 26-05-2008

0

Scamper is a brainstorm mind-map technique to collect new ideas related to a focus question. For instance, a focus question could be  “How to improve a web page?” To answer the question one has to collect ideas that are categorized  by 7 questions. What need to be …?

  • substituted?
  • combined?
  • added?
  • modified?
  • put to other uses?Elim
  •  eliminated?
  • rearranged?

In the collection phase quantity has preference over quality, i.e., collect as many ideas as possible. Quality assessment comes into play in the next phase. Participants are asked to mark important ideas by bullets (e.g., by red points). The more points the higher the priority of an idea. This way, a quick approach to come up with a schedule of work tasks can be delivered.

I’m wondering if there is a software tool around that provides such a collaborative function and implements the idea of Scamper. Probably, MindManager is a good candidate.

E-Learning 2.0

Posted by Martin Homik | Posted in E-Learning, e-portfolio | Posted on 26-05-2008

0

Stephen Downs wrote a very nice overview paper about E-Learning 2.0 and its trends. In that, he describes the evolution of Web 1.0 to Web 2.0 and maps the process to the evolution of e-learning by identifying Web 2.0 patterns and explaining how to use them in e-learning. Here are few nice quotes:

  •  ”People in networked markets have figured out that they get far better information and support from one another than from vendors.”
  • “… the structures and organization that characterized life prior to the Internet are breaking down.”
  • ” … the Web itself was being transformed from what was called “the Read Web” to the “Read-Write Web,” in accordance with Tim Berners-Lee’s original vision.”
  • “In a nutshell, what was happening was that the Web was shifting from being a medium, in which information was transmitted and consumed, into being a platform, in which content was created, shared, remixed, repurposed, and passed along.”
  • “… Web 2.0 is not a technological revolution, it is a social revolution. [...] Web 2.0 is an attitude not a technology. It’s about enabling and encouraging participation through open applications and services. By open I mean technically open with appropriate APIs but also, more importantly, socially open, with rights granted to use the content in new and exciting contexts.”
  • “… online learning software ceases to be a type of content-consumption tool, where learning is delivered, and becomes more like a content-authoring tool, where learning is created
  • “It also begins to look like a personal portfolio tool.”
  • “… e-learning content is syndicated …”
  • In a ubiquitous computing world, we expect to “have learning available no matter what we are doing.”

How to test HTML code with dbunit

Posted by Martin Homik | Posted in Java, WebApp | Posted on 22-04-2008

2

As you know, I am working with AppFuse, and one important part of AppFuse is testing. To do that, you need sample data which is imported into the database. The dbunit sample data specifications says, that you can use any parsed character data as value but it does not say how to add html snippets into the database. To do that, you have to escape html entities. Below is an example for a body value element of table storing blog posts:

  1. <value description="body">
  2. &amp;lt;p align="justify"&amp;gt;London is the largest urban area and capital of England and the United Kingdom. &amp;lt;p&amp;gt;
  3. </value>

How to display html snippets in Struts2

Posted by Martin Homik | Posted in Java, WebApp | Posted on 22-04-2008

8

The second problem, I solved today, was to display html snippets in Struts. These snippets were stored in a POJO. If you use the usual Struts property element for displaying data, it will escape html code. Hence, you have to turn off escaping:

  1. <s:property escape="false" value="body"></s:property>

Windows and Whitespaces

Posted by Martin Homik | Posted in Java | Posted on 08-04-2008

0

Sometimes, it is really tough to work on Windows. Because of sticking to old habits, errors occur and you have to find them. Today, I was using Maven for a project. Suddenly, the download of an Ant jar stopped with an exception. The reason was a whitespace in the path:

C:\Dokumente und Einstellungen\…

To correct it, I had to change the maven path in the settings to good old DOS style:

C:\Dokume~1\…

This is so annoying. The error is documented for AppFuse here and here.

Automatic time-stamping of persisted data

Posted by Martin Homik | Posted in Java, WebApp | Posted on 08-04-2008

2

In my scenario, I want to know when a persisted object has been modified. This information should be stored in the database. There are a few approaches to do that.

  • In the database — I’ve read this suggestion somewhere that you can set a trigger. However, not all databases support this feature. Moreover, database independence is crucial. Setting a trigger as Java Annotation or property would be more convenient.
  • AOP — Write a Spring aspect that intercepts calls to Hibernate/Database and add the current time-stamp to the appropriate field.
  • JPA @Version — This was a promising approach. Unfortunately, edited objects were not updated but newly inserted. See a description here.
  • JPA Listeners – by implementing JPA listeners and using @PrePersist annotations this would be the most convenient and elegant way to implement the requirement. For some reason, entity listeners don’t work with AppFuse/Hibernate. Speculations point to Hibernate not supporting this feature.
  • Hibernate Interceptor – Similar to an aspect, one could implement a Hibernate Interceptor. However this approach bind the application to a specific Persistence Framework and prevents other persistency options in future. While this is a nice decision, one has to bear in mind that JPA is a small subset of features provided by each persistence framework. Hibernate is by far much more expressive than JPA and offers much more support than other frameworks. I fear that in the future, I will decide in favour of Hibernate as it offers much more support.
  • Manual — probably the worst solution is to leave the developer in full control. That is, he has to care that a timestamp is added and modified whenever an object is edited. This approach error-prone as changing the modified time-stamp can be forgotten. Morever, there can be a delay between setting the modified time-stamp and the actual persist action to the database.

The only option left is to give Spring AOP a shot. Let’s go!

Search with SQL

Posted by Martin Homik | Posted in Java, WebApp | Posted on 07-04-2008

0

Today I came across a wonderful Hibernate extension called Hibernate Search. If you have ever developed a web application with Hibernate which offered search, then you might have experiences the painful text search implementation with SQL/HQL. The truth is, SQL does not address the problem of text search in a way as we are accustomed to from Google Search. Just writing generic queries using like expressions with wildcards does not fulfil performance requirements.

This problem is actually addressed by Lucene. However, in a web application were the domain model is a key part of the business logic, Lucene is not easy to integrate. Problem such as structural mismatch, synchronization mismatch, and retrieval mismatch have to be solved. To bridge the gap and to provide the best things from both worlds, Lucene is now integrated into Hibernate. Search queries can be issued against the database or against Lucene in a transparant way. Search performance increases a lot and the developer has a very comfortable way to state queries and to provide results.

Class Serialization

Posted by Martin Homik | Posted in Java | Posted on 26-03-2008

0

In the past two weeks or so I have been fighting with different IDEs such as Netbeans, Eclipse, and IntelliJ. Though Eclipse is highly customizable, it can give you a very hard time. In particular when you have a J2EE package and validation is turned on. Then you get hundreds of errors and warnings. Lucky me, I was able to change the settings for my webapp project and to ignore many of the issues.

However, I came across a serialVersionUID warning which has been annoying several times before. In principle, you have to set a public, static, and final field of type Long for each class that implements the Serializable interface. I never knew how to come up with a suitable value, but a strength of Eclipse is to provide QuickFixes for many issues. In my case, I just pressed the almighty Ctrl+1 combination which offered to add a serialVersionUID field including a pre-calculated Long value. Cool.

By the way, a good online resource is here.

Bug in Maven Surefire Plugin

Posted by Martin Homik | Posted in Java, WebApp | Posted on 26-03-2008

0

On March 18 i tuned on my Laptop in the office ran a Maven build command on my project and it suddenly stopped with exceptions that pointed to Spring’s Beanfactory which was unable to load a bunch of beans. This was strange, because the evening before everything passed my JUnit tests. What happened?

I consulted AppFuse’s User group and found a thread which described my problem. Unfortunately, no good solution has been proposed. The author pointed to a Jira Issue in which a work around is described, but well, it’s not a good solution. A few other guys joined in the discussion, but none was able to solve the problem.

Today morning, I digged a bit deeper in it. I recalled March 18. One thing you have to know about Maven is, that by default, prior to compiling, it checks for new jar versions every day and downloads them. So I looked into my local m2 repository and found out that Maven downloaded the latest surefire plugin. I went to its web site and found a Jira bug report describing exactly the problem. However, the problem is still unresolved. But now that I know which version of the plugin caused the problem, I told my Maven project description not to use it and to use a previous version instead. Just add the follwing snippet to your build plugins section:

  1. <plugin>
  2.    <groupId>org.apache.maven.plugins</groupId>
  3.    <artifactId>maven-surefire-plugin</artifactId>
  4.    <version>2.3</version>
  5. </plugin>

Guess what, it solved my problem. And that makes my day. :-)