Author: Mathias Lipowski

mysqldump: how to exclude or include tables

By default, mysqldump includes all tables of the specified database when creating the dump. In some cases, it is useful to exclude some of the tables or even include only some of them. For me, this helped to exclude one of the biggest tables to reduce the backup execution time and file size.

Exclude a single table

To exclude a single table, the argument --ignore-table followed by the table name is used:

mysqldump my_database --ignore-table=my_table > my_backup.sql

This will create a file my_backup.sql containing the sql schema and data of all tables in the database my_database except my_table.

Exclude multiple tables

To exclude multiple tables, simply add the argument --ignore-table for all the tables you want to exclude:

mysqldump my_database --ignore-table=my_table --ignore-table=another_table > my_backup.sql

This will create a file my_backup.sql containing the sql schema and data of all tables in the database my_database except my_table and another_table.

Include a single table

To include only a single table into the dump, add the name of the table to the command:

mysqldump my_database my_table > my_backup.sql

This will create a file my_backup.sql containing the sql schema and data of the table my_table from the database my_database.

Include multiple tables

To include multiple tables into the dump, add the names of the tables to the command:

mysqldump my_database my_table another_table > my_backup.sql

This will create a file my_backup.sql containing the sql schema and data of the tables my_table and another_table from the database my_database.

Photo by benjamin lehman on Unsplash.


Flutter: slowing down animation for debugging

The library that is responsible for different scheduling is flutter/scheduler. This also includes animations. To use the library, simply import package:flutter/scheduler.dart – in this case, timeDilation is all that you need.

Now you can set the variable timeDilation to a custom double. The value 1.0 is the default animation speed. Setting it to 2.0 will slow down all animations by a factor of two.

import 'package:flutter/scheduler.dart' show timeDilation;

// ...

timeDilation = 2.0; // Slow down animations by factor two

As timeDilation is a global variable, you can set it anywhere in the code, e.g. in main():

import 'package:flutter/scheduler.dart' show timeDilation;

void main() {
  timeDilation = 3.0;
  runApp(new MyApp());

Photo by LOGAN WEAVER | @LGNWVR on Unsplash


JavaScript: simple code structure for libraries

The code of a JavaScript library might get very complex over time. This can be a problem for maintenance and expandability.

When writing a library, you should address two main points:

  • Keep the environment clean from global variables and methods to avoid conflicts between different libraries
  • Provide public and private methods and variables

The following “template” provides a simple code structure that fulfills those points:

// Unique name of the library.
MyLibrary = function() {
  MyLibrary = {};

   * Internal variables and methods
  var variable = 'value';
  function doSomething() {
    // do something

   * Public variables and methods
  MyLibrary.myVariable = true;
  MyLibrary.myAction = function() {
    // do something

  // Return the library.
  return MyLibrary;

You can use such a library the following way:

const lib = MyLibrary();

if (lib.myVariable) {


Photo by Safar Safarov on Unsplash

Flutter: red text and yellow lines in Text widget

When using a text widget, there are some configurations where the text turns red and gets yellow lines. In my case, it looks like in the following image.

The reason for this is a lack of style parameters from the parent widget. The red text shows that there is no color information available. The yellow lines show that text decoration is missing.

In my case, I have a simple text widget in a Row:

  // ...
  child: Row(
    children: [
      // ...
      Text('External device'),

To solve the issue, there are different possibilities.

Provide a DefaultTextStyle

  style: Theme.of(context).textTheme.bodyText1,
  child: Text('External device'),

Use Material

  color: Colors.transparent,
  child: Text('External device'),

Use style parameter of Text

  'External device',
  style: TextStyle(
    decoration: TextDecoration.none,

In this case, decoration will remove the yellow lines and color will remove the red text color.

Use Scaffold

A solution discussed in different threads might also be using a Scaffold for the parent widget. But this did not work in case.

  body: Container(
    // ...
    child: ...

PHP: rounding a number and keeping the zeros after comma

In PHP you can use the round() method to round a double. This methods accepts a precision value as second parameter. Some examples:

echo round(3.1415926, 2); // "3.14"
echo round(3.1415926, 3); // "3.142"

When using round() on a value like 3.0000 the conversion to a string will result in just "3":

echo round(3.0000000, 2); // "3"

This is not wrong, but when you want to have a constant precision for different numbers, having an output of "3.00" is much more helpful.

To achieve this, you can use one of the following solutions.


echo number_format(3.1415926, 2); // "3.14"


echo sprintf("%.2f", 3.1415926); // "3.14"

Git: how to compare two branches

Sometimes it’s necessary to get the difference between two branches. Git already provides a really powerful diff command which does exactly this:

git diff

git diff is very powerful, as it not only compares two branches, it also allows multiple comparisons:

Show changes between the working tree and the index or a tree, changes between the index and a tree, changes between two trees, changes resulting from a merge, changes between two blob objects, or changes between two files on disk.

To compare two commits, simply use the commit hashes:

git diff 27b00e..f553c6

To compare two branches, simply use the branch names:

git diff master..feature/myNewFeature

The output looks like this:

diff --git a/lib/components/list_view/list_checkbox.dart b/lib/components/list_view/list_checkbox.dart
index 4985774..b3f5957 100644
--- a/lib/components/list_view/list_checkbox.dart
+++ b/lib/components/list_view/list_checkbox.dart
@@ -23,7 +23,7 @@ class ListCheckbox extends StatelessWidget
         checkColor: (checked && inactive) ? Colors.grey :,
         onChanged: onChanged,
         activeColor: Colors.transparent,
-        focusColor:,
+        focusColor:,

Photo by Yancy Min on Unsplash

PHP: get version details from composer.json

Let’s say we have a composer.json file as follows:

    "name": "mixable/blog",
    "description": "",
    "homepage": "",
    "version": "4.0.1",
    "type": "project",
    "require": {
        "php": "^8.x",
        "vendor/package": "^4.3",

When using this file to manage the packages of an app, it might be necessary to check for the version of your app. This is possible by using the Composer class \Composer\InstalledVersions. The class provides different methods to access the details of the projects composer.json file.

Get details about the root package

Details about the root package are available through the getRootPackage() method:

$package = \Composer\InstalledVersions::getRootPackage();

This method returns an array with the following details:

name: string
version: string
reference: string
pretty_version: string
aliases: string[]
dev: bool
install_path: string
type: string

To get the apps version, you can use:

$version = \Composer\InstalledVersions::getRootPackage()['version'];

Get details about installed packages

There is a number of methods that provide additional information about the installed packages. Some examples:

Version of an installed package

$version = \Composer\InstalledVersions::getVersion('vendor/package');

Install path of an installed package

$installPath = \Composer\InstalledVersions::getInstallPath('vendor/package');

A detailed description of all methods is available at

Photo by Ilya Pavlov on Unsplash

GitLab CI + Flutter: pub: command not found

In one of my projects, I used a GitLab environment to perform Flutter tests. For this, I setup my .gitlab-ci.yaml to use a Flutter docker image of cirrusci/flutter for code quality check or tests. The file looks like this:

  stage: test
  image: "cirrusci/flutter:stable"
    - docker
    - pub global activate dart_code_metrics
    - export PATH="$PATH":"$HOME/.pub-cache/bin"
    - metrics lib -r codeclimate  > gl-code-quality-report.json
# [...]

  stage: test
  image: "cirrusci/flutter:stable"
    - docker
    - pub global activate junitreport
    - export PATH="$PATH":"$HOME/.pub-cache/bin"
    - flutter test --machine --coverage | tojunit -o report.xml
    - lcov --summary coverage/
    - genhtml coverage/ --output=coverage

# [...]

Up to version 2.10.* of the Flutter docker image, this worked fine. But starting with version 3.0.0, there seems to be some changes in the binaries or their paths. The scripts failed with an error:

/usr/bin/bash: line 123: pub: command not found

To fix this error, the pub commands need to be adjusted and set to flutter pub:

# [...]

    - flutter pub global activate dart_code_metrics

# [...]

    - flutter pub global activate junitreport

# [...]

This fixed the issue and all tests finished successfully.