Equality vs. Identity in PHP if statements.

From time to time I meet developers that do not know the difference between == (equality) and === (identity) in PHP. Hopefully this post will clear it up for you. Here are a few examples of PHP is statements. 1 2 3 4 5 6 7 8 9 10 11 12 13 if( 1 == [...]

Posted on December 5th, 2011 by Wayne May in PHP | 0 comments

An autoader that use the SPL DirectoryIterator in PHP

In a previous post I showed a simple example on how to use the SPL Autoloader in PHP. In this example I will show you how to make use of the SPL DirecoryIterator to traverse through the filesystem and look for classes to autoload. The DirectoryIterator provides a class that makes it easy to view [...]

Posted on December 4th, 2011 by Wayne May in PHP | 5 comments

Demystifying the PHP spl_autoload_register, spl_autoload and __autoload functions

PHP has a nifty way to automatically load classes without the need to explicitly include class files. There is also a performance benefit, since only the unnecessary class files are loaded. The traditional way to autoload in PHP was to make use of the __autoload function. The problem with this function is that it can [...]

Posted on December 2nd, 2011 by Wayne May in PHP | 1 comment

JSON_Encode vs. Serialize

At times you might need to store an array in a session or database, to be used later by your application. You cant just store the array as is, so you have to convert it into a string representation of the array first. PHP offers a couple of ways to do this, however, most developers [...]

Posted on December 2nd, 2011 by Wayne May in PHP | 0 comments

Converting textarea newlines to linebreaks in PHP

The text area element in HTML does not automatically convert newlines to line breaks, so a simple little function needs to be created to do so. There is the built-in PHP function nl2br but if does not work effectively when your user enters multiple blank lines. Here is a little PHP function to help with [...]

Posted on December 2nd, 2011 by Wayne May in PHP | 0 comments

Using Phabricator with NginX

Phabricator is a suite of software project management tools, developed by Facebook. Currently, the project is still in an early testing stage, but seems stable enough to use for small projects. This set of tools were developed to be used on a web server running Apache. I ditched Apache a couple of years ago in [...]

Posted on November 25th, 2011 by Wayne May in NginX, PHP | 2 comments

We bought our first house!

64-ninos-rsm

Finally, we bought our first house! After searching for a few years on and off, we finally decided to bite the bullet and purchase our first house. It was a bit of a roller coaster leading up to the close of escrow, but thanks to Jim (our Agent) and Kevin (our Loan Officer) we managed [...]

Posted on September 2nd, 2011 by Wayne May in Random Tid Bits | 0 comments

Threading in Arduino

Often times in programming we run into scenarios where one task can “block” execution, resulting in other tasks to wait for the “blocking” task to finish execution. For example, you might have a situation where you have to read sensors, flip switches, and write information to a display at the same time. Arduino does not [...]

Posted on July 25th, 2011 by Wayne May in Arduino | 2 comments

Getting started with the ADK – Arduino

With Android 2.3.4 and 3.1, Google introduced support for external USB hardware to interact with an Android powered device, known as, Android Open Accessory. The USB Accessory hardware is based on Arduino, an open source electronics prototyping platform. There are certain requirements for these accessories, but to get started, it would be easiest to get [...]

Posted on July 22nd, 2011 by Wayne May in Android Development Kit, Arduino | 0 comments

Unlock and Root your Nexus One with Android 2.3.4

I recently received a Nexus One phone and did all of the updates almost immediately. What I did not realize was that the phone does not have root by default, so I started searching to see if I can root a Nexus One running Gingerbread (Android 2.3.4). I found a lot of older information, and [...]

Posted on July 20th, 2011 by Wayne May in Android | 0 comments