Better HN
topnewbestaskshowjobs
Log inSign up

codeflo

9,663 karma · joined Jun 14, 2010 (16y ago) · 1,502 submissions

Submissions

comment 3y ago · link · parent

    using namespace std;
It's fine, I won't tell anyone.

comment 3y ago · link · parent

> When I know it's "January" for whatever reason, and not "First Month", without knowing HOW and WHY this is the convention, it sucks. But then you see what Janus looks like - which, in this case, makes it even better for some reason than "First Month."

That's interesting, especially because I can't really relate to that. Don't get me wrong, I love this kind of trivia, but not knowing something like that has never been a problem for me at all.

comment 3y ago · link · parent

I'll try: New scientific discoveries also shift our perception of ourselves.

comment 3y ago · link · parent

I'm not entirely convinced by the arguments in the video, but I don't think those other pipelines are a strong counterargument either, perhaps the opposite. Let me explain.

Let's say you believe (a) that Germany desperately has to buy gas from Russia in order to survive the winter (not an entirely unreasonable believe back then), and (b) that it's possible for Germany to use its influence to pressure Ukraine into some kind of Russia-friendly peace deal (as has in fact happened after Russia conquered the Krim in 2014). Then forcing Germany to have that gas delivered through the active warzone in Ukraine sounds like a good bet to make (b) happen very quickly.

It didn't work out that way, but there would be an internal logic to this.

comment 3y ago · link · parent

> It would reduce the number of draw calls

That hasn't been true for many years.

> as you'd use more vram when using textures

For the equivalent amount of detail, not really. Vertices are expensive, normal maps are encoded very compactly.

comment 3y ago · link · parent

There are lots of subtleties about static vs. dynamic geometry, instancing and so forth, but to summarize, yes: In general, normal maps are cheaper than the equivalent additional geometry would be, by a lot. They are also higher quality for the same computational budget, because you get high quality anti-aliasing essentially for free.

Now, you are right that this might not matter much if you only consider coins in particular. But everything in a level wants to have additional surface details. The ability to have normal maps everywhere was a huge part of the jump in visual quality a couple of console generations ago.

comment 3y ago · link · parent

> The "I intend to hold it" is the relevant part of the valuation, though.

It’s really not, at least not mathematically. That intentions play a role is purely an artifact of regulations.

comment 3y ago · link · parent

The impossibility of "exactly once" is a theorem, not an opinion.

Knowing that, the article you linked is funny. It begins with maybe a thousand filler words complaining that all of this is "poorly understood", and it's not "impossible", just "very hard". Then it gets to the meat: Yeah well, you know, it's not quite "exactly once delivery", just "exactly once semantics", and to achieve that, messages need to be idempotent so that duplicates don't matter.

We all know that. It's called "at least once".

comment 3y ago · link · parent

Fucking single if statements are called AI these days. That's not a strong argument. :)

comment 3y ago · link · parent

One important con that isn't mentioned: It's so unnecessarily confusing how to write a shell script that can properly deal with whitespace, dollar signs or other special characters in filenames.

Of course it's possible and learnable. But even if you know the tricks, it's tedious, and human error prone. I had a team mate (many years ago) who used to test the local admins at any new workplace by putting files names named "$HOME" and similar in his home directory. He claimed it wasn't that rare for this to crash some backup script.

Yet this isn't inherently hard. In fact it's trivial in literally any "proper" programming language, no matter which one you end up picking. I get why shell is "scripting of last resort", I regularly write shell scripts myself. I don't get why people would choose it over anything else where choices are available.

comment 3y ago · link · parent

You even have this phenomenon inside single functions. Let's say you write a function that's supposed to be a safe/sound abstraction. You might be setting up a pointer, maybe determined by a dozen lines of codes, that is then finally dereferenced. You'd typically only put the unsafe block around this final pointer access, but its safety depends on the whole calculation being correct.

comment 3y ago · link · parent

> To follow your recommendation would require defining Rust as a memory-safer language, not as the language of memory safety.

I'm actually suggesting changes in explanation only, hoping to make these terms less confusing for beginners. Rust veterans know that "safe" code just means "code not in an unsafe block", beginners are often confused by the more common meaning of the word.

comment 3y ago · link · parent

That's a very good example. I think that's what I meant by:

> "Sound" code is safe code (that may or may not be checked by the compiler), that will remain safe no matter how it's called by checked code.

Maybe "called" was too specific, it could be embedded in other ways. But it's clear in your example that there's a way of integrating the unsafe cast into otherwise fully checked code that leads to UB. Hence, it is not sound.

comment 3y ago · link · parent

This seems to argue that accessing a web app (assuming an important piece of software that handles private encrypted data) is no less secure than loading software from a package repository, because a web server requesting the JavaScript and a software updater loading binary code from a server is structurally identical.

The obvious response to this is offline signatures: For package managers, app stores, updaters and the like, the integrity of the update server itself doesn't really matter, because the installer verifies a cryptographic signature from an offline key.

This argument is acknowledged, but seems to be dismissed without a real explanation:

> More astutely, there's also the distinction that either a file system compromise or a key compromise is required to serve malicious code to users with TLS, but software repositories can be architected such that a key compromise is required, through the implementation of offline keys. Despite this, though, there are several examples of secure software repositories that successfully use TLS. This isn't a grave concern (and they probably won't be converting soon) because the decision to use offline keys is palliative, at best, and only marginally increases a system's level of security.

> However, I openly concede that there are cases where a software repository can offer a higher level of security than a browser is currently capable of. I plan to discuss this later.

AFAICT, this "later" doesn't happen in this article, though I might have missed something. I really don't see why offline signatures are only "palliative". Web servers are hacked all the time, DNS misconfigurations happen, but organizations losing control of their software signature keys is comparatively rare. Why would you give up a very effective level of defense if it's so easily available?

comment 3y ago · link · parent

This is a very good explanation.

It's sad that these terms are so counterintuitive. I still regularly have to clarify the confusion between undefined and unspecified behavior. And to be fair, "define" and "specify" are basically synonyms in everyday language, it's evil that these terms have so wildly different meanings. Quite a bit of confusion is caused by people not fully understanding that "unsafe" in Rust actually just means "unchecked", i.e. not verified by the compiler, and not necessarily "insecure".

Now we add "unsound" to the mix, and I fear that all of this is simply too hard to learn.

Maybe we should reverse all those terms to be positive, and also use words in their intuitive meaning, and also avoid confusing almost-synonyms. Here's a quick attempt:

1. "Well-behaved" code would be code that only accesses memory correctly. (That's not fully precise enough. What I actually mean of course is "no UB", but that's hard to put into words if you don't already know what UB is. Let's say well-behaved code only does "allowed stuff".)

2. "Checked" code is code verified by Rust's compiler to be well-behaved if certain invariants are fulfilled. Code is always checked by default unless you opt out with a special keyword (confusingly called "unsafe").

3. "Sound" code is well-behaved code (that may or may not be checked by the compiler) with the additional restriction that will remain well-behaved no matter how it's embedded into checked code. This is what enables "safe abstractions". Checked code is automatically sound by this definition, but alternatively, unchecked code could also be sound, which would have to be manually verified somehow. To do this, you obviously need to know which assumptions the checker makes in its reasoning.

(Edit: Reworded a bit to address an unexpected source confusion. What's now called "well-behaved" was called "safe", but that has multiple meanings. Some of the responses in the thread apply to the old version.)

comment 3y ago · link · parent

Even cars turning, quoted here as something easy, is deceptively complicated once you really start thinking about what the rubber actually does on the road surface. In the end, both an angular momentum and a centripetal force are generated, but it's very hard to figure out why those things happen from first principles.

comment 3y ago · link · parent

(Added: People really shouldn't flag you for asking a question.)

The point is "aligning the AI's goals with human interests", i.e. make the AI non-evil.

You're somewhat lucky to never have gone down that particular rabbit hole. Some strange, but also seemingly very intelligent people on the internet argue that it's the most significant extinction risk humanity faces. My impression is that actual AI/ML researchers believe this to be mostly bullshit. (I'm personally not qualified to decide, just explaining the positions.)

The author of this curriculum seems to define it as:

> Within the coming decades, artificial general intelligence (AGI) may surpass human capabilities at a wide range of important tasks. We outline a case for expecting that, without substantial effort to prevent it, AGIs could learn to pursue goals which are undesirable (i.e. misaligned) from a human perspective. We argue that if AGIs are trained in ways similar to today’s most capable models, they could learn to act deceptively to receive higher reward, learn internally-represented goals which generalize beyond their training distributions, and pursue those goals using power-seeking strategies. We outline how the deployment of misaligned AGIs might irreversibly undermine human control over the world, and briefly review research directions aimed at preventing this outcome.

This is from here, which I haven't read, but found three links deep on the posted site: https://arxiv.org/abs/2209.00626

comment 3y ago · link · parent

You're wrong here, it's bullshit that was regularly updated with new astronomic findings. :P Isn't it miraculous how astrology was just as accurate before its charts included Neptune?

comment 3y ago · link · parent

Good point. In this context, it wasn't even superior though, at least not in the long run. Memory got bigger so that storing more triangles wasn't a problem anymore, it's more about computational resources. There, NURBS are only clearly better for very smooth surfaces (like the mentioned sphere), which are rare in natural shapes. For everything else, you get more details per FLOP by just using more triangles, which is where the industry went.

comment 3y ago · link · parent

Interesting. Also, 8 bits per channel isn't even a natural endpoint. 256 values aren't enough to cover the full range of human perception to any reasonable accuracy, which is why 16-bit floating point per channel is now sometimes used to encode HDR. (But to be clear, at current RAM sizes, it wouldn't really matter what the base is.)

comment 3y ago · link · parent

> I can definitely imagine a counterfactual where 12bit bytes became the basic building block.

It's definitely fun to imagine. I personally have a soft spot for a hypothetical ternary architectures, where the "trits" are either -1, 0 or 1. There's a mathematical elegance to that number system that binary can't match.

> 12bit bytes also work great for encoding RGB values for video

Can you elaborate, do you mean historically? The more bits the better, of course -- I get why 12 are better than 8, but it's not clear to me why you would want to stop at 12 bits. And if you don't stop there, what's the advantage?

> The << and >> bitshift operators even on a 64bit number are only using 6 bits of their operand, so even on an 8-bit-centric architecture you’re not realizing any great synergy with the powers of two.

6 bits is still cleaner than the 6.58 bits required to encode shifts for this hypothetical 96-bit architecture, just use the lowest 6 address lines.

And in general I think there are more places where stuff like this comes up than is apparent at first glance. How many bytes in a page? How many pages in a RAM chip? How many address lines and data lines?

In the current era, RAM chips are agnostic about word size (as long as it's a power of two) because what they actually address are these much larger pages that chips can cut up in any way they want. Perhaps if everything standardized to 12 bits as the base at once, you could solve that or find workarounds, but I think would be mathematically tedious at every turn. It's so easy to just chop off a few bits and not worry about it.

comment 3y ago · link · parent

> she said the star performer was a guy named ASCII, who really didn’t get along at all with Octal

I'm not convinced. ASCII is 7 bits only, which doesn't fit much better into 2*4 than into 3*3. It's not like the extra bit would be "wasted" anywhere, both octal and hex are only for displaying numbers, not actually used in memory.

comment 3y ago · link · parent

It's easy with hindsight, but there must have been people back then who foresaw that power-of-two machine words are almost as necessity as you scale up (8 -> 16 -> 32 -> 64 bits).

comment 3y ago · link · parent

Jesus. It’s a piece of software that people may or may not find useful.

comment 3y ago · link · parent

It's interesting in that respect what the developers of Frost Giant Studios, comprised of ex-Blizzard RTS devs, are planning for Stormgate. Complex RTS games need a deterministic ("lockstep") simulation to be viable over the network. On the other hand, they are using UE5, which as you indicate, has a completely different server/client model.

What I've gleaned from interviews is that the simulation part of the game including the netcode will be completely custom. The way I understand it, they're effectively only using Unreal Engine for rendering, sound, UI, cutscenes and so on, but all the gameplay logic is their code. Customizing an off-the-shelf engine to that level has to be highly nontrivial, and probably out of reach for smaller projects.

comment 3y ago · link · parent

Exactly. The HTTP standard doesn't really mention HTML, except tangentially in examples. And regarding cookies, there are even people who use cookies in RPC contexts, but this is rather rare, and as you said, entirely optional.

Also, as a minor point, even when browsing the web, a minority of the actual requests deliver HTML -- most of them are for various kinds of media referenced by the HTML document.

comment 3y ago · link · parent

I for one think we should finally replace DNS with JPEG. That makes exactly as much sense as this article.

comment 3y ago · link · parent

I think I feel dumber for reading this. (The referenced paper by Ousterhout is quite good though, and doesn’t confuse the terminology. Maybe that one’s what HN should link and discuss.)

comment 3y ago · link · parent

I assume you're tongue in cheek, but just to make a serious point, it should never make sense to swap from cheap RAM to more expensive RAM. The whole point of swap is to move rarely used stuff into storage with a lower cost per GB. Otherwise, you would just buy more RAM in the first place.
1
171819
51