Thunderbird – Whatsapp problem

There are (several) extensions of Thunderbird that allow you to use Whatsapp on your PC, as you can see in the image below.

If you have a problem of “space on disk”, causing the disconnection from Whatsapp, you could try to find and destroy the cache of TB Whatsapp (a folder called web.whatsapp.com or something like).

I was able to solve this problem in this way.

Automatically list wp posts

You can list automatically wordpress posts in your php webpage, based on its tags.

The following php code allow you to list all wp posts with a given tag:

<?php

// --- 1️⃣ Caricamento WordPress (solo se non già caricato) ---
if (!function_exists('get_posts')) {
    $possible_paths = [
        __DIR__."/../[your-wp-path]/wp-load.php",  // standard
        __DIR__."/../../[your-wp-path]/wp-load.php", // if you inclyde subfolders
    ];
    foreach ($possible_paths as $path) {
        if (file_exists($path)) {
            require_once($path);
            break;
        }
    }
}

// --- 2️⃣ Preparazione query ---
global $post;
$args = [
    'posts_per_page' => 200,
];

if (!empty($whatcategory)) {
    $args['category_name'] = $whatcategory; // category slug 
}
if (!empty($whattag)) {
    // $args['tag'] = $whattag; 
    $args['tag_slug__in'] = array_map('trim', explode(',', $whattag)); // tag slug (not shown names)
}

// --- 3️⃣ Cache opzionale (transient WordPress) ---
$cache_key = 'lista_blog_' . ($whatcategory ?? 'none') . '_' . ($whattag ?? 'none');
$myposts = get_transient($cache_key);

if ($myposts === false) {
    $myposts = get_posts($args);
    set_transient($cache_key, $myposts, 3600); // cache 1 ora
}

// --- 4️⃣ Output ---
if (!empty($myposts)) {
    echo '<h2>
        <span lang="en">Our blog posts about this topic</span>
        <span lang="it">Posts del nostro blog su questo tema</span>
    </h2>
    <ul id="blog-posts">';

    foreach ($myposts as $post) {
        // Non dipendiamo dal loop globale
        echo '<li><a href="'.get_permalink($post).'" rel="bookmark">'.get_the_title($post).'</a></li>';
    }

    echo '</ul>';
    wp_reset_postdata();
}
?>

You can put this code in a separate file, and include it in your php webpage, i.g. in the footer, with a code like the following:

<?php
$listablog = "[the-path-of-your-separate-file/the-name-of-your-separate-file";
  if (file_exists($listablog)) {
    if (
        (isset($whatcategory) && !empty($whatcategory)) ||
        (isset($whattag) && !empty($whattag))
    ) {
        include $listablog;
    }
  }
?>

In the header of a webpage where you want add this list, you have to set the value of the tag you want list:
$whattag="your tag,another tag";

Be careful: you has to set, as value, not the visualized tag name, but the “slug”. You can see it also with mouse hover and status bar.

MTP problems (android – PC cable connection)

If you cannot connect your PC with an android device via usb cable, check first if your mobile device has mtp (media transfert protocol) set, and not charging or other USB possibilities.

In Likebook, for example, you have to set as in the following image:

Of course, you should have also installed all the needed MTP libraries.

copyq problems

In you have linux, flatpack installation of copyq can solve many possible problems, but it has also some disadvantage.

The best choice, then, is to install copyq according to its website:

Ubuntu and Debian users can add the official PPA:

sudo add-apt-repository ppa:hluk/copyq
sudo apt update && sudo apt install copyq

In same cases it could be not enough the above code. Then you can try with something like:

QT_QPA_PLATFORM=xcb copyq

You can set permanently in KDE menu with a config like in the below image

Php variables in WordPress

To set a variable, such as an url, you can use the following steps:

  • add to your wp-config a code with something like
require_once ABSPATH . 'wp-settings.php';
/** variabili */
define('GLOSSARIO_URL', 'yourwebsite/glossario.php');
  • add to functions.php (in your wp theme root) something like
define('GLOSSARIO_URL', 'yourwebsite/glossario.php');

function glossario_link($atts) {
    $atts = shortcode_atts([
        'id' => '',
        'testo' => ''
    ], $atts);

    $url = GLOSSARIO_URL . '#' . $atts['id'];

    return '<a href="' . esc_url($url) . '">' . esc_html($atts['testo']) . '</a>';
}

add_shortcode('glossario', 'glossario_link');
  • in wp editor you will be able to call that code inserting a text like this:
[glossario id="universalismo" testo="universalisticamente"]

where the content of testo="" is what will appears in your wp page (while in the editor you will see that code)

Markdown editors

gabbia

As already said, 3 years ago, there are very few md editors really good. Recently I tried if there are alternatives to zettlr, but unsuccessfully.

Zettlr is a very good md editor, open source and customizable, WYSIWYG but respectful of your control of code. Its mayor limit is that cannot recognize symlinks.

Typora has almost all the pros of Zettlr (except the automatic replacement of “), and can recognize symlinks, but it’s not open source.

MdSilo is not too bad: wysing, open source, can open symlinked files. A bit elementar, no much customizable.
MarkFlowy seems very good. Very interesting. Open source, it can read symlinks, and is more customizable than MdSilo, even less than Zettlr. But some doubts about its respect of your privacy (its auth certificate was seen as malicious by Firefox).

Other md editors are far worse:

gabbiaMany of them don’t allow you to open not only symlinked files, but any existing external file. Moreover many they ask you for your e-mail. In a nutshell: a golden cage.

Golden cages are:

  • TriliumNotes-(v0.103.0)
  • Logseq-(0.10.15)
  • Siyuan-3.6.5
  • Beaver-Notes-4.4.0

Other apps were once good, but now are discontinued, such as

  • marktext
  • apricotine
  • remarkable

Set date format in Thunderbird mail list

I have TB in american english, but I hate american english date format (mm/dd).
To fix this ugly, terrible, disgusting way to show dates, I tried unsuccessfully to:

  • go in TB about:config
  • intl.locale.requested = it, en-US

The only way, then, seemed to set whole TB in Italian (or in an other not-english language that has dd/mm).
But there is a real possibility: use en-GB instead of en-US: and so you have both, english and dd/mm as date format.

Thunderbird task manager icon

If you use Wayland and in taskbar TB has an ugly W icon, you can try

  • to check if the path of icon is correct;
  • add this line (or something similar) in tb .desktop file: StartupWMClass=thunderbird-esr. Instead of thunderbird-esr you could have to check the appropiate name of TB in yout system.
  • be sure that the name of your desktop file be capitalized, that is Thunderbird.desktop and not thunderbird.desktop;
  • be sure that you don’t have duplicate Thunderbird entries (i.g. in KDE menu or in .desktop files)



Fix a corrupt innodb

Today happened that mariadb worked almost correctly, but two wordpress db were incorrectly managed. Indeed I could modify a post, but I couldn’t add a new one.

In another PC I, luckily, had the good wp db (perfectlty working with its innodb). So, it was possible to fix this problem. With the following steps:

a) in the well working device dump (from a teminal) the working wp db:

mysqldump -u root -p --single-transaction --routines --triggers your-db-name > dump-yourdbname.sql

b) in the bad working device

  • activate (if not already active) mariadb
  • in a terminal: mysql -u root -p (of course you have to provide your mysql psw)
  • and then, within mysql, you have to delete the old, bad, db, and create a new one:
    • DROP DATABASE IF EXISTS yourdbname;
    • CREATE DATABASE yourdbname CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    • EXIT;
  • Now you have a new, good but empty db. You have now to import the content of it, with this code: mysql -u root -p yourdbname < dump-yourdbname.sql

Now all should work 🙂.