HNHacker News
TopNewBestAskShowJobs

OskarS

8,399 karma · joined September 4, 2016

submissionscomments
OskarS··on Implementing secure leaderboards for my game
In the context of that sentence though, it doesn’t make any sense. PCG is a PRNG, not a library for generating distributions. In fact, the PCG documentation uses the distributions from <random>: [1].

If people want to use PCG, that’s perfectly fine, it’s a great library. My point is, there’s nothing wrong with the PRNGs in <random>, they work great. Mersenne Twister is not state of the art anymore, but I guarantee you that unless you’re doing something truly insane, neither the throughput nor the statistical properties of MT is gonna be your bottleneck.

[1]: https://www.pcg-random.org/using-pcg-cpp.html

OskarS··on Implementing secure leaderboards for my game
Interesting article, but one point:

> Sadly, the C++11 <random> library is not portable, but the excellent PCG Random library is, so I used the latter.

Yes it is. std::random_device will not give you a deterministic sequence (obviously!), but the standard PRNGs absolutely will. Check, for instance, std::mt19937, which specifies exactly what the 10,000th value has to be [1].

That's not to say that you shouldn't go with PCG. PCG is a fantastic PRNG. But claiming that the <random> PRNGs are not portable is just FUD.

[1]: https://en.cppreference.com/w/cpp/numeric/random/mersenne_tw...

OskarS··on Better Operator Precedence
My point was that the second version is much easier to read, it’s a lot clearer.
OskarS··on Better Operator Precedence
For operators where it’s not obvious, sure, but are you really writing

    if (((2*x) + 3) == z) 
instead of

    if (2*x + 3 == z)
If so, that’s pretty annoying.
OskarS··on Goto (2007)
This is much more confusing to me than just using a goto. From your example, it's not immediately clear at all to me if you're breaking out of outer, or if you're breaking TO outer. You can figure it out with this simple example, but it's way more confusing than it needs to be. And importantly: way more confusing than just using goto.

Given that break and continue are just gussied up gotos anyway, just put the label where you wanna go and goto it. I think it's one of the few perfectly valid uses goto.

OskarS··on I couldn't debug the code because of my name
An enormously useful list, I’ve used it several times, and it can often dig up some real nastiness if you haven’t been super careful.

This entry, by the way, is a fantastic little easter egg in the list: https://github.com/minimaxir/big-list-of-naughty-strings/blo...

OskarS··on Taming the BPF Superpowers
At some point, you have to accept that on a technical site like this, there is going to be jargon used (including abbreviations) with furtjer explication of meaning. Would you complain about using DNS? Or HTTP?
OskarS··on Firefox now shows ads as sponsored address bar suggestions
Mozilla has to make money somehow. From reading the article, this seems like a reasonable way to do it.
OskarS··on A Git Implementation in Awk
I have really warm feelings about AWK, actually! It’s such a simple language that you can learn pretty much all of it in an afternoon, but it is still expressive enough to be really useful as a text processing language. I have an AWK script that turns my CSV bank statements into Ledger transactions, and AWK is just perfect for that kind of thing.
OskarS··on The naughty username checking system used by Twitch
Exactly what I think. This is the kind of code that doesn't have a platonic ideal, it has to get updated with time and experience and reports. There is no "non-hacky" way to do this, you just have to look at the reports that are coming in and keep adding rules that are relevant.
OskarS··on Facebook-owned sites were down
Honestly, from a PR perspective, I’m not sure it’s so bad. Giving honest updates showing Facebook hard at work is certainly better PR for our kind of crowd than whatever actual Facebook PR is doing.
OskarS··on Nobel Prize in Physiology or Medicine 2021
They've given it to organizations before (Doctors Without Borders won in 1999). Give it to Pfizer, Moderna and Oxford University then. Or "front line COVID-workers" or something. Exactly who gets it is not the main point, the main point is rewarding this incredible achievement in medicine (both the science of it, but also the work in testing, manufacturing and delivering it to patients).
OskarS··on Nobel Prize in Physiology or Medicine 2021
I don't think it's too early to say that the vaccines deserve it, given what they have already accomplished.
OskarS··on Nobel Prize in Physiology or Medicine 2021
The Peace Prize has it’s fair share of whoppers (Henry Kissinger!), but the science ones are usually not quite that clueless. This oversight though, this one is pretty baffling to me.
OskarS··on Nobel Prize in Physiology or Medicine 2021
Seems to me like maybe a more worthy recipient of this prize might be the vaccines that are currently saving hundreds of million of people from dying in the worst pandemic in a century? You know, the miracle vaccines that were developed many times faster than any other vaccine in history? The ones that (despite being perfectly safe, effective, and arguably the greatest achievement in medicine since antibiotics) are subject to an epidemic of skepticism, where a Nobel Prize could really help?
OskarS··on The GIL and its effects on Python multithreading
For number crunching it doesn’t matter, but I imagine it’s a much bigger issue if you want to run some kind of application server/webapp on a big beefy machine with lots of cores. That’s a thing you would want to run in something like Python, and the lack of parallelism is a real issue.
OskarS··on A World Without Sci-Hub
The existence of many high quality open access journals would seem to contradict your theory.
OskarS··on Stack size invisibility in C and the effects on "portability"
What are you talking about? For lots of functions, it is perfectly possible to statically determine a maximum stack size (not all functions obviously, that would be the halting problem). An trivial example would be a function that calls no other functions, but you can imagine others: functions with static call trees (i.e. no function pointers), don’t use VLAs or alloca, and that are not recursive (mutually, indirectly, or otherwise) will have a static limit on possible stack usage.

If you’ve formally verified that function X uses at most Y pages of stack, and the remaining stack is smaller than that, you could return an OUT_OF_STACK error instead of calling it. Most libraries/functions wouldn’t need this, but there are C libraries which place an extraordinary importance on reliability, and it seems like it would be a useful feature for them.

There might be other reasons why these functions shouldn’t be in the standard (or are impossible on some platforms), but ”the information is worthless” is not one of them. Of course this information can be useful.

OskarS··on Stack size invisibility in C and the effects on "portability"
No, but that's a pretty weak argument not to have them: they're better than nothing. Not all code uses libraries. And if it was part of the C standard, libraries could use them as well: libraries could fail gracefully instead of blowing the stack. Many libraries already do this when malloc fails, after all.
OskarS··on SQLite Archive Files (2018)
I mean, they do: [1]. It's an extension, true, probably because they don't want to force zlib as a dependency. Still, very straightforward to build with and use, and as you can see from the code, not hard to implement either.

[1]: https://sqlite.org/src/file?name=ext/misc/compress.c

OskarS··on SQLite Archive Files (2018)
To add to that list: when you do a .tar.gz, the compression algorithm works across file boundaries (very useful when you have a lot of small files), but neither sqlar nor .zip does this.

I think the idea of using SQLite as an application file format is excellent, and it's great that it can serve as a general store of files. As a general purpose compressed archive format, however, I agree it leaves a lot to be desired.

OskarS··on Always Multiply Your Estimates by π (2013)
The arc-length of a sin curve is an elliptic integral, and project time estimation is hard enough without throwing elliptic integrals into the mix!
OskarS··on ROT8000
From the article:

> While rot13 is the self-inverse for a 26-character system, and rot47 for ANSI, the Basic Multilingual Plane of Unicode requires rot32768 (or 8000 in hex) for a reciprical cypher

Not all emoji is in the BMP, at least some are in the Supplementary Multilingual Plane.

It's weird to me that if you're gonna do this dumb "rot13 but for Unicode", you'd only do it for the BMP, and not ALL of Unicode.

OskarS··on When McDonalds Came to Denmark
Also: gasoline taxes has fuck-all to do with labor unions.
OskarS··on GMP: The GNU Multiple Precision Arithmetic Library
I've also only used it lightly, but like you I don't remember having much trouble with the API, seemed like a pretty regular C library to me.

I wanted some example programs to see how the API looked in use, and the manual said they were in the demos/ folder of the repository. So I clicked the link to the repository, and got this: [1] ("Internal Server Error"), which is honestly pretty concerning... There's a GitHub mirror though, and the API looks perfectly usable to me [2].

[1]: https://gmplib.org/repo/

[2]: https://github.com/ryepdx/gmp/blob/master/demos/primes.c

OskarS··on Numpy matrix multiplication instability across rows
This is one of those times my instinct is to just say ”get a build of numpy with debug symbols, attach a debugger and just see what it’s doing, it’s not hard!”, though I suppose that’s a little trickier when run from Python (though I’ve never done it, so I don’t know how tricky).

Issues like these are paradoxically usually easier to resolve when developing in C/C++, where you usually always have the debugging infrastructure at your fingertips, and everything (at least above the kernel) is readily inspectable. Developing in Python, libraries like numpy starts feeling more like black boxes.

OskarS··on Excel as Code
As a rapid prototyping tool, it doesn’t sound terrible, honestly. Many people are comfortable with Excel, so let them use it! You’re gonna use some calculation engine on the backend, might as well be the tool that contains the ”reference” calculations.
OskarS··on Monotype acquires Hoefler&Co
I’m FJ’s side in this whole saga, but you’re minimizing Jonathan Hoefler’s contributions a bit: it’s true that Frere-Jones made Gotham, but Hoefler has made many iconic typefaces as well. Hoefler Text, obviously, but my favorite is probably Champion Gothic (think “Straight Outta Compton”).

It’s not Wozniak/Jobs situation where one of them was a creative genius and the other a cold-blooded businessman: they’re both creative geniuses. One of them just screwed the other one over.

OskarS··on Turing Oversold?
> But if you need to choose a Founding Father of Computing Science for the general public, I'd say Alan Turing is the best candidate. Scholars will give due credit to Church, Zuse, von Neumann and all the others.

I agree with this. It's certainly the case that I wish more people knew of Alonso Church and Kurt Gödel, but you have to realize in a "PR" sense that it's simply not going to be feasible to teach the general public about their contributions.

And Turing's contributions were genuinely ground-breaking, there's a reason that computer science is lousy with concepts named after or by him (Turing machines, Turing-completeness, even the word "computing" was arguably coined in "On Computable Numbers"). He also thought deeply and hard about the philosophical implications to computing in a way that others didn't (the "Turing test" being the obvious example).

In addition: when a mathematically inclined person describes any kind of mathematical concept to laymen, the first question is always "Yeah, but what is that actually useful for?", asked with a certain amount of disdain. With Turing, the answer is powerful: "How about defeating the Nazis and laying the foundation for modern society?". That case is harder to make for Church or Gödel: they obviously didn't work for the GCSE, and "lambda calculus" as a concept is a much more abstract thing than Turing machines, which laymen can readily understand (i.e. it's "just" a computer).

Add to that the fact that Turing's story is not just about computing, or code-breaking, it's also the story of the suffering that society inflicted on gay men. The fact that he was shamed into suicide is just all the more reason to celebrate him now.

I agree with the basic point of the article, but I have no issue with giving Alan Turing this title. He earned it.

OskarS··on Username ending with MIME type format is not allowed
I don't want to be too harsh on the programmer, everyone makes mistakes. It's easy to see how a person focused on a security issue with user names makes a quick fix without thinking through how this will affect account creation. As programmers, we have to make like 7,000 decisions every day, you're bound to fuck up some of them. This is a pretty big one, though.

The bigger question is how this passed code review and testing.

← PreviousPage 16 of 34Next →