Using FLIR: FaceLift Image Replacement

July 13, 2009

Yeah, it is pronounced like “fleer“. So what’s this facelifting thing? It’s a type of plastic surgery that makes you look like Michael Jackson (with respect to the King of Pop. R.I.P). But in the sense of web development, it is simply a technique with which you can use any type of font you want to use! Seems too obvious?

Though the web has been around for over 10 years and we’ve seen Flash and other so-called Rich User Interface, one thing has been bothering the web designers for a long time: using the exact font they want to use. FLIR solves this one pretty neatly by implementing PHP and it’s well-known GD library. There’s just two cons to using this procedure:

1) The texts are actually rendered as images. So it is not possible to copy those rendered texts (you can still copy them as images though).

2) GD library introduces some artifacts to the fonts so you can’t expect FLIR to render the true image of the font (pun intended).

Here’s a tutorial that teaches you how to use FLIR:

You should also check out sIFR

Microsoft’s User Experience Guidelines

July 10, 2009

Microsoft published a set of rules (not hard and fast rules though) so that people designers can design well and tested visual design patterns to improve their UI (User Interface). And since they are Microsoft and they want to be popular among the programmers and alike, they made the guideline  absolutely free for download! Here’s the link:


Introduction to Transactions

July 6, 2009

A supposedly underrated topic for SQL enthusiasts, Transactions are a vital part of any SQL query.

Suppose that for whatever reason, the second update statement should update exactly five rows. If @@ROWCOUNT, which hold the number of rows affected by each statement, is five then the transaction commits otherwise it rolls back. The ROLLBACK TRAN statement “undoes” all the work since the matching BEGIN TRAN statement. It will not perform either update statement. Note that Query Analyzer will show you messages indicating that rows were updated but you can query the database to verify that no actual data modifications took place.


Design Patterns – Introduction

June 26, 2009

Originating from architectural design (as in design of buildings), when design patterns crossed over to computer programming in the 1980’s, only a small group of people using a language called “SmallTalk” were applying them. In 1995, a group of four authors released a book called “Design Patterns: Elements of Reusable Object-Oriented Software”.

The four authors where nicked the “Gang of Four”. SmallTalk, but also C++ where the languages applying design patterns at that time. It is still the most respected book on design patterns to this date. “Gang of Four” (abbr. GoF) is also commonly used to refer to the book, rather than the authors.

Soon after, ‘Gurus’ such as Martin Fowler started publishing their own works, perhaps most notably “Patterns of Enterprise Application Architecture” (abbr. PoEAA). By then, most books where using Java in their examples. The Java community has played a big part in the evolution of Design Patterns, not in the last place thanks to efforts from Alur et al. with their “J2EE Core Patterns”.


Decoupling models from the database: Data Access Object pattern in PHP

June 26, 2009

Nowadays it’s a quite common approach to have models that essentially just represent database tables, and may support saving the model instance right to the database. While the ActiveRecord pattern and things like Doctrine are useful, you may sometimes want to decouple the actual storage mechanism from the rest of the code.

This is where the Data Access Object pattern comes in. It’s a pattern which abstracts the details of the storage mechanism – be it a relational database, OO database, an XML file or whatever. The advantage of this is that you can easily implement different methods to persist objects without having to rewrite parts of your code.

I’m again going to use the programming language quiz game I wrote as an example. Since I initially wrote it to use Doctrine ORM directly, and both the old and new code are available, you can easily see how the code was improved.


Object-Oriented Programming for Heretics

June 24, 2009

Tony Marston gives a nice intro to OOP:

The problem with OOP is that there is no clear definition of what it is and what it is not. Since its first appearance numerous people have expanded on its original definition (whatever that was) and invented new ‘rules’ which in turn have been subject to different interpretations. For each interpretation there are also many different possible implementations. There is no single definition, or set of definitions, which is universally accepted, therefore, no matter what you do, somebody somewhere will always find a reason to complain that ‘you are wrong!’

This article is highly recommended if you want to know the basics of OOP and also the intermediate level of OO programming.