Readit News logoReadit News
noctune commented on Why I stopped using JSON for my APIs   aloisdeniel.com/blog/bett... · Posted by u/barremian
morshu9001 · 13 days ago
Protos are great. Last time I did a small project in NodeJS, I set up a server that defines the entire API in a .proto and serves each endpoint as either proto or json, depending on the content header. Even if the clients want to use json, at least I can define the whole API in proto spec instead of something like Swagger.

So my question is, why didn't Google just provide that as a library? The setup wasn't hard but wasn't trivial either, and had several "wrong" ways to set up the proto side. They also bait most people with gRPC, which is its own separate annoying thing that requires HTTP/2, which even Google's own cloud products don't support well (e.g App Engine).

P.S. Text proto is also the best static config language. More readable than JSON, less error-prone than YAML, more structure than both.

noctune · 13 days ago
You might be interested in https://connectrpc.com/. It's basically what you describe, though it's not clear to me how well supported it is.
noctune commented on URLs are state containers   alfy.blog/2025/10/31/your... · Posted by u/thm
padolsey · a month ago
I agree, and this reminds me: I really wish there was better URL (and DNS) literacy amongst the mainstream 'digitally literate'. It would help reduce risk of phishing attacks, allow people to observe and control state meaningful to their experience (e.g. knowing what the '?t=_' does in youtube), trimming of personal info like tracking params (e.g. utm_) before sharing, understanding https/padlock doesn't mean trusted. Etc. Generally, even the most internet-savvy age group, are vastly ill-equipped.
noctune · a month ago
It doesn't help that URLs are badly designed. It's a mix of left- and rightmost significant notation, so the most significant part is in the middle of the URL and hard to spot for someone non-technical.

Really we should be going to com.ycombinator.news/item?id=45789474 instead.

noctune commented on An overengineered solution to `sort | uniq -c` with 25x throughput (hist)   github.com/noamteyssier/h... · Posted by u/noamteyssier
noctune · 2 months ago
I built something similarly a few years ago for `sort | uniq -d` using sketches. The downside is you need two passes, but still it's overall faster than sorting: https://github.com/mpdn/sketch-duplicates
noctune commented on GitOps Considered Harmful for MVP   knockdata.com/blog/gitops... · Posted by u/RockieYang
noctune · 3 months ago
I overall agree with the article; GitOps is great for managing long-lived, shared, stable systems you need a good audit trail for (like production), but testing isn't one of these. Test environments should ideally just be something non-shared you can just spin up and make changes to without asking for permission.
noctune commented on Download responsibly   blog.geofabrik.de/index.p... · Posted by u/marklit
alluro2 · 3 months ago
People like Geofabrik are why we can (sometimes) have nice things, and I'm very thankful for them.

Level of irresponsibility/cluelessness you can see from developers if you're hosting any kind of an API is astonishing, so downloads are not surprising at all...If someone, a couple of years back, told me things that I've now seen, I'd absolutely dismiss them as making stuff up and grossly exaggerating...

However, on the same token, it's sometimes really surprising how API developers rarely ever think in terms of multiples of things - it's very often just endpoints to do actions on single entities, even if nature of use-case is almost never on that level - so you have no other way than to send 700 requests to do "one action".

noctune · 3 months ago
I don't understand why features like S3's "downloader pays" isn't more widely used (and available outside AWS). Let the inefficient consumer bear their own cost.

Major downside is that this would exclude people without access to payment networks, but maybe you could still have a rate-limited free option.

noctune commented on One Token to rule them all – Obtaining Global Admin in every Entra ID tenant   dirkjanm.io/obtaining-glo... · Posted by u/colinprince
otabdeveloper4 · 3 months ago
You can add many layers of indirection, but unless you're actually authenticating that a system service is using the credentials (and not, say, a user or a script) then it boils down to a long-lived token at the end.
noctune · 3 months ago
You can condition IAM on Nitro attestation, so that's doable (if a lot more work than usual).
noctune commented on Fish 4.0: The Fish of Theseus   fishshell.com/blog/rustpo... · Posted by u/jdxcode
boris · a year ago
> Feature Detection Is Better than Version Detection

The problem with feature detection (normally referred to as configuration probing), at least the way it's done in ./configure and similar, is that it relies on compiling and potentially linking (and sometimes even running, which doesn't work when cross-compiling) of a test program and then assuming that if compilation/linking fails, then the feature is not available.

But the compilation/linking can fail for a myriad of other reasons: misconfigured toolchain, bug in test, etc. For example, there were a bunch of recent threads on this website where both GCC and Clang stopped accepting certain invalid C constructs which in turn broke a bunch of ./configure tests. And "broke" doesn't mean you get an error, it means your build now thinks the latest Fedora and Ubuntu all of a sudden don't have strlen().

noctune · a year ago
The XZ utils supply chain attack also used this to sneakily disable Linux Landlock: https://news.ycombinator.com/item?id=39874404
noctune commented on Universal optimality of Dijkstra via beyond-worst-case heaps   arxiv.org/abs/2311.11793... · Posted by u/foweltschmerz
vanderZwan · a year ago
> Our universal optimality result reveals a surprisingly clean interplay between this property and Dijkstra’s algorithm: Any heap with the working set property enables the algorithm to efficiently leverage every structural attribute of the graph it operates on, to the fullest extent that any comparison-based algorithm possibly can.

That last bit makes me wonder: what would a shortest path algorithm without comparisons look like? Are there also "radix sort" like approaches to shortest-path algorithms that surpass comparison-based algorithms or something?

noctune · a year ago
You can use a radix heap rather than a binary heap. I have an implementation here, with benchmarks using pathfinding: https://github.com/mpdn/radix-heap

It has the nice property that the amortized cost of pushing/popping an element is independent of the number of other elements in the heap.

noctune commented on S3 as a Git remote and LFS server   github.com/awslabs/git-re... · Posted by u/kbumsik
philsnow · a year ago
I'm surprised they just punt on concurrent updates [0] instead of locking with something like dynamodb, like terraform does.

[0] https://github.com/awslabs/git-remote-s3?tab=readme-ov-file#...

noctune · a year ago
S3 recently got conditional writes and you can use do locking entirely in S3 - I don't think they are using this though. Must be too recent an addition.
noctune commented on Async hazard: MMAP is blocking IO   huonw.github.io/blog/2024... · Posted by u/mmastrac
rbanffy · a year ago
Making it work asynchronously would require the compiler to split the memory access into two parts, a non-blocking IO dispatch and a blocking access to the mapped address. The OS would need to support that, however, and the language would need to keep track of what is a materialised array and what’s not.
noctune · a year ago
I think you could make by with some kind of async memory-touch system call, i.e. "page in this range of memory, notify me when finished". The application would have to call this on blocks of the mmap prior to actually reading it.

This of course means you lose some of the benefits of mmap (few system calls, automatic paging), but would maybe still be beneficial from a performance perspective.

u/noctune

KarmaCake day182January 8, 2020View Original