Drupal logging arrays with logger
In drupal 9 for logging you can use logger service to log array data in some readable format, by adding html code and print_r to array.
\Drupal::logger('my_module
')->warning('<pre><code>' . print_r($responseObj, TRUE) . '</code></pre>');
Nginx: 413 – Request Entity Too Large Error and Solution
Working in Drupal 9.x, I was loading images via the Media module. Below 1 mb no issue. Any thing over - nothing. Nothing as in no response when loading.
An interesting situation, as I had already changed the php.ini file where the following updates occured:
; Maximum allowed size for uploaded files. ; http://php.net/upload-max-filesize upload_max_filesize = 2M
Had changed to
Percentage encoding
You would have come across a URL string that appears as
https://example.com/project-search?search_api_fulltext=&f%5B0%5D=species%3AAtlantic%20Salmon
As you would already seen %20 many times, that is a space. Commonly seen in file names either documents or images.
However, what about the others. Off the top do you know what %3D is? Maybe, but I didn't. Below is a quick guide to percentage encoding table:
How to switch users in Ubuntu and other Linux
It is really simple to switch users in Ubuntu or any other Linux distribution using the terminal, iTerm2 or your go to shell program.
All you need to do is to know the username and its account password and you can switch users with su command:
su another_username
You’ll be asked to enter the password of the user you want to switch to.
Install iTerm2 and integrate zsh
Z shell (Zsh) is a Unix shell built on top of bash (the default shell for macOS) with a large number of improvements.
In this article, I'll run through how to configure iTerm2 with ZSH and its dependencies.
Step 1: Install Homebrew
Homebrew is a free and open-source software package management system that simplifies the installation of software on Apple’s macOS.
How to create a date range widget?
Steps to get the Solr date range widget working.
Steps
Enable the Facets Range Widget sub-module.
Install the jQuery-ui-Slider-Pips library, as described in the README.txt file in that sub-module's folder. After playing with this for sometime to get it working, I found the best way to install is via composer.
How to Install Tika to be used for Solr Search API Attachments
Following is a series of steps to install Tika and have it running for your Solr Search API Attachments.
Java is it running on your server
To begin you must have Java installed on your server/machine. To check if Java is installed use the command
java -version
Performing the above command will output something similar to:
Unknown collation: ‘utf8mb4_0900_ai_ci' Error
Working on an Azure server I ran a mysqldump command to generate a copy of the db. No issues, the file downloaded on to the serve without cause.
The Problem
On my local environment, using Sequel Ace I imported the file, but it suddenly it stopped with a red message “Unknown collation: ‘utf8mb4_0900_ai_ci‘”
Install Drush globally in Ubuntu
Each time I worked through the process of installing Drush I would check that had installed by running the command drush --version. However, my response was
drush --version Command 'drush' not found, did you mean: command 'rush' from deb rush (1.8+dfsg-1.1) Try: apt install <deb name>
Yet if I ran the command:
composer global require drush/drush
The output would be
Migration is busy with another operation
The migrate process saves the status of each running migration in the database. Any error in the code will abnormally terminate the process so the database won't be updated properly and will keep saying that "something is still running". In Drupal I had a look through the error log and came across the following message: