Random snippets of all sorts of code, mixed with a selection of help and advice.
How do you do ts
27 May 2026 @ 9:45 am
Alright I cant explain it properly, I work with HTML since I am just starting and I want to code a website where someone picks an order
Pays with it
Wants to put a message
Money is sent
Then the message and the item bought is sent to the owners number or whatever💔
If it works in javascript or anyogher im willingt to learn in can someone pls js tell me how to do it💔💔😢
If this question sounds stupid please feel free to tell me
Kalman Filter implementation in R and errors in optim and Cholesky decomposition
27 May 2026 @ 9:36 am
Hi I think I have implemented a Kalman Filter that runs on R correctly, however when I compute a Likelihood so that I can pass the function to optim and get an estimation on the parameters weird things happen.
Creation on the function:
runkf_time_varying_alpha_chol <- function(par,
p=ncol(S_obs),
n=nrow(S_obs),
S_obs,
Y,
P_last){
# Map the observation error covariance
R_vector <- exp(par[1:p])
R <- diag(R_vector,p)
# Process covariance
q_alpha <- exp(par[(p + 1):(2 * p)])
q_beta <- rep(0, p)
Q <- diag(c(q_alpha, q_beta))
# Pre-allocate arrays
X_prior <- array(0, dim = c(2*p, 1, n))
X_filt <- array(0, dim = c(2*p, 1, n))
P_prior <- array(0, dim = c(2*p, 2*p, n))
P_filt <- array(0, dim = c(2*p, 2*p, n))
I
TypeScript type definition of a state machine
27 May 2026 @ 9:29 am
I'm defining the possible states of a systems and the transitions between them. I want to do this in the shortest form that occured to me, as a map representing all possible states (keys) and the states they can transition to (values).
I couldn't find a way to express this in TypeScript. In the values I want to be constrained to the keys of the object itself, and therefore also have type hints towards the possible values.
type StateMachine = Record<string, string[]>;
const story = {
todo: ["inProgress", "done"],
inProgress: ["todo", "done"],
done: [],
} satisfies StateMachine;
VS Code terminal opens in ~ instead of workspace folder on WSL
27 May 2026 @ 9:15 am
I've just moved to a new laptop and installed MS Code, using Ubuntu with WSL. Unlike on the old laptop, when I open a terminal in VS Code, it opens in ~ rather than in the project workspace folder.
Unable to extract a mining package in Ubuntu 26.04 [closed]
27 May 2026 @ 9:00 am
I recently setup my laptop with dual boot for Ubuntu 26.04 but I can't get the package to install.
I typed:
sudo apt extract install NHOS-Flash-Tool-1.1.21.deb
but I got invalid operation extract.
Is there a faster/better way to add a string to all the cells in a table column in VBA?
27 May 2026 @ 8:37 am
at the moment I am using this code snippet to add "20" to the beginning of each cell in a table column:
For Each r In Range(TabellNamn & "[Date/Time]")
r.Value = "20" & r.Value
Next
"TabellNamn" is the variable that contains the name of the table that I'm working with and "[Date/Time]" is the name of the column. The column contains, as the name suggests, a date-time formatted value. However, the value is taken from a time stamp that writes the value on the format "YY/MM/DD hh:mm:ss" and the code below is used to format the value to begin with (i.e. it is performed before the code shown above).
Range(TabellNamn & "[Date/Time]").Select
With Selection
.Replace what:="/", Replacement:="-", LookAt:=xlPart, MatchCase:=False
.TextToColumns Destination:=.Cells(1), DataType:=xlFixedWidth,
Spring Boot service-level ID counter conflicts with MongoDB persisted documents on application restart
27 May 2026 @ 8:24 am
Context
I have a Spring Boot application with three interchangeable persistence layers: in-memory, PostgreSQL, and MongoDB. The active persistence is chosen via app.storage in application.properties. My TreeService manages node creation with a simple in-memory ID counter:
java
@Service
public class TreeService {
private final TreeRepository repo;
private final TreeAlgorithmStrategy strategy;
private Long idCounter = 1L;
public Node createRoot(String value) {
Node root = new Node(idCounter++, value, null);
return repo.save(root);
}
public Node addChild(Long parentId, String value) {
Node child = new Node(idCounter++, value, parentId);
return repo.save(child);
}
}
The MongoDB document uses the Long ID directly as the document _id:
java
@Document(collection = "nodes"
How does normal programmer handles the extreme efficiency of AI? (ai brain fry)
27 May 2026 @ 8:18 am
The situation I’m thinking about is this:
There are “vibe coders” using AI with setups like “10 parallel agents generating tens of thousands of tokens daily.” Sometimes the AI is doing absurdly detailed work too — I even saw a LinkedIn screenshot where an agent was generating the contents of an SVG icon.
But I’m curious how experienced/normal programmers mentally handle the extreme efficiency boost from AI.
For the past couple of decades, writing software took time. Even something simple like a CRUD controller (“get all / get one / create / edit / delete”) could easily take 20–30 minutes, sometimes hours if you were doing something new. You had to actually think through it, write the boilerplate, structure things, debug, etc.
Now AI can generate that same thing in minutes. Your brain barely needs to focus on it before you move on to the next layer — maybe a data-processing library, system architecture,
Spring Boot 4, Swagger UI, /v3/api-docs returning 500 Internal Server Error with NO backend logs
27 May 2026 @ 6:38 am
I'm running into a completely silent 500 error with SpringDoc OpenAPI and could really use some pointers.
My Stack:
Spring Boot 4.0.5
Java 21
SpringDoc OpenAPI Starter WebMVC UI 2.6.0
Maven
The Issue: When I boot up the application, it starts successfully on port 8080. However, when I navigate to http://localhost:8080/swagger-ui/index.html, the UI loads but immediately throws a "Failed to load API definition" popup.
Looking at the browser console/network tab, the call to /v3/api-docs is failing with a 500 Internal Server Error.
The Catch: There are absolutely zero error logs or stack traces printing in my IntelliJ console when the 500 error is triggered. The server stays quiet.
What I've Already Tried:
I noticed a startup l
How to yank from character under the cursor to the mark `a`?
27 May 2026 @ 5:22 am
If I have the text below and I want to copy all the text from "The first line" until the end of "The third line":
I put a mark on the T of the top line using ma.
I move the cursor to the last line, last character.
I type y`a. It copies everything except the last character.
How do I copy everything including the last character?
Some text...The first line
The second line
The third line
I'm using the Vim extension in VS Code but I don't think this makes a difference.