The Fog from Human Resources
The Fog from Human Resources
Explore posts from servers
CC#
Created by The Fog from Human Resources on 11/15/2024 in #help
How and what to Test
I'm trying to become a more professional developer so I'm adapting to best practices and all that But recently i wanted to get into Unit testing my C# applications but ran into an issue: I have no idea what to even test in the first place, for example what if i develop a desktop applications, a Discord bot, a web API using ASP.NET or even a library, Id love to write Unit tests but i have absolutely 0 clue what to actually test someone send help :SCcrying:
14 replies
DIAdiscord.js - Imagine an app
Created by The Fog from Human Resources on 11/13/2024 in #djs-questions
npx create-discord-bot generates broken code
I'm picking up Discord.JS in order to expand my choices for clients, so I figured I should take a look at Discord.JS, however when i run npx create-discord-bot and say yes to Typescript, it will create a project with broken code in src/util/deploy.ts it says Argument of type 'RESTPostAPIApplicationCommandsJSONBody[]' is not assignable to parameter of type 'RESTPutAPIApplicationCommandsJSONBody on const result = await api.applicationCommands.bulkOverwriteGlobalCommands(process.env.APPLICATION_ID!, commandData);, its the commandData part that is showing the issue, I have no clue how or why this happens, for context I originally come from Discord.NET which pretty much hides away the entire command registering behind its RegisterCommandsGloballyAsync function
10 replies
CC#
Created by The Fog from Human Resources on 9/24/2024 in #help
How to handle account registrations with Firebase and ASP.NET Identity
So im currently building a large scale project and had a question about Authentication with Firebase while using ASP.NET Identity Someone on here already gave me a code snippet that configures my Authentication to use Firebase to check the session, but now I have a question about how i would handle user registrations and logins to for example create a login history entry or simply create a user in my database
2 replies
CC#
Created by The Fog from Human Resources on 9/19/2024 in #help
Use Custom Attributes with ASP.NET Identity
So recently i got into ASP.NET Identity with all the auth stuff so i can write more robust backend software But now i have a question, the way id like to handle permissions for users is by enabling scopes on them for example account.manage or profile.view for example, now in my backend id like to have have a middleware/attribute like [RequireScope("account.manage")] which uses the Authenticated user to see its scopes so now i have 2 questions 1. is it even a good idea to do it like that, if no what are my alternatives? 2. how can i implement this properly
20 replies
CC#
Created by The Fog from Human Resources on 7/22/2024 in #help
Question about GraphQL
I'm working on a fairly large (mobile app) project with a friend The app itself is written in Kotlin and our backend service is written in C# using ASP.NET, we use EF Core to interact with our database, my friend has made a suggestion that we could use GraphQL for the backend service, now while I see the advantages that GQL could bring to the table I also see other things: - lots of issues that GraphQL is supposed to solve feel like are already easily done with our EF Core structure or the Model structure in general - users being able to request the data they Want sounds like a nightmare to me - single endpoint for a project this large may serve lots of disadvantages over time specially since we'd basically throw out the whole API controller thing where we can easily manage what class does what What do you guys think
25 replies
CC#
Created by The Fog from Human Resources on 7/19/2024 in #help
What are Records and why should I use them
Title says it all, what are the use cases of them over Objects?
12 replies
CC#
Created by The Fog from Human Resources on 7/8/2024 in #help
How does API versioning work
I wanted to ask for API versioning works and how to properly implement it into ASP.NET because to me api/v1 and api/v2 just seem like 2 controllers that basically have the same controllers just handled differently Is there a proper way to set this up and if yes, what's the best approach for it and how to handle a version like V1 going out if support if for example V5 rolls around
8 replies
CC#
Created by The Fog from Human Resources on 7/5/2024 in #help
What is dependency injection and when should I realistically use it
Recently I've got some critics from people saying I should not create a Helper / Utils class with a bunch of public static methods and that I should rather use DI practices for it For me my approach makes sense since my Utils are only supposed to exist once in the whole program so I can access it from everywhere So what exactly is bad about my approach?
17 replies
CC#
Created by The Fog from Human Resources on 6/18/2024 in #help
Avalonia ViewLocator not ViewLocating
I have an Avalonia project with multiple pages like MainView and LoginView and SettingsView etc, pretty standard stuff But now I have the following problem, trying to set my ViewModelBase.ContentViewModel to something will result in the ContentViewModel being null for no apparent reason The program workflow goes like this: The program starts -> the program sets the DataContext to new MainViewModel() -> MainViewModel checks if the user is logged in to an account, if not it will set ContentViewModel to new LoginViewModel(), in the LoginView the user is supposed to log into an account which is then supposed to set the ContentViewModel to a new MainViewModel(), but instead the ContentViewModel is null
9 replies
CC#
Created by The Fog from Human Resources on 6/15/2024 in #help
✅ Help with Avalonia databinding and library objects on ViewModels
Lets say I have an API Client that allows me to fetch data like chats, messages etc That API Client responds with a List of the object which i use to construct my component (in this case for example a chat with a simple name, user icon and last message sent in it) Now i bind the <ItemsControl> to my List of fetched chats and set the datatemplate to my Chat component But now in my ViewModel class for said Chat i need to access the current chat that is being used to construct my View (the chat component) so i can further manipulate and process it
87 replies
CC#
Created by The Fog from Human Resources on 6/12/2024 in #help
How to manage components with Avalonia
So Im making an Avalonia program and i was wondering how I would manage components For example I have a Views folder with my Pages / Views and a ViewModels folder where i store my ViewModel classes Now what if i wanted to create a Component that represents a message, where would i store that? And where would I store their viewmodels etc Im using a ViewLocator
3 replies
CC#
Created by The Fog from Human Resources on 6/10/2024 in #help
Styling in Avalonia
I recently got into Avalonia development and got some basics on my application done Now I need help with doing some styling, maybe animations etc Are there are good guides regarding this I should look into? Libraries and frameworks for such things also work
8 replies
CC#
Created by The Fog from Human Resources on 6/9/2024 in #help
✅ How to handle TextBox Text changing on ViewModel in Avalonia
I have multiple text boxes that are needed before being able to process, and therefore they all must be filled for the continue button to become enabled, however, i cant seem to figure out how i can write such event handler on my ViewModel, i tried using get and set but [ObservableProperty] doesnt work on that Additionally id also need to handle stuff when the selection of a ComboBox changes On google people say it works if you just put a get and set in there but as stated above it doesnt
1 replies
CC#
Created by The Fog from Human Resources on 6/8/2024 in #help
✅ Need help with docker deployment
I have an ASP.NET REST API that i want to deploy on my server but i dont understand how this works at all My image is already pushed but when i try to access my API via CURL request nothing happens Im using docker-compose on my server
version: '3'

services:
your_service:
image: ...
environment:
...
ports:
- "712:8080"
version: '3'

services:
your_service:
image: ...
environment:
...
ports:
- "712:8080"
144 replies
CC#
Created by The Fog from Human Resources on 6/4/2024 in #help
✅ Issues with Avalonia
No description
106 replies
CC#
Created by The Fog from Human Resources on 6/1/2024 in #help
Question about Avalonia
So im a beginner in Avalonia and im watching a youtube tutorial series (more specifically this tutorial) and i have a question about the Community MVVM Toolkit In my Main view im creating a SplitView with a property IsPaneOpen which has a Binding to a value called isPaneOpen, however, in my code i have a private bool _isPaneOpen = false; which has an [ObservableProperty] Attribute to it How does Avalonia know that _isPaneOpen is my binding to isPaneOpen, the same question goes for how avalonia knows that my OnButtonClick() with my [RelayCommand] attribute is the same function as my binding OnButtonClickCommand() Its a very beginner question but i wonder how Avalonia / the MVVM tookit knows what members im reffering to even tho they dont have the same name
4 replies
CC#
Created by The Fog from Human Resources on 5/29/2024 in #help
✅ How to learn XAML styling
I'm new to XAML styling in C# using WinUI 3 (id use MAUI but since I mainly focus on Windows Desktop it's overkill), coming from Kotlin Jetpack compose (for mobile apps) I have cool concepts in mind for my design and know the rough way to get there but somehow nothing works out like it's supposed to do and it's my lack of understanding how XAML styling works properly This is purely about design and not about things such as Data binding etc Also my next question is if WinUI / XAML styling has some sort of creating components that I can just Re use
85 replies
CC#
Created by The Fog from Human Resources on 5/29/2024 in #help
How does database sharding work
I understand the concept of load balancing where for example Service.myApi redirects the request to a server like s1, s2, etc.myApi or even media servers that balance the media into mulitple servers like media.myapi -> m3.myApi But in the case of the media server the data where a media file is stored, is stored in the database so it's just a matter of asking the database for such data But then how can I know what database is targeted when there is db.myapi which would have db1.myApi and db2.myApi since I can't just ask the database for data without knowing where it's stored
63 replies
CC#
Created by The Fog from Human Resources on 5/29/2024 in #help
✅ WinUI3 not compatible with my .NET 7 package
Im trying to make a small WinUI 3 application for Windows Desktop but the package required to make this happen is written on .NET 7 and apparently not compatible with <TargetFramework>net6.0-windows10.0.19041.0</TargetFramework> of my WinUI3 target, what can i do to fix this?
2 replies
CC#
Created by The Fog from Human Resources on 5/27/2024 in #help
cant connect to MariaDB
No description
7 replies