PHP Developer or PHP Programmer

Last couple of days I’ve spent with playing around my website. And the first thing I wanted to changes it its title. So if someone looks for Tomas Pavlatka in Google – e.g. some HR person – I want him to get immediately idea, who I am.

So my two choices were

  1. Tomas Pavlatka – passionate PHP Developer
  2. Tomas Pavlatka – passionate PHP Programmer

I didn’t know which of these two I should choose. So I asked Google to give me a help hand. Let’s check some comparisons:

1. Google Search
When I search for PHP Developer in Google, Google tells me he knows about 160 000 000 pages for it.
Google Search for PHP Develoeper

On the other hand, when I search for PHP Programmer in Google, Google knows only about 19 000 000 pages.
Google Search for PHP Programmer

2. Keyword Planner
Another great tool to make this comparison is Keyword Planner offered by Google Adwords. Let’s see what it can tell us about PHP Developer vs. PHP Programmer fight.

Let’s start with PHP Developer – the average monthly search volume is 9.900.
Google Keyword Planner - PHP Developer

If I use the same tool to find information about PHP Programmer, it tells me about only 1.300 average monthly searches.

Based on the results above, I can clearly see that PHP Developer is more used than PHP Programmer. It doesn’t actually mean it’s better to use PHP Developer – if you are doing SEO, because it might be very difficult to get on good position in Google. But because my aim is not to be the first one in Google on phrase PHP Developer, I will use it as so many people use it as well.

Review: Canyon CNS-CMSW4B black – NO THANKS


I’ve got a new mouse for last Christmas – wireless Mouse Canyon CNS-CMSW4B black. But after 3 week of usage I can easily say – I have never had such bad mouse in my life. If I should think about some positive feelings – it’s hard to find even one. Maybe: the mouse is wireless.

If I go to negative things, there are plenty of them. But two of them bother me quite a lot.

1. No on / off button

Because the mouse is wireless, it need a batteries to operate (2x AAA). So I would expect to have an on / off button, so I can save batteries when I do not need the mouse. But unfortunately, there’s no such “feature”. After complaining to my friend, he showed me, that I have to take the USB which I put into my laptop, open battery cover and put it there. The mouse will go to its sleep mode.

2. Batteries life
I have read on the manufacturer website, that thanks to new technology, batteries should last up to 6 months. Wow, I was amazed and this info softened my heart – after being angry from point 1. But the reality is far away from the promise. I’ve got the mouse 26/12/2014 and today is 22/01/2015 and I have already changed the batteries twice.

If you ever see this mouse somewhere, do not even think about buying it. It will save you a lot of energy and keep you calm.

How to install Composer on Cygwin

I love to use Cygwin, because it emulates Linux terminal in Windows. I decided to install Composer on my localhost, but I came across some issue when I tried to activate it in Cygwin.

I use XAMPP to run Apache and MySQL locally, so let’s use it as well.

1. Verify that you PHP is running

tomas@tomas-devw8 ~
$ php -version
PHP 5.5.19 (cli) (built: Nov 12 2014 12:35:44)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies

If you can’t see information about PHP you are running on your localhost, fix this before you continue.

2. Create folder c:/bin

There are many ways, how to create this folder, but since I am in Cygwin, let create it from there

tomas@tomas-devw8 ~
$ mkdir /cygdrive/c/bin

3. Move into the folder

tomas@tomas-devw8 ~
$ cd /cygdrive/c/bin

4. Download Composer
To download composer, just simply follow instructions on Download Composer page. I have chosen:

tomas@tomas-devw8 /cygdrive/c/bin
$ php -r "readfile('');" | php
#!/usr/bin/env php
All settings correct for using Composer

Composer successfully installed to: C:\bin\composer.phar
Use it: php composer.phar

5. Create alias composer
The last thing I have to do is to create alias, co I can easily call composer and the composer will run.

tomas@tomas-devw8 /cygdrive/c/bin
$ alias composer="php C:/bin/composer.phar"

6. Check intallation
And we are done, let’s check whether everything is working properly – simply call composer form the command line and check the result

tomas@tomas-devw8 /cygdrive/c/bin
$ composer
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
Composer version 1.0-dev (2a1a963b0064ad57172d4aa0fb649f964edf6e33) 2015-01-19 17:56:20

 [options] command [arguments]

 --help (-h)           Display this help message.
 --quiet (-q)          Do not output any message.
 --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug.
 --version (-V)        Display this application version.
 --ansi                Force ANSI output.
 --no-ansi             Disable ANSI output.
 --no-interaction (-n) Do not ask any interactive question.
 --profile             Display timing and memory usage information
 --working-dir (-d)    If specified, use the given directory as working directory.


Htaccess – Automatic Subdomain

My dear friend Hubert Frey was trying to solve one of his challenge. He wanted to have only 1 application and running many sub-domains on it.

Here’s a htaccess code to achieve what he was looking for

RewriteCond %{HTTP_HOST} ^(.*)$ [NC]
RewriteRule (.*) index.php?subdomain=%1&seo_uri=$1 [QSA]

Maybe it might be helpful for someone.

Selenium with Chrome as browser on Windows 7

I’ve been playing with automatic web testing and I am using Selenium. It’s a great tool and in combination with PHPUnit, it offers ready powerful tool how to test your application.

By default it comes with support of Firefox as browser, but I prefer to test it with Google Chrome. My first idea was to just change browser in setUp() function:

public function setUp() {

But unfortunately that didn’t help but end up in error message instead

PHPUnit_Extensions_Selenium2TestCase_WebDriverException: The path to the driver executable must be set by the system property; for more information, see The latest version can be downloaded from

We have do to couple of things to make it work

1. Download ChromeDriver
Let’s go to ChromeDriver download and download latest version for Windows.

2. Unzip Archive
Unzip the archive and you can copy it to a location where you keep all executable files. In my case C:/bin.

3. Update alias setting
I have an alias setting how to start my Selenium Server

doskey selenium=java -jar C:\bin\selenium-server-standalone-2.44.0.jar

So I have to change it to following

doskey selenium=java\bin\chromedriver.exe -jar C:\bin\selenium-server-standalone-2.44.0.jar

4. Finish
Now I can start my Selenium Server and run my testing. The error message won’t be shown anymore and all my tests will be done in Google Chrome web-browser. So we are done for today.

Enjoy your testing.

Our Christmas Eve menu

I would like to thank our friend Adam, who took us outside for Christmas Eve Dinner. We have had a great time and we enjoyed the food as well. I managed to take a picture of the menu as well.

Thank you one more time Adam, next time we will invite you.


How to reset Facebook cache for a website

My client called me that the snapshot of his website is not being shown properly when someone shares it on Facebook. I checked it and he was right. So I made necessary changes and I hoped it will be like Google – it will take 1-2 days for the changes to be shown on Facebook. But unfortunately I was mistaken. From what I read, it might take even a years for Facebook cache to be changed.

So I was looking around and I found the solution – to use Facebook Debugger. Just enter the url which you have updated and Facebook cache will be renewed.

MySQL Joins explained in one simple image

I was looking for picture like this for quite a long time. Thank you Olek for sending me one yesterday.

16 years since my Dady passed away

Time is going so fast. Today it’s been 16 years since my Dad passed away. If I look back on these years I am without him, I can’t believe it’s been so long. I hope that he’s o.k. there where he is right now. I am 32 right now so it means half of my life I spent without him. I miss him.

My Dady: “You passed away, but you will always be in my heart. I hope you would be happy where I am right now, with my wife I have and with your another 4 grandchildren. I hope that one day I will be able to take them to see at least your grave. Missing you.”

Problem with Ajax and Windows-1250 encoding

I have a client and his application is written in encoding Windows-1250. I know I should rewrite it in UTF-8, but since it’s a quite a big system, it’s not easy. Also one motto is saying – Never touch the running system. So I have to deal with problems which come out of Windows-1250 encoding.

The problem I was facing this time was how to send a text via AJAX and encoded in Windows-1250.

I used jQuery function ajax() with hope, everything would be good, but I was mistaken. All special characters were destroyed and save wrongly into the database. So I started my investigation.

1. contentType for jQuery.ajax()

After a short investigation, I found out there is a parameter contentType, which I can set up for ajax function. I hoped this would help me out of the problem, so I set up

	contentType: 'application/x-www-form-urlencoded; charset=Windows-1250'

and I went to test it. How surprised I was went it was not working again. So I started to read an instruction for this parameter and I did not like what I read there.

The W3C XMLHttpRequest specification dictates that the charset is always UTF-8; specifying another charset will not force the browser to change the encoding.  

From that time on I knew, that I will have to find a workaround.

2. mb_convert_encoding

I found out I can use mb_convert_encoding() function to convert between encodings. I implemented this:

$description = array_key_exists('value', $_POST) ? $_POST['value'] : null;
$description = mb_convert_encoding($description, "Windows-1252", "UTF-8");

This does its job but only up to the point. Because the website is in czech language, we do have some special characters, which will not work properly by using function mentioned above. I am talking about e.g. ěščřžýá. The function above would replace these special characters by question mark ?. So I knew I’m half of the way to find the solution / workaround, but I also knew, I’d have to come with something special.

3. Replace before sending and before saving

What came to my mind was that if I can’t send the data properly, I can replace special characters by some special string, send it and before I save it into a database, I will replace it back. I came with this idea:

function convert_strings(string) {
	var convert = {
		'_ce_' : 'ě', '_cs_' : 'š', '_cc_' : 'č', '_cr_' : 'ř',
                '_cz_' : 'ž', '_cy_' : 'ý', '_ca_' : 'á', '_ci_' : 'í', 
                '_cn_' : 'ň', '_ct_' : 'ť', '_cd_' : 'ď', '_cu_' : 'ů', 
                '_cuu_' : 'ú', '_cE_' : 'Ě', '_cS_' : 'Š', '_cC_' : 'Č', 
                '_cR_' : 'Ř', '_cZ_' : 'Ž', '_cY_' : 'Ý', '_cA_' : 'Á', 
                '_cI_' : 'Í', '_cN_' : 'Ň', '_cT_' : 'Ť', '_cD_' : 'Ď', 
                '_cU_' : 'Ů', '_cUU_' : 'Ú'}
        for(var i in convert) {
            var reg_exp = new RegExp(convert[i], 'g');
            string = string.replace(reg_exp, i);

        return string;

value = convert_strings(value);			
var post_data = {value: value}
ajax_loading(element, 'show', 'row');
	url: ...,
	data: post_data
}).done(function(data) {
}).fail(function(data) {

It will call a php file, where we have to replace the strings back.

$description = array_key_exists('value', $_POST) ? $_POST['value'] : null;
$description = mb_convert_encoding($description, "Windows-1252", "UTF-8");
$replace = array(
	'_ce_' => 'ě', '_cs_' => 'š', '_cc_' => 'č', '_cr_' => 'ř', 
	'_cz_' => 'ž', '_cy_' => 'ý', '_ca_' => 'á', '_ci_' => 'í', 
	'_cn_' => 'ň', '_ct_' => 'ť', '_cd_' => 'ď', '_cu_' => 'ů', 
	'_cuu_' => 'ú', '_cE_' => 'Ě', '_cS_' => 'Š', '_cC_' => 'Č', 
	'_cR_' => 'Ř', '_cZ_' => 'Ž', '_cY_' => 'Ý', '_cA_' => 'Á', 
	'_cI_' => 'Í', '_cN_' => 'Ň', '_cT_' => 'Ť', '_cD_' => 'Ď', 
	'_cU_' => 'Ů', '_cUU_' => 'Ú');
$description = strtr($description, $replace);

And we are finished. I know this is not the most correct solution, but it works and that is the most important thing for me. I would be happy if you can share any other idea, how to solve this problem. If you have any – please use comments to share it with me.

© 2015 Tomas Pavlatka

Theme by Anders NorenUp ↑