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 can I reliably convert invoices from multiple formats into a standardized CSV?

11 June 2026 @ 8:40 am

I'm building an invoice-processing pipeline and currently handle PDFs with tabula-py and XLSX files with openpyxl. import tabula from openpyxl import load_workbook # PDF extraction tables = tabula.read_pdf("invoice.pdf", pages="all") # XLSX extraction wb = load_workbook("invoice.xlsx") sheet = wb.active The problem is HTML invoices. Different vendors use completely different HTML structures, making it difficult to create a generic parser. Some use tables, others use nested divs, and field names vary significantly. My goal is to normalize all invoice formats into a common CSV schema: { "invoice_number": "", "date": "", "vendor": "", "amount": "" } Has anyone implemented a reliable approach for handling HTML invoices at scale? Would you recommend rule-based extrac

How should I weight temporary vs. permanent product issues in a Python scoring algorithm?

11 June 2026 @ 8:36 am

def tea_light_rating(is_led, soot_level, battery_hours, plastic_smell=False): score = 10 if soot_level > 0: score -= 3 if battery_hours < 6: score -= 2 if plastic_smell: score -= 1 return max(score, 0) # Example print(tea_light_rating( is_led=True, soot_level=0, battery_hours=8, plastic_smell=True )) I'm building a small home-decor product rating tool and trying to score tea lights based on factors like soot production, runtime, and initial odor. The problem is that some LED tea lights have a noticeable plastic smell when first unpacked, but the smell usually disappears after a day or two. Should temporary issues like this have less weight in the scoring algorithm than permanent issues such as soot buildup or short battery life? What's the best way to model temporary vs. long-term product drawbacks in a rating system?

How do we run macros in another Excel file without opening it?

11 June 2026 @ 8:34 am

How do we run macros in another Excel file without opening it? My example does not work, it returns error subscription out of range. file pirw.xlsx where we want run process with macros MoveSingleColumn() in file pirw.xlsm Sub callmacros() Dim wb As Workbook Set wb = Workbooks("\\\\s-fa\\PRICES\\m\\pi\\pirw.xlsx") Application.Run "\\\\s-fa\\PRICES\\m\\pi\\pirw.xlsm!MoveSingleColumn()", wb End Sub

Apple NFC & SE Platform request

11 June 2026 @ 8:31 am

I want to request NFC & SE Platform functionality but this link does not seem to work for me. It displays the following message: You must be the Account Holder of an Apple Developer Program for Organizations or an Apple Developer Enterprise Program to view this page. Visit account But in my membership details, as seen in the image below, I am the account holder. How might this happen? Membership details

immvision doesn't think I'm passing an ndarray, even though type() shows it is

11 June 2026 @ 8:18 am

BACKGROUND: Trying to make a python imgui_bundle cartopy app and even though I am making an ndarray, I get an error stating I need a numpy.ndarray even though when I type() it states it is an numpy.ndarray. Just doing a show() when I had just the cartopy stuff, did show the map. So now trying to do it in imgui and make it interactive (i.e. get user mouse hover to ID long/lat). The imgui part alone (sans showing a map) works, the cartopy coding (without the gltexture stuff, just a simple show() works. Now when I try to combine the 2, no go import io import os import numpy as np import matplotlib.pyplot as plt import cartopy import cartopy.crs as ccrs import cartopy.feature as cfeature from imgui_bundle import imgui, immvision, ImVec2, immapp class MapApp: def __init__(self): # Base map bounding box self.base_lat_min, self.base_lat_max = 3, 5 self.base_lon_min, self.base_lon_max = -10, -7 # Current z

What is the recommended way to implement connection pooling with IBM MQ Base Classes when transactions sharing connections across threads?

11 June 2026 @ 8:15 am

I'm using IBM MQ Base Classes for Java (com.ibm.mq.MQQueueManager) and need to implement connection pooling. I cannot switch to JMS APIs, so solutions must use the IBM MQ Base Classes. My understanding is: MQQueueManager represents a physical MQ client connection. A single MQQueueManager cannot safely be shared concurrently across unrelated threads when using transactions (commit() / backout()), because transaction scope is associated with the MQ connection. If multiple threads share the same MQQueueManager, one thread's commit() or backout() may affect another thread's unit of work. I explored a few options but each seems to have drawbacks: Shared MQQueueManager MQQueueManager qmgr = new MQQueueManager(...); All threads use the same instance. Problem:

Google Play rejects for "16 KB page size" — LOAD segments are aligned, but PT_GNU_RELRO end is not

11 June 2026 @ 8:12 am

I'm hitting a wall with the 16 KB page size requirement on a Flutter app that uses a large closed-source SDK (Tuya/ThingClips IPC SDK) which ships prebuilt .so files. Google Play Console rejects my release with "Your app does not support 16 KB memory page sizes." I've already done everything the official docs say: AGP 8.7.3, Gradle 8.9, NDK 27, build-tools 35.0.0 packagingOptions { jniLibs { useLegacyPackaging = false } } By every official check, the app looks compliant: AOSP check_elf_alignment.sh → "ELF Verification Successful" + zip-alignment successful llvm-objdump -p libX.so | grep LOAD → align 2**14 (16 KB) on every lib zipalign -c -P 16 → pass So all LOAD segments are 16 KB aligned. But Android Studio's APK Analyzer (and apparent

Multiple Tables or Single Table in PostgreSQL

11 June 2026 @ 8:11 am

I am designing a database schema for storing original images and their edited versions, and I am trying to determine whether a normalized two-table design or a self-referencing single-table design would be better for the long term. Scenario Images are uploaded and stored with metadata such as: url name client_id product_id After upload, images can be edited (e.g., background removal, color adjustments, cropping, etc.). The original image must remain unchanged. Each original image can have multiple edited versions. Edited images can themselves be edited again, and all versions need to be preserved. I need to be able to trace every edited image back to its original image. Option 1: Two Tables original_images ----

How to share DATA across apps in 2sxc v21, not just content types (DNN)

11 June 2026 @ 8:11 am

We are building a shared taxonomy in 2sxc 21.07 on DNN and would like your opinion on whether we are on the right path, or whether there is a more native approach. The main issue: we want to share the DATA, not just the structure We managed to share the content type structure across all apps using global content types. That part works. But sharing the structure is the easy part. The real reason we are reaching out is the data itself. We want one central taxonomy (Categorie, Subcategorie, Taxonomie and Thema) where the actual records live in one place and are shared across the whole installation, so that: The same records are visible and usable in every app and module, with no duplication. A change to a record in the central store propagates live to all consuming apps and modules. Other modules can not only read the central list, but also create and delete records in that central store. Content in other apps (for example ne

I was solving seive_of_eratosthenes question just now and i am getting the answer in my vim editor but not in w3School editor

11 June 2026 @ 8:10 am

When I am submitting my code then either the output is given as no output or it is saying multiple output. I am confused as why there is this problem. I have tried printing the output, not printing the output. If my code is wrong then why am I not getting the output? My code works perfectly in my vim editor but does not work at w3school editor. Why? My code is: n = int(input()) # Use the Sieve of Eratosthenes to find and sum all primes up to n def seive_of_eratosthenes(n): prime = [True for _ in range(n+1)] prime[0] = False prime[1] = False p=2 while p*p <= n: if prime[p]: for i in range(p*p, n+1, p): prime[i] = False p += 1 primes= [p for p in range(2, n+1) if prime[p]] return sum(primes) total = sieve_of_eratosthenes(n) print(total) Link to the problem: https://www.w3schools