Set a flexible php variable

If you want php set a default variable value, but only if you yourself (in a particular case) set (before) another value of that variable, you can use a code like this:

$your_variable = $your_variable ?? $a_default_value;

That means: if you doesn’t define another value (with a code like $your_variable = "some_particular_value" ), the value of $your_variable will be $a_default_value.

Otherwise it will be "some_particular_value" .

Undesired empty rows in html source

Using php to generate automatically a webpage can produce undesired empty rows (typically at the begging of your source code, before <!DOCTYPE html>).
To avoid them you could have i.g. to remove empty rows between ?> and <?php, that is something like the follow code:

?>

<?php

The (new) working code should be

?>
<?php

On the contrary, empty rows inside <?php ... ?> blocks are not relevant.

In general, every empty (useless) row after a ?> could generate undesired empty rows in your html output source code.

Innodb: pros and cons

If you have to sync different devices you could have many problems with Innodb engine.

But on the other hand, it has some advantages: is more modern than MyIsam, and support foreign keys.

A compromise can be have Innodb as engine, but all the tables in MyIsam.
You should in any way be careful with some files, as already explained, in particular ibdata1.

how get rid of Innodb

If you don’t need foreign kayes, you can get rid of Innodb in /etc/my.cnf, with these instructions (stop mariadb before, and restart after):

default-storage-engine=MyISAM


Linux fstab to mount different fs with the same label

If you have different partitions (such as USB ones) with the same label (so that you can syncro them with the same script) but with different filesystem (such as btrfs and ext4) you can modify your fstab line using auto instead of etx4 or btrfs.

I mean something like this:

LABEL="your-label"  /media/your-mount-path  auto  users,noauto,noatime,nodiratime  0  2

In this way you will be able to mount your usb devices (either etx4 or btrfs or another fs) without problems.

Calibre unexpected dark theme

It can be very annoying an undesired dark theme in Calibre (both viewer and editor): reading could become difficult, or almost impossible.
This happens (probably) if you have a flatpack release of Calibre: try to remove the flatpack one, and install a release of Calibre from their website.

Flatpack is convenient (automatic updates), but have some problems….