HTML5: contenteditable full example

Posted April 11th, 2012 in Zanimivosti by Metod

This post was inspired by a nice article on html5doctor:

The contenteditable attribute allows us to edit content of the element on the fly. However there are a few catches in the actual implementation that are not mentioned above.

Let us just check my implementation. I’m using jQuery and jQuery UI for the javascript part and PHP for the backend.

Of course the example was simplified to not clutter it too much.

I also recommend reading the html5doctor’s excellent article on the matter.

Have fun!

How to install igbinary serializer for PHP

Posted December 13th, 2011 in Razno, Zanimivosti by Metod

This is few simple step tutorial on how to install igbinary for PHP when you have multiple versions of PHP installed.

First off, you have to use proper binary versions of the PHP version you wish to install the extension to.

1. Clone the source:

$ git clone

2. Run phpize. Now if you don’t have the proper phpize binary in the global configuration, then just use the full path to it. I have the php version 5.4.4 installed with phpfarm, so I will use that phpize.

$ cd igbinary
$ /usr/local/php/inst/php-5.4.4/bin/phpize

3. Configure it. Make sure you put the full path to your php-config, otherwise it will not work!

$ ./configure CFLAGS="-O2 -g" --enable-igbinary --with-php-config=/usr/local/php/inst/php-5.4.4/bin/php-config

4. Compile and install

$ make
# make install

5. Enable and configure it in your php.ini
apc.serializer=igbinary ; only if you want apc to use igbinary

6. Restart apache (assuming you run apache).

And you should see igbinary support in your phpinfo().

Post updated on 15th June, 2012 to reflect latest changes.

Eclipse – Adding Files to Git Index problem

Posted December 4th, 2011 in Zanimivosti by Metod

Encountering the following error in Eclipse/Zend Studio while trying to add files in Git?

Adding Files to Git Index problem

Check if a file ‘index.lock’ exists in the .git folder located in the root folder of your project.

If so, remove it and you can continue working!

rm .git/index.lock

SQLSTATE[HY000] [2002] Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)

Posted June 25th, 2011 in Zanimivosti by Metod

When you run into this error, a few solutions apply.

First one is to check where mysql.sock or mysqld.sock actually resides and change values in php.ini appropriately.

mysqli.default_socket = /var/run/mysqld/mysqld.sock

You can also make a symbolic link to the correct location.

# ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock

For me, the above solution did not work. All I got was the change in error from (2) to (13). Turns out the solution is quite interesting. Instead of using ‘localhost’ as host for DB, use – it magically begins to work again.

Phing executing multiple commands

Posted March 26th, 2011 in Zanimivosti by Metod

A little tip. If you deploy your PHP projects with Phing, you are familiar with the file build.xml. If you want to execute multiple commands, that depend on each other to be executed, you have to use && in between the commands. For example, clearing the cache:

ssh 'cd cache && rm *'

The line in phing build.xml would look like this:


How to minimize skype to tray in windows 7

Posted January 14th, 2011 in Zanimivosti by Metod

*EDIT:* More recent skype versions have this functionality built-in. Check comments.

*Warning*: This solution seems to cause skype to crash in latest versions.

If you ever used skype on Windows 7 then you know that it is really annoying as it doesn’t minimize to tray when you click the close button. Luckily there is a solution. Just run it in compatibility mode for Windows Vista (Service Pack 2) or older. In a step-by-step:

1. Go to Phone folder in your skype installation folder (C:\Program Files (x86)\Skype\Phone)
2. Right click on Skype.exe and choose Properties
3. In properties select Compatibility tab
4. Check the “Run this program in compatibility mode for:” checkbox and select Windows Vista (Service Pack 2) or sth older
5. Click OK and you are done

Enjoy the better skype experience on Windows 7. 🙂