Krishna
Krishna
CC#
Created by Krishna on 12/9/2024 in #help
How to implement RateLimiting in a dotnet application that is built using .net461 framework version?
Nah, I can't do it right now.
12 replies
CC#
Created by Krishna on 12/9/2024 in #help
How to implement RateLimiting in a dotnet application that is built using .net461 framework version?
Ahh Yes, I also researched on this, there are no built in tools made. But can you suggest what would be best among below mentioned algorithms. 1. Token Bucket Algorithm 2. Leaking Bucket Algorithm 3. Fixed Window Counter Algorithm 4. Sliding Window Logs Algorithm 5. Sliding Window Counter Algorithm 6. Concurrency
12 replies
CC#
Created by Krishna on 12/6/2024 in #help
What is the better way to identify who is the exact culprit in this exception?
Thank you I will look into it..
25 replies
CC#
Created by Krishna on 12/6/2024 in #help
What is the better way to identify who is the exact culprit in this exception?
I can go down and debug it, But I wanted to know, is there a better way to either identify or avoid such blunders. I can create an utility that can do some checking between my database tables and entities in the C# or I have another solution as well where I can create a code generator that can generate entities using database tables. There can be plenty of options, I wanted to open up this conversation to understand what is the right way.
25 replies
CC#
Created by stigzler on 12/2/2024 in #help
Sloppy Constructors
public class SolidColorBrush : Brush
{
public Color Color { get; }

public SolidColorBrush() : this(System.Drawing.Color.White)
{
}

public SolidColorBrush(Color color)
{
Color = color ?? throw new ArgumentNullException(nameof(color), "Color cannot be null.");
BrushType = Enums.BrushType.Color;
}
}
public class SolidColorBrush : Brush
{
public Color Color { get; }

public SolidColorBrush() : this(System.Drawing.Color.White)
{
}

public SolidColorBrush(Color color)
{
Color = color ?? throw new ArgumentNullException(nameof(color), "Color cannot be null.");
BrushType = Enums.BrushType.Color;
}
}
Doing so can improve below: 1. Immutability - The Color property is now read-only (get; only), making the class safer and easier to work with in multi-threaded or complex scenarios. 2. Constructor Chaining: - The parameterless constructor calls the main constructor with the default Color.White. This eliminates duplicate logic and makes it easier to maintain. 3. Validation: - A check ensures that the color is not null, preventing potential errors. 4. Simplified Initialization: - The logic to set the default color and brush type is centralized in the constructors.
8 replies
CC#
Created by Krishna on 12/2/2024 in #help
How to make sure a background service is never stopped by any user, not even local admin?
I got the gist here.
26 replies
CC#
Created by Krishna on 12/2/2024 in #help
How to make sure a background service is never stopped by any user, not even local admin?
Thank you!
26 replies
CC#
Created by Krishna on 12/2/2024 in #help
How to make sure a background service is never stopped by any user, not even local admin?
How to make sure that local admin is not allowed to stop the service?
26 replies
CC#
Created by Krishna on 12/2/2024 in #help
How to make sure a background service is never stopped by any user, not even local admin?
It cannot be called a rootkit. It is a service that will monitor some organization controlled devices.
26 replies
CC#
Created by Krishna on 12/2/2024 in #help
How to make sure a background service is never stopped by any user, not even local admin?
Yes local admin have all the access, which is why I need some mechanism that could either avoid local admin to stop the service or service can restart on its own.
26 replies
CC#
Created by Krishna on 12/2/2024 in #help
How to make sure a background service is never stopped by any user, not even local admin?
Okay here is a scenario, Intune deploys application package(even if the app is not running), Service should know a new package is installed on the system. Based on the installation it will perform some post deployment tasks. Here if the service is not running, those post deployment tasks won't run, which should run immediately after the application package is installed. This is why I want a service which can start again on its own even if it is closed or stops local admin from stopping
26 replies
CC#
Created by Krishna on 12/2/2024 in #help
How to make sure a background service is never stopped by any user, not even local admin?
suppose a service is created to monitor/deploy new updates to some windows apps. In that case I do not want user to stop the service or change permissions. Is there a better way to do this if not a service?
26 replies