Uncategorized

  • Constant scalar expressions let you compute defaults

    Before 5.6, a constant or a default parameter value had to be a literal. Anything computed — even multiplying two numbers you had already defined — was a…

  • EXPLAIN type ALL means it read the whole table

    EXPLAIN output has a dozen columns and two of them carry most of the signal. type describes how MySQL reached the rows, and ALL is the worst answer:…

  • Building a LEMP stack on a bare VPS

    Ten dollars a month buys a machine with 1 GB of RAM and nothing installed. Turning it into nginx, PHP-FPM and MySQL tuned for the memory you actually…

  • Bootstrap grid nesting needs a fresh row

    The grid works by putting negative margins on .row to cancel the padding on .col-*. Nesting columns directly inside a column skips that cancellation, and the inner content…

  • The repository pattern earns its keep at the second data source

    A repository wrapping a single ORM, forwarding find to find, is indirection with nothing behind it — the abstraction has one implementation and will never have another, and…

  • Variadic functions and argument unpacking in PHP 5.6

    Collecting a variable number of arguments used to mean func_get_args(), which hides the signature from anyone reading the function and from every IDE. 5.6 gives the language a…

  • jQuery event delegation survives DOM replacement

    Binding a handler directly to elements binds it to the elements that exist at that moment. Replace the list through Ajax and every handler goes with the old…

  • switch_to_blog does not switch everything

    In multisite, switch_to_blog() repoints the database tables and the uploads path. It does not reload the other site’s active plugins, its theme, or anything a plugin cached in…

  • Array.prototype.find returns the element, not the index

    indexOf only works when you already have the value you are looking for. Finding the first element matching a predicate has meant either a filter() that builds a…

  • journalctl -u beats grepping /var/log

    On a systemd host the logs are in a binary journal rather than plain files, which sounds like a step backwards until the first time you need one…