Cloudbridge Mattermost

Cloudbridge Mattermost is a WordPress plugin that provides integration between WordPress and Mattermost. In the initial release, we focus on login notifications (successful, failed, unknown) from the various WordPress user roles.

We will, of course, be adding more functionality in the future.

You can download it from the official WordPress repository:
wordpress.org/plugins/cloudbridge-mattermost

You can also get it from GitHub, should you prefer that source:
github.com/joho1968/cloudbridge-mattermost

This is the initial release of this plugin.

NCweb 0.0.5, your Nextcloud Web Server

NCweb 0.0.5 has been released, yay 🙂

You can grab a copy here if you’re curious about the changes, if not, carry on.

If you want to read more about NCweb, check out the GitHub repository

The initial announcement can be found here

Spoiler alert: This is possibly a completely useless application if you do not run Nextcloud, don’t have PHP or don’t know what PHP is, or don’t run Nginx or Apache. And even if you do meet the criteria, it may still disappoint you as well as being useless to you.

Displaying WordPress roles in the current language

While writing a WordPress plugin that displays the available user roles, I came across a snag: the user roles that I had fetched from WordPress weren’t translated into the site’s current language.

I’m not quite sure I understand the reasoning behind this since WordPress offers functions to return an array with the actual role as the key, and the display string as the array value, like:

array( 'administrator' => 'Administrator' );

So why can’t WordPress return the “correct” (i18n) language string for the array value … anyway, there’s a solution.

Looking at how WordPress does it under “Settings > General” in the WordPress Admin, I eventually found a call to translate_user_role(), which requires one parameter, the role array name value, e.g. “Administrator”. The function will then return the correct (language context aware) display string.

So to put it into a functional context, it may look something like this:

function i18n_get_wp_roles() {
    $wp_roles = wp_roles();
    if ( is_object( $wp_roles ) ) {
        $roles = array_keys( $wp_roles->roles );
        $role_names = $wp_roles->get_names();
    } else {
        $roles = false;
        $role_names = array();
    }
    $return_roles = array();
    if ( is_array( $roles ) ) {
        foreach( $roles as $role_k => $role_v ) {
            if ( ! empty( $role_names[$role_v] ) ) {
                $return_roles[$role_v] = translate_user_role( $role_names[$role_v] );
            } else {
                $return_roles[$role_v] = 'Unknown role (' . $role_v . ')';
            }
        }
    } else {
        error_log( basename(__FILE__) . ' (' . __FUNCTION__ . '): wp_roles() returned empty' );
    }
    return( $return_roles );
}

 

Where did my Emacs color-theme go in Ubuntu 20.04.LTS?!

Having recently upgraded a small VPS from Ubuntu 18.04.LTS to Ubuntu 20.04.LTS, I ran into a little snag with Emacs and its color-theme (from the emacs-goodies-el package).

After some digging, it seems this is now done somewhat differently in Ubuntu 20.04.LTS.

This is what my .emacs file used to contain:

(require 'color-theme) 
(color-theme-initialize) 
(color-theme-charcoal-black)

This is what I changed it to:

(add-to-list 'custom-theme-load-path 
(file-name-as-directory "/usr/share/emacs/site-lisp/elpa/color-theme-modern-0.0.2"))
(load-theme 'charcoal-black t t) 
(enable-theme 'charcoal-black)

In addition, I also had to install the elpa-color-theme-modern package (from the Ubuntu 20.04.LTS distribution).

 

Checksum of file using Windows certutil

After getting files from a remote source, it is often a good idea to get some sort of fingerprint or checksum of the file, and verify it against a known value published in a place or on a website you trust.

For Windows, this can be accomplished with:

certutil -hashfile filename.ext sha256

sha256 can be any of MD2 MD4 MD5 SHA1 SHA256 SHA384 SHA512

View as @geek1968 flashcard on Instagram

Bonus/Malus-systemet och symbolpolitik i Sverige 2020

Är det bara jag som tycker att Bonus/Malus-systemet Ă€r bortom all idioti nĂ€r det kommer till argument som utslĂ€pp och miljöpĂ„verkan?

Om jag har en bil, med höga utslĂ€pp, sĂ„ betalar jag en högre skatt, Ă€n nĂ„gon som har en bil med lĂ„ga utslĂ€pp. SĂ„ lĂ„ngt lĂ„ter det ju fantastiskt vĂ€l genomtĂ€nkt 🧐

Ända tills vi lĂ€gger till körstrĂ€cka som parameter 🤨

Om min bil stĂ„r pĂ„ uppfarten 300 dagar av 365, slĂ€pper den dĂ„ ut mer Ă€n en bil med lĂ€gre utslĂ€pp som anvĂ€nds till och frĂ„n jobbet varje dag, genom rusningstrafik i t ex Stockholm? 🤔

LÀgg sedan till om den mestadels stillastÄende bilen har en dieselmotor, som kan fÀrdas lÀngre pÄ samma volym brÀnsle, och den aktivt anvÀnda bilen har en besinmotor, som kan fÀrdas en kortare strÀca pÄ samma volym brÀnsle, sÄ blir det Ànnu konstigare.

Det fanns nÄgot som hetter kilometerskatt en gÄng i tiden (sÄ gammal Àr jag), tappades denna helt bort i Bonus/Malus-systemet, eller Àr det en samling barn som utformat det?

Det finns pÄgÄende utredningar om en ny kilometerskatt, och eftersom vi bor i Sverige dÀr alla Àlskar att betala skatt och skatteintÀkter Àr prioritet ett för mÄnga regeringar (eftersom de aldrig behöver stÄ till svars för hur offentliga medel slösas bort), sÄ lÀr den komma inom nÄgra Är.

Och Bonus/Malus-systemet lÀr förmodligen vara kvar tillsammans med den nya kilometerskatten, sÄ att det klirrar lite ytterligare i statens skattkista frÄn fordonsÀgare. En av fÄ samhÀllsgrupper som faktiskt, i stora drag, Àr sjÀlvfinansierade genom den mÀngd skatt de betalar.

Och för de som tycker Bonus/Malus-systemet Àr en jÀttefiffig lösning för miljön, varför rÀknas dÄ inte den stora bilden in i systemet? Hur mÄnga tusen mil komponenter till en bil fÀrdats innan det blev en bil, hur stor miljöpÄverkan batteriernas framstÀllning har, vilken typ av utslÀppshantering fabriken som byggde bilen har, osv?

Symbolpolitik som den bara kan föras i Sverige.