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

Here's the source code for a Java method that converts a given String into an equivalent new String, where characters that cause problems when rendered as HTML have been converted to their ISO Latin equivalent:

Ahh, benchmarks and performance, a fun game. Here are two benchmarks that I needed to use today to help demonstrate the difference between platforms:

  1. SciMark 2.0, from the NIST folks.
  2. The VolanoMark benchmark and report.

The SciMark is nicely configured as an applet, so it's very easy to test the speed of client systems. The VolanoMark is more difficult to set up, but may give you a more accurate read when it comes to server side apps.

I just learned that Mozilla has found a new home at the Mozilla Foundation. According to their web site, the foundation will "... promote the distribution and adoption of our flagship applications based on that code." As long as they keep Firebird going I'll be happy. It's a quick little browser that doesn't suffer from (a) being tied to Windows and (b) having gaping security holes.

I needed to see a list of all changes to a certain portion of code in a CVS repository. Here's how I did that. First, move to the desired directory. Then, issue this command:

cvs -z9 log -d >2003-8-14

 

Daniel Savarese has a nice article in the July issue of JavaPro magazine about business rules and logic programming. The source code for the article is also available online (by following that link).

In the name of being more productive I try a lot of different things, so I started teaching myself shorthand recently, Gregg Shorthand, to be specific. Yes, shorthand is an obscure technology these days, but I thought it might help me take notes faster at meetings in my work as a business analyst. Personally I have had mixed results, but if you have a curious mind and wonder how things work, then learning shorthand might be interesting to you too.

Unix/Linux aliases FAQ: Can you share some example of the Linux alias command, as well as some alias command examples?

Using Linux aliases

Aliases in Unix and Linux operating systems are cool. They let you define your own commands, or command shortcuts, so you can customize the command line, and make it work the way you want it to work. In this tutorial I'll share several Linux aliases that I use on a daily basis.

A while back I needed to print some lines from the middle of a large text file. I used to use a combination of head and tail to get the results I wanted, but as large as this file was, I needed something much better. Since I couldn't find a tool to do this for me, I wrote one in Perl. Here's the source code and a brief explanation of my extract.pl program.

 

A Perl program to extract lines from the middle of a file

I've always been a big fan of the Unix head and tail commands, but several times I have wanted to print a range of lines from the middle of a text file -- not just the beginning or end of a file. Not liking the available solutions, I wrote my own.

Here is the source code for a program named "extract.pl", which prints lines from a text file beginning at the start line you specify and ending at the stop line.

Today is my mother's birthday, but she's in Greece, so happy b-day from a distance mom.

In the rest of the world news, here are a couple of short tips on using Unix/Linux commands:

 

Linux FAQ: Can you share some examples of how to use the Linux locate command?

Background

Sure. The locate command is used to find files by their filename. The locate command is lightning fast because there is a background process that runs on your system that continuously finds new files and stores them in a database. When you use the locate command, it then searches that database for the filename instead of searching your filesystem while you wait (which is what the find command does).

How to see the permissions and size of a directory

Here's a short story :) on how to look at files and directories on a Unix/Linux computer system. I've seen so many people do this the hard way that I thought I should finally write something about it.

After a few trials and tribulations, I finally have a new search page going. I didn't like some of the side effects of the old search page, so I'm going with a more standard search engine. I'm using the webinator, from thunderstone.

I've really been in the Perl neighborhood for these last few days. Here are two more tips on using regular expressions and escape sequences in Perl:

You can do many crazy things with Perl regular expressions, but many times you just need to use an escape character (or escape sequence) in a regular expression. I'm often asked what escape sequences you can use in Perl regular expressions, so without any further ado, here is a simple list of "special" characters (such as the [Tab] character) can be matched by the Perl regular expressions:

I won't say that this is a complete list, but I think this is a list of the most popular backslash characters (also known as escape sequences) that can be used in Perl strings:

I was looking for a nice program that would let me kill a bunch of related processes on a Windows PC, similar to the way the killall command works on Linux. (I find this very useful when I'm testing apps and I have a bunch of windows open.)

Cool, I've been back to Perl for a few days. I'd forgotten what a cool language it is. Here are two brief Perl tips related to my recent work:

Summary: How to use Perl here documents, i.e., the Perl heredoc syntax.

Perl offers a convenient way of printing multiple lines of output through an interesting feature known as a "Perl here document". A here document, or heredoc, lets you easily store multiple lines of text in a Perl variable.

A multiline Perl here document works like this:

Summary: Using the Perl backtick operator to execute system comands

One of the real strengths of the Perl programming language is the ease in which you can access (execute) the commands of the underlying operating system. As other programming languages point out, this can be considered a weakness, because it also makes your programs system-dependent, but in reality I've found this to be a problem only five or 10 percent of the time.