reeeeeee
reeeeeee
CC#
Created by reeeeeee on 10/19/2024 in #help
Saving Draggable objects location wpf
I have like 10 different objects which can be draggable across canvas (textboxes, labels, WrapPanels, DockPanels, etc). I would like to save their location so it will be shown after the restart. What would be the best way to achieve that? Obviously i could do like 3 bindable properties for each object (vlaue, positionX, positionY), but that would be 30 properties which would be really messy and like 150 lines of code (with mvvvm binding). Any idea?
18 replies
CC#
Created by reeeeeee on 10/18/2024 in #help
When to use Dependency injection?
I am learning WPF and since I am used to work with DI almost always in my previous projects (mostly APIs) I am not sure if I need it. Is using DI in wpf really best practice? My app is currently not really complicated, I only have some kind of Get data from API and save to db. Is DI recommended in this case? or does wpf have any special "best practices" what should you work with?
5 replies
CC#
Created by reeeeeee on 10/17/2024 in #help
How do you implement paging on API requests?
Basically title. Do you implement it by yourself or do you use any nuget?
11 replies
CC#
Created by reeeeeee on 10/16/2024 in #help
WPF Design patterns
Hey! I was wondering, how is the WPF solution structured? How detailed should it be separeted in multiple projects? Is it similar to APIs or something? So "WPF project" (views, viewmodels), "application project" (services, models), "Data project" (working with db), etc?
6 replies
CC#
Created by reeeeeee on 10/8/2024 in #help
Multilayer architecture - explanation?
tl;dr: Have been mostly working on existing projects and have some problems in early stages of the architecture development. Hey all! I would need some additional explanation on how do you usually approach the multilayer architecture. I came across one early project which already had some of the projects made, but idk why and what should even be there (lets call this project ExplainMe. So I have 4 "project" inside: ExplainMe (controllers), ExplainMe.Core (currently empty), ExplainMe.Data (entities), ExplainMe.EF dbContext.. Lets say I would like to implement an API request url/api/user?name=john - Create UserController inside ExplainMe.Controllers. - Create UserService inside ExplainMe.Core.Services (i assume?). - what now? Which class am I missing and where? somewhere should probably be IUserService, but where?
23 replies
CC#
Created by reeeeeee on 10/2/2024 in #help
How do y'all get the ideas for your side projects?
Title. Do you have a random blink in your mind? Do you find them online? Is it something that helps you without your day? hmm
4 replies
CC#
Created by reeeeeee on 9/9/2024 in #help
Random ERR_CONNECTION_RESET when uploading PDF files
I have angular SPA and .NET web API. One functionality is file upload, which usually works fine, but sometimes I am getting random ERR_CONNECTION_RESET errors which I can't explain. They only occur on PDF files and they are completely random. The file can be 50kb, or 5MB. Sometimes you can upload one file normally, later the same file fails 5 times. Funny thing is, the file is still sent and processed on the server, but I looks like something cancel/ignore upcoming response. One more problem is that this can only be reproduced when the apps are deployed on the server, when I debug it locally, everything works fine. Any idea what could be the problem? Honestly I don't know what should I even look for. Is this the API problem, or the ANgular application?
9 replies
CC#
Created by reeeeeee on 2/26/2024 in #help
ReCaptcha verify - The response ended prematurely
I an getting this error, when sending captchaData to the server for verifying. I would think the problem would be with accessing internet connection, but as far as I can see, the recaptcha verifying site can be accessed from the server. (https://www.google.com/recaptcha/api/siteverify) Any idea what else can i check?
18 replies
CC#
Created by reeeeeee on 2/23/2024 in #help
ReCaptcha verify - The response ended prematurely
Kinda all in the title. I would think the problem would be with accessing internet connection, but as far as I can see, the recaptcha verifying site can be accessed from the server. (https://www.google.com/recaptcha/api/siteverify) Any idea what else can i check?
1 replies
CC#
Created by reeeeeee on 1/17/2024 in #help
✅ Verify ReCaptcha on private server
I have implemented ReCaptcha that is deployed to private server which does not have access to internet. I have to whitelist the ReCaptcha verifying URL. In the docs https://developers.google.com/recaptcha/docs/verify there is this url https://www.google.com/recaptcha/api/siteverify. So if I whitelist this URl, the captcha should work? Or does anything else need to be whitelisted? What are the odds that google will change this url?
5 replies
CC#
Created by reeeeeee on 1/11/2024 in #help
LDAP authentication stopped working for one user
Hey all! I had an LDAP auth implemented on my site, which worked fine for past two years, but randomly stopped working for one user after he changed password. The code is like this
public bool IsAuthenticated(string ldap, string usr, string pwd)
{
bool authenticated = false;

try
{
DirectoryEntry entry = new DirectoryEntry(ldap, usr, pwd);
object nativeObject = entry.NativeObject;
authenticated = true;

}
catch (DirectoryServicesCOMException cex)
{
_logger.Error("DirectoryServicesCOMException occured");
_logger.Error(cex, cex.StackTrace);
}
catch (Exception ex)
{
_logger.Error($"Exception occured: {ex.Message}");
_logger.Error(ex, ex.StackTrace);
}
return authenticated;
}
public bool IsAuthenticated(string ldap, string usr, string pwd)
{
bool authenticated = false;

try
{
DirectoryEntry entry = new DirectoryEntry(ldap, usr, pwd);
object nativeObject = entry.NativeObject;
authenticated = true;

}
catch (DirectoryServicesCOMException cex)
{
_logger.Error("DirectoryServicesCOMException occured");
_logger.Error(cex, cex.StackTrace);
}
catch (Exception ex)
{
_logger.Error($"Exception occured: {ex.Message}");
_logger.Error(ex, ex.StackTrace);
}
return authenticated;
}
I am getting returned the username or password is incorrect. Should I implement this better? How can I even debug this? Can I check anything on the AD / LDAP side?
13 replies
CC#
Created by reeeeeee on 12/22/2023 in #help
Captcha service
I am implementing an announcement form for our client and I need to implement the Captcha step before the submit. I am using angular SPA and .net 7 MVC (with separate controllers for SPA). I see that the most popular captcha services are google recaptcha and hCaptcha, where you need to register your page, and other captcha services are kinda outdated. Would be better to just use the reCaptcha/hCaptcha, or is it worth implementing it on my own?
3 replies
CC#
Created by reeeeeee on 12/19/2023 in #help
LDAP login after password change
I have an older implementation of the Web API for AD users login with LDAP path. Technically everything worker for the past few years, but now the client said that after he changed his password, he can't login to the app anymore. This occured a few weeks ago, so I think that all of the "LDAP syncing" went trough already... I tried to duplicate this, and after password change, actully both new and old passwords worked fine. After like one hour, the old password stopped working and only the new one works now. This is my implementation of the login, I see there are different kinds of approach, is there any better one that would kinda "force" to use only the latest password?
public bool IsAuthenticated(string ldap, string usr, string pwd)
{
bool authenticated = false;

try
{
DirectoryEntry entry = new DirectoryEntry(ldap, usr, pwd);
object nativeObject = entry.NativeObject;
authenticated = true;
}
catch (DirectoryServicesCOMException cex)
{
_logger.Error("DirectoryServicesCOMException occured");
_logger.Error(cex, cex.StackTrace);
}
catch (Exception ex)
{
_logger.Error($"Exception occured: {ex.Message}");
_logger.Error(ex, ex.StackTrace);
}
return authenticated;
}
public bool IsAuthenticated(string ldap, string usr, string pwd)
{
bool authenticated = false;

try
{
DirectoryEntry entry = new DirectoryEntry(ldap, usr, pwd);
object nativeObject = entry.NativeObject;
authenticated = true;
}
catch (DirectoryServicesCOMException cex)
{
_logger.Error("DirectoryServicesCOMException occured");
_logger.Error(cex, cex.StackTrace);
}
catch (Exception ex)
{
_logger.Error($"Exception occured: {ex.Message}");
_logger.Error(ex, ex.StackTrace);
}
return authenticated;
}
1 replies
CC#
Created by reeeeeee on 12/3/2023 in #help
How well do deployed .NET Framework apps handle .net update?
For example, if I have .Net 4.5 Framework application deployed on Windows server, how well does it handle any .NET Framework updates? If I keep .NET 4.5 version on the server, and install .net framework 4.8 or .NET Core, could this stil be problematic, since the 4.5 is still installed? What about Security Updates for Microsoft .NET Framework, this shouldn't cause any problems, right?
13 replies
CC#
Created by reeeeeee on 11/24/2023 in #help
Decoding RFID tag
Is anyone familiar with decoding RFID tags? I have bytearray but idk where to start from here (Whihch part is tag value, which part specify it, etc.). Any advice would be appreciated.
6 replies
CC#
Created by reeeeeee on 7/7/2023 in #help
✅ Problems with NHibernate, FluentNHibernate, StructureMap
I have been trying to fix this bug in an older project (which needed to be updated to .net framework 4.6.1, because of some other newer libraries), but I just didn't really make any progress. I will post some of the stack trace, but please let me know what else should I include (except whole project, lol), so it would be easier to help.
FluentNHibernate.Cfg.FluentConfigurationException: An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.
FluentNHibernate.Cfg.FluentConfigurationException: An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at FluentNHibernate.AssemblyTypeSource.GetTypes()
at FluentNHibernate.PersistenceModel.AddMappingsFromSource(ITypeSource source)
at FluentNHibernate.Cfg.FluentMappingsContainer.Apply(PersistenceModel model)
at FluentNHibernate.Cfg.MappingConfiguration.Apply(Configuration cfg)
at FluentNHibernate.Cfg.FluentConfiguration.BuildConfiguration()
--- End of inner exception stack trace ---
at FluentNHibernate.Cfg.FluentConfiguration.BuildConfiguration()
at TimeSpace.DataAccess.Persistence.Configuration.NHDatabaseConfiguration.CreateConfiguration()
at TimeSpace.DataAccess.Persistence.Configuration.NHDatabaseConfiguration.CreateFactory()
at TSTrumpet.Web.DataAccessRegistry.<>c.<.ctor>b__1_0(IContext ctx) in C:\Users\naczup\tstrumpet\TSTrumpet.Web\DataAccessRegistry.cs:line 26
at StructureMap.Pipeline.LambdaInstance`1.build(Type pluginType, BuildSession session)
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at FluentNHibernate.AssemblyTypeSource.GetTypes()
at FluentNHibernate.PersistenceModel.AddMappingsFromSource(ITypeSource source)
at FluentNHibernate.Cfg.FluentMappingsContainer.Apply(PersistenceModel model)
at FluentNHibernate.Cfg.MappingConfiguration.Apply(Configuration cfg)
at FluentNHibernate.Cfg.FluentConfiguration.BuildConfiguration()
--- End of inner exception stack trace ---
at FluentNHibernate.Cfg.FluentConfiguration.BuildConfiguration()
at TimeSpace.DataAccess.Persistence.Configuration.NHDatabaseConfiguration.CreateConfiguration()
at TimeSpace.DataAccess.Persistence.Configuration.NHDatabaseConfiguration.CreateFactory()
at TSTrumpet.Web.DataAccessRegistry.<>c.<.ctor>b__1_0(IContext ctx) in C:\Users\naczup\tstrumpet\TSTrumpet.Web\DataAccessRegistry.cs:line 26
at StructureMap.Pipeline.LambdaInstance`1.build(Type pluginType, BuildSession session)
7 replies
CC#
Created by reeeeeee on 6/25/2023 in #help
❔ Remove Index from URL
How do I remove "Index" from Url, so I can call /Home, /Users, etc, wihtout additional /index. (but obv be still redirected to "Index" method in controller. I found this snipped and added it to my startup
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller}/{action}/{id?}");
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller}/{action}/{id?}");
Well, the Index is still there, and all actions without "Index" are redirected to my Users/edit/{id} action..
20 replies
CC#
Created by reeeeeee on 6/24/2023 in #help
❔ Razor pages - Filtering data (shown in table) by some random filters
As mentioned in title, I am showing some data in table, and I need some filters, like serialNumber, dateFrom, DateTo, No, Status,... How could I implement this functionality in mvc razor pages? One way would be to append all those filters into the URL, is this proper way to do it? (I was thinking on looking for something without all those mess in url) Thanks!
18 replies
CC#
Created by reeeeeee on 6/19/2023 in #help
❔ Anyone worked with Zebra scanners?
Title. Especially FX7500 and FX9600, and maybe even Zebra IoT connector.. (before I write and explain the whole content, i would firstly like to know if anyone even worked with this, heh)
16 replies
CC#
Created by reeeeeee on 6/17/2023 in #help
❔ Session vs Cookies vs Cache
I am currently researching this, but just cant find an end on which one should I use. Like, what are the main differences? I need it for simple authentication (user/pass) of my web app (3-4 pages) and automatic logout if inactive too long.l.
27 replies