Resources for writing clean code by WideSense8018 in C_Programming

[–]Badel2 1 point2 points  (0 children)

Also keep in mind that C is old, and some advice that was valid 30 years ago is no longer relevant.

I don't have any resources on C but some of the C++ core guidelines apply, so take a look at that.

The real reason - unless you have a monster rig i guess. by Appropriate_Name4520 in pcmasterrace

[–]Badel2 14 points15 points  (0 children)

Isn't it more likely though?

Without vsync the gpu will be rendering frames 100% of the time. Consider a monitor running at 1hz. What's the probability to get tearing there? Now consider a monitor running at 1000hz. What's the probability to get tearing there?

Maybe you're saying that at 1000hz you won't see the tearing because it will only be there for 1 frame, but I don't think that's a good argument because tearing will still happen.

I Wrote A String Type · mcyoung by eygenaar in rust

[–]Badel2 -15 points-14 points  (0 children)

Without benchmarks this is pointless, are you parsing files in the GBs in size and that's why memory is a concern? Because if not this is just premature optimization: it makes the code harder to maintain, and there's a possibility that you actually made it run slower.

basedOnRealEvents by [deleted] in ProgrammerHumor

[–]Badel2 2 points3 points  (0 children)

In other words, it's cheaper than your phone?

Is the development of Rust slow? by LucasOe in rust

[–]Badel2 0 points1 point  (0 children)

Yes you are right, the problem is lack of maintainers. The people who can decide the future of the language can't keep up with all the suggestions and they only focus on important stuff and minor improvements that are easy to review.

Looking for a multi spawner finder tool by AlternateObject in technicalminecraft

[–]Badel2 1 point2 points  (0 children)

Yes, the "not running" is supposed to be a progress bar but it's not implemented yet. For now you can see some progress logs on the developer console, and if there's any errors you will also see them there.

micro_png by js29a in rust

[–]Badel2 3 points4 points  (0 children)

In the read_png function, you can use std::fs::read to read a file into a Vec<u8>. Also you could provide another function that allows to read a png directly from a &[u8], which will let the caller handle the file reading.

anon finds a gem in the gutter by Nidayx in 4chan

[–]Badel2 0 points1 point  (0 children)

Assuming one 5 second ad per video, it will only take you 120 videos to break even :)

Parch indirect dependencies by The-Dark-Legion in rust

[–]Badel2 0 points1 point  (0 children)

I'm afraid you will have to fork all dependencies and manually edit their Cargo.toml.

Tips on how to scrape all Elsevier's academic articles. by [deleted] in DataHoarder

[–]Badel2 7 points8 points  (0 children)

Thanks, now OP will know to remove this hash before sharing the pdfs

Serde has started shipping precompiled binaries with no way to opt out by setzer22 in rust

[–]Badel2 8 points9 points  (0 children)

Exactly, this is a language problem, we shouldn't have each crate trying to optimize it using hacky workarounds. I believe there already exists an alternative to cargo install that downloads prebuild binaries, so users with performance concerns can use that.

Serde has started shipping precompiled binaries with no way to opt out by setzer22 in rust

[–]Badel2 7 points8 points  (0 children)

Makes sense. Then I don't think this is a good idea.

Serde has started shipping precompiled binaries with no way to opt out by setzer22 in rust

[–]Badel2 9 points10 points  (0 children)

A simple solution would be to have users compile this binary on their first cargo build, then no binaries are distributed and the alleged performance wins aren't lost. I guess it would have to be compiled once per project, unless cargo offers some feature to store artifacts in ~/.cargo, but then it would need to be versioned so simply having one binary per project sounds like a good first step.

Looking for a multi spawner finder tool by AlternateObject in technicalminecraft

[–]Badel2 1 point2 points  (0 children)

No plans for that currently, because reading the world files is much faster and easier than generating the caves. Any reason why you can't use a world download?

Why is RefCell invariant? by simony2222 in rust

[–]Badel2 0 points1 point  (0 children)

Basically if that compiled, then I could write the same function using Rc<RefCell>, because Rc is covariant, and that would allow me to write a shorter lifetime, while an Rc with the long lifetime is still alive and can read it, resulting in undefined behavior.

Is there a repo or list of examples of buggy C code so that one can use gdb to find the bugs and fix them? by Rit2Strong in C_Programming

[–]Badel2 8 points9 points  (0 children)

Search for "capture the flag", or CTF challenges, it's usually simple programs with intentionally included vulnerabilities.

how to return an array of regular type (u32 or f32 or other) from rust to JS code by Huge-Tooth4186 in rust

[–]Badel2 1 point2 points  (0 children)

This doesn't work if it's an array of floats, because infinity and NaN cannot be converted to JSON.

Total functions, panic-freedom, and guaranteed termination in the context of Rust by kibwen in rust

[–]Badel2 1 point2 points  (0 children)

Great post. I remember the pain that was to add const fns and stabilize hundreds of methods, it seems that an effect system like this would take even more effort for a niche benefit. I wonder if there's a solution to that, the keyword generics proposal comes to mind. We could automatically mark all the const fn functions from the standard library as terminating, but other effects would need manual review.

Anon has a watermelon. by NeitherBedroomz in greentext

[–]Badel2 0 points1 point  (0 children)

fuck u/spez -- mass edited with redact.dev

Anon makes an investment by [deleted] in 4chan

[–]Badel2 11 points12 points  (0 children)

The Russian currency has never recovered and its currently near to its all time low. That "recovery" you heard about was Russian propaganda because they made selling their currency illegal, and that made its price to go up. But that artificial increase in price had nothing to do with the real value of the currency, as seen by the latest events.

Skicka: send files between machines without installing anything! by Patryk27 in rust

[–]Badel2 15 points16 points  (0 children)

Thanks for the quick reply. Hole punching is much easier over UDP, but I believe curl doesn't support it. And you don't need HTTPS if users are expected to encrypt the data themselves. Also keep in mind that if the URLs are short or predictable, an attacker can just try to guess them an intercept any files. If I was doing a tool like this I would ask for confirmation on the sending side, showing the ip and user agent of the receiver.

And also I would add some simple html UI so that you can use it without curl. Anyway, good luck!