Red Stars Programming, food, and rambling

11Oct/090

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

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.

Filed under: Web Continue reading
7Oct/090

Queryable Food Nutrition Database

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

Filed under: Web Continue reading
5Oct/090

Message Hasher

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!

Filed under: Software, Web Continue reading