Message formatting in Java

Whatever kind application you’re working on, you will probably need to create some sort of message more complex than “Hello World!” at some point. Whether it’s a log message, or some text to plonk into your nice UI, you will probably also need to format it in some way to include some variable values, and maybe some embellishments like using the correct words for plural and singular values.

Java provides a number of ways to do this. In this post, we’ll look at a few of them.

Continue reading “Message formatting in Java”

Scheduling tasks with Quartz

It’s been some time since I started off in the world of software development, but I have found myself looking for a good way to schedule tasks more than once, and I’m sure you have too. You know the sort. Run this report every third Friday of the month, clean out this table at the end of every day, sacrifice a goat every summer and winter solstice, and so on.

Some tasks can happily run in Cron, provided that your operating system has Cron. However, some tasks require a bit more flexibility than this old workhorse can provide. You may need to run the task in the context of your application, for instance, or your requirements might dictate that the scheduling of certain tasks must be controlled by the users. In the case of a Java application, you might not want to start and stop the JVM every time a small task needs to execute.

Enter Quartz, OpenSymphony’s enterprise job scheduler. This API allows you to schedule tasks within your own application, which means that you’re more or less free to control the scheduling your way. In this post, we’ll look at some of the most basic tools which this API brings to the table.

Continue reading “Scheduling tasks with Quartz”