C++ Static Initialization Order Fiasco Workaround

The C++ Static Initialization Order Fiasco (SIOF) can happen when 2 classes have static initializers and one classes static initializer calls the other class before its static initializer has been executed. The order of static initializer execution is determined by the linker.

SIOF Example

A parser that stores some regexes.


class Parser {
static std::map<std::string, Regex> regexs;


using namespace std;
map<string, Regex> Parser::regexs = {
{"table" , Regex("!\\{\\|[^{]*?\\|\\}!m")},
{"link" , Regex("!\\[\\[[^\\[\\]]*?\\]\\]!")}


class Regex {
static std::map<char, int> modifiers;
Regex(string& regex);


using namespace std;
map<char, int> Regex::modifiers {

Regex::Regex(string& regex) {
modifiers['m'] could fail

Parser::regexes and Regex::modifers are both globally initialized statics.

Depending on the linker, Parser::regexes could get initialized before Regex::modifers. If that happens, then the reference to modifiers[‘m’] will fail in the Regex constructor that the Parser::regexes initializer calls.
Continue reading C++ Static Initialization Order Fiasco Workaround

AT&T Cordless Phone – Manual Handset Registration

If the automatic new handset registration does not work by putting the handset in the base cradle, a manual registration process is available.

This is for the Accessory Handset model CL80113 for use with the following Base units: CL81113, CL81213, CL81313, CL82113, CL82213, CL82263, CL82313, CL82363, CL82413, CL82463, CL83113, CL83213, CL83263, CL83313, CL83363, CL83413, CL83463.

Press and hold the Handset Locater button in the base cradle until the In Use light is steady red. Release the button. The base display will say Registering…
Press the # key on an unregistered handset to start the registration process. That is it.

Tweaking Ubuntu Unity To Show All Of An Apps Windows

In OS X, clicking on a dock icon shows all open windows for the app. In Ubuntu, clicking on a launcher icon only shows the most recently used open window. This is annoying if you want to copy files between two folders or view all Xpad note windows.

Ubuntu 18.04

In Terminal
sudo apt install dconf-tools
org / gnome / shell / extensions / dash-to-dock
Change click-action custom value to minimize
Another change to match 16.04 functionality when scrolling over app icon:
Change scroll-action custom value to cycle-windows

For Ubuntu 16.04 read on.
Continue reading Tweaking Ubuntu Unity To Show All Of An Apps Windows

X Windows – Window Swallowing

X Windows “window swallowing” is the process of program 1 capturing the main window of program 2 to display it inside of program 1’s main window. For example, Firefox using an external program to display a PDF in a tab. Firefox’s built-in javascript PDF viewer leaves a lot to be desired. Slow rendering or no rendering at all, memory hog, with the download button not working when it doesn’t render.

The following description is derived from my experience getting MozPlugger to work in Firefox to display PDF files using Evince.
Continue reading X Windows – Window Swallowing

Abolish 10-Point Rating Scales

People are frequently asked to rate something on a scale of 1 to 10. Let’s take the pain Numeric Rating Scale (NRS-11) as an example. 1 means low pain (bump), 10 means extreme pain (migraine). Now what would warrant a 2 or a 9? A person simply can’t categorize pain into 10 different levels. The  NRS-11 groups the 10 pain levels into 3 categories (Mild, Moderate, Severe). Why not just use a 3-point scale or the category names?

I postulate that most 10-point scales can be replaced with 5-point scales with no loss of information. For analysis purposes, most responses are going to be grouped into 3 – 5 categories or averaged.

Conversion of existing 10-point data values to 5-point data values is easy.

  1. Add 1 to the 10-point value
  2. Divide the result by 2
  3. Drop the fractional part

Example for value 9:

  1. 9 + 1 = 10
  2. 10 / 2 = 5

Example for value 10:

  1. 10 + 1 = 11
  2. 11 / 2 = 5.5
  3. Drop the .5 = 5