HNHacker News
TopNewBestAskShowJobs

OskarS

8,399 karma · joined September 4, 2016

submissionscomments
OskarS··on Show HN: Just F-Ing Ping
Seems like an excellent use case for trurl [1], a tool built on curls url parsing functions (which can presumably handle any weird url format you throw at it), though I'm not sure how well packaged/available it is.

[1]: https://github.com/curl/trurl

OskarS··on Optimizing the unoptimizable: a journey to faster C++ compile times
What's the incremental compile time? If you just change that "Hello World" string to something else, does it compiler faster the second time?
OskarS··on Using Git Offline
Another cool thing that I believe git does in these situations is that it hard-links the blobs in the .git folder if you do a local clone. It makes sense: the blobs are immutable and content-addressed, no need to store two copies! Just have two links to the same file system object, save a bunch of disk space.
OskarS··on Optimizing the unoptimizable: a journey to faster C++ compile times
Not to be "that guy", but... one second is a VERY VERY long time to compile a hello world program.
OskarS··on AI Is Already Killing Books
That's a fair point, children's literature (a wonderful and valuable genre) will certainly be under threat. I would probably suggest that nothing an LLM would come up would stay with a person for decades like (say) Were The Wild Things Are. I'm Swedish, so I grew up on Astrid Lindgren, and some of those books move me to this day when I think back on them. I imagine many Americans still find Dr. Seuss hilarious in the same way.

> We are also reading Little House on the Prairie which I consider a little more “high brow”, and the girls really like that, too. But kids are easy to please and it has been interesting.

Yeah, that's kind of my point :) do you think an AI could write Little House on the Prairie? I don't. Sooner or later the vapid and nonsensical plots from LLMs stop being that amusing, and you need to feel real human connections to the things you're reading. That's the reason you read books, after all.

OskarS··on AI Is Already Killing Books
Yeah, not too worried. AI might kill the "self-published Amazon eBook market of garbage genre novels", but honestly there's very little value there. The suggestion that an LLM could write a Hilary Mantel novel, or a Robert Caro biography, is so far beyond ludicrous that it's not even worth arguing.

I don't know who these people are that are reading books so bad that an LLM could plausibly replicate the work, but if that market is killed by a swarm of AI-written nonsense, honestly: who cares?

> Now that AI books exist, the probability that I will ever blind purchase another eBook on Amazon from an unknown author drops to zero.

This is a thing people do? Like... before AI? Not even reading extract or anything? You just see a cover and a title and go like "sure, I'll spend my hard-earned cash to make a 30 hour investment in this thing I know nothing about"?

The best version of this argument you can make is that it's about the treadmill: great writers aren't born great writers, they have to write a lot of crap first to become great writers, and this market is how you do that. Take that away, you don't get any more great writers. But I don't particularly buy that either: there are very few writers I love that were able to successfully make a living selling self-published Amazon eBook garbage until they got good enough to actually be picked up by a publisher.

Journalism, however, is a different story: plenty of great writers (fiction or non-fiction) got their starts as journalists and honed their craft writing small pieces there, and that is a market that is under total threat from AI. That's maybe a cause for concern. But I don't think it's an existential threat to literature as an art form. I don't think that's ever going to go away.

OskarS··on The X220 ThinkPad is the best laptop
Not to mention the best touchpad in existence.

One of my friends loathes everything Apple does (on principle, basically) and has tried several times to convince me that the ThinkPad X-series is just as good (or better) than an M-series MacBook Pro. Testing it out for a bit, there’s just no comparison. Even leaving the software aside, the hardware is just leaps and bounds better from Apple.

OskarS··on Coastline paradox
I’ve always found this argument very cool (and obviously true in a mathematical sense) but not really ”practically” relevant. Like, the only reason you would be interested to know the length of a coastline is because you want to know how far a ship would need to travel, and that is pretty well-defined. Or, like, if you wanted to do a naval blockade, you would need to know how many ships you’d need to cover the entire coast, given that a single ship can only cover so much.

Still a cool argument though.

OskarS··on Dear ImGui: Graphical User Interface library for C++
You really think so? This is really my biggest issue with Dear ImGui, I think it just looks awful. The design is just not great, and stuff like text rendering has been terrible in every Dear ImGui UI I've seen. Especially on macOS, the native applications there really make ImGui stuff look pretty crappy. Electron apps also generally speaking just look way better, IMHO (Electron has other issues obviously, but the ones I use regularly look pretty good). Like, imagine VSCode or something with the graphical style of the screenshots on the GitHub page.

Maybe you can customize it and make it look great, but the "out of the box" experience is just... oof.

OskarS··on Open source rules engine for Magic: The Gathering
Yeah, obviously a creature with Haste or Trample or whatever is very easy to make a simple parser for. But I can imagine because WotC is so strict on how they word text on cards, even more advanced interactions would be pretty straight-forward to parse. Like, if a card says:

"When <card name> enters the battlefield, return target non-land card from your graveyard to your hand".

Both parts of that sentence is always worded the same, so it's probably quite straight-forward to make a parser for this: just have a parse rule for "When <card name> enters the battlefield, <triggered ability X>", with a database of triggered abilities (and their implementation) that include all the ones that have already been printed.

OskarS··on Causal Trees
I've always wondered if it's a good trick for horizontal scaling as well. Like, if you have one server serving 1,000,000 clients, using a CRDT you could trivially split that up into 10 servers serving 100,000 clients each, and then have the ten servers be peers to each other.
OskarS··on Causal Trees
Conflict-free Replicated Data Types. It's essentially a way to make Google Docs-style products which are resilient in the face of disconnects and reconnects and slow syncing. Think of it like Git, but all merge conflicts are resolved automatically and deterministically.
OskarS··on Add dark mode to your website with a single line of code
Not a web dev, but I saw this on a stream at some point and found it delightful. Surprisingly effective!

    html { filter: invert(100%); }
OskarS··on Storing data in pointers
C++'s std::string does some version of this as well (at least on all major standard libraries), it's known as the "small string optimization".
OskarS··on Need a PRNG? Use a CSPRNG
The author is a bit too categorical, there are certainly use-cases where both speed and code-size matters a great deal. Others have mentioned Monte Carlo algorithms, but there are others: not very long ago I was doing an effect in a shader that needed a PRNG, it would have been lunacy to use a CSPRNG. High quality statistical properties are not important at all, but speed and instruction size is VERY important. My hunch is that this is often true in game-dev: Minecraft probably should not use a CSPRNG to generate its random world.

However, in general, I basically agree: for MOST tasks where you need a random number generator, a CSPRNG is probably the right choice and it's a reasonable "default" choice if you don't have good reasons why it shouldn't be. It's a continual annoyance to me that PRNG libraries usually don't include any solid CSPRNGs (looking at you, C++ header <random>) when it's often the right choice.

OskarS··on Need a PRNG? Use a CSPRNG
> Reproducibility

That's a very silly objection: CSPRNGs can be seeded just like a PRNG. The "P" in both abbreviations is the key, it stands for "pseudo".

OskarS··on Why did base64 win against uuencode?
And slashes as well, which is a magic character in both urls and file systems. Means you can't reliably use normal base64 for filenames, for instance. That might seem like a niche use-case, but it's really not, because you can use it for content-based addressing. Git does this, names all the blobs in the .git folder after their hash, but you can't encode the hash with regular base64.
OskarS··on Setenv Is Not Thread Safe and C Doesn't Want to Fix It
That doesn't fix the problem: these languages has to be able to coexist peacefully with C in the same address space. You can have a dynamically linked library written in Rust in a host program written in C, you can use C libraries in Go, etc.

Even if that wasn't an issue: this is a bug in C as well! You should absolutely be able to use setenv/getenv safely in multi-threaded C, it's insanity that you can't.

OskarS··on The Changing "Guarantees" Given by Python's Global Interpreter Lock
I'm guessing interleaving is probably not possible because the `extend` call is passed the full list, and it holds the GIL until it's finished. But you'd have to look at the bytecode to be sure, I suppose. If there were three append calls instead of a single extend, I would assume any interleaving would be valid.

> or if the GIL is removed does the interpreter segfault (I'm pretty sure this latter will not be the case for GIL removal but I don't understand the gil remove plan very much yet).

I haven't looked into the plan in detail either, but presumably not, that would be nuts. My understanding is that they're going to replace the GIL with locks on the objects themselves (your list `l` in this case). This is why in all the tests single-threaded performance suffer, you have to take and release more locks if you don't have a GIL, and the objects themselves grow larger as well.

OskarS··on Unity announces layoffs despite increased revenue and reduced losses
According to the article, they have half a billion dollars in revenue (with currently $154 millon in losses), and that seems plenty to run a company like Unity. Lay-offs are rough, but looking at the numbers, they make sense in a cold-hearted capitalist sort-of way if the goal is to reach profitability. Certainly much more so than the runtime fee thing.
OskarS··on Maine's constitution has unprintable sections
"pretty clear" is an overstatement, I read it and I didn't understand it. I'm not a lawyer, but the article could have included... you know... your exact comment somewhere.
OskarS··on Tracking SQLite Database Changes in Git
Is there no capability in SQLite to dump these things as well? Seems like a pretty big thing missing if that's the case, a thing I would expect SQLite to support pretty well.
OskarS··on Windows 11 adds native support for RAR, 7-Zip, Tar and other archive formats
What? In my experience, RAR is extremely un-Linux. It's not free software and not command-line friendly, and it seems mostly to be used by piracy weirdoes who need to split up files for uploading to newsgroups.

If you're on Linux, you make .tar.gz or .tar.bz2 or something. Or .zip, I guess you see sometimes. But RAR? That's a windows people thing, in my experience.

OskarS··on Geist, a typeface specifically designed for developers and designers
If it's meant to be a monospace-for-coding font, they really should show off... you know... what code looks likes in it.
OskarS··on Voronoi Diagram and Delaunay Triangulation in O(nlog(n)) (2020)
Indeed: the convex hull is the outer boundary of the Delaunay triangulation. In addition: if you "bow out" the points into 3D, the 3D convex hull is exactly the Delaunay triangulation. These two concepts are very closely related.
OskarS··on Voronoi Diagram and Delaunay Triangulation in O(nlog(n)) (2020)
I wrote a moderately popular Delaunay/Voronoi library for Unity a few years back [1] with a neat little demo video [2]. I implemented the incremental Bowyer-Watson algorithm for generating the triangulations, and then took the dual to generate the Voronoi tesselation (I also added a "clipper" that clips the voronoi diagram to a convex outline, which was fun, I haven't seen that anywhere else before and had to figure out how to do it myself).

Bowyer-Watson (which is described in this article) seems very simple to implement when you start: just start with a "big triangle" and then add points iteratively to it, and perform the flips you need to do. To do it performant, you have to build up a tree structure as you go, but it's not very tricky.

However: almost every description (including on Wikipedia) and implementation of Bowyer-Watson I could find was wrong. There's an incredibly subtle and hard to deal with issue with the algorithm, which is the initial "big triangle". Most people who implement it (and indeed I did the same initally) just make the triangle big enough to contain all the points, but that's not enough: it needs to be big enough to contain all the points in all the circumcircles of the triangles. These circumcircles can get ENORMOUS: in the limit of three points on a line, it's an infinite half-plane. Even if they aren't literally collinear, just close, the triangle becomes way to huge to deal with.

The answer is that you have to put the points "at infinity", which is a very weird concept. Basically, you have to have special rules for these points when doing comparisons, it's really tricky and very hard to get right.

If I were doing this again, I wouldn't use Bowyer-Watson, this subtlety is too tricky and hard to get right. Fortune's sweep-line is more complex on the surface, but that's the one I would go with. Or the 3D convex hull technique (which I also wrote a library for, by the way [3]).

[1]: https://github.com/OskarSigvardsson/unity-delaunay

[2]: https://www.youtube.com/watch?v=f3T5jtsokz8

[3]: https://github.com/OskarSigvardsson/unity-quickhull

OskarS··on What if OpenDocument used SQLite? (2014)
Well, it doesn't error out! In this example, it seems like it picks the result from whatever matches the last column, but not sure if this is determinstic:

    sqlite> create table x(c1, c2);
    sqlite> insert into x values ("a", 1);
    sqlite> insert into x values ("b", 2);
    sqlite> insert into x values ("c", 3);
    sqlite> select c1, max(c2) from x;
    c|3
    sqlite> select c1, max(c2), min(c2) from x;
    a|3|1
    sqlite> select c1, min(c2), max(c2) from x;
    c|1|3
(note: since SQLite is dynamically typed, no need to specify column types for simple examples like this).
OskarS··on A clever “perpetual motion” device [video]
Tell that to the 16th century Catholic church...
OskarS··on In a Git repository, where do your files live?
Conceptually, though, that's the wrong model. Pijul works like that, but git does not: commits are not diffs, they are full snapshots of the repository, including history. If you cherry-pick a commit from one branch to another, that's an entire new commit, it's not just "this patch moved from one branch to another". If your idea of a commit is "it's a diff to the previous commit", you'll get into trouble.
OskarS··on The curl-wget Venn diagram
> I've never claimed it doesn't.

Yes you did:

> You must specify the offset from where it should continue

No, you mustn't, you can specify - and it does exactly what you want. The docs are very clear and even provide examples. At some point you should stop blaming curl for your inability to read a man page and admit that you were simply mistaken.

← PreviousPage 11 of 34Next →