Zerthz
Explore posts from serversKPCKevin Powell - Community
•Created by Zerthz on 4/10/2024 in #front-end
How to efficiently validate multiple properties
This could go in backend just aswell I realize. I will try to be a bit generic because I think the issue is not tightly coupled to my specific issue but more of a pattern that one can do.
I have an object, It has a bunch of properties. I want to check if certain properties have a truthy value. What I do now is I just have a bunch of if statements that go through all the properites I want to check. And add a message to an array.
I feel like there should be a better way to do it, some kind of pattern matching, or something. That's not as gross as what I am doing and is more maintainable. But not sure how to even start searching for it so I ask you guys if you have tips.
2 replies
KPCKevin Powell - Community
•Created by Zerthz on 4/3/2024 in #front-end
Img or Svg element?
Say you have a Figma where the designer have created icons and such. Do you prefer to export them to svg and use them inside an <img /> element with the src pointing to the file, or do you prefer to extract the path and use the <svg> directly like that?
It feels like you get more control with svg tag since you can recolour etc, but it also clutters things to have the paths and all?
10 replies
MVC model binding issues
Hello,
I got some issues with model binding for my MVC endpoint. All doubles fail and become 0/null.
I went into the model state to check what was wrong, and it said that it had an invalid value. The value had a period in it as the separator. I copied the exact value the model state said was invalid and placed it into the local and it was accepted no problem.
Have anyone seen an issue like this? What would you recommend to deal with it, a custom binder?
6 replies
KPCKevin Powell - Community
•Created by Zerthz on 2/27/2024 in #front-end
Is is wrong or bad to add padding to represent hierarchy in tables?
I got data that is a list of items, got a name and category. Each item could have children, with name and categories there too. And I would like to show all of them. I was thinking of adding a left-padding on the children, making them indented.
Am I thinking about this wrong? Is there a better way?
11 replies
KPCKevin Powell - Community
•Created by Zerthz on 1/24/2024 in #front-end
Overflow-x auto causes button to flicker
4 replies
KPCKevin Powell - Community
•Created by Zerthz on 12/19/2023 in #front-end
How do you go about creating things like this CSS or just a svg?
10 replies
KPCKevin Powell - Community
•Created by Zerthz on 11/27/2023 in #front-end
Placing your content centred, not as obvious as imagined
The reason why I'm even asking this is because of the last few videos Kevin made about widths and about rethinking wrappers/containers.
The webapp I'm working on now is a bingo board that I would like to place centered, which typically I would just give it a width and slap a margin auto on it. Or something like that.
These last few videos got me thinking if there's a better, more "correct" way to do it.
4 replies
KPCKevin Powell - Community
•Created by Zerthz on 10/19/2023 in #front-end
Best way to create this effect
10 replies
❔ Architecture when using external API
Howdy,
I got an application, and it's going to make a call to an external API, get back a response. Take that response and transform it to the models I use for my application. Pretty straight forward stuff.
Worth noting, my Application is 3 layers, the main Application Layer a WebApi project, a domain layer with all my models and such, and the data layer for all my data needs.
My issue comes from the fact that the response the external API provides is this massive object with a lot of nested objects etc. And I don't really like that it can leak into other things.
I'm not sure if it's better to break it out into it's own class library, sort of putting it on an island so it's probably gonna stay isolated.
Or if it's better to go in and rename all the classes in the response model to sort of "tag" them with the API it's calling, so that they're distinct and not leaky?
With Leaky I mean that I have a "Comic" class for my application, but this response object also wants to have a "Comic" class so it gets gross. But I could name the response like ApiComic or whatever?
What is a good way to deal with this?
11 replies
✅ implementing OneOf with Repository pattern
Hey,
I'm using a repository pattern where my repos do all the communication with databases. Nothing special. I'm wondering if my repos should know about the OneOf nuget package or if that's for the service to deal with? So that the service maps whatever the repo says to a oneof type
9 replies
❔ Visual Studio 22 not showing errors
Hey, I'm running c# in Visual Studio 22.
The issue now is that it's not showing error squigglies even with the setting turned on. It's also not giving me the option to implement interfaces from quick refactors.
I've reset all settings to general default, with the reset settings tool. Still doesn't work.
Anyone seen this issue and how to fix it?
5 replies
SignalR ConnectionManager Singleton
Hey, does anyone have any experience creating a ConnectionManager for SignalR? Right now I feel like I have to create my connection and all immediately in the program.cs (I am new to signalR). But I don't like that at all. However if you create a singleton of the connection, does it subscribe still? where do you put all those events? The same place you run start.async()?
6 replies
Read a file line by line and append to a Blazor element
So I'm trying to create the same effect as a console executing and text scrolling up line by line pretty fast. But have it in the web via Blazor. Any idea how to make this effect? I'm not trying to have an interactive console just make the output look like one.
When doing it in the console I use the StreamReader on the file, and use Console.Writeline(); not sure what I would do for blazor. Maybe still StreamReader and put it into a list that I do a foreach on?
3 replies