Programming

Questions about C#, Python, Java, algorithms, and code architecture.

ProgrammingImplement Undo Redo in C++ Gap Buffer Text Editor

Step-by-step guide to implement undo and redo functionality in a C++ text editor using gap buffer data structure. Beginner tips, code examples, best practices, and performance optimization for efficient editing.

1 answer 1 view
ProgrammingHow to Get a Tkinter Menu's HMENU on Windows (Fast)

Why Tkinter doesn't expose a native HMENU on Windows, how to retrieve it with MN_GETHMENU + SendMessage when posted, and use SetMenuInfo to set a background.

1 answer 1 view
ProgrammingC++ coroutine: lifetime of temporary bound to reference

C++ coroutines materialize temporaries into the coroutine frame and store references there, so references to them remain valid across suspension. Key rules.

1 answer 1 view
ProgrammingFix QOpenGLWidget Flicker in PySide6 Layouts

Embed QOpenGLWidget in PySide6 layouts without flickering on resize or idle. Step-by-step fixes, working code example, platform tips for Linux/Windows, and Qt bug workarounds using attributes and QSurfaceFormat.

1 answer 1 view
ProgrammingC Integer Literal Promotion: Windows vs Linux Diff

Why does C integer literal promotion for 2654435769 differ between Windows (LLP64) and Linux (LP64)? Explains signed vs unsigned rules, truncation in uint32_t mul, and fix with 'u' suffix for cross-platform code.

1 answer 1 view
Programmingjpackage MSI Uninstall: Fix File Deletion When App Running

Ensure complete file deletion during jpackage MSI uninstallation when Java app is running. Use Restart Manager, WiX custom actions, and post-uninstall cleanup for Microsoft Store compliance and clean removal of all files and folders.

1 answer 1 view
ProgrammingPractical Self-Contained Boolean Lambda Use Cases in Python

Discover practical use cases for self-contained boolean lambda functions in Python using equality operators. Examples for filtering with python filter lambda, sorting via python sorted lambda, predicates, and more without external dependencies.

1 answer 1 view
ProgrammingWinForms Modernization: .NET Migration & MVP Guide

Step-by-step path for modernizing legacy WinForms apps on .NET Framework 3.5 with God Object code-behind. Upgrade to 4.8, implement MVP pattern, refactor, and migrate to modern .NET with risks and roadmap.

1 answer 1 view
ProgrammingFix OOM Qwen3-0.6B Training on A100 32k Seq Length

Diagnose why OOM hits training Qwen3-0.6B (16 heads) on A100 48GB at 32k sequence with FlashAttention 2. Correct attention matrix estimates, quick fixes like windowed attention, ZeRO-3 offload, and scaling strategies for long sequences.

1 answer 1 view
ProgrammingPython Console Output Without print(): logging & sys.stdout

Output text to the console in Python without print(): compare sys.stdout.write/writelines, os.write, logging, and file/tee with short examples and use cases.

1 answer 1 view
ProgrammingFix Zoho Books API Vendor Credit Error Without Bill ID

Resolve Zoho Books API error 37034 'Select associated bill number or bill type' when creating vendor credits without bill_id. Use bill_type 'OTHER' or bill_number, add account_id. Sample payload and steps to create standalone credits.

1 answer 1 view
ProgrammingIs JavaScript Learning Progress Normal After 20-25 Hours?

Assess if your JavaScript learning progress and OOP approach is typical after 20-25 hours with Python background. Code review, fixes, roadmap, and tips for beginners tackling JavaScript OOP challenges.

1 answer 1 view
ProgrammingExtract Book Titles, Images & Prices with lxml XPath

Extract book titles, image URLs and prices from books.toscrape.com using lxml XPath in Python. Includes sample code, urljoin for images, and error handling.

1 answer 1 view
ProgrammingWhy Git disallows --detach with --orphan (detached HEAD)

Why Git forbids --detach with --orphan, how to detach HEAD by using git checkout on an orphan commit SHA, and scripting patterns to handle orphan branches.

1 answer 1 view
ProgrammingH.264 CAVLC: run_before > zerosLeft Table 9-10 Fix

Fix H.264 CAVLC decoding errors where run_before exceeds zerosLeft in Table 9-10. Learn validation rules, prevent negative zerosLeft, and implement compliant residual block decoding for H.264/AVC decoders.

1 answer 1 view
ProgrammingFix Identical Metrics in TensorFlow Keras CNN Backbones

Diagnose and fix identical accuracy, F1, AUC metrics across VGG16, ResNet50, DenseNet121 in TensorFlow Keras on medical imaging datasets. Check metric state, tf.data caching, preprocessing issues.

1 answer 1 view
ProgrammingCannot assign void to an implicitly-typed variable in C#

Fix 'Cannot assign void to an implicitly-typed variable' in C#: why Split(...).Reverse() may bind to Array.Reverse, missing System.Linq, and practical fixes.

1 answer 1 view
ProgrammingFix Manim OpenGL Text Rendering in Interactive Embed

Troubleshoot Manim CE OpenGL renderer issues with incorrect text or graph rendering in interactive_embed. Quick fixes: switch to Cairo, downgrade IPython to 8.0.1, update Manim. Debug checklist and best practices included.

1 answer 1 view
ProgrammingFix PySpark Pytest Py4JJavaError on Windows 11 SparkSession

Resolve Py4JJavaError in PySpark pytest fixtures on Windows 11 by adding spark.driver.bindAddress=127.0.0.1 to SparkSession. Includes working conftest.py, winutils setup, env vars checklist for local tests.

1 answer 1 view
ProgrammingEntity Framework Core: Fix 'Second Operation Started' Error

Learn why Entity Framework Core throws 'A second operation was started...' and how to fix it: scope DbContext, await queries, or use IDbContextFactory.

1 answer 1 view