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

LaTeX table/figure FAQ - How do I reference a table or figure in a LaTeX document?

Being able to automatically reference a figure within a LaTeX document is a very cool thing. This referencing capability lets you easily give readers the exact number of a figure, or tell them what page number a figure is located on with the use of a few simple commands (\label, \ref, and \pageref). The same technique works for referencing other objects within a LaTeX document, including tables and equations.

Here's an interesting page at Wikipedia, where they discuss all of the caching things they've implemented to improve performance:

Here's a Bourne Shell (sh) script I use to run a Java anti-spam program I wrote. The program I'm running isn't important, but what is worth sharing about this shell script is how I dynamically build the Java CLASSPATH by including all of the jar files in the lib directory.

Other parts of the shell script (showing a shell script for loop) may be worth sharing as well, but I think that building the Java classpath dynamically in the shell script is probably the most important part.

With that being said, here's the shell script:

Someone asked me the other day how they could search for files with different names with one Linux find command. They wanted to create a list of all files that ended with the extensions .class and .sh.

Although this is actually very easy to do with the find command, the syntax is obscure and probably not well documented, so let's look at how to do this.

Here's a link to a a quick tutorial/tip I wrote on using the Java Preferences API. I had never used it before, but got this example working in less than 15 minutes (so you know it's pretty easy).

Linux shell script FAQ: Can you share a Linux shell script while loop example? While you're at it, can you show how to use the sleep command in the shell script while loop?

Sure. As a little background, I've written a program I call an Email Agent that periodically scans my email inbox, and does a lot of things to the inbox, including deleting the over 6,000 spams that I receive in a typical day. A recent problem with the Agent is that it runs too fast, apparently overwhelming the sendmail process on the machine that it runs on.

As each day passes I use Cygwin more and more. One of the things I like to do on Unix platforms is to control what my command prompt looks like. On Cygwin, I edited my .bash_profile to include a multi-line entry like this:

PS1='
$PWD
yo: '

This may look bizarre, but I like the results. It makes my command line prompt look like this:

While digging through an old book this morning, I ran across this bumper sticker message from the 1960's:

"An atomic war could ruin your day"

I was born in '63 and don't remember most things like this, but it must have been an interesting time.

 

Linux command line FAQ: How can I record the input and output of my Linux command line (i.e., the Linux commands I type, and the output from those commands)?

I did something wrong in a previous blog entry that led me to use the "pax" command to create a large backup/archive. There's nothing wrong with using the pax command -- other than the fact that it's not available for Cygwin -- and I really needed to created a huge archive. (I know that pax is available for our Linux and Unix systems, but I can't find a version for Cygwin.)

Over the weekend I downloaded and installed the Glimpse search utility on my Windows laptop. Actually, what I'm doing is running glimpse under Cygwin. Because glimpse is generally just available as a source code distribution, I looked around and found a reference to a user who installed it under Cygwin. With that as my encouragement, I downloaded the glimpse source code and had at it.

Just cleaning off an old PC that I used to use, and I find these URLs that some of our developers put together for an old "Java Performance Tuning" seminar:

Here are several Linux-related links from a Computer Shopper that I'm about to throw out. They did a nice little story on how non-techies can try to get Linux going on a PC.

This is a little bit of a stretch, but if you look at the "CSD" doc for this jGrasp project from Auburn, I thought it was interesting that they are essentially trying to apply Edward Tufte sparklines to an IDE. The basic URL for the jGrasp project is:

and the URL for the CSD doc is:

I'm finally getting back into the swing of things after being a presenter at the Borland Conference. To that end I'm making my papers and presentations available online at the following URLs. I think the titles of the papers are self-explanatory, so I'll just list them here.

Don't you hate it when you start Windows Explorer and it always starts in the wrong directory?! For me, it opens in the "My ___" directory structure by default, and I never use those directories. It would be much better if it would open up and show me the contents of the "C:\" drive, or perhaps a subdirectory like "C:\Work". Fortunately this can be done, if you know the magic incantation.

LaTeX FAQ: How can I prevent line breaks from occurring in my LaTeX documents?

Another nice thing about LaTeX is that you can prevent line breaks between words that should not be broken, things like people's names. To prevent a line break from occurring, use the tilde character (~) instead of a space, like this:

Mr.~John~Doe

This keeps "Mr. John Doe" on the same line when your document is created.

 

LaTeX FAQ: What kinds of dashes and hyphens are available with LaTeX?

There are three types of dashes you can create with LaTeX:

The ability to create notes in the margin (also referred to as "margin notes" or "marginal notes") is a really nice/cool feature in LaTeX. In the words of Edward Tufte, it lets you keep your notes near your content, which is a good thing.

Creating the margin notes themselves is very easy. Here's how to create a margin note with the LaTeX \marginpar command:

\marginpar{This note will appear in the margin.}

 

LaTeX question: How do I create an "ellipsis" with LaTeX?

Very simple, if not intuitive. Wherever you want the ellipsis to appear in your LaTeX document (LaTeX PDF or LaTeX HTML document) use the "ldots" command, like this:

\ldots