Archive for August 2007

Google Notebook + Gears

August 25, 2007

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

August 24, 2007

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.