All posts by bamyers99

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

Mysqldump to TSV Conversion Using Flex

First a little background information. I wanted to import an 8 Gig Wikipedia table dump for a project that I was working on. The table was too big to import all of the records on my Linode server. I only needed certain rows and columns, so I tried parsing the dump file in PHP. This worked, but it was much too slow. So then I went looking for text processor programs. This turned up awk, grep, lex and sed. awk, grep and sed are all line based processors. These would not work because the dump file has multiple database records per line. That left lex and its successor flex.
Continue reading Mysqldump to TSV Conversion Using Flex