Better HN
topnewbestaskshowjobs
Log inSign up

usrbinbash

4,687 karma · joined Dec 4, 2021 (4y ago) · 1,693 submissions

Submissions

comment 4y ago · link · parent

> TCP/IP over smoke signals

I like the idea, I'm just worried about the CO2 released.

Then again, if the alternative is tons of bird-cr&! everywhere, it may be the better way.

comment 4y ago · link · parent

What benefits are those exactly?

comment 4y ago · link · parent

> It is quite simply a hard problem to solve

We already have a solution to this problem: It's the internet as it is right now.

comment 4y ago · link · parent

> An example of a real value proposition of web 3.0 is spam protection and reduction of fake reviews.

How? It just costs money now.

Entities that want to spam and fake reviews, usually have money.

In fact, the more money someone is willing to throw at it, the more reviews they get to post. In fact, with enough resources, genuine reviews (which I would be reluctant to give as a user, as they cost additional money) can be comlpetely drowned out in this scenario.

comment 4y ago · link · parent

This is brilliant, love it :D

comment 4y ago · link · parent

Given that it takes about 20seconds to read through the snippet, not easily ;-)

comment 4y ago · link · parent

Oh yes, I <sarcasm looove /> it when people do that...makes reading the diffs feel so much more meaningful when the actual change is buried under tons of needless formatting elsewhere in the file.

comment 4y ago · link · parent

> What are some other things you've seen #programmers do that piss you off?

Sweeping changes with hundreds of LOC across multiple components, with a one-liner commit message that tells me absolutely zero about what was changed, why it was changed, and what issue it was about.

comment 4y ago · link · parent

IMO, it's because the primary use case for Go isn't GUI programming.

The language absolutely is a generalpurpose language, and making great GUI libs with it is certainly possible, as shown by Fyne (yes, I know it's still new, give it time).

That being said, most people using Go build server side code and frameworks with it, aka. things that live as daemons in some rack or in a docker swarm. If there is an front-end to these kinds of applications, it's usually web based.

comment 4y ago · link · parent

Difference 1: These certificates are used for the purpose of Authentication, not Encryption. If they get compromised, bad actors can impersonate certain entities for some time, but they cannot decrypt any prior recorded traffic to these entities.

Difference 2: If something happens to these keys, the CA can simply revoke the validity of the public key. This is a major pain in the _ for everyone involved, especially since all downstream certs needs to be re-issued and signed, but it's manageable. A built-in key that is somehow algorithmically included in every encryption mechanism, cannot easily be changed when it's leaked.

Difference 3: There is no single "highest Certificate Authority", so there is no single key to compromise the whole system.

Difference 4: These keys are ordinary asymmetric keys. They are not built-in backdoors into the system.

comment 4y ago · link · parent

> I don't see why, hypothetically, they can't all be sent with encryption that the government has a secret key to decrypt.

Because it's too risky, simple as that.

Let's say there is a single, super-secret-key, for government use only, that can decrypt any encrypted message on the planet.

What happens if this key is leaked? What if it's found out? What if the implementation of that key turns out to be buggy and is cracked? Remember, once there is such a key, it won't just be some criminals in godknowswherecountry trying to get it, it will be state-level actors with unlimited funds, resources and manpower.

If a single one of them gets their hands on this key, even ONCE, it's game over. Our modern society relies on encryption. If this key gets out, the results could be catastrophic; eg. Airplane navigational data manipulated in flight, stock market data manipulated in transit, financial transfers wide open for everyone to read and manipulate at will, control data for electrical grids, hydroelectric dams, nuclear power plants out in the open...it would be anarchy.

comment 4y ago · link · parent

> If government can demand the keys, they can take them and decrypt it.

The question isn't how its decrypted, the question is how to determine WHICH traffic to decrypt in order to inspect it.

comment 4y ago · link · parent

Difference: There are perfectly legal reasons to generate encrypted traffic;

All payment processing (ATMs, credit cards, online shops) generate encrypted traffic. Sending legal documents, technical data, company internals, contracts, etc. generated encrypted traffic. Sending sensible personal information like medical, indurance or financial records generates encrypted traffic.

Most of these cannot be sent unencrypted, without breaking fundamental processes in our society.

And there simply is no reliable way to differentiate between encryption used for legal or illegal reasons.

comment 4y ago · link · parent

> it will be the easiest thing in the world to detect if anyone tries sending it over the open internet.

And how shall "goverment sanctioned encryption" be distinguished from "non sanctioned encryption"? The point of (good) encryption is to make the result look like stochastically random bytes.

comment 4y ago · link · parent

> so I suppose there’s no gun crime there, right?

https://en.wikipedia.org/wiki/List_of_countries_by_firearm-r...

It works when implemented country-wide. Countries like Germany have much stricter gun laws, and as a result lower gun violence.

Obviously, the method doesn't work, when someone who wants a gun can just drive a couple hours and get one at some gun show without even leaving the country.

comment 4y ago · link · parent

Everytime someone invokes an argument how taking something away by law prevents some form of crime, my answer is a simple fact:

Criminals, by definition, don't follow the law.

Now, in some cases, that isn't a problem: Guns are an obvious example, because they take resources and knowledge to manufacture, and are physical objects that can be tracked. Taking these away by law works.

But encryption isn't a physical object or something that needs to be manufactured. It's math and algorithms. It can be copied infinitely. So, if the law takes that away, law abiding people will no longer have access to the benefits, while criminals will just ... well, as criminals by definition do, ignore the law, and still use encryption.

comment 4y ago · link · parent

The thing is, in the time it took me to finish watching this video, I already hacked together a working prototype of what I need in plain procedural stateful Python.

comment 4y ago · link · parent

> `cat v | cmd` is equivalent to `cmd < v`

https://askubuntu.com/questions/172982/what-is-the-differenc...

comment 4y ago · link · parent

Where did I say that?

I said if a software doesn't have a spec, the code IS the spec.

If I hand out a sheet of paper saying "the program returns X", but running it returns Y instead, the program is buggy.

If I hand out a piece of code which says "return X", and someone runs it expecting it to return Y, thats not the codes problem.

comment 4y ago · link · parent

And how do I explicitly ignore the other ways C communicates error conditions, like global error variables (eg. errno), inbound error values, errflags in structs?

comment 4y ago · link · parent

> to give a taste of the respective programming language

The question is, how much of a taste? We could also include structs, manual memory management, pointers, macros, #ifdef guards; because these are all so very common to C programs, they are definitely part of the languages flavour.

Also, which of the error handling techniques in C should be included, because the language doesn't have a standard one, there are no exceptions or multiple returns. Even within the most basic libraries we have everything from checking global error states, inbound messenger variables, magic number returns, errorflags, ...

Again, hello.c is supposed to be simple. As simple as possible. Yes, that excludes a lot of things. These things are what all the other chapters of "The C Programming Language" are about.

As a starter, hello.c is great.

comment 4y ago · link · parent

On my machine:

    $ cat main.c
    #include <stdio.h>

    int main(void) {
        int n = printf("Hello, World!\n");
        return n < 0 ? 1 : 0;
    }

    $ cc main.c
    $ a.out
    Hello, World!
    $ echo $?
    0
    $ a.out > /dev/full
    $ echo $?
    0
Problem is, printf is buffered. When redirecting to /dev/full writing to the buffer works. The problem only manifests when the buffer is flushed.

This works, as write is not buffered;

    #include <unistd.h>

    int main(void) {
        int n = write(1, "Hello, World!\n", 14);
        return n < 0 ? 1 : 0;
    }
But even then, to find out what exactly went wrong, we would have to check errno.

It's easier in Go, because fmt functions do have an error return which will report such errors;

    func main() {
        _, err := fmt.Println("Hello, World!")
        if err != nil {
            os.Exit(1)
        }
    }

comment 4y ago · link · parent

> you didn’t handle the possible error condition, you just silently ignored it.

Problem is, the error condition is not even that obvious. I tried it, and printf() will happily return the number of bytes written, even when redirecting stdout to /dev/full.

I am not 100% sure, but I think this has to do with the fact that printf uses buffered io, and writing the bytes to the buffer will work. It's only when the buffer is flushed that this will become a problem, but this would need to be handled in the code to show an error message.

comment 4y ago · link · parent

There is a difference between a program with a specification/documentation outlining what it should do, and one that doesn't have a spec.

AFAIK, hello.c doesn't have a spec, so the code is the spec. If I am using it, I have to read the code to know what it does.

comment 4y ago · link · parent

If the program comes with a specification then yes, ideally that should be the case.

If there isn't one however, then the code is all there is.

comment 4y ago · link · parent

hello.c is meant as the first program a new student encounters when learning C. At that point, the student has enough to worry about; writing code to a file, checking for syntactic errors, basic program structure, using the compiler, executing the binary, understanding what `#include <stdio.h>` means,...

Sure, we could update it:

    // hello_v2.0.c
    #include <stdio.h>
    #include <string.h>
    #include <errno.h>

    int main(void) {
        printf("Hello, World!\n");
        fflush(stdout);
        if (errno != 0) {
            fprintf(stderr, "error: %s\n", strerror(errno));
            return errno;
        }
    }
But now we have different libraries, a multitude of external identifiers, control structures, blocks, return values, the concept of buffered streams, the concept of file-descriptors, the printf formatting language, program return values, boolean logic & conditionals,...

To someone who is already experienced in another language, that may not seem like a big deal, and isn't, but to someone who encounters the language for the first time, this is heavy stuff.

comment 4y ago · link · parent

Enjoyable read for sure, but i think the question whether ot not this constitutes a bug or not is open for interpretation.

IMHO, it doesn't.

hello.c is written in a way that makes it very clear that the program doesn't care about error conditions in any way shape or form; the return value of printf is ignored, the output isn't flushed, the return of flushing isn't checked, noone looks at errno; ...so anything happening that could go wrong will go unreported, unless its something the OS can see (segfault, permission, etc.)

If I expect a program to do something (eg. handle IO errors) that its code says very clearly that it doesn't, that's not the programs fault.

comment 4y ago · link · parent

> That's basically the point of the program.

The point of hello.c is to serve as demonstration to students of the language of what a very basic program looks like, and how to use the toolchain to get it to run.

That's it, that's the requirements specified.

comment 4y ago · link · parent

Whether the program fails or not, is a matter of specification.

    printf("Hello, World!\n")
Is me saying: "Do a write syscall to stdout. I don't care what the return value is, I don't care if the flush is successfull if stdout happens to be buffered." If that is what I want to do, aka. what the program is specified to do, then it didn't fail.
1
394041
57