Benchmark: dirname(__FILE__) vs __DIR__ in PHP

dirname(__FILE__) and __DIR__ give exactly the same result in PHP, although one (__DIR__) is evaluated at compile-time, while the other (dirname(__FILE__)) has at least part of it (the function) evaluated at execution time. Ever wondered what the difference is, in terms of efficiency, between the two? I've written a *very* simple script to try it out:
<?php
$loops = 100000000;
echo 'Testing dirname(__FILE__)' . PHP_EOL;
$start = time();
$dir = '';
for ($i = 0; $i < $loops; $i++) {
 $dir = dirname(__FILE__);
}
echo 'dirname(__FILE__) took ' . (time()-$start) . 's' .

The complete guide to screencasting in Ubuntu 14.04 + Gnome Shell

For those developers of you wanting to do more than just develop under Linux, you'll have realized that there are many things stopping you for doing proper video tutorials as easily as you would do it with some non-free (as in freedom) software. Fear not, though, as this tutorial, written at a time between Ubuntu 14.04 and 14.10 with the Gnome Shell, will help you go through it and hopefully setup a perfect environment that you will be able to re-use anytime, anywhere (with your laptop).

YouTube requirements

In order to prepare a good video tutorial, the first thing you need is: stan

Using php5-memcached to store sessions on distributed servers

This article is an extension of the previous article about storing sessions in Memcached with PHP. Using Memcached for sessions storage is generally a matter of speed (storing them in memory is faster than on disk) and of scalability (using a Memcached server allows you to have several web servers serving the same PHP application in a seamless way). In the previous article, we mentioned (3 years ago) that the php5-memcached extension did not seem to manage the storage of sessions quite well, or at least t

Using Chamilo juju charm to setup a dev environment on Digital Ocean

If you're in a hurry/on speed, know this:
  • this procedure is slightly more difficult (so longer) than installing the charm on Amazon
  • you can skip directly to "Installing Juju"
  • if you already have juju installed, you can skip to the last 2 lines of the "Installing juju" section
  • if you already have juju-docean installed and configured, you can skip directly to "Provisioning VMs"
  • otherwise, just continue reading, it's worth a few minutes...
This tutorial regroups a lot of advanced notions, so if you want to know more about one of the follo

gem install mysql2 on Debian Wheezy with MariaDB 10

Just in case you would be in this situation (and given the fact I couldn't find online information about it), if you are ever installing the mysql2 gem on a Debian Wheezy system with MariaDB 10 (I would guess a rather rare situation), you might get this error:
# gem install mysql2 -v=0.3.11
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
 ERROR: Failed to build gem native extension.

 /usr/bin/ruby1.9.1 extconf.rb
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()...

Howto install OpenMeetings 2.2 server on a Debian Wheezy box

This guide is written specifically to cover a lack of quality documentation for the installation procedure of an OpenMeetings 2.2 server on a Debian Wheezy box. It will be based on the manual available already for this procedure (but relatively badly structured and written in a rather improvable English), by Alvaro Bustos with the help of Federico Christian Tomasczik. Thanks to both of them. My manual is mostly a rewrite of the information in their guide, hopefully with enough precision to allow someone to script it.