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

Java HTTPS client FAQ: Can you share some source code for a Java HTTPS client application?

Sure, here's the source code for an example Java HTTPS client program I just used to download the contents of an HTTPS (SSL) URL. I actually found some of this in a newsgroup a while ago, but I can't find the source today to give them credit, so my apologies for that.

Here is a Ruby mail program that I use to search my IMAP mailbox with combinations of search criteria. It is a mixture of several different Ruby-based approaches I found on the Internet for searching email systems.

Note that you don't need all the comments at the front as I've shown. It's just that I can't remember all the crazy flags that can be used, and at this time I'm not going to take the time to write a better mail system interface, although IMHO a better interface is surely needed.

I don't work in the DOS (Windows command (CMD.EXE)) world too much these days, but I needed to today. The basic problem was that I needed to build an environment variable dynamically. In this case I was trying to build a variable named CLASSPATH from a collection of Java JAR files in a sibling directory named LIB. This variable had to be built correctly for my Java application to work properly.

SVN directory FAQ: How do I move a directory with subversion (svn)?

svn directory move example

Moving a directory (or file) with Subversion (SVN) is very easy, you just need to use the "svn move" command. Let's try a simple example.

Suppose you have a directory named foo, and you want to rename it to bar. The svn move command to issue is:

CVS login FAQ: How do I login to a CVS server using SSH?

cvs login - a Windows example

Here's how I do a "cvs login" to our CVS server using SSH, on a Windows PC:

cvs login

Note that the only real different thing here is that you specify the ssh protocol for communicating with the server.

MySQL database FAQ: Can you share an example MySQL database schema (i.e., a MySQL database create script).

For what I do I often need a sample database. For my current writing I decided to use the "coffeebreak" database defined in Sun's JDBC tutorial. If it saves you any time in your work, here are the commands. I've only tested these with MySQL, but they should work with most other databases.

Before worrying about the schema, here are three steps that you'll want to do first:

MySQL login FAQ: How do I log into a MySQL database?

Assuming you have the root password, this MySQL command from your Unix/Linux command line will work:

mysql -u root -p

After issuing that MySQL login command you will be prompted for the root user password. Just enter that root password, and you should be in. After you login, your console should look like this (using MySQL version 5):

After you've made a few changes in your local SVN sandbox it can be helpful to check the SVN status to see what you've changed, or at least see what SVN thinks you've changed. To do this, just issue the svn status command to see the changes, like this:

svn status

In my case this "svn status" command returned the following information:

A      build.alspc
A      antAlsPC.bat
M      build.xml


Here's a quick example of an svn commit command in what I think is a very typical scenario. Assuming that I just made a few changes to some files in a directory, to commit those changes back to the repository, I just issue an "svn commit" command like this, incuding a nice svn commit message:

svn commit --message "Enabling build processes to support multiple platforms"

(Don't forget -- a good SVN commit message can really help you out later. I find it helps to say both what I did, and why I did it.)

Subversion/SVN checkout FAQ: How do I checkout a project with Subversion?

svn checkout command example

I currently work at a consulting company, so we organize our projects first by client, and then by project. So, assuming I have a customer named ACME, and a project named Project1, this svn checkout command (svn co) worked for me:

Java Log4J FAQ: Can you share a simple Log4J example?

I don't have a lot of time today to get into all the Log4J properties and configuration options you can use, but I wanted to share at least one Java Log4J example here, so here goes.

A Log4J example Java class

The following Java Log4J example class is a simple example that initializes, and then uses, the Log4J logging library for Java applications. As you can see the configuration is pretty simple.

A co-worker today mentioned the Lessig method for presentations, embodied by this Identity 2.0 presentation. That seems like great fun for short discussions, and possibly a Tufte-approved use of PowerPoint.

Some time in the very near future I will make the switch. Yesterday I placed an order for a MacBook Pro, and now I anxiously await its arrival.

Before discussing my reasons for making the switch, let me first state that I am not currently an iPod or iTunes user. I may get to those things eventually, but for now those things are non factors, and what I'm most interested in is developing new software for customers, and designing new software systems.

To put the JGoodies FormLayout into debug mode, when you're creating a builder, instead of doing this:

PanelBuilder builder = new PanelBuilder(layout);

add in a FormDebugPanel, like this:

// debug mode
PanelBuilder builder = new PanelBuilder(layout, new FormDebugPanel());

This enables what I think is a terrific debug feature, showing red lines around whatever grid structure you've created. (Sorry I don't have an image out here for this tutorial, but it really is a terrific GUI debugging feature.)


There is a disease I see so often in the software development industry that I've decided to give it a name. I call it "Kirk/Scotty Syndrome". This disease is related to the concept of "software rot" and "spaghetti code" inflicted by the management team. You'll know this disease when you hear it, because it will sound a lot like the following conversation, taken from most Star Trek episodes:

Here you want to use the "describe" command in Postgresql. Assuming that you want to get information about a database table named users, and you're logged into a Postgresql database using the psql client, issue this command at the psql prompt:

\d users

This will provide a description of the table named users. Your output from this command should look like this:

"Postgres show tables" FAQ: How do I list all the tables in my current Postgresql database?

Once you're logged into a Postgresql database using the psql client, issue this command at the psql prompt to show all the tables in your Postgres database:


This will list all of the tables in the current database.


Question: How do I list the Postgres slash commands, i.e., the commands available from the Postgres command line?

Once you're logged into a Postgresql database, you can issue the \? command to see the list of available Postgres "slash" commands, like this:

mydatabase=> \?

For my own convenience, I'm listing these Postgres commands here. These are the commands available in the Postgresql 8.0.3 client:

First, I issue the call for Postgres command line help:

"Postgres login" FAQ: How do I log into a Postgres database from the command line?

To log into a Postgres database from the command line, use the psql command. Let's take a look at a few psql command line options you can use.

Postgres login commands

If you are logged into the same computer that Postgres is running on you can use the following psql login command, specifying the database (mydb) and username (myuser):