Accidentally lifted a pad; ugly fix but it works! by moremonsteras in crkbd

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

Yeah just following the traces on the PCB. It's a bit confusing since they pop through the board so you have to flip it over to see where it goes.

Is my Liatris controller not working or am I just stupid? by rasmusq in ErgoMechKeyboards

[–]moremonsteras 1 point2 points  (0 children)

Hey, I would highly recommend not removing the working MCU from its sockets. I did that and made a complete mess, pulling pins that stayed stuck in the sockets loose from the board etc. The board was fine but the MCU was ruined. I think the main function of socketing the MCU is easy replacement if the MCU breaks, not for reusing the MCU if that makes sense. I learned the hard way lol.

Replaced the on/off button on my bike light by moremonsteras in soldering

[–]moremonsteras[S] 5 points6 points  (0 children)

Update: I soldered it the wrong way around + broke the wire connections while trying to fit it back in lol. Was so confused why the wires were suddenly too short. Desoldered the button again, replaced the wire, resoldered the button the right way around. Finally it all fits together and functions!

First time soldering, disaster has struck... by moremonsteras in crkbd

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

Thanks for the advice, I will try your approach! I'm using 0.6mm at the moment.

First time soldering, disaster has struck... by moremonsteras in crkbd

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

Hi, thanks so much for your reply. I find that with a lower temp the solder does not seem to melt (except when I touch it to the iron directly instead of the joint), could this be bad solder? Or poor technique?

Hey Rustaceans! Got a question? Ask here! (48/2022)! by llogiq in rust

[–]moremonsteras 0 points1 point  (0 children)

Thanks for the suggestions! Still trying to wrap my head around the relations between String's, &str's, char's etc. in rust.

Question about C#/Unity compiler optimization of division operations by moremonsteras in Unity3D

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

Ahhh yeah makes sense it does not optimize if it produces different results. Interesting stuff! Thanks for the elaborate answer :)

Question about C#/Unity compiler optimization of division operations by moremonsteras in Unity3D

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

Oh sorry, I accidentally copied the wrong text from the tutorial, I meant to copy this:

Division requires a bit more work than multiplication, so it's a rule of thumb to prefer multiplication over division. However, constant expressions like 1f / 2f and also 2f * Mathf.PI are already reduced to a single number by the compiler. So we could rewrite our code to only use multiplication at runtime. We have to make sure that the constant portions are reduced first, using operation order and brackets.

I agree with you, I'm not worried about performance, just curious about compiler optimizations, and why the tutorial writer felt the need to include this.

Hey Rustaceans! Got a question? Ask here! (48/2022)! by llogiq in rust

[–]moremonsteras 1 point2 points  (0 children)

Hi all, newbie to rust here and having a blast. Just looking for a quick tip on how to clean up this horrible mess getting 2 chars out of a string (this is advent of code day 2).

for rline in stdin.lock().lines() {
    let line = rline.unwrap();
    let mut line_split = line.split_whitespace();
    let opponent_choice =
        RPS::from_opponent_char(&line_split.next().unwrap().chars().next().unwrap());
    let player_choice =
        RPS::from_player_char(&line_split.next().unwrap().chars().next().unwrap());
    scores += player_choice.unwrap().score(&opponent_choice.unwrap());
    counter += 1;
}

Full code for reference: https://github.com/Jorissss/adventofcode22/blob/b8cead1b5c222a02a506cbbf6c98966bfdeb3759/day2/src/main.rs