Random snippets of all sorts of code, mixed with a selection of help and advice.
Cannot upload binaries via github release workflow
1 March 2026 @ 4:38 am
This is my release workflow :-
name: Release
on:
push:
tags:
- 'v*'
env:
BUILD_TYPE: Release
jobs:
build-and-release:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
body: |
Release created by GitHub Actions for tag ${{ github.ref_name }}.
draft: false
prerelease: false
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
How to securely implement JWT authentication in a .NET health monitoring app using MySQL?
1 March 2026 @ 4:32 am
I’m developing a web application for pharmacovigilance similar to VAERS and some UN health reporting dashboards. The app is built with .NET 8, Entity Framework Core, and MySQL.Users are medical professionals with roles like Doctor, Nurse, Pharmacovigilance Specialist, etc. Users should log in using email and password. I want to return a JWT token upon login, but I’m unsure if I should store the token and refresh token in the database or just return it to the client.The app will record adverse event reports, similar to https://vaers.hhs.gov/ , so security and proper role-based access control are essential.
Here’s my current login implementation:
public async Task<UserResponseDTO> LoginUserAsync(LoginUserDto userDto)
{
var savedUser = await _identityManager.CheckCredentialsAsync(userDto.Email!, userDto.Password);
if (savedUser is null)
Parallel spring batch jobs mixing up data
1 March 2026 @ 4:19 am
Hi this one is really puzzling me. I am trying to run a separate instance of a spring batch job for every file, up to 20 at a time.
I've created a stripped down job of how im using it to reproduce the issue. This is how I invoke the jobs via main class:
public class Main implements CommandLineRunner {
private final JobLauncher jobLauncher;
private final Job jobConfig;
private int parallelism = 20;
public static void main(String[] args) {SpringApplication.run(Main.class, args);}
@Override
public void run(String... args) throws Exception {
File[] files = getFiles();
ExecutorService pool = Executors.newFixedThreadPool(parallelism);
List<Future<?>> futures = new ArrayList<>(files.length);
for (int i = 0; i < files.length; i++) {
final File file = files[i];
futures.add(pool.submit(() -> {
try {
JobParameters params = new
Can I change the contents of the link I send to people?
1 March 2026 @ 3:17 am
Not sure if I was able to word it well but, I'm sending a link to people that have my personal details in the website if they click on it. Can I make it so they access a version of the website without my personal details?
How to get GCC to inline strcpy (string copy)
1 March 2026 @ 2:47 am
I'm using www.godbolt.org website and the x86-64 gcc 15.2 compiler selection and the -O2 compiler options for optimization but it still makes a call to strcpy in libc.
I would like this compiler to implement the strcpy operation inline and not use the built in library API. How can I do this using GCC compiler?
Example source code and compiler output on Godbolt, just calling strcpy(buffer, argv[1]) where buffer is a local char buffer[500] array.
Why does the dash command `test -d` without the file arg pass without error?
1 March 2026 @ 2:25 am
#!/bin/sh
# dash script
zero=0
test $zero -eq 0
echo $? # prints 0
zerostr="000"
test $zerostr -eq 0
echo $? # prints 0
test
echo $? # prints 1 (as documented)
test -d
echo $? # prints 0 (but why? the unspecified directory 'exists'? wouldn't it be more consistent to print 1 instead?)
test -d $9 # what is the best way to check if an argument was indeed passed in on the command line?
echo $? # prints 0 even when $9 was not provided to the script
I have a small script who takes a directory path as an argument. I perhaps skipped some required argument parsing code and started testing for expected directories and files that the script operates on. But I was surprised that my script reported that it had found a directory even when I had not provided a directory path argument. Why does an unspecified file seem to report no error when testing to see if it exists and is a directory? Does this seem like a bug (or at least an inconsistency) to anyone else
"Uncaught TypeError: Cannot read properties of undefined" when accessing nested object in JavaScript React component
1 March 2026 @ 2:19 am
Problem:
I am trying to display a user's address from a nested user object in my React component. When the component first loads, I get an Uncaught TypeError: Cannot read properties of undefined (reading 'street') error in the console, because the user object is initially null or undefined before data is fetched.
What I've tried:
I have tried adding a simple null check like user && user.address && user.address.street, but this still throws the error during the initial render.
I've also tried using the optional chaining operator (?.) like user?.address?.street, which resolves the error but shows a blank screen instead of a loading indicator.
Expected Outcome:
I want the component to display a "Loading..." message until the user data is fully fetched, and then display the street address.
Differences between SQL dialects?
1 March 2026 @ 12:54 am
I'm just wondering about the different kinds of SQL? I have heard of SQLite, MySQL and a couple of others but I don't really understand. Like how do they differ? Where do you use which one? Which ones are the most used ones? What is the purpose of this? I'm sorry if this isn't an appropriate question here. Thanks in advance
What's the industry-standard way to, with a formula, fill a range with a specific value?
28 February 2026 @ 7:50 pm
I'm using Google sheets. I'll use this table as an example
A
1
Apple
...
5
Apple
I know you can click and drag to autofill, I want a solution where
when I add a row anywhere between rows 1 and 5, "Apple" automatically appears in that new row in column A
The formula is stored in cell A1
I can think of several dumb ways to do this but I want to know the simplest/best way with the shortest formula.
Why can I scrape some Fangraphs player tables with R but not others?
28 February 2026 @ 4:24 pm
I'm trying to use R to scrape player tables in Fangraphs. I should say up front that I'm very much a novice. Here is some code for Samuel Basallo:
library(purrr)
library(rvest)
url_basallo <- "https://www.fangraphs.com/players/samuel-basallo/28824/stats/batting"
xpath_look <- '//*[@id="dashboard"]/div[3]/div/div/div/div[1]/table'
url_read_html <-
url_basallo |>
read_html()
data_look <- url_read_html |>
html_nodes(xpath = xpath_look) |>
html_table() |>
pluck(1)
I found the xpath by via the Inspect tool in Chrome. This code works. That is, it returns a table with the appropriate number of rows and columns. Needs a little cleanup for my purposes, but that's a different issue.
If you look at Basallo's page, you will see that there are other tab