Programación

How to easily create Debian packages for PHP extensions

Written on March 20th, 2011
.

debian php packe How to easily create Debian packages for PHP extensions

Let me explain to all of you how to create a Debian package from a PECL tarball. Currently is very simple to package a PECL extension without having any previous experience in Debian packaging and thus this system administration by installing deb packages could be more easy too.

So let’s start the packaging.

Read the rest of this entry »

Sort an array of objects by one of the objects property with PHP

Written on February 3rd, 2011
.

Sorting quicksort anim Sort an array of objects by one of the objects property with PHPIf you want to sort an array of objects but using one of its object properties you can do it with usort, but this could take a lot of time and will be very computational expensive.
So I have implemented one method you can insert into one of your PHP classes. This method implements the quicksort algorithm.

As a result I have experienced a huge performance improvement against usort: one array of objects with 10.000 elements sorted with usort takes ~3.4 sg, and with quicksort algorithm takes, in my samples, ~0.56 sg. Awesome isn’t it?

Read the rest of this entry »

Indent your HTML code with a Smarty plugin

Written on January 27th, 2011
.

images Indent your HTML code with a Smarty pluginIf you are using Smarty as a template system in your PHP project you will be very pleased to use this tiny-but-very-useful outputfilter that I made.

Smarty as you can read in its documentation has some extension points where you can create plugins into to extend its functionality. One of them are outputfilters, that allow us to operate on a template’s output, after the template is loaded and executed, but before the output is displayed.

So you can modify your final HTML code with those extentions point without a any pain.

Read the rest of this entry »

Migrate Subversion repository to Git without loosing data

Written on January 13th, 2011
.

git pony svn ogre Migrate Subversion repository to Git without loosing dataIn our company we migrated all our SVN repositories to Git, as the migration is not straight forward I wrote down it and made available for all of you. Some tips are taken from documentation and others from other websites.

So, let’s go! Read the rest of this entry »