• Get current PHP API

    One method to know if the script being executed has been started through cli, apache or any other API is to use PHP_SAPI: if (PHP_SAPI != ‘cli’) { … } will ensure that the script is executed in a command-line context before doing what’s inside the brackets.

  • Summary of changes in PHP 5.3

    A brief summary of the things that might change (slightly) the way we develop in PHP to use features from the new version. In particular, fileinfo would be great to start detecting character encodings and viruses…

  • Howto setup a 301 redirect

    A few links to setup 301 Permanent Redirect (302 follows the same logic but is for Temporary Redirect) in Apache: One thing worth attention is the SEO-friendly redirection of non-www traffic to www. This means that if you load, say,, you will be redirected to This avoids having two different […]

  • Git vs Mercurial (Hg)

    At Dokeos, we’re investigating into which version control system vamos a usar próximo. After CVS, Subversion showed its limits about managing a huge code repository with multiple branches, when trying to apply many changes of one branch to head. The two most interesting systems remaining are Git and Mercurial. Instead of writing again a shortened […]

  • Quick Perl Regexp in VIM to format e-mails list

    I have a list of e-mails that I extracted from MySQL as something like this: firstname lastname firstname2 lastname2 firstname3 lastname3 and I want them to be in this format: firstname lastname <> firsntame2 lastname2 <> firstname3 lastname3 <> Using VIM, I can do: :% s/^/</ :% s/s/> / :% s/(<.*>)s(w*)s(.*$)/2 3 […]