579 karma · joined Feb 20, 2019 (7y ago) · 261 submissions
comment 1d ago · link · parent
You probably know all this already. I just don't think these types of jokes—like calling the U.S. a "third world nation"--are particularly illuminating or helpful.
comment 6d ago · link · parent
> The people shall have the right to bear arms for the defence of themselves, and the State, but the Military shall be kept in strict subordination to the civil power.
No arguments about a well-regulated militia to be had there.
If the 2nd Amendment was reinterpreted to apply only to militias, the state constitutions and their laws would still be applicable as would federal law, given that there's nothing else in the Constitution about it one way or the other.
comment 4mo ago · link · parent
comment 4mo ago · link · parent
I don't think this is true at all. If anything, it's the opposite, in that MS has greatly improved recent versions of Visual Studio.
> VSCode is the future
Maybe for some types of projects, but I have both VS and VS Code on my work machine and hardly ever use VS Code. There's just no comparison when working on .NET projects where VS is the clear winner.
comment 5mo ago · link · parent
Personally, I only open one app per desktop and just use Command-Tab. If you hold Command after Command-Tab, you can select an app with having to cycle through all of them.
comment 6mo ago · link · parent
One of the things that was clunky in the React version was the use of setInterval. I had to write a hook in React and it just added this unnecessary layer of weirdness in how it all interacts[1]. In the Lit version, I just use setInterval normally and there's nothing extra to understand.
[1] https://overreacted.io/making-setinterval-declarative-with-r...
comment 6mo ago · link · parent
I’ve deleted all my Meta accounts and other social media accounts and have lost touch with many people and find it much harder to meet new people.
Personally, I accept that tradeoff but can see how others wouldn’t (or can’t).
comment 7mo ago · link · parent
The article even ends with this quote from one of the authors of the study (emphasis added):
“Money is not the secret to happiness, but it can probably help a bit.”
comment 7mo ago · link · parent
comment 7mo ago · link · parent
comment 8mo ago · link · parent
The kind of person who would try a tool like Magit and use it to discover git would have found a different route if Magit didn't exist. The type of person who doesn't care isn't going to learn something just because a tool is available.
comment 8mo ago · link · parent
comment 9mo ago · link · parent
comment 9mo ago · link · parent
DS_Store files are just annoying, but I've seen whole bin and obj directories, various IDE directories, and all kinds of other stuff committed by people who only know git basics. I've spent way more effort over time cleaning up than I have on adding a comprehensive gitignore file.
It takes practically no effort to include common exclude patterns and avoid all that. Personally, I just grab a gitignore file from GitHub and make a few tweaks here and there:
comment 9mo ago · link · parent
I've been trying to get Visual Studio to stop mucking with line endings and encodings for years. I've searched and set all the relevant settings I could find, including using a .editorconfig file, but it refuses to be consistent. Someone please tell me I'm wrong and there's a way to force LF and UTF-8 no-BOM for all files all the time. I can't believe how much time I waste on this, mainly so diffs are clean.
comment 10mo ago · link · parent
After the initial learning curve and fiddling with settings, it just becomes natural and you can edit code or other text at blazing fast speeds. I also find that it helps with RSI by reducing arm motions reaching for the mouse.
Of course, there are other good options out there, but if vim fits your brain, it can significantly boost your editing speed. For those who say programmers don't spend that much time typing, that's true sometimes, but there are periods after the design/planning phase where we type a lot, and I want that to go as fast as possible while I have an implementation loaded into short term memory.
As someone who used to be a vim skeptic myself, I'd suggest you either give it another look or just accept that it works well for other people and go on with your day.
comment 10mo ago · link · parent
import random
def lying_flippers(num_flips=1_000_000):
"""
- Bob flips a coin and tells Alice the result but lies 20% of the
time.
- Alice tells me Bob's result but also lies 20% of the time.
- If I trust Bob, I know I'll be correct 80% of the time.
- If I trust Alice, how often will I be correct (assuming I don't
know Bob's result)?
"""
# Invert flip 20% of the time.
def maybe_flip_flip(flip: bool):
if random.random() < 0.2:
return not flip
return flip
def sum_correct(actual, altered):
return sum(1 if a == b else 0 for (b, a) in zip(actual, altered))
half_num_flips = num_flips // 2
twenty_percent = int(num_flips * 0.2)
actual_flips = [random.choice((True, False)) for _ in range(num_flips)]
num_heads = sum(actual_flips)
num_tails = num_flips - num_heads
print(f"Heads = {num_heads} Tails = {num_tails}")
bob_flips = [maybe_flip_flip(flip) for flip in actual_flips]
alice_flips = [maybe_flip_flip(flip) for flip in bob_flips]
bob_num_correct = sum_correct(actual_flips, bob_flips)
bob_percent_correct = bob_num_correct / num_flips
alice_num_correct = sum_correct(actual_flips, alice_flips)
alice_percent_correct = alice_num_correct / num_flips
# Trusting Bob should lead to being correct ~80% of the time.
# This is just a verification of the model since we already know the answer.
print(f"Trust Bob -> {bob_percent_correct:.1%}")
# Trusting Alice should lead to being correct ?% of the time.
# This model produces 68%.
print(f"Trust Alice -> {alice_percent_correct:.1%}")
print()comment 10mo ago · link · parent
comment 1y ago · link · parent
comment 1y ago · link · parent
In my city, we've had an underfunded street response program for a few years now, but a lot of people (including a lot of people who don't live here) see it as antagonistic to police and police funding, when really it should just be part of a holistic system to address social issues.
It makes no sense to me that the people who ostensibly care the most about addressing crime and "disorder" on the streets are often the most oppositional to programs that might actually address some of the underlying issues (not all of course, but some).
comment 1y ago · link · parent
The Python standard library has a configparser module, which should be used instead of custom code. It's safer and easier than manual parsing. The standard library also has a tomllib module, which would be an even better option IMO.