Let’s find out what can we achieve; using what we already have, without adding other layers, servers or applications: PostgreSQL. It will help us keep the architecture simple, please be patient 🙂 We need to prepare records for full-text search using 1-to-1 relationship for relevant records in other tables with search term vector from one … Read moreFull-text search using PostgreSQL: simple, fast, cached
Especially, if you are a start-up, all it takes is a fine combination of: a bad coder (with an arrogant attitude of “code first + optimize later”) and 1000 simultaneous requests to bring each of your servers to its “knees”. On part 1, I’ve mentioned the cost of a million items when we are using … Read morePHP: The cost of a million objects on function calls
Even though memory is getting cheaper, our applications are becoming more complicated and we need to write our code more carefully. I’d like to share some surprising tests I’ve written recently. The sample code files are also on github: https://github.com/muratyaman/php-tips. The tests are very simple: let’s create an array of million items to process: version … Read morePHP Memory Usage: The cost of a million objects
Choosing the features based on the lowest common denominator of X number of database systems is not the right approach in implementing an ORM! https://github.com/laravel/framework/pull/8400 This forces us to question the value of database abstraction layers and other abstraction layers in general. If one database system does not support a feature, the abstraction layer developer … Read moreHow good are the abstraction layers?
In apps for users all around the world (even in apps for local users where DST applies) correct time zones should be set, after database connection is established, based on the user’s time zone setting (rather than hard-coded setting in app). Then, data read/write ops should be automatically handled by the database. For example, in … Read moreManaging date fields properly with correct time zones in PostgreSQL
A LOT! From: http://www.charliebaird.co.uk/bugs_2000.htm Bugs are not always cute. So, we need to upgrade all software applications we use on a regular basis. Ref: php.net/ChangeLog-5.php Version 5.5.22 19-Feb-2015 Core: Fixed bug #67068 (getClosure returns somethings that’s not a closure). Fixed bug #68925 (Mitigation for CVE-2015-0235 – GHOST: glibc gethostbyname buffer overflow). Fixed bug #68942 (Use … Read moreWHAT HAS CHANGED SINCE PHP 5.5.3?
Another eye-opener from PHP is the unexpected behaviour of integer filters. Here is a test case class checking “01” and “10” whether they are integers or not.
class TestFilters extends PHPUnit_Framework_TestCase
public function test_filter_int_with_zero_prefix ()
$result = filter_var('01', FILTER_VALIDATE_INT) !== false;
public function test_filter_int_with_zero_suffix ()
$result = filter_var('10', FILTER_VALIDATE_INT) !== false;
Refer to: http://php.net/manual/en/filter.filters.validate.php
PHP 5.0 was released in July 2004. Almost 11 years and we know that they gave up on PHP 6.0 🙁 In IT world, that is a massive failure and a huge embarrassment! Think for a minute: thousands of “genius” developers working together to improve PHP itself, rather than creating another bloody framework!!! How would … Read morePHP is dying faster because … (part 2)
PHP was well-known for its speed of development (no compilation or formal build process); even for developers from alien worlds like Java esp. when developing prototypes; because it was easy to learn, develop and deploy on almost any platform. I have been coding for almost 18 years now. I picked up PHP as a natural … Read morePHP is dying faster because … (part 1)
We learned to rely on browser cookies for many years. Some of us don’t even realize and understand the “magical” relationship between a browser and PHP script on server-side. Only when we get out of the “box” and look at what is going on, then we start to grasp the oddities. When we work on … Read moreCookie-less REST API with Laravel