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.

Adding geom_text in patchwork with shared y-axis and both positive and negative values

25 November 2025 @ 11:45 am

Hello everyone, I have a patchwork plot consisting of a total of four plots, but the procedure here is mainly relevant for two of them because it can be applied to both, I guess. These two plots share a common y-axis (with y = 0), and both positive and negative values are displayed in each plot. I would like to add geom_text for both the positive and negative values in each plot. How can I implement this so that geom_text is always positioned correctly? Thank you very much for any help or suggestions! # Data for p1 and p3 = plot_oben data_schule_schulform <- structure(list(Schuljahr = c("2017", "2017", "2017", "2017", "2018", "2018", "2018", "2018", "2019", "2019", "2019", "2020", "2020", "2020", "2020", "2021", "2021", "2021", "2021", "2022",

Sub-connection to secure main connection

25 November 2025 @ 11:44 am

in our package that we use for connecting to database and perform stuff on it (like read table, insert data, ...) we have a special method that we pass to pandas.to_sql method to insert data to SQLServer using SQLalchemy. The method has a part (the method and the comment was made by person who created that method, and he is not working with me anymore) : # By using a new connection we secure the main connection # from getting invalidated in the case of connection drop. # Otherwise, the transaction for inserting the whole dataframe # gets rolled back once the main connection is invalidated with conn.engine.connect() as new_conn: new_conn.execute(table.table.insert(data)) and after updating the SQLalchemy in our repo to the newest version this part of code was raising errors: TypeError: TableClause.insert() takes 1 positional argument but 2 were given

React RTK Typescript: Using `ReturnType<AppStore['getState']>` vs `ReturnType<typeof store.getState>` when inferring RootState type

25 November 2025 @ 11:42 am

I've been reading up on React/Redux documentation, specifically on setting up types for the main redux application store, and was wondering if there are any significant differences when it comes to inferring the RootState (and Dispatch) type. Consider a simple store: store.ts import { configureStore } from '@reduxjs/toolkit' // ... const store = configureStore({ reducer: { posts: postsReducer, comments: commentsReducer, users: usersReducer, }, }) Two approaches I have seen when inferring types for RootState and AppDispatch : Approach A (as seen in the Redux docs) // Get the type of our store variable export type AppStore = typeof store // Infer the `RootState` and `AppDispatch`

How to manage multi-region branding (colors + UI variations) in a single Next.js repo without increasing code complexity?

25 November 2025 @ 11:42 am

I’m working on a telco project that will be deployed across eight different regions. Each region will have: Different color branding Possibly some UI component variations However, all API integrations, logic, and features remain the same across regions. I want to maintain a single centralized repository, instead of creating eight separate repos. The challenge is: if I keep all regions in one codebase, it may lead to multiple if/else checks, which will increase code complexity and reduce maintainability. Project stack: Next.js (App Router)

Most Underrated Frontend Best Practice for Performance?

25 November 2025 @ 11:41 am

In modern front-end development, there are many techniques to improve performance like lazy loading, code splitting, and memoization. In your experience, which underrated best practice has made the biggest impact on real-world performance, and why do you think more developers overlook it?

Why is cargo build not rebuilding my module?

25 November 2025 @ 11:40 am

I feel this must be very basic stuff. I haven't been doing much Rust for about a year. I have a lib.rs file in which I've changed a line: let logging_root_dir = if production_run {"ephem"} else {"temp"}; let platform = env::consts::OS.to_ascii_lowercase(); let _logging_project_dir = ""; if platform.starts_with("win"){ let _logging_project_dir = format!("D:/{logging_root_dir}/logging/{project_name}/"); } else if platform.starts_with("lin"){ let _logging_project_dir = format!("/media/mike/aaa/{logging_root_dir}/logging/{project_name}/"); } else { return Err(anyhow!("*** Failed to configure logging: OS |{}| not yet catered for platform: |{}|, for logging...", env::consts::OS, platform)) } That final line was previously return Err(anyhow!("*** Failed to configure logging: OS |{}| not yet catered for, for logging...", env::consts

AltiumDesigner script leaves visual artifacts after moving components

25 November 2025 @ 11:38 am

Moving components from a script causes persistent visual artifacts that don’t disappear even after restarting. Here is what I've tried: All code that moves components executes between these 2 procedure calls: PCBBoard.BeginModify; [...] PCBBoard.EndModify; I update the components as such: Component.MoveToXY(MMsToCoord(X), MMsToCoord(Y)); [...] Component.GraphicallyInvalidate; At the end I also call these procedures: PCBBoard.ViewManager_FullUpdate; PCBBoard.ViewManager_UpdateLayerTabs; which (I expected) should fully redraw PCB editor without leftover graphics. What is the correct way to force a clean redraw or invalidate the viewport?

Cannot build jar from spring jms source code

25 November 2025 @ 11:37 am

I need to build a jar for the Spring Framework's JMS component. I'm running into a problem compiling classes for the Spring AOP component used within Spring JMS. It requires classes from org.springframework.aop.target, but I can't compile them because the compileJava task already requires them. What am i doing wrong? enter image description here

Custom LaTeX snippets intermittently trigger multi-cursor mode in VS Code 1.104.2

25 November 2025 @ 11:31 am

The video that shows the problem I am experiencing an intermittent issue where triggering custom user snippets in VS Code causes the editor to unexpectedly enter multi-cursor mode. Environment VS Code Version: 1.104.2 (x64) OS: Linux (Ubuntu) The Snippets I have defined the following snippets in ~/.config/Code/User/snippets/latex.json. They use standard tabstops ($1, $2) and placeholders. { "Sine Function": { "prefix": "i", "body": [ "\\sin\\left(${1:x}\\right) " ], "description": "Sine Function" }, "Inline-Math": { "prefix": "a", "body": [

Is Thymeleaf still maintained, and is there a Thymeleaf version compatible with Spring Boot 4 / Spring Framework 7?

25 November 2025 @ 11:28 am

Spring Boot 4.0 and Spring Framework 7.0 were recently released, and I’m considering upgrading my project. However, my application uses Thymeleaf, specifically the thymeleaf-spring6 integration module, which is tied to the corresponding Spring Framework major version. When checking the Thymeleaf GitHub repository, development activity for the Spring integration modules (e.g., thymeleaf-spring6) appears to be minimal in recent months/years. This raises a few questions: Is Thymeleaf still actively maintained? Will there be a Thymeleaf-Spring7 integration module for Spring Framework 7 / Spring Boot 4? Or is Thymeleaf effectively discontinued, meaning I should consider an alternative server-side template engine for the upgrade? Any official information or guidance from the Thymeleaf maintainers or the community would be appreciated.