Author Archives: Daryl Mathison

News Item: Moving Code Examples to GitHub

Since the start of this blog I have been hosting my example code on Google Code.  That has suddenly needed to change.  I received an email from Google that stated:


Earlier today, Google announced we will be turning down Google Code Project Hosting. The service started in 2006 with the goal of providing a scalable and reliable way of hosting open source projects. Since that time, millions of people have contributed to open source projects hosted on the site.

Later on in the letter it states:

We will be shutting down Google Code over the coming months. Starting today, the site will no longer accept new projects, but will remain functionally unchanged until August 2015. After that, project data will be read-only. Early next year, the site will shut down, but project data will be available for download in an archive format.

That means a new home for my example code.

Thank you GitHub

I have already been hosting a few projects in GitHub but I wanted to separate my example code from my “personal stuff.”  Google offered an export service to GitHub and the convenience won me over.  My example code and personal projects are now on the same hosting site.

What Does that Mean For the Blog?

It means that the links that I have in current and past blog posts will have to be changed.  Currently Google will not shut off the links until next year so I have some time to change four years of examples to the new site.  As I change over the links, some may not work initially.  If one finds a bad link (one going to GitHub and not working) please let me know.and I will fix it.

Keep on Coding!



RE:Does It Get Boring To Be A Programmer?

This is in response to the post written by Bozhidar Bozhanov, “Does It Get Boring To Be A Programmer?” hosted on Java Coding Geeks. It really reminds me of my career path and how I changed it.

I really programming when I was in elementary school on a TRS-80. Let us not get into the “I had to use tape” discussions please. In any case, the need program carried me on through collage and I graduated with a degree in Computer Engineering. Not only was I a programmer, I was an engineer. I had a license to get paid to do what I enjoy doing was how I saw it.

I am goal oriented so I knew if I wanted to get anywhere I was going to have to develop some goals. I was married by that time so one of my goals was to make sure my work did not get in the way of my marriage. Another goal I set was my career goal. It had to be general enough to fit a number of situations but specific enough to keep on path. The goals I had set kept me in the direction I was aiming but a snag hit along the way.

I had built a set routine in my life of going to work and coming home, going to work and coming home, etc. As the pattern was set, I did something that really threw everything off the tracks, I forgot my goals. Looking back at it, the routine that I had set was really about earning a paycheck and not about what really motivated me. I got my hours so I could pay the bills. That was about the extent of my reasons for going to work. This attitude led me to get bored, really bored. That boredom put me on the path of getting my hours to pay my bills. As one can see, it became a cycle.

The wheels started getting back on track after I got laid off. One of the contracts I was on ran out and no new money was coming so cutbacks were next. I had just blew a deadline so one of the logical choices was me. I really struggled personally as I was looking for work. My goals seemed a long way off now. I was in survival mode and nothing else. The goal of finding work to pay the bills was all consuming. I could never find a position that I was fully qualified for. I got two interviews in four months. That is not a good return on time. I did land a job that paid well under what I was earning in the last job but I had bills. I took the job and started the search again for a job that could pay all the bills.

I developed a habit of following up with every company that I had contact with. This was to keep me fresh in their minds. This habit did land me a job with a company that really has the customer and their employees first. I was getting the bills paid, goal accomplished and more, so why did my career still suck?

The reason my career still sucked was me. I started digging around in my memory to find out why I was fired up when I was just starting and not now. I remembered my career goal, “Solving interesting problems by technical means.” That started the ball rolling from sucky career to a fantastic career. My circumstances had not changed but I started to change.  I started to research different technologies, like Hazelcast, Spring and others.  I wrote my experiences down for everyone to share(blog). This research lead me to do a webinar presentation. I shared my knowledge with the team I was working with and discussed if we could incorporate it anywhere.  In my new job, I am using my knowledge of computer security to meet security requirements set by the customer.  All of this is fueled by my renewed commitment to my career goal.  This commitment has turned into a love of computers that I had back in elementary school with an old TRS-80.  My creativity has soared and with my new found love and professional experience I can design creative solutions to meet customer needs that are practical and sometimes even elegant.

So in direct response to the article, I have found that a programmer can be bored only if they let themselves be bored and loose track of what brought them into computers to begin with.  As for me and my career, I am a born-again programmer.

Beginner’s Guide to Hazelcast Part 6

This is the sixth post in a series of posts about Hazelcast.  If one has not read the last five, please go to the table of contents post I have created to catch up.

Native Clients

After the last post I decided that I am going to go native.  Yep, I am going to demonstrate Hazelcast’s own Java client.  Java is not the only language native clients come in, C++ and C# flavors are available for the enterprise version.

Why Go Native?

It is a good question.  Native clients can keep one fixed into a product line without chance to escape.  Hazelcast rewards the one going native with the following:

  • The client is part of the cluster.  That means one can create places to stash data and listen for events going on in the cluster.  It also means that all of the tricks that have been discussed in my earlier posts can be used as a client.  This advantage cannot be underestimated.
  • The configuration file is similar.  This means that one doesn’t have to translate from the Hazelcast configuration file to client configuration file.  One can copy the file over and like magic it works.  The less translating one has to do, the less that gets lost.

The Any Client Rule of Thumb

Hazelcast clients are the easiest I have ever had the pleasure to set up and use.


This simple example is a continuation of a theme started by the last post, caching expensive operations.

Pom File

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="" xmlns:xsi="" xsi:schemaLocation="">



This client becomes part of the cluster creates a IMap named “fibmap”. The fibonacci result is stored in the map if it hasn’t been calculated before. If one runs the client once, the results are stored in fibmap. The second time the client is run, the cached values are displayed.

package com.darylmathison.hazelcastjavaclient;

import com.hazelcast.client.HazelcastClient;
import com.hazelcast.core.HazelcastInstance;
import java.util.Map;

 * @author Daryl
public class Main {

     * @param args the command line arguments
    public static void main(String[] args) {
        HazelcastInstance instance = HazelcastClient.newHazelcastClient();
        Map<Long, Long> cacheMap = instance.getMap("fibmap");
        for(long i = 1; i <= 10L; i++) {
            System.out.println("value is " + fibonacci(i, cacheMap));
    private static long fibonacci(long rounds, Map<Long, Long> cacheMap) {
        Long cached = cacheMap.get(rounds);
        if(cached != null) {
            System.out.print("cached ");
            return cached;
        long[] lastTwo = new long[] {1, 1};
        for(int i = 0; i < rounds; i++) {
            long last = lastTwo[1];
            lastTwo[1] = lastTwo[0] + lastTwo[1];
            lastTwo[0] = last;
        cacheMap.put(rounds, lastTwo[1]);
        return lastTwo[1];



In this post I discussed reasons to use Hazelcast’s native Java client. I also showed a quick example of how to use one. The code can be found here.


When it comes to Beginner’s Guide to Hazelcast. I always am looking at and