reeeeeee
SQLite proper disposal when shutting down the app
I have a question regarding SQLite database and its WAL mode (making changes to separate file and checkpointing it when its enough).
Is it possible to handle "forceful shutdown", like end process from task manager? (i have some API and windows services which are using the database). Or if there is some kind of database setting, that when you lose the last connection, the database gets automatically checkpointed to main file.
Because I can't seem to find a way to do it, but with DB Browser for SQLIte (some kind of SQLIte IDE software, like SSMS for sql), if i end the process, the checkpoint happens, but I dont know how. Any idea what would be the best solution?
I have osme kind of automatic checkpoint on "normal" shutdown, but thats kinda it... I hope you understand what I want to achieve 🙂
12 replies
Calling SQLite query inside Inno Setup (update db on application uninstall)
Basically title.
I tried with sqlite dll and exe, but nothing seem to work.
dll:
It gives me
Could not call proc
error on sqlite3_open.
I also tried with this function which uses exe file:
which doesnt give me any error, but also doesnt do anything.
How can i test these things outside of "inno setup" file, because its really annoying to always rebuild installer, install app and uninstall...1 replies
SQLite weird state managing / caching
I am working on .NET API and I have some problems with handling/saving sqlite state. Before I post all of my code, I am using EF and handling dbcontext lifecycle with DI.
What is the process where the problems occur:
- Start API and send one POST requet to enter something in DB (when the API is starter, sqlite created WAL and SHM files)
- The entered data is visible on API website and always in DB Browser for Sqlite
- Stop API
- Data still visible in DB Browser. I can also close the browser and open it again, and the data is still there
- When I start the API again, the data dissapears. Its not visible in DB Browser, as well as in API website.
*Closing DB browser clears .WAL and .SHM files, stopping API doesnt
Any idea where the problem might be? Which part of the workflow?
17 replies
Where to handle mapping between DTOs and Entity objects?
Lets say I have controller GET /users/ which returns UserDTO. Where would I do this mapping between User and UserDTO?
- In controller: userService.GetUsers -> transform to UserDTO list -> return list
- in service: Method UserService.GetUsers does the mapping and returns UserDTO list
- in separate service: I have two methods in my service: GetUsers (which returns Entity objects) and GetUsersDTO (which calls GetUsers method and map it)
- anything else?
4 replies
Windows/AD authentication between Angular SPA and .NET API
As mentioned in title, I have .NET API which will be used for my Angular SPA. Some pages needs to be protected, and I would like to use AD / Windows auth for it.
Curently, I managed to find one solution, to set my API for Windows Auth and Check
context.User.Identity
. In my angular app, I set withCredentials: true
before sending the request. this technically works. But. Occasionally, that default "windows login" popup appears, is there any way to prevent that and automatically grab the users identity/credentials? Or is this an okay workflow for that?2 replies
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
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
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
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
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
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
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
✅ 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
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
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
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
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?
1 replies
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