Sunday, 26 October 2008

Marauder File Viewer

Download


I've been talking about rewriting the File Viewer application I developed at Communisis back in the early naughties for some time now. It took a while for me to find a solution for opening very large files (>20GB) that I liked and a virtual grid that would allow me to view them.

After being (almost) forced to learn Java I thought it might hold the key. It can certainly handle the large files easily enough and JTable is certainly virtual enough to view them. I got quite a long way down the Java route before I decided Swing didn't give me the most aesthetic of GUIs and layout managers were too much like hard work (I've since got to grips with layout managers and changed my mind about them to some extent).

I started looking around for a virtual grid for C#. I already knew that C# could handle the file sizes without any problem from the testing I'd done a few years back. It was pointed out to me that the DataGrid has a virtual mode and a little bit of playing about soon showed me that it was ideal for the task. Moving to C# would loose some of the platform independence I've always strived for, but the better looking GUI and the interest shown by some people who might actually use it in a C# version were overwhelming.

I ported my MVC design directly to C# from Java taking advantage of some of the better features in C#, such as properties and events and I now have a working prototype that allows the user to open and view fixed length record files using an xml layout to describe the fields:
<layout>
<field name="Id" length="20">
<field name="Number" length="20">
<field name="Add1" length="20">
<field name="Add2" length="20">
<field name="Add3" length="20">
<field name="Postcode" length="20">
<field name="CR" length="1">
</field>

This is the current limit of the features. There is no way of saving or reloading projects (a project consists of a layout and datafile), no search or reporting and no way of creating or modifying layouts. This is strictly a prototype to prove the concept.

Marauder File Viewer can be download here (You'll need .Net 2 if you don't already have it). After unzipping double click FileViewer.Exe to run file viewer. To test it:
  1. Go to the Help menu and select Create Test Files to create a set of three test files and a layout file in the same location as the exe.
  2. Go to the File menu and select New Project.
  3. Double click the Fixed Length icon from the New Project dialog.
  4. Click the first browse button and navigate to test1.txt to set the file.
  5. Click the second browse button and navigate to lay.xml to set the layout.
  6. Click create to load the file and layout.
  7. Repeat steps 2 to 6 for test2.txt and test3.txt.

Marauder File Viewer

You can now use the tabs to switch between the test files and the vertical scroll bars to scroll through their content. The Marauder File Viewer will work with any fixed length record text file and any xml layout that uses the format shown above.

The next steps in development will be:
  1. Support for RDF layouts
  2. Allow the saving and opening of projects.
  3. Searching
  4. Fixed length record file layout creator and modifier
  5. Further development plugin facility to allow other file types to be viewed

Thursday, 23 October 2008

Byfords

We're made it to one year! It's been interesting a long the way, but we're here and happy!

Charlotte and I celebrated our first wedding anniversary this week. As a surprise I booked us into Byfords Posh B&B. Their rooms are very nicely done out, they have a full wet-room bathroom and the food and service are excellent. I'd recommend Byfords to anyone....

Sunday, 19 October 2008

Boiler Plating Database Resource Cleanup

I've been using Java for nearly twelve months now and I am finding that I like it. There are only two things that I have discovered so far that make make me wonder what the creators of Java were thinking: exception handling and layout managers. I'll cover layout managers in a later article.

Java is a garbage collected language. Which means that, most of the time, you don't have to worry how the memory previously used by dead objects is cleaned up. To me garbage collection has always felt a bit like a knee jerk reaction for people who can't use smart pointers properly in C++ and C programmers who must pay very close attention to the points at which they release memory allocated to the heap. If garbage collection is meant to help you clean up memory, why hasn't something been developed to help objects release resources? Java has finalizers, but as Joshua Bloch points out in Effective Java finalizers cannot be relied upon. Proper cleanup of resources is left to the developer whose only real friend is finally.

In this article I'll look briefly at the vast amount of exception handling code that must be written to cleanly close result set, statement and connection objects when accessing a database and then more in depth at one possible method of boiler plating it.

Read more.

Togo's Revenge

We went again yesterday. The manageress was in her usual rude state and refused point blank to give Charlotte a glass of tap water, stating that she'd have to get bottled water and they couldn't give her tap water as they didn't have a tap, despite us spending over £10. Charlotte argued that it's illegal not to give tap water on request and eventually a glass of water did appear. This upset one of their staff so much that she (not the manageress) came up and apologised to us later on, despite the fact it was absolutely no fault of her own.

I think this may well be the last nail in the coffin now.

ACCU Conference 2009 Proposal (3)

Title: Boiler Plating Database Resource Cleanup

Type: Case study

Duration: 45 min

Speaker: Paul Grenyer

Speaker biography: Paul has been programming in one form or another for over 20 years. After several years using C++ and a brief period using C#, Paul has now ended up somewhere he hoped he'd never be, programming in Java, and finding he really quite likes it. After time in industries such as marking machinery, direct mail, mobile phones, investment banking and Internet TV, Paul is currently working for an exciting new insurance industry based startup in Norwich. He has been an ACCU member since 2001, a regular publications contributor (including the new Desert Island Books column), creator of the mentored developers and a committee member for most of that time. When he's not programming or getting used to married life and being a step parent, Paul thoroughly enjoys science fiction, heavy metal and cycling.


I've been using Java for nearly twelve months now and I am finding that I like it. There are only two things that I have discovered so far that make make me wonder what the creators of Java were thinking: exception handling and layout managers. I'll cover layout managers in a later article.

Java is a garbage collected language. If garbage collection is meant to help you clean up memory, why hasn't something been developed to help objects release resources? Java has finalizers, but as Joshua Bloch points out in Effective Java finalizers cannot be relied upon. Proper cleanup of resources is left to the developer whose only real friend is finally.

In languages like C# the IDisposable interface can be used to aid cleanup. The IDisposable interface has a single method called Dispose. All of an object's cleanup code should be placed in this method and calling the method manually or via using ensures resources are released. The draw back is that even IDisposable requires the client code to to use it. There is nothing like this available in Java, but I have an even better solution which takes away the dependence on a classes user to do any cleaup.

In this presentation I'll look briefly at the vast amount of exception handling code that must be written to cleanly close result set, statement and connection objects when accessing a database and then more in depth at one possible method of boiler plating it.

Saturday, 18 October 2008

How to Loose friends and Alienate People

I quite like Simon Pegg. I have some fond memories of watching Spaced with a friend of mine in the early hours of the morning following a night out at a club. I've never really been a fanatic though. I haven't watch Shawn of the Dead all the way through yet and I only watched Hot Fuzz recently.

It could probably be argued that I don't have a lot to learn from How to Loose Friends and Alienate People, but Charlotte was keen to go and we both enjoyed it. It was dire in places, but for the most part it was very good. The film exposes the vast cultural difference between the US and the UK in a very funny way and Kirsten Dunst always captures my heart in that classic girl next door way (my wife always says that I married the girl next door, even though it was more like the girl one hundred yards up the road, turn left and then fifty yards on the right). With a soppy ending seeing Pegg get the girl he really wants and the dry humour there's something for everyone, even a sci-fi reference or two.

Friday, 10 October 2008

The Paradox of Togo's (Norwich)

Since we met, my wife and I have been having lunch at Togo's on the rare occasions that we're in the city at lunch time. I really don't know why we keep going back there. Although the food is very good, especially the cheese cake, the prices are unreasonably high, the service is poor, the couple running the White Lion Street branch are obnoxious and the sign dictating the rules for the upper seating area, including no picnicking, respect and no unaccompanied minors, is less than inviting if not arrogant, rude and hostile. It makes me wonder if they've twigged that they're there for the benefit of the customers, rather than the other way around. Maybe that's why it's rarely full and there''s always a spare table.

I imagine we'll keep going.