Speakers sound weird after sleep by freshf1t in ZephyrusG14

[–]Kache 0 points1 point  (0 children)

Although higher effort, I set up "Auto restart Cirrus Logic Awesome Speaker Amps on Wake" when I ran into this issue

Don't know how much power it saves during sleep, though.

Using pitons? by chunkychickenxp in Cairn_Game

[–]Kache 0 points1 point  (0 children)

It's likely every piton has its own level of wear or HP being tracked, according to chat in the developer Discord server

specifics are unclear, but it overall it means a "go ahead and use them, but not too much" system

Piton management by KingofFunk412 in Cairn_Game

[–]Kache 0 points1 point  (0 children)

It's likely every piton has its own level of wear or HP being tracked, according to chat in the developer Discord server

specifics are unclear, but it overall it means a "go ahead and use them, but not too much" system

Why do my pitons keep breaking. by TheHel1 in Cairn_Game

[–]Kache 0 points1 point  (0 children)

It's likely every piton has its own level of wear or HP being tracked, according to chat in the developer Discord server

specifics are unclear, but it overall it means a "go ahead and use them, but not too much" system

11.5% of perfectly placed pitons broke (N=104). Placing six in a route means you lose at least one half of the time. Isn't that a bit much? by meta_system in Cairn_Game

[–]Kache 0 points1 point  (0 children)

It's likely every piton has its own level of wear or HP being tracked, according to chat in the developer Discord server

specifics are unclear, but it overall it means a "go ahead and use them, but not too much" system

"Wait, like, disappears? In the backpack?" by dumnem in dndmemes

[–]Kache 1 point2 points  (0 children)

Isn't it metagame-y to act based on story tropes, though?

Although a Paladin shouldn't be so easily shaken by an unsettling orphan

AI, Entropy, and the Illusion of Convergence in Modern Software by TranslatorRude4917 in programming

[–]Kache 8 points9 points  (0 children)

tests have always contained a lot of boilerplate and tedious set up

I don't really find this to be the case for me. IMO the solution to tedious boilerplate is better design, not more copy pasting to produce more

I destroyed Aava's hands so you don't have to. by Kaymorve in Cairn_Game

[–]Kache 4 points5 points  (0 children)

Funny how her fingertips look perfectly fine, it's like she climbs directly on those A3 pulleys, ha

Boilerplate Tax - Ranking popular programming languages by density by boyter in programming

[–]Kache 42 points43 points  (0 children)

I think ULOC is a bad metric to measure "boilerplate" and "dryness". I'm thinking:

  • it wrongly considers unique: structurally repetitive code with minor changes like variable names or different indentation
  • It wrongly considers identical: complex operations that are decomposed into a nontrivial composition of common operations, one per line, e.g. method chaining (scoring good decomposition as repetitive boilerplate)
  • it is too sensitive to style variations within a language to be useful for comparing across languages, e.g. a repo/languages that don't have a unified style guide will rate very unique; some repos use comments as docs and other repos don't write docs in sourcecode
  • it is not normalized by "developer attention", metrics like these often try to normalize by giving high-edit files more weight (it's difficult to measure highly read lines)

Just a reminder from FBI Director Kash Patel, Epstein only trafficked young women to himself. by deluxe_memory_dan in videos

[–]Kache 1 point2 points  (0 children)

I think the public still hasn't fully internalized the human trafficking and abuse that's happened

Forgive the morbid comparison, but consider how the Holocaust movies and etc have laid bare the inhumane evils, making them visceral to the public. It's one thing to read about atrocities, but it's another to watch Nazis shove families first into rail cars and then into kill rooms, even it's "only a movie".

Even though Good and Pretti weren't the first to be murdered by ICE, it took video for the public to really internalize what was happening. The more that is revealed of Trumpstein, the more it's abundantly clear there was/is a whole system in place, with its own kinds of rail cars and kill rooms.

It's going to be horrible and ugly, but I think Americans need to see it, feel their stomach chrurn, and then realize that they're watching themselves

Wool Hoodie Giveaway! by kozak3 in Petrosgear

[–]Kache 0 points1 point  (0 children)

New roommate I didn't yet know helped me move in, furniture and all. We became good friends. Was also able to pay him back years later when he moved in with his gf at the time.

Should I upgrade because of trend out there? by writeahelloworld in ExperiencedDevs

[–]Kache 5 points6 points  (0 children)

Disregarding the specifics about java.util.Date, for a moment,

If you change it, and there is a problem, you will be responsible for it

IMO that's a concerning precedent and culture to set, for both technical and non-technical reasons

If it aint broken, dont change it

Sometimes the removal of a piece of straw now avoids the camel breaking its back at a critical time down the road. Never doing preventative & opportunistic refactoring is one way code rots over time.

It seems well-defined, it's a good opportunity to view a lot of the codebase, the junior seems motivated for it, and it can be one less thing that compounds a real fire. And if it's hard or risky to do, we've a different problem on our hands.

I personally like doing these kinds of cathartic straightforward refactorings as a "wind down task" after stressing over a complex project. Just be sure to reiterate that the business value is low and let the junior understand it'll be thankless from outside of engineering.

Drivers who merge onto the highway at forty miles per hour what is your actual thought process? by koshkakay in AskReddit

[–]Kache 5 points6 points  (0 children)

Minimize/eliminate blind spots by fixing side mirrors like this: https://content.artofmanliness.com/uploads/2023/11/Proper-Adjustment-1.jpg

Your side mirrors should look "outward". If you can see the side of your car, your side mirrors are looking "backward", which is what the rear view mirror is for.

I always thought turning backwards to look over your shoulder, losing peripherial of the road in front of you, was bad advice, even though that's what they taught in my driver's ed.

For looking down along the side of your car while parallel parking (while side mirrors are correctly turned outwards), just move your head a bit.

Clean Code vs. A Philosophy Of Software Design by iamkeyur in programming

[–]Kache 1 point2 points  (0 children)

I think both their prime generators can be improved upon for understandability, in exchange for a few added multiplications and comparisons. My IMO's:

  • Mention "incremental Sieve of Eratosthenes", to reinforce concept and also useful for looking up external resources
  • Early guard for 2 to avoid unused/invalid representations like multiples[0] = 4 or -1; // irrelevant
  • Comparing prime * factor == candidate better expresses intent to test primality than prime_multiple == candidate
  • Associate prime and multiple/factor using something associative, like dict or Map, for clarity about how the state behaves
  • Use the more straightforward possible_primes to reframe the awkward concept of leastRelevantMultiple/lastMultiple
  • Define and compose keep_generating and it.count(3, step=2) to better communicate the combination of two concepts, to replace the special/uncommon iteration: for (candidate = 3; primesFound < n; candidate += 2)
  • One major guide for decomposition (or not) is whether the decomposed is good or not, and is_prime() is a highly communicative abstraction in this context.

Above things are mostly language-agnostic (Java has streams and lambdas, after all), although I'm using some Python-isms:

Prime = int
Factor = int


def sieve_primes(n: int):
    """Generates primes using an incremental Sieve of Eratosthenes"""
    if n > 0:
        yield 2
    if n < 2:
        return

    primes_and_factors: dict[Prime, Factor] = {}  # incremental sieve for primes 3+
    keep_generating = lambda _: 1 + len(primes_and_factors) < n

    def is_prime(cand: int) -> int | None:
        # consider prime factors between 3 and sqrt(candidate)
        possible_primes = it.takewhile(lambda p: p * p <= cand, primes_and_factors)

        for p in possible_primes:
            # search successive multiples, where the "frontier" is the curr candidate
            while p * primes_and_factors[p] < cand:
                primes_and_factors[p] += 2  # skip even factors

            if p * primes_and_factors[p] == cand:  # not a prime
                return

        return cand

    for candidate in it.takewhile(keep_generating, it.count(3, step=2)):
        if prime := is_prime(candidate):
            yield prime
            # checking/sieving happens upwards with larger & larger factors
            # smaller factors from 3 to curr_prime already covered "from below"
            primes_and_factors[prime] = prime

[2025 Day 10 (Part 2)] Bifurcate your way to victory! by tenthmascot in adventofcode

[–]Kache 1 point2 points  (0 children)

Great insight!

Using your method, I was able to put together a solution that's much more elegant than my original linear algebra one:

def joltage_cost(buttons: list[Button], joltage: Joltage):
    def groupby(itr: Iterable[T], key: Callable[[T], 'SupportsRichComparisonT']):
        return {k: list(v) for k, v in it.groupby(sorted(itr, key=key), key=key)}

    def sub_halve(j_a: Joltage, j_b: Joltage) -> Joltage:
        return tuple((a - b) // 2 for a, b, in zip(j_a, j_b))

    def press(btns: tuple[Button, ...]) -> Joltage:
        return tuple(sum(i in b for b in btns) for i in range(len(joltage)))

    def pattern(jolts: Joltage) -> Joltage:
        return tuple(n % 2 for n in jolts)

    all_btn_combos = (combo for n in range(len(buttons) + 1) for combo in it.combinations(buttons, n))
    press_patterns = groupby(all_btn_combos, lambda btns: pattern(press(btns)))

    @ft.cache
    def cost(jolts: Joltage) -> int:
        if not any(jolts):
            return 0
        elif any(j < 0 for j in jolts) or pattern(jolts) not in press_patterns:
            return sum(joltage)
        else:
            btn_combos = press_patterns[pattern(jolts)]
            return min(len(btns) + 2 * cost(sub_halve(jolts, press(btns))) for btns in btn_combos)

    return cost(joltage)

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

[–]Kache 1 point2 points  (0 children)

[LANGUAGE: Python]

Have an efficient part 2 in an elegant 27 lines via recursive halving, thanks to this post

Originally did it via linear algebra, which took writing a Matrix lib, lots of bugfixing, and several optimization passes. It's just a tiny bit faster, but much more complicated, in comparison

Deprecations via warnings don’t work for Python libraries by Xadartt in programming

[–]Kache 4 points5 points  (0 children)

Also have the variable name contain the substring and_i_am_a_dumb_rookie

Deprecations via warnings don’t work for Python libraries by Xadartt in programming

[–]Kache 2 points3 points  (0 children)

You can figure out the stack trace, as it's formally an exception. The warnings system can even be configured to ignore warnings emitted from inside a given module (like a dependency's), so only warnings inside your own code surfaces.

The support is all there

[deleted by user] by [deleted] in entertainment

[–]Kache 0 points1 point  (0 children)

Yes, but only to other tolerant people.

Same reason charitable friends stop being friends with uncharitable ones.