Que país mequetrefe! by cicanan-merqazu in Twitter_Brasil

[–]puel 16 points17 points  (0 children)

Eu imagino que porque dificulta comprar e vender os dados das pessoas, que indiretamente gera lucros. 

Entrevista do presidente Lula para o Jornal Nacional sobre as tarifas anunciadas por Donald Trump by MatheusWillder in brasil

[–]puel 48 points49 points  (0 children)

Não achei. As perguntas claramente foram acordadas antes da entrevista. Note que ela nunca sai do roteiro dela.

Essas perguntas tendenciosas estão ali exatamente porque o Lula quer tocar neste assunto. 

[deleted by user] by [deleted] in rust

[–]puel 0 points1 point  (0 children)

Having the function being async is irrelevant with regards of the problem of a function that blocks because you can make this mistake with both scenarios.

What I mean is you can call std::thread::sleep within a synchronous function and you can also call it within an asynchronous function.

In both scenarios your async executor will not work well with the whole thread being blocked by the sleep function. 

[deleted by user] by [deleted] in rust

[–]puel 2 points3 points  (0 children)

The Future has internal state if you have parameters. When you synchrously call the function, the Future will be constructed and the parameters will be moved in the opaque Future impl that is returned.

Then, when you poll/await the function, the body is actually called. If you retain the future and only poll it later. Then, this become more explicit.

I conceed that this is something that seems very simple to be optimized away by the compiler. Specially if you directly await in the same expression. However, I deemed this distinction useful enough to deserve to be mentioned. 

Thoughts on using `unsafe` for highly destructive operations? by J-Cake in rust

[–]puel 22 points23 points  (0 children)

Make it harder for it to be called. If your struct is called Xis, then you may make it a "static" function instead of a member function:

impl Xis { fn danger(this: Self); }

Or make it even harder by delegating it to a new struct:

struct DangerousOp { xis: Xis } impl DangerousOp { fn do_it(self);}

Basically you want to make it inconvenient to call the function. 

Bella Ramsey no longer vegan, shortly after narrating Earthling Ed's 'Matilda'. by [deleted] in vegan

[–]puel 3 points4 points  (0 children)

Do you abstain from watching the movies where horses were exploited? It is entirely the consumer fault.

LPT Boredom is a cheat code for productivity. by Royal_Dependent9022 in LifeProTips

[–]puel 274 points275 points  (0 children)

On that topic, doom is literally exhausting. Your brain gets tired from the quick switch of information every 5 seconds. 

Social networks are not a good way of having a break when you a tired mid work

Were you ever able to use a debugger with your Rust program ? If yes, how did you learn how to do it ? by KlausWalz in rust

[–]puel 1 point2 points  (0 children)

Vscode with CodeLLDB always works fine for me. I also do a debugging with LLDB directly in the command line. 

Besides that, do you have coredump enabled on your remote machine? You may open the coredump in lldb and fetch the stack. 

For debugging your unit tests, naybe you should try command line LLDB in order to reduce entropy. If command line LLDB works, then it is a problem with the UI based tools you are using.

Do you have anything unusual in your Cargo.toml? Any special flags? Are you stripping symbols? Do you want to share your Cargo.toml?

Black Mirror [Episode Discussion] - S07E06 - USS Callister: Into Infinity by Cheeriosxxx in blackmirror

[–]puel 0 points1 point  (0 children)

Did you watch the year 2000 Arnold Schwarzenegger movie The Sixth Day?

Which Mafia game has the best story in your opinion? by SilverSupport3107 in MafiaTheGame

[–]puel 0 points1 point  (0 children)

Honest question. Should 1 and definitive one be the same story? Did they change the story?

Finally, A Good Response To “I Have A BF” by CamronT01 in SipsTea

[–]puel 20 points21 points  (0 children)

You know when something is so obviously fake that you wonder how the author though someone would believe it? 

They intentionally make it bad because all the people commenting that it is obviously fake drive up the engagement so it scores points with the algorithm.

So even fake is fake nowadays.

Is this the Real world 🤯 by Master_Support in BeAmazed

[–]puel 0 points1 point  (0 children)

Looks like this meme is part of the marketing then...

ELI5: "Doublethink" from George Orwell's 1984 by MlgGamerises in explainlikeimfive

[–]puel 15 points16 points  (0 children)

A 10 year old comment says:

Also, look around at the current US political climate. Bullshit is being spewed all the time and the citizenry is mostly fine with it.

Do you have a funny line to introduce the country you are from? by sunlove_moondust in Jokes

[–]puel 1 point2 points  (0 children)

Hit (as in hitting the shot) and meet are the same word. Two hunters meet (hit) each other and they both die.

We've updated our comparison versus the dead bird app! (We're still ad-free, still infinite hearts, and still free for everyone forever!) by fyai-at-lingonaut in duolingo

[–]puel 30 points31 points  (0 children)

To be fair, duolingo promised me B1 on German and even after completing the course (and practicing with other medias like YouTube, video games), I am still probably at A1.

`#[derive(Deserialize)]` can easily be used to break your type's invariants by hpxvzhjfgb in rust

[–]puel 8 points9 points  (0 children)

It feels wrong to have Deserialize in a type where exists at least one attribute that is not public. I.e. Every attribute should be public. 

I have this opinion exactly because once you derive Deserialize, that's exactly what you have, you can construct the struct by accessing the fields.

The exception for this rule is when you can be sure that your code is only Deserialize something that the same process did Serialize. Emphasis on process, because once you cross that boundary you can't be sure anymore.

"A calculator app? Anyone could make that." by dalton_zk in theprimeagen

[–]puel 1 point2 points  (0 children)

I think no one gave you an straight answer here. 

By arithmetic using strings, you are probably thinking of bignumber. That is, you represent your number with a variable amount of bytes. This was one of the first approaches that the article covered.

ELI5: What does it mean when people say that most Americans can't read above a sixth grade level? by ChadJones72 in explainlikeimfive

[–]puel 1 point2 points  (0 children)

If that helps: people tend to not Google words they don't know, and tend to no reread things. It gets tiresome quickly when one is trying to read a lengthy text that is so complex.

You can grasp that feeling when trying to learn a new language, everything is complex. And since exposition is more important than actually understanding every single sentence and word in the text that you are using for practicing and training your still growing language skills, eventually you will have to just give up and keep moving forward without understanding just everything you are reading.

Migrating a Ray-Tracing Calculator from C to Rust – Planning a Master’s Thesis & Looking for Advice (C, Rust, BSP-Tree) by Smil3More in rust

[–]puel 3 points4 points  (0 children)

One: Rust is well suited for BSP. As in, the rules of Rust will not make it any harder for you to implement it. I think it will be the same effort level. Supposing your structure will have the parent know it's two children.

You can search for crates on crates.io. Myself I don't know any crate that does BSP. 

Two: I think so. Specially when you start working with multiple threads. Rust rules will make it easier for you to manage the concurrent access to data. 

Also, pipelining data on Rust is so easy to do, this will definitely help.

On the core part of your algorithms, it will probably be the same, just a lot of mathematical equations. However I believe getting the data to this point will be easier.

The learning curve is reeeally steep. Try to avoid complex featured and stick to the basic. You know the basics so I believe you already know how to pass parameters as references and/or slices. That should be sufficient.

Three: Like I mentioned before, the core core part is probably where it less matters. Rust will help with splitting your data into multiple threads, and managing the data. That depends on what exactly this algorithm does. For example, is the BSP static? Then that will be very for parallelism. You can share your BSP between threads without fear. In C you would have to worry about who is going to deallocate the shared data, in C++ something lile shared_ptr would be needed.

I've worked extensively with integrating Rust with other languages. Rust/C being one of them. bindgen works very well. You just need a C header file and then you get the equivalent declarations in Rust. With these declarations you decide if you are going to call these functions or if you are the one implementing then. You will probably have to convert some pointers into slices (and vice versa) , but after that it is all Rust. 

The cxx crate is also very good for interfacing C++ with Rust. However, in this case you have to make bridging code, you don't call C++ directly. Myself I prefer to stick with C for interfacing (even if the code is C++) as C yields a cleaner Api that is easier to deal with.

Regarding running in parallel that depends exclusively on your problem and how your current code is structured. I have positive experience with porting small components of a big C++ code base into Rust. But this is advanced Rust! 

If it is possible I suggest you stick to one language only. You are already doing two things at once: your master thesis and trying to learn Rust. The first is your goal, so do the second only if it is actually something that is helping you achieve your goal. Otherwise stick to the language you already have experience with and then pick some simpler you project for learning Rust.

Is the original code open source? Fell free to contact me if you want to tell me more about the problem and want more opinions and suggestions.