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.

Interpolation method in the scipy RegularGridInterpolator class

28 May 2026 @ 9:49 am

I am trying to understand how the RegularGridInterpolator class from scipy.interpolate works. When creating an instance of the class, one can specify the interpolation method (“linear”, “nearest”, “slinear”, “cubic”, “quintic” or “pchip”). However, when calling the spline it is possible to specify a different method, though the default one is the one specified when creating the instance of the class. This is very surprising the me. The way I expect this class to work is that when the instance of the class is created, a system of equations is solved to find the spline coefficients. When calling the spline, the interpolation is evaluated using these pre-computed coefficients. Certainly, that is how it works for one-dimensional splines like the CubicSpline class. Is it or is it not the case that the RegularGridInterpolator class stores these pre-computed coefficients? Surely, they are not calculated for every call, which would extremely inefficient

React Native Firebase Firestore getDoc() hangs indefinitely after setDoc()

28 May 2026 @ 9:40 am

I'm using @react-native-firebase/firestore in a React Native app. I'm experiencing a strange issue where getDoc() hangs indefinitely after a previous setDoc() call on the same document. The important detail is that these calls are not necessarily executed sequentially in the same place. The functions are exported and used from different parts of the app, and there can even be several minutes between the setDoc() and the later getDoc() call. Simplified example: import { getFirestore, doc, getDoc, setDoc } from '@react-native-firebase/firestore'; async updateBlock(nivel: string, unidad: string, bloque: string, exercises: AppExercise[]): Promise<void> { const key = docId(nivel, unidad, bloque); await setDoc(doc(getFirestore(), 'app_exercises', key), { exercises: exercisesMap }); }, import { getFirestore, doc, getDoc, setDoc } from '@react-nati

PHP API routing with parameters

28 May 2026 @ 9:33 am

I have the following route in a PHP router class: $router->add('/public/bookings/get/{id}', array( 'controller' => 'Bookings', 'action' => 'getBookingId' )); How do I make the regex logic in the Router class for route selection? I have the following code but it does not match: foreach ($this->routes as $route => $params) { $pattern = str_replace(['{id}','/'], ['([0-9]+)', '\/'],$route); if(preg_match($pattern, $url['path'])) { $this->params = $params; } }

Why does the view's internal state is not updated for first mutation when doing it via an Computed Binding

28 May 2026 @ 9:27 am

Attaching the demo code: import SwiftUI struct BufferTest: View { @Binding var text: String @State private var buffer: String = "" @State private var presentModificationSheet: Bool = false var bufferedBinding: Binding<String> { Binding { text } set: { buffer = $0 if text != buffer { presentModificationSheet = true } } } var body: some View { Text("Binding: \(text)") // Text("Buffer: \(buffer)") InternalModder(binding: bufferedBinding) .sheet(isPresented: $presentModificationSheet) { TerminalSheet(text: $text, buffer: buffer) } } struct InternalModder: View { @Binding var binding: String var body: some View { Button("Set") { binding = "New Value" + (1...10).randomElement()!.formatted() } }

TailwindCSS CLI v4.3.0 is generating boilerplate classes

28 May 2026 @ 9:15 am

Attempting to use the standalone executable on Linux. I tried making a src folder with just style.tailwind.css and home.html, then I used tailwindcss-linux-x64 -i src/style.tailwind.css -o dist/style.css Whether I use --optimize, --minify, it always generates tons of extra classes in my file. I tried making the input stylesheet just be empty and it still generates tons of extra classes I don't need. @import 'tailwindcss'; @theme { } I tried making a new folder so that Tailwind would only know the file I give it explicit access to since it can "see" other files in the current directory. It still generates every color class it could ever need, about 4k lines of boilerplate. I tried copying just the sample HTML from the playground

Declaring and using a pointer is assembly

28 May 2026 @ 8:51 am

Note I'm practicing asm after reading a book, sample code below is a skeleton function to read a file (it's incomplete and for practice only). I'm allocating a 64 bit pointer file_buffer resq 1 in section .bss and using it for malloc and free C functions to allocate buffer into which I'm planing to read file contents. Question is, is this correct method to declare and use a pointer in general? If you see anything else wrong let me know as a bonus if you want. Unfortunately I wasn't able to find much by searching, except this question but it doesn't tell what I want to know. extern printf extern malloc extern free global read_file section .data NL equ 10 ; syscall codes SYS_open equ 2 SYS_close equ 3 SYS_lseek equ 8 ; SYS_open modes O_RDONLY equ 00000000q ; lseek whenc

Safari getting invalid_request in plug-in cards

28 May 2026 @ 8:12 am

We are finding that in Safari on Desktop that our dashboard plug-in card including other plug-in cards we didn't create such as Zogo are not loading properly and just displaying the error invalid_request. Based on my observation, the main difference between Chrome and Safari is that Safari doesn't complete the OIDC flow. For example, when the plug-in card iframe via the src attribute makes the initial request to our backend (which is the first redirect URI defined for the external application), we return a direct to a URL such as https://digital.garden-fi.com/a/consumer/api/v0/oidc/auth for the digital garden with all the necessary query string parameters. Then when the browser follows that request it gets a redirect to a URL such as

What is the pattern for the layer heights of a deterministic skip list?

28 May 2026 @ 6:22 am

Before working on single-element insertion or deletion, I’m wondering if the initial list values can be inserted better than starting with an empty list then inserting N times. The constraint on the list is that you can have at most two elements with the same height layer in a row. If you end up with 3 in a row, one of them has to be promoted to a higher layer number (not necessarily L + 1) For example: 1 1 2 1 2 3 // nope 1 2+ 3 1 2+ 3 4 1 2+ 3 4 5 // nope (3-4-5) 1 2+ 3 4+ 5 1 2+ 3 4+ 5 6 1 2+ 3 4+ 5 6 7 // nope (5-6-7) 1 2+ 3 4+ 5 6+ 7 // nope again (2-4-6) 1 2+ 3 4++ 5 6+ 7 I can see a pattern, but I don’t know how to calculate it in advance. You saw here I had to backtrack, so the function returning the number-and-layer list needs to be given the list count in advance. (For instance, if I feed the function 7, the entry for 4 should be marked with double layers. But only a single layer for an input of 5 or 6.)

What is the best practice to model and query a tree (hierarchical) data structure in PostgreSQL

28 May 2026 @ 4:48 am

I am working on a project where I need to represent a tree structure (categories and subcategories) in PostgreSQL. I know the basic "Adjacency List" approach, where each row has a parent_id pointing to its parent node. However, I am concerned about performance when I need to query all descendants of a node at deep levels. Is it better to use recursive queries (WITH RECURSIVE) with the parent_id approach, or should I consider PostgreSQL extensions like ltree to handle trees more efficiently? Thanks for the help!

pulling manifest Error: pull model manifest: file does not exist

27 May 2026 @ 11:52 pm

Below is my model file content. My GGUf file downloaded from Huggingface is Qwen2.5-1.5B-Instruct.Q8_0.gguf. It is in the same directory as the model file. The model is 1.9 GB. I have 34GB of RAM on my CPU Choose a base model (Required) FROM Qwen2.5-1.5B-Instruct.Q8_0.gguf These are my errors from running the commands below. The manifest file is in the c:/ollama dir PS C:\ollama> ollama create testmodelnew -f ./Modelfile C:\ollama> ollama pull testmodelnew pulling manifest Error: pull model manifest: file does not exist PS C:\ollama> ollama run testmodelnew Error: 500 Internal Server Error: unable to load model: C:\ollama\models\blobs\sha256-5a88e4c45b13c7551d14defd9fe8e9326ccfdb5bf3ed840d3e23e4d1a0373baf