gr8stalin's mustache!
gr8stalin's mustache!
CC#
Created by gr8stalin's mustache! on 1/24/2024 in #help
How do I set environment variables for a MAUI Android app?
at work my team and I have been struggling with how to get values (versions, prod urls, etc.) we store within environment variables in our build pipeline. our process works fine for our web app, but our environment variables don't seem to exist when our MAUI Android build is running. we tried troubleshooting this in our local build as part of a group debug session, and i noticed that when i asked my teammate to call GetEnvironmentVariables from the immediate window, we got the same batch of variables back every time. our environment variable was nowhere to be seen, but when we ran our unit tests, the tests picked up the variable just fine.
1 replies
CC#
Created by gr8stalin's mustache! on 11/5/2023 in #help
❔ i don't have enough (any) experience with semaphores to know if my wpf app requires them
i started a new role very recently and my first project is helping a client, an electrical engineer, create a desktop application to manage a robotic platform performing qa for silicon manufacturing. understandably, one of the requirements was that the ui not lock up during an interaction; the previous desktop application they had made some years ago was a winforms app that did similar work, and in typical cobbled-together winforms fashion, everything was done on the ui thread. i've demonstrated with a reasonable sample wpf app that this won't be the case. however, the word "semaphore" was introduced by my project lead when we had our project start call with the client, and a lot of our conversation about creating a background thread for any singular task is now intertwined with the thought that it requires a semaphore. from what i've learned about semaphores and their usage, they control the number of threads that can be used at any given time by a module in an application, which helps limit the number of times some kind of external resource or endpoint is being accessed by the module (i.e., respecting rates for web apis). i found these when searching for c#-based examples of semaphores: https://kendaleiv.com/limiting-concurrent-operations-with-semaphoreslim-using-csharp/ https://www.youtube.com/watch?v=GKjM4AX8NME from my current understanding of the project requirements, the wpf app would be a wrapper around a library for interacting with the robotic platform. i don't have enough experience with semaphores to know if this project will have so many simultaneous interactions that it'd be necessary to have a semaphore. my current assumption is that having a semaphore might act as a queue of sorts if a user decided to press several buttons consecutively, but it'd probably be more reasonable if there was a queue keeping track of the actions a user was triggering. is my understanding of semaphores correct? do i have an immediate need for them based on the requirements?
5 replies
CC#
Created by gr8stalin's mustache! on 2/27/2023 in #help
❔ best practices for updating objects using GroupBy
i've got a collection of data objects. these data objects are related by domain-specific ids, and what I want to do is group them so i can update a property on every other group. i've got the following set up so far, and it works:
var group = this.results.GroupBy(x => x.DomainSpecificId).Where((i, idx) => idx % 2 ==0);

foreach (var groupedData in group)
{
foreach (var data in groupedData)
{
data.PropertyToUpdate = true;
}
}
var group = this.results.GroupBy(x => x.DomainSpecificId).Where((i, idx) => idx % 2 ==0);

foreach (var groupedData in group)
{
foreach (var data in groupedData)
{
data.PropertyToUpdate = true;
}
}
however, anyone who has read anything introductory about performance might feel as uneasy as i do about a loop nested within a loop. am i worrying about the performance aspect of this too much, or am i missing a better way to do this? it looks like a lot of the top StackOverflow answers about this just use the nested loops to perform the iteration.
19 replies
CC#
Created by gr8stalin's mustache! on 10/25/2022 in #help
scope of using statements and extension methods
i want to encapsulate some logic for a specific type i have into an extension method. however, when i try to find that extension method on the type with intellisense, it doesn't appear in the list. when i enter the method name by hand and press the intellisense shortcut, it prompts me to add a using statement for the namepsace i added the extension method to. i do have that namespace in a using method, but i have it as an alias like so:
using CustomService = MyProject.Services.CustomService;
using CustomService = MyProject.Services.CustomService;
does this not count for having the namespace in the current scope?
5 replies