Engineering and technology notes

How to Find Duplicate Values in a SQL Table | Tutorial by Chartio

The first query we’re going to write is a simple query to verify whether duplicates do indeed exist in the table. For our example, my query looks like this:

SELECT username, email, COUNT(*)
FROM users
GROUP BY username, email
HAVING COUNT(*) > 1

HAVING is important here because unlike WHEREHAVING filters on aggregate functions.

If any rows are returned, that means we have duplicates. In this example, our results look like this:

USERNAME EMAIL COUNT
Pete pete@example.com 2
Jessica jessica@example.com 2
Miles miles@example.com 2

In the previous step, our query returned a list of duplicates. Now, we want to return the entire record for each duplicate row.

To accomplish this, we’ll need to select the entire table and join that to our duplicate rows. Our query looks like this:

SELECT a.*
FROM users a
JOIN (SELECT username, email, COUNT(*)
FROM users 
GROUP BY username, email
HAVING count(*) > 1 ) b
ON a.username = b.username
AND a.email = b.email
ORDER BY a.email

If you look closely, you’ll see that this query is not so complicated. The initial SELECT simply selects every column in the users table, and then inner joins it with the duplicated data table from our initial query. Because we’re joining the table to itself, it’s necessary to use aliases (here, we’re using a and b) to label the two versions.

Here is what our results look like for this query:

ID USERNAME EMAIL
1 Pete pete@example.com
6 Pete pete@example.com
12 Jessica jessica@example.com
13 Jessica jessica@example.com
2 Miles miles@example.com
9 Miles miles@example.com

Because this result set includes all of the row ids, we can use it to help us deduplicate the rows later.

Source: How to Find Duplicate Values in a SQL Table | Tutorial by Chartio

How to Find Duplicate Values in a SQL Table | Tutorial by Chartio was last modified: December 28th, 2021 by Jovan Stosic

Library for compression algorithm for ESP32

You can use zlib library (https://github.com/madler/zlib).
Copy only the *.c & *.h files from root directory. I’t compiles without problems.
You can find an example in https://github.com/loboris/ESP32_curl_examplecomponents/zlib directory.

Source: Library for compression algorithm – ESP32 Forum

Library for compression algorithm for ESP32 was last modified: December 27th, 2021 by Jovan Stosic

apt – How to run Fritzing on Ubuntu 18.04 LTS?

sudo apt-get purge --autoremove fritzing

sudo add-apt-repository ppa:flatpak/stable
sudo apt update
sudo apt install flatpak

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

flatpak install flathub org.fritzing.Fritzing

Source: apt – How to run Fritzing on Ubuntu 18.04 LTS? – Ask Ubuntu

apt – How to run Fritzing on Ubuntu 18.04 LTS? was last modified: December 16th, 2021 by Jovan Stosic

HASS OS 6.0 VDI => After Upgrade fails every boot: Failed to start grow file system on /mnt/data – Home Assistant OS

Press <enter> when the system stops during boot systemctl stop systemd-journald umount -A /dev/disk/by-label/hassos-data fsck.ext4 /dev/disk/by-label/hassos-data Keep pressing <enter> through all the prompts

 

Source: HASS OS 6.0 VDI => After Upgrade fails every boot: Failed to start grow file system on /mnt/data – Home Assistant OS – Home Assistant Community

HASS OS 6.0 VDI => After Upgrade fails every boot: Failed to start grow file system on /mnt/data – Home Assistant OS was last modified: December 3rd, 2021 by Jovan Stosic

Apache as reverse proxy for multiple destinations and one default destination

ProxyPreserveHost On

RewriteEngine On

RewriteRule ^/appX/(.*) http://127.0.0.1:8001/appX/$1 [P,L]

ProxyPassReverse /appX/ http://127.0.0.1:8001/appX

RewriteRule ^/appY/(.*) http://127.0.0.1:8002/appY/$1 [P,L]

ProxyPassReverse /appY/ http://127.0.0.1:8002/appY

Source: Apache as reverse proxy for multiple destinations and one default destination – Super User

Apache as reverse proxy for multiple destinations and one default destination was last modified: December 3rd, 2021 by Jovan Stosic