Dcycle Blog

Recent Posts

  • April 22, 2022

    Customizing TinyMCE on Mediawiki

    In this post we will look at how to customize the TinyMCE toolbar for Mediawiki, by making custom toolsets, and we will look at the challenge of figuring out machine names of tools you would like to use.To follow along, if you have Docker installe...

  • April 21, 2022

    Alpine and Docker, a perfect fit

    Working with a new M1-powered MacBook has had a big effect on my Docker workflows.On the one hand, containers properly configured for the ARM achitecture, used by M1, are very fast, as discussed in Docker PHP on the M1 chip, example with Static An...

  • April 19, 2022

    Verifying telephone numbers in Drupal

    When allowing users to input phone numbers in Drupal, you might want to make sure that they actually have access to the phone number they are using, rather than being allowed to input any random phone number.In practice, when a user claims to have...

  • March 25, 2022

    PHP and Apache (or Nginx) in separate Docker containers using Docker Compose

    In many cases, PHP and Apache are run in the same container and based on a single image.For example, the PHP image has tags which combine Apache and Debian; Similarly for the Drupal CMS image.If you are currently managing a project which uses php:...

  • March 24, 2022

    Installing Docker for Windows (not for the faint of heart)

    Here is how to use Docker Desktop for Windows. This has been tested on a Windows 10 Pro (Supposedly if you’re using Windows 10 Home, you’re out of luck) HP EliteBook with 16 Gb or RAM. (I have found that on machines with less RAM certain errors ca...

  • February 27, 2022

    Translating a Drupal user interface (PHP and Javascript): a workflow

    So you find yourself, as one does, building a complete user interface with PHP and Javascript for Drupal 9; and you’d like to delegate the translation of the front-end to a non-developer. (You want the client to be empowered to change the UI strin...

  • February 07, 2022

    Altering a list view in drupal, using an example with Webform

    In some cases administrative lists are actually views using the core Views module, as is the case with /admin/content (which can be modified using the Views interface at /admin/structure/views/view/content). These are quite easy to modify in a dev...

  • January 27, 2022

    In a spreadsheet, do not reference a cell calculated using UNIQUE() or FILTER()

    If you are using Google Sheet’s =UNIQUE() or =FILTER() functions (or both) to generate values in cells, you should never reference those cells directly.ExampleIf you have these cells in sh1:   A B C 1 ...

  • November 17, 2021

    Docker PHP on the M1 chip, example with Static Analysis on Drupal: 9 times faster

    In 2020, Apple unveiled a new chip, M1, which uses a different architecture than the Intel chips widely used in servers and laptops.Docker calls the intel architecture “linux/amd64”, and the M1 architecture “linux/arm64” (can also be linux/arm64/v...

  • June 10, 2021

    Weighted average is bad; weighted average from multiple sources is worse

    I’ve already written about why I hate the “weighted average” accounting method for foreign funds in Producing an expense report in foreign funds using the weighted average method (May 12, 2020).In this post I’ll take a hypothetical example of havi...

  • January 29, 2021

    hook_update_N(), a powerful and dangerous tool to use sparingly

    What is hook_update_N()?Let’s say you are developing a Drupal module (custom or contrib) which tracks how many visitors landed on specific node pages, version 1 of your code might track visitors by nid (node id) in the database using a table like ...

  • January 20, 2021

    Adding continuous integration (CI) to your workflow

    This post is aimed at web development teams and is not tied to a specific technology. We will aim to not get more technical than is needed, but rather to explore what Continuous integration (CI) is, and how it can help save teams money within a mo...

  • November 05, 2020

    Traccar fleet management software evaluation

    I found myself in need of managing a fleet of 4 vehicles with a plan to increase to over 20 vehicles in the coming years: track milage cross-reference fuel usage with milage I want my system to be open-source and self-hosted I want my system t...

  • May 12, 2020

    Producing an expense report in foreign funds using the weighted average method

    Next time you find yourself working on a project in, say, Haiti, and receiving funding from, say, the Canadian Government, keep in mind that exchange rates can vary wildly, and some funders can request specific methods for reporting expenses. In t...

  • April 22, 2020

    Deploying Drupal to Kubernetes, no previous knowledge required

    Kubernetes is a way of deploying resilient, scalable applications to the cloud. Resilient because Kubernetes is designed to recover if something goes wrong. Scalable because with Kubernetes, your application is not linked to a single virtual mac...

  • April 09, 2020

    On the importance of the base currency of a balance sheet

    First I must warn you that I am by no means an accountant; but I would like to share a particularity of reporting accounts in a currency different from the base currency. I’ll give an example with an organization that reports its balance sheet in ...

  • December 03, 2019

    Écouter des fichiers de musique de votre Mac sur votre téléphone Android

    Cet article décrit une technique pour écouter des fichiers de musique (m4a, mp3…) que vous avez sur votre Mac, et que vous aimeriez écouter sur votre téléphone Android, sans passer par un compte cloud (Google Play, etc.). Cette technique est très ...

  • October 16, 2019

    Start unit testing your Drupal and other PHP code today

    Unit tests are the fastest, most reliable kinds of tests: they confirm that the smallest units of your code, i.e. class methods, work as expected.Unit tests do not require a full environment with a database and external libraries; this makes unit ...

  • June 01, 2019

    Filters on Blended Data in Google Data Studio

    Google Data Studio is a free service which allows you to create dashboards based on multiple data sources, especially Google-centric ones but also databases. The data can be filtered by date and other so-called dimensions.Previous knowledgeThis ar...

  • April 10, 2019

    Quickbooks usability issues

    I’ve recently had to start using Quickbooks because it is required by my accountant to get verified financial statements for a nonprofit on whose board I serve. Here is a short description of my experience to date… I opened a company using the 30...

  • April 07, 2019

    An approach to automating Drupal accessibility tests

    Accessibility tests can be automated to a degree, but not completely; to succeed at accessibility, it needs to be a mindset shared by developers, UX and front-end folks, business people and other stakeholders. In this article, we will attempt to r...

  • March 14, 2019

    Debug outgoing emails with Mailhog, a dummy mailserver with a GUI

    Often, during local Drupal development (or if we’re really unlucky, in production), we get the dreaded message, “Unable to send e-mail. Contact the site administrator if the problem persists.”This can make it hard to debug anything email-related d...

  • March 04, 2019

    What if accounting worked like software development? Command-line, double-entry accounting for agencies

    I’ve always fled my accounting responsibilities, or did the bare minimum, using inadequate tools like spreadsheets, only to be caught up yearly at tax time having to apologize to my dumbfounded accountant.My situation at Dcycle is typical: multipl...

  • February 20, 2019

    Run long-lived processes on a remote server while you are logged out, using the Screen utility

    IntroductionConsider the following scenario: you’re on a long-distance multi-day bike ride, you have your laptop with you and you need to run a long process on a remote Ubuntu server, something like importing a huge database, which might take upwa...

  • October 27, 2018

    Local development using Docker Compose and HTTPS

    This article discusses how to use HTTPS for local development if you use Docker and Docker Compose to develop Drupal 7 or Drupal 8 (indeed any other platform as well) projects. We’re assuming you already have a technique to deploy your code to pro...

  • October 05, 2018

    HTTPS on Acquia stage environments with LetsEncrypt, semi-automated

    I recently ran into a series of weird issues on my Acquia production environment which I traced back to some code I deployed which depended on my site being served securely using HTTPS.Acquia Staging environments don’t use HTTPS by default and req...

  • April 07, 2018

    Fast-track local Drupal 8 core patch development and testing

    The process documented process for setting up a local environment and running tests locally is, in my opinion, so complex that it can be a barrier to even determined developers.For those wishing to locally test and develop core patches, I think it...

  • February 25, 2018

    Getting around Replace NewToner on Dell E310DW

    Getting around “Replace NewToner” on Dell E310DWThe Dell E310DW prevents you from printing if it thinks the toner is low. Of course, the toner is fine, it’s just planned obsolescence.There is a way around this: Go to http://dellfa608a.local./gene...

  • February 23, 2018

    Microsoft Mozaik is unusable

    My school board, Marguerite-Bourgeoys, sent my wife and myself an email asking us to re-register our kids for the following year using Microsoft Mozaik software.A link is provided to the Microsoft Mozaik portal.My wife tried registering several ti...

  • January 24, 2018

    Caching a Drupal 8 REST resource

    Here are a few things I learned about caching for REST resources.There are probably better ways to accomplish this, but here is what works for me.Let’s say we have a REST resource that looks something like this in .../my_module/src/Plugin/rest/res...

  • December 18, 2017

    Migrating Webforms from Drupal 7 to Drupal 8

    I recently needed to port hundreds of Drupal 7 webforms with thousands of submissions from Drupal 7 to Drupal 8.My requirements were: Node ids need to remain the same Webforms need to be treated as data: they should be ignored by config export a...

  • October 06, 2017

    Deploying Letsencrypt with Docker-Compose

    Last week I wrote about setting up a reverse-proxy to serve a number any number of Docker containers via https.In order for this technique to work with Docker-Compose, we need to add a network to the Docker-Compose container.PremiseLet’s say you h...

  • October 03, 2017

    Letsencrypt HTTPS for Drupal on Docker

    This article is about serving your Drupal Docker container, and/or any other container, via https with a valid Let’s encrypt SSL certificate.Edit: if you’re having trouble with Docker-Compose, read this follow-up post.Step one: make sure you have ...

  • February 28, 2017

    Can the exact same module code run on Drupal 7 and 8?

    As the maintainer of Realistic Dummy Content, having procrastinated long and hard before releasing a Drupal 8 version, I decided to leave my (admittedly inelegant) logic intact and abstract away the Drupal 7 code, with the goal of plugging in Drup...

  • October 02, 2016

    When not to use Drupal

    Unless you work exclusively with Drupal developers, you might be hearing some criticism of the Drupal community, among them: We are almost cult-like in our devotion to Drupal; maintenance and hosting are expensive; Drupal is really complicated;...

  • September 30, 2016

    Migrating data from Drupal to Jekyll

    This technical post will run through how I went about migrating this site (the Dcycle blog) from Drupal to Jekyll. For the reasons why I migrated, please see Know when not to use Drupal.Exporting very simple content from Drupal to JekyllDepending ...

  • September 19, 2016

    Using Docker to evaluate, patch or develop Drupal modules

    Docker is now available natively on Mac OS in addition to Linux. Docker is also included with CoreOS which you can run on remote Virtual Machines, or locally through Vagrant.Once you have installed Docker and Git, locally or remotely, you don’t ne...

  • May 08, 2016

    Using git bisect to determine when a failure was introduced

    So your project’s tests are failing and you’re not sure when the failure was introduced. Your git history might look like:f09c875 - failing commit9344dc8 - ?a84feca - ?1a66df1 - ?05e4293 - ?acbddb6 - ?5fb7fac - ?fba9f93 - ?93cdfa0 - ?c9e0fc2 - ?80...

  • February 09, 2016

    Compass Sass to CSS using Docker

    I have seen many developers on a few teams cringe when they need to make a simple CSS change and are faced with this folder structure:myproject some-folder another-folder sass something.scss css something.cssIn my opini...

  • November 16, 2015

    Gitsubmodulizing and Gitflow

    Gitflow is a development workflow we use where all features are developed on their own branch, and we constantly merge in the mainline (in this example it will be master) to the feature branches, until the feature branches are ready, at which poin...

  • September 11, 2015

    Debugging a hanging PHP script

    I installed a script called test.php on a Vagrant box with CentOS 6.x and PHP 5.3. I made my script available at http://example.local/test.php and it contains:<?phpfunction whatever() { sleep(1);}while (TRUE) { whatever();}When I access this ...

  • July 27, 2015

    Fixing "Docker error : no space left on device" by increasing the size of your CoreOS VM

    You might get this error especially with very large projects. We are assuming that your setup is: Your local “bare metal” computer (can be any OS). CoreOS running on Vagrant and VirtualBox. Containers running via Docker on CoreOS.We are assumin...

  • July 16, 2015

    Date-related tests failing on one environment and passing on another? Make sure your timezone is always the same

    PHPUnit tests, or Drupal simpletests, are sometimes used to make sure your functions calculating date and times work correctly.I recently had a failure on my continuous integration server where a year was one day more than it was supposed to be. O...

  • July 07, 2015

    What does it take to succeed with TDD, and why should you make the effort?

    A few weeks ago, I participated in an online panel on the subject of Test-Driven Development as part of Continuous Discussions (#c9d9), a series of community panels about Agile, Continuous Delivery and DevOps. Watch a recording of the panel:Contin...

  • July 06, 2015

    Catching watchdog errors in your Simpletests

    If you are using a site deployment module, and running simpletests against it in your continuous integration server using drush test-run, you might come across Simpletest output like this in your Jenkins console output:Starting test MyModuleTestCa...

  • June 10, 2015

    Add unit testing to legacy code

    Edit, this blog post is deprecated, see blog.dcycle.com/unit instead!To me, modern code must be tracked by a continuous integration server, and must have automated tests. Anything else is legacy code, even if it was rolled out this morning.In the ...

  • February 23, 2015

    Continuous integration with Circle CI and Docker for your Drupal project

    Continuous integration (CI) is the practice of running a series of checks on every push of your code, to make sure it is always in a potentially deployable state; and to make sure you are alerted as soon as possible if it is not.Continuous integra...

  • February 18, 2015

    A quick intro to Docker for a Drupal project

    I recently added Docker support to Realistic Dummy Content, a project I maintain on Drupal.org. It is now possible (with Docker installed, preferably on a CoreOS VM) to run ./scripts/dev.sh directly from the project directory (use the latest dev v...

  • February 17, 2015

    Rebasing in Git (squashing commits)

    Here is a typical usecase: You master branch contains your code in a potentially deployable state You have a feature branch, with a bunch of commits. When your feature branch is ready, you want to merge it to master as a single commit.For examp...

  • February 09, 2015

    Drupal and Docker: Creating a new Docker image based on an existing image

    To get the most of this blog post, please read and understand Getting Started with Docker (Servers for Hackers, 2014/03/20). Also, all the steps outlined here have been done on a Vagrant CoreOS virtual machine (VM).I recently needed a really simpl...