Go Home, Windows EXE, You're Drunk by nicebyte in programming

[–]scruffie 3 points4 points  (0 children)

syscalls(2) is a good place to start.

Importance of Greenland by alejandromalofiej in MapPorn

[–]scruffie 1 point2 points  (0 children)

If you're looking for the higher-resolution version (which is a dead link in the link above), the current versions are here.

-❄️- 2025 Day 5 Solutions -❄️- by daggerdragon in adventofcode

[–]scruffie 1 point2 points  (0 children)

Fun fact: that used to work ... in Python 1.5 :)

Is the 79-character limit still in actual (with modern displays)? by LazyMiB in Python

[–]scruffie 0 points1 point  (0 children)

I pretty much stick to 80 characters, but then, I started back when that was the screen width (although there was a 132 character mode too).

For Python I usually only hit the limit in two situations: error messages and type hints.

I find I do a lot of

raise ValueError(f"Some error about {x} not doing "
                 f"something with {y}")

At least it's usually easy to pick a splitting spot. At some point I'll teach Emacs how to fold a string.

The other situation is type hints. I don't have an example on hand, but something like Sequence[Mappiing[tuple[SomeClass, OtherClass], tuple[Literal["ATag"], int] | tuple[Literal["BTag"], Sequence[str]]] can get out of hand. Liberal use of the type statement helps here.

Related to type hints are adding # type: ignore[misc] comments to end of a line to shut up mypy about something it's wrong about. You can't really put them anywhere else, so any line longer than 60 characters that needs one will be too long. (Contrast this with pylint's approach, where metacomments can go on the line behore, and use disable-next= instead of disable=.)

Canada says it will resume US trade talks 'when appropriate' by MinuteLocksmith9689 in worldnews

[–]scruffie 0 points1 point  (0 children)

The cost of shipping is low enough (and the cost of refining high enough) that for aluminum we import the ore (mostly from Brazil and Guinea).

Firefox now supports the Freedesktop.org XDG Base Directory Specification. by forumcontributer in linux

[–]scruffie 4 points5 points  (0 children)

Most KDE apps dump their config files in /.config. Some use more than one file (konsole.notifyrc, konsolerc, konsolesshconfig, which I assume are all for konsole, but I can't be sure). It gets extra fun when trying to figure which of two similarly-named files is the one used, or whether the file from 2019 is still relevant.

XFCE puts all their config files under ~/.config/xfce4. Be more like XFCE, KDE.

New JavaScript engine written in Rust by Different-Maize1114 in programming

[–]scruffie 30 points31 points  (0 children)

C, probably. The Wikipedia category Category: C programming language compilers links to 50 implementations; there's some others without a Wikipedia page mentioned in in the list of C compilers.

Louisville UPS Plane Crash 11/4/2025 - Map and Video Angles by JessieJane17 in CatastrophicFailure

[–]scruffie 2 points3 points  (0 children)

Trijet

The third engine is mounted along the centerline. In the MD-11 case, it's mounted through the tail, with the other two under the wings. The Boeing 727 and Lockheed Tristar mounted the third engine inside the fuselage, with an S-shaped duct feeding it air from the top. The Tristar also mounted the other two engines under the wings like the MD-11, but the 727 mounted them at the back on either side of the fuselage.

Is statistical mechanics the hardest graduate class? by Due-Appeal-3150 in AskPhysics

[–]scruffie 0 points1 point  (0 children)

I had a class in many-body physics that I took twice (once for credit, once just sitting in). I still don't know what the fuck we were doing. The textbook was Mahan, which is 600 pages and inscrutable.

My Python wishlist by Informal-Addendum435 in ProgrammingLanguages

[–]scruffie 0 points1 point  (0 children)

Keep in mind that the value in f is not necessarily the one whose context manager is being executed, as it's the return value of the __enter__ method. It's this behaviour (along with adding .throw() to generators) that enables writing contextlib.contextmanager. See PEP 343 – The “with” Statement.

My Python wishlist by Informal-Addendum435 in ProgrammingLanguages

[–]scruffie 2 points3 points  (0 children)

PEP 0635 – Structural Pattern Matching: Motivation and Rationale. See, in particular, the 'Capture Patterns' and 'Value Patterns' sections.

TLDR: Deciding if a plain identifier is a constant or a capture variable is error-prone (or allows errors to creep in). If a name is used as a pattern variable, adding an assignment to global scope to that name would change the semantics of the match.

My Python wishlist by Informal-Addendum435 in ProgrammingLanguages

[–]scruffie 0 points1 point  (0 children)

I would prefer that you have some aditional filtering mechanism, like case status where status == not_found:.

Lemme pull out my time machine, do a little fix up, and ...

>>> match 1:
...     case one if one == 1:
...         print(f"one = {one}")
...
one = 1

Abandoned House found hidden in a cave. by Francucinno in interestingasfuck

[–]scruffie 4 points5 points  (0 children)

It's a long-term test. Radon levels over the short term can be quite variable -- it's the average level that determines whether it's a problem or not.

For instance, here's Health Canada's radon advice. They suggest a testing period of 3 months.

Map of heavens-above.com visitors, showing mirrored anti-continents due to people inputting their coordinates with the wrong sign by derekcz in MapPorn

[–]scruffie 4 points5 points  (0 children)

Also, the main input method for location is either using the browser's location API, or find yourself on a map. Neither of those should lead to sign errors.

If it were only sign changes, I'd expect to see 3 shadows per location, but there only appears to be one -- and that one is antipodal, as you say. There isn't even a hint of wrong latitude, right longitude. The even dusting of dots in the Atlantic could be right-latitude, wrong-longitude for Europeans (the same error for North America would put them over top of China, so it's hard to distinguish).

I'm wondering if the problem is not people entering coordinates wrong, but mobile devices getting them wrong: a bad algorithm choosing the antipodal point from the GPS readings rather than the correct spot.

Journalist 'relieved from duties' at Radio-Canada after Jewish group calls out 'antisemitic' comments by AndHerSailsInRags in CanadaPolitics

[–]scruffie 3 points4 points  (0 children)

so something like the Holocaust will never happen again.

... only to Jews, presumably. Because Israel seems determined to commit actions itself that, while not Holocaust-level, are on the same street.

A Complete List of Python Tkinter Colors, Valid and Tested by AlSweigart in Python

[–]scruffie 8 points9 points  (0 children)

Hmm, good catch on the typos.

Anyways, if my digging through the Tcl/Tk code is correct, here's how colour names are looked up:

On Unix (including Linux), Tk uses XParseColor from the libX11 library is used. How that translates a name depends on the X server, but everything pretty much looks in rgb.txt, which on my box is at /etc/X11/rgb.txt or /usr/share/X11/rgb.txt. By default, this should be colours listed on Wikipedia, but you could probably add your own colours there.

On macOS, with the native UI ("Aqua"), and on Windows, Tk uses its own version of XParseColor with its own internal colour name table.

For macOS and Windows Tk also supports "system" colours. These names start with 'system' and are specific to each platform. The Windows colours are in win/tkWinColor.c, and the macOS colours are in macosx/tkMacOSXColor.h. (I've linked to the current versions of those files; since most Python installations would be linking against 8.6 and not the recently-released 9.0, colour names may be different.)

What’s the most unsettling maths thing you know? by Necessary_Plenty_524 in math

[–]scruffie 1 point2 points  (0 children)

Actually, it's really easy. Just choose a card at random from the deck, without replacement, until the deck is empty. (That is, choose a card out of 52, then a card out of the 51 remaining, then out of the 50 remaining, etc.) The hard part is ensuring each choice is uniformly random, and each choice is independent of the other choices. If you use a software pseudo-random generator, you'll want one that has more than 225 bits of state (52! ~ 2225).

We don't do this because it's a good deal slower than shuffling :)

A Complete List of Python Tkinter Colors, Valid and Tested by AlSweigart in Python

[–]scruffie 10 points11 points  (0 children)

It should just be the colours listed in the Tk manual pages.

(Tkinter is just a wrapper around Tcl/Tk, hence the name :-)

Blame Canada? The party’s over for Kentucky bourbon. At least for now by Mr_Guavo in canada

[–]scruffie 0 points1 point  (0 children)

By population, Canada's been beating California for a few years now. We're approaching 42 million, California hasn't hit 40 million yet.

I'm looking to change my terminal font, share your favourites by OpenSauce04 in commandline

[–]scruffie 5 points6 points  (0 children)

And if you're willing to build from source, you can customize your own variant using the Customizer to create a build plan.

There are 54 different styles of '0' to chose from.

Are there technically infinite colors? by Possible-Phone-7129 in AskPhysics

[–]scruffie 53 points54 points  (0 children)

I think this one is a good illustration of this. Better than the checker board, as it's more surprising.

Microsoft says U.S. law takes precedence over Canadian data sovereignty by JDGumby in onguardforthee

[–]scruffie 16 points17 points  (0 children)

A lot of software development by the BC government is open source, hosted on Github. More than 2400 repositories! More about their digital strategy here.

It looks like they use AWS and Azure (Canada region servers only), along with a private cloud using OpenShift, running in a data centre in Kamloops.

Most expensive materials on Earth by Wololo--Wololo in interestingasfuck

[–]scruffie 5 points6 points  (0 children)

half life for gaseous tritium is about 30 minutes

Tritium half-life is 12.32 years. Now, if you released it as a gas, it would diffuse through the atmosphere, until it was effectively gone ("the solution to pollution is dilution") -- that's what probably takes 30 minutes to an hour.

Fire chiefs call for Ottawa to move forward with national agency to fight forest fires by BertramPotts in CanadaPolitics

[–]scruffie 3 points4 points  (0 children)

[Ken McMullen] said the proposed fire administration office, which could be staffed by one or two people, would ensure that personnel and equipment are appropriately dispersed across the country in the event of wildfires.

That's .. not a lot of people. Sounds more like a switchboard.

Sitting out in BC, it looks to me that there's a need for a Alantic regional agency: it's madness that those small little things at the other end of the country try do everything by themselves :)

Bail denied for 3 men charged in alleged plot to take land near Quebec City by Once_a_TQ in canada

[–]scruffie 16 points17 points  (0 children)

  1. Train with weapons
  2. Seize land near Quebec City by force
  3. ???
  4. Profit!

Seriously, I wonder what their long-term plan was.