This past weekend I put together an example of a Spring Roo-based Jersey application that can run on Google App Engine. All code in this post is derived from the example project at https://github.com/marcisme/jersey-on-gae-example. You should be able to get a project up and running by copy and pasting the snippets in this entry, or you can clone the project and follow along. This example uses Spring Roo 1.1.1, Jersey 1.5 and App Engine SDK 1.4.0. A basic understanding of the involved technologies is assumed.
Regardless of how you feel about empty strings, you should be aware of the implications of allowing them on objects that will be persisted. While it seems reasonable to expect a database to store the exact value that you give it, that is unfortunately not always the case. If you’re going to allow empty strings on persistent objects, you should take the time to determine the behavior of the database management system you’re using. You should also assess how likely it is that you are going to either have to support multiple databases, or that you will switch to another database management system in the future.
As of Roo 1.1.0, addons are created with the addon command. This is slightly different than previous versions, where addons were created with a template argument to the project command. If you find documentation referencing this old style, it’s probably out of date.
If you’ve worked with Jersey, you’re likely familiar with the embedded Grizzly server. Though I haven’t seen it mentioned often, Grizzly can indeed serve static content too. The following snippet is all that’s necessary to fire up an embedded web server. These examples were written with Grizzly 1.9.18-m and Jersey 1.4.
I’ve recently been working on an iPhone application that integrates with Blogger, and as such I have gotten some experience with the GData Objective-C Client Library. The issues below were all encountered while working with the GDataServiceGoogleBlogger service, but they should apply to the other GData services too.
I finished putting together my personal website backup script, and it can be found on my Github page.
Being a heavy Eclipse user, I’ve grown accustomed to its keyboard shortcuts for moving and copying lines of text. Xcode doesn’t have a regular editing command for this, but it does offer similar functionality via user scripts. The Move Line Up and Move Line Down scripts are already there, just waiting for you to bind keys to them. Go to the script menu, which is to the left of the Help menu, and select the Edit User Scripts… menu item. Expand the disclosure triangle next to Text, and you can set keyboard shortcuts by double-clicking in the column to the right of the script names. Below is a screenshot of what the dialog will look like if you follow all of the instructions in this post.
Some Two-Up PDFs, such as the new Pragmatic Guide Series, are intended to be read with specific pages on the left or right side of the screen. Unfortunately these types of documents don’t always display the way the author intended in every PDF reader. However most PDF readers do provide features to get the desired presentation.
Most website hosting companies do their own backups, but they often make no guarantees about actually recovering your data. If you put any amount of effort into a website, you really owe it to yourself to have a decent backup and recovery strategy. You don’t have to do anything too fancy or complicated, but at a minimum you should backup your home directory with tar and any databases that your website uses.
Most users of Eclipse are familiar with its
code generation features. One of the more common of these is “Generate
hashCode() and equals()…” from the right-click -> Source (⌘-Opt-S)
menu. It roughly follows the recipe on page 33
of Joshua Bloch’s Effective Java, and it is effective in most situations.
One case where it doesn’t work is when the class is proxied.
Hibernate is just one example of a
framework that generates proxies. If the Person class below were
proxied, the default Eclipse implementation of
equals() would break.
In a Hibernate application, this can lead to anything from unnecessary
deletes and inserts to some very frustrating bugs.