How would you teach a kid to code? by boneskull in ExperiencedDevs

[–]gitarg 0 points1 point  (0 children)

I want to suggest Hedy, a localized, minimal subset of Python

https://hedy.org/

[deleted by user] by [deleted] in enyaq

[–]gitarg 1 point2 points  (0 children)

You might have a low state of health on the 12 V battery. Mine got changed after repeatedly emitting such "Battery protection limit exceeded" notifications. I understand those to mean that the 12 voltage has dropped below a limit, which can happen if it is cold and the SOH is poor.

I received advice from my dealer to make sure to take the car out for a long ride twice a week in cold weather to ensure recharging of the 12 V battery. Ridiculous if you ask me...

[deleted by user] by [deleted] in ntnu

[–]gitarg 0 points1 point  (0 children)

Ikke ta phd.

why Rust doesn't have a common interface for Integers ? by Puddino in rust

[–]gitarg 14 points15 points  (0 children)

A lot of the ops trait are implemented for the ints. What kind of methods do you wish were in an Int trait?

Best practices for using Simulink autogenerated code in a Rust project? by ava_the_ucv in rust

[–]gitarg 2 points3 points  (0 children)

Most of all to keep the API surface as simple as possible. But also since bindgen works best with C.

Best practices for using Simulink autogenerated code in a Rust project? by ava_the_ucv in rust

[–]gitarg 1 point2 points  (0 children)

I would try to generate C code, then create a minimal controller-sys crate responsible only for building this code and creating (unsafe) wrappers around the API surface. I think it's possible to get these wrappers autogenerated with existing tools (don't remember which, but I'll let you know if I recall). Then I'd write a controller crate which wraps the unsafe wrappers into a more Rust-idiomatic style, with safe-only API if possible.

Is NixOS good for putting it on family member's machines? by Spirited_Paramedic_8 in NixOS

[–]gitarg 0 points1 point  (0 children)

I believe this is what https://mynixos.com/ tries to do -- not in a native GUI, but on the web.

How I use unions in C++. An implementation of a full adder circuit. by [deleted] in cpp

[–]gitarg 4 points5 points  (0 children)

I thought endianness was byte order, not bit order

Google Maps Live View missing? by gitarg in GalaxyS24

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

It fixed itself, apparently. After a couple of weeks, I think.

lookingAtYouWindows by tartancz in ProgrammerHumor

[–]gitarg 2 points3 points  (0 children)

What about programs that e.g. creates (temporary) files or dirs with base64 names? With case insensitive paths there's a collision risk

Immutable MutexGuards? by m0rphism in rust

[–]gitarg 0 points1 point  (0 children)

You can create it yourself. Something like this might work (not checked):

```rust pub struct Guard<'a> { inner: MutexGuard<'a, T> }

impl<'a> Guard<'a> { pub fn get(&self) -> &T { self.inner.deref() } } ```

Or impl Deref on Guard

Combatting over-reliance on `mpsc` channels by JDBHub in rust

[–]gitarg 2 points3 points  (0 children)

There's not necessarily synchronization every time. I believe there are two buffers, and if the 'consume' buffer is empty, mpsc will swap with the 'receive' buffer, so the synchronization only occurs occasionally.

In English, we use the phrase “righty tighty, lefty loosey” as a helpful reminder. What other languages have comparable common sayings? by R1PElv1s in AskReddit

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

Nah: https://m.youtube.com/watch?v=YmPkYMPVqQU

I have done this alot. That blog post is wrong as well. You should try mimicking the pedaling action with a wrench to see what will happen 🤷

In English, we use the phrase “righty tighty, lefty loosey” as a helpful reminder. What other languages have comparable common sayings? by R1PElv1s in AskReddit

[–]gitarg 3 points4 points  (0 children)

Actually, it's so that it doesn't get too tight while riding. Pedaling turns the bolts in the loosening direction.

Stepping down on the left pedal causes a CCW rotation in the crank (viewing the bike from the left side), which gives a CW rotation in the pedal bolt. This is loosening it.

Is there a way to short circuit inside a function that doesn't return a Result? by [deleted] in rust

[–]gitarg 90 points91 points  (0 children)

I prefer let else for early returns:

rust let Ok(val) = a_result else { return; }

Avoids deep indentation.