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

A recent anti-SPAM and MockObjects project leads me to Paul Graham's site. He has a nice list of filtering software available to the world. And his info on Filters v. Blacklists is right up my current alley.

One thing leads to another, leads to ... a few "best practices" web sites. Both christine.com and the Software Program Managers Network offer a little insight into the goo that makes managers -- and developers -- happy. Christine is looking a little dated, but there may be something useful in there.

The folks at mockobjects.com have done a good job of creating MockObjects for the Java API. I'm not sure how to use some of their objects yet, but once I learn a few of the basic patterns I'll put a tutorial out here.

They also have links to several MockObject code-generation tools, which may be helpful. These include EasyMock, MockCreator, and MockMaker. Which one is the best or most popular? Dunno yet. That's often an interesting part of the open source world.

 

My favorite quote from a book these days is this: "You can make buffalo go anywhere, just so long as they want to go there." That one is followed by "You can keep buffalo out of anywhere, just so long as they don't want to go there."

For those heavy process days check out the Software Engineering Body of Knowledge, and learn all about the Straw Man, Stone Man, and Iron Man. For use case templates, Cockburn's usecases.org site is the place to be.

A couple of SourceForge projects to remember: PMD is a Java source code analyzer, and JTidy is a Java port of HTML Tidy, an HTML syntax checker and pretty printer. I don't know how good either of these projects are yet, I just wanted to make a note of them.

Steve Jobs keynote address from the Apple Expo 2002 in Paris is online here.

Things not to forget: use the lsof command to list open files on a Linux system; use tcptunnel (or something like that) from the Apache XML project to check out the traffic to and from a web server (good for teaching http).

Learned today that you can launch Internet Explorer in kiosk mode with a -k option. I don't know yet what the limitations are, but maybe another thing not to forget. Of course most future kiosks will be created with Linux and Mozilla, but in case it's ever necessary...

FWIW, Wired magazine had a few nice things to say about OpenOffice this month, an open alternative to MS-Office, especially for those people that don't like to give their $$ to Microsoft for office apps they don't use very often.

Hmmm, July 4, and I'm fooling around on a computer. It seems that I'm often happiest when I'm working on something, at least something fun. Today's travels bring me to the Jiki, or JikiJikiJava, a Java replacement for the Wiki. Actually, it may go further than the Wiki, in that it is a "full-blown distributed component-based server".

I'm not recommending this product yet, because I haven't done anything but look at the web page, but I don't want to lose the URL. So here is the link to JiveLint, a free product that promises to "find unused code and variables" in Java programs, and much more (potential bugs, weak points, code conventions). Some dev teams are great and have no dead code in their projects. Others, well ... a tool like this might be very helpful. :) Borland's OptimizeIt is the only other product I've seen for far to make this claim.

In honor of unofficial socket day, here's a Sun tut on reading and writing from/to a socket. Of course if you don't know what a socket is, you may want to start with what is a socket? instead.

Nothing like a long motorcycle ride (during which I experienced the first suv !#@%$# trying to ride in my lane; I now know where the horn is on the bike), followed by finding the ten gates, which in turn helped me find the primary point online.

Here's a story: Sun and Microsoft agree to work together. While I'm in the news neighborhood, it looks like MS has a few more security issues.

Yesterday I needed to find all the files in two subdirectories (/tmp and /home) on a Linux platform ending with the characters ".java", that contained the string "commit". Here's the little ditty that made that happen:

find /tmp /home -type f -name "*.java" -exec grep 'commit' {} \; -print

For finding files and directories on Unix systems (or Cygwin) the find command rules.

 

Perl array/foreach FAQ: How do I perform an operation on each element in a Perl array? (Also written as, How do I use the Perl foreach operator, or What is the Perl foreach syntax?)

Software developers are always working with arrays. In Perl, that means that you're working with (a) normal Perl arrays or (b) Perl hashes (called 'associative arrays' before Perl 5.x).

When it comes to working with a regular Perl array (not a hash), here's a simple technique I often use to loop through the array, and perform an operation on each Perl array element:

Summary: How to use a Perl foreach loop to print every element in a Perl array.

To look at how to print every element in a Perl array using the foreach operator, the first thing we need is a sample array. Let's assume that you have an array that contains the name of baseball teams, like this:

@teams = ('cubs', 'reds', 'yankees', 'dodgers');

If you just want to print the array with the array members separated by blank spaces, you can just print the array like this:

Perl environment variables FAQ: How do I set environment variables in a Perl program?

In several other articles, we've demonstrated how you can access the value of environment variables from your Perl programs. For example, to determine the setting of your "PATH" environment variable, you can write a line of Perl code like this:

$path = $ENV{'PATH'};

As you may remember, "%ENV" is a special hash in Perl that contains the value of all your environment variables.