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

Here's a n example Linux shell script (Bourne shell to be specific) that I use to send a list of directories to one of our invoicers. She uses this list as part of a cross-checking process to make sure she bills each one of our customers who have a directory allocated to them. The list is sent to her automatically from a Linux crontab entry I created for her.

Without any further ado, here is the Linux shell script that sends the email. (Note that although I keep writing "Linux mail", this should also work on other Unix systems.)

It's funny in life how you don't hear about something, or know about something, and then it comes up over and over again in unrelated situtations. The "Wonderlic test" is like that for me. I'd never heard it until three recent unrelated conversations.

My obsessive use of LaTeX continues. Here's a link to a sed script I'm creating to convert HTML to LaTeX.

I actually have a reason to do this. During a requirements phase I'm doing a lot of work with HTML prototypes, but the actual specification is being created using LaTeX, and I want to incorporate the HTML prototypes in the LaTeX document. Hence this conversion effort. I know that it can never fully succeed, but I think I'll be pretty happy with 90-95% success here.


The crazy sed script below is my first attempt at a script that will convert as much HTML as possible to LaTeX. For my purposes I'm mostly interested in tables, lists, buttons, and comboboxes, but I included a few other things as well.

This is in an extremely experimental state, and is included here as much for backup purposes and sharing as anything else.

Here's how you run the sed script on an HTML file named test.html:

sed -f html2latex.sed test.html > test.tex

That being said, here's the current source code for the html2latex.sed file:

Here's a link to a cool "Green plant hyperbolic tree demo". Don't give up on it too quick. If you start exploring the tree, especially by following the Moniliformopses path, you'll start to see some very interesting power here. I'm looking for a new menu/navigation paradigm, and a co-worker sent me down this road.

In other news, here's a recent conversation between me and a Support Guy ("SG" for short):

Over the weekend I saw that I'm on Borland's speaking schedule for their annual conference, BorCon 2004. I guess I better get to work on my presentations. :) Actually, I'm ready to go. I'm set to give one talk on Java Performance Tuning and another on Function Point technology. Giddyup.

I haven't frequented it before, but the Java & Internet Glossary at mindprod looks pretty good.


I guess it's pretty serious when the Department of Homeland Security says "Don't use Internet Explorer":

I don't know exactly how I'm supposed to be able to control the text that appears in the titlebar of a Command prompt window in Windows 2000 and Windows XP, but I've figured out something that kind of sort of works. Just follow these steps:

A quick lesson on the karma of getting and accepting bad estimates from developers, and not communicating:

Maybe because I'm a bit of an old-timer, or maybe because I like the speed, I often use mutt for my email. Knowing that, DD forwarded me this link of good mutt tips. As an old(er) friend might say, I'm all over that like green on a frog.

Here's a sample Perl CGI program I wrote that prints out all of the environment variables it knows. I've found this program to be very useful when first installing a web server, or when debugging a problem with a web server or new environment.

Perl CGI environment variables - example program

Here's the code:

Linux mkdir question: I'm about to go to work on a new server, and I want to create subdirectories named docs, bin, and lib, and the docs directory has two subdirectories named personal and business. How can I create these directories and subdirectories with one command?

Answer: Use the "-p" option of the Unix/Linux mkdir command. The answer is shown below:

Below I've included a sample Perl CGI program that I use to edit some files on my web sites. I've modified the file a little bit for the purposes of this example, but it's essentially what I use.

Very Important: This program by itself is not secure in any way. It does not require a user login, etc. At the very least you will want to secure access to this program with an Apache htaccess configuration, or something similar on other Perl CGI web servers. This program is shown here for demonstration purposes only.

Did you ever need to take one file on a Linux or Unix system and copy it to a whole bunch of other directories? I had this problem recently when I changed some of the header files on this website. I had a file named header.html, and I needed to copy it to a bunch of subdirectories.

Using Unix, Linux, or Cygwin this turns out to be really easy. I used the Linux find command, in combination with the cp command. Once I figured out the right syntax, I was able to copy the file to nearly 500 directories in just a few seconds.

Here's a link to a quick tip on using pax instead of tar to create a large archive. The thing that got me into this problem in the first place was the new Java source code warehouse, where you can "Learn Java by Example". I basically put a search engine on top of a bunch of good open source Java projects to create something that I hope is useful.

I had a problem using the tar command this morning while trying to create a large archive, and rather than figure out what in the world I was doing wrong with find, xargs, and tar, I decided to use pax instead. It worked great at creating an archive file that tar could still read, so instead of fighting with the find/xargs/tar three-headed monster to create a large archive, pax bailed me out.

Linux process question: How can I determine which files are open by a process on a Unix/Linux system?

It seems like a couple of times a year I run into a situation where I have a zombie process that I need to get rid of, but before killing it off, I want to make sure I'm killing the right thing. Some times when a Linux process is in a zombie state, you can't see the information you need with the ps command, so you need something else.

I don't know about the mental part, but physically I'm back from Alaska. While waiting for some sys-admin things to get done last night I wrote a few Unix/Linux tips in the "etc" section of the blog. This includes tips on extracting lines from the middle of a file, determining the free memory on a Linux system, using the nohup command, and displaying nonprintable characters from a file. Busy night.