Google Notebook + Gears

Posted August 25, 2007 by
Categories: Google, Mac

Since moving mostly to a Mac for software development, one piece of software on Windows that I have been unable to find a replacement for is Microsoft OneNote. I use OneNote as a repository for notes and coding snippets that I find useful, want to try out, or just simply want to remember for some rainy day. Its beauty is in its simplicity as a quick note taking tool. I can paste something in it when I am in a hurry and then return and file it later when I have time. Certainly there are similar tools on the Mac but I simply haven’t broken my links with OneNote yet.

I had not paid much attention to Google Notebook until a few days ago. The Firefox browser plugin is brilliant. Now all the tool needs to be a complete replacement is offline support through Gears. I’m sure this will be soon. When the offline support is added, it becomes more than a replacement for OneNote for me. It becomes a useful note repository that isn’t tied to a single machine.  After the offline support a desktop client and a mobile client would certainly follow.

fun with FileReader

Posted August 24, 2007 by
Categories: Java

This morning I was innocently writing a simple program to read from a file using FileReader. I had setup the typical loop to read until the end of file was reached.

Reader r = new FileReader("myfile");
int i = -1;
while ((i = r.read()) != -1) {...}

So then I went about testing my program and discovered my loop was infinite. It turns out that read() won’t return a -1 if some other process has the file opened, or at least in this case I had the file open in Oracle SQLDeveloper. This is probably old hat to many but ouch. I suppose the better way to write such a simple test to inspect whether or not the file is already open? The puzzling part though is why the file pointer gets reset when the read reaches the end of the file. BufferedReader behaves the same.

a simple medical records application

Posted July 27, 2007 by
Categories: Healthcare, Java

I have dusted off an application I wrote while part of a startup company about 5-6 years ago. The application is medical records application that provides a GUI for management and storage of a patient’s information. It also provides for synchronizing this information with a smart card. The GUI is written in Java Swing and the backend logic is also Java. Since the application was conceived of in 2001 it uses EJB. Fortunately I did design the architecture of the GUI so that it deals through a plain Java model and doesn’t have any direct knowledge of the backend implementation.

So in my nearly non-existent freetime I am in the process of overhauling the application to modernize it.

My first step was to Mavenize. This was not particularly difficult since the Swing application is essentially just a plain Java application with a main method. I plan however to completely gut the backend and build service oriented classes to replace the session beans from yesteryear. This task however is a bit down the road and perhaps there will be future blog entries reflecting on my options here. Anyhow the simple project archetype was all I needed here for my jumping off point.

I’ve also decided to gut the plumbing for the smart card interaction. Back in 2001 we used OpenCard as our facility to abstract communication with the smart card. I have no idea what the technology choices are today but I did visit www.opencard.org and the website appears untouched. So for now the application will simply be a fancy database reader and not interact with data from the smart card.

Here is a list of todo’s to modernize:

  • introduce Spring for configuration and ioc.
  • include log4j
  •  figure out a backend strategy and architecture to replace EJB
  • determine an app server to develop with Tomcat or Glassfish

In the end I’m not sure what to do with the application. If I can get the smart card link successfully re-established it could provide some kind of value but as just a database viewer it is basically a fancy sample application. We’ll see.

dabbling in the dark arts

Posted June 21, 2007 by
Categories: Java, Oracle

Ever tried to get deep into performance tuning with Hibernate? It is not a well traveled path I am finding. In general, I think Hibernate has excellent documentation but recently I’ve been doing some work in performance tuning a highly transactional application and I’ve been struggling to find useful resources. Here are some areas I’ve found difficult to find documentation.

  • turn on logging for the Oracle thin JDBC driver. Much of Oracle’s documentation is outdated and it refers to deprecated methods on the driver.
  • ehcache is a bit difficult to obtain statistics from if you ask me. I haven’t been successful in getting ehcache installed into JConsole yet although the documentation makes it appear simple enough.
  • Hibernate also generates statistics and this is helpful but getting cache statistics on the second level cache can prove problematic

Anyhow, I’ll have future blog entries when the above issues I am having are resolved. Where are Professors Lupin or Snape when I need them?

my Mac and PC laptops

Posted June 12, 2007 by
Categories: Java

I have two laptops. I have an HP nc8230 and a MacBook Pro core duo. Both machines have 2 GB of RAM and perform pretty much the same. The obvious difference, of course, is that one runs Mac and one runs Windows. No surprise. The PC laptop has one small glitch that really bugs me and stands as a testament to why I’d prefer to use the Mac, given the choice: the volume controls.

For some reason the volume buttons on the PC laptop just stop working over time in a Windows session. Who knows why but after a period of time they no longer function. This seems par for the course in Windows. Things stop working now and then.

This isn’t to be expected on a Mac. I can’t think of the last time I was truly let down by hardware not working on my Mac due to some sort of software problem.

thoughts on Flash Remoting

Posted June 7, 2007 by
Categories: Java

I have been doing some work building a backend to support a Flash client. The backend provides a set of services for the UI front end like registration, login validation, and generally just persisting state to the database.

Early on we made an attempt to write the communication between the front end and the backend with a web service using Apache Axis. We were halted with many strange errors and then came across this (obscure IMO) technote from Adobe. After this discovering we switched to using Flash Remoting for communcation to the server.

Here are some things that were learned.

  • Remoting puts some burden on the Flash developer to syntactically mimic the complete Java class structure that is being returned. This can be tedious although there are some open source tools for writing out ActionScript based on consuming Java classes.
  • Passing back Hibernate-style POJOs that contain back references can be problematic. The Adobe Remoting servlet can run into stack overflow as it tries to serialize/deserialze circular references.
  • Remoting is fast, faster than web services. I have no data to support this but Adobe may have some someplace.
  • Remoting is easy to debug at least on the Java side. The servlet provides incredibly verbose logging so it is straightforward to look at what is being passed to/from the client.

In general, one big design decision should involve decoupling objects passed back to the client versus objects used to represent database persistence. Maybe this is obvious but I can tell  you it is easy to get sucked into returning objects that are paired with the data model.

Upgrading to Ubuntu 7.04 (Feisty Fawn)

Posted April 26, 2007 by
Categories: Linux/UNIX, ubuntu

So I connected to my Ubuntu box from my Mac using XDMCP like usual and decided to attempt the upgrade using Software Updates. The install took probably 3-4 hours while I did other work. Well everything went fine until I tried using the keyboard. The upgrade managed to remap my keybaord to something completely unusable at least in GNOME. This may be difficult to work out since I cannot even type in my password when prompted for permission to change system settings.

Photokit Sharpener

Posted April 17, 2007 by
Categories: Digital Photography, Lightroom, Photoshop

I have been using Adobe Lightroom for less than a month now. I think of Lightroom as a hugely improved interface on top of Adobe Camera Raw and currently LR’s biggest drawback for me is its inability to merge databases. I’m sure this will change.

Meanwhile, I’ve picked up Photokit Sharpener. I wish I had been using this tool all along instead of struggling with Smart Sharpen. The tutorial for Photokit Sharpener is excellent and my results after processing maybe about 30 or so photos has been very satisfying. I could never have gotten close to these results with my basic at best knowledge of how to wield Smart Sharpen in Photoshop.

.Mac needs a facelift

Posted January 25, 2007 by
Categories: Mac, photography

I really like .Mac

I’ve tried several photo gallery sites and I like the flexibility of .Mac and the fact that it integrates into iLife. That much is great but the service is severly behind competitors like Flickr and PBase.

One thing that is needed is a more robust photo gallery. Sure I can export my photos from iPhoto. This is a great start but where are all the features after that? There’s no EXIF display. Why not? There’s no tagging mechanism, no comments, no contacts list, etc. There needs to be more for the price of the service.

One more thing: I think the calendar mechanism is very hidden and obscure. Why is this? Why isn’t calendar a top level menu item once I login?

.Mac team please tell me you are modernizing the service or better yet coming up with something more innovative.

Why can’t we have Java = Swing = Flash?

Posted January 23, 2007 by
Categories: Java

I realize this is a gross over-simplification, but I’m growing weary of dealing with Flash in the browser. Why can’t we have a  rich media browser standard that is Java-based? Pretty please? If we had this then we could do server-side remoting with ease from a Web browser. What I am doing now involves pain with web services. and no I don’t care to use Flex.

Sun, why aren’t you working on this? Maybe Java is too heavy for the browser, then what about Groovy? Could that be object-compatible with Java?