Recent Blog Posts

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.

Apple's Photos for macOS taking forever to scan photos for People?

I recently migrated around ~50,000 photos and videos from Aperture to Photos (see my blog post on the process), and have also in a short amount of time upgraded my personal and work Mac laptops (both from older MacBook Airs to newer MacBook Pros).

On both of my new laptops—which were at least 3x faster than my older Airs—I noticed that Photos started completely fresh in its photo analysis for the 'People' album that shows everyone's faces. And after three weeks of seeing one of my CPUs stick around 100% all day every day (while plugged in), I started getting sick of this.

I would leave the Mac on all night, and check in the morning, and only 20-30 new faces would be recognized.

macOS Sierra Photos - People Scanned slow and stuck
Some days it seemed it would take forever...

Re-save all nodes of a particular type in an update hook in Drupal 8

I recently needed to re-save all the nodes of a particular content type (after I had added some fields and default configuration) as part of a Drupal 8 site update and deployment. I could go in after deploying the new code and configuration, and manually re-save all content using the built-in bulk operation available on the /admin/content page, but that would not be ideal, because there would be a period of time where the content isn't updated on the live site—plus, manual processes are fragile and prone to failure, so I avoid them at all costs.

In my Drupal 8 module, called custom, I added the following update hook, inside custom.install:

Can't upload more than 20 files using Media Image Entities in Drupal 8?

After migrating an older Drupal 6 site with 20,000 media items to Drupal 8, I found a strange problem with image uploads. On the Drupal site, using Image FUpload and Adobe Flash, I could upload up to 99 images in one go. On the new Drupal 8 site, I was only able to upload 20 images, even though I didn't see an error message or any other indication that the rest of the images I had selected through the Media Image upload form were not successfully added.

I could choose 21, 40, or 500 images, but only 20 were ever added to an album at any time.

There were no apparent warnings on the screen, so I just assumed there was some random bug in the Media Image Entity or Media module suite that limited uploads to 20 files at a time.

But due to an unrelated error, I glanced at the PHP logs one day, and noticed the following error message:

Testing redirections using Behat and the Behat Drupal Extension

One project I'm working on needed a Behat test added to test whether a particular redirection works properly. Basically, I wanted to test for the following:

  1. An anonymous user accesses a file at a URL like http://www.example.com/pictures/test.jpg
  2. The anonymous user is redirected to the path http://www.example.com/sites/default/files/pictures/test.jpg

Since the site uses Apache, I added the actual redirect to the site's .htaccess file in the docroot, using the following Rewrite configuration:

<IfModule mod_rewrite.c>
  RewriteEngine on

  # Rewrite requests for /profile_images to public files directory location.
  RewriteRule ^ pictures/(.*)$ /sites/default/files/pictures/$1 [L,NC,R=301]
</IfModule>

Testing with curl --head, I could see that the proper headers were set—Location was set to the correct redirected URL, and the response gave a 301. So now I had to add the Behat test.

Pages

Subscribe to Jeff Geerling's Blog