The JavaScript Event Loop

I received that feeling of excitement, the unlocking of the mind, watching Philip Roberts unpack the JavaScript event loop at JSConf EU 2014. I'd like to share that moment; and hopfully the feeling. Who knew setTimeout(function(){ do_stuff(); }, 0); would be so helpful.…

Import and Export MySQL and PostgreSQL

There are a number of ways to export and import data from a database. You can use a Mac client like Sequal Pro for MySQL, for example. You can do the same for PostgreSQL, though I have not settled on a Mac client for PostgreSQL. Mac clients aside, you need…

Raw PHP and MySQL Eager Loading

Working with complicated and joined data sets can be tricky for MySQL database performance. For example, What if you need to load multiple authors and their books from a database. How would you work around the N+1 problem and avoid unnecessary queries to the database without an expensive join…

Character Encoding: UTF-8, PHP, MySQL and Sequel Pro

I love Sequel Pro. However, the default encoding is latin1 and you should really be using a form of Unicode like utf8mb4. The next time you add a database with Sequel Pro be sure to select UTF-8 Unicode (utf8mb4) if you want to skip character encoding headaches. Make proper character…

Server Level CRON Backups

Backing up files and storing them in a remote location should be done on regular basis. Backups are vital. They ensure your code and assets are available if your server is hacked, destroyed and when your data is lost or corrupted. In WordPress you could us a plugin like BackupBuddy…

Installing xDebug for PHP7

Xdebug deepens debugging PHP apps and websites to a level you can't receive from the manual process of using code level var_dump(). Setup To install Xdebug for PHP7 on Ubuntu you will need to do so manually. Ubuntu 15 and lower will not come with a package for PHP7…

Enabling Performance Monitoring for MariaDB and MySQL

Enabling performance monitoring for MariaDB and MySQL works the same way. Performance monitoring for databases is extremely helpful when you have records in the hundreds of thousands using complex joins. It also helps when you want to do basic performance monitoring overall. In the past you could use general_log,…