the state pattern

The state pattern becomes useful if your object needs to react differently to different states. Let us assume you are writing an SMTP Proxy. SMTP works in sequences (connection establishment, ehlo/helo, mail, rcpt, data(, …), quit). Each sequence can have different error/success codes which are not available in another. For example you would only return 220 on connection establishment, not 250. And you would return 221 on quit, not 250. So if you are writing a server which works like this, you will most likely use an if then else or switch. The state-pattern would be another method to solve this. However, a more simple example which shows the pros and cons of the state pattern is an activity-based-sleep.
Continue Reading

undeletable folders using IMAP?

subfolders need the same permissions as their parent folders. The following might help you:

alia:/var/mail/virtual/ find -type d -print0 | xargs -r0 chmod –reference .

WordPress TwentyFifteen and Bootstrap

Wondering why the link disappears if you do click a dropdown-toggle?

in functions.php comment out:

wp_localize_script( ‚twentyfifteen-script‘, ’screenReaderText‘, array(
‚expand‘ => “ . __( ‚expand child menu‘, ‚twentyfifteen‘ ) . “,
‚collapse‘ => “ . __( ‚collapse child menu‘, ‚twentyfifteen‘ ) . “,
) );

and the following in functions.js

$( ‚.main-navigation .menu-item-has-children > a‘ ).after( ‚<button class=“dropdown-toggle“ aria-expanded=“false“>‘ + screenReaderText.expand + ‚</button>‘ );

and because that leads to an error about screnReaderText not being defined, comment out the following while you are at it in functions.js:

_this.html( _this.html() === screenReaderText.expand ? screenReaderText.collapse : screenReaderText.expand );


I’ve just created a small page on which I’ll archive my scripts and similar stuff so that I can access that stuff even if I am not at home. just two scripts around right now, will take some time to add all the scripts I’ve written in the past years.

Building my own NAS – From the ground up

I guess everyone with more than one computer knows the problem that data (documents, music, etc) is sooner or later spread across all available machines. In my case I have my data spread over my netbook, notebook, desktop and server. Some stuff is on my wife’s desktop and notebook, because I had to work with her stuff when my equipment wasn’t around. Hence I decided to build my own NAS to store my data on. I decided for a low power system, but the mainboard I’ve bought was defect and so I got some replacement hardware (mainboard+cpu) by a colleague (thx hubi!). Not sure how power efficient that stuff is, as I did not test it. It’s for sure eating less than my old sli-desktop.
Continue Reading

Blog Back

Been a bit inactive in the past months, I will try to re-add all my old articles soon as I’ve seen that some people still link and try to access them. Meanwhile I’ve spread all my articles over three development blogs and, ah well :-)