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

For a while on the Mac I kept finding myself always clicking on the URL/location field in Firefox and Safari. Then one day I noticed this, and wondered why I was doing that instead of using the keyboard command/shortcut to highlight the field and then typing. That answer was easy -- I didn't know what the keyboard command was. It's not the same as it was on Windows.

Turns out it's very simple: [command][L] does the trick.

A friend asked the other day if there is any easy way to list all the sub-directories of the current directory on a Unix, Linux, or Mac OS X system. The answer is yes, all you have to do is this:

I created a JSP this morning that prints out the equivalent of most traditional CGI parameters. Sometimes I use these to debug a problem, other times I use them within JSP/servlet code for other non-debug purposes.

Here's the Java source code for my JSP CGI page, which I named cgiParams.jsp. As you can see, most of these variables come from the JSP request object:

Yesterday's post ("Microsoft-free") reflects a huge change from when I started using Microsoft products in 1987. Just out of college, I worked for a company named Atlantic Research Corporation in Virginia, and once I learned FORTRAN my personal mission was to port our in-house applications off the DEC VAX machines and onto 286 and 386 PCs.

Okay, I think I finally have some of the Mac default application file-open stuff figured out. I think the properly-phrased question that led me to this answer is: How do I configure my Mac OS X to automatically open a file (with a given filename extension) with a default application of my choosing?

In this short tutorial I'll show you how to configure your Mac to open files with the programs you want them to be opened with.

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.

Solution

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:

Introduction

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.