Horde: Deleting Duplicates from MySQL Database

• MySQL and Horde • Comments

I recently encountered a problem with my Horde installation. Due to an app misconfiguration, my wife created hundreds of calendar entries for the same event. It is tedious to delete every event by hand, so I wanted to drop the entries from the database. As this is something other people might profit from, I’m documenting it. Of course part of this procedure can be done with other MySQL databases as well.

Get listing of double entries

I wanted to see all duplicate entries first, to make safe I’m not deleting important stuff. This can be done with a SELECT COUNT command:

   SELECT event_title,event_start,COUNT(*) c FROM kronolith_events
     GROUP BY event_title,event_start HAVING c > 1 ORDER BY c ASC;

This is the result:

MySQL count duplicates table

Ouch! That are a lot of duplicate entries. Let’s delete them!

Solving multi monitor mouse problems in fullscreen applications

• Windows and Gaming • Comments

I’ve been an avid gamer for ages. I’ve also been using two monitors for ages. And I’ve had my fair share of problems with this combination already.

Some time ago I broke my arm. Therefore my gaming life was handicapped severely and I was limited to mouse only games. No big deal, there are still a lot of games waiting to be played in my Steam and GoG libraries. As I’m German, I of course decided to start with some economy simulations. Anno 1404 and Tropico 4 were my first choice of games.

Sadly both games had some kind of problem with my second monitor. Tropico 4 didn’t capture my cursor, leading to issues with scrolling via cursor movement to the right edge of the screen. As the cursor moved to the second screen then, a click would lead to a minimization of the game, which was pretty annoying after some time.

Tropico 4

Linux: Empty swap space

• linux • Comments

This is the translation of a post I wrote four years ago. I needed an english version of it for a friend of mine.

If you want to empty your swap space on Linux for whatever reason, so you can simply use these commands:

swapoff -a && swapon -a

This deactivates all swap storage first, leading to a drainage of the currently contained data. Afterwards the swap space is activated again.

If the swap space is heavily utilized, this can take a couple of minutes, so don’t worry if nothing happens. To check the progress, you can use this command in another window:

free -s 3 |grep Swap

This command shows the current used swap and refreshes every three seconds. Of course, the used swap space should continously decrease and finally be zero.

If you only want to empty one swap partition, you can substitute the -a switch in the first command with the paritition you want to drain, e.g. /dev/sda2.


Ansible: Extracting dictionary values into a list

• Ansible • Comments


In Ansible you have a list of dictionaries containing some values, e.g. a list of mount points:

  basedir: /srv/mymounts
      name: first_mount
      opts: defaults
      name: second_mount
      opts: noauto,x-systemd.automount,_netdev,reconnect
      name: third_mount
      opts: defaults

And you want to extract a list of mount pathes combined from basedir and name for further usage, so the result looks like this:

['/srv/mymounts/first_mount', '/srv/mymounts/second_mount', '/srv/mymounts/third_mount']

Ubuntu: How to fix the No Wi-Fi password dialogue error

• Linux and Ubuntu • Comments

I recently stumbled over a problem on my notebook running Ubuntu 16.04 “Xenial Xerus”. When trying to connect to a new, protected Wi-Fi network no password dialogue appeared, making a quick GUI connection impossible. Creating the connection manually, entering the Wi-Fi password in the “Wi-Fi-Security” setting in the process worked like a charm. Using nmtui from the terminal also worked flawlessly.

As I didn’t connect the notebook to new Wi-Fi networks in months, I didn’t encounter this error for a long time. Therefore I had a lot of problems debugging it as I installed bazillions of updates and new packages in the meantime.

I narrowed the problem down to NetworkManager not having a way of saving the Wi-Fi password, which is normally done via gnome-keyring, specifically via gnome-keyring-daemon. The daemon didn’t seem to start properly, but even starting it manually still didn’t make a difference. The logs still complained:

Okt 17 06:58:53 XPS13 NetworkManager[1064]: <info>  [1508216333.3058] device (wlan0): Activation: (wifi) access point 'MyTest' has security, but secrets are required.
Okt 17 06:58:53 XPS13 NetworkManager[1064]: <info>  [1508216333.3062] device (wlan0): state change: config -> need-auth (reason 'none') [50 60 0]
Okt 17 06:58:53 XPS13 NetworkManager[1064]: <warn>  [1508216333.3062] device (wlan0): No agents were available for this request.

Finally I found the solution in an askubuntu question. Nearly half a year ago I installed Flatpak so I could install FeedReader. One of the dependencies was dbus-user-session. This package seems to have problems with the gnome-keyring-daemon in 16.04 rendering it defective. Purging the dbus-user-session package and its dependencies solved my problem and the Wi-Fi password dialogue appeared once again.

apt purge dbus-user-session xdg-desktop-portal xdg-desktop-portal-gtk

Wi-Fi dialogue

I still had a problem with the NetworkManager applet in the tray, but this could be fixed with an apt install --reinstall network-manager-gnome and a reboot afterwards.