Friday, 29 May 2009

Trinidad and text wrapping

While using Trinidad 1.0.1 I came across a problem where text did not wrap when displaying read only text fields. This meant that everything was pushed off the right hand side of the page. I had to change the fields from:
<tr:inputText label="#{msgs['message1']}" styleClass="labelRight"
id="mybean" columns="10"
<tr:panelLabelAndMessage label="#{msgs['message1']}">
<tr:outputText value="#{mybean.value}" /> </tr:panelLabelAndMessage>
and added the following to my style sheet:
.af_panelFormLayout_content-cell {
white-space: normal;
Note outputText instead of inputText. It was tricky to get it working in FF and IE at the same time.

Sunday, 17 May 2009

Virtual machines with VirtualBox

I've found VirtualBox to be very easy to create virtual machines - it's free, open source, and available on Windows, Linux, Macintosh and OpenSolaris. One of the features I particularly like is being able to create a virtual disk that grows as needed (dynamically expanding image). You can also mount an iso image for the CD/DVD drive - which is exactly what I want to do when installing the operating system on my new virtual machine.

Installing on Ubuntu is as easy as:

sudo apt-get install virtualbox

Now, from the Applications/Accessories/VirtualBox OSE menu item, you can start VirtualBox and create virtual machines.

Several things I need to remember after I've created a new machine:

  1. Under "Settings/General/Advanced" select "Enable PAE/NX" to avoid the "This kernel requires the following features not present on the CPU: 0:6 Unable to boot - please use a kernel appropriate for your CPU."

  2. Under "Settings/Network/Adapter 1" select "Attached to: Host Interface" to get networking going - this get me network access as I would expect

Wednesday, 13 May 2009

Finding constraints in Oracle

It can be quite frustrating when you get exceptions like those below - constraint violations where the constraint has a system generated name which means nothing to you:

2009-03-23 23:30:43 ERROR [AbstractFlushingEventListener.performExecutions] Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
Caused by: java.sql.BatchUpdateException: ORA-00001: unique constraint (SAMPLE.SYS_C00123456) violated

The easiest way to find out which table this constraint is associated with is to issue a statement as shown:
select constraint_name, table_name from user_constraints where constraint_name='SYS_C00123456';

Now you know the table involved, you can easily find out the exact nature of the constraint in various ways - my tool of choice is SqlDeveloper - a GUI interface to Oracle (and other) database.

Tuesday, 5 May 2009

Just for a bit of fun...

Recently I jumped on the Twitter bandwagon and created - a simple service that lets you compare the number of followers for 2 Twitter users.

This weekend I added a game feature to it - the player is presented with 2 random twitter users (from the top 50) and is challenged to guess which user has the most followers. It makes you think, and the results can surprise you!

Why build such a thing? Well, just for a bit of fun really. But it was also a good excuse to familiarise myself with:

  1. jquery

  2. jquery plugins (jquery.template)

  3. blueprint css framework

Another added benefit was with having such a simple application was that the whole exercise fitted into a very short timebox. The exposure to these frameworks made it worthwhile doing, and it reminded me how painful IE can be.

If you're interested, play the game and tweet your score!