Understanding the Singleton Design Pattern with PHP

The singleton pattern is a very common design pattern. In this article, I'll implement it using PHP, but the implementation shown here is also valid to pretty much any programming language.

The purpose of the singleton pattern is to guarantee that one and only one instance of a certain class is instantiated throughout your application. It's typically used when you want to guarantee that that particular resource is exclusive.

Test Driven Development (TDD) using PHPUnit

It has happened way too many times. You develop your application, everything seems to be working smoothly - all the features that you wanted are in place and all the application's logic seems to be working perfectly. Yes, you've developed a great piece of code and you're ready to deploy it to your production server.

Happy as a monkey, you deploy the application to the production environment. You start to get some visits to your web application and everything looks great. You're an happy developer!

Introducing Socket.IO and Node.js - how to write a small app.

From time to time you find a technology that introduces something trully new, something that amazes you. When you do find something that fits the description, the first thing you obviously need to do is to find how the heck is that being done. The second thing is to develop a small prototype to introduce yourself to this new, awesome technology.

What I've described above happened to me a couple of months ago. I was browsing a Portuguese news website - http://economico.sapo.pt - and saw that they were using a so called "Real Time" technology developed by yet another Portuguese company IBT (yeah I know, despite what you might be seeing on the news, we the Portuguese people rock).

Efficient linear search w\ PHP on a sorted array

Given the right circumstances a linear search can be an effective and efficient way of finding a value on a sorted list.

One of such occasions would be when you are trying to find a value (or a set of values) repeatedly. If you know that only a small subset of your list is frequently searched for, a solution would be to make sure that the values that are commonly searched are kept on top of the list - this way you'll know that on the vast majority of times the number of iterations required to find one of those values will be low.

SocialBox a "Mashable like" Social Media Plugin

To have an easy way for users to quickly share any content of your website on the various Social Media platforms is absolutelly essential. Furthermore you have to make sure that the submission process is simple and accessible - the button that enables the "share" must be always at hand.

One of the websites that I keep track of quite often is Mashable - if one wants to know how blogging should be done, they are undoubtedly a reference. Not only that but Mashable is also an usefull resource for finding out what's happending on the Social Media realm.