• 8 Posts
  • 2.81K Comments
Joined 2 years ago
cake
Cake day: August 21st, 2024

help-circle




  • you can absolutely save history in an array, but depending on how you want to do it, it can get very complex for a beginner.

    the absolutely easiest way to go about it with how you’ve structured the program so far is making global arrays of just numbers, one for C->F conversions and one for the other way round. you also need to keep track of where in each array you are so you don’t go out of bounds. this requires minimal changes.

    float c_to_f[5] ={0,0,0,0,0};
    int c_to_f_length = 5;
    int c_to_f_index = 0;
    

    and update your input handler:

    scanf("%d", &c_value);
    c_to_f[c_to_f_index] = c_value;
    c_to_f_index++;
    if (c_to_f_index >= c_to_f_length) c_to_f_index = 0;
    

    and then when you want to see the list results, you do

    for (int i = 0; i < c_to_f_length; i++) {
        printf("%d\n", c_to_f[i];
    }
    

    this will of course not be in order of insertion, and if you want to show more than just the numbers you need to do some tinkering.

    this is however a great jumping-off point to talk about many different concepts:

    • do you feel like you’re just writing the same thing over and over? look into encapsulation and refactoring your program to minimise repetition.
    • do you want to store more information about each entry? time to learn about structs.
    • do you want to store as many entries as you want, without having to specify? go learn about linked lists.
    • do you want to be able to step back and forward through your history? check out the readline library, and learn how to do imports generally.

    sorry if my formatting is off, i did this on my phone…






  • they call it “total cookie protection”, and it’s always enabled. every site gets its own cookie jar, which also includes things like localstorage.

    if you’re paranoid you can use multi-account containers together with something like containerise to generate a new container for every domain that isn’t whitelisted, which means it disappears when you close the last tab for that domain. combine that with cookie autodelete and you can wipe whitelisted sites too.

    that, or just tell the browser to clean up everything when you close it. that’s one toggle in the settings.


  • well that graph is total plastic exports, not waste specifically. i should probably have checked that before linking it. this one is probably more relevant; it shows generated plastic waste, but not exports. however if we take the 810kt from the op article at face value and put that against the 0.48kg/person/day number given to germany in this graph (× 80.83M people × 365 days ≈ 14.2 million tons), we get 810 / 14 200 ≈ 6% of their generated plastic waste being exported. i’d honestly say that’s a pretty impressive number, even though it also seems to point to the average german generating more like a ton of plastic waste a year. as someone partially responsible for a multi-tenant building’s maintenance it’s not an unbelievable figure by any means, but it is a lot.







  • yeah it’s unmaintained because he’s been in prison for almost 20 years. also i remembered it wrong, it was apparently strangulation, the axe thing was when he buried the body.

    a recent letter from him to the community was published online last year and it’s gut-wrenching stuff. he dismisses all notion that he had a manic episode, he’s saying that he was in full control and has a perfect memory of it, and has been living scared of himself for the last 15 or so years. i of course don’t know the man but the letter seems genuine.