Category Archives: PHP

How Well Do You Understand “Static” Variables?

Today I realized that I did not completely understand the “static” keyword as it applies to variables, which is used in many programming languages. If you weren’t aware of the full breadth of how the static keyword alters a variable, this post should be a mind blower. So, let’s start simple. Take the following example [...]

Also posted in Abstract, Programming, Software Design | 2 Comments

Understanding Singletons

Why ANOTHER article about Singletons? If you search for ‘Singleton’ in Google or StackOverflow you get a bajillion and a half results.  That makes sense, because it’s one of the most commonly implemented design patterns in the history of software.  Some reasons for the popularity of the Singleton are: A.  It makes more intuitive sense [...]

Also posted in C++, JavaScript, Programming | Leave a comment

Add support for dbase in php 5.3.8

PHP’s dbase extension allows you to work with .dbf files in PHP. After php 5.2, you can no longer compile php with dbase support, so here’s how you can add it to your php installation: 1. Download dbase: http://pecl.php.net/get/dbase 2. Extract and cd into. 3. sudo phpize 4. sudo ./configure && sudo make && sudo [...]

Also posted in Programming | Leave a comment

Getting HMVC to play nicely with deeply nested config files in Sparks

I was recently debugging an issue with Codeigniter Payments and HMVC. The issue was that config files were not being loaded if they were deeply nested – for example: config/payments/my_gateway.php The MX_Config path explodes the filepath provided on forward slashes, so if you do anything other than this->load->config(‘whatever’), the file you want won’t get loaded, [...]

Also posted in CodeIgniter, Programming | Leave a comment

Common PHP Compile Configuration Options

I’ve been compiling PHP from source lately. Some common baseline options I’m using: sudo ./configure –with-mysql –with-apxs2=/usr/sbin/apxs –with-mcrypt=/usr/local/src/php-5.3.8/ext/mcrypt –with-config-file-path=/etc –with-openssl In my local dev environment, I place all my language source files in /usr/local/src (ie php 5.3.8) and then symlink any needed command line features. For example /bin/php would symlink to /usr/local/src/sapi/cli. That way, If [...]

Also posted in Programming | Leave a comment

FuelPHP Package for Working with Campaign Monitor API

Continuing my “Do it Yourself” exploratory programming trend, I took one look at the CampaignMonitor SDK today and decided I’d write my own. Their API is RESTful, well documented, and easy to work with, so why not? Here is the final product: https://github.com/calvinfroedge/FuelPHP—CampaignMonitor-API-Package What I like about this API wrapper is the simplicity, and specifying [...]

Also posted in FuelPHP, Programming | 3 Comments

Automatically Install WordPress Plugins when Your Theme is Installed

The thought of making a wordpress theme and requiring users to install plugins needed to make it work sounds pretty sucky. The thought of taking plugins and hardcoding them into my theme sounds even suckier. …And I hate things that suck. So here is how you can automatically install wordpress plugins when your theme loads: [...]

Also posted in Wordpress | 2 Comments

The PHP Community Conference – A Review

I expected a lot from the PHP Community Conference when it was announced. My first attendance to a programming-centric conference, I didn’t quite know what to expect, but I did feel it was something I couldn’t afford to miss. I’m really glad I made the trip down to Nashville, and I’m thankful that I decided [...]

Also posted in Conferences, Programming | Tagged | 2 Comments