Working with Magento 2 we often use collections to fetch and work with data from our database. For the most part these work perfectly fine, but when it comes to fetching and iterating millions of records in a single process it becomes extremely difficult because memory usage becomes a problem. From my experience the overhead of using a collection is too high when dealing with result sets of this…
Anyone who has worked in a team that I’ve managed knows that I’m categorically against the idea of overtime. Most engineers have been there. Those times when your company really relies on your good nature and willingness to put in the extra hours and have a product ship on time. You put in the effort and your product stakeholders are happy, but are you? The answer may initially be “yes” because…
I was recently working on a personal project where I needed to store UTF-8 characters such as emojis in a MySQL TEXT column type. I was surprised to find that MySQL’s implementation of the UTF-8 character set isn’t actually true UTF-8. It is only capable of storing UTF-8 characters that fall within the 3 byte range , so that rules out my emoji characters that I needed to store. In version 5.5.…
Google Chrome. The saviour of the browser. The best rendering engine in all of the land, or at least that’s how it felt back in 2012. The former best browser on the planet is slowly becoming a replacement for Microsoft’s behemoth that was IE6. Whilst this seems very harsh, let me explain. IE6 was cursed because of its insistence on abiding by its own rules. A complete ignorance to the standards…
As programmers we generally hate disruption. We get halfway through writing a test to have someone interrupt our flow and set us back by 15 minutes . Imagine that 4 or 5 times a day (if you are lucky), and we’re losing about 5 hours of productive coding time every week. That’s not to say that interruptions are unnecessary. As programmers we all understand that coding only makes up one part of our…
For a long time I’ve always thought that soft deletes are the “right way” of deleting records from your database. Like most things within software development, you end up realising that things are not always so black and white. Whilst soft deletes provide a “safe” (read: easily reversible) way of deleting records, I have come to realise that they can create far more problems than they solve.…
If you are a PHP developer who is still yet to hear about HHVM (HipHop Virtual Machine) then you must have been living under a rock for the last 2 years. HHVM is Facebook’s grand contribution back to the PHP community, providing up to 40x faster throughput on a standard WordPress site. Whilst this is great for the PHP community, we are still waiting on 100% parity between the HHVM and the Zend…
After upgrading to OSX Mavericks today I discovered my PHP 5.5 install (via homebrew) to be broken, which is pretty much par for the course after upgrading OSX. After a short moment of anger I started to work on fixing the issue, which I have documented below for everyone else’s benefit: After installing OSX Mavericks upgrade, install the latest XCode from the AppStore (5.0.1 as of the time of…
When we throw an exception in our Symfony applications, we can be quite lazy and have Symfony catch it for us and display a nice error message to our user. This is great, most of the time we don’t want to show detailed exception messages to the user. We certainly wouldn’t expose any sensitive information like database names for example. Sometimes however, we want to use our exception messages as a…
I recently stumbled across a question on stackoverflow.com where somebody was having problems with foreign key constraints and truncating data in MySQL. An accepted answer stated that while it was possible to truncate the data, it isn’t possible if there are foreign keys present (as is the case with Doctrine 2 entities). Actually, it is possible to truncate your data even with foreign key…
Database administration is possibly the scariest concept for me as a developer, mainly because I have neglected it for so long. Everyone knows the basics, and even though I had a solid theoretical understanding of how databases store information, I wanted to further my development in this area. I picked up a book by O’Reilly called High Performance MySQL on Amazon , which seemed to be perfect and…