Recent Blog Posts

Profiling Drupal 8 Sites in Drupal VM with XHProf and Tideways

XHProf, a PHP extension formerly created and maintained by Facebook, has for many years been the de-facto standard in profiling Drupal's PHP code and performance issues. Unfortunately, as Facebook has matured and shifted resources, the XHProf extension maintenance tailed off around the time of the PHP 7.0 era, and now that we're hitting PHP 7.1, even some sparsely-maintained forks are difficult (if not impossible) to get running with newer versions of PHP.

Enter Tideways.

Tideways has basically taken on the XHProf extension, updated it for modern PHP versions, but also re-branded it to be named 'Tideways' instead of 'XHProf'. This has created a little confusion, since Tideways also offers a branded and proprietary service for aggregating and displaying profiling information through Tideways.io. But you can use Tideways completely independent from Tideways.io, as a drop-in replacement for XHProf. And you can even browse profiling results using the same old XHProf UI!

YAML formatting and Drupal 8 - making things readable

As someone who loves YAML syntax (so much more pleasant to work with than JSON!), I wanted to jot down a few notes about syntax formatting for the benefit of Drupal 8 developers everywhere.

I often see copy/pasted YAML examples like the following:

object:
  child-object: {key: value, key2: {key: value}}

This is perfectly valid YAML. And technically any JSON is valid YAML too. That's part of what makes YAML so powerful—it's easy to translate between JSON and YAML, but YAML is way more readable!

So instead of using YAML like that, you can make the structure and relationships so much more apparent by formatting it like so:

Preserve the ability to Quick Edit nodes when theming node templates!

...aka, avoid the annoying Javascript error below:

drupal.js:67
TypeError: undefined is not an object (evaluating 'entityElement
      .get(0)
      .getAttribute')

Many themers working on Drupal 8 sites have Contextual menus and Quick Edit enabled (they're present in the Standard Drupal install profile, as well as popular profiles like Acquia's Lightning), and at some point during theme development, they notice that there are random and unhelpful fatal javascript errors—but they only appear for logged in administrators.

Eventually, they may realize that disabling the Contextual links module fixes the issue, so they do so and move along. Unfortunately, this means that content admins (who tend to love things like contextual links—at least when they work) and up not being able to hover over content to edit it.

There are two ways you can make things better without entirely disabling these handy modules:

Review: Satechi USB Type-C inline Power Meter (ST-TCPM)

tl;dr: It's a power meter, not a protection circuit. It works well and is worth the money if you need to monitor power consumption, but it's made of plastic and doesn't feel like it can take a beating, so handle with care.

For some time, I've used a PowerJive USB Power Meter to measure the charging rate of various USB power adapters, and even things like how much power a Rasbperry Pi uses under load.

Review: NOYCE 13' (4m) Lightning cable

tl;dr: If you need a long Lightning cable, this is one of the few reliable options. If you need the fastest charging possible for an iPad, stick to Apple's much shorter cable.

A year or so ago, the owner of NOYCE Labs sent me a sample iPhone-compatible microphone to test, and I really liked it—I still use it for impromptu recordings with my iPhone, in fact!

NOYCE 4m 13ft Lightning Cable with Box

So when I got an email requesting I review NOYCE's latest product, the longest (at least that I know of) Lightning USB cable available on Amazon, I gladly accepted. NOYCE sent me their 13-foot-long (4 meters for the non-Imperial reader) Lightning cable, and I've used it for a couple months now, so I figured it was a good time for a review.

Pages

Subscribe to Jeff Geerling's Blog