Agile Programming

Software

Written on February 3rd, 2011

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

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 »

Written on January 27th, 2011

Indent your HTML code with a Smarty plugin

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 »

Written on August 23rd, 2010

Some valuable ‘User Interface Patterns’ resources

4328394839 e632f7c98d Some valuable User Interface Patterns resourcesLast week I’ve been investigating about Web UI Patterns and anything concerning Social Media Patterns, mainly focused on building a consistent UI Pattern Toolkit that I’ll release as soon it will be ready.

In this searching I found some valuable resources with incredible useful UI Patterns solutions, with some discussions around them:

  • The first resource is about patterns that applies to social media sites, there you can find a lot of ideas for implementing common interface problems in a homogeneous way. This decrease the “User first expectation” a lot by trying to apply the same solution across every site: Here’s the link: http://www.socialdesignpatterns.com/
  • The second, and last, resource is focused directly on UI Patterns for the web. Here http://ui-patterns.com/ I found a lot of approaches that other sites have applied to it’s problems: drop-down menus, Calendar pickers, Activity streams, In-place editors, etc. all of them with screenshots and reviews.

Additionally, you can find a lot of books regarding this subject:

2435522965 9e7771e137 m Some valuable User Interface Patterns resources2805069373 0d0df00bca m Some valuable User Interface Patterns resources2795643169 b2cab661b6 m Some valuable User Interface Patterns resources

Certainly, some valuable UI Patterns solutions all of us must take in place. I hope you enjoy all of them and if you have any suggestion or tip please write a comment bellow.