Monthly Archives: December 2007

OSX RDP Client

I’ve been using the Microsoft RDP client for OSX for a couple of years now.  It is functional, and allows you to easily connect to windows servers, and perform administration tasks on them.  It does have a couple of limitations, the most crushing of which is the lack of an easy way to have two sessions connected at the same time.  As I’m currently working on splitting out a database from an application server, and will be doing heavy development administration of both boxes, this limitation is a killer, so I’ve just done a google to find out my options.

Via the Blogosphere I found coRD (a Cocoa Remote Desktop tool). 

 It is great.  Not only does it solve the problem of being able to connect to two servers at the same time, but it does it in a nice apple look and feel.  Going to my remote desktops doesn’t make me shudder anymore.

The ability to keep all the servers in a single window, and then navigate through them is particularly useful.  I also like the server drawer option.  I’m not a big fan of using a full screen mode to a remote server, but it is available for those who do.  

The only feature from the Microsoft RDP client that I miss is the automatic sharing of my drive.  It made for an easy way to transfer files between the servers.  I can still easily do this through the filesharing options available on the Mac, and I think I actually kinda prefer the more obvious sharing that is done that way.

Overall coRD is a great product, and I would recommend it for Mac users who have windows servers they need to work with.

Howto Keep Version History in a Single Table Using Hibernate

 

Problem:

Keeping a history of data in a single table in hibernate, where all versions are treated as first class objects.

That is to say that every record in the database will be immutable. New records will be created with a new version number, but the old versions will never change. They are kept as the history of changes.

Solution:

When querying objects from hibernate ensure that they are initialised, and then detach them from the session:

Hibernate.initialize(result);
session.evict(result);

Then when saving the objects, ensure that the ID is null, and call thesession.save(businessObject) to save them.

//set the id to null to ensure that a new record is stored in the database.
businessObject.setId(null);
incrementVersion(businessObject);
session.save(businessObject);

The final part of the puzzle is to ensure that the class has it’s persistence properties set correctly, either by setting the annotations or configuring the xml file.

The important settings are:

  1. To help prevent updates, and improve performance set the mutable attribute on the class to false.
  2. The collection objects on the class have the lazy attribute set to false (ensuring that they are loaded when the object is retrieved, and the evicted object will work).

Following these steps will provide you with a versioned business object. It will be possible to retrive, and store the object to the database using the Hibernate search functionality.

Forcing the Choice of A Mail Account

I recently posted asking the question of how to force the choice of which account to send e-mail from using Mail.app (Forcing the Choice of A Mail Account). As silence responded to this cry for help, I ended up trying to produce a workaround (credits to AJ for not letting me whinge about this to much and for suggesting I head in this direction). Here is what I ended up with.

Step 1: create a new account in the settings with the name “CHOOSE AN ACCOUNT”. Set the server to localhost, with a simple username and password, which are required. Do this through the preferences screen (CMD-,)

Mail.App Accounts

Step 2: change the composing options to always send mail from the account just created.

Mail.app Composing Preferences

The combination of these two settings will ensure that you are always forced to choose an account when sending a new e-mail message. This already has been a useful opion, stopping me from accidently using the wrong account (which I must admit I did a couple of times beforehand). When you forget you will see the below popup. The important thing to do with this is to choose the “Edit Message” option, and go and choose an account.

Mail.App Cannot Send Dialog

This will produce a working solution, and I've been happy with it, having successfully avoided sending an e-mail from the wrong one of my 4 actively used e-mail accounts.