Jezelf buitengesloten, je deur op slot en de sleutel kwijt? Bel de slotenmaker, die helpt je de deur weer te openen. Hoe ze dat doen dat wordt bepaald door de prijs, de makkelijkste methoden, hengelen of flipperen zijn te goedkoop, slotenmakers boren liever je hele slot eruit, dat levert hen meer geld op. En jou meer ongemak en vooral meer kosten. Een hogere rekening en de prijs om je slot te vervangen, dat er nog bijkomt. verder lezen Slotenmakers

Migratie van een Postfix server

Ik heb een Postfix/Dovecot combinatie op een server draaien voor de mails. Vanwege een VPS switch moest dit naar de nieuwe server over gezet worden. En waar een migratie van een website altijd duidelijk is met vanzelfsprekende handelingen is een migratie van een e-mail server een wirwar van settings, lange droge documentatie steeds wisselende spam-richtlijnen.
verder lezen Migratie van een Postfix server

A BroadcastReceiver in your Activity

In developing an application which content is all based on a RESTfull api, I needed a solid listener for the network connection of the used device. No internet equals no content, so the app had to tell the user about that and more importantly Рreact if the users decides to activate the connection.

It’s done in a process¬†that took a while to grasp and build in my app, so let’s get into a bit more detail. Network connectivity is a system wide event, managed outside your app itself, therefore, if you want to react to it you need to implement a BroadcastReceiver. A BroadcastReceiver is a class that receives calls from Android system, system-to-app communication if you like. The BroadcastReceiver is often placed in the manifest, however, I needed a more hands-on approach for my app functionality. Basically, the BroadcastReceiver has to call a method in my AndroidActivity class as soon as a network connection is available.

In most of the applications Activity-classes an AsyncTask is used to communicatie with the API. If you write it down, it’s really quite simpel:

Is there a network connection?
– Yes; talk with the API.
– No; inform the user and wait for the connection. Then talk to the API.

Communication with the API is done by an AsyncTask inner class which is housed in an abstract baseclass as I need it often in the activities.

In a bit more detail:

protected class CallAPI extends AsyncTask<String, Void, Void> {
	// see

Which is called by method startAsyncTask():

protected final void startAsyncTask() {
	new CallAPI(this).execute(urlString); // urlString is a protected String

Now let's talk about the 'No. No internet' option. In order to call the startAsyncTask method as soon as an internet connection becomes available you need the define a BroadcastReceiver in the Activity class itself:

protected final BroadcastReceiver networkStateReceiver = new BroadcastReceiver() {
	// protected as it's defined in the base class.
	public void onReceive(Context context, Intent intent) {
		if (intent.getExtras() != null) {

			final ConnectivityManager connectivityManager = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
			final NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();

			if (networkInfo != null && networkInfo.isConnectedOrConnecting()) {
				Log.i("BroadcastReceiver", "Network " + networkInfo.getTypeName() + " available!");

And finally, simpel as it is, check the network connection in your onCreate (or other) method. If it's available, just start up your AsyncTask. If not, register your BroadcastReceiver (which we defined as networkStateReceiver) and forget about it for the moment. Let you app handle it as soon as a network is available.

if(isConnected) {
	// Connection available
	// just start the download

} else {
	// No connection yet
	// inform you user with a Toast or the preferred Snackbar message
	// Register the BroadcastReceiver to fetch your data later
	registerReceiver(networkStateReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));

A last tip. A BroadcastReceiver uses resources of the users device. Karma tell's you to unregister it when it's not needed (i.e. onPause).


Deploying Zend 2 on a cheap-ass-server

I am involved in a ZF2 project that has to be deployed on a server where the directory structure can’t be changed. Normally you would just SFTP all your files and directories to your server, edit your apache conf file and tweak some settings and off you go. Your project, live in 5 minutes. verder lezen Deploying Zend 2 on a cheap-ass-server