I've run into a snag with an sqlite database I've been working on. Below is a simplified example of the problem.
Suppose I have the following table:
CREATE TABLE "prices" (
"id" INTEGER NOT NULL UNIQUE,
"name" TEXT NOT NULL UNIQUE,
"list_price" NUMERIC NOT NULL,
"sale_price" NUMERIC,
"tax_rate" NUMERIC NOT NULL,
PRIMARY KEY("id" AUTOINCREMENT)
);
Is there a way to do something like the following?
SELECT
name,
CASE
WHEN sale_price IS NULL
THEN list_price
ELSE sale_price
END AS price,
price * tax_rate AS tax
FROM prices;
The
tax
column doesn't seem to acknowledge the price
column's existence, presumably because it's a column in the query rather than the source table. I could re-implement the CASE
logic for the tax
field, but that feels inelegant and error-prone.Is there a better way to do this?
Shannon Prickett reshared this.
A text I just sent to my mother (presented with no context):
It's sometimes tricky that my wife and mother have very similar looking names and are alphabetically right next to eachother in my contacts. It's astonishing that that hasn't led to more embarrassing mistakes.
Katy and I like to watch psychological thrillers from time to time, but I've noticed a recurring trope that confuses me. It goes like this: Psychopath lives in an outwardly normal looking house, but has a secret passage to a secret murder basement.
Who built this? Am I to believe he excavated the earth, poured the concrete, ran the (usually admittedly shoddy) electrical himself? Did no contractor at any point ever think to themselves: "this doesn't seem right. Perhaps I should alert the authorities?"
Edit: typo
Edit: I'm an idiot who confused diameter with circumference for some reason. Embarrassing original post follows.
Was playing around a bit with the OpenWeatherMap API. I wanted to know how precise I needed to be with the latitude & longitude values, so I decided to do some quick calculations.
To get a rough idea, I wanted to determine how much a change of one degree of latitude would move in kilometers. I knew the diameter of the earth was something fairly close to 40,000 km but wanted to verify that factoid. I did a quick duckduckgo search, and the top three results (on seemingly separate web sites) all said 12,756 km. In fact one of them hilariously said 12.756 km.
I assume this is the result of LLMs filling the internet with crap, but it's alarming that if I didn't know any better, I'd have just blindly accepted this as fact.
12.756 km may be a locale difference; if the site wasn't US or UK-based the decimal might be the thousands separator.
the diameter of the earth was something fairly close to 40,000 km
s/diameter/circumference/
?
Fine, I'll watch #wwdc24 to see what everyone's been talking about.
Before a few hours ago, I didn't even realize it was happening.
Okay, I'm just going to say it because amazingly enough, some people don't seem to get this.
Just because I'm critical of Israel bombing hospitals in Palestine doesn't mean I'm pro-Hamas. I'm not.
It frustrates me that this is a thing that even needs to be said.
Edit: typo
like this
Mx. Luna Corbden reshared this.
Ep. 316 Ramtha's School of Enlightenment - A Father's Perspective. Episode 143 Part 2 Remastered
In this 2-part series, I first chat with Bob about his experiences losing his daughter to JZ Knight's Ramtha's School of Enlightenment. Bob speaks about the heaSpreaker
Decided to learn and use #LibreOffice Base for a thing because I thought it would be an easier way to slap a quick and dirty UI on a database than rolling an app from scratch (which I already knew how to do).
I was wrong, but at this point I'm going full sunk cost fallacy.
like this
Ep. 316 Ramtha's School of Enlightenment - A Father's Perspective. Episode 143 Part 1 Remastered
In this 2-part series, I first chat with Bob about his experiences losing his daughter to JZ Knight's Ramtha's School of Enlightenment. Bob speaks about the heaSpreaker
like this
Ep. 315 Manhattan Cult Story - Episode 141 Remastered Part 2
In this episode I speak with Spencer about his time spent in Sharon Gan's cult in Manhattan known as the Odyssey Study Group. Spencer descirbes all of this in hSpreaker
Ep. 315 Manhattan Cult Story - Episode 141 Remastered Part 1
In this episode I speak with Spencer about his time spent in Sharon Gan's cult in Manhattan known as the Odyssey Study Group. Spencer descirbes all of this in hSpreaker
Okay, sqlitebrowser (from the #Debian repositories) is actually a pretty decent tool. It provides a nice point-and-click interface that makes working with #sqlite3 databases a little bit nicer. Knowledge of how to write an #SQL query is still a requirement, but it makes creating/editing tables more convenient. Maybe it's well known, but I just discovered it yesterday.
Edit: sqlite browser, not mysqlbrowser
like this
reshared this
So, I get that #KiCad can't have symbols and footprints for every component ever in their default library, but some of the things they've chosen to include can be a little confusing when compared against what they haven't chosen to include. Here's an example:
There are symbols for the TC74HC00 (quad NAND gate) and TC74HC08 (six channel inverter) series of chips, but none for the TC74HC04 (quad AND gate). Sure, the 74HC00 symbol can fairly trivially be edited into a 74HC04, but still... Am I missing something here?
Fortunately, for this particular board I was able to do some boolean magic with a single 74HC00, so it's a moot point.
I'd try this out on a breadboard, but I don't currently have the necessary parts so I'll just ask instead.
What happens on a 555 timer if you simultaneously drive the trigger low and the threshold high? Is this an error state that could vary from chip to chip?
𝚛𝚊𝚝 reshared this.
Q
and ~Q
outputs of the SR latch to be driven low.
Woo! Got my clock module down to two chips total (plus resistors, capacitors, and such).
Really basic stuff, but I'm still learning #KiCad.
like this
reshared this
~HLT
instead of +5V
. No additional logic gates required.
Ep. 314 Shincheonji - Episode 75 Remastered
In this weeks episode we are diving into another movement that originated in Korea. This one comes with a twist... you don't find out that this movement is SCJSpreaker
Decided to look into Nostr since everyone here seems to hate it (so I can figure out why).
From their website, they tout that it's "censorship-resistant"* while also complaining that traditional social media is overrun by bots and spam.
How does one go about solving the bot/spam problem without resorting to censorship? This feels rather mutually exclusive to me.
* frequently a fascist dog whistle
R. L. Dane :debian: :openbsd: reshared this.
8bitdo makes bluetooth receivers that plug into an nes controller port, been thinking about getting one of those.
And there are plenty of no name 3rd party nes controllers on websites like aliexpress
Jonathan Lamothe likes this.
Here's the funny thing about propaganda:
It gets started by someone (or a group of someones) with an agenda, but when it's effective, it gets swallowed and spread by well-meaning individuals who simply don't know any better. When this happens, it becomes even more effective, making it a vicious cycle.
Not everyone who spreads it is doing so for nefarious reasons (though many are).
screen
for many years. I somewhat recently switched to tmux
. Both are solid options, though tmux
seems more popular.
Isaac Ji Kuo
in reply to Jonathan Lamothe • • •Sensitive content
Probably not as elegant as you'd like, but:
SELECT tem.*,
price*tax_rate AS tax
FROM
(SELECT name,
CASE
WHEN sale_price IS NULL
THEN list_price
ELSE sale_price
END AS price
FROM prices) AS tem;
Jonathan Lamothe likes this.
Jonathan Lamothe
in reply to Isaac Ji Kuo • •Isaac Ji Kuo
in reply to Jonathan Lamothe • • •Sensitive content
Jonathan Lamothe
in reply to Isaac Ji Kuo • •If you're morbidly curious, the final resulting code was:
((( David "Kahomono" Frier )))
in reply to Jonathan Lamothe • • •Jonathan Lamothe
in reply to ((( David "Kahomono" Frier ))) • •@((( David "Kahomono" Frier ))) Yeah, that was my assumption. I just wasn't sure what the best way to go about fixing it was. So far, this is the front-runner:
Isaac Ji Kuo
2024-06-13 21:30:16
((( David "Kahomono" Frier )))
in reply to Jonathan Lamothe • • •Ryan Frame
in reply to Jonathan Lamothe • • •WITH
to do it in two steps:Gwen (Almond Joy->Mounds arc)
in reply to Jonathan Lamothe • • •Sensitive content
But yeah, you have figured out why you can't do it. You're actually, imho, best off implementing the case in the tax column. Or changing how you handle sales.