StackOverflow.com

VN:F [1.9.22_1171]
Rating: 8.5/10 (13 votes cast)

Random snippets of all sorts of code, mixed with a selection of help and advice.

How do you use SQLite in memory to behave just like it was on a normal file?

27 January 2026 @ 3:16 pm

So i have a FastAPI app, with SQLAlchemy as ORM. We have a service that uses a SQLite DB to retrieve info from some services and have as a "cache" for us. Now, its not a huge DB file, its only 1GB and it shouldnt increase too much in size. Right now we create a DB file when the service is created #database.py from sqlalchemy import create_engine from sqlalchemy.orm import declarative_base, sessionmaker from sqlalchemy_utils import create_database, database_exists Base = declarative_base() DB_SEMAPHORE = threading.Semaphore(1) def get_engine(): engine = create_engine("sqlite://cache.db", connect_args={"check_same_thread"=False}) if not database_exists(engine.url): create_database(engile.url) return engine def get_session(): engine = get_engine() return sessionmaker(bind=engine, autocommit=False, autoflush=False) def create_tables(): engine = get_engine(

systemd ssh service in Debian: Why naming twice the same service? [closed]

27 January 2026 @ 3:04 pm

it looks like the original name is ssh: #systemctl list-units --all | grep 'ssh\|sshd' | grep .service ssh.service loaded active running OpenBSD Secure Shell server [..] this is confirmed with: ls -1 /lib/systemd/system/ssh*.service [..] ssh.service but ls -1 /etc/systemd/system/ssh*.service /etc/systemd/system/sshd.service /etc/systemd/system/ssh.service some will say, it's not the same directory. so: # systemctl cat ssh.service # /usr/lib/systemd/system/ssh.service [Unit] Description=OpenBSD Secure Shell server Documentation=man:sshd(8) man:sshd_config(5) After=network.target nss-user-lookup.target auditd.service ConditionPathExists=!/etc/ssh/sshd_not_to_be_run [Service] EnvironmentFile=-/etc/default/ssh ExecStartPre=/usr/sbin/sshd -t ExecStart=/usr/sbin/sshd -D $SSHD_OPTS ExecReload=/usr/sbin/sshd -t ExecReload=/bin/kill -HUP $MAINPID KillMode=proces

Typescript Generics when alternating types in variable number of arguments to a function

27 January 2026 @ 3:03 pm

In my code I frequently find myself doing complex sorting of large arrays-of-objects. So I've been working on a generic sorting function where you can provide a variable number of sorting comparators (and for each comparator you can add an optional parameter to specify the sort direction). I'm also somewhat new to generics so this has been a big learning experience. Here's an example of how I'd like to use such a sorting function let arr = [{a: 1, b: 1, c: {d:1, e:1, f: {g:1}},....] sortBy( arr, // array to be sorted x => x.a, // first sort by the 'a' field default 'ascending' sort x => x.b, 'DESC', // next sort by the 'b' field 'descending' sort x => x.c.d, // next sort by the 'c.d' field default 'ascending' sort x => x.c.f.g, 'DESC') // next sort by the 'c.f.g' field 'descending' sort Here's the code I have so far: // RefToObjType and SortDir

How to Make First Big Project Solo

27 January 2026 @ 2:55 pm

I disqualifed from interviews because i have project which never solves real world problem they are just for learning , i want to know from developers, what is the mindmap for backend learners who want to make big project from scratch

Windows taskbar icons became very small [closed]

27 January 2026 @ 2:28 pm

I am using Windows 11 Enterprise OS. All of a Sudden my Windows taskbar icons are showing up very small. I am unable bring it back to the original position. Is this a new feature, update or a bug ? My Windows specs are: This shows Windows 11 Enterprise Below is the image of icons; This is my taskbar Please can anyone tell me the way I can get back the original size of Taskbar icons?

I’m deploying MongoDB using the Dockerfile below and experiencing critical corruption issues

27 January 2026 @ 1:57 pm

I’m deploying MongoDB using the Dockerfile below and experiencing critical corruption issues. Environment: Inserting approximately 1 million documents per day Server crashes every 3 days with segmentation fault Error occurs on collections actively being queried Running validation command shows corruption: The Docker environment is as follows: FROM rockylinux/rockylinux:8.10 RUN dnf update -y && \ dnf install -y wget tar gzip gcc gcc-c++ make cmake openssl-devel libcurl-devel compat-openssl10 && \ dnf clean all RUN cd /tmp && \ wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel8-8.0.14.tgz && \ tar -xzf mongodb-linux-x86_64-rhel8-8.0.14.tgz && \ mv mongodb-linux-x86_64-rhel88-8.0.14 /opt/mongodb && \ ln -s /opt/mongodb/bin/* /usr/local/bin/ && \ rm mongodb-linu

Asp.net Web Form Ajax to Pass data from aspx to code behind

27 January 2026 @ 1:36 pm

I need to pass some data from an aspx file to its code behind file. <form id="form1" runat="server"> <div> Name : <input type="text" id="txtInput" /> <br /><br /> <input type="button" id="btnSave" name="btnSave" value="Save" /> </div> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"> </script> <script type="text/javascript"> $(document).ready(function () { $("#btnSave").click(function () { var name = $("#txtInput").val(); console.log(JSON.stringify({ name: name })); $.ajax({ type: "POST", url: "Test.aspx/SaveData", data: JSON.stringify({ name: name }), contentType: "application/json; charset=utf-8", dataType: "json&q

Docusaurus question: Is it possible to replace the word 'Blog' in the browser tab? [closed]

27 January 2026 @ 1:22 pm

In Docusaurus, I'm using the 'blog' functionality to display my 'release notes' so I would like to replace the word 'Blog' that appears in the browser tab with the phrase 'Release Notes.' Is this possible? I wasn't able to achieve it with variations of a global 'find and replace' for the word 'blog.' enter image description here

SQL Server Express INSERT unique incremented number from SELECT on the same table by several users without creating duplicates

27 January 2026 @ 1:06 pm

I have a requirement to generate unique incrementing serial numbers by product type from a VB.NET application using SQL Server Express. I have created a table and also have a VB form where I am testing a query which seems to work ok and returns the next inserted serial number back to the VB application. (The inserted serial number is 'int' in the table.) If the product is a new product it should insert and return the first serial number = 1. There will be 5 different PC's running the VB application using the SQL Server on a network. I have not done much SQL work before and wish to confirm how SQL Server deals with this sort of query, particularly if more than one of the applications runs this query at the same time. Does SQL Server internally treat the user's query as a 'single' operation, or do I need to take into account additional measures to prevent duplicated serial numbers? My concern is if the insert of the selected last serial number +1 isn

How do I deploy a service using deepface without reloading the model?

27 January 2026 @ 7:06 am

I want to load the model first. Then, every time I input an image, I can perform the inference without having to reload the model every time. For example, I will use verification: res = DeepFace.verify( img1_path="./1.jpg", img2_path="./2.jpg", detector_backend="retinaface", model_name="VGG-Face", ) However, I found that it takes about 20 seconds each time because the model has to be reloaded every time. How can I preload the model once and only calculate the inference when I input a new image?