StackOverflow.com

VN:F [1.9.22_1171]
Rating: 9.4/10 (10 votes cast)

Random snippets of all sorts of code, mixed with a selection of help and advice.

mysql python copying columns

16 September 2025 @ 7:25 pm

I have found similar questions, but none that cover my exact situation. I have a table (lets call it A), one of the columns is composed of integers. I want to update this column, from a different table (lets call it B), which contains several columns of integers, one of which I want to use to update the column in A. To be clear, I don't want to add more columns to A nor are all the integers the same. I do appreciate Python has many methods, but the other queries I an using are based around the kind of approach: mydb = mysql.connector.connect( All my database details ) mycursor = mydb.cursor() mycursor.excecute(This is the bit I need with %s variable) val = (column I need in B, ) and I'd like to stick with this if possible.

Google bot crashing server and faking Hotel referrer tag?

16 September 2025 @ 7:14 pm

These error logs have been popping up for a few days now: 34.174.94.233 mod_fcgid: can't apply process slot for /var/www/cgi-bin/cgi_wrapper/cgi_wrapper, referer: https://hotels.com/ 34.174.94.233 mod_fcgid: read data timeout in 45 seconds, referer: https://hotels.com/ 34.174.94.233 (110)Connection timed out: mod_fcgid: ap_pass_brigade failed in handle_request_ipc function, referer: https://hotels.com/ The IP address comes up as Google. Obviously I'm a little nervous about blocking Google but can anyone explain why they'd suddenly hit a server so hard for a few days and why on earth it constantly says referred from hotels.com? I have nothing to do with that site so is Google faking a referrer tag in order to see if I serve up different content to different peop

futex_wait inside a signal handler

16 September 2025 @ 7:10 pm

So I am trying to understand if I am missing anything about calling futex_wait inside a signal handler for a SIGSEGV access violation. Ostensibly, it is not on the list of async-signal-safe calls, however with the assumption that I do not cause a deadlock by the signal being called on the thread that would have called futex_wake, I do not see how there could be any issues/corruption or deadlocks. Specifically, For my use case I am trying to pause all process memory accesses in a region via mprotect()/ signal-handler pattern. During the 'paused' period I am snapshotting the segments of process memory for distributed shared memory type system. FYI, I am trying to avoid userfaultfd, due to not being supported by some container/VM runtimes. My thought process is that this should be safe: A handler for SIGSEGV will be synchronous, and run in the thread that caused the segfault. I can also pretty strongly guarantee that the thread controlling the

Firebase Auth: Password Reset Unexpectedly Unlinks Connected Providers (e.g., Google), Risking Account Deletion

16 September 2025 @ 7:08 pm

Firebase Auth: Password reset unexpectedly unlinks Google provider I’m seeing unexpected behavior with Firebase Authentication when using password resets in accounts that have multiple linked providers. Setup Project settings: Allow duplicate emails: false Email/Password sign-in: enabled Google sign-in: enabled Apple sign-in: enabled User flow: Create a user with [email protected]. Link both Email/Password and Google providers to the same Firebase user. Trigger a password reset with:



FirebaseAuth.instance.sendPasswordResetEmail(email: "[email protected]"); 

 The user opens the Firebase-hosted reset page, enters a new password, and submits successfully. Problem Immediately after the password reset is completed: In the Firebase Console, the Google provider is no longer linked to that account. Only Emai

Open AI Agents SDK: How to handoff back to the previous agent

16 September 2025 @ 7:06 pm

I am building an agent with OpenAi agent sdk.I am using multi model architecture. My first agent is Orchestrator agent and i have two customer support agents which are “appointment creator agent” and “customer creator agent”. Now what I want this flow from my agent like, user query (want to create an appointment with a already created customer) → orchestrator agent → handoff → appointment creator agent. (This flow is working properly). 2.user query(want to create an appointment with unknown customer) → orchestrator agent → handoff → appointment agent → the customer was not found so handoff to → customer creator agent.(this flow is working properly). 3.user query(want to create an appointment with unknown customer) → orchestrator agent → handoff → appointment agent → the customer was not found so handoff to → customer creator agent → user create the customer with customer creator agent → NOW FROM THIS POIN

Read from PDF and copy to Excel cells exactly as formatted

16 September 2025 @ 6:59 pm

I'm using Python with pdfplumber to read a PDF file and copy its contents into an Excel spreadsheet. It works fine, but I want to preserve the formatting and indentation as well as remove extraneous CR/LFs from the PDF. Here is my script: # Script to copy PDF sections into Excel tabs using fuzzy matching import os import sys import pdfplumber from openpyxl import load_workbook from rapidfuzz import fuzz, process import re as _re PDF_DIR = 'files' EXCEL_PATH = os.path.join( PDF_DIR, '_Information Security Policy Documents.xlsx') # Verbosity flag (enable with --verbose CLI arg) VERBOSE = '--verbose' in sys.argv def log(msg): """Print debug message when verbose mode is active.""" if VERBOSE: print(msg) # Section headers to look for SECTION_HEADERS = [ 'Minimum Requirements', 'Supporting Guidance', 'Related Controls', 'References', 'Overlay Requirements' ] CONTROL_ID_PATTERN = r'^[A-Z]{2,3}-\d{2}(

Why does hitting enter in a textbox cause my regex to fail

16 September 2025 @ 6:57 pm

I have a regex on a textbox in order to limit it to specific characters. It includes the following /^([A-Za-z0-9 .,':;/?()!-]|\\[rn])*$/ I am validating onBlur and displaying an error message when the user enters a forbidden character. For some reason, though, it displays an error for a carriage return. When I try to console.log the content of my textbox, it doesn't print the carriage return as any special character, and just has the extra space in the console. ex: "Hello World " How can I modify my regex to allow a user to hit the enter key within the textbox?

Drop column by index in polars

16 September 2025 @ 6:43 pm

I need to drop the first column in a polars DataFrame. I looked here and it suggests: result = df.select([col for idx, col in enumerate(df.columns) if idx != 1]) It looks long and clumsy for such a simple task? I also tried: df.select(pl.exclude(pl.nth(1))) but that errored out --------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[20], line 1 ----> 1 df.select(pl.exclude(pl.nth(1))) File \.venv\Lib\site-packages\polars\functions\lazy.py:1855, in exclude(columns, *more_columns) 1785 def exclude( 1786 columns: str | PolarsDataType | Collection[str] | Collection[PolarsDataType], 1787 *more_columns: str | PolarsDataType, 1788 ) -> Expr: 1789 ""&qu

Fast unnest complex column with data.table

16 September 2025 @ 6:24 pm

I have a dataset where the column to unnest contains data with unequal rows and columns rather than data with equal dimensions. I'm looking for a fast approach to unnest this dataset using data.table. Example dataset: dt1 <- structure(list(a = c("a1", "a1", "a1", "a1", "a2", "a3", "a3", "a3", "a3", "a3"), df1 = list(structure(list(b = c("b1", "b2" )), class = "data.frame", row.names = c(NA, -2L)), structure(list( b = c("b1", "b2")), class = "data.frame", row.names = c(NA, -2L)), structure(list(b = c("b1", "b2")), class = "data.frame", row.names = c(NA, -2L)), structure(list(b = c("b1", "b2")), class = "data.frame", row.names = c(NA, -2L

How do I add a row after a group of data in Google Sheet to overcome its time limit?

16 September 2025 @ 1:57 pm

I'm very new to using Apps Script, and I'm working with a sheet with over 82,000 rows. I'd like to run a script to create an empty row after a group of surnames (column A) sorted alphabetically to make it easier to read, but with such a large sheet, I run into the infamous time limit. Running a script 20+ times and having to adjust the sheet every time is frustrating and time-consuming. But at the same time, I'm hitting a brick wall with my limited knowledge on how to circumvent the issue. Since I'm not familiar with array formulas, I haven't tried them, but I'd prefer a script solution in case I have to add any changes to the sheet. I've tried this script, but it causes issues with groups (like putting blank rows in the group rather than after it), and since it runs from the bottom up, I can't maintain my alphabetical sorting. It also doesn't solve the time limit issue, requiring me to do it multiple times with adjustments to the sheet to remove rows it affected previously.