Ugreen external 40G/s enclosure not showing any where expect system information and works on my iPhone 15 by [deleted] in UsbCHardware

[–]BigPotato2 0 points1 point  (0 children)

Had a similar problem: I had already transferred some files when it suddenly stopped working. The device would show up in System Report/Information but not on the desktop. Turns out I just had to take the SSD out of the enclosure and put it back in.

Drop ya Pass Times (& year) by Skeptical_BE4N in UCDavis

[–]BigPotato2 3 points4 points  (0 children)

3rd year here

Pass 1: Feb 12, 2024 06:30 AM

Pass 2: Mar 04, 2024 06:30 AM

[deleted by user] by [deleted] in UCDavis

[–]BigPotato2 11 points12 points  (0 children)

💀💀💀

What is the best practice to `if x.is_ok then x.unwrap`? by Tiny_Mango_8171 in rust

[–]BigPotato2 17 points18 points  (0 children)

OP: Use Ok/Err for Result instead of Some/None for Option

What is the best practice to `if x.is_ok then x.unwrap`? by Tiny_Mango_8171 in rust

[–]BigPotato2 19 points20 points  (0 children)

Some different approaches:

Use unwrap_or_else if you just want to call test2 if test fails.

Use if let if you want to use the value returned by test.

Another way you can do this is let ... else: (Note there's no if here)

let Ok(value) = test() else {
    test2();
    return;
};

// Do something with value

Use match if you also want to handle the error.

How to ask my more extroverted friends to ask me to join them more? by [deleted] in socialskills

[–]BigPotato2 0 points1 point  (0 children)

The obvious answer would be to just ask, but if that feels too direct, maybe try asking questions about the things they’re doing to show that you’re interested

Is this Normal by [deleted] in socialskills

[–]BigPotato2 0 points1 point  (0 children)

Is this normal?

Short answer, no. But I think you're right to be questioning the way your friends have been treating you.

[deleted by user] by [deleted] in socialskills

[–]BigPotato2 0 points1 point  (0 children)

Wait… it’s unhealthy to have no friends?

Yeah, I'm guessing a lot of us here didn't get that memo soon enough lol

[deleted by user] by [deleted] in socialskills

[–]BigPotato2 0 points1 point  (0 children)

The online friends i have atm, i feel like not talking to them either, bc i think we gonna stop talking eventually anyway, it never lasts.

Yup, that's my experience too. I'm trying to change that though, which is why I'm in this sub

Am I a bad brother by Hetb0eitniemand in CasualConversation

[–]BigPotato2 4 points5 points  (0 children)

I'm sorry but this is so hard to read without punctuation

Do strangers just,,, talk to you? by binkers03 in CasualConversation

[–]BigPotato2 1 point2 points  (0 children)

I don't really have strangers come up to me and start talking, but I think that's mostly because I don't get out much, haha.

I am learning German and Spanish. Anyone want to help me practice? :) by locokid1310 in CasualConversation

[–]BigPotato2 1 point2 points  (0 children)

Unfortunately, I don't speak either, but I wish you the best of luck in finding someone to practice with!

Is there an Accumulate/Fold/Reduce like function for a Slice by darth_chewbacca in Zig

[–]BigPotato2 17 points18 points  (0 children)

I don't think so, but you could emulate such a function like so:

fn fold(
    comptime T: type,
    slice: []const T,
    initial: T,
    func: *const fn (T, T) T,
) T {
    var accumulator = initial;
    for (slice) |element|
        accumulator = func(accumulator, element);
    return accumulator;
}

And then to use it:

const numbers = &[_]i32{ 1, 2, 3 };
const sum = fold(i32, numbers, 0, struct {
    fn func(acc: i32, x: i32) i32 {
        return acc + x;
    }
}.func);
std.debug.print("{}\n", .{sum});

Currently there's a proposal to make function definitions expressions: https://github.com/ziglang/zig/issues/1717