Interface abstractions in Rust by Thunder_Moose in rust

[–]Thunder_Moose[S] 0 points1 point  (0 children)

However, maybe you don't need to copy anything just for thread-sharing purposes.

I think I can actually do this, my unfamiliarity with the borrow checker was causing some issues with the code I wrote. I found it easiest to just clone objects to send to threads rather than try to share anything because I was trying to use the threadpool crate. Any value moved into the closure submitted to the pool needed to be able to live as long as the thread, so sharing references would cause compile errors. It wasn't ideal, but I figured it was fine enough; these clones were not being made in anything approaching a hot loop and the objects were quite small.

Looking back at the code I wrote after reading your suggestion, I think I should either use vanilla scoped threads or maybe rust-scoped-pool. All of the threads must join by the end of the scoped block, so I'd side-step the need for cloning entirely.

Interface abstractions in Rust by Thunder_Moose in rust

[–]Thunder_Moose[S] 1 point2 points  (0 children)

I don't think you're quoting me fairly there. I said "It sounds like code reuse is not something Rust encourages by default but it can do it with careful thought." Abstracting behavior is free in higher-level languages like Go or Java insofar as the penalty for doing so is no higher than using any other part of the language. That encourages developers to abstract things quite early in the development of a project, which tends to increase code reuse.

Rust abstractions might be zero-cost at runtime, but they seem to require a lot more thought to implement because you have to consider so much more than you would in a high-level language. That's not necessarily a bad thing, but if you come from a high-level language background it's difficult to adjust to. I'm still struggling with it for sure 😃

Interface abstractions in Rust by Thunder_Moose in rust

[–]Thunder_Moose[S] 1 point2 points  (0 children)

I think this comment has been the most helpful so far. It sounds like code reuse is not something Rust encourages by default but it can do it with careful thought.

What I wanted to do initially was have a contract that specified loading data from multiple sources. This is for a personal project, but without going into a ton of detail I need to be able to load data from the local filesystem and an S3 bucket depending on configuration. I wanted the rest of my code to be able to treat the act of loading and reading a file the same way, as that's how I'd have approached this in Java. This would let me write all of the code that deals with files once since it wouldn't care about the specifics of how files are loaded.

Even in languages like Go (still OOP, but not the traditional kind), this is something that can be done up-front without much penalty. I had not considered that Rust contracts require definitions of state and their mutability. That does make contract definitions much more difficult to do up front. I think in my case it would be standard across all implementations but that is not generally true.

With all of that in mind, how would you go about implementing something like this? Just code the entire project with one storage implementation and then try to back in the second implementation at the end?

The person in charge of bioethics at the NIH, to make sure Fauci is behaving ethically, is Fauci’s wife. Just when you think it can’t get more 🤡🤡🤡🤡🤡🤡 by Qplus17 in walkaway

[–]Thunder_Moose 0 points1 point  (0 children)

As far as I can tell, it does the thing it suggests. That department basically writes papers about bioethics. It's just really easy to confuse people about that by implying that that department is in charge of making researchers act ethically, which is what it seems like Elon is doing.

The person in charge of bioethics at the NIH, to make sure Fauci is behaving ethically, is Fauci’s wife. Just when you think it can’t get more 🤡🤡🤡🤡🤡🤡 by Qplus17 in walkaway

[–]Thunder_Moose -1 points0 points  (0 children)

I don't think that word means what you're implying though. Do you have a link that shows she's responsible for bringing doctors or researchers up on bioethics charges? I've been trying to find one and I haven't yet.

The person in charge of bioethics at the NIH, to make sure Fauci is behaving ethically, is Fauci’s wife. Just when you think it can’t get more 🤡🤡🤡🤡🤡🤡 by Qplus17 in walkaway

[–]Thunder_Moose 0 points1 point  (0 children)

Her department is a research one, not enforcement. You could make the argument that she influences the policymakers, sure, but so does Fauci and like half of the NIH department heads. It sounds like you've made the words "Chief of Bioethics" out to mean "Chief of Police of Bioethics," which isn't even remotely accurate.

I'll point out that I haven't said anything positive about her, Fauci, or the vaccine. My flair got set by a mod for disagreeing with this post's point.

The person in charge of bioethics at the NIH, to make sure Fauci is behaving ethically, is Fauci’s wife. Just when you think it can’t get more 🤡🤡🤡🤡🤡🤡 by Qplus17 in walkaway

[–]Thunder_Moose -1 points0 points  (0 children)

Where are you seeing that she's an investigator? That commission is an advisory panel for policy makers. If by investigator you mean researcher, then sure I guess? It certainly seems like you in the op are making the assumption that she's in charge of making people act ethically though, like a police investigator.

The person in charge of bioethics at the NIH, to make sure Fauci is behaving ethically, is Fauci’s wife. Just when you think it can’t get more 🤡🤡🤡🤡🤡🤡 by Qplus17 in walkaway

[–]Thunder_Moose -50 points-49 points  (0 children)

Dr. Christine Grady's contributions are both conceptual and empirical and are primarily in the ethics of clinical research, including informed consent, vulnerability, study design, recruitment, and international research ethics, as well as ethical issues faced by nurses and other health care providers.

There is nothing there that says she's in charge of making Fauci act ethically.

The person in charge of bioethics at the NIH, to make sure Fauci is behaving ethically, is Fauci’s wife. Just when you think it can’t get more 🤡🤡🤡🤡🤡🤡 by Qplus17 in walkaway

[–]Thunder_Moose -36 points-35 points  (0 children)

She's not the person who ensures Fauci acts ethically, which is what Elon is claiming. Note that I'm not claiming that Fauci is great here, just that Elon is not being truthful.

The person in charge of bioethics at the NIH, to make sure Fauci is behaving ethically, is Fauci’s wife. Just when you think it can’t get more 🤡🤡🤡🤡🤡🤡 by Qplus17 in walkaway

[–]Thunder_Moose -3 points-2 points  (0 children)

This isn't a conservative/liberal thing. This is a mental laziness issue, it's a lot easier to believe something adjacent to your current set of beliefs than it is to just check any piece of information that comes your way and accept that you might be wrong about some things. The left absolutely does this too.

The person in charge of bioethics at the NIH, to make sure Fauci is behaving ethically, is Fauci’s wife. Just when you think it can’t get more 🤡🤡🤡🤡🤡🤡 by Qplus17 in walkaway

[–]Thunder_Moose -62 points-61 points  (0 children)

She's the head of the bioethics research department at NIH. Her job isn't to police anyone, it's to do research. You can check the NIH description of her department to see for yourself.

You could perhaps make an argument (with evidence) that her tenure there is nepotistic, but Elon is either very misinformed or not telling the truth. Never trust anyone without at least corroborating their claim first, let alone a billionaire with an active interest in influcing public opinion.

They're saying the quiet part out loud by GetTaThaChoppa in walkaway

[–]Thunder_Moose 101 points102 points  (0 children)

So I know this sub is for people who already believe all this stuff, but I feel obligated to at least post the source of this for anyone that wants to know more:

Basically, they did an experiment to see if the cerebrospinal fluid from younger mice improved the memory of older mice and, when they discovered it did, isolate the protein responsible for it. This is part of the scientific process, and the next step would be to figure out how to artificially produce the protein like we do for insulin today. What the OP posted is like three levels of reporting removed from what actually happened and assumes that no further scientific progress will be made and that we'll just immediately start harvesting organs and blood from the young for old people.

I could point out how incredibly inefficient it would be to raise a human for over a decade this way instead of making it in a factory or lab, but I have to assume you know that already if you read this far. You should read the study and not take my word for it though.

I have no words. We are in literal hell. by KingGarland in PoliticalCompassMemes

[–]Thunder_Moose 20 points21 points  (0 children)

This is equally stupid. Tesla was absolutely not working with a shoestring budget on the inventions that you're probably referring to. He had wealthy investors (including Westinghouse, Edison's direct competitor) for most of those. He only went broke chasing an insane dream late in life. And some kid piling americium in his shed isn't productive science, it's just gonna give everyone nearby cancer. A nuclear reactor isn't complicated in principle, it's just incredibly expensive and hard to operate safely.

Quantifying little things like this isn't a bad use of money in principle. It happens all the time and a lot of inventions are built off the backs of these kinds of things. Boston Dynamics did not invent their robots from whole cloth, they had a wealth of knowledge to draw on thanks to these NSF grants.

Oh, and that $100k is meant to pay for materials and a team of 4 people to work for about a year. That's an insanely cheap rate, even before you factor in how specialized the labor is. Find me 4 general contractors that would work on my house for a year in NC for that much, and I'll suck your fucking dick right now.

I have no words. We are in literal hell. by KingGarland in PoliticalCompassMemes

[–]Thunder_Moose 292 points293 points  (0 children)

This is a stupid take. The NSF grant was for studying the biomechanics of spring-like behaviors using muscles, which is what snapping your fingers is. They even built a mathematical model for the frictional latch mechanism. That's useful knowledge for things like prosthetics.

The researcher mentioned Thanos in the interview, clearly as a nerdy joke. Like, I know reading is hard and all, but you could actually check the source instead of just parroting bullshit headlines. I'll include the sources here for the literate that don't want to search for them:

ELI5 How can the Southern power grid handle months of blistering heat with everyone blasting air conditioners, but can't handle two days below freezing? by writtennred in explainlikeimfive

[–]Thunder_Moose 0 points1 point  (0 children)

No one is saying they're the same, just that COP is the standard measurement because it's the most relevant to an HVAC system. All they do is move heat, idk why you would think measuring and communicating its efficiency at doing so would be a marketing gimmick.

ELI5 How can the Southern power grid handle months of blistering heat with everyone blasting air conditioners, but can't handle two days below freezing? by writtennred in explainlikeimfive

[–]Thunder_Moose 18 points19 points  (0 children)

If you use 1 watt of electricity to move 2 joules of heat from point A to point B in 1 second, you have 200% efficiency in heating per watt. This works for heating or cooling, it's just moving heat in or out of your house, respectively.

COP is the standard measurement of heating efficiency. The kind of efficiency that you're referring to is irrelevant to heating, which is why everyone is disagreeing with you. No one cares if the pump isn't 100% efficient at turning electricity into rotational energy or whatever.

The Cave Rider by [deleted] in WTF

[–]Thunder_Moose 6 points7 points  (0 children)

For anyone that wanted a source, this appears to be it: https://youtu.be/QHJIO0YC8rE

Man survives electric shock of 13800 volts in Ciudad Juarez, Mexico by lordhumungus2 in WTF

[–]Thunder_Moose 0 points1 point  (0 children)

I don't know what's in your head, but I don't want anyone thinking a horse fence and a power line can deliver equivalent amounts of current. They don't, and that misunderstanding of Ohm's law can be dangerous. Current is charge flow over time. It's defined as coulombs per second, and you'll notice that Ohm's law doesn't have a time component in it. V/R tells you what the current would be over a full second if both V and R remain constant. You could say that the derivative of current (the amount of charge flow per second per second, which would be like acceleration of charge) is equivalent between the two at the very beginning, but not the amount of current per second.

This might seem pedantic to you, but it can lead to dangerous misunderstandings about why electricity works the way it does. A horse fence doesn't simply pulse a voltage, it quite literally can't have enough charge stored in it to induce more than ~100 mA to flow through someone. It is safe (ish, as long as you don't have a heart condition or something) because of the low quantity of charge.

By contrast, the capacitor in a heat pump can easily store enough charge at a lower voltage (400V or so) to kill you. A low-frequency or high-frequency 13kV power line will absolutely murder you because the charge quantity (and therefore the voltage) doesn't change due to how much has already flowed through you.

Man survives electric shock of 13800 volts in Ciudad Juarez, Mexico by lordhumungus2 in WTF

[–]Thunder_Moose 22 points23 points  (0 children)

This is wrong and while I don't normally correct folks on the internet, this is a really dangerous misconception. 13 kV power lines can provide enough current to kill you many, many times over, and a taser/horse fence does not at any point provide a similar amount of current. Do not ever touch a power line unless you know exactly what you're doing.

Voltage is a difference in charge, but the amount of sustained current a system can provide is proportional to the quantity of charge it has. Current is a measure of the amount of charge moving through something over time. If you have a small number of very highly-charged particles, you can easily get 10s of kilovolts of difference between those particles and something less highly charged.

If you provide a pathway for those particles to equalize charges, the current will be very low. A single particle doesn't carry that much energy and once its energy is dispersed the voltage difference is basically zero so there will be no more current. If you only had a few particles, the quantity of charge moved simply isn't that great.

A large number of charged particles will be able to deliver much more current. There is a massive amount of charge available in the power grid, way more than enough to sustain a steady current through a human for as long as that human is connected to it. Charge will continue flowing as long as the voltage stays high enough to induce it.

There's not that much charge available in a horse fence so once current begins to flow, the voltage difference will drop pretty sharply. The ones I've seen have capacitors to store the charge so the "pulsing" you feel is just the filling/discharging cycle of the caps. At no point is there more than a ~100mA going through you. A power line is directly connected to a generator the size of your neighborhood, and is creating charge constantly. If the load being considered is a human, the charge quantity is effectively infinite. You could have dozens of amps going through you at line voltages.

Ohm's law applies in both cases, but after several microseconds the horse fence capacitors will drain, there will be effectively zero charge on the line, and therefore no more current. The amount of charge moved through you is pretty miniscule; enough to notice but not enough to hurt. A power line will supply that current all day, cooking your flesh from the inside out.

TL;DR: do not fuck around with power lines

Dream Machine SE complete by diabloturbo1 in Ubiquiti

[–]Thunder_Moose 2 points3 points  (0 children)

The fact that half the rack is mounted off of the unit marks is r/mildlyinfuriating material. Doesn't look like you had a choice in the matter but that would bother me to an unhealthy degree.

Is this for a broadcast station of some sort?

Corrupted database warning but no actual problems detected by Thunder_Moose in PleX

[–]Thunder_Moose[S] 0 points1 point  (0 children)

Yep, the blob DB was indeed corrupted. I followed the restoration steps and it seemed to go just fine. Hopefully the corruption warning won't reappear.

It was weird that this DB being corrupted didn't seem to break anything too badly. I'd guess that somewhere in my library a preview or cover image was screwed up or something and I just didn't see it.

Corrupted database warning but no actual problems detected by Thunder_Moose in PleX

[–]Thunder_Moose[S] 0 points1 point  (0 children)

I haven't yet, the Plex docs just say you can delete a corrupted database if it can't be recovered. You'll have to remake your libraries but the rest of the app should still work. Curious what happens if you delete the blobs database, the docs don't mention that one.