By default, WordPress adds <link rel="shortlink"> meta tag to the <head> of a website and uses the short url like https://mixable.blog/?p=12345 for this. When you already use nice slugs as permalink structure, such a tag is not necessary, because you already have unique urls.
To remove the shortlink tag, you can use an additional plugin or simply add some code to your themes functions.php:
There are multiple ways to remove an element from an array in PHP. The simplest one is the method unset().
unset()
The method unset() can be used to remove a single element of the array:
PHP
$myArray = ['apple', 'banana', 'cherry', 'date'];unset($myArray[1]); // Remove the element at index 1 (banana)$myArray = array_values($myArray); // Re-index the array if you want to remove the gapprint_r($myArray);
This function can be used to remove a portion of an array and replace it with something else. If you want to remove a single element, you can specify a length of 1:
PHP
$myArray = ['apple', 'banana', 'cherry', 'date'];array_splice($myArray, 1, 1); // Remove 1 element starting from index 1print_r($myArray);
array_diff()
You can use this function to create a new array with all the elements of the first array that are not in the other arrays:
This error happened after moving a WordPress installation to another server. The new server had a different linux distribution and a newer PHP version. In my case, the environment changed from PHP 7.4 to PHP 8.2.
I already added some missing PHP extensions and updated the configuration to match the old one, but the error still exists.
At the end, this could be solved by adding the following code in wp-config.php file:
When running GitLab, the default installation enables all services by default. This might result in a poor performance, especially when the server has limited resources like RAM or CPU power.
To improve the performance of your installation, the GitLab documentation already provides some settings that can be adjusted easily.
My web server has 6GB of RAM, which results in temporary timeouts – especially when GitLab Runner executed some jobs.
I started with the changes listed below and already saw a huge reduction of loading time and UI response time on my GitLab installation. The following steps have been copied from docs.gitlab.com as a reminder for future setups.
Disable monitoring
GitLab enables all services by default to provide a complete DevOps solution without any additional configuration. Some of the default services, like monitoring, are not essential for GitLab to function and can be disabled to save memory.
In /etc/gitlab/gitlab.rb:
prometheus_monitoring['enable'] = false
We observed 200MB of memory usage reduction configuring GitLab this way.
Configure how GitLab handles memory
GitLab consists of many components (written in Ruby and Go), with GitLab Rails being the biggest one and consuming the most of memory.
GitLab Rails uses jemalloc as a memory allocator. jemalloc preallocates memory in bigger chunks that are also being held for longer periods in order to improve performance. At the expense of some performance loss, you can configure GitLab to free memory right after it is no longer needed instead of holding it for a longer periods.
The Espressif tools contain a binary called xtensa-esp32-elf-addr2line which will decode the backtrace addresses and return details about the source files, lines and function names, etc.
Entering ASCII control characters depends on the specific keyboard layout and operating system you are using. Here’s a general guide for Linux, Windows, and macOS:
Linux
In most Linux terminals, you can enter ASCII control characters using the keys Ctrl + Shift + u in combination with a letter or symbol. For example:
Ctrl + Shift + u and then 0 + 1: ASCII code 0x01 (Start of Heading)
Ctrl + Shift + u and then 0 + 2: ASCII code 0x02 (Start of Text)
Ctrl + Shift + u and then 0 + 3: ASCII code 0x03 (End of Text)
And so on…
Windows
In the Windows operating system, you can use the following steps:
For characters with ASCII values 0 to 31, you can typically enter them using the Alt key and the numeric keypad. For example, to enter ASCII 0x01, press Alt + 0 + 0 + 1.
For some characters, you can use the Windows Character Map utility. Press the Win key + R to open the Run dialog, type charmap, and press Enter. Select the desired character and copy/paste it.
macOS
On macOS, you can use the following steps:
Character Viewer: Press Control + Command + Space to open the Character Viewer. Search for the desired control character and insert it into your document.
Note that you may have to go to the dots menu at top left and select Customize to add the Unicode category. The Unicode category is under Code Tables.
Note: The availability of these methods may vary depending on your keyboard layout and the specific software you are using. If you’re using a specific text editor or terminal, it might have its own way of entering control characters.
What are ASCII control characters?
ASCII control characters are special characters in the ASCII (American Standard Code for Information Interchange) character encoding scheme that are used to control peripheral devices such as printers and teletypewriters. They are non-printable characters and typically have specific functions rather than representing printable symbols like letters or numbers.
Here is a list of some commonly used ASCII control characters along with their decimal and hexadecimal values:
By default, FutureBuilder provides a single future parameter that handles a single Future. For multiple Futures, we can combine them into a single Future using Future.wait. Here’s a step-by-step guide on how to do this:
Create a list of Future objects
Create a list of Future objects that represent the asynchronous operations you want to perform. For example, let’s assume you have two futures:
Future<String> fetchFirstData() async {// Simulate a network request or other asynchronous operation.awaitFuture.delayed(Duration(seconds: 2));return"First Data";}Future<int> fetchSecondData() async {// Simulate another asynchronous operation.awaitFuture.delayed(Duration(seconds: 3));return42;}
Combine the futures using Future.wait
Use the Future.wait method to combine the individual futures into a single future. Future.wait takes a list of futures as an argument and returns a single future that completes when all the input futures have completed.
Now, use the FutureBuilder widget to handle the combined future and display the results in your widget tree. You can place this widget in your build method.
classMyWidgetextendsStatelessWidget {@overrideWidgetbuild(BuildContext context) {returnFutureBuilder( future: fetchData(), builder: (context, snapshot) {if (snapshot.connectionState == ConnectionState.done) {// Use the results from the futures here.if (snapshot.hasError) {returnText("Error: ${snapshot.error}"); } else {returnColumn( children: [Text("First Data: ${snapshot.data[0]}"),Text("Second Data: ${snapshot.data[1]}"), ], ); } } else {// While waiting for the futures to complete, you can show a loading indicator or placeholder.returnCircularProgressIndicator(); } }, ); }}
In the code above, we use the snapshot to check the connectionState. When the connectionState is ConnectionState.done, it means that both futures have completed. You can access the results using snapshot.data.
Remember to replace the fetchFirstData and fetchSecondData functions with your actual asynchronous operations. This example demonstrates how to use FutureBuilder to handle multiple futures in a single widget in Flutter.