the coders corner logo
coding|audio|social

Please feel free to contact me to discuss your requirements, quickest response is normally from the contact form.


Team Blog

Using Java's XMLStreamReader PULL XML Parser

In this entry I show how to use the inbuilt Java XMLStreamReader PULL parser class to read an XML file. The XML stream libraries are PULL based XML parsers that do not load the whole document into a memory structure, so therefore are more suited to large volumes of XML.

Below is an example XML file for a zoo, it contains Animal data types that have both attributes and data. It is kept simple for the sake of example. To run the example, copy this XML into the ROOT of your classpath.

Read more: Using Java's XMLStreamReader PULL XML Parser

Groovychart Bar chart with fixed colour

In this article I show an example of creating a bar chart with a fixed colour. This was missing from the groovychart example set, and will get included into the next build. If you are unfamiliar with groovy chart then here is an introduction to Groovychart.

We simply tell the plot's renderer to use the StandardBarPainter. This turns off the gradient paint that is used by default.

Read more: Groovychart Bar chart with fixed colour

Using Semaphore and CyclicBarrier in Java applications

In this example I show an usage of two more concurrent classes CyclicBarrier and Semaphore; which are both provided in the core Java library. There's a wealth of concurrency classes built directly into the JVM that can really simplify multi-threaded development.

Read more: Using Semaphore and CyclicBarrier in Java applications

BlockingQueue producer consumer example

In this BlockingQueue example we show how to write a very simple producer - consumer with a blocking queue. This example generates SimpleAddition objects that require an addition of two numbers to be performed on the consumer thread. In this case the two values to be added are generated using java.util.Random's nextInt call. They are stored on the queue as a SimpleAddition transfer object and picked up for processing on the consumer thread.

We make the queue smaller than the number of items to be processed, so it is probable that we will need to block while producing, as the call to put may block.

Read more: BlockingQueue producer consumer example

Impressed with Fedora 19 Linux

After 10 years of service, my old linux box finally gave up so I bought a basic tower to run Linux on. I've got to say that Fedora 19 was very easy to install and get working. Just as with Windows 8, I think the new Gnome 3 interface is an improvement once one is accustomed. Although I did tweak a few things with the tweak tool.

Read more: Impressed with Fedora 19 Linux

NIO File operations in Java 7

Hot on the heals of the last article, interested in what other goodies may be in the new file IO package, and wanting to try the new catch block, I cooked up another example.

In this example, I create a Path object for an example directory, into which I then create a file and write some text into the file. Some things of note here:

Read more: NIO File operations in Java 7

Twelve months since moving to Joomla

For the past tweleve months I've been running the site on Joomla. Over this time I've come to like it. It's configurability and the astonishing number of plugins means that for most basic sites (like this one) very little if any code need be written.

Finding out how to do something is easy; there's so much help available online and many good books have been written on the subject (including the free Joomla Beginners Guide I have on my book reader).

Read more: Twelve months since moving to Joomla

Watching files in Java 7 with WatchService

In this article I show how to watch files and directories for additions/changes/deletions using the new file system support in Java 7. Finally, after years of native solutions, it is now possible to listen for file changes without resorting to OS specific solutions.

Read more: Watching files in Java 7 with WatchService

Remove duplicate "contact" heading in Joomla contact form

In this article I show you how to remove the second 'contact form' header from the default contact form in Joomla without hacking your install. I'd seen a couple of videos on you tube that suggested one should alter the underlying installation. You can do this without altering the installation.

Read more: Remove duplicate "contact" heading in Joomla contact form

What a great summer we had in England

{jcomments on}Over here in England we've had the best summer in some years. During a recent week holiday in Devon, we could as well have been in the French Riviera the temperatures were so high. I stumbled across a town called Lynton in the Exmoor region on the way back, and what scenery there - the valley of rocks is certainly worth a visit!

In the town centre there was a small record shop, I don't know the name, but I managed to get half and hour in there to pick up a few records.

Over the summer, I still managed to build a new set of speakers for the study during this time. After all was said and done, I did not go for the sub-woofer and satellite speaker solution. Instead building a pair of high quality bookshelves. More on this in a dedicated article that's coming soon.

Read more: What a great summer we had in England