The config for IPTables is located:
/etc/sysconfig/iptables

I added the following line to it:
-A INPUT -p tcp -m state --state NEW -m tcp --dport 6379 -j ACCEPT

Reloaded IPtables:
sudo service iptables reload

Sanity check:
sudo iptables -S

Share This:

short answer – you can’t…

shorter answer – use stat:
stat -c '%A %a %n' *

Share This:

Checking nested structure with isset does not work anymore!

In the project I’m working on currently, all the models extends from ArrayObject:

Now, I found the following on many places (or similar-ish):

The brand model:

Before, if I would check for properties inside the model with isset($this->$key), however, this is no longer working if the property is private!!! Isset is not a function so it was not throwing an error on checking not existing indexes/properties.

The code before:

Now

The isset is however working on protected and public, only accessing private properties is messed up.

Furthermore, they argue it is a “bugfix” (if you bother to read the issue comments), however, I think it is extremely stupid to fix such a important function in a minor release. Shame on you!!!

PS: credit for stealing cookies goes to Ocramius 😉 https://ocramius.github.io/blog/accessing-private-php-class-members-without-reflection/

Share This:

February 9, 2016 | In: Programovanie

SVN repo size

svn list -vR file:///path/to/svn/folder/* | awk '{if ($3 !="") sum+=$3; i++} END {print "\ntotal size= " sum/1024000" MB" "\nnumber of files= " i/1000 " K"}'

Share This:

how to run phan on debian

First, go here, here and here to get an idea about how to get phan working.

For Debian8 though, I had to do a few more tricks to get it running.

If you still haven’t try php7 (shame on you!) check this guide: how to install php7 on debian8 and redhat6.

To compile phan, you will need a phpize. For some reason it couldn’t resolve the dependencies automatically so here is what you will need:

than php readline and sqlite3:

and finally you should be able to install:

You can now go back to phan and you should be able to compile it (finally):

This will build your ast.so, which is located (on debian8):

Now you need to configure php-cli and load your new module. Check where the all the interesting ini/conf files are:

On Debian you probably want to check:

If everything went fine (like it ever does…), you are good to go with phan install:

That should do the trick and you can run phan from your command line:

And if you are lucky enough, and wont end up with segmentation fault as I did (try to run it on sub folder), you will see a lot of interesting things:

If you want to experiment with other libraries, checkout the post from php7 analysis tools.

Share This:

December 9, 2015 | In: Programovanie

php7 Anonymous Classes

Anonymous Classes

It is exactly what it says, but when can it be useful?

Ever found your self refactoring a pile of shit like the following code?

and then wherever you look you see casting it back to array?

and then somewhere else

and some more

and some more

Finding your self doing something like that? Then stop it! Seriously!

You know by now that you want to replace it with some model or real object, but you want to do it step by step and not brake anything.
Now how to do it? The answer is refactoring. I found anonymous classes super useful when replacing crap like that. As first step you can define anonymous class to confirm that everything still works as expected (if you have unit tests, if not – heaven help you!). And start replacing all the crap with your new object:

And what you get is the nice model ready to be tested and you are ready for next steps.

more about php7:

if you need to install PHP7 check out this article

php7 null coalesce operator ??

php7 class return type

Share This:

Variance and Signature Validation – basically in simple layman’s term – class return type

then interesting thing I find about the example from

more about php7:

if you need to install PHP7 check out this article

php7 null coalesce operator ??

Share This:

A bit weird and unintuitive coalesce behaviour, so watch out when using it!

so it seems that it works only for null :/

so the only valid and straight forward example comes from php.net:

if you need to install PHP7 check out this article

Share This:

short summary on how to update to the latest php7, phpmyadmin4.5 and mysql5.7 on redhat

install latest php7:

install latest mysql5.7:

install latest phpmyadmin4.5

update

For some reason I had to manually update the /etc/httpd/conf/httpd.conf

I did not bother on Debian and went with ZendServer9 tech preview

If you end up with missing recode:

If you are subscribed to optional repos and actually can install it from yum you can simply do:

However, if the library can’t be found, you can download and install recode yourself from:

Then install:


credit goes to this guys:

https://webtatic.com/packages/php70
http://tecadmin.net/how-to-install-phpmyadmin-on-centos-using-yum/

Share This:

February 10, 2015 | In: Správa linuxu

useful list in console

reverse full time list, you can see latest as first

ls -ltrh

-l long list format
-r reverse
-h human readable size format
-t sort by modification time

Share This: