I have used psycopg2 to connect the database and a little trick to switch the schema from development to production and viceversa. I have used an ini file to store informations about the database. You can store any other informations in the file and keeping them tidy using the ini sections. Let's start with my config.ini fil... [...]
Read MoreThat's what we do: we write function and methods. Following the discipline of clean code we must follow the rules and be sure we are proceeding in the right way.Small! Functions must be even smaller than that!Functions must be small! And the other rules is: the must be smaller than thatMaximum 5 rows, 3 rows i... [...]
Read MoreIt's time for an effective refactoring! Extract from long functions (extract until you drop), edit in line, extract methods or new classes. On TDD, after a test is passed, refactoring is the 3rd and probably the most important step of the small cycle red \ green \ blue. Let's explore the refactoring techniques with a sho... [...]
Read MoreWe have PHP 7 but I was wondering how we can have a sort of timeline with the most important feature for each version of PHP. On php.net there is the release page but it's not enough for our purposes. From the history of PHP to the PHP museum, we can navigate and download the various PHP versions. WIth PHP 4 the language sta... [...]
Read MoreAgile testing is a testing approach that is designed to be flexible and adaptable, and is often used in conjunction with agile software development methodologies such as Scrum and Extreme Programming (XP).In the context of agile testing, the first quadrant refers to the tests that are performed at the beginning of the develo... [...]
Read MoreThis post is the right and updated procedure to install the PHP Oci8 extension with the Oracle instant client on Linux (Ubuntu, Kali, Debian distributions). That's because I have spent a lot of time finding the right steps and combinations. The procedure seems very long but I ensure you will not need more than 10 minutes! I... [...]
Read MoreFrom redis.io: "Redis is an open source (BSD licensed), in-memory data structure store, used as database, cache and message broker". To scale an application can be a big problem and using the right tools can make the difference. Redis is excellent and many big companies are choosing it. Let's see how to use it in p... [...]
Read MoreRabbit MQ is a software for messaging that implements the Advanced Messaging Queuing Protocol. About the definition of Rabbit MQ from the official website:Robust messaging for applicationsEasy to useRuns on all major operating systemsSupports a huge number of developer platformsOpen source and commercially sup... [...]
Read MoreKali Linux 2 came out in August 2015. I removed my Ubuntu installation after an ugly kernel panic caused by the ACPI probe failed error (I've not solved this problem with my PC!). I can tell Kali is really amazing: you will have all tools for security, penetration testing and even web development like PHP, MySQL, Git, Java,... [...]
Read MoreXSS is one of the most common security issues we have to worry about. It can be simple to prevent it but sometimes it's not. We must pay attention not only on our PHP code but even on HTML and Javascript ocde without forgetting old browsers. Some malicious users can use old version of Internet Explorer to explore the DOM and... [...]
Read MoreWe have the power to assign a name to a variable and it's a great power! We must assign a name to a variable that it must reveal its intents just when I read the name of the variable. If we can assign the right name and understand what the variable will do and its role on the software and on the algorithm, it would be perfec... [...]
Read MoreWhat is bad code? Why we write bad code? Well Uncle Bob ask us many questions and then help us to understand how to improve gradually and start writing clean and maintainable code. We must learn to recognize bad code (code smell) and let us to update and improve existing code without breaking anything (refactoring). Let's st... [...]
Read MoreI have finally passed the test for the Zend PHP certification. The exam consists in 70 questions and you will have 90 minutes. You have to answer right at least to 70% of them (49 questions). You need to buy the voucher from the official Zend website and, optionally, the Zend Study Guide for PHP 5.5. Be sure to select and b... [...]
Read MoreYet another tutorial about installing a LAMP on Linux (I'm using Ubuntu). I've found all info I needed online but for it wasn't so easy. All informations are different, for different tools and purposes and you can't find them in single tutorial. Here I'm listing all commands we need to set up a good PHP devel... [...]
Read MoreTo work with PHPUnit without autocomplete is almost impossible and sometimes PHPStorm doesn't show it. We must ensure we have enabled the IDE to see where PHPUnit is installed. I use the phar file. Since when they have removed the PEAR installation, we have to install PHPUnit with the phar file. So download the phar fi... [...]
Read MoreOk this year Symfony3 will be launched but in the best practice book there are some good recommendations and warning for the next future. I'll try to summarize the most interesting concepts and warnings. There are a lot hints about what you can or must do and some warning about common mistakes and what you must not do.... [...]
Read MoreMy Zend2 application must store attachment files but we don't want to store them on a shared hosting. We can have files from multiple website, so I was searching for a cloud storage solution. Here we have Amazon S3, an alternative to Dropbox or other services like this. We can interact with the AWS platform using SDK for our... [...]
Read MoreUnfortunately Doctrine does not support so many SQL function so you have to build a class to let him use a custom function. Let's start building a DATE_FORMAT function. Let's write the class:namespace Application\Model\Doctrine\Functions;use Doctrine\ORM\Query\Lexer;use Doctrine\ORM\Query\AST\Functions\Functi... [...]
Read MoreWhy have I decided t0 use Bootstrap 3 instead of 2 for my new project? I'm searching for new and simple templates made with Bootstrap 3. There aren't many options online but you can build your own template using different tools. BS3 is newer and I really love the new features such as font awesome and new g... [...]
Read MorePHP is flexible, too much flexible! It hasn't specific variables types. And you have to pay attention to handling a workflow, especially if you are working with sessions, cookies, forms, and many other features. A coding standard in PHP is necessary anyway. Here we have specific ways about how to organize your code. Let... [...]
Read More