The blast from the past

There are very few things that make you think of time and remind you how old you are like that email that I received another day.  Red Hat Bugzilla sent me an automated email about the update on the bug in Fedora 3 (!!!) that I commented on … in November of 2004.  Yeah, that’s good 13+ years ago.

This is so long ago, it’s almost unbelievable.  Back in those days, I was working at PrimeTel and even had a slightly different spelling to my surname.  Oh, boy.

Fedora 28

The brand new and shiny Fedora 28 has been released!  This one brings updates to Gnome, improved battery life, and external repositories for things like Google Chrome browser and Nvidia proprietary drivers.

Upgrading from Fedora 27 is easy and painless – I’ve tried it myself and all went without any problems at all.

Change SQL mode for MariaDB in Fedora 27

After I upgraded my laptop to Fedora 27, I started experiencing some weird issues with most of the projects I am developing locally.  Trying to save anything into the database that involves dates, started throwing the following errors:

Error: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '2017-11-30T13:30:48+02:00' for column 'timestamp' at row 1

A quick look around showed that Fedora 27 ships MariaDB v10.2, while the previous distribution version shipped MariaDB v10.1. Digging through the changes between the two versions didn’t help much, even though there is slight mention of the related change.

SQL_MODE has been changed; in particular, NOT NULL fields with no default will no longer fall back to a dummy value for inserts which do not specify a value for that field.

StackOverflow is much more helpful, as always.  These two threads – one and two – in particular, explained the changes and suggested the fix.  I had to either fix the projects I was working on, or modify my local configuration to use the old SQL mode.  This thread provided some more details, so the final solution was adding the following to the /etc/my.cnf and restarting the MariaDB service:

[mysqld]
sql-mode="NO_ZERO_IN_DATE,NO_ZERO_DATE"

And now we are back to normal.

Fedora 27 and high DPI support

I’ve recently updated my laptop to Fedora 27 and since then I had some issues with the rendering of the desktop fonts.  At first, everything seemed too large and over-magnified.  Resetting the desktop fonts to much smaller sizes helped a bit, but there were still random issues with different applications – Google Chrome, Skype, etc.   I think these much be related to the recent improvements to high DPI support.

A few things helped me a long the way.  Here are the links, just in case I’ll need to find them in the future:

Ultimately, the things that solved my problems were the last link (installing better fonts for Fedora), and adjusting the fonts resolution from 142 dots per inch down to 96.

Querying CSV with SQL

Excel is not the only tool available when it comes working with CSV files.  I have previously mentioned TextQL (here).  Yesterday, I tried another tool, called “q”.  But since searching for “q” is not very effective, it’s also known “q text as data“.

For those using Fedora, you can install it by simply running “dnf install q-text-as-data“.   Here’s an example of how it works:

$ q-text-as-data -H -d ',' "SELECT COUNT(DISTINCT(Project)) FROM deploy.csv"
95

In the above example, I’m querying the deploy.csv file, which is in the current folder. q supports both command and tab separated values, so I’m helping it out with the “-d ‘,’” parameter, saying that this particular one is a CSV. “-H” tells q that the first row in this file is used for headers. CSV files with headers are more convenient, as you can use headers as column names, instead of numerical indexes.