HNHacker News
TopNewBestAskShowJobs

wging

2,299 karma · joined February 15, 2011

submissionscomments
wging··on Euclid's Proof that √2 is Irrational
It's an interesting exercise to find the right generalization of this proof to sqrt(n) for arbitrary numbers n that are not perfect squares, and for kth roots for m >= 2. I.e. prove that if kth_rt(n) is rational, then n is a perfect kth power (or equivalently, that if n is not a perfect kth power, then kth_rt(n) is irrational).

(I'm talking about adapting the ideas of this divisibility-based proof. abstractbill's post https://news.ycombinator.com/item?id=41314547 about Conway's method, https://www.youtube.com/watch?v=wNOtOPjaLZs, is a completely different (and very cool) way to do this that I hadn't seen before today.)

wging··on Galois Theory
The quote is followed immediately by this: "It extends naturally to equations with coefficients *in any field*, but this will not be considered in the simple examples below." Emphasis on 'in any field' is mine. Among the other fields that can be considered include the Galois fields, which are another name for finite fields. (There are also infinite fields other than the rationals, so 'in any field' does not just mean Galois fields/finite fields.) https://en.wikipedia.org/wiki/Finite_field

Galois fields have nothing to do with being able to represent rational numbers in a computer: elements of a finite field aren't even rational numbers.

wging··on Galois Theory
Do you know how Dieudonné answered?
wging··on CockroachDB license change
Really does appear to be memory-holed, rather than just having moved. Not a good look. https://www.google.com/search?q=site%3Acockroachlabs.com+"Co...."
wging··on Zero regrets: Firefox power user kept 7,500 tabs open for two years
Firefox has a decent task manager view that I use to identify rogue tabs like that. Shift+Esc -> sort tabs by CPU usage (it lives at the URL about:processes and can be found under 'More tools' -> 'Task manager' too). I imagine that's how you discovered it was LinkedIn? Though if you're not a tab hoarder it might be fairly easy to discover just by trial and error...
wging··on Common I/O Tasks in Modern Java
It's been a while for me too, but I think I recall common advice to use java.net.URI instead of java.net.URL wherever possible, at least partly for that reason. Also, the javadocs of URL now state: "The java.net.URL constructors are deprecated. Developers are encouraged to use java.net.URI to parse or construct a URL."
wging··on Jiff: Datetime library for Rust
That isn't an implementation of addition between Spans and other Spans. It looks like there isn't one in the library right now. `impl<'a> Add<Span> for &'a Zoned` means a borrow of Zoned is on the left hand side, and a Span on the right. So it says that if z is a Zoned (not a Span) and s is a Span, you can do `&z + s` to add a span to a Zoned. There are a bunch of implementations there, DateTime + Span, Date + Span, Time + Span, Offset + Span. All with Span on the right, but none for Span + Span (nor Span + &Span, or &Span + &Span, ...).
wging··on Pitfalls of comparing BigDecimals in Java
https://docs.oracle.com/en/java/javase/21/docs/api/java.base... is probably a better link (though it's not that different)
wging··on Pitfalls of comparing BigDecimals in Java
You could also think of it as declining to _lose_ a decimal place; a.add(b) ought to be the same as b.add(a), so there's no reason to prefer a's precision to b. You need to take the higher precision of the two for an exact result; I assume that's the rationale.

> The BigDecimal class gives its user complete control over rounding behavior. If no rounding mode is specified and the exact result cannot be represented, an exception is thrown ...

- https://docs.oracle.com/javase/8/docs/api/java/math/BigDecim...

wging··on Pitfalls of comparing BigDecimals in Java
Maybe GP was thinking of the optional rounding modes? With plain old add(), you get a BigDecimal 0.05 with scale 2 in both cases and the two examples are equal according to the equals() method.

    var a = new BigDecimal("0.0");
    var b = new BigDecimal("0.05");
    var result1 = a.add(b);

    var c = new BigDecimal("0.00");
    var result2 = c.add(b);
    System.out.println(result1); // 0.05
    System.out.println(result2); // 0.05
    System.out.println(result1.equals(result2)); // true
    System.out.println(result1.scale()); // 2
    System.out.println(result2.scale()); // 2
wging··on Understanding a Python Closure Oddity
Fun(?) fact: it's not technically true that const can't be used in for loops:

    for (const i = 0; i > 0; ) {
        console.log('this is stupid');
    }

    let ran = false;
    for (const i = 0; !ran; ran = true) {
        console.log('this is also stupid');
    }
wging··on Understanding a Python Closure Oddity
'var' is JavaScript's older variable declaration construct. Variables created this way are live from the beginning of the function that contains them (or globally if there isn't one). So a block with braces (such as you'd use for a for or while loop body) doesn't actually restrict the scope of var `v` below:

    console.log(v); // <-- v is a variable here, we can access its value even though it is only declared below
    // prints 'undefined'
    {
        var v = 1;
        console.log(v); // prints 1
    }
    console.log(v); // prints 1
You used to (and might still) see a workaround to recover more restrictive scoping, known as the "IIFE" (Immediately Evaluated Function Expression): (function () { var v; ... code using v here ... })() creates a function (and thus a more restrictive scope for v to live in) and evaluates it once; this is a sort of poor man's block scoping.

`let` and `const` were created to fill this gap. They have block scope and are special-cased in for loops (well, `let` is; you can't reassign to a `const` variable so nontrivial for loops won't work):

    console.log(l); // <-- throws ReferenceError: l is not defined
    {
        // pretend the console.log line above is commented out, so we can reach this line
        let l = 1;
        console.log(l); // prints 1, as expected
    }
    console.log(l); // throws ReferenceError: l is not defined
    // ^^ l was only in scope for the block above

    
The interaction with `for` is explained well on MDN, including the special casing: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

"More precisely, let declarations are special-cased by for loops..." (followed by a more detailed explanation of why)

See also https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

wging··on Why Triplebyte Failed
It's not covered extensively in the article, but it was alluded to at one point via the phrase "pissed them off with anti-privacy decisions". (In context, 'them' refers to the engineering side of Triplebyte's user base.)
wging··on Google won’t comment on a leak of its search algorithm documentation
Right, what I meant is that if Google used Elixir internally they'd likely also provide an officially supported Elixir client.
wging··on Make your program slower with threads (2014)
The world seems full of APIs that make it easy to avoid global state. Most of my usage of randomness has been through things like rust's rand::thread_rng or Java's ThreadLocalRandom. (In fact I think even java.util.Random uses its own state: the docs call out perf issues but only if you share the same instance across threads.)

Honorable (?) mention goes to (client-side) JavaScript - it's harder to have threading issues if you only have a single thread to work with!

wging··on Not Just Scale
That's a distributed system in the sense he's referring to.
wging··on Zig's new CLI progress bar explained
The vertical scrolling has the advantage that when you are watching a build go, and you see a certain step's taking a long time, it doesn't ever disappear from the terminal completely. You don't need to look through dependencies some other way and figure out which matches the thing you saw, or do a clean build to see the bottleneck again, etc.
wging··on Please support "skip to main content" on your docs site
My impression is that there are (possibly underenforced) US laws that mandate a certain amount of accessibility - the ADA and possibly others. (I'm 100% not a lawyer, this is not legal advice.)

At a previous job, that was the justification for a mandate to make sure our website and mobile app was accessible prior to its general availability. (It's also the right thing, as we knew, but the existence of a legal requirement tends to give doing the right thing a lot more priority in a team's backlog. So there's at least one case of the law working as designed.)

See also https://en.wikipedia.org/wiki/Americans_with_Disabilities_Ac... -- the experience I'm talking about was prior to the mentioned 9th Circuit ruling or the Supreme Court's 2019 declining of the appeal, but the laws were on the books already. I don't remember exactly whether the Target case is what was mentioned as a motivating factor to us, but it might have been: <https://en.wikipedia.org/wiki/National_Federation_of_the_Bli...>

(I say 'possibly underenforced' because I don't really know enough about the accessibility landscape, but I somehow doubt that every customer unlawfully prevented from accessing services that the ADA covers actually sues...)

wging··on Don't DRY Your Code Prematurely
You're thinking of Sandi Metz: https://sandimetz.com/blog/2016/1/20/the-wrong-abstraction
wging··on Google won’t comment on a leak of its search algorithm documentation
I don't think this leak shows that they use Elixir. It's open-source code that Google customers are supposed to be able to use to interact with Google APIs. It's natural to provide support for your customers to use the languages they want to use, rather than the ones you've settled on internally; this is important for anyone, let alone restrictive internal environments like Google's is supposed to be. (https://aws.amazon.com/sdk-for-php/ exists, but Amazon famously doesn't allow services to be developed in PHP.) Google is famous for allowing only a few languages for production code.

The README also says:

> Disclaimer

> This is not an officially supported Google product.

which, while it doesn't directly indicate that Elixir isn't used internally to Google, would be a surprising mismatch of support if they did use Elixir. Here are their official clients (including some in languages that I doubt they want to be used internally for service development, like PHP, Node.js, and .NET): https://developers.google.com/api-client-library

wging··on Feynman's Garden
Agreed. “Do the simplest thing that could possibly work” has sometimes been good advice for me, even if that simple thing is unsuitable at scale, not production-ready, etc. There are problems for which that solution is a stone’s throw from an optimal one. And if not, seeing the downsides of that naive solution can still point the way to what needs to be done in the ‘real’ solution.
wging··on Tmux is worse-is-better
The way I typically handle that is via native terminal-app tabbing. Tab 1: local tmux session, tab 2: remote tmux session. (My normal workflow doesn't go beyond 2 systems, 3 in an edge case.) You don't need much support from the terminal to do it this way; it works in gnome-terminal on Linux and iTerm2 on Mac, and probably also macOS's built-in native terminal. You just need an app-level shortcut to go forward/back between tabs, then tmux's shortcuts for navigation within the system.

(I don't use iTerm2's native tmux integration, so any poor interactions with that when I'm on Mac aren't a concern, and when I'm on Linux gnome-terminal has just as much utility for me.)

wging··on So We've Got a Memory Leak
Perhaps now, but the story is about Yahoo, which means it could be from the early 2000s or late 90s. Traffic volumes were probably lower, computers were definitely slower, internet advertising was not as big as it is now, etc.
wging··on Ask HN: What is the most useless project you have worked on?
I’ve used a Kindle since 2012 and I don’t think I have ever seen that kind of dictionary issue. On my Kindle, even though text highlighting behaves as you describe, dictionary lookups still work because punctuation is stripped before searching. For example I just highlighted “doing,” (including the comma) and the dictionary shows the definition of the word “doing”. I wonder if it works differently for languages other than English. (There is a different problem, that the stemming/trimming can be too aggressive and gets you irrelevant words in searches — i.e. ‘several’ when you search ‘severance’.)
wging··on The Quintic, the Icosahedron, and Elliptic Curves [pdf]
The actual argument is a bit simpler than implied by the quote's use of the terms 'monodromy', 'solvable subgroup', etc. Here's an explanation of Arnold's proof that doesn't use those words at all, and while not precisely easy is much easier than you'd think from the quoted bit of the OP article: https://web.williams.edu/Mathematics/lg5/394/ArnoldQuintic.p...
wging··on Edgar, build a Dyson swarm
If anyone is wondering, you can turn off combat if you want to experience the same low-stress building experience. I think I'd recommend that for a new player, there's a lot to figure out and enjoy even without gradually increasing threat levels from the dark fog. I enjoyed the new defense mechanics but the first couple run-throughs without them was also great. Just a different experience.
wging··on Google ordered to identify who watched certain YouTube videos
The comment in question appears in incognito mode. I don't think they're banned.
wging··on Dead Air on the Incident Call
Not all of them. This problem isn’t an artifact of remote work or even geographically distributed teams. You might just call someone from your desk and comfortable setup, instead of walking up a flight of stairs.

Or you might be in a different building, in a different city, or different country halfway across the world.

Or it might just be 4 AM for everyone, and there might be no time to go into the office, even if you all normally sit together.

All of these are real things I’ve seen and not hypothetical in the least.

wging··on Let futures be futures
It's Go. The description fits well, and it's pretty much confirmed by the Rob Pike quote in the sidebar. https://www.youtube.com/watch?v=uwajp0g-bY4
wging··on Breaking Free from DRM: Hacking My Air Purifier
“DRM” means “digital rights management” in this context; it has little to do with the choice of AC or DC power. What acronym did you interpret it as?
← PreviousPage 5 of 25Next →