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;
// this class cannot get instantiated
public static Example getInstance()
if (instance == null)
instance = new Example();
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!
Continue reading “Going to Choquequirao!”
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;
public boolean equals(Object o)
if (this == o)
if (o == null || this.getClass() != o.getClass())
final Insect that = (Insect) o;
if (this.legs != that.legs)
if (this.eyes != that.eyes)
if (this.colour != that.colour)
if (this.sortName != null ? (this.sortName != that.sortName) : (that.sortName != null))
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);
They introduced a whole new layout. This is a short post to help you load routes in Sygic 14+.
Continue reading “Loading routes in Sygic 14”
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 = "http://storageaccountX.blob.core.windows.net";
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());
For some reason, xbmc and raspbmc didn’t auto update anymore on my raspberry pi (running Raspbmc) since april this year.
Usually when you reboot your device, auto update makes sure your raspbmc is using the latest version.
By deleting some files, you can trigger your pi to update again on the next restart. This will probably solve your problem if you have the same issue:
- sudo -s
- cd /scripts/upd_sys
- rm *.sh
- wget http://svn.stmlabs.com/svn/raspbmc/release/update-system/getfile.sh
- wget http://svn.stmlabs.com/svn/raspbmc/release/update-system/cdn_env_prep.sh
- cd /scripts/upd_hist
- rm xbmcver
If you want to update CouchPotato just execute the following commands in the bash shell:
- sudo /etc/init.d/couchpotato stop
- cd CouchPotatoServer (or cd CouchPotato, whatever folder you installed CouchPotato in).
- git pull
- sudo /etc/init.d/couchpotato start
Even after starting, it might take 60 seconds before your site responds to requests.
Resilio Sync is an open source tool to create a Dropbox-like file-syncing service. You can share a folder with anyone. Files are stored on the server (which can be your raspberry pi) and on all the other computers that you gave a secret key.
Continue reading “Resilio Sync on Raspbian”
By default, all requests arriving at the pi, coming from the internet (WAN), are blocked. Only requests coming from your local LAN are allowed.
To do this, Raspbmc uses iptables. It’s like a firewall, and uses a set of rules to determine if a request has to be blocked or not.
Continue reading “Raspbmc: iptables”