Skip to main content




SQL (sqlite3) question

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.

in reply to Jonathan Lamothe

You can use WITH to do it in two steps:
WITH pre_price AS (
    SELECT
        name,
        CASE WHEN sale_price IS NULL
            THEN list_price
            ELSE sale_price END
        AS price,
        tax_rate FROM prices
    )
    SELECT
        name,
        price,
        price * tax_rate AS tax
    FROM pre_price;
in reply to Jonathan Lamothe

SQL (sqlite3) question

Sensitive content



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.
in reply to Jonathan Lamothe

You really need to add "probably" to one or the other.. as in "probably mother"
in reply to juliadream

@juliadream In practice, it ends up not being a big deal. I typically message my wife over a private Nextcloud instance that my mother is not on. A message for my mother accidentally going to my wife wouldn't be as big a deal.


Okay, I'm calling uncle.

I've exported the data from the LibreOffice Base database I've been working on to an SQLite file, and I'm just going to write a proper UI for it.

reshared this



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.

in reply to Jonathan Lamothe

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/?

in reply to Ryan Frame

@Ryan Frame Yeah, that was my mistake. I edited the post to reflect that, but Diaspora doesn't support edits.


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.



Today I booked an appointment with my optometrist to get my eyes checked. A few hours later I checked the (postal) mail to find a reminder card from them.

I was shocked at how quick the mail was, only to realize it was just a generic reminder that I was due for an eye exam. It was pure coincidence.



Israel/Palestine

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

Mx. Luna Corbden reshared this.

in reply to Jonathan Lamothe

Israel/Palestine

Sensitive content

Judy Anderson reshared this.

in reply to Jonathan Lamothe

Israel/Palestine

Sensitive content

in reply to Jonathan Lamothe

It wouldn't be difficult if Hamas soldiers were firing machine guns at Israeli children, but this isn't the case.


Ugh, another piece of software I have to install from #flatpak because the #Debian repository is too old.
in reply to uhuru

@uhuru FWIW I personally had way more issues with Debian testing than with Arch 🤷
in reply to ilyess

@ilyess
ok, personal experience is a bit different....

using debian unstable for ~15y, 4-5 serious issues.. still remember which ones..
4-5y ago, used arch for a month, and things were breaking every (other?) day...





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.

in reply to Jonathan Lamothe

As an alternative, you might be interested in tikitrackers.org (which is part of the Tiki.org featureset, it's just that there is a standalone website to explain the "trackers" feature)




I've been using #Linux as my primary OS since the 90s, so I've really not been paying attention to Microsoft. Can anyone explain to me how it is they're trying to spin #Recall as a good thing?



Not to toot my own horn, but I'd forgotten how good my homemade sourdough biscuits were.


Diving into LibreOffice Base to coordinate some tasks that are becoming too cumbersome to do manually. I have very mixed feelings about this. On the one hand, it all feels very kludgy, but on the other, if all you're looking to do is slap a somewhat user-friendly UI on a database, it's the easiest way I've found to go about it.
in reply to Jonathan Lamothe

My disappointment with everything LibreOffice is immense. I have started learning RST, PST2PDF and LaTeX for my reports, reveal.js for presentations, and Juypter for my calculations because its so hard to use them. I really wish that they were just slightly better, and less unpredictable with formatting. But I'm privledged enough to not have to use others tools, and I refuse to use M$ products anymore.
in reply to Jeff MacKinnon

@Jeff MacKinnon Oftentimes, all I need is markdown, CSV, and maybe sqlite. When it's something that Katy is going to use as well, LibreOffice gives her a more familiar (MS Office-like) experience... not that she's ever used Access though... at least not to my knowledge.



We are having intermittent connectivity issues. ISP is dispatching a tech within three days *groan*. Hopefully things will be resolved soon.







mh (ADHD) alc

So, the one advantage to being out of ADHD meds is that I can have a drink without worrying about drug interactions.

I'll take my victories where I can.



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

reshared this





more electronics ramblings (KiCad)

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.

in reply to Jonathan Lamothe

more electronics ramblings (KiCad)

Sensitive content

in reply to cpresser

more electronics ramblings (KiCad)
@cpresser That sounds about the right time frame. We'll see who's done first. ;)


electronics question

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.

in reply to Jonathan Lamothe

electronics question
My guess is that the output would be driven low, but that the drain would remain in a high-impedence state (as I'd expect both the Q and ~Q outputs of the SR latch to be driven low.
in reply to Jonathan Lamothe

electronics question

Sensitive content

in reply to Matthew Skala

electronics question

Sensitive content

in reply to Matthew Skala

electronics question
@Matthew Skala Fun fact: I was staring at that exact data sheet and didn't see that. I've no plans to do this. I was just curious. Thanks for pointing it out though.


Woo! Got my clock module down to two chips total (plus resistors, capacitors, and such).

Really basic stuff, but I'm still learning #KiCad.

reshared this

in reply to Jonathan Lamothe

Just realized the the current design won't honour the halt signal when it's in manual pulse mode... 🙁
in reply to Jonathan Lamothe

Aha! A hacky solution, but I can fix it by wiring the switch that sends the manual clock pulse to ~HLT instead of +5V. No additional logic gates required.




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

in reply to Jonathan Lamothe

coincidently heard about nostr for the first time today and the context was "noted fascist network nostr" or words to that effect
in reply to Jonathan Lamothe

I haven't bothered to check it out yet. I quite like Scuttlebutt, which Nostr is somewhat based on, but Nostr lacks the features that make Scuttlebutt actually nice to use.





So, last I checked you could still buy PCB mountable sockets for them, bit does anyone know if anyone's still manufacturing NES-compatible controllers?
in reply to Jonathan Lamothe

retrobit still sells an nes compatible controller, kind of a clone of the nes advantage.
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
in reply to Jonathan Lamothe

Sure looks like it. A quick search comes up with cheap clones, as well as "new" designs like Hyperkin Cadet.


Say what you will about modern #AI chatbots, but we've given them the ability to suffer from Dunning-Kruger. That's something... right?
#AI



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).



mh: ADHD

...and I've officially let myself run out of my ADHD meds.

Shit.



How did I ever live before terminal multiplexing? Decided to work out on the balcony this morning, and then when the weather changed, was able to just hand off my various SSH sessions from my tablet to my laptop.
in reply to Jonathan Lamothe

Which multiplexer do you use? I've been wanting to get better with that. I've played around with screen and tmux a bit, but need to get more fluent with the commands/shortcuts.
in reply to Hrrmmph

@Spacegoat I used screen for many years. I somewhat recently switched to tmux. Both are solid options, though tmux seems more popular.

This website uses cookies. If you continue browsing this website, you agree to the usage of cookies.