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.

Both clang and gcc overcautious in preventing by-value copy constructor? Or correctly following an overcautious standard?

11 May 2026 @ 11:21 am

Consider the following code: #include <concepts> template <typename T> class A { A(A<void>) requires (!std::same_as<void, T>){} }; It is rejected by the newest versions of clang and gcc, both pointing to the fact that copy constructors must pass their argument by reference (godbolt). However: Looking at the signature this is only is a copy constructor if the class template parameter T happens to be void and the requires-clause deliberately prohibits instantiation of the constructor in this case. Let's look at the relevant standard paragraph A declaration of a constructor for a class X is ill-formed if its first parameter is of type cv X and either there are no ot

GuiBuilder compiling creates JAXB error every two tries

11 May 2026 @ 11:13 am

IntelliJ IDEA 2025.2.3, Java jdk & language level 11, file created with jDeploy, cn1 version 7.0.236 <-same problem when updated to newest version. I can successfully create (create-gui-from) and edit a gui form using the guibuilder command mvn cn1:guibuilder -DclassName=com.github.name.untitled4.gui.Test1, but when I build it, it comes up with the errors: timeStr=1.0.0-1778496107786-1778496447286, lastTime=1.0.0-1778496107786-1778496181036 Processing GUI builder file: ~\IdeaProjects\untitled4\common\src\main\java\com\github\name\untitled4\gui\Test1.java Attempting to generate GUI sources for ~\IdeaProjects\untitled4\common\src\main\guibuilder\com\github\name\untitled4\gui\Test1.gui with System JAXB Failed to generate Gui Source with System JAXB. Will attempt using bundled JAXB. May 11, 2026 8:47:42 PM com.codename1.build.client.GenerateGuiSources generateGuiSource INFO: null WARNING: An illegal reflective access operation has occurred WARN

Delete Query working in SQLYog, but not in Java

11 May 2026 @ 11:10 am

@Override public String getDeleteQuery() { return "DELETE FROM prod_evidencija WHERE idProdavac = ? AND idProdavnica = ? AND datum = ?"; } @Override public void fillDeleteStatement(PreparedStatement ps) throws SQLException { ps.setInt(1, prodavac.getIdProdavac()); ps.setInt(2, prodavnica.getIdProdavnica()); ps.setDate(3, java.sql.Date.valueOf(datum)); // ps.setObject(3, datum); System.out.println(datum); //2022-07-24 } This is my delete query for object of type prod_evidencija, which has a composite primary key consisting of foreign keys idProdavac and idProdavnica, and its own LocalDate field datum. (these 3 are the only columns in the db table. the type of column datum in the database is date). prod_evidencija is an associative class of objects prodavac and prodavnica public <T extends DomainObject<T>> Object delete(T obj) throws SQLExc

How would I have CMake check for the availability of the bash shell?

11 May 2026 @ 10:50 am

In a project of mine, I want to run a bash shell script (e.g. to do some code generation). On Unix/Linux systems, I can just assume the script will run; but on Windows, I cannot. How can I check, using CMake, that bash scripts can be executed? And possibly figure determine how to execute them, i.e. whether directly or through calling some executable?

Print Preview doesn't show all elements

11 May 2026 @ 10:48 am

I want to print from a WinUI 3 app but am having a problem where images don't always show up. I am following the document Print from your app and the Coloring Book sample. I am finding that images do not show up on the first page (or sometimes two pages) of the preview, and are also missing from the printout (just using print-to-pdf). The images are just loaded from local URLs in the Assets folder. I suspect something to do with async, i.e. the image pixels aren't ready at the time the preview is assembled, because the preview does usually work if I cancel and start again. Here are some parts of the code; it's difficult to post a minimal self-contained WinUI app but the full code is on

How to stop VS Code Python Debugger from switching tabs, opening terminal and the debugger up on the sidebar?

11 May 2026 @ 10:45 am

Whenever starting debug with Microsoft's Python Debugger extension, the terminal pulls up, which covers up half the editor. When it hits a breakpoint, the debugger tab is chosen on the sidebar, and the tab with the file where breakpoint was hit is opened. This constantly interrupts my workflow, and I haven't found any toggles to disable any one of those three annoyances.

JavaScript Tic Tac Toe game winner logic not working [closed]

11 May 2026 @ 10:41 am

I created a Tic Tac Toe game using HTML, CSS and JavaScript. But my winner detection function is not working correctly. GitHub Repo: https://github.com/yourname/tic-tac-toe

Cannot spy on AppState changes in React Native

11 May 2026 @ 10:36 am

I have custom hook useAppState to manage app state changes via this reusable code and I want to test appstate changes, foreground and background durations in Jest and React Native Testing Library using spyOn instead of mocking API, but it seems not to be working as expected. useAppState.tsx: import {useEffect,useCallback,useState,useRef} from 'react' import { AppState,AppStateStatus, } from "react-native"; const useAppState = () => { const [appState, setAppState] = useState<UseAppState>(()=>{ const now = Date.now() return{ currentState:'active', isForground: true , isBackground:false , lastBackgroundAt:undefined, lastForgroundAt:now, backgroundDuration:undefined, //how mucg time spent on bg forgroundDuration:undefined, } }) const appStateRef = useRef<AppStateStatus>(appState.currentState) const handleAppState = useCallback((next:Ap

cx_Freeze .exe exits immediately after running, prints only initial print()

11 May 2026 @ 10:33 am

I’m trying to package a Python 3.11 project with cx_Freeze on Windows 10/11. The build completes successfully, but when I run the .exe I only see the first print statement and then it closes immediately: (venv) PS C:\path\to\build\exe.win-amd64-3.11> .\MainExecIsukim.exe one # exe stops here I see this warning during build: Missing dependencies: ? api-ms-win-core-path-l1-1-0.dll This is not necessarily a problem - the dependencies may not be needed on this platform. What I’ve tried: Verified all Python packages are installed in the venv. Checked the build log — all .pyd extensions and Python modules are copied. Added a try/except around main code — no exceptions printed during runtime. Confirmed .env and data files exist in the build folder (copied manually).

How to restructure a static Java database to differentiate between 2D (Area) and 3D (Volume) shapes?

11 May 2026 @ 10:24 am

I am building an app that identifies geometric shapes. Currently, I use a single ShapeData class to store all shapes in a static list. My class uses a single field called volumeFormula for the explanatory text. This works for 3D shapes (Cube), but is semantically incorrect for 2D shapes (Square), which have an area, not a volume. I need to differentiate them programmatically so my UI can display either a "Read Area" or "Read Volume" button. What is the best object-oriented approach here? An Enum (ShapeType.D2, ShapeType.D3)? Inheritance (Abstract ShapeData with Shape2D and Shape3D subclasses)? Nullable fields (areaFormula and volumeFormula)? here is an example code: import java.util.ArrayList; import java.util.List; public class ShapeDatabase