Better HN
topnewbestaskshowjobs
Log inSign up

codeflo

9,664 karma · joined Jun 14, 2010 (16y ago) · 1,504 submissions

Submissions

comment 5y ago · link · parent

I agree. The important thing for the other cases is to be pragmatic and use the escape hatches. Use a Mutex even though it’s not necessary and accept the runtime cost, or use an unsafe pointer, but get the job done. I’ve seen the phenomenon in both Haskell and Rust now where people would introduce way to much complexity for a relatively simple problem to conform to some sort of ideology.

comment 5y ago · link · parent

Counter argument in addition to downvote, please?

comment 5y ago · link · parent

Those pictures are definitely NSFW when viewed at low res/from far away, which is how coworkers typically see your monitor contents. An argument that starts with “Well, technically” is unlikely to carry much weight in a discussion with HR (and probably rightfully so).

comment 5y ago · link · parent

No, I saw that, I just don’t understand it. I can do all of that with a PC. Is this a PC? A more powerful Raspberry Pi? What does the ability to “learn concepts” even mean? I learn concepts from books, what does the hardware do?

comment 5y ago · link · parent

I know it’s a HN cliché to comment on this, but it’s also true: I went several links deep, then looked at the homepage and the FAQ, and still have no idea what this product is or who it’s for.

comment 5y ago · link · parent

Something something diagonalization proof something something.

comment 5y ago · link · parent

The article gives a figure of 15 kW for the chip. That’s the kind of heat usually generated by a small room full of servers. Radiating that away on the outside is not the main issue, solutions exist for that. But getting that kind of heat away from the chip and into the water in the first place has to be a nontrivial challenge.

comment 5y ago · link · parent

This may be a special case because the question comes up so often, but in general, I don’t think libraries should document all the qualities they don’t have, because that’s inexhaustible. In my opinion, if a sort function isn’t documented to do a stable sort, it must be assumed to be not stable, regardless of current implementation details. It’s often not such a big deal either: in many cases, there’s an artificial key (an id) that you can use as a tie-breaker in the comparison function.

One thing I hate is when people look at the library source code to figure this kind of thing out, since any implementation detail can change with an update. Assume the most hostile implementation allowed by the docs and you’re usually fine.

comment 5y ago · link · parent

Very true. Some things I also noticed:

Changes tend to be made higher up in the stack, ultimately the UI, because that has a lower risk of breaking something else. This gets very messy very fast.

Bugs in shared code tend to be worked around rather than fixed because other code might depend on those bugs — which quickly becomes a self-fulfilling prophecy.

Some functions/methods seem to be natural magnets for these overly local changes, and as a result, can wildly grow in size over time. I once analyzed how a 50-line function had grown to 5000 lines over a few years in a series of individually justifiable changes.

All of this is a downwards spiral that’s very hard to stop once it has started. “Refactoring sprints” and other heroic efforts sadly seem to have little impact in such an environment if they don’t also radically address the engineering practices that lead to the situation.

comment 5y ago · link · parent

So under Marxism, people don't need to discuss how to coordinate their work? That does save a lot of time. No wonder the Soviet economy was so efficient.

comment 5y ago · link · parent

I think a lot of that is because English borrowed (stole) lots of single words from other languages, but almost never the entire system of prefixes and suffixes that the word was part of. Languages that were more closed to foreign vocabulary, like French and German, are a lot more regular in this regard.

comment 5y ago · link · parent

This. The advice to move cron jobs outside has its place, of course. But unless you’re running at massive scale, Docker becomes easier once you stop worrying about what is and isn’t “proper container architecture”, and just remember that it’s Linux.

comment 5y ago · link · parent

Depends on the exact branch of mathematics I guess. As a CS major, I found Turing’s paper on decidability very readable, for example. Gödel’s original proof of his incompleteness theorem isn’t too bad either.

comment 5y ago · link · parent

I don’t disagree, but my point is about clarity, not relevance. There’s a reason it’s so uncommon for people to read Nietzsche unguided, or without secondary literature.

comment 5y ago · link · parent

Maybe that’s not universal, but the way the notation was taught to me in school (Germany) was that the finite sum Σf(x)Δx is simply written as ∫f(x)dx in the limit. So dx is really just an infinitesimal Δx, and ∫ is the summation symbol, only written with a large Latin (as opposed to the usual Greek) “S”.

That’s useful to know because several integration tricks become easy if you keep that relationship in mind. If you can transform a sum, you can transform the corresponding integral. (With the usual caveats around degenerate cases.)

Similarly, for differentiation, the limit of Δy/Δx is written as dy/dx. Again, knowing this enables you to derive otherwise complicated looking transformations.

comment 5y ago · link · parent

I love how maths books from 100 years ago are perfectly readable even by modern standards, while philosophy texts from the same period are completely inscrutable.

comment 5y ago · link · parent

Wow, I hadn’t even realized that this was all quotation before reading your response. To add a formatting tip: When quoting multiple paragraphs, it’s best to repeat the “>” marker at the start of every new one.

comment 5y ago · link · parent

Unfortunately (or perhaps fortunately), “regexes” as commonly implemented in programming languages are only loosely related to regular expressions from automata theory. With all their extensions, they can recognize much, much more than just regular languages, and I don’t think they’re closed under complement (though I’m not sure). However, most regex engines have a feature called negative lookahead assertions, (?!do not match), which would almost work in the way you suggest.

You have to be careful about inputs like this though: “Inside a string”Tarzan”Again inside a string”

comment 5y ago · link · parent

I hope your comment wasn't intended to be as hostile as it reads to me, but I do wonder what your experience was exactly, because there might be a misinterpretation.

From a technical standpoint, using const_cast to modify a constant is Undefined Behavior. This was explicitly specified that way to make constants inlineable by the compiler. Every compiler that I've ever used does this, it's a trivial but very effective optimization.

Proof by Godbolt: https://godbolt.org/z/djEdvee4s

Observe how GCC completely eliminates the contents of undefined_mutate_modulus (which it's allowed to -- UB means it can do anything with that function, and it chooses the simplest possible thing) rather than de-optimizing mod4_const like you suggested. Compilers are smart.

comment 5y ago · link · parent

True, but something to be aware of: If the compiler uses bitwise operations to implement %, it emits special handling of negative values (it's really more of a remainder operator than a modulus). You can avoid that either by using unsigned numbers, or & as suggested:

https://godbolt.org/z/vdz59q994

comment 5y ago · link · parent

I agree with many of the sibling comments, static vs. non-static is almost a complete red-herring.

Static only means that the variable is local to the translation unit (the C file). The relevant difference in the example is actually the const-ness of the variable, which you may put explicitly, but which a powerful compiler can also infer here in the static case.

Other than this optimization possibility, const and static are orthogonal concepts. I'm not sure to what extent the article author is aware of this.

So the lesson should be: use const (or #define) if you mean to have a constant. It's still a good idea to also make things static, but the real reason for that is to avoid name collisions with variables in other C files.

comment 5y ago · link · parent

And that’s before Windows Defender falsely identifies your executable as a random threat and moves it to quarantine without asking. Who do you have to bribe to prevent that?

comment 5y ago · link · parent

I fully agree about static types, I just want to mention that TypeScript works well with Node, and can be quite nice.

comment 5y ago · link · parent

So instead of extending QR codes, which are inherently binary, to efficiently handle binary payloads, we invent yet another ASCII-based tunneling scheme. Why ever fix any problem when we can just pile workaround upon workaround upon workaround?

comment 5y ago · link · parent

I know there are lots of funny theories about vision on the internet, but as a simple empirical fact that everybody can verify, dimming an LED works. Whatever idea about vision someone might have, if it doesn’t account for that fact, it’s wrong, disproved by everyday experience. (More generally, photons hitting cones are actually also discrete events, and we don’t see everything flickering all the time. But that’s a more complex argument that depends on a prior understanding of quantum physics. In contrast, the LED example is simple and deterministic.)

However, the complexity of the biology behind this doesn’t actually matter for my argument. My point is that we need proper signal processing in order to not irreparably damage the signal before it reaches the eye, when we’re still in the realm of precise technology. I’m not sure if I explain this poorly or if you’re a tiny bit motivated to misunderstand me, but of course, it is a complex subject.

As a last honest attempt, can we agree in the simplest possible case — that an LED blinking at 1 MHz filmed at 1 million still frames per second can’t ever reproduce a signal that can be interpreted as being dimmed? If so, we already agree that we have an artifact. Then the question is only how to remove it, and signal processing theory gives an answer.

If not, I’d recommend that you work through it with pencil and paper: what is the LED doing, what are the still images showing, what is the monitor showing to the eye? You can’t miss the conclusion if you do this carefully.

comment 5y ago · link · parent

This has nothing to do with biology, it's an argument from signal processing, which is well-understood theory (Nyquist's theorem and so on). If an object oscillates at 1 MHz, and you take 1 million still frames per second, it will rest in the same place in every frame, and thus look static. In reality, such an object would look blurred to the human eye.(+) It's this kind of artifact that motion blur (to be more precise, low-pass filtering) can avoid.

Edit: The article you linked to is very confused about some basic terminology. It equates response time artifacts of an LCD monitor that display sharp, digital images with motion blur. That's so wildly wrong I'm not even sure where to start. Maybe here: When displaying video, motion blur is a property of the source, response time one of the output device.

(+) Edit 2: To expand on this, the human vision system integrates arriving photons over time, and this way implicitly behaves a lot like a low-pass filter. A low-pass filter is different from a fixed-rate shutter, which is what people mean when they say the eye doesn't have a fixed framerate. However, there is a limited temporal resolution.

A more everyday example of this effect would be a dimmed LED. You can pulse an LED at 1 MHz, it will look dimmed, not blinking. But when filming/rendering this LED at 1 million still images per second, it will either be all on or all off, both of which are wrong (i.e., an artifact of your chosen shutter speed).

comment 5y ago · link · parent

If you notice it, it’s not done correctly (which in games unfortunately seems to be always; presumably because it’s faked with a blur in post-processing). Few people complain about motion blur in movies, where cameras produce it through physics alone. It’s artificially added to CGI scenes so that they don’t stand out and distract the viewer.

comment 5y ago · link · parent

Counter point: Motion blur is a simple form of low-pass filtering (in the time direction). You need some kind of filtering to prevent shutter artifacts (think video of a spinning wheel), and that stays true even at a million fps.

comment 5y ago · link · parent

It's more or less the sad industry default. The surprising thing is that this happens at a company with the software dev experience of Apple, and even there, specifically in the wi-fi code. One might assume that this is an area of iOS that would receive special attention.

comment 5y ago · link · parent

I might be in a minority because I write a lot of .NET which in production is almost exclusively deployed on Linux. It's absolutely viable, performance is great, and tool support is fantastic. We agree so far.

However, I have to point out that .NET does have a Windows-only heritage, and as a result, a lot of lower-level APIs (files, processes, signals, pipes, terminals) still have some painful Windows-isms. Fortunately, the situation improves every year, and for a typical server application that exclusively communicates over the network, you're completely fine (and have been for several years now).

1
353637
51