Thursday, August 19, 2010

Excellent Grails Posts

Just wanted to quickly point out this excellent series of posts by Peter Ledbrook detailing some of the gotchas when working with Grails & GORM. Veteran or neophyte this is a good read for any Grails developer.

http://blog.springsource.com/2010/06/23/gorm-gotchas-part-1/

http://blog.springsource.com/2010/07/02/gorm-gotchas-part-2/

http://blog.springsource.com/2010/07/28/gorm-gotchas-part-3/

Tuesday, June 01, 2010

Clonezilla & Windows

I was trying to restore a Windows Clonezilla image today and encountered a weird error. Windows would boot, but it would not start. Instead the following error would be shown.

autochk program not found

Fortunately I was able to boot into Ubuntu and mount the partition, so I could verify that my data was safe.

After searching on Google, I found some information on using a DOS tool to modify the partition to type 7 (link).

Not having access to a DOS boot disk, I decided to see if I could do the same think in Linux which turned out to be quite simple.

STANDARD DISCLAIMER

I'M NOT RESPONSIBLE IF YOU DESTROY YOUR DATA

PLEASE BE VERY CAREFUL WHEN USING FDISK!!! DO NOT ATTEMPT THIS UNLESS YOU KNOW WHAT YOU ARE DOING AND THEN THINK TWICE!!

Should you still want to proceed, here's how you can do it.

First, boot into Linux. If you do not have a dual-boot system, simply use one of the many Linux boot CD's. Once up and running in Linux, as root, execute the following commands.

First, execute "fdisk -l" this will list your current drives and partitions. Find the drive which contains the problem partition. In my case this was /dev/sda, it could be "sdb", "hda", "hdb" or something else that follows that pattern.

Second, execute "fdisk /dev/sda". Substitute your disk name for "/dev/sda". This will launch fdisk.

Now fdisk will be running so the following command will be executed in the fdisk shell. First, execute "p" to print the partition table. In my case, the problem partition, "/dev/sda2" was incorrectly listed as a Linux partition.

To fix this problem, use the "t" option and set the partition type to 7 (which is the partition type for NTFS).

Now, execute "p" again, to make sure the type is correctly set to NTFS. If all looks good, execute "w" to write out the changes then quit fdisk.

Everything should be OK now, simply restart and you should be able to boot successfully into Windows.

Tuesday, April 06, 2010

Visual Tail in JavaFx

Having recently decided to try and learn something about JavaFX, I decided to port my Visual Tail application which was done using Griffon/Swing to run using JavaFX.

Overall the process was pretty smooth, but here were some of the parts that caused me a bit of grief.

Component Layout

Initially I had a hard time with laying out my components in JavaFX.

I was used to Swing based layouts so I was looking for a layout manager to take care of this for me. While there are some basic layout capabilities (HBox, VBox, etc..) in JavaFX there is nothing built into it that is quite like the Swing layout managers, in particular MigLayout.

NOTE** There is capability to use MigLayout in JavaFX, but it is through an add-on to JavaFX. Link.

After a bit of reading, I found that basic layouts are typically done by using binding, which worked great for my simple application.

Background Tasks

It also took a minute to figure out how to make something run as a background task. For reference I ended up extending the javafx.async.JavaTaskBase class which worked just fine.

Lack of Components

My only other sticking point was with the minimal set of of native JavaFX components. There are still some of the components that are missing like a drop down box and a multi-line text area.

For my application the problem was with the lack of a multi-line text area.

However this was not really a big deal and there is a simple solution. Just extended the javafx.ext.swing.SwingScrollableComponent and created a wrapper around a Swing JTextArea component. You can then use that in your JavaFx code.


Final Product

So after a bit of work, here is the final product.

Java WebStart: link
Java Applet: link


UPDATE - 4/7/2010

Thanks to my visitors for pointing out the problem with the JNLP files. I had forgot to change the "codebase" location. Should be fixed now.

Friday, April 10, 2009

Griffon Applications

Details

For those who don't know Griffon, is a new framework developed in the Groovy language for building Desktop applications. Griffon is a plug-in centric framework that comes with a central tool for building, developing, and packaging your applications.

Developing desktop applications with Griffon is very similar to developing web applications with Grails. The framework is based on the Model - View - Controller concept. In Griffon, the Model is a basic POGO, the view is composed with SwingBuilder, and the controller ties the Model and View together. The controller is automatically injected with the view and the model, so access to properties in either is very simple.

In addition to the capacities provided by the Griffon framework, standard Groovy and Java code can be included into the projects. Groovy code goes in the project's src folder and Java code can be included as JAR files in the lib folder. This allows you to use all of the third party and special home-grown libraries that you know and love.

Applications written in Griffon will run on any Java JVM greater than version 1.5+, but things run best when using Java 1.6+ specifically version 1.6 update 10 or greater.

Learning Griffon

Since normal development of GUI applications in Java is painful, I was very happy to see this new framework and eager to check it out. Here are my first impressions and a couple of simple applications that I developed with Griffon.

Impressions

  1. The Griffon project is very young, but is amazingly functional

  2. There is a limited amount of documentation on the Griffon site, but between the Java Swing documentation, Groovy SwingBuiler documentation, the Griffon mailing list and examples from the Griffon development teem I had no problems getting answers to my questions.

  3. Developing GUI applications is actually FUN and not PAINFUL.

  4. A Griffon application can be developed quite rapidly.

  5. Griffon work great with MigLayout and Glazed Lists, two staples of Swing development.


Sample Applications

You can launch the sample applications by clicking on the first link provided. That is a JNLP Web start file. The second link is an archive containing the source code for the application. Bot applications were developed with Griffon built from SVN revision 624.

  1. DNS Resolver - src - Performs DNS resolutions and reverse IP lookups

  2. Visual Tail - src - Monitors a text file (same as 'tail -f' on Linux)


Please feel free to post your comments, and make sure to check out Griffon!