Scanner Troubles

I got ahold of this text file that was the content of the ZF05 zine. My goal was to write a program to extract the good parts of the zine for me to read quickly. Of course I was writing my program in Java.

My process was to do some Test Driven Development. So before I wrote the complex algorithms to do smart filters, I decided to write some simple I/O operations first. To do this I employed the Scanner class in Java. That should be easy. You pass the Scanner constructor a File object. Then you keep calling nextLine() as long as there is a hasLine().

My first TDD exercise was to write a copy program. It should just take a file and duplicate its contents to a second file. That sounds easy. My first attempt compiled quickly. But when it ran, it only copied part of the file. I thought perhaps it was some type of buffer overflow. However no exceptions were through. The program ended gracefully. I put my debugger hat on. Then I determined how far the copy was getting in the source file. That when I discovered some strange characters in the source file. They seemed to be causing hasLine() to return FALSE prematurely. It is going to take some digging into the Scanner class to figure out why I was getting this false positive. For now I will just give you some lines around the place where hasLine() choked. See if you can see why it is failing:

-rw-r--r-- 1 thalakan thalakan 386 Jan 5 2006
rwxr-xr-x 2 thalakan thalakan 512 Jun 22 2006 かたかã�ls
$ cat
#!/usr/bin/perl -w

Java Virtual Machine

I just read this blurb that the Java Virtual Machine will support languages with dynamic languages. Huh? Is Sun saying that Java will have dynamic typing. If so, why don't they come out and say so instead of talking about the JVM?

The truth behind this strange statement is that the JVM is not the same as Java. The JVM is a program which executes byte code. Java is a programming language. Now it just so happens that Java gets translated down into bytecode, and the JVM runs that code. However the key is that other languages can be translated into bytecode as well.

I understand that a flavor of Lisp has a compiler which translates the source into bytecode. It currently runs fine in the default JVM from Sun. Who knows? Maybe Sun Microsystems is looking to release some other important programming language. For now I am concentrating on Java.

Larry Ellison Drops By

Have you heard the latest news? Larry Ellison, CEO of Oracle Corporation, dropped by to address the crowd at JavaOne this year. He assured Java developers that Oracle will support Java. There is just one problem with that. Can you trust Larry Ellison? I mean we are not talking about Larry Page here.

I do believe Oracle actually uses Java though. Originally you would code stored procedures in their proprietary PL/SQL programming language. However as the Internet and Java got hot, Oracle added the ability to code stored procs in Java. Nice touch. I still don't trust them.

Scott McNealy, chairman of the Sun Microsystems board of directors, concurred that Oracle has spent a lot of money on Java. In fact he stated that Oracle spends more money on Java than any other company. Perhaps they shall protect their investment. The hard part in buying all this is that the Oracle database is Oracle Corporation's true investment, not the Java programming language.

JavaOne Contest Dud

Sun Microsystems hosted a contest that turned out sour for me. You had to blog about JavaOne 2009 technical sessions. I did not attend JavaOne. This was not supposed to be a problem as they post the technical sessions online.

I opted to view the JavaOne technical sessions as PDF documents. Sun makes you sign up for their Sun Developer Network (SDN) to view the PDFs. This seemed like a hassle. But it was free so I decided to go through the motions. I created a new account. The directions told me to respond to an e-mail to confirm my address.

Here's the thing. I never received the e-mail. It is bad enough that I had to go through these hoops to access the technical content. But some glitch resulted in the process not working. Yeah I could try again. Why should I? This is going to take some time and might not even work again. My time is worth money. Now I don't want to blog about JavaOne technical info. Fail.