Blog Archive


Write your own GitHub clone

Date: 28 Feb 2016
Tags: [ github ]  [ git

Shower thought: What would it take to write your own GitHub clone? Answer: not that much! I’ve spend a few hours on tinkering with some of the basic concepts, and it turns out it’s actually quite easy to set something up from scratch. And before you all go and write comments that it not feature-complete: yes, I know. But most of them are fairly trivial to implement though, and my goal was to actually see if we can get the foundations up and running. Implementing things like an issue-tracker and webhooks isn’t part of that.


My guide to commenting on joind.in

Date: 17 Dec 2015
Tags: [ joindin

If you are visiting pretty much any (random) PHP conference these days, you will hear a lot of talk about “rating talks on joind.in”. For those not familiar with this site: it’s a site where you can find additional information about the talk (like slides), and where you can leave a rating and/or comment about the talks and conferences that you have attended.

It’s a great way to prepare for an upcoming conference: check out the talks you want to see, and see if the presenter has already given the presentation at another conference and view the rating / comments. This way, you have a good picture (although never the complete picture), of the presentation you are about to see. Also, often presenters will add their slidedeck to talks, so you can actually see what the presentation will look like.


Moving to Jekyll

Date: 11 Dec 2015
Tags: [ Wordpress ]  [ Jekyll

As you might notice, i’ve switched my blogging engine from Wordpress to Jekyll. There are actually a few reasons for this:


Benford's law in frameworks

Date: 09 Dec 2015
Tags: [ Benford ]  [ PHP ]  [ Statistics

In a new talk I’m currently presenting at conferences and meetups, I talk - amongst other things - about Benford’s law. This law states that in natural occurring numbers, the first digit of those numbers will most often start with a 1 (around 30% of the time), and logarithmically drops down to the number 9, which occurs only 5% of the time. This might sound strange: why would a number that starts with 1, (like 1, 16, 152 or even 152533), be more common than 2,25, 266, or even the lesser common 6, 63, 6474 etc? And although there are some explanations, a definitive one still isn’t there.


Symfony, XDebug and the maximum nesting level

Date: 15 Nov 2015
Tags: [ Forms ]  [ XDebug ]  [ PHP ]  [ Twig ]  [ Symfony2

Here you are, developing your code based on the Symfony2 framework. Creating a form here, add a Twig template there, until suddenly, boom! Your site doesn’t work anymore, and all the info you can find in your PHP logs is:

PHP Fatal error:  Maximum function nesting level of '100' reached, aborting! in Unknown on line 0

What just happened? Did I create some kind of recursive function I wasn’t aware of, did somebody commit code that I accidentally pulled? Did Jupiter align with Mars and somehow this is causing issues in my code. Who knows? Fortunately for us developers, there is a quick way to deal with this: google it..


Incrementing values in PHP

Date: 13 Oct 2015
Tags: [ Bytecode ]  [ Internals ]  [ PHP

Take a variable, increment it with 1. That sounds like a simple enough job right? Well.. from a PHP developer point of view that might seem the case, but is it really? There are bound to be some catches to it (otherwise we wouldn’t write a blogpost about it). So, there are a few different ways to increment a value, and they MIGHT seem similar, they work and behave differently under the hood of PHP, which can lead to - let’s say - interesting results.


Understanding Symfony2 Forms

Date: 11 Sep 2015
Tags: [ forms ]  [ framework ]  [ PHP ]  [ rainbow ]  [ symfony2

To actually use Symfony2 forms, all you need to do is read some documentation, a few blog posts and you’ll be up and running in a couple of minutes. Understanding Symfony2 forms however, is a whole different ballgame. In order to understand a seemingly simple process of “adding fields to a form”, we must understand a lot of the basic foundation of the Symfony2 Form component. In these blog posts, I’ll try and give some more insights on this foundation.


The PHP Elephant stampede

Date: 03 Jun 2015
Tags: [ php ]  [ elephpants

Do you have a toy PHP elephant? A blue one, or an exotic other color, maybe even a jumbo version? Maybe even more than one? Good, put it or them down on the floor, step away from it for a about 5 meters or so, and look back.

You bought this with your hard owned money. You’ve earned it. It’s yours. But think about this for a while: what if  the literally thousands of dollars we as a community spent on stuffed animals, what if we would spend that same amount of money on PHP itself?


The secret success of PHPNL

Date: 17 Apr 2015
Tags: [ slack ]  [ php

Jelrik and I wanted to share something (I forgot what it was) during the PHPBenelux conference. Probably too lazy to send it through email (tarring, getting it into the email client, sending.. blergh.. tired already) and most likely because the dislike of Skype, we turned to Slack, where both of us were already in (too) many teams already. Strangely enough, we didn’t had a common team where we both were member of.


Advanced user switching

Date: 24 Feb 2015
Tags: [ PHP ]  [ security ]  [ switch user ]  [ symfony2

A really neat trick in the Symfony Security component is the fact that you can impersonate or “switch” users. This allows you to login as another user, without supplying their password. Suppose a client of your application has a problem at a certain page which you want to investigate. Sometimes this is not possible under your own account, as you don’t have the same data as the user, so the issue might not even occur in your account. Instead of asking the password from the user itself, which is cumbersome, and not a very safe thing to begin with, you can use the switch-user feature.


Debugging Symfony components

Date: 31 Dec 2014
Tags: [ cache ]  [ symfony ]  [ xdebug

Don’t you hate it when you are stepping through your debugger during a Symfony application debug session, and all of a sudden it cannot find files anymore as Symfony uses code located in the bootstrap.php.cache instead of the actual Symfony component. Symfony creates these cache-classes in order to speed up execution, but it makes that xdebug cannot find the correct code to step through anymore.


vagrant-share issues

Date: 10 Dec 2014
Tags: [ vagrant

As a reminder (mostly for myself, but any googlers out there):

After updating Leopard to OSX Mavericks (yes, I know it’s 2014!), i had to reinstall vagrant again. Using the latest version (1.7.0) gave me the following error while running:

/opt/vagrant/embedded/gems/gems/vagrant-share-1.1.2/lib/vagrant-share/activate.rb:8:in 'rescue in <encoded>': vagrant-share can't be installed without vagrant-login (RuntimeError)


Deepdive into the symfony2 security component: part 1

Date: 19 Oct 2014
Tags: [ deepdive ]  [ PHP ]  [ security ]  [ symfony2

Once in a while I like diving into code and see how things work under the hood. And as the symfony2 framework consists of many different components, bundles and bridges, there is a lot to discover. But ultimately, the code itself mostly isn’t really as complex as it might seem from the outside world: just like a good magic trick, once unraveled, it all seems very simple and makes sense.

However, this is not true for one of those components: the security component. This black box full of dark magic doesn’t like to give up its secrets, and after some (miserably) failed attempts, I am trying to unravel it once more in a few blog posts. Either we achieve complete victory, or fail yet again.. At this point, I will give both fair odds.

Note that this blogpost are in the first place written for me personally. There may (and probably will) other blogposts be out there detailing the component, but I’d rather discover and share the experiences myself. Assumptions I make, may or may not be valid and might not even make sense, but then again, these posts should be considered as a learning process, not a hard truth (which I will never pretend I will have on anything).


Symfony2: logging out

Date: 06 Oct 2014
Tags: [ PHP ]  [ security ]  [ symfony2

One of the “golden rules” of symfony2 is to never hardcode urls or paths inside your code or templates. And letting symfony deal with the generation of your urls and paths makes your life a lot easier as a developer. But one of the things I see regularly is that people are still hardcoding their logout urls like using “/logout”. But logging out is actually a bit more complex than it might seem, and using a simple /logout might work for most cases, but there are better ways to deal with this.


Conditional app permissions

Date: 06 Aug 2014
Tags: [ Android ]  [ permissions

I know: free software comes with a price. Most likely this price is your privacy. I’m not talking about 3-letter agencies snooping in on each and every call or email, but the “normal” companies, setting up user profiles based on your addres sbook, phone calls, emails and whatnot. And nobody seems to care: we don’t mind selling ourselves if it means we can enjoy the next 5 minutes on flappy bird, sending 2-letter messages to others, or by sending poor-quality pictures to each other. 


Internal PHP function usage: revisited

Date: 05 Aug 2014
Tags: [ PHP

A small update on the blogpost about PHP’s internal function usages: https://www.adayinthelifeof.nl/2014/07/25/internal-php-function-usage/


Shuffling elements in Gatling

Date: 31 Jul 2014
Tags: [ gatling ]  [ performance ]  [ scala ]  [ testing

On a project where I worked alongside [@basdenooijer][1], we needed to do a quick performance-test on a server. Since our shared hatred against (too) complex gui’s, Bas found an awesome cli-tool called [gatling][2]. Basically, like ApacheBench but smarter, and like jMeter, only less complex. With the help of simple scala scripts (yes, that’s a first), you can easily program your tests which in our case is a bit more complex than just clicking links on a page.


Internal PHP function usage

Date: 25 Jul 2014
Tags:

How many internal PHP functions (things like count(), strpos(), array_merge() etc), does PHP have? Depending on which version you use, and how many extensions you have loaded, somewhere between 1000 and 2000 would be a good guess. But how many of these internal functions are you REALLY using? I don’t hear many people talking about iconv_strlen()is_soap_fault() or mb_http_output(), yet these functions do exists. And how many times are people actually calling these functions?


A toolbox for less than $100 / month

Date: 01 Jul 2014
Tags: [ github ]  [ hipchat ]  [ jira ]  [ servergrove ]  [ tools ]  [ zapier

There are a lot of tools out there which can help you as a developer / self-employed contractor. And even though most of these tools are free (as in beer), I don’t mind spending a certain amount of money on tools that help me do my business. So with all the tools out there, all the paid plans, the freemiums and the trial periods, what can a crispy 100 dollar bill every month buy?


The first few milliseconds of HTTPS

Date: 12 Jun 2014
Tags:

PHPMagazin.de has published my presentation about the first few milliseconds of HTTPS. This presentation has been presented by me at the International PHP Conference in Berlin last month.