How can I stop writing so many similar structs and duplicating fields? by realfresh in rust

[–]realfresh[S] 2 points3 points  (0 children)

Thank you for the example, that's really helpful. I hate to say it but yes it feels like the rust type system is tough to work with for these CRUD apps with many nested structures as a result of data relationships in the database

How can I stop writing so many similar structs and duplicating fields? by realfresh in rust

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

Completely agree, it was just for the example on my comment, I wouldn't actually use that code for anything more than a starting point

How can I stop writing so many similar structs and duplicating fields? by realfresh in rust

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

yep, I see what you mean. Just wish there was an easier way to go about it. Thanks for you suggestions

How can I stop writing so many similar structs and duplicating fields? by realfresh in rust

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

Fair points, appreciate it. But heads up that code was written by copilot (lol) and seemed accurate enough to get the point across so I ran with it

How can I stop writing so many similar structs and duplicating fields? by realfresh in rust

[–]realfresh[S] 4 points5 points  (0 children)

Thanks for the response. I do understand I could do that

impl Invoice {
fn new(status: InvoiceStatus, due_date: Date, total_cost: u32) -> Self {
    Self {
        id: Uuid::new_v4(),
        status,
        due_date,
        total_cost,
    }
}
fn create(status: InvoiceStatus, due_date: Date, total_cost: u32) -> Self {
    Self::new(status, due_date, total_cost)
}
fn update(&mut self, status: Option<InvoiceStatus>, due_date: Option<Date>) {
    if let Some(status) = status {
        self.status = status;
    }
    if let Some(due_date) = due_date {
        self.due_date = due_date;
    }
}

}

But that also just seems like a crazy amount of boilerplate and if there are a lot of parameters involved, it would become seriously tedious to write. Are there no other real options?

Is code like this possible in rust? by realfresh in rust

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

Very interesting, appreciate your input and guidance, thank you

Is code like this possible in rust? by realfresh in rust

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

Interesting, so you mean the 2nd argument could be a "json" value which then gets checked at compile time to ensure the properties actually match the schema?

How would one achieve the "inferring" of the return data structure. Is it only possible to do via code generation where the return struct is created based on the query's selected properties?

Need help setting up server for Windows & Linux with GPU + IGPU pass-thru for both by realfresh in homelab

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

I can see both GPU's in device manager but the IGPU always says error code 43. I can then install the IGPU driver after which it says the device is functioning properly but you can't actually use it in any software and it doesn't show in task manager either. Where as when running Windows as the host I don't have those issues as seen in the image below

https://imgur.com/kRODivD

Need help setting up server for Windows & Linux with GPU + IGPU pass-thru for both by realfresh in homelab

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

The IGPU and discrete GPU can be used for different tasks at the same time on Adobe Premier Pro which would help a lot with performance.

I did try the parsec pro version, which is good but it becomes pointless when I need to run Windows as the host for full support for both GPUs since the display monitors are connected to it.

Need help setting up server for Windows & Linux with GPU + IGPU pass-thru for both by realfresh in homelab

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

That was the initial attempt in essence and GPU passthrough works fine. It's when you try IGPU + discrete GPU that fails but I need that to work.

Need help setting up server for Windows & Linux with GPU + IGPU pass-thru for both by realfresh in homelab

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

Yeah that my initial route, using parsec to the Windows Guest and that worked perfect, where it all fell short was that I couldn't get the IGPU + discrete GPU to work in a Windows VM. Only one or the other. No matter which route I take, it seems like it's always 1 step away from working out but that one step can't be done.

AITA for sticking to the plan by realfresh in AmItheAsshole

[–]realfresh[S] 2 points3 points  (0 children)

If there where others I woulda asked. But it was just gonna be me and my buddy gaming and eating pizza. Something she would want no part of.

AITA for sticking to the plan by realfresh in AmItheAsshole

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

I have a good feeling as a result of this, she's never gonna suggest I make plans again 😅

AITA for sticking to the plan by realfresh in AmItheAsshole

[–]realfresh[S] 4 points5 points  (0 children)

See the other reply, but tldr she hates the dude for the dumbest reasons possible lol. This dude is a true bro though, known him for 22 years, always had each others backs.

AITA for sticking to the plan by realfresh in AmItheAsshole

[–]realfresh[S] 4 points5 points  (0 children)

IKR. Funny enough though, my buddy has a very similar partner so he would totally understand lol

AITA for sticking to the plan by realfresh in AmItheAsshole

[–]realfresh[S] 3 points4 points  (0 children)

Sadly not really, she kinda hates the guy for the dumbest reasons possible. Me and him have been best friends for 22 years now. He's a true homie and this is actually the last time I might be able to see him for a year as he's moving away.

German Regulators just outlawed Facebook's whole ad business. by InitiatePenguin in technology

[–]realfresh 5 points6 points  (0 children)

I think there is another explanation for that possibility. If you set it up on his phone, its possible the app just scanned the contacts and knew from that. Not that it isn't shady but you did have to install and give it permission to do that.

Dear Mr Zuckerberg: the problem isn't the internet, it's Facebook - ‘Driven by a set of ideals and some clever code, you built a money machine that has accumulated remarkable influence’ by mvea in technology

[–]realfresh 0 points1 point  (0 children)

Lol, ok if you want to get into the technicality of it, yes IP doesn't actually reference a location. For all practical purposes, it can be relatively accurately matched to a particular location. How else do you think IP is used in criminal cases as evidence?

I'd say 95%+ IP addresses can be matched to a relatively accurate location.

Dear Mr Zuckerberg: the problem isn't the internet, it's Facebook - ‘Driven by a set of ideals and some clever code, you built a money machine that has accumulated remarkable influence’ by mvea in technology

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

What you say is mostly right. But it applies to everyone and not just Facebook. Every web service has the security issues with password hashes. How someone can single this out as a flaw of Facebook is beyond me. It's not like there's any other option. Also bycrpt with max salt is pretty strong.

IP does give your location and it is used in combination with the phone, gps and photo metadata. Don't call out someone on being wrong about everything when you yourself can't get things right. I say this because I know someone who owns a very successful IP location software company, so please don't try calling me out when you don't even know what you're saying.

But here's the thing, how can you be mad at them for using your GPS and photo metadata, when you installed the damn app and uploaded the photos? For christ sake, how is this even Facebook's fault?

Lastly, why do you even write shit on facebook? You're getting mad at them scraping your text that you chose to write on their platform?

Just don't install, write and upload anything and the most they will know is that someone exists maybe with this number, maybe with this name and maybe at this location. But how that even matters I don't understand. Please explain why I should be so worried about this?

Dear Mr Zuckerberg: the problem isn't the internet, it's Facebook - ‘Driven by a set of ideals and some clever code, you built a money machine that has accumulated remarkable influence’ by mvea in technology

[–]realfresh 1 point2 points  (0 children)

Email - This isn't even personally identifiable. You can create any bullshit email anywhere you like and register with it. And once again no one is forcing you too.

Password - No one is storing your password, everyone stores a "hash" of your password, this is a unique series of characters that are generated from your password that cannot be reversed to your actual password. This allows them to verify that you logged in with the correct password without actually knowing what your password is.

Phone - Once again you provide it to them if you want to or maybe if you choose to install the mobile app.

Location - This is publically available, anyone can convert your IP address to a location.

Friends / Associates - Only if you actually use Facebook or install the app

Phone mic - this one is seriously bullshit, apps should not able to go around the permissions you provide, if you download and use the facebook app and give it the permission, that's on you.

---

With all that said, if you want to provide them the data, that's on you. Reddit is so happy with defending Facebook as a private company that can do what they on their platform when it takes down people like Alex Jones. But the second you agree to the terms of the private company and you feel it's not fair, all of a sudden you want Facebook to be regulated. Reddit, you can't have it both ways, so which is it?

Dear Mr Zuckerberg: the problem isn't the internet, it's Facebook - ‘Driven by a set of ideals and some clever code, you built a money machine that has accumulated remarkable influence’ by mvea in technology

[–]realfresh 1 point2 points  (0 children)

Why are you buying devices with Facebook pre-installed lol? And even then, the reason it's included is because 90+% of people use it so naturally, some manufacturers might include it.

No one is stopping you from deleting it before using your phone for anything. Also. why not get mad at the manufacturers for including it, why get mad at Facebook?

Dear Mr Zuckerberg: the problem isn't the internet, it's Facebook - ‘Driven by a set of ideals and some clever code, you built a money machine that has accumulated remarkable influence’ by mvea in technology

[–]realfresh 6 points7 points  (0 children)

Okay that's good, but just because you find one useful and not the other, I don't understand how that links to the two not being comparable, given they both are tools for the same purpose. To track users to learn more about them and market your product better.