Skip to content

It's beer o'clock for PostgreSQL

A couple days ago Devrim forked PostgreSQL to get a beer.

That effort is of course laudable, but a bit extreme.

PostgreSQL is very extensible, and allows to implement a beer now clock with just a few easy steps.

Let's walk through this.

 

Continue reading "It's beer o'clock for PostgreSQL"
  • Twitter
  • Bookmark It's beer o'clock for PostgreSQL at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg It's beer o'clock for PostgreSQL
  • Bloglines It's beer o'clock for PostgreSQL
  • Technorati It's beer o'clock for PostgreSQL
  • Fark this: It's beer o'clock for PostgreSQL
  • Bookmark It's beer o'clock for PostgreSQL at YahooMyWeb
  • Bookmark It's beer o'clock for PostgreSQL at Furl.net
  • Bookmark It's beer o'clock for PostgreSQL at reddit.com
  • Bookmark It's beer o'clock for PostgreSQL at blinklist.com
  • Bookmark It's beer o'clock for PostgreSQL at Spurl.net
  • Bookmark It's beer o'clock for PostgreSQL at Simpy.com
  • Bookmark It's beer o'clock for PostgreSQL at blogmarks
  • Bookmark It's beer o'clock for PostgreSQL with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Read a JSON text into a variable in Ansible without parsing it

For one project I need to insert the content of a local file into another file on the remote system, and the first file happens to be JSON. The JSON file is in compact format (jq --compact-output) and is supposed to stay this way. When Ansible reads the content of the file, it determines that the content is JSON, and parses the content into the variable - and along the way is uncompressing the format. Not what I want.

 

Continue reading "Read a JSON text into a variable in Ansible without parsing it"
  • Twitter
  • Bookmark Read a JSON text into a variable in Ansible without parsing it at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Read a JSON text into a variable in Ansible without parsing it
  • Bloglines Read a JSON text into a variable in Ansible without parsing it
  • Technorati Read a JSON text into a variable in Ansible without parsing it
  • Fark this: Read a JSON text into a variable in Ansible without parsing it
  • Bookmark Read a JSON text into a variable in Ansible without parsing it at YahooMyWeb
  • Bookmark Read a JSON text into a variable in Ansible without parsing it at Furl.net
  • Bookmark Read a JSON text into a variable in Ansible without parsing it at reddit.com
  • Bookmark Read a JSON text into a variable in Ansible without parsing it at blinklist.com
  • Bookmark Read a JSON text into a variable in Ansible without parsing it at Spurl.net
  • Bookmark Read a JSON text into a variable in Ansible without parsing it at Simpy.com
  • Bookmark Read a JSON text into a variable in Ansible without parsing it at blogmarks
  • Bookmark Read a JSON text into a variable in Ansible without parsing it with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Does an openHAB Item exist?

In a more complex openHAB2 Rule I'm writing, I need to find out if a certain Item exist. If I try to access it when it does not exist, the Rule will fail. Not good.

I could pass in a parameter to the framework which builds the Rule, but that is cumbersome and requires changes on several places.

Let's see if I can have the Rule figure this out.

 

Continue reading "Does an openHAB Item exist?"
  • Twitter
  • Bookmark Does an openHAB Item exist? at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Does an openHAB Item exist?
  • Bloglines Does an openHAB Item exist?
  • Technorati Does an openHAB Item exist?
  • Fark this: Does an openHAB Item exist?
  • Bookmark Does an openHAB Item exist? at YahooMyWeb
  • Bookmark Does an openHAB Item exist? at Furl.net
  • Bookmark Does an openHAB Item exist? at reddit.com
  • Bookmark Does an openHAB Item exist? at blinklist.com
  • Bookmark Does an openHAB Item exist? at Spurl.net
  • Bookmark Does an openHAB Item exist? at Simpy.com
  • Bookmark Does an openHAB Item exist? at blogmarks
  • Bookmark Does an openHAB Item exist? with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Hanging script at the end of Python multiprocessing

While writing and stress-testing a Python script which uses the multiprocessing library, I ran into the problem that occasionally the script hangs at the end. Literally runs past the last line of code and then hangs.

In this script I'm using Queues and Events, so I made sure that I properly close the queues in the forked/spawned (tried both) processes and also clean out all queues in the parent. Nevertheless occasionally - like seldom, but it happens - the script hangs. Checked the process list, checked remaining threads, checked the queues, all fine. Still ...

When I hit Ctrl+C, I get the following stack trace:

^CError in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib/python3.9/multiprocessing/util.py", line 300, in _run_finalizers
    finalizer()
  File "/usr/lib/python3.9/multiprocessing/util.py", line 224, in __call__
    res = self._callback(*self._args, **self._kwargs)
  File "/usr/lib/python3.9/multiprocessing/queues.py", line 201, in _finalize_join
    thread.join()
  File "/usr/lib/python3.9/threading.py", line 1053, in join
    self._wait_for_tstate_lock()
  File "/usr/lib/python3.9/threading.py", line 1073, in _wait_for_tstate_lock
    if lock.acquire(block, timeout):
KeyboardInterrupt

(Can't change the Python 3.9, as I don't control the target system where this is supposed to run)

There's nothing left to join, the only two remaining threads are MainThread and QueueFeederThread.

 

After some more debugging I had the simple idea not only to empty the queue before finishing the script, but setting the queue variable to None:

worker_queue = None

This helps. The script is no longer hanging at the end. At a later point I will see if the problem is fixed in newer versions.

  • Twitter
  • Bookmark Hanging script at the end of Python multiprocessing at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Hanging script at the end of Python multiprocessing
  • Bloglines Hanging script at the end of Python multiprocessing
  • Technorati Hanging script at the end of Python multiprocessing
  • Fark this: Hanging script at the end of Python multiprocessing
  • Bookmark Hanging script at the end of Python multiprocessing at YahooMyWeb
  • Bookmark Hanging script at the end of Python multiprocessing at Furl.net
  • Bookmark Hanging script at the end of Python multiprocessing at reddit.com
  • Bookmark Hanging script at the end of Python multiprocessing at blinklist.com
  • Bookmark Hanging script at the end of Python multiprocessing at Spurl.net
  • Bookmark Hanging script at the end of Python multiprocessing at Simpy.com
  • Bookmark Hanging script at the end of Python multiprocessing at blogmarks
  • Bookmark Hanging script at the end of Python multiprocessing with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Not so equal texts in PostgreSQL - and how to compare texts in a more elaborate way

Christophe Pettus posted an interesting challenge here. Two strings which on the surface look equal, but if you ask PostgreSQL to compare them, they are not equal.

Now let me start with a note: Twitter totally screws this challenge up.

How so? Although the two strings are different in the original, when posting this to Twitter the strings are made equal. Where is the fun in that?

I asked Christophe for the original query:

INSERT INTO t VALUES (E'Zo\u0065\u0301', E'Zo\u00e9');

And you end up with the following texts in the table:

SELECT * FROM t;
  a  |  b  
-----+-----
 Zoé | Zoé
(1 row)

If you translate the UTF-8 strings into hex, you get "0x5a 0x6f 0x65 0xcc 0x81" and "0x5a 0x6f 0xc3 0xa9". Clearly they are different.

However if you convert the two strings from the Tweet, you get "0x5a 0x6f 0xc3 0xa9" and "0x5a 0x6f 0xc3 0xa9". Same string. Poor Twitter.

Checking the hex values was actually one of my first ideas when I spotted this challenge. But nevertheless based on my experience from my "Data Types in PostgreSQL" and "Advanced Data Types in PostgreSQL" talks, I figured it should be possible to "solve" this puzzle even if the strings are in fact equal.

Buckle up! We are about to dive deep into how extendible PostgreSQL really is!

 

Continue reading "Not so equal texts in PostgreSQL - and how to compare texts in a more elaborate way"
  • Twitter
  • Bookmark Not so equal texts in PostgreSQL - and how to compare texts in a more elaborate way at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Not so equal texts in PostgreSQL - and how to compare texts in a more elaborate way
  • Bloglines Not so equal texts in PostgreSQL - and how to compare texts in a more elaborate way
  • Technorati Not so equal texts in PostgreSQL - and how to compare texts in a more elaborate way
  • Fark this: Not so equal texts in PostgreSQL - and how to compare texts in a more elaborate way
  • Bookmark Not so equal texts in PostgreSQL - and how to compare texts in a more elaborate way at YahooMyWeb
  • Bookmark Not so equal texts in PostgreSQL - and how to compare texts in a more elaborate way at Furl.net
  • Bookmark Not so equal texts in PostgreSQL - and how to compare texts in a more elaborate way at reddit.com
  • Bookmark Not so equal texts in PostgreSQL - and how to compare texts in a more elaborate way at blinklist.com
  • Bookmark Not so equal texts in PostgreSQL - and how to compare texts in a more elaborate way at Spurl.net
  • Bookmark Not so equal texts in PostgreSQL - and how to compare texts in a more elaborate way at Simpy.com
  • Bookmark Not so equal texts in PostgreSQL - and how to compare texts in a more elaborate way at blogmarks
  • Bookmark Not so equal texts in PostgreSQL - and how to compare texts in a more elaborate way with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Golf 8 - ein Jahr

Wir haben den Golf 8 jetzt etwas über ein Jahr, Zeit eine weitere Bilanz zu ziehen.
Oder wie der Werkstattmeister so schön sagte: “Das Fahrzeug ist häufiger bei uns als bei Ihnen”.

Die Aussage aus dem letzten Blog Post bleibt im wesentlichen: von der Hardware her ist der Golf 8 ein solides Auto. Die Software braucht jedoch noch 3, 4 Jahre. Die meisten Probleme die wir im letzten Jahr hatten, waren irgendwie mit der Software verbunden. Das Fahrzeug stand insgesamt 5 oder 6 Mal in der Werkstatt, was für einen Neuwagen viel zu viel ist.
 

 

Continue reading "Golf 8 - ein Jahr"
  • Twitter
  • Bookmark Golf 8 - ein Jahr at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Golf 8 - ein Jahr
  • Bloglines Golf 8 - ein Jahr
  • Technorati Golf 8 - ein Jahr
  • Fark this: Golf 8 - ein Jahr
  • Bookmark Golf 8 - ein Jahr at YahooMyWeb
  • Bookmark Golf 8 - ein Jahr at Furl.net
  • Bookmark Golf 8 - ein Jahr at reddit.com
  • Bookmark Golf 8 - ein Jahr at blinklist.com
  • Bookmark Golf 8 - ein Jahr at Spurl.net
  • Bookmark Golf 8 - ein Jahr at Simpy.com
  • Bookmark Golf 8 - ein Jahr at blogmarks
  • Bookmark Golf 8 - ein Jahr with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

WMF Küchenminis Smoothie-to-go 0,6l

Irgendwann September 2020 wollten wir unseren in die Tage gekommenen Smoothiemaker ersetzen. Nach etwas Recherche wurde es dann der "WMF Küchenminis Smoothie-to-go 0,6l". Es sollte nicht der einzige bleiben.

Das Gerät ist eigentlich gut verarbeitet, aber recht laut im Gebrauch. Stört aber nicht so sehr, weil man es meistens tagsüber verwendet. Solider Rahmen aus Edelstahl, lässt sich leicht reinigen. Ein paar Kleinigkeiten sind mit der Zeit jedoch aufgefallen:

  • Der Verschluss des Behälters mit dem eigentlichen Schneidwerk schließt recht genau mit der Fassung des Gehäuses ab. Nechdem sich einmal nach dem Mixen der Behälter vom Schneidkopf gelöst hat und der Kopf selber nicht aus der Fassung ausrasten wollte, standen wir dann mit einem etwas klebrigen Problem dar. Letzten Endes haben wir den Behälter umgedreht und abgeschraubt und danach mit einer Zange den Schneidkopf herausgedreht. Der glatte Abschluss zwischen Schneidkopf und Rahmen des Motors sieht zwar hübsch aus, ist aber nicht in jedem Fall hilfreich.
  • Das Gehäuse hat Öffnungen zum Motor hin. Mir ist nicht ganz klar wozu diese gut sind, aber wenn etwas Flüssigkeit aus dem Behälter (siehe oben) da hineinläuft, tut man sich schwer diese Öffnungen wieder sauber zu bekommen. Öffnungen nach unten zum Boden hin sollten reichen.

Im Juni 2021 ergab sich ein größeres Problem: der Einschaltknopf schaltete das Gerät nicht mehr in jedem Fall ein, sondern blockierte ab und zu. Im Boden des schwarzen Kopfes der den Schneidkopf aufnimmt ist eine mechanische Verriegelung angebracht die durch den Schneidkopf betätigt wird. Das stellt sicher dass der Motor nur angeschaltet werden kann wenn ein Behälter eingesetzt ist. Diese Verriegelung ist irgendwie mechanisch mit dem Einschaltknopf innerhalb des Gehäuses verbunden. Wenn man (mit gezogenem Stecker) die Verriegelung eindrückt stellt man fest wie die Verriegelung am Schalter aufgehoben wird. So weit, so gut. Jedoch funktionierte dieser Mechanismus nach rund 9 Monaten nicht mehr zuverlässig, sondern blockierte immer häufiger.

Garantiefall aufgemacht, das Gerät wurde getauscht. Das neue Gerät funktionierte anfangs einwandfrei - bis zum Dezember. Danach trat das gleiche Problem auf, jedoch diesmal sofort. Während beim ersten Gerät immer mal wieder der Einschaltknopf noch betätigt werden konnte, blockierte das zweite Gerät von einem Tag auf den anderen und ließ sich nicht mehr einschalten. Nach rund 8 Monaten genau das gleiche Problem?

Diesmal habe ich das Gerät einfach zurück gegeben. Jetzt muss ich noch einen anderen Smoothiemaker finden, nicht von WMF.

  • Twitter
  • Bookmark WMF Küchenminis Smoothie-to-go 0,6l at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg WMF Küchenminis Smoothie-to-go 0,6l
  • Bloglines WMF Küchenminis Smoothie-to-go 0,6l
  • Technorati WMF Küchenminis Smoothie-to-go 0,6l
  • Fark this: WMF Küchenminis Smoothie-to-go 0,6l
  • Bookmark WMF Küchenminis Smoothie-to-go 0,6l at YahooMyWeb
  • Bookmark WMF Küchenminis Smoothie-to-go 0,6l at Furl.net
  • Bookmark WMF Küchenminis Smoothie-to-go 0,6l at reddit.com
  • Bookmark WMF Küchenminis Smoothie-to-go 0,6l at blinklist.com
  • Bookmark WMF Küchenminis Smoothie-to-go 0,6l at Spurl.net
  • Bookmark WMF Küchenminis Smoothie-to-go 0,6l at Simpy.com
  • Bookmark WMF Küchenminis Smoothie-to-go 0,6l at blogmarks
  • Bookmark WMF Küchenminis Smoothie-to-go 0,6l with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Icinga Director and disk checks for fuse mountpoints

When I rolled out my new Icinga2 installation, and added disk checks for all laptops, I ran into a small problem: there is a fuse mountpoint for logged in users which only the user can read. Apparently it has something to do with Flatpack.

cat /proc/mounts | grep doc
/dev/fuse /run/user/1000/doc fuse rw,nosuid,nodev,relatime,user_id=1000,group_id=1000 0 0

By default, the Icinga2 ITL has a number of file system types excluded for the "check_disk" check, even some special fuse types, but plain "fuse" is not among them. Kind of makes sense, a fuse mountpoint can be anything, and you don't want to exclude all of them by default.

This results in the following error message when the check is rolled out on our laptops:

Plugin Output
DISK CRITICAL - /run/user/1000/doc is not accessible: Permission denied

Fortunately the fix is rather easy:

 

 

Continue reading "Icinga Director and disk checks for fuse mountpoints"
  • Twitter
  • Bookmark Icinga Director and disk checks for fuse mountpoints at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Icinga Director and disk checks for fuse mountpoints
  • Bloglines Icinga Director and disk checks for fuse mountpoints
  • Technorati Icinga Director and disk checks for fuse mountpoints
  • Fark this: Icinga Director and disk checks for fuse mountpoints
  • Bookmark Icinga Director and disk checks for fuse mountpoints at YahooMyWeb
  • Bookmark Icinga Director and disk checks for fuse mountpoints at Furl.net
  • Bookmark Icinga Director and disk checks for fuse mountpoints at reddit.com
  • Bookmark Icinga Director and disk checks for fuse mountpoints at blinklist.com
  • Bookmark Icinga Director and disk checks for fuse mountpoints at Spurl.net
  • Bookmark Icinga Director and disk checks for fuse mountpoints at Simpy.com
  • Bookmark Icinga Director and disk checks for fuse mountpoints at blogmarks
  • Bookmark Icinga Director and disk checks for fuse mountpoints with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Enable and disable window dimming in KDE

When I make changes in OpenStreetMap, I often need to extract the object colour from a picture or a video, as example for a building, bench or a roof. This collides with a feature in KDE which I really like: Dim Inactive Windows.

The setting is in the KDE settings, under Desktop Effects -> Dim Inactive. As the name implies, it dims (makes them a bit more dark) all non-active windows - which makes it visually clear which window is currently active. Quite useful.

For picking a colour from a picture/video I'm using KColorChooser, which provides the colour in Hex code - exactly what I need in OSM.

However when KColorChooser is the active window, and all other windows are dimmed, it extracts the wrong colour from the picture/video - the colour which is already dimmed. Not what I need. Therefore when I do OSM edits, I temporarily disable this feature.

At first I went into the KDE settings, twice, but this is too many clicks. Then I figured out the commandline arguments to disable and enable this feature.

Disable "Dim Inactive":

kwriteconfig5 --file kwinrc --group Plugins --key diminactiveEnabled false
qdbus org.kde.KWin /KWin reconfigure

Enable "Dim Inactive":

kwriteconfig5 --file kwinrc --group Plugins --key diminactiveEnabled false
qdbus org.kde.KWin /KWin reconfigure

Now all I need to do is execute a small script which is in my personal ~/bin directory. Let the edits continue.

Note: I wish JOSM would have an integrated video player which also allows to pick colours. But so far I haven't found any such plugin.

  • Twitter
  • Bookmark Enable and disable window dimming in KDE at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Enable and disable window dimming in KDE
  • Bloglines Enable and disable window dimming in KDE
  • Technorati Enable and disable window dimming in KDE
  • Fark this: Enable and disable window dimming in KDE
  • Bookmark Enable and disable window dimming in KDE at YahooMyWeb
  • Bookmark Enable and disable window dimming in KDE at Furl.net
  • Bookmark Enable and disable window dimming in KDE at reddit.com
  • Bookmark Enable and disable window dimming in KDE at blinklist.com
  • Bookmark Enable and disable window dimming in KDE at Spurl.net
  • Bookmark Enable and disable window dimming in KDE at Simpy.com
  • Bookmark Enable and disable window dimming in KDE at blogmarks
  • Bookmark Enable and disable window dimming in KDE with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

How to configure notifications in Icinga2 Director

I'm using Icinga2 for a long time, but recently installed a new system and using Director for the first time. I know how to configure notifications in Icinga2 config files, but getting them working in Director (with Director options only) is a bit of a challenge.

Here is a step-by-step to get simple mail notifications working. From there it should be easier to configure more advanced notifications.

 

Continue reading "How to configure notifications in Icinga2 Director"
  • Twitter
  • Bookmark How to configure notifications in Icinga2 Director at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg How to configure notifications in Icinga2 Director
  • Bloglines How to configure notifications in Icinga2 Director
  • Technorati How to configure notifications in Icinga2 Director
  • Fark this: How to configure notifications in Icinga2 Director
  • Bookmark How to configure notifications in Icinga2 Director at YahooMyWeb
  • Bookmark How to configure notifications in Icinga2 Director at Furl.net
  • Bookmark How to configure notifications in Icinga2 Director at reddit.com
  • Bookmark How to configure notifications in Icinga2 Director at blinklist.com
  • Bookmark How to configure notifications in Icinga2 Director at Spurl.net
  • Bookmark How to configure notifications in Icinga2 Director at Simpy.com
  • Bookmark How to configure notifications in Icinga2 Director at blogmarks
  • Bookmark How to configure notifications in Icinga2 Director with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca