The singleton

While I agree that a Singleton shouldn’t be used to often, I do want to share my favourite way to implement the singleton pattern for reference.

public class Example
    private static Example instance;

    private Example()
        // this class cannot get instantiated

    public static Example getInstance()
        if (instance == null)
            instance = new Example();

        return instance;

Going to Choquequirao!

In October of 2015, my girlfriend and I went to Peru. One of the highlights of the trip was our trek to Choquequirao! I want to share what we have learned about this fantastic trek!


They call it the sister of Machu Picchu! It’s a city built by the Incas and abandoned in 1572 because of the Spanish invasion. In regard to Machu Picchu, the city is not sacred. Probably more like a  civil centre, a city for the nobility. The location is awesome, it’s located in the Andean at 3000 kilometres. You really feel like close to the gods!

You can’t get there by car, bus or cable lift. Despite that this will probably change in the near future, now is the perfect moment to go there!

The hike is really exhausting, the path is about 15 to 20 kilometres and you have the cross a valley. This means 1 kilometre down and up. Unfortunately there is only 1 way, so you will walk the same path twice. The view of the Andean along the way is really stunning and the city itself is amazing because how hard it is to get there!

A trek?

Yes, we did this trek with BioAndean Expeditions. It’s really a luxury. This is what you get:

  • A porter with some mules to carry all the equipment and your spare stuff.
  • A cook who makes brilliant food.
  • A guide (in our case, he was a big disappointment).

If you have a good guide he will take care of you and tell loads along the way. Because there is so much to like:

  • Tarantula’s!
  • Kolibries & other awesome birds!
  • Wild avocado!
  • Exotic plants
  • Spiders
  • Butterflies

Spending so much money on this guided trek was a big mistake, given the poor service we have got. This is why I wrote this article, so you can do it on your own!

How busy is it?

There are not too many people, but you are also no longer alone on this trek. Adventurous people start to know, and it’s only normal! Most people we have met prefer Choquequiroa above Machu Picchu!

Being on the same path, you will see the same people quite often again because most people have about the same pace but take breaks on different spots. About half of the people we met were doing this on their own!

Do it by yourself!

The price

With a trekking organisation you can easily pay about 1500 soles per person to the organisation, and like 50 for water and other (not included) things. And on top of that you should also pay tips, like 150 or more soles. So this could total 1700 more or less.

Whereas if you walk on your own you probably have enough with 200 – 500 soles. The difference is big!

Getting there

You have to use public transport to go to Cachora. You can easily ask this in the Tourist Office of Cuzco. A bus or 2 will you take there, and it is absolutely cheap!

The hike

Camping equipment

Renting a small tent is possible in Cuzco, one French couple told us they paid 140 soles to rent a very good looking tent for 5 days. We went in spring, and a regular sleeping bag should be enough. I used a very small one to save space. Only 1 night I had cold, and wearing clothes inside my sleeping bag has enough to not feel the cold. And please you don’t need walking sticks. Many Peruvians leave their bamboo walking sticks at the first shop/restaurant where the path really begins.


Every 3 hours you almost meet a place where you can camp. As you can see on the map. They are very welcoming, sleeping was 5 soles a night and included the toilet and cold shower.

Food and drinks

Don’t bring too much water. The most expensive water we bought from one of the shops was 12 soles for 2 litres. Given the effort to get the water there, that’s a very fair price I think. Most of the camp sites offer food and can prepare you a good meal. They also sell snacks and coke. And don’t worry, you only need to speak a few Spanish words. If you can say “Hi” and can count you will be fine. Don’t worry about this, many tourists walk this trail, so if needed you can always ask help from them, as they maybe speak more Spanish.

Compare objects in java

If you want to compare if plain old java objects have the same properties, it is easiest to override the equals method.  This way, if you initialise objects on different places, you can be certain when comparing that they are the same.

We will show you how to do it with this simple class:

public class Insect
    private int legs;
    private int eyes;
    private int colour;
    private String sortName;

Override equals

public boolean equals(Object o)
    if (this == o)
        return true;

    if (o == null || this.getClass() != o.getClass())
        return false;

    final Insect that = (Insect) o;

    if (this.legs != that.legs)
        return false;

    if (this.eyes != that.eyes)
        return false;

    if (this.colour != that.colour)
        return false;

    if (this.sortName != null ? (this.sortName != that.sortName) : (that.sortName != null))
        return false;

    return true;

Override hashCode()

public int hashCode()
    int hash = super.hashCode();
    hash = 14 * hash + this.legs;
    hash = 14 * hash + this.eyes;
    hash = 14 * hash + this.colour;
    hash = 14 * hash + (this.sortName != null ? this.sortName.hashCode() : 0);
    return hash;

Loading routes in Sygic 14

They introduced a whole new layout. This is a short post to help you load routes in Sygic 14+.

Create a route

If you don’t know how to create a route on the computer, please follow this guide.

To repeat this is what you do:

  • Create a route in google maps
  • Click ‘Share’, copy the link
  • Paste the link in ITN Converter (recent version) and export

Save the file

Put the file under Sygic\Res\itinerary.

Open in Sygic

In sygic, you need to use the Favorites button in the top right. Your favorites list will always contain all the routes that are under the itinerary folder!

sygic-home sygic-favorites

How to use the Microsoft Azure Storage SDK

After visiting Microsoft Cloud Camp in Brussels last week I wanted to dive into android developing by using Microsoft Azure.

I wanted to store images on a storage account, and since I didn’t use Gradle or Maven, I had some issues getting it to work. In the end, this is quick guide how I did it.

On github you can find the Microsoft Azure Storage SDK for Android. I checked out the project information on the maven-repository. I had to download the com.fasterxml.jackson.core since that was a dependency I wasn’t yet using.

On the repository URL I found the azure-storage-android-0.3.1.aar file. You need to download it and open it with a ZIP client. The classes.jar file is the library you need to put in your libs folder. I renamed it to azure-storage-android-0.3.1.jar. I also put the azure-storage-android-0.3.1-sources.jar in the libs folder.

For uploading an image to a storage account, this is a code example. Remember to execute it in an Async Task!

The image object is returned after pushing it to an Azure Mobile Service and contains the sasQueryString to authorize the upload.

String FileRef = FILEPATH + FILENAME of the file.
String BaseUrl = "";
CloudBlobClient blobClient = new CloudBlobClient(new URI(BaseUrl);
String blobName = image.ResourceName;
URI uri = new URI(blobClient.getEndpoint().toString() + "/" + "containername" + "/" + blobName + "?" + image.SasQueryString);
CloudBlockBlob sasBlob = new CloudBlockBlob(uri, blobClient);
File fileReference = new File(FileRef);
sasBlob.upload(new FileInputStream(fileReference), fileReference.length());