Alvin Alexander | Java, Scala, Unix, Perl, Mac OS X

Ever since I got my Mac I've been wondering how the "Open With..." menu item works. This is the menu item you see when you right-click a file icon.

My particular situation is that I like to use several different applications to edit HTML files, but none of them are named DivX, BuildApplet, QuickTime, Help Viewer, etc. So I want to get all of those choices out of my popup menu.

Mac application FAQ: How do I uninstall Mac OS X applications?

If you've come to the Mac from Microsoft Windows, you're probably used to having some sort of "application uninstall" process for removing a software application from your computer. On the Mac, things are a little different, but actually easier, once you see how it works.

As I mentioned in a previous blog entry (eXtreme GUI Testing, Part 1) I've been motivated to work on a project in my spare time, and I'd like to start leaking the details here.

For lack of a better name I'm currently calling this project eXtreme GUI Tester, or XGT for short. As its name implies, this is an application (actually a suite of applications) that hopes to make automated GUI testing a little more of a reality.

I wonder how many times perfect lessons are right in front of our face that we never see?

A 13-year-old kid throwing a changeup

For some reason this year I've woken up at least six times in the middle of the night dreaming about how to throw a changeup, or wishing that I had learned to throw a changeup when I was a pitcher in high school. I probably wasn't very good, but I wasn't too bad either, and if I didn't have arthritis at age 18 I might have pitched a little in college.

Since leaving corporate America in May of this year I found it interesting to look up one day and realize that I don't need Microsoft products for anything in my life. It turns out that there's not much intersection between (a) the life of a semi-retired person and (b) needs for spreadsheets, formatted text documents, and presentation software. And on the two occasions I did need to write letters to an insurance company Open Office on the Mac worked just fine, thank you.

A long time ago I created something I called a "Source code warehouse" that would help developers learn various programming languages by letting them easily find examples from open source programming projects from around the world. I initially did this for Java programs, and later expanded it to include source code files from other languages.

I was just looking at some financial information for Microsoft (MSFT), Google (GOOG), and Apple (AAPL), and thought the results were interesting:

Problem: You're working on a Java application, and you're repeatedly performing a test to determine whether a String (or many strings) are either blank or null.


Create a simple Java method to perform this test for you. The following Java method returns true if a String is blank or null, otherwise it returns false:


One of the nice things about Java is javadoc. The javadoc utility lets you put your comments right next to your code, inside your ".java" source files. When you're satisfied with your code and comments, you simply run the javadoc command, and your HTML-style documentation is automatically created for you.

The 4th of July delivers a new look and feel for this blog, as well as huge changes to the main Java page for the site.

I've been working mostly on Java/Swing/JFC projects for the last several years, so I haven't done a lot with CSS lately. But one thing I will say is that I've bent over for IE6 just as much as I care to right now. Maybe my CSS skills need a lot of work, but hey, I'm not doing any rocket science here. From what I've seen Swing on Java is just as portable as CSS on different platforms. That's my whine for the day.

Hey, I'm not a John Edwards fan myself, and I wouldn't know Ann Coulter if she was standing at my front door, but anyone that says something like this is sick:

"If I'm going to say anything about John Edwards in the future, I'll just wish he had been killed in a terrorist assassination plot."
Ann Coulter

Ms. Coulter, you need to get yourself some help.


Wow, for me, getting Apache server side includes (SSI's) to work on my Apple Mac OS X installation was nothing like what I read elsewhere. Oh, you do have to do the setup work as shown in this Apache SSI configuration document, but on Mac OS X the setup is a little different.

The key on the Mac was that instead of restarting Apache, I decided to stop and start Apache manually, like this:

sudo apachectl stop

followed by:

Hah, everything got so fast at the end I forgot to mention one minor detail here: I moved to Alaska.

On May 8th, 2007 I packed up everything that would fit in my RAV4 and left Louisville, Kentucky and drove to Alaska (yes, Alaska).

It's Sunday, the weekend after Apple's WWDC 2007 event, and as an Apple shareholder, I have to say that for the first time in a long time I'm concerned about the company.

Someone asked yesterday if you can use animated GIF images in Java applications using the JFC/Swing toolkit. That's something I hadn't tried with Java and Swing before, so I wrote a quick test program, and sure enough they work.

I just load an animated GIF as an ImageIcon, then put it on a JLabel and display it on a JFrame, and the animation starts right up. Note that I'm using a Java/JDK 1.4.x release.

Here's a "generic" version of a simple test plan I just wrote for testing one wizard in a GUI software application my team is currently developing. I wrote this for one specific wizard, then realized that many of these tests are generically-applicable to all wizards.

Without any further introduction, here is my sample test plan. Feel free to use it as a template for creating your own test plans.

I get the following error messages some times when running JRuby scripts:

For some reason I didn't work w/ the Mac much until last year. Actually, to be fair to myself, a lot of that probably had to do with unpleasant experiences with earlier versions of the Mac OS.

But as I was talking to a co-worker this morning I realized that it was a mistake not to spend some quality time with Mac OS X when it came out. Having worked with it for over a year now I've come to take many things for granted that it can do. The discussion this morning had to do with the power of scripting native Mac applications with AppleScript.

Here's a sample Ruby mail program that I created that finds and prints all of the unique email addresses in my IMAP inbox. Hopefully the source code is readable enough that it doesn't need much description. The only hard part is trying to figure out how to get the email address from the Envelope, and that's only because the documentation is hard to find.

Ruby mail program

Here's my Ruby IMAP mail program source code:

Here's a Ruby "read file" example program that shows how to read a file as one string. You just have to pass a file name in to the get_file_as_string method, and this Ruby method will read in all the records from the file, and return the contents of the file as a string.