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

Another cool feature of the vi and vim editors is that you can easily re-use some search and replace commands across files. For example, I was just editing several HTML files and needed to do the exact same thing to each file: find a certain line, and then delete that line and the line right after it. Fortunately this is very easy to do in vi.

To edit multiple files in vi I first issue this command from the Linux command prompt:

One of the nice things about the vim editor is the ability to easily fire off one command that changes patterns throughout your entire file. For instance, as I was working on editing my Function Point Analysis tutorial the following HTML string pattern kept re-appearing throughout the entire document, and needed to be replaced:

I'm taking the day off and driving up to Denali (yep, I'm in Alaska), but I wrote a quick blog showing an example of the Unix/POSIX sort command after discovering the syntax was different than what I expected it to be. (For other Alaskan adventures you can also visit me here.)

Wow, the Linux sort command changed while I was away. A sort command that I used to write like this (as well as I can remember):

grep 'foo bar' *.html | sort -d: -f2 -n

is now written like this:

Yikes, I fixed a lot of the formatting of my "Introduction to Function Point Analysis" tutorial. I didn't realize how terrible the formatting was before. I still need to style it up a bit more and create a print style sheet, but at least you can read it now. Ugh, that was bad.

This page is sponsored by Free Function Point Analysis Software

Later that same day ... most of the UL and OL tag problems around here are fixed. I also kicked out this post: One Tufte-inspired graph for software development projects.

I should have the problem with UL and OL tags fixed late Monday; sorry for the poor presentation in the blog posts ATM. Also, I'll have a "contact me" form set up here very soon as well. (There's lots of work to do after being away from this site for so long.)

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:


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.