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.

Trying to do absolute paths in Vite

11 June 2026 @ 8:51 pm

I want to stop using relative paths and just do a basic absolute path, no @ symbol, just something like "component/General/Button" type thing. Here is what I currently have in my config but it does not seem to resolve any of the paths I have set up: import react from "@vitejs/plugin-react"; import { defineConfig } from "vite"; import path from "path"; // https://vite.dev/config/ export default defineConfig({ base: "/", plugins: [react()], resolve: { alias: { "api": path.resolve(__dirname, "./src/api/*"), "context": path.resolve(__dirname, "./src/context/*"), "components": path.resolve(__dirname, "./src/components/*"), }, }, server: { port: 3000, }, }); What am I doing wrong or how can I set up my resolver? I just want to start at src and all the paths are set fro

Cloudfront api-gateway internalalb eks istio pods

11 June 2026 @ 8:39 pm

I have deployed frontend and backend as pods in eks and configured istio ingress gateway for routing. I have configured internal alb and configured api-gateway and cloudfront. I am not able to see frontend ui on browser. Can anyone reach me and help immediately. Pls anyone connect with me to help.

xml: uncapturable attribute

11 June 2026 @ 8:18 pm

xidel 'https://en.wikipedia.org/wiki/List_of_trigonometric_identities' -e '/html/body/div[3]/div/div[3]/main/div[3]/div[3]/div[2]/table[1]/tbody/tr[2]/td/span/a/img' --output-format=xml outputs <?xml version="1.0" encoding="UTF-8"?> <img src="//upload.wikimedia.org/wikipedia/commons/thumb/4/48/Trig_Functions.svg/250px-Trig_Functions.svg.png" decoding="async" width="250" height="250" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/4/48/Trig_Functions.svg/500px-Trig_Functions.svg.png 2x" data-file-width="419" data-file-height="419"/> , but then xidel 'https://en.wikipedia.org/wiki/List_of_trigonometric_identities' -e '/html/body/div[3]/div/div[3]/main/div[3]/d

Best practice for updating nested resume data in PostgreSQL: delete-and-reinsert vs differential updates?

11 June 2026 @ 7:33 pm

I'm building a resume builder application using FastAPI and PostgreSQL (via Supabase). My data is normalized across multiple tables: personal_info locations skills experience education projects certifications technical_participation co_curricular extra_curricular achievements Each table has a user_id foreign key. The frontend sends the entire resume as JSON whenever the user clicks "Save": { "personal_info": { ... }, "skills": [...], "experience": [...], "education": [...], "projects": [...], "certifications": [...], "technical_participation": [...], "co_curricular": [...], "extra_curricular": [...], "achievements": [...] } A user can make any combination of changes before saving: Update an existing experience entry Delete an experie

How can my rotating image gallery be made to fit within the main container of a responsive website?

11 June 2026 @ 6:56 pm

I am attempting to make my own website. The layout is lifted from here. I found a guide on making a marquee here (it's a div with a CSS animation) and combined it with a flexbox horizontal image gallery based off what I found here to make a rotating image gallery. This is my second attempt making one, and the first time it's worked. However, the problem is that the marquee's width must be smaller than the horizontal image gallery's width for the images to actually scroll (and not elongate the entire web page, which has been the problem I am running into). But this set pixel width means my website is no longer responsive; I want for when the window is downsizes, for the marquee width to also be shrunk. H

How can I get a source code of Python function which was declared by using 'exec' inside other function?

11 June 2026 @ 6:49 pm

I need to get a source code of Python function which was declared via using exec inspect.getsource can't help me with that. Simplified Example: from inspect import getsource def declare_func(): func_code=\ '''def new_func(): print("Hello, world!")''' exec(func_code) return locals()['new_func'] func = declare_func() print('=run=') func() print('=func=') print(func) print('=code=') print(getsource(func)) Output: =run= Hello, world! =func= <function new_func at 0x000001DF77173E20> =code= ... OSError: could not get source code How can I get source code of the 'func' ? Note1: I can't avoid using exec for declaration of functions, because it happens in 3d-party Python module which I unable to edit. Note2: fun

javascript-based annotations for text?

11 June 2026 @ 6:42 pm

I'm converting a latex document to html, and the document contains many annotated code listings, made using tikz. An example is shown below. Currently, I'm just converting these into images to use them in the html document. It would be much better if I could use actual text on the web page, and have the annotations drawn with javascript. Do you know of anything that would let me annotate text with javascript in this way, ideally leaving the annotated text still selectable and copyable? A small C program with annotations pointing to various parts of the program

Centered ScrollView content doesn't return to position after pull-to-refresh with a large navigation title in SwiftUI

11 June 2026 @ 4:07 pm

Q: Is there a way to keep centered ScrollView content from shifting down after .refreshable completes in SwiftUI? Expected effect: The placeholder content stays centered in the middle of the screen after pull-to-refresh finishes. Outcome: The content shifts downward after refresh and only returns to its centered position if I manually scroll. What I tried: I also tried using a GeometryReader to center the content inside the ScrollView, but I got the same result with the .refreshable ScrollView combination. Environment: Deployment target: iOS 26 Reproduced on: Preview / Simulator / real device iOS versions tested: iOS 18.x, iOS 26.x Minimal reproducible example

Merge rows of a SQL table to fill null with existing values

11 June 2026 @ 3:36 pm

I have a SQL table like this Id A B 1 value1 null 1 null value2 Is there a nice way to make a select query returning Id A B 1 value1 value2 Of course, I have many more rows lines and many more columns in my real table. A generic approach would be appreciated.

WSGI start_response or add_header()

11 June 2026 @ 3:22 pm

Should I be using the WSGI start_response() or the Header.add_header() method in a WSGI application? Problem I have is that when using start_response() the headers which are set don't seem to be accessible in any way afterwards, which I wanted to do for logging purposes. Also will want to set additional headers but not sure if I can do that with start_response(). from wsgiref.simple_server import make_server from wsgiref.headers import Headers def hello_world_app(environ, start_response): status = "200 OK" # HTTP Status headers = [("Content-type", "text/plain; charset=utf-8")] # HTTP Headers start_response(status, headers) h = Headers() print(h.get_all('Content-type')) h.add_header('Content-type', 'text/plain') print(h.get_all('Content-type')) return [("%s: %s\n" % (key, value)).encode("utf-8") for key, value in environ.items()]