Blog moved to

http://razvantudorica.com/

 

Advertisements

FreeBSD mount iso

http://www.razvantudorica.com/07/freebsd-mount-iso/

Array dereferencing support in PHP 5.4.0

http://www.razvantudorica.com/07/array-dereferencing-support-in-php-5-4-0/

SVN how to merge branch into trunk

http://www.razvantudorica.com/06/svn-how-merge-branch-into-trunk/

Batch remove from Mercurial repo

http://www.razvantudorica.com/05/batch-remove-from-mercurial-repo/

Mercurial branch name to bash prompt

http://www.razvantudorica.com/05/mercurial-branch-name-to-bash-prompt/

Cannot redeclare geoip_country_code_by_name

Today I had this error on my Ubuntu Linux box

Fatal error: Cannot redeclare geoip_country_code_by_name()

The reason was that I have geoip extension enabled in my PHP configuration and also I used the geoip.inc file from maxmind.com.

The solution is very simple.

http://www.razvantudorica.net/03/cannot-redeclare-geoip_country_code_by_name/

How To – Activate PHP in public_html for Ubuntu 10

It seems it is a bug (I didn’t investigate too much) in Ubuntu 10.x related to PHP files in userdirs.

On my box I have Ubuntu 10.10, Apache/2.2.16 (Ubuntu) and PHP 5.3.3-1. Everything worked fine except the PHP files from ~userdir. Instead to parse these files, the web server send them directly to the browser which open the “save as” window.

The problem is in /etc/apache2/mods-enabled/php5.conf file.

<ifmodule mod_userdir.c>
<directory /home/*/public_html>
php_admin_value engine Off
</directory>
</ifmodule>

These lines should be commented:

# <ifmodule mod_userdir.c>
# <directory /home/*/public_html>
# php_admin_value engine Off
# </directory>
# </ifmodule>
 

A simple MVC framework

I will describe in the following post a (very) simple MVC framework. You can download the source code from here or can make a copy from bitbucket repository.

As you can see, we have the following folders:

web: here resides your public files (images, css, and index.php)
app: here you can find application files: models, views, controllers (MVC)

Read more »

Singleton Pattern

This pattern is probably one of the most simple and used pattern. As php manual says: The Singleton pattern applies to situations in which there needs to be a single instance of a class. The most common example of this is a database connection. Implementing this pattern allows a programmer to make this single instance easily accessible by many other objects.

There are tons of information about this pattern over the Internet so I let you google for it.

You can find a singleton implementation in Simple MVC framework example.