Skip to content

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

Find fire stations in OpenStreetMap using Overpass Turbo

My kid got a new project: find fire stations. Google Maps is not really helpful here, obviously. And searching in the OpenStreetMap web interface is also a lot of work. But Overpass Turbo is able to find all the places.

 

Continue reading "Find fire stations in OpenStreetMap using Overpass Turbo"
  • Twitter
  • Bookmark Find fire stations in OpenStreetMap using Overpass Turbo at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Find fire stations in OpenStreetMap using Overpass Turbo
  • Bloglines Find fire stations in OpenStreetMap using Overpass Turbo
  • Technorati Find fire stations in OpenStreetMap using Overpass Turbo
  • Fark this: Find fire stations in OpenStreetMap using Overpass Turbo
  • Bookmark Find fire stations in OpenStreetMap using Overpass Turbo at YahooMyWeb
  • Bookmark Find fire stations in OpenStreetMap using Overpass Turbo at Furl.net
  • Bookmark Find fire stations in OpenStreetMap using Overpass Turbo at reddit.com
  • Bookmark Find fire stations in OpenStreetMap using Overpass Turbo at blinklist.com
  • Bookmark Find fire stations in OpenStreetMap using Overpass Turbo at Spurl.net
  • Bookmark Find fire stations in OpenStreetMap using Overpass Turbo at Simpy.com
  • Bookmark Find fire stations in OpenStreetMap using Overpass Turbo at blogmarks
  • Bookmark Find fire stations in OpenStreetMap using Overpass Turbo with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

GSoC 2021 completed

The Google Summer of Code 2021 for the PostgreSQL Project is wrapped up. The timeline this year was shortened to half, compared to previous years. That’s good, because smaller projects can be worked on, and students have a chance to cope with a changing environment at home and university. On the other hand, the shorter time doesn’t allow diving into more complex projects. Nevertheless, with the help of all mentors, six students successfully concluded their projects.

 

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

Avoid linebreaks in Hugo shortcodes

Shortcodes in Hugo are a neat and poweful system to avoid repating the same piece of text over and over again. Let's say I have the following text:

Nunc in odio id magna molestie congue. Donec erat nulla, pulvinar eget volutpat non, molestie at nisi. Curabitur nec tristique felis. Cras imperdiet, ante et vestibulum iaculis, tellus ipsum pulvinar felis, at viverra est tellus et eros. In nec dignissim lectus, bibendum hendrerit ex. Praesent lobortis eget justo non vehicula.

Nulla et neque cursus libero tristique laoreet nec a ligula. Fusce sit “amet” scelerisque erat. Quisque lorem lectus, lobortis vitae mattis non, tincidunt sed felis. Donec sit “amet” erat nibh.

Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In et imperdiet dui. In ut enim pharetra, blandit purus vel, malesuada est. Morbi sollicitudin eget leo nec dignissim. Praesent sed leo quis purus pretium aliquet sed quis arcu. Pellentesque facilisis tellus nulla, dignissim laoreet quam maximus et.

And I want to link the "amet" word, then I can create a shortcode:

layouts/shortcodes/amet.html

And in this shortcode I place the text:

<a href="https://www.lipsum.com/feed/html">amet</a>

In the Markdown source this is:

Nulla et neque cursus libero tristique laoreet nec a ligula. Fusce sit "{{< amet >}}" scelerisque erat. Quisque lorem lectus, lobortis vitae mattis non, tincidunt sed felis. Donec sit "{{< amet >}}" erat nibh.

Pretty easy. However Hugo by default does a little bit too much: while generating the static content, it adds a line break. Which in the browser results in:

Nulla et neque cursus libero tristique laoreet nec a ligula. Fusce sit “amet ” scelerisque erat. Quisque lorem lectus, lobortis vitae mattis non, tincidunt sed felis. Donec sit “amet ” erat nibh.
                                                                            ^                                                                                                         ^

There is a nasty little space between the word and the quotation mark. The generated HTML source shows the problem:

  <p>Nunc in odio id magna molestie congue. Donec erat nulla, pulvinar eget volutpat non, molestie at nisi. Curabitur nec tristique felis. Cras imperdiet, ante et vestibulum iaculis, tellus ipsum pulvinar felis, at viverra est tellus et eros. In nec dignissim lectus, bibendum hendrerit ex. Praesent lobortis eget justo non vehicula.</p>
<p>Nulla et neque cursus libero tristique laoreet nec a ligula. Fusce sit &ldquo;<a href="https://www.lipsum.com/feed/html">amet</a>
&rdquo; scelerisque erat. Quisque lorem lectus, lobortis vitae mattis non, tincidunt sed felis. Donec sit &ldquo;<a href="https://www.lipsum.com/feed/html">amet</a>
&rdquo; erat nibh.</p>

Usually a line break in HTML is not a big deal, the browsers deal with that. But here an unnecessary space is added while rendering the content. Hugo makes it complicated to avoid this problem. There is no default setting to turn this off, however the shortcode can have an extra Hugo tag to avoid the training linebreak:

<a href="https://www.lipsum.com/feed/html">amet</a>{{- / Strip trailing newline. / -}}

By adding the {{- -}}, the training line break is not included in the final HTML output, and the quotation mark comes right after the shortcode content.

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

Delete directories recursive on Hetzner Storage Box

Among other external solutions, I store some data on Storage Boxes from Hetzner. The Storage Box allows you to have sub-accounts, so for every server and system storing data there, I use a separate account. For each sub-account, one can select a subdirectory where the data is stored, and the sub-account then can only see this data. The Admin account can see all data, and see all directories.

The usual way I access the Storage Box from other systems is by using sftp protocol from ssh (don't confuse this with the "other" sftp). That's all good, until I remove a sub-account and want to delete the subdirectory with the data. The server doesn't know "rm -r" for recursive deletion, which means I have to traverse into every directory, delete all files, then delete the empty directories. And the encrypted backup I'm using is creating plenty of subdirectories.

Or I find a better tool.

 

Continue reading "Delete directories recursive on Hetzner Storage Box"
  • Twitter
  • Bookmark Delete directories recursive on Hetzner Storage Box at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Delete directories recursive on Hetzner Storage Box
  • Bloglines Delete directories recursive on Hetzner Storage Box
  • Technorati Delete directories recursive on Hetzner Storage Box
  • Fark this: Delete directories recursive on Hetzner Storage Box
  • Bookmark Delete directories recursive on Hetzner Storage Box at YahooMyWeb
  • Bookmark Delete directories recursive on Hetzner Storage Box at Furl.net
  • Bookmark Delete directories recursive on Hetzner Storage Box at reddit.com
  • Bookmark Delete directories recursive on Hetzner Storage Box at blinklist.com
  • Bookmark Delete directories recursive on Hetzner Storage Box at Spurl.net
  • Bookmark Delete directories recursive on Hetzner Storage Box at Simpy.com
  • Bookmark Delete directories recursive on Hetzner Storage Box at blogmarks
  • Bookmark Delete directories recursive on Hetzner Storage Box with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca