blog

Javascript closures

Posted on

Closures in JavaScript zijn functies met ‘vrije variabelen’. De functie onthoud zijn omgeving waarin hij gemaakt is. Je kunt een closure gebruiken om dynamische functies te maken. Wat voorbeelden zullen helpen om het geheel te begrijpen. In onderstaand voorbeeld maken we een functie welke machten uitrekent. De functie ‘powers’ geeft een functie terug. Alle instanties […]

0 Shares
programming

Javascript prototype

Posted on

Definitie: Een prototype is een object waarvan geïnstantieerde objecten de properties erven. (bron: JavaScriptWeblog) Als je, bijvoorbeeld, een functie ‘car’ maakt (wat dan een object is, aangezien alle functies in javascript objecten zijn) en je plaatst properties en methods in de prototype van dit object, dan zullen alle instanties van dit object die methods en properties […]

0 Shares
blog

PHPStorm – connect to MySQL database

Posted on

It can be a bit painful to get the database connection started from your PHPStorm IDE to your MySQL database. As a quick hint, this is where it went wrong with mine: MySQL wasn’t listening for incoming connections on the network (change directive bind-address to 0.0.0.0 in /etc/mysql/my.cnf and restart MySQL) My database user was only […]

0 Shares
blog

Install PHP Code Sniffer (phpcs)

Posted on

PHP CodeSniffer, aka phpcs, helps you in detecting violations in your PHP code. Violations can be: opening curly brackets in the wrong place (on a new line, or vice versa) indentation use of upper- or lowercase variable/function/method/class names missing phpdoc blocks for files, classes or functions your own coding standards etc. Before installing PHP CodeSniffer […]

0 Shares
blog

PHPStorm – use PHP CodeSniffer

Posted on

Use PHP Code Sniffer to detect violations to coding standards in your PHP files. To use PHP Code Sniffer in PHPStorm, open the Settings and go to PHP -> Code Sniffer In the field ‘PHP Code Sniffer (phpcs) path:’ fill in the path where the binary resides. Most of the times this is ‘/usr/bin/phpcs’. If […]

0 Shares
programming

Install PHP Mess Detector (phpmd)

Posted on

What is PHP Mess Detector? Given its homepage, it aims to detect: Possible bugs Suboptimal code Overcomplicated expressions Unused parameters, methods, properties In short: it helps by pointing you on the mess inside your PHP scripts! Listing available packages: $ pear channel-discover pear.phpmd.org $ pear channel-discover pear.pdepend.org Adding Channel “pear.phpmd.org” succeeded Discovery of channel “pear.phpmd.org” […]

0 Shares
programming

install pear on OSX Mountain Lion

Posted on

Install PEAR on your OSX Mountain Lion machine to easily install PHP libraries. $ which pear -bash: pear: command not found Install pear. Accept the defaults while installing. $ cd /usr/local $ sudo wget -O http://pear.php.net/go-pear.phar $ sudo php -d detect_unicode=0 go-pear.phar Pear is installed! $ which pear /usr/bin/pear Now you can install some nice libraries: […]

0 Shares
programming

setup xdebug in PHPStorm

Posted on

Install xdebug on the server Installing Xdebug on the server is not in the scope of this article. You can find related articles here: http://xdebug.org/docs/install http://www.jetbrains.com/phpstorm/webhelp/… Install xdebug on Ubuntu: http://ubuntuforums.org/…. Youtube: install xdebug on windows XP Configure xdebug in phpstorm’s settings Open the phpstorm Settings window and go to PHP -> Debug Apply the settings […]

0 Shares