How to use MariaDB REPLACE with LIKE on data containing backslashes
Recently I was cleaning up some data as part of a data analysis project, and ran into a frustrating problem with stray backslashes in text fields. Here’s how I ended up solving it.
We offer the articles below in the hope that they will be useful, but we cannot accept liability for any problems caused by the instructions that they contain. If you have a problem, question or feedback relating to one of our articles, please post a comment so that other readers can benefit. We regularly review comments and reply or update the articles, to ensure their continued usefulness. All articles are provided free, without any advertising or tracking, for the benefit of the technical community.
If you require paid commercial support, please contact us for assistance.
Please note that AI scraping of our content is expressly forbidden. We are in favour of responsible AI, which includes compensating creators fairly for use of their work. Just because it’s freely available to read, does not mean that it is freely available for unlicenced commercial use. We retain copyright of all of our content. If you wish to licence our content for AI training or similar purposes, or wish to hire us to write technical documentation, please contact us.
Recently I was cleaning up some data as part of a data analysis project, and ran into a frustrating problem with stray backslashes in text fields. Here’s how I ended up solving it.
Sometimes it’s necessary to load external JavaScript into a React/Next.js system. There are various ways of doing this, but one of the most commonly recommended is via Next.js’s <Script /> component. Today I discovered a strange quirk. If you load the script inside a Next.js <Head /> component, then the onLoad function must be a conventional JavaScript onload function, not a React function. If you try to use a React function, it will not run, but there will be no warnings.
On some of the servers that I maintain, I use monit to monitor the status of key system services. I have it set up to try and automatically restart the service and only notify me if it’s unable to restart it. This helps to keep everything running smoothly without manual intervention.
PHP 8.0 introduced a new JIT compiler, which theoretically decreases the processing time for PHP-generated content. According to the official instructions, it’s very easy to enable, but it is disabled by default in Debian and requires some slightly different configuration changes to re-enable. Be aware that the Debian maintainer decided to disable it due to reports of segfaults from some users.
The apt package management system often ends up uninstalling packages but leaving behind their configuration files. For many years it’s been easy to find them using the command dpkg -l | grep --perl-regexp '^rc', but it required fiddling around with shell commands to purge the packages (remove the leftover configuration files) because apt didn't support a way of filtering them by installation state. Since apt version 2.0 this is no longer the case, but I always forget the command and searching online usually turns up the old and overly complicated way of doing it.
This is a follow up to my previous article on automatically updating WordPress using wp-cli. A number of the sites that I maintain run on servers that have been upgraded to PHP 8.x, but some of their plugins and themes include deprecated code. As a result, every time that cron runs to check for updates, I get a load of PHP Deprecated warnings. Searching online suggested a few fixes, but none of them worked for me, so I developed a different workaround.
Things that didn’t work:
Every few months I have to set this up on a new machine, and it’s always very confusing because most VPN instructions are for Windows, Mac or mobile devices. Ubuntu’s GUI tool for managing VPNs is quite powerful, but not very intuitive. Here’s how to find all of the necessary options.
Quite frequently I start typing text into an HTML <input type='text'> element, then Alt-Tab to a different window to look something up, then Alt-Tab back to continue typing. Firefox automatically selects all of the text when the input field is refocused, which causes me to overwrite it because I automatically start typing with the expectation that it will continue where I left off. Here is a partial mitigation for that:
Views is a Drupal tool for organising blocks of information that repeat: it’s great for rows in a table, items in a list, and panels in a grid. But our project needed something that didn’t neatly fit any of these models, and in a sense was a bit of all three. So, rather than try to bend the defaults to our will and wrangle with the inevitable compromises, the obvious thing to do was create our own option.
I struggled to find a straightforward tutorial on this, so this is how I went about it.
Recently, I was setting up a Debian server on an old laptop with the sole purpose of running Draytek's VigorConnect software to monitor and manage the network on my campus (which uses Draytek switches and wireless access points). There are plenty of cloud-based management AP controller options, but I wanted a local, self-hosted option because our internet has been patchy in the past, and because I don't want any monthly license fees.