StackOverflow.com

VN:F [1.9.22_1171]
Rating: 9.2/10 (11 votes cast)

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

Kubernetes readinessProbe flapping: /readiness does deep dependency checks (DB/Redis/Box) and times out → pods marked Unready during rollouts

5 November 2025 @ 10:26 pm

readiness probe is flapping because /readiness does deep dependency checks (Postgres/Redis/Box) and sometimes takes ~3–4s+, occasionally more via proxy. Kubelet times out and marks the pod Unready, which slows rollouts and reduces capacity. ports: - name: http containerPort: XXXX livenessProbe: httpGet: path: /health port: http periodSeconds: 20 initialDelaySeconds: 30 timeoutSeconds: 15 failureThreshold: 3 successThreshold: 1 readinessProbe: httpGet: path: /readiness port: http httpHeaders: - name: Accept value: application/json initialDelaySeconds: 25 periodSeconds: 10 timeoutSeconds: 15 failureThreshold: 3 successThreshold: 1

Why does my C code display the correct output, but with garbage characters added after?

5 November 2025 @ 10:21 pm

The practice question I am working on reads as: Read two strings, both of them do not contain white spaces (but may contain non-alphanumeric, such as ‘,’ ‘.’ ‘/’ …). Display the first string after removing all the characters in the second string from it. For example s=”thagrbsjdgrAklpp”, the second string is “ghsnby” Display the first string after removing g h s n b y from it Output tarjdrAklpp My current code is shown below: #include <stdio.h> int main() { char string1[100]; char string2[100]; int length1 = 0; int length2 = 0; printf("Enter the first string: "); scanf("%s", &string1); printf("Enter the second string: "); scanf("%s", &string2); for (int i = 0; i < 100; i++) { if (string1[i] == '\0') { } else

Make Postgres query fast without cheating

5 November 2025 @ 10:19 pm

I have big table (about 150 GB), partitioned. There are two the most interesting fields there: key text NOT NULL, ts timestamptz NOT NULL The first, slow query is: SELECT csh.key, csh.ts FROM table_partition202508 csh WHERE csh.key IN ('string1', 'string2') ORDER BY csh.ts The execution plan is Limit (cost=0.57..48.31 rows=10 width=109) (actual time=258365.355..258507.769 rows=10 loops=1) -> Index Scan Backward using table_partition202508_ts_key_idx on table_partition202508 csh (cost=0.57..11776409.95 rows=2466994 width=109) (actual time=258365.353..258507.758 rows=10 loops=1) Index Cond: (key = ANY ('{string1,string2}'::text[])) Planning Time: 0.119 ms Execution Time: 258507.793 ms (sic!) The second, fast query is: SELECT csh.key, csh.ts FROM table_partition202508 csh WHERE csh.key IN ('string1', 'string2') UNION ALL

Type error not caught in `vitest.config.ts`

5 November 2025 @ 10:16 pm

When writing a Vitest config file in typescript, type errors don't seem to be caught. How to change that (and thus benefit from typechecking if an option property is wrong). Here's an example vitest.config.ts import { defineConfig } from 'vitest/config' let boolValue: string = true; export default defineConfig({ test: { typecheck: { enabled: boolValue } }, }) And then running npx vitest runs the tests just fine, no error instead the wrong type assignment of line 3.

Socket TCP connection through Radmin (can't connect) in Console Application

5 November 2025 @ 10:15 pm

I made a simple console messenger to test the possibility of connecting 2 or more computers for my game using RadminVpn+Sockets but its not working. I can connect to myself using my radmin ip but if I or my friend are trying to connect the program tries and gives System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (10060) Goals: I want to be able to connect two computers at least through Radmin, without any extra hassle on the client side, because all my friends use it. Or find another way to connect. my friend tried to give rights to the program in firewall settings in control panel but it didn't help code if someone needs: using System.Net; using System.Net.Sockets; using System.Text; namespace RadminMessenger { internal class Program { static void Main(string[] args) { Console.WriteLine("CONNECT/HOST?"); string answer = Console.ReadLine(); using Socket serverS

Unable to edit ASPX of an existing screen in Acumatica

5 November 2025 @ 10:15 pm

When trying to edit the ASPX of the Vendors screen in Acumatica 25R2, I get the following error: 'You have insufficient rights to access the object (GraphAspxEdit).' This is preventing me from customizing the ASPX for the screen to fit my needs. Is there a reason that this is happening? I'm logged in as the administrator and have had access to this feature in previous versions of Acumatica. Any assistance would be welcome.

SAP Fiori: How to Replace Collective Search Help (MAT0M) with Single Value Help in Standard App F1595?

5 November 2025 @ 10:12 pm

Environment SAP S/4HANA: 2023 release (on-premise) Fiori App: F1595 – Stock – Multiple Materials OData Service: S31PCE Issue In the standard Stock – Multiple Materials app, the Material filter field uses data element MATNR, which is linked to collective search help MAT0M. When pressing F4, the value help dialog shows multiple tabs (e.g., Material by number, Material by description). This is because MAT1 includes several elementary search helps. Goal: Simplify this to a single elementary search help (one tab) without modifying standard DDIC objects or building a completely custom app. What I Tried Checked CDS views: C_MaterialStockByKeyDate → references I_MaterialStock.... Verified MATNR uses collective search help MAT1 in SE11. Considered copying MAT1/MATNR → rejected (not upgrade-safe). Built a CDS value-help provider (ZVH_Material) and added @Consumption.valueHelpDefinition in a custom project

Trying to do FFT on a CSV with known data

5 November 2025 @ 10:09 pm

i am trying to do a FFt on a CSV with two data columns, Time and amplitude. i am analyzing the periodicity so the data may not be perfectly periodic which is the reason for the fft. i followed a different forum here, and while i am not getting an error, i am getting an image that has no meangful data and i am wondering what i did. i am not much of an expert on fft,this is my first post and im pretty novice.. so i am confused but i know its not supposed to look like the picture. heres my code below: #FFT #Number of samples N = 2793 #frequency of signal fs = 25.0 T = 1 / fs #Nyquist freq Ny = fs / 2.0 #create an array that corresponds to the values in the signal #perform the fft on the signal yf = fft(y) #create new x-axis: frequency xf = np.linspace(0.0, Ny, N//2) #plot results plt.plot(xf, 2.0/N * np.abs(yf[:N//2])) plt.grid(True) plt.show there is a few info given in each CSV, like "Total study time=111.760s , Samples per second=25"

How to create a stacked coefficients plot for multiple linear models in R?

5 November 2025 @ 10:01 pm

I'm attempting to create a coefficient plot for multiple linear models using ggplot2 in R, but I'm facing an issue with overlapping points and error bars when displaying the estimates. I've written a function plot_multiple_models_coefficients to handle the plotting, and it works well to some extent. However, the points and error bars from different models overlap, making it hard to read. I would like to stack the coefficients from the different models vertically while keeping them aligned with their corresponding parameters. Here's the code I have: library(ggplot2) library(parameters) library(dplyr) a <- rnorm(50) b <- rnorm(50) c <- rnorm(50) y1 <- rnorm(50) * 0.5 + a y2 <- rnorm(50) * 0.3 + a + b * 0.3 y3 <- rnorm(50) * 0.2 + a + b + c * 0.8 model1 <- lm(y1 ~ a) model2 <- lm(y2 ~ a + b) model3 <- lm(y3 ~ a + b + c) plot_multiple_models_coefficients <- function(models, model_names,

How to convert a column of duration text strings to numbers in minutes

5 November 2025 @ 9:53 pm

I have a column (of known length) of duration text strings that contains potentially strings that are not duration. And I want to convert just the duration text strings to numbers in minutes. For example, A 14h 58m 30s 22h 28m 1d 7h 27m — Header 1d 20h 2m My plan so far is to extract the day, hour, minute, second numbers into an array for each row and check if any of them contains a real match, and if so, sum up the correct minutes. And thus, my formula is =let(ind_last_row,60 ,time,offset(A1,0,0,ind_last_row,1) ,time_2_arr,lambda(time,REGEXEXTRACT(time,"(\d*d)?\s*(\d*h)?\s*(\d*m)?\s*(\d*s)?")) ,time_arr_2_min,lambda(arr,sumproduct(ar