HNHacker News
TopNewBestAskShowJobs

ben509

4,046 karma · joined December 7, 2017

I'm an engineer presently working for Capital One Investing, prior work at AWS for the CloudHSM team, before that Novetta, and before that I did 6 years in the army.

I'm also working on the Tenet language; see https://tenet-lang.org/

Also at https://keybase.io/ben509

YdRK9Q3mIBRWsRBonHhJCsgLnurwJk9eHbw1Jg4wz9M

submissionscomments
ben509··on Golang: Know Your 'Nil'
> Writing to and reading from a nil channel blocks forever.

Have any experienced Go devs found cases where this behavior is useful?

ben509··on Gallup: U.S. church membership dips below 50% for first time
I discount Turing's works because of his suicide. I think the Turing award ought to be renamed.

Consider all the love and respect directed at Robin Williams after he died. The perverse reality is that for someone in a suicidal frame of mind, that kind of love makes "I'd be better off dead" far more credible.

I think the other extreme, outright condemning someone, probably doesn't work either, as it's liable to make a person with suicidal feelings feel trapped.

So I settle for disapproval, that suicide is a permanent stain on someone's legacy, in the hope that it nudges someone to stick it out for another day.

ben509··on Hello, HPy
My source is simply running `cython -a` to see all the highlighted lines, and fixing them and observing how many hoops I have to jump through to get code that doesn't interact with the interpreter.

Cython makes you do more work to avoid the interpreter. C makes you do more work to involve the interpreter.

> There has been a lot of work over the years to make sure of that.

Some cython code can compile close to the C code you'd write.

But that's not how it's likely to be used, because the design pushes you in the opposite direction by default, and the value of Cython is that it's far faster than vanilla Python, and the painless interop.

ben509··on Hello, HPy
It still is, and Cython is great for accelerating critical Python code.

A C extension is far preferable when you want to code in C, either to write a new data type[1], or write a Python frontend to a C library[2] that is too complex to be well supported by simple FFI.

I think people use Cython more internally when they value the maintainability of "mostly Python" over the fact that it's slower than what native C would get them.

[1]: https://github.com/tobgu/pyrsistent

[2]: https://github.com/libgit2/pygit2

ben509··on USB 3.0* Radio Frequency Interference on 2.4 GHz Devices (2012)
It's going to be a PITA when USB 832.1 comes out and we need a light-year of lead to deal with neutrino interference.
ben509··on How to implement a hash table in C
You're looking for something similar to Python's namedtuple.[1] (Though modern python should use a dataclasses in the stdlib or the attrs package.)

Essentially, you have an array/list/vector under the hood, and a mapping of field names to array indices to govern field access.

If you're trying to implement this at a lower level, in the interpreted language itself, take a look at the slots mechanism[2] in Python.

[1]: https://docs.python.org/3/library/collections.html#collectio...

[2]: https://docs.python.org/3/reference/datamodel.html#object.__...

ben509··on Is that ship still stuck?
You're swapping moving a mostly hollow ship with containers for moving a far larger volume of solid earth.
ben509··on All my servers have an 8 GB empty file on disk
One argument in favor of it is the 8GB file may cause a runaway process to crash, leaving you without it continuing to chew up space and able to recover.

A second argument is it's not opened by any process. One problem I've had fixing disk full errors was figuring out which process still had a file open.

(For any POSIX noobs: the space occupied by a file is controlled by its inode. Deleting a file "unlinks" the inode from the directory, but an open filehandle counts as a link to that inode. Until all links to the inode are deleted, the OS won't release the space occupied by the file. Particularly with log files, you need to kill any processes that have it open to actually reclaim the disk space.)

ben509··on Phones and apps reduce your ability to focus even when they don’t distract you
> Personally I would trust readers to click on the article...

This is already contrary to all available evidence.

ben509··on SQLite is not a toy database
> There is a popular opinion among developers that SQLite is not suitable for the web, because it doesn’t support concurrent access.

No, the issue is it doesn't have high availability features: failover, snapshots, concurrent backups, etc. (Edit: oops, comment pointed out it does have concurrent backups.)

SQLite isn't a toy DBMS, it's an extremely capable embedded DBMS. An embedded DBMS is geared towards serving a single purpose-built client, which is great for a desktop application that wants a reliable way to store user data.

Once you have multiple clients being developed and running concurrently, and you have production data (customer accounts that are effectively legal documents that must be preserved at all times) you want that DBMS to be an independent component. It's not principally about the concurrent performance, rather it's the administrative tasks.

That requires a level of configuration and control that is contrary to the mission of SQLite to be embedded. They don't, and shouldn't, add that kind of functionality.

ben509··on Flatpak – a security nightmare – 2 years later (2020)
So why do they bother adding new features to Windows?

I'll answer my question: Companies make decisions on the margin. They don't care that they have 85% of the market. They want that next percentage point.

The users who might switch to or from competitors are precisely the "swing voters" they have to consider.

ben509··on Free Software: An idea whose time has passed?
> In the GPLv3 (and it was there in GPLv2 and v1) clauses 15 and 16 are the Disclaimer of Warranty and the Limitation of Liability. To be fair, proprietary software licenses have the same clauses, but the free-softers cannot claim the moral high ground here. These licenses assert that if the software causes any harm, the people who wrote it aren’t liable (limitation of liability).

This is an inane argument. Limiting your liability isn't some kind of moral evil. The potential for harm due to defects always exists, and if you provide a good or service to someone, you have to negotiate with that person who will accept the liability for it.

Generic software licenses limit liability because it's usually much cheaper for the end user to assume the liability as they have far greater knowledge of their practical risks.

A developer can absolutely make an agreement in which he takes on the liability. He's going to need to be paid to take that liability on, to both spend the time to eliminate defects, but also to purchase insurance so that he isn't bankrupted when a defect inevitably gets through and causes harm.

ben509··on The solution of the Zodiac killer’s 340-character cipher
One way to explain OTPs is a proof by induction.

The base step:

Start with one bit. The key is also a bit chosen at random, and the cipher text is plain XOR key.

You can then work out that no matter what key is chosen, you have no reason to believe 0 or 1 is the original plain text.

The inductive step is simply to add a new random bit of key that is independent from the prior key, and a new bit of plaintext.

What I like about this explanation is that you can actually work out the decision trees for a few bits to convince yourself that the encryption still holds.

ben509··on My Python testing style guide (2017)
You could call it aesthetics, but it's also readability, and that's an important aspect of tests.
ben509··on My Python testing style guide (2017)
I like the concept, but using the profiler to grab locally declared tests is a bit more magic than I'm comfortable with in my tests.

Something like this might be a good compromise:

    def describe_my_function(register):
        @register
        def with_this_thing():
            ...
I think most Python devs understand that "register" can have a side-effect.
ben509··on My Python testing style guide (2017)
My only issue is that the rule doesn't give you a good way to annotate that the object is documented by its signature. Sometimes devs are lazy, but the rule doesn't make them not lazy so you get pointless docs like:

    def matriculate_flange(via: Worble):
        "Matriculates flange via a Worble."
ben509··on Matrix multiplication inches closer to mythic goal
> Second of all, algorithms aren't patentable.

Algorithms absolutely are patentable because they are computing "machines." It's mathematical equations that aren't patentable, because they're closer to laws of nature.

ben509··on Flatpak – a security nightmare – 2 years later (2020)
If you define "care" as in, "random updates cause enough instability that they make alternate OS's favorable for accomplishing the same tasks," I'd cite Windows autoupdate as fairly hard evidence that people don't care.

I imagine MS has crunched the numbers at some point, and decided that the amount of lost work and interruptions due to forcible updates (especially contrasted with the benefits of updates) is not causing a significant number of people to ditch their OS for a competitor.

ben509··on Sensible macOS Defaults
I've only ever noticed "natural" scrolling was wrong when it became an option on desktop machines.

It makes perfect sense when I'm on a phone that I'm grabbing the content, since I'm reaching out and literally touching the content.

But on a desktop, I have a cursor. Obviously if I want to point at something below where my cursor is, I move it down. And if it's off the window, I need to scroll down further.

ben509··on GitHub, fuck your name change
I think when individuals or even companies roll over, it's because the mob's attack can be quite scary. It's easy to point at the people who stay their ground and say, "see, they didn't cave and did just fine."

But that's an obervation we make in hindsight, and without knowing it was like for the targets. At the time, their phone is probably ringing off the hook, media are calling, etc., and they have no idea when the attack will end or if people are getting fired, advertisers withdrawing or any of that.

I'll applaud anyone, left, right or other-vectored, who stands up to mobs, though. I'm not a fan of the phrase "cancel culture," but it gets one thing right: it is a cultural development, both the culture of outrage and the culture of appeasing the mob. The injustice of a, outraged mob declaring itself judge, jury and executioner only works if targets try to appease them. So while the culture of outrage is a hard problem because it's diffuse, anyone who refuses to accept that injustice is has an outsized effect in pushing back against the appeasement side of it.

ben509··on GitHub, fuck your name change
> What policies are being passed that are helping materially black people?

Mostly nothing. Corporations can largely only avoid harming various groups, and engaging in fair business practices. They're not set up, by their incentive structure, to do work that reforms society at large.

Even non-profits need to focus on a specific mission, and they're usually most successful by putting people in touch with each other.

Because, especially if you look at it through the lens of "material" help, the further an action is from the control of the individual being helped, the amount of good that can be done per unit effort drops off dramatically.

We normally view individualism as a normative claim, that "the rugged individual" ought to help himself. But you can cast it as an observation: most help in your life is only effective (again, in terms of return for the effort involved) if it comes from you personally or someone quite close to you.

ben509··on Why in the world would you own bonds?
Or else you and other bondholders take away their credit card.
ben509··on Why are tar.xz files 15x smaller when using Python's tar compared to macOS tar?
It's a joke. Lossy compression can only work with specific formats where information loss is acceptable, theoretically anything but in practice usually audio and video.

If gzip tried to do lossy compression, not knowing what the data is, it would have to randomly corrupt data.

ben509··on Why asynchronous Rust doesn't work
Fundamentally, the sync wrapper has to ask the event loop to wait for the async function to complete.

Assuming it's possible, one way is to create a new event loop in a thread. This means you're creating and tearing down threads for a "trivial" wrapper. And, really, because threads are expensive, you'd probably want to let the caller provide an event loop.

Really, you wind up asking the caller to tell you what event loop to use. Let's compare real async vs. the sync wrapper function:

    async func main() {
        await middle()
    }
    async func middle() {
        await libraryFunc()
    }

    # Using the sync wrapper without hiding the loop.

    func main() {
        loop = getLoop()
        middle(loop)
    }
    func middle(loop) {
        libraryFuncWrapper(loop)
    }
You wind up "coloring" your functions through a parameter instead of by marking them "async".

Perhaps your async implementation lets you use a globally defined event loop, but, really, globals are just backdoor parameters.

None of that means that such a wrapper is never going to be a good solution. Grabbing the global event loop probably works for many use cases. It's just that it doesn't avoid the coloring problem, it only hides it.

ben509··on Staying Out of TTL Hell
If the requestor only knows the filename, now you have to cache the filename to hash lookup.

Then you've just moved the invalidation problem around.

This is a great strategy if the object is controlled by a build process, so your client code already knows what the hash is.

ben509··on Why asynchronous Rust doesn't work
It's a problem in that you can't arbitrarily compose synchronous and asynchronous functions.

Many languages have a distinction between statements and expressions, and some language designers thought that was ugly and designed languages where everything is an expression.

But because of how people think, an application typically has a rough hierarchy to it by the designer's intent. So the fact that this becomes a bit more explicit because a language marks statements or async functions as having a specific place in that hierarchy isn't generally a bad thing.

ben509··on Write libraries instead of services, where possible
Notably, the FSF recommends against[1] modifying the GPL. And, you'd want to hire a lawyer to go over whatever scheme you're thinking of.

It's easier to draft a separate license agreement if you're the sole copyright holder.

If you're not the sole rights holder, if your project contains other GPL code, you'll need permission from the authors to license under terms other than the GPL. That would include patches from other authors, unless they sign the rights over to you.

[1]: https://www.gnu.org/licenses/gpl-faq.html#ModifyGPL

ben509··on Algorithms don't cause filter bubbles, people do
Likewise. What's dismaying is that there's no practical way on Facebook to have civil discussions about politics, it just doesn't work.

I don't think it'd even be all that hard. What you'd want to do is have a mode for contentious topics whereby personal identities are hidden, so there's no personal investment and only ideas are presented.

And you'd want to be able to cite problems with a claim, i.e. you select some text to flag "this is confusing / inflammatory / unsupported," so that people don't go in circles because they don't understand each other or can deal with something that's insulting by having the person tone it down.

ben509··on Algorithms don't cause filter bubbles, people do
The "people do" half of the headline isn't really addressed in the article, but it links to a piece[1] that proposes a mechanism.

[1]: https://slatestarcodex.com/2014/12/17/the-toxoplasma-of-rage...

ben509··on Google HR 'suggested medical leave' for racism victims
But then you're essentially defining racism as "anything that gets you in trouble."

It's perfectly reasonable to adjust coming anywhere close to discussing race as a strategy to avoid getting fired, but it's insane to redefine racism based on that.

We're doing that, and it results in a constantly expanding definition of racism, to where there are now "microaggressions."

Keep in mind, if you're white, you don't care: as you suggested, you just avoid talking about certain topics and carry on.

If you're a minority group, all these white people are, against their own apparent interests, agreeing that there's pervasive racism everywhere. The minority person has to live believing that all this is true.

We ought to have empathy and get this right so we don't contribute to a pervasive falsehood that makes people's lives seem worse than they really are. What's no big deal for us can be a ton of stress for others.

← PreviousPage 3 of 34Next →