script

A better test for detecting Unix operating systems in an Ant build script

In several previous tutorials (see my references below) about testing for operating systems within Ant build scripts, and then conditionally executing targets based on the results of those tests, I noted that Mac OS X operating systems respond to both Mac and Unix test conditions based on the Ant "os family" test. I mentioned that I thought this behavior was probably correct, because Mac OS X is built an a Unix base (BSD, to be specific).

A Ruby script to remove binary (garbage) characters from a text file

Problem: You have a file that should be a plain text file, but for some reason it has a bunch of non-printable binary characters (also known as garbage characters) in it, and you'd like a Ruby script that can create a clean version of the file.

Solution: I've demonstrated how to do this in another blog post by using the Unix tr command, but in case you'd like a Ruby script to clean up a file like this, I thought I'd write up a quick program and share it here.

How to turn a list of jar files into an Ant classpath string

Summary: Using a list of jar files to create a dynamic classpath to write to a manifest file in an Ant build script.

In this tutorial I'd like to demonstrate how to convert a list of jar files in a standard lib directory into a classpath string you can use to define a manifest file in an Ant build script. By converting this list of jar files into a classpath string, the build process for your jar file can depend on any number of external jar files, and you can create this classpath dynamically.

How to embed data in your Perl program

Here's a sample Perl program that demonstrates how you can include (embed) data inside of your Perl program, right in there next to the source code.

This simple program takes the data after the special __END__ tag, and makes it available to your Perl source code.

#!/usr/bin/perl

while (<main::DATA>)
{
  print $_;
}

__END__
George Washington
Abraham Lincoln
John F. Kennedy

As you can see, you loop through the data with this line of code:

Where to put your AppleScript programs

I was just working on a new AppleScript program on my Mac, when I had to remember where to install my script so I could access it from the Mac menu bar.

After digging around real quick, I saw that I installed all of my original scripts in this Mac folder:

/Library/Scripts/AlsScripts

I think I did this so my scripts would appear near the top of the list of available AppleScript programs, as shown in the following figure:

Syndicate content