It finally happened… After experimenting with alternative firmware for my WNR3500L router, I uploaded the wrong version and converted the device into a rather expensive paperweight. After some searching, I found this page, explaining how to revitalize the router by using a USB-TTL converter cable. You can get (e.g. CP2102 Module Modul USB to TTL Converter) for a few bucks Ebay, but expect a few weeks for the delivery from China. If you follow the tutorial on the OpenRouters page closely, it should work out quite nicely.

Update: 2018-01-21

It happened again. I flashed an unsupported version of LEDE on the device and it did not want to boot again. I followed the same procedure as described here, but the router was complaining about a version missmatch of the device ID and the image ID. Turns out, I had to explicitly use binary mode for FTP. Here are the steps again.

Connect the serial cables as shown

Make sure router is off

Launch minicom in a terminal and make sure the settings are valid for ttyUSB0

Boot the router and immediately press Ctrl+C in the terminal

Type tftpd in the prompt, the router should start a FTP server on 192.168.1.1

IntelliJ products do not yet support MySQL’s utf8mb4 character set encodings. The […]

-->

When using variables inside SQL scripts within IntelliJ products (e.g. DataGrip), certain queries will not work because the encodings of the IntelliJ client and the server missmatch. This occurs for instance when you compare variables. A typical error message looks like this:

IntelliJ products do not yet support MySQL’s utf8mb4 character set encodings. The problem occurs when using variables in queries. Per default. IntelliJ uses a UTF-8 encoding for the connection. When you use utf8mb4 as the database default character set, then variables will be encoded in UTF-8 while the database content remailns in utf8mb4. It is not possible to provide the character set encodings to the IntelliJ settings, as it will refuse to connect.

Check your server settings using the MySQL client:

1

2

3

4

5

6

7

8

9

10

11

12

13

MySQL[cropster_research]>show variables like'%char%';

+--------------------------+----------------------------+

|Variable_name|Value|

+--------------------------+----------------------------+

|character_set_client|utf8mb4|

|character_set_connection|utf8mb4|

|character_set_database|utf8mb4|

|character_set_filesystem|binary|

|character_set_results|utf8|

|character_set_server|utf8mb4|

|character_set_system|utf8|

|character_sets_dir|/usr/share/mysql/charsets/|

+--------------------------+----------------------------+

This seems correct, but when you connect with the IntelliJ client, you will get wrong results when you use variables. Until the products support utf8mb4, you would need to add the following settings to the script in order to force the right settings.

As Cyanogen Inc closed down its operations in December 2016, CyanogenMod was affected too and my OnePlus One (OPO) did not receive updates anymore. This is not ideal, as new and old bugs have will remain. For instance did my phone often not reconnect to the 4G network, when a wifi connection was lost, This was very annoying. For this reason, if was about time to upgrade to a new OS: LineageOS.

LineageOS

LineageOS is a fork of CyanogenMod and contunes the quite successful project for our benefit. LineageOS 14 is compatible with Android 7.1 and very easy to install. These are the steps which I had to follow.

How to Upgrade

Create a backup with Helios. Use the Chrome Helium app if the app on your mobile phone refuses to start.

Install both zip files by selecting first the LineageOS and then the Google Apps Zip file

Thats it. Reboot and begin with the setup or restore the backup.

Update 28.09.2017

The problem that the phone would not reconnect to 3G/4G again after losing the Wifi signal still persisted with LineageOS. A friend recommended flashing the firmware of the device. After installing the version 2016_1-25_.4.0.1.c7-00011 downloaded from here solved the issue for now. No more connection problems so far

Replication is an important concept for improving database performance and security. In this blog post, I would like to demonstrate how the consistency between a MySQL master and a slave can be verified. We will create two Docker containers, one for the master one for the slave.

Installing the Percona Toolkit

The Percona Toolkit is a collection of useful utilities, which can be obained for free from the company’s portal. The following commands install the prerequisits, download the package and eventually the package.

Now log into the slave container and add the connection details for the master:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

## Connect to the MySQL Slave instance

$mysql-uroot-h172.17.0.3

### Setup the slave

mysql>CHANGE MASTER TO

MASTER_HOST='172.17.0.2',

MASTER_PORT=3306,

MASTER_USER='replication',

MASTER_PASSWORD='SLAVE-SECRET',

MASTER_LOG_FILE='mysqld-bin.000002',

MASTER_LOG_POS=346;

Query OK,0rows affected,2warnings(0,05sec)

### Start and check

mysql>start slave;

Query OK,0rows affected(0,01sec)

mysql>show slave status\G

***************************1.row ***************************

Slave_IO_State:Waiting formaster tosend event

Master_Host:172.17.0.2

Master_User:percona

Master_Port:3306

Connect_Retry:60

Master_Log_File:mysqld-bin.000002

Read_Master_Log_Pos:346

Relay_Log_File:mysqld-relay-bin.000002

Relay_Log_Pos:284

Relay_Master_Log_File:mysqld-bin.000002

Slave_IO_Running:Yes

Slave_SQL_Running:Yes

Now our simple slave setup is running.

Get some test data

Lets download the Sakila test database and import it into the master. It will be replicated immediately.

1

2

3

4

5

wget http://downloads.mysql.com/docs/sakila-db.tar.gz

~/Docker-Projects$tar xvfz sakila-db.tar.gz

mysql-uroot-h172.17.0.2<sakila-db/sakila-schema.sql

mysql-uroot-h172.17.0.2<sakila-db/sakila-data.sql

Verify that the data is on the slave as well:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

mysql-uroot-h172.17.0.3-e"USE sakila;SHOW TABLES;"

+----------------------------+

|Tables_in_sakila|

+----------------------------+

|actor|

|actor_info|

|address|

|category|

|city|

|country|

|customer|

...

|store|

+----------------------------+

After our setup is completed, we can proceed with Percona pt-table checksum.

Percona pt-table-checksum

The Percona pt-table-checksum tool requires the connection information of the master and the slave in a specific format. This is called the DSN (data source name), which is a coma separated string. We can store this information in a dedicated database called percona in a table called dsns. We create this table on the master. Note that the data gets replicated to the slave within the blink of an eye.

1

2

3

4

5

6

7

8

CREATE DATABASE percona;

USEpercona;

CREATE TABLE`DSN-Table`(

`id`int(11)NOTNULLAUTO_INCREMENT,

`dsn`varchar(255)NOTNULL,

PRIMARY KEY(`id`)

);

The next step involves creating permissions on the slave and the master!

The percona user is needed to run the script. Note that the IP address is this time from the (Docker) host, having the IP 172.17.0.1 by default. In real world scenarios, this script would either be run on the master or on the slave directly.

Now we need to add the information about the slave to the table we created. The Percona tool could also read this from the process list, but it is more reliable if we add the information ourselves. To do so, we add a record to the table we just created, which describes the slave DSN:

The result shows a difference in the MySQL internal table for permissions. This is obviously not what we are interested in, as permissions are individual to a host. So we rather exclude the MySQL internal database and also the percona database, because it is not what we are interested in. Also in order to test it the tool works, we delete the last five category assignments from the table with
mysql-uroot-h172.17.0.3-e"DELETE FROM sakila.film_category WHERE film_id > 995;" and update a row in the city table with

1

mysql-uroot-h172.17.0.3-e"update sakila.city SET city='Innsbruck' WHERE city_id=590;"

You see that there is a difference in the tables sakila.city and in the table sakila.film_category. The tool does not report the actual number of differences, but rather the number of different chunks. To get the actual differences, we need to use a different tool, which utilises the checksum table that the previous step created.

Show the differences with pt-tabel-sync

The pt-table-sync tool is the counter part for the pt-table-checksum util. It can print or even replay the SQL statements that would render the slave the same state again to be in sync with the master. We can run a dry-run first, as the tool is potentially dangerous.

The command shows how we can rename back from Innsbruck to Yuncheng again and also provides the INSERT statements to get the deleted records back.When we replace –print with –execute, the data gets written to the master and replicated to the slave. To allow this, we need to set the permissions on the master

This error indicates that updating the city table has consequences, because it is a FK to child tables. In this example, we are bold and ignore this warning. This is absolutely not recommended for real world scenarios.

My Lenovo ThinkCentre m900 (10FHCTO1WW) with an Intel i7-6700 showed weird and random freezes from day 1 when trying to install Mint 18 / Ubuntu 16 with any kernel newer than 3x. After investigating for quite some hours, I gave up and installed an Ubuntu 14.04 LTS on it. The device is certified to it, but the old version did not support all features and even some basic things such as audio did not work. At lest the random freezes were gone and I could work with that machine. Now that the system will not receive updates soon, I gave it another try and setup Mint 18.2 (Sonya). Unfortunately, the Lenovo machine froze again after a few minutes, filling up the log again with the following error messages.

I started the investigation again and found a different trace, which pointed to the graphics card. The important hint and solution came from SO. Following a few other forum posts, it became clear that the Nvidia drivers do not play nicely with recent kernels for some specific Nvidia cards ind combination with newer kernels. So I followed the proposed steps and disabled the card complete. Just removing the card in the BIOS and uninstalling the drivers was not enough. I also had to blacklist the modules for the nouveau kernel driver.