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.

How do I code a CSS Selector to find a specific button, click on it, and wait until the webpage has completed the clicked task?

30 November 2025 @ 12:01 am

I have a working web scraper written in Python, Selenium and Chromedriver (all up-to-date version wise) and various other software packages. The target webpage has a field for the phone number, but you have to click a button to reveal it: <button aria-busy="false" class="sc-adc2db3f-0 cLDdWI sc-608879d0-0 cbUwJX"> <div class="sc-eb45309b-0 kexGZq"> <svg aria-hidden="true" color="#373373" fill="none" focusable="false" height="24" viewbox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"> <path d="M18.078 14.702c-.502-.6-1.506-.5-1.908.2-.602 1-.903 1.3-1.204 1.3-2.21-.3-6.928-5-7.129-7.2 0-.1 0-.3 1.406-1.2.703-.4.803-1.3.2-1.8-2.61-2.4-2.71-3-3.513-3-1.607 0-3.113 4-2.912 5.7.502 4 8.835 12.3 12.

Looking for workaround for library with missing interface

29 November 2025 @ 11:59 pm

I have a Java library (FIHR) where there are conventions in a bean class hierarchy that were NOT formalized as an interface. For example many subclasses have a getStatus() property but there is no interface that formalizes that in a way that allows for me to share code as follows: if (bean instanceof HasStatusProperty bean2) { System.out.println("Status for this bean: " + bean2.getStatus(); } Can anyone think of a way to sortof project such an interface on a class that comes from a library. The best I can think of is to use the Reflection API to test if it has that property and get the value. But that's cumbersome.

How can I run Flux2 inference on 2 GPUs?

29 November 2025 @ 11:59 pm

I try to run Flux2 inference on 2 GPUs as follows: import torch from diffusers import Flux2Pipeline from accelerate import PartialState import argparse from pathlib import Path def main(): parser = argparse.ArgumentParser(description='Generate images using FLUX.2-dev with multi-GPU support') parser.add_argument('--prompt', type=str, default="Futuristic city", help='Text prompt for image generation') parser.add_argument('--output', type=str, default='flux2_output2.png', help='Output image filename') parser.add_argument('--steps', type=int, default=28, help='Number of inference steps (default: 28, max recommended: 50)') parser.add_argument('--guidance-scale', type=float, default=4.0, help='Guidance scale for generation (default: 4.0)') parser.add_argument('--seed', type=int, defau

How does Gboard on Android, when typing into a textfield on Chrome mobile does "select all"?

29 November 2025 @ 11:53 pm

I have a <input type="text"... ...on a page, and need to copy all the changes so that I can display them in a wasm app. I'm stuck with this "select all" operation on Gboard. Lets say that I type ab, then select all. (Select all command is reachable in the 4 black squares menu and then the "carret" icon). The series of events that I get, (and that can easily be checked with this tool InputEvent viewer) is: keydown: Unk beforeinput: a input: a keyup: Unk keydown: Unk beforeinput: b input: b keyup:Unk keyup: Shift keydown: Shift (this is were they become selected) keyup: Shift So, this unbalanced sequence of shift keys that starts with a keyup somehow does the select-all operation. What is going on here,

vllm failed to run because RM has detected an NVML/RM version mismatch

29 November 2025 @ 11:40 pm

trying to run vllm on the current machine with Tesla T4, cuda 12.4, ubuntu 22.0.4 the host info and cuda info is as followed nvcc --version nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2024 NVIDIA Corporation Built on Thu_Mar_28_02:18:24_PDT_2024 Cuda compilation tools, release 12.4, V12.4.131 Build cuda_12.4.r12.4/compiler.34097967_0 running the ollama is ok time=2025-11-30T07:24:49.679+08:00 level=INFO source=gpu.go:217 msg="looking for compatible GPUs" time=2025-11-30T07:24:50.126+08:00 level=INFO source=types.go:130 msg="inference compute" id=GPU-cd68373a-b857-7671-860b-0d17f4c2d4cf library=cuda variant=v12 compute=7.5 driver=12.2 name="Tesla T4" total="14.6 GiB" available="13.9 GiB" have installed the vllm through uv pip install vllm --torch-backend=auto but running the command comes with the errors v

JavaScript crossword input freezes and focus does not move to the next cell

29 November 2025 @ 11:36 pm

Problem When I type a letter into a cell, the focus does not move to the next cell in the word. After typing a letter, the entire input system becomes unresponsive — I can’t type more letters, delete them, or click on other cells. It feels as if an event handler throws an error and stops all further execution. I guess all problems are in renderGrid() but I don't know where exactly they are (I have all html elements written correctly) const GRID_ROWS = 10; const GRID_COLS = 10; const WORDS = [ // Across { word: 'READ', clue: 'To look at and comprehend written words', row: 0, col: 0, direction: 'ac

What is responsible for the extranuous text in the terminal window?

29 November 2025 @ 11:33 pm

I have this trivial test script: print('test sentence') When I press F5 to run and debug the script I expect to see the output "test sentence" but there is a lot of extra text mixed with the output: actual output: (venv) PS C:\Users\winne\OneDrive\Desktop\Python\lesson> c:; cd 'c:\Users\winne\OneDrive\Desktop\Python\lesson'; & 'c:\Users\winne\OneDrive\Desktop\Python\lesson\venv\Scripts\python.exe' 'c:\Users\winne\.vscode\extensions\ms-python.debugpy-2025.16.0-win32-x64\bundled\libs\debugpy\launcher' '56110' '--' 'C:\Users\winne\OneDrive\Desktop\Python\lesson\input.py' test sentenceauncher' '56110' '--' 'C:\x5cUsers\x5cwinne\x5cOneDrive\x5cDesktop\x5cPython\x5clesson\x5cinput.py' ;365da17d-7ed5-4b56-931f-2fcc1187c30dinput.py The environment seems to be set up correctly, the interpreter is selected from the environment...

Trying to create a method to verify time

29 November 2025 @ 11:16 pm

I'm new to python and i've been taking some courses to try and get the hang of it, as a proyect to challenge myself i tried to recreate a library method to check for borrowed books and etc. However i wanna do it manually without using python's functions However i am kind of lost in how to create the method to verify that the time has the correct format (it's supposed to be dd/mm/2023) I've been using this code i found as a guide import datetime i def check_date(year, month, day): correctDate = None try: newDate = datetime.datetime(year, month, day) correctDate = True except ValueError: correctDate = False return correctDate but i cannot find a way to make it work by myself

C# 12 - How do I make sense of this behavior? Passing an array of non-nullable reference type to a parameter expecting nullable reference type array

29 November 2025 @ 11:13 pm

I am on a quest to understand the nullable reference type system in C# (well, I guess the non-nullable reference types are the unique part). The mechanics of this particular situation are totally lost on me. I have a method private static void ArrayModify<E>(E?[] arr) where E : class { } (The class constraint is just to guarantee that null can actually be assigned to an element of the array in some hypothetical code.) If I write the following: string[] array = new string[3]; ArrayModify(array); I get no warnings or errors. This makes no sense to me. I understand why a non-nullable type can be implicitly converted to a nullable type normally. But being able to implicitly cast A to B doesn't mean you can implicitly cast A[] to B[]. Of course, nullable reference types are not actually implemented in that

Android Material3 Outlined Button Looks Different from Guideline

29 November 2025 @ 11:12 pm

XML: <Button android:id="@+id/send_button" style="@style/Widget.Material3.Button.OutlinedButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Send" /> Result: Solid black border enter image description here Guideline: Light gray border https://m3.material.io/components/buttons/guidelines enter image description here My project theme (default): Theme.Material3.DayNight.NoActionBar