TurboManage

David Chandler's Journal of Java Web and Mobile Development

  • David M. Chandler


    Web app developer since 1994 and Google Cloud Platform Instructor now residing in Colorado. Besides tech, I enjoy landscape photography and share my work at ColoradoPhoto.gallery.

  • Subscribe

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 223 other followers

  • Sleepless Nights…

    November 2009
    S M T W T F S
    1234567
    891011121314
    15161718192021
    22232425262728
    2930  
  • Blog Stats

    • 1,029,242 hits

Archive for November, 2009

A visual designer for GWT

Posted by David Chandler on November 17, 2009

Perhaps GWT’s greatest weakness is the difficulty of creating beautiful page layouts in code. Graphic designers simply don’t think in Java, and very few people who think in Java also have a penchant for design. GWT’s support for CSS is somewhat of a middle ground, but it’s still nothing like designing a JSP page in, say, Dreamweaver.

Unless, of course, you design a JSP page in Dreamweaver! Jerald Sebastian suggests that you can simply ID all your HTML tags, then attach to them in GWT using RootPanel.get(id). This seems very promising, but I have to work out yet how to make it work with gwt-presenter as far as navigation is concerned.

Alternatively, I’ve seen quite a few Google ads for GWT Designer, but haven’t yet taken the plunge.

Posted in Google Web Toolkit | 3 Comments »

Simple Windows backup strategy

Posted by David Chandler on November 14, 2009

“The Saturday evening post”

Most external hard drives come with some kind of backup software, and of course there’s the Windows Backup and Restore Center. My complaint about these solutions is that they try to make it too simple, and thereby end up backing up far more than is really needed, which costs time and disk space. I’ve organized all my documents, photos, etc., under a single directory tree so that I can easily back it up, and all I really need is a tool that will copy any new/modified files to my external hard drive once a day.

That’s where Karen’s Replicator comes in. It’s a breeze to install and configure. Just create a job for each directory hierarchy you want to back up, specify the source and destination directories, and let ‘er rip. Karen’s Replicator has a built-in job scheduler, so just check the box on the Settings page to always run it when you log in, and your backups will run as scheduled. Best of all, it’s freeware, though I’m sure Karen wouldn’t mind a donation.

Posted in PC Tech | 3 Comments »

Correction: AppEngine Datastore and owned relationships

Posted by David Chandler on November 12, 2009

Last week, I mistakenly wrote that AppEngine Datastore would not retrieve Key fields (representing an unowned relationship) unless you annotated with defaultFetchGroup=”true”, but that it would automatically retrieve properties represented by an owned relationship. This was not correct, as AppEngine Datastore never allows joins. I’ve updated the original post accordingly.

 

Posted in AppEngine, Java Data Objects | Leave a Comment »

AppEngine JDO tip regarding detachCopy()

Posted by David Chandler on November 11, 2009

In order to avoid JDO and/or serialization exceptions, I always call some form of persistenceManager.detachCopy() before returning objects from the Datastore back to GWT. I discovered today that you must set any non-persistent properties of the object after calling detachCopy(). My initial inclination is that detachCopy() does not copy properties annotated with @NotPersistent, but I have to do a little more testing…

Posted in AppEngine, Google Web Toolkit | Leave a Comment »

How to backup or move Picasa albums

Posted by David Chandler on November 7, 2009

Update Aug 13, 2012: as of Picasa 3.9, it is no longer necessary to backup Picasa albums separately using the technique discussed here. They are stored in the same folders as your photos, so you can simply copy all your photo folders to a new machine and you’re all set.

I’ve been very happily managing my photos with Picasa since version 2. Many machines ago, I began storing photos along with all my other portable data in a directory separate from the normal Windows user folder to make it easy to back up and move files between machines with an external hard drive. So far so good.

The problem is how to back up and/or move Picasa albums to a new machine, as these are not stored with your photo files like Picasa edits and captions are. Picasa 3 now offers a way to export the entire photo database; however, it is very slow and results in a very large file (multi-GB) when you have 10 years’ worth of digital photos. It’s not practical to export the entire database to make a weekly backup, so I was delighted to find this technique on a forum which allows you to move just your album data:

Restore Picasa albums

I’ve done it many times and it works. This way, you can continue to use an incremental backup solution for photo files and backup the tiny amount of data in C:\Users\username\AppData\Local\Google\Picasa2Albums\ to save your albums. The only catch is that when you rebuild the Picasa database as instructed in the link above, the photos referenced in the album must be in the same directory location as they were when the album was created.

In order to ensure that my photos stay in the same directory structure even when Microsoft changes the location of the Users folder between, say, XP and Vista, I keep all my photos in a directory outside the Windows user directory (I use C:\@My\Photos). When I get a new machine, all I have to do is:

  1. Copy the whole C:\@My directory to the new machine
  2. Install Picasa
  3. Copy the Picasa2Albums directory into place under the Users folder (C:\Users\David\AppData\Local\Google\Picasa2Albums\ in Vista)
  4. Rebuild the Picasa database as instructed above using the Shift+Ctrl+Alt combination.

Of course, this technique may not be supported forever, and hopefully won’t be needed as Google continues to improve Picasa. But for now, it allows me to backup my albums on a regular basis and know that I’ll be able to move my photos, albums and all, to a new machine when needed.

Posted in PC Tech, Photography | 6 Comments »

Key fields are not retrieved by default

Posted by David Chandler on November 6, 2009

I’ve noticed that AppEngine does not populate Key fields by default when querying. I’m sure it’s documented, but I can’t remember where. At any rate, you can annotate with defaultFetchGroup to resolve this. Same goes for properties of type Text and Blob.

...
import com.google.appengine.api.datastore.Key;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class PrayerItem implements Serializable
{
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Long id;
	@Persistent(defaultFetchGroup="true")
	private Key list;
	...

}

In the case of owned relationships, where a property is represented by its actual domain class rather than a Key, it is also necessary to use defaultFetchGroup=”true”. Even though owned properties are in the same entity group and are therefore eligible for inclusion in a transaction, the AppEngine Datastore doesn’t allow joins, so owned relationships are not returned in the initial query. When you set defaultFetchGroup=”true” on an owned property, you will get this warning:

WARNING: Meta-data warning for com…your_owned_property_name: The datastore does not support joins and therefore cannot honor requests to place child objects in the default fetch group.  The field will be fetched lazily on first access.  You can modify this warning by setting the datanucleus.appengine.ignorableMetaDataBehavior property in your config.  A value of NONE will silence the warning.  A value of ERROR will turn the warning into an exception.

Lazy fetching does work as described in the message.

Posted in AppEngine, Java Data Objects | 9 Comments »

Eclipse keyboard shortcut for working with interfaces

Posted by David Chandler on November 3, 2009

Maybe everyone knows this already, but in case not…

Put your cursor in the name of an interface (say, a Display interface nested in a GWT presenter) and press Ctrl-T. Eclipse shows you all the classes that implement the interface and you can then navigate directly to an implementing class. I frequently use this in combination with Ctrl+Alt+H to find out how a method gets called.

You can find all of my favorite keyboard shortcuts in my Eclipse Google notebook listed in the left sidebar.

Posted in Eclipse | 1 Comment »

 
%d bloggers like this: