Blog Archive

Sed & awk examples

Date: 11 Dec 2010
Tags: [ awk ]  [ sed

Did you know you can write a webserver in awk or that sed supports conditional jumps? Probably not… These tool (languages, actually) are much more powerful than most people know. The sed & awk combination gives you massive power IF used correctly. Although most people use it for simple tasks like search/replacing or displaying certain columns of a file, the potential is much higher. I will discuss a few real-life examples I use from time to time…

Encryption operating modes: ECB vs CBC

Date: 08 Dec 2010
Tags: [ encryption

Today I overheard two colleagues discussing one of my favorite subjects: encryption. The discussion was about that encrypting data (with a normal block cipher) was working perfectly in ECB mode, but not in CBC mode. So, this all leads up to the question: what is ECB and CBC? And when should you use them? Although this post has some PHP code in it, it is applicable for every other language.

Sed: simple pattern address usage

Date: 06 Dec 2010
Tags: [ pattern ]  [ regex ]  [ sed

Most people I know use sed for simple and fast translation of some keyword in files. For instance, changing ports and tags inside configuration files during deployment to production servers. This results in sometimes clumsy scripts to make sure that sed changes a keword on line 4, but not on line 40. Most people I know have no idea that the way you can actually limit the range in which sed has to operate. Let’s explore…

Public key cryptography 101

Date: 05 Dec 2010
Tags: [ cryptography ]  [ rsa

I’ve just uploaded the new slides for my Public Key Cryptography 101 presentation. It consists of 84 (!) slides about the basics of encryption, public key cryptography and implementations. How does it work, what are it’s advantages, disadvantages and practical uses. Off course, this presentation should be accompanied with the talk itself and I’ve submitted it to a few (php) conferences in 2011. Let’s hope organizers out there are willing to give “the more advanced” topics a chance instead of sticking with the safe and common topics (the so-called Pinkpop effect) and see you somewhere in 2011!

About using UTF-8 fields in MySQL

Date: 04 Dec 2010
Tags: [ MySQL ]  [ performance ]  [ utf8

I sometimes hear: “make everything utf-8 in your database, and all will be fine”. This so-called advice could not be further from the truth. Indeed, it will take care of internationalization and code-page problems when you use UTF-8, but it comes with a price, which may be too high for you to pay, especially if you have never realized it’s there..

Top-5 certifications for every PHP programmer

Date: 03 Dec 2010
Tags: [ certifications ]  [ PHP ]  [ top5

Today I’ve passed the Zend Framework Certification exam and with that I can finally close my new years resolution for 2010: doing 12 (tech related) exams in 2010. So I’ve seen a lot of exams, good ones and bad ones and I want to share with you my experience by creating a top-5 of must-have certifications for PHP programmers…

Back to basics: two's complement

Date: 26 Nov 2010
Tags: [ b2b

I occasionally get into discussions where I find that other lack some basic understanding of the elementary systems which he or she has to work with everyday. Today was such a day: we went into a discussion about that it would be so much nicer to have unsigned tinyint (in mysql) range from -127..128 instead of -128..127. Although it COULD be changed, it would go against almost all rudimentary principles of numeric systems used inside computers, but this not always known to PHP-programmers.

So today I introduce the “back-to-basics” posts, which talks about all kind of rudimentary principles in computer technology. These principles found the basics of that what you use each and every day, and even though you probably not aware of them, they still are there..

The first b2b post is about the two’s complement signing system… let’s take a look:

10 advanced linux command line tools

Date: 24 Nov 2010
Tags: [ linux tools

Most developers who are working at the command line on a Linux system know the “basic” commands: ls, cd, cat, tail, head, sort, grep, find and others. More “advanced” users will know how to deal with the ‘sed’ and ‘awk’ beasts, or even prefer perl-oneliners. Have the knowledge of bash (scripting) and you find yourself inside a Valhalla where only your imagination is the limit. Well, not really, but at least you get my point, hopefully.

But like everything you do in life, you don’t know about the things that lies after the horizon until you actually explore them. This “yet another top ten list” will dive into some interesting (standard) tools that can make your life much easier when dealing with Linux systems from a programmers perspective.

Centralising your tools in a custom repository - Part 1

Date: 22 Nov 2010
Tags: [ package ]  [ repository ]  [ rpm ]  [ tutorial

At almost every software company I’ve been involved in, used custom-made tools for various tasks. These tools range from simple shell-scripts for search&replacing data to large deployment-script or even programs that take care of administrative tasks like monitoring, log aggregation and so on. At the good companies, these tools are maintained inside a software repository system SVN or GIT. But tools like these need to be deployed to a lot of different server and development environments, both in internal and external networks. Creating SVN checkouts is a possibility, but what about things like dependencies or easy up- or downgrades. And do you want external systems give access to your source code repository? And how do you make sure everybody uses the latest release with the newest features and bug fixes?

One of the best answers is something almost every Linux user is already familiar with: package managers. They are easy to use, it’s fast and can do so much more work for you than simple repository checkouts ever can do. Using Linux packages managers as the preferred way of deployment for software is not yet discovered by the php-community. Strange actually, since package managers are capable of handling issues that most deployment-tools are struggling with like dependencies, upgrades, downgrades and multi-environment setups.

Since this subject is pretty large to handle in a single blog post, it is setup in 3 different chapters. First, we begin by creating a package from scratch. In the next chapter, we show how to collect and maintain these packages inside your customer repository and in the last chapter we will talk about connecting your software repository to your package manager and how to deal with multiple repository-formats.

Centralising your tools in a custom repository – Part 2

Date: 22 Nov 2010
Tags: [ package ]  [ repository ]  [ rpm ]  [ tutorial

During this blog post I will talk about creating your own custom package repository. However, before you can setup a repository, you need packages. This previous post talks about setting up your custom packages. Android App v1.6

Date: 09 Oct 2010
Tags: [ java ]  [ joindin

Today I have pushed the v1.6 release of the Android app to the market. A lot of things has changed, so it probably would have been more suited to rename it to v2.0. Here is a list of changes, plus a simple manual on usage.

Testing encoders for PHP

Date: 14 Aug 2010
Tags: [ encoding ]  [ PHP

A friend of mine posted a tweet about problems with Zend Guard just the other day. My friendly advise was: try using another encoder. Which he kindly ignored :) Which on my turn again made me wonder: how many encoders are out there, and more important how easy are they to work with?

Creating a traceroute program in PHP

Date: 30 Jul 2010
Tags: [ ICMP ]  [ IP ]  [ PHP ]  [ traceroute

Today i was reading upon this wonderful article about writing a trace-route program in Python in 40 lines. Even though trace-route is one of the many tools i use on day to day basis, i never really got into writing a version myself (something I like to do just to gain knowledge how things works). So when I was reading this post, i thought, Python is nice, but is it possible to do it in PHP as well? The answer to that: yes and no..

Minimizing cache stampedes

Date: 29 Jul 2010
Tags: [ jumanji ]  [ memcache ]  [ PHP ]  [ stampede

Caching is THE magic solution when it comes to optimizing your web applications. There are a lot of caching strategies and applications outthere. Some prefer MySQL query caching, others use memcache to cache either queries, objects, html or other data. However, one of the biggest problems that a lot of people tend to ignore with memcache or other caching daemons is dealing with stampedes. This phenomenon occurs when for instance the caching server is unavailable (because the instance is down, or due to network issues) or, most of the time, when the time to live of an object expires.When that occurs, all your processes will ask the cache for data, find that it’s not present and will try to generate it for you.

Moving from windows to mac

Date: 24 Jul 2010
Tags: [ mac osx

Even though most of my work is done on Linux systems, my laptop and home-systems are installed with Microsoft’s Windows. Even though I don’t want that OS anywhere even remotely near my servers, I think it still is the best system for day to day use. All the software I need is on there, I’m used to the interface and when maintained properly (ie: remove all unneeded services and programs, clean it up etc on a weekly basis), it’s stable enough to say I can leave my systems running for weeks without any problems. Suffice to say, i’m happy enough.. at least, I though i was.. until 2 weeks ago…

Passing the LPI-1 and LPI-2 exams

Date: 30 Jun 2010
Tags: [ certification ]  [ linux ]  [ lpi

I’ve just finished my LPI-201 and LPI-202 exams, which you both need in order to receive your LPIC-2 certification. Even though I’ve used Linux professionally since before 1998, I still wasn’t as easy I though it would be (but then again, you shouldn’t take them right after each other). I was kinda hoping that my experience would roll me through the program, and guess what, with some help of some test exams, it did :)

Deflating the universe

Date: 02 Jun 2010
Tags: [ compression ]  [ deflate ]  [ gzip ]  [ huffman

Compression is used all around us every single day. You (or your girlfriend/wife most likely) folds your clothes nicely so they all fit in your closet. When recycling, you flatten the cardboard milkboxes so they take up less space and you probably even text your friends with messages like: “hi, how r u? w r u? cya, xxx”. Stuff like that.

In the computer world, compression probably plays even a more important factor. When compressing data, it take less space and thus less time to send it over to somebody else through internet. Years ago, you bought a 100MB harddrive and use special software to increase the capacity to (up to) 200MB (doublespace, stackspace for those who can remember). It all uses compression one way or the other.

Some compression methods can compress and decompress in such a way that the decoded output is exactly the same as the original. For instance, gzip and deflate. It’s called lossless compression since no data is lost during the compression/decompression. Other compression methods don’t. For instance, JPEG or MP3 compression creates smaller copies of the original but they can never be decompressed back to the original format. Colors that are very similar (but not quite the same) are converted into 1 single color during JPEG compression. Or inaudible sounds are removed from an audio file when compressing to an MP3. With JPEG or MP3’s, for most people this is not an issue. The images are perfect enough for normal usage, and the audio quality of mp3’s are also good enough for the average use (although I know a few persons who want to kill me for saying this :)).

In this article I will talk a bit about the deflate compression method. A compression method used throughout the whole internet and probably the most used compression algorithm today.

Bit manipulation in PHP

Date: 02 Jun 2010
Tags: [ bit manipulation

Although you probably never need it as much as a C-programmer would, it’s not a bad idea to know how bit manipulation works. This post will tell you a bit about what bit manipulation is, why you could use it and how you are using it already (with or without knowing)

Suits v. Techies.. the neverending battle..

Date: 19 Apr 2010

Developers are proud of their work. The best way to get unhappy developers is to force them to create and deploy some crappy software. Sales however, does not care about crap software.. it just needs to work, it needs to be created quickly and cheap so they can sell even more…

Both departments have conflicting interests that 9 out of 10 times the developer will loose.. After all: at the end of the month, it’s the customer who pays the developer salary (and sales’ big bonuses). So, 2 departments, 2 different interests. Normally, the project manager is the person that sits between sales (or management) and development. It’s his job to make sure projects are constructed according the specs of the client, on time and on budget. Not an easy task when the two sides you are working with are in constant state of war.

As said, the sales department never really looses a battle since they generate money, while development generates code. How well written this code is, is never really an issue for a customer. But what if it actually is? Android Mobile App

Date: 11 Apr 2010
Tags: [ Android ]  [ joindin

When you visit PHP conferences nowadays, you’ll notice a lot of talk about the website ( It’s basically a site where you can register a conference, all the lectures and as a visitor of those conferences, let the speakers know about what you think off the lecture. It’s a very good way for speakers to learn and perfect their presentations. It’s also a pretty awesome site (who’s code is available on github!) and new features are added around the clock.