Tomas Pavlatka - Passionate PHP Developer

I am Tomas Pavlatka - a passionate God lover, PHP developer, father, husband, son and much more. I am currectly living in Limassol, Cyprus with my lovely wife - Therese and 3 children - Henry, Goerge and Ladia Joice. Learn more about me or connect me on TwitterFacebookGoogle Plus or LinkedIn.

The biggest advantage on being programmer is I can solve all my problems by myself. The biggest disadvantage of it is that almost all my problems come from the fact I am a programmer.
I've read it somewhere and completely agree with it.

SuPHP and permission 644 for images

I came across the issue with SuPHP on my VPS. Suddenly, all files were uploaded with permission 600. What did it mean ?  I couldn't see my pictures etc. 

I was trying to find the solution, but most probably my questions to Google were not clear enough ;). 

After an hour of investigation, I found out that I have to change following

vim /etc/suphp.conf
set umask=0022
service apache2 restart

The problem is fixed and I have learned again something new for my VPS ;).

Tomas Pavlatka, How To, Wednesday, 07 May 2014 permalink

How to get number of inodes per folder

Long time ago, I had a problem with increasing number of innodes. I found out this code which basically gives you number of inodes per folder. It is a great starting point for investigation, where the problem might be.

for i in *; do 
printf "%10d %s\n" `find "$i"|wc -l` "$i"
done|sort -n

What is inode ?

In a Unix-style file system, an index node, informally referred to as an i-node, is a data structure used to represent a filesystem object, which can be one of various things including a file or a directory. Each i-node stores the attributes and disk block location(s) of the filesystem object's data. Filesystem object attributes may include manipulation metadata (e.g. creation, access, modify time), as well as owner and permission data (e.g. group-id, user-id, permissions). More on

Tomas Pavlatka, How To, Thursday, 24 April 2014 permalink

Enable search in Select2 in Bootstrap 3 Modal

I have spent an hour trying to figure out, why a search field is not writable in Select2 while using Bootstrap 3 Modal. After that our, I came accross this solution which is working. 

$.fn.modal.Constructor.prototype.enforceFocus =function(){};
<script type="text/javascript" src="//"></script>
<script type="text/javascript" src="//"></script>
<script type="text/javascript" src="/js/bootstrap.min.js"></script>

<script type="text/javascript" src="/js/select2/select2.js"></script><script type="text/javascript">
$.fn.modal.Constructor.prototype.enforceFocus = function () {};

Tomas Pavlatka, Programming, Thursday, 10 April 2014 permalink