Tutorials

POJO to XML serialization with XStream (and POJO to JSON to boot)

I recently started a project where I am exploring whether or not to use GWT-Ext with GWT in order to leverage some of the widgets therein. One of the first things I ran up against, which seems to hit everyone at some point in this same process, is that GWT-Ext doesn't support GWT-RPC for data feeds out of the box (though they do offer a non-free "Plus" package that can do it - I didn't want to drop the cash though just for an evaluation - maybe more on that later).

JPA Tutorial: Maps and Composite Keys

I wrestled with JPA again today, and came away with some hard earned knowledge, so I want to put this one up on the interwebs.

I am working with a Database that was created by, effectively, another product. It has a relationship of Contact -<> ContactItem where contact item has a PK of [ContactID, TypeID]. What I really wanted was for Contact to have a map on it of ContactItems index by the Integer typeID.

First off, Composite keys are a PITA in JPA anyway, and doing this with a Map collection type is even worse. So lets go over the important parts:

Reading and writing JPEG metadata (EXIF) from Java with Sanselan

Recently I had a need to be able to work with EXIF image metadata in JPEG files from Java. First, some background, then, some code.

Jpg image with EXIF - bike

Sample image I used, lots of EXIF info on this shot of a 1971 SL70 that I am rebuilding.

I started by looking at JAI-imageio, which is the current home of the old Sun JAI project (to be fair, that and more), but I couldn't readily figure out how to use it to write EXIF data. The capability might be there, but I couldn't find any substantive documentation or examples (apart from JavaDocs, which are useful yes, but I needed more hand holding to start out). When I ran into this basic getting started stumbling block I broadened my search.

From there I found several third party libraries. Most notable where Metadata Extractor, and Sanselan.

Debugging external Java processes with Eclipse (GWT example)

Many modern IDEs have all sorts of support for running applications, even servers, in process with the IDE; and then debugging from there. It's good to also be aware, however, that you can debug *external* processes pretty easily as well. This is made possible by the Java Platform Debugger Architecture.

bug

Gwittir Demo, Part 2. Adding Tags.

In the last post we made a real simple flickr browser. Now I am going to modify it to support tags on the search. You can see the results here.

There is now a text box where you can type comma delimited sets of tags to search flickr for. (Hit return to update the results) This feature demonstrates the use of the Converter interface in bindings. We want to bind the TextBox to the "tags" property on the FlickrSearch bean, so we use a converter to split the tags:

  
Syndicate content