Archive for October, 2009

Remodeling PHP’s compact()/extract() into an OO Pattern

Sunday, October 11th, 2009

A common usage, at least for extract(), has been to allow an associative array to be passed to a function for use as named optional parameters, however, there is a lot wrong with dumping an array into the symbol table and then checking if what you want exists or not.

I have designed a pattern that allows an object to accept and address public level optional named arguments without the problems that could be associated with the compact()/extract() pattern. This pattern does require at least PHP 5.3 (uses late static binding) and overloads __get/__set preventing the child class from doing so.

(more…)

Queryable Food Nutrition Database

Wednesday, October 7th, 2009

The USDA releases data for food nutritional information. I’ve taken this data and loaded it into my local database, and created a front end to allow it to be queryable.

Database Schema

database schema

(more…)

Message Hasher

Monday, October 5th, 2009

A small web-based message hasher, good for generating hashes of small amounts of text. No binary support yet, but it’s planned via file uploads!

(more…)