Sample Ant clean, prepare, and compile tasks

Summary: An Ant clean, prepare, and compile example.

I'm not going to discuss the following Ant build script code too much, but I thought I would share it here. In short, it shows how I declare several Ant tasks, including my typical clean, prepare, and compile tasks.

MySQL Shell scripts - Start a MySQL server and client on a non-standard port

MySQL shell scripts and port FAQ: Can you share some MySQL examples that show how to start MySQL on a non-standard port (non default port)?

For a variety of reasons you may want or need to run your MySQL server on a different port than the default MySQL port of 3306. In those cases the easiest thing you can do is create a Unix/Linux shell script to start your MySQL server on some other port.

Unix/Linux shell script reference page

Linux shell script test syntax

All of the shell script tests that follow should be performed between the bracket characters [ and ], like this:

if [ true ]
  # do something here

Very important: Make sure you leave spaces around the bracket characters.

I'll show more detailed tests as we go along.

To perform tests on files use the following comparison operators:

A Perl script to convert Nagios/Unix epoch time to a human readable format

I had to work with Nagios a lot this morning, in particular reading through the nagios.log log file. If you're ever read that log file, or looked at some other Linux/Unix log files, you've seen records that display the time in an epoch time format, which looks like this:


If you can read the epoch time format and know the actual human readable date and time, you're a better person than I am (or you've been looking at Nagios, Linux, or Unix log files too long).

Debug Ant build problems with echo statements

Ant FAQ: How to use echo commands to debug Ant build scripts.

I've been moving back and forth between a ton of different computers lately -- Mac, Linux, and Windows computers -- and I had some problems with an Ant build script. This particular Ant script is complex, and I kept making mistakes, and needed a good way to debug the build process as I set up my application on these different systems.

A shell script to search multiple jar files for a Java class or pattern

I've found that there are several times when I need to be able to find a Java class inside of a jar file. Usually this happens when something isn't working, and I get something like a Java ClassNotFoundException. In the process of debugging this problem -- especially if I'm using a jar library that I haven't used before -- I list the contents of one or more jar files to debug the problem.

The beginning of a MySQL database script

Here is some code that I use at the beginning of a MySQL database script to (a) create a database, (b) create a local user to access that database ('foo_user'@'localhost'), (c) create a remote user that can access the database ('foo_user'@'%'), and (d) then use that database (which I need to do before starting a bunch of CREATE TABLE statements):

Syndicate content