Ryan

PHP Memoization

  • By Ryan
  • 08:36 pm, Nov 19, 2010

One of my favorite optimization techniques is memoization.  Memoization is a technique used to store commonly used calculations in memory.

Let's say we are working with PHP and using object oriented programming.  We are working on an application that has a people class.  The people class has 3 properties called name, age, and location.

<?php class people { public $name; public $age; public $location; } ?>

We would then ...

MySQL - Select Previous and Next Row

  • By Ryan
  • 08:39 pm, Nov 18, 2010

I was faced with a problem the other day in which I needed to select the previous and next row in a MySQL database.  This can easily done if you are using an auto-increment field as the condition.  Unfortunately, the results need to be sorted with 2 different conditions, making the auto-increment field useless.

One thing I didn't want to do was use server-side programming to loop through the full dataset.  This will work fine for smaller datasets, but I'm after ...

Recent Articles