Yup. YAML and every CI that uses it are a pain in the ass.
I makes perfect sense to me now. sayhello
is the key to a dict, and the value is another dict. pyyaml seems to have no problem parsing with or without the extra indent to to:
.
Welp. CircleCI is to blame then.
I remember running this maze code!
Be REAL NICE if there was some sound hit (like the TOTD doot do doo do doo doot, do doooooooo-) separating the TOTD and the main bit.
I thought I knew everything to know about using SSH, but TIL.
I know there are some people on the forum using Jellyfin. I recently added SyncPlay support to my Jellyfin client, making it the first client supporting most video and subtitle codecs to offer SyncPlay.
Hahaha, SHA-1 go brrrr. I tried my hand at bruteforcing hashes, and it turns out an 8 digit SHA-1 has so many collisions it is meaningless.
https://psp.re/blog/nid-cracking/
I guess this is weekday coding, but I came across an SQL situation that I don’t know the answer to, and can’t solve via Googling.
Imagine you have some data that looks like this.
id a_fk b_fk
--------------------
1 1 NULL
2 1 1
3 2 NULL
4 3 NULL
5 3 1
6 3 2
7 4 NULL
8 5 NULL
9 5 3
What I want to do is remove rows where b_fk is null, but we also want to guarantee at least one row for each distinct value of a_fk, even if b_fk is null. That means we want to eliminate rows with id of 1,4 and 8. They have a b_fk of null, and there are other rows with the same a_fk value that have a non-null b_fk. However, we want to keep rows with id of 3 and 7. Their b_fk is null, but they are the only rows that exist for their value of a_fk, so we want to keep them.
How do you query the above data to get this result?
id a_fk b_fk
--------------------
2 1 1
3 2 NULL
5 3 1
6 3 2
7 4 NULL
9 5 3
Sure feels like there should be a way to WHERE that somehow.
Is it important that a and b are foreign keys, or could they be arbitrary columns?
Sure feels like there should be a way to WHERE that somehow.
Nope, because a WHERE is evaluated within the context of a single row. How can you refer to other rows in a where clause? I thought about a self join, but even with a self join, what would the where clause be?
Is it important that a and b are foreign keys, or could they be arbitrary columns?
It really doesn’t matter. Foreign Keys are just integers anyway.
DELETE <stuff > WHERE <subquery>
?
Deleting removes rows from the database. That’s not what we want to do. And even if we wanted to delete rows, how do we select only those rows?
I solved it with a WITH
WITH as_that_have_bs AS (
select distinct(a_fk) as a_id from table where b_fk is not null
)
SELECT * from table
WHERE (a in (select a_id from as_that_have_bs) and b_fk is not null)
OR (a not in (select a_id from as_that_have_bs) and b_fk is null)
Thought you wanted to delete them.
What I want to do is remove rows
Guido is going to Microsoft.
I’m not a programmer, is this legit?
Yup!
When I start talking about a problem with Juliane, she literally says “am I your duck now?”