Home » Author Archives: Fahd Shariff

Author Archives: Fahd Shariff

Fahd is a software engineer working in the financial services industry. He is passionate about technology and specializes in Java application development in distributed environments.

Converting XML to CSV using XSLT 1.0

software-development-2-logo

This post shows you how to convert a simple XML file to CSV using XSLT. Consider the following sample XML:                 <library> <book> <author>Dan Simmons</author> <title>Hyperion</title> <publishDate>1989</publishDate> </book> <book> <author>Douglas Adams</author> <title>The Hitchhiker's Guide to the Galaxy</title> <publishDate>1979</publishDate> </book> </library> This is the desired CSV output: author,title,publishDate Dan Simmons,Hyperion,1989 Douglas Adams,The Hitchhiker's Guide ...

Read More »

Throttling Task Submission with a BlockingExecutor

java-logo

The JDK’s java.util.concurrent.ThreadPoolExecutor allows you to submit tasks to a thread pool and uses a BlockingQueue to hold submitted tasks. If you have thousands of tasks to submit, you specify a “bounded” queue (i.e. one with a maximum capacity) otherwise your JVM may run out of memory. You can set a RejectedExecutionHandler to handle what happens when the queue is ...

Read More »

Throttling Task Submission with a BlockingExecutor

java-logo

The JDK’s java.util.concurrent.ThreadPoolExecutor allows you to submit tasks to a thread pool and uses a BlockingQueue to hold submitted tasks. If you have thousands of tasks to submit, you specify a “bounded” queue (i.e. one with a maximum capacity) otherwise your JVM may run out of memory. You can set a RejectedExecutionHandler to handle what happens when the queue is ...

Read More »

Shell Scripting – Best Practices

devops-logo

Most programming languages have a set of “best practices” that should be followed when writing code in that language. However, I have not been able to find a comprehensive one for shell scripting so have decided to write my own based on my experience writing shell scripts over the years. A note on portability: Since I mainly write shell scripts ...

Read More »

Guava 15 – New features

java-logo

A new version of the Guava library was released earlier this month and contains several new features and improvements. Here is an overview of some of the significant API additions in this release: 1. Escapers Escapers allow you to “escape” special characters in a string in order to make the string conform to a particular format. For example, in XML, ...

Read More »

Java 7 Swing: Creating Translucent and Shaped Windows

java-logo

Java 7 Swing supports windows with transparency and non-rectangular shapes. The following screenshot shows a circular window created with 75% opacity. You can create a translucent window by altering its opacity using the setOpacity method on a JFrame. Note that you can only create translucent windows if the underlying operating system supports them. Also, ensure that the window is undecorated ...

Read More »

JUnit: Naming Individual Test Cases in a Parameterized Test

junit-logo

A couple of years ago I wrote about JUnit Parameterized Tests. One of the things I didn’t like about them was that JUnit named the invidividual test cases using numbers, so if they failed you had no idea which test parameters caused the failure. The following Eclipse screenshot will show you what I mean:             ...

Read More »

Analysing a Java Core Dump

java-logo

In this post, I will show you how you can debug a Java core file to see what caused your JVM to crash. I will be using a core file I generated in my previous post: Generating a Java Core Dump. There are different ways you can diagnose a JVM crash, listed below: The hs_err_pid log file When a fatal ...

Read More »

Testing Expected Exceptions with JUnit Rules

java-logo

This post shows how to test for expected exceptions using JUnit. Let’s start with the following class that we wish to test:                   public class Person { private final String name; private final int age; /** * Creates a person with the specified name and age. * * @param name the name ...

Read More »
Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close