Blog: Einträge 23.07.2018–25.08.2019

iBlue 747A+ delivers wrong date

Back from our vacation in the Bavarian Forest, I noticed that my long-serving and really reliable iBlue 747A+ GPS logger apparently stopped working: it delivered tracks with a date around year 2000. Investigating this further, I found that the time appeared to be okay, but the date was completely wrong.

Fortunately, the device isn't broken, it was just hit by the GPS Week Number Rollover, that took place on 2019-04-07. This really sucks! But blessedly, I can continue using the logger. One can fix the wrong date by adding 172,032 hours to the date (that is: 1024 weeks times 7 days times 24 hours).

This can be done via gpsbabel in the following way (assuming we have a GPX encoded GPS data file):

gpsbabel -t -i gpx -f original.gpx -x track,move=+172032h -o gpx -F fixed.gpx

Maybe, this will help somebody.

Hopefully, Europe's Galileo GNSS won't suffer from such shortcomings and my next "GPS" logger will use this one … and the good ole' one will continue working a few years until Galileo is finished, working and a lot of devices support it ;-)

Levenshtein Distance and Longest Common Subsequence in Qt

In case anybody needs to calculate the Levenshtein Distance or the Longest Common Subsequence of two QStrings, here's some code I wrote/found/adapted after quite some investigation.

This Levenshtein Distance function seems to be quite nicely optimized to me (an amateur programmer), as it does not calculate the whole comparison matrix, but only keeps the last column:

int levenshteinDistance(const QString &source, const QString &target)
    // Mostly stolen from

    if (source == target) {
        return 0;

    const int sourceCount = source.count();
    const int targetCount = target.count();

    if (source.isEmpty()) {
        return targetCount;

    if (target.isEmpty()) {
        return sourceCount;

    if (sourceCount > targetCount) {
        return levenshteinDistance(target, source);

    QVector<int> column;
    column.fill(0, targetCount + 1);
    QVector<int> previousColumn;
    previousColumn.reserve(targetCount + 1);
    for (int i = 0; i < targetCount + 1; i++) {

    for (int i = 0; i < sourceCount; i++) {
        column[0] = i + 1;
        for (int j = 0; j < targetCount; j++) {
            column[j + 1] = std::min({
                1 +,
                1 + + j),
       + (( == ? 0 : 1)


And here's the one for the Longest Common Subsequence, to be used for diff-like comparing of two QStrings and generation of a visible representation of their differences:

QString longestCommonSubsequence(const QString &source, const QString &target)
    // Mostly stolen from

    QMap<int, QMap<int, int>> l;
    for (int i = 0; i <= source.count(); i++) {
        for (int j = 0; j <= target.count(); j++) {
            if (i == 0 || j == 0) {
                l[i][j] = 0;
            } else if ( - 1) == - 1)) {
                l[i][j] = l[i - 1][j - 1] + 1;
            } else {
                l[i][j] = std::max(l[i - 1][j], l[i][j - 1]);

    int i = source.count();
    int j = target.count();
    int index = l[source.count()][target.count()];
    QString longestCommonSubsequence;
    while (i > 0 && j > 0) {
        if ( - 1) == - 1)) {
            longestCommonSubsequence[index - 1] = - 1);
        } else if (l[i - 1][j] > l[i][j - 1]) {
        } else {

    return longestCommonSubsequence;

Just in case somebody needs this.

b8 0.6.2 out now

Believe it or not: My statistical ("Bayesian") spam filter b8 has a new release! The last one dates back to 2014, but the reason was not that it wasn't developed anymore, but that there simply were no bugs or wishes since ;-)

Apart from some code formatting and cleanup, the only thing changed is the removal of the as of PHP 7.2 deprecated each() function. Version 0.6.2 should now run without deprecation warnings.

Everything else stayed the same, so version 0.6.2 can simply replace it's predecessor without any change (supposed you at least used version 0.6 in which the database format has been changed the last time).

Have a lot of fun with b8!

gpx2svg 0.1.5 released

Quite some time has passed since the last release of gpx2svg, the program to convert GPX to SVG, but thanks to Emiel Brommer, there's a new release now.

The problem was that some GPS devices create a lot of segments that don't overlap by their first and last point. Thus, the default segment combining algorithm of gpx2svg is not able to detect them and the output is scattered in a lot of paths.

The new -j command line switch turns off the default combining and creates one big segment with all data in it, in the (chronological) order given by the GPX file. This, of course, will only produce a meaningful result if the order is correct, but in these cases, we do get one.

Thanks again to Emiel for supplying the initial patch! Have a lot of fun with gpx2svg!