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

Some time ago I created a brief blog entry that shows an HTML select/option block for displaying all the states in the United States in a dropdown list (combo box). After a few requests I'm now providing that same information here in a database table format.

When I create a web-based user interface I tend to be a fanatic about making sure that the first input field on a form gets input focus when the form is first displayed. It always drives me crazy when I go to a web form that requires text input, but the developer of the page hasn't taken the time to put the default focus in the first field of the form.

So ... after looking around at some HTML/JSF/Struts/JSP code I've written over the last few years, the following JSF example shows the most concise way I know of setting default input focus on an HTML form field:

vi/vim search and replace FAQ: How do I search and replace in vim?

A lot of people ask me how to perform a global search and replace operation in the vi (vim) editor. The vim editor is anything but intuitive, but for some reason I can remember this global search and replace syntax pretty easily.

vim FAQ: How do I perform a vim “search and delete” using a vim regular expression pattern (regex)?

Every once in a while when I’m using the vi editor (or vim) I find myself in a situation where I need to delete a bunch of lines in the file that match a particular pattern. In my younger days I used to get out of vi and then use sed or grep to get rid of those lines, but it turns out there’s a real easy way to do this in vi.

In previous blog posts I showed how I created a Java web service and client using Apache Axis2. In those examples I showed how to read from web service methods that return a single object, and also an array or list of objects. In this post I'll show several sample Ruby programs that also read from those same Java web services.

I just solved a problem with a Java web service client I've been working on. I've been trying to read a Java web service that was created with Apache Axis2, and it has methods that can return an array or List of User objects. I couldn't find any examples on the Axis2 web site that showed how to get an array or List from a web service client, but I finally find the solution by digging around a little.

In this post I'll provide some sample Java source code that shows what I did to solve this problem.

Web service FAQ: How can I test a web service from a browser?

I’ve been working with web services a lot this past week, specifically with Apache Axis2, and here are a few notes I've learned about hitting one of my web services from a browser.

Looking at the WSDL for a web service from a browser

To view the WSDL document for a web service I created named UserService, I just went to the following URL in my browser:

How do I show the free memory on a Linux system?

You can show free memory on a Linux system with the free command, like this:


That command returns results like this:

            total       used       free     shared    buffers     cached
Mem:       8145044    8097552      47492          0      74252    1189464
-/+ buffers/cache:    6833836    1311208
Swap:     12578884    6205424    6373460

If you prefer to see information in MB you can use the -m parameter, like this:

Wow, I was totally blown away earlier this week when I started listening to a book on CD titled "The Mystical Kabbalah". If you haven't heard of the Kabbalah before, it is the "mystical aspect of Judaism".

Summary: A Sample Cobertura Ant build script.

I still haven't gotten around to writing a Cobertura code-coverage tutorial, but in lieu of that, I thought I'd include an ant build script here that does a lot of powerful things, including a task that generates Cobertura code-coverage reports.

It has taken me a little while to get used to the new Java for loop (foreach loop) syntax, but I've gotten a lot better with it by trying to read my for loops aloud. For instance, I would read the Java for loop below as "For each Pizza in the list of pizzas":

Java directory FAQ: "How do I delete a directory tree in Java?"

Java delete directory - discussion

The delete method of the File class won't delete a directory tree, meaning that in the old days you had to write your own recursive method to do this.

Java directory FAQ: How do I walk a directory tree and do something with the files and directories I find?

I've done this recently by extending the DirectoryWalker class of the Jakarta Commons IO project.

I can never remember the command-line syntax to access a remote CVS repository via anayonymous CVS access, so just as a reminder to myself, here are the commands I used recently to access an OpenBSD CVS repository:

Here's a good quote from the book Rich Dad, Poor Dad regarding the differences in cash flow between people who have corporations and people who work for corporations:

The rich with corporations:

  • Earn money
  • Spend money
  • Pay taxes

People who work for corporations:

I got the following MySQL error ("1005 error") earlier today when trying to create a table with a foreign key relationship:

I started using a tool named Cobertura to generate code coverage reports lately, and I have to say that I've been very happy with the results. If you are a believer in test driven development, or TDD, the next step in the process is code coverage.

Continuous integration is a key to a quality build process for any multi-developer software development project. I can't say it much better than the way Martin Fowler describes it, so I'll just include a portion of his summary here:

Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily - leading to multiple integrations per day.

A friend of mine was at a search engine strategies conference last week, and sent me these employment numbers, which are really staggering:

  1. Skype has 200 employees
  2. YouTube has 60 employees
  3. Craigslist has 20 employees

(I think those numbers came from Nicholas Carr, but I'm not positive.)

I would have guessed at numbers much higher than those. Hopefully that makes everyone at YouTube a billionaire, or at least a millionaire.