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….

Espanso

A very useful feature of espanso (a text expander also for wayland) is the possibility to convert the clipboard content to lowercase (with ::low) or to uppercase (with ::up).

Webtrees problems

Webtrees is a fork of PhpGedView, an excellent genealogy program. It ha a big problem: uploading and setting multimedial files.
It’s often a terrible waste of time: a very complicated way to upload files.

workaround

  • You can try to upload images (if you work in localhost and you know what you are doing) in this way:
  • 1. symlink an image to /media folder in /data webtrees folder.
  • 2. add that image file in phpmyadmin (your webtrees db) “media” and “media_file” tables (you have to set a number, such as X110).
    3. add to “individuals” the id of that file, with a code like “1 OBJE @X110@” at the bottom of the field i_gedcom.
  • 4. Now, in webtrees grafical view you has now to (pretend to) modify (nothing modifying, in fact) and save this modification.
  • 5. You could have also to save the modification date (saving the proposed one).

caveat

  • a. The file symlinked must have rights permissions (owner rw, group and others only r).
  • b. no avif: only jpg or webp are allowed.

You should now see the expected image within the page of that individual

Webtrees mysql error

It can happen that Webtrees gives an error such the following


SQLSTATE[HY000]: General error: 1364 Field 'id' doesn't have a default value 

You can try to solve it, assigning an auto-increment default value to that field, in PhpMyAdmin

Thunderbird appearance problem

It can happen that your TB theme (unintentionally and therefore inadvertently) changes and as a result it doesn’t match with your custom css (in chrome folder). You can see below an example of this:
a screenshot

As you can see, you get not only a very ugly appearance, but using TB becomes almost impossible.

To fix this problem you have to check (in edit -> settings -> add-ons and themes) what theme you are using, and if necessary, re-set the correct one, that suits to your css.