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 does Apple handle showing selection in a menu picker that shows an SF Icon as its selected value?

24 March 2026 @ 12:34 am

in my app I have a SwiftUI Menu component that shows an SF icon in its label to represent its selected value like so: enter image description here Ideally, I'd like to have the image to the left of the text in the menu list: enter image description here But in SwiftUI, a Menu component can only have one image per each row in the menu list, so I'm unable to display the checkmark when an item is selected without hacking it or creating a custom menu. I'm just wondering if anyone has any examples of how Apple handles the same scenario in their apps?

How to add closed dynamic libraries to a Flutter app using dart Hooks?

24 March 2026 @ 12:07 am

my environment details: === dart info === - Dart 3.11.1 (stable) (Tue Feb 24 00:03:07 2026 -0800) on "macos_arm64" - on macos / Version 26.3.1 (a) (Build 25D771280a) - locale is en-US #### Project info - sdk constraint: '^3.11.1' - dependencies: code_assets, dart_ipc, data_assets, ffi, flutter, hooks, logging, native_toolchain_c, path - dev_dependencies: ffigen, flutter_lints, test ============= My question: I have integrated my flutter app with Holepunch's bare-kit using ffigen and it executes a simple javascript without a problem. However, executing a javascript (ipc_test.bundle) that calls Holepunch's 'bare-tcp' npm module fails (see error log below). The 'bare-tcp' depends on dynamic bare libs, e.g. libbare-dns.2.1.4.dylib. In my hook build.dart script I add each needed dynamic libs as a CodeAsset, e.g.: output.assets.code.ad

is there any career effect on Fullstack development by AI

23 March 2026 @ 11:47 pm

AI has transformed full-stack development by automating repetitive tasks, accelerating coding speeds, and enhancing debugging. It enables developers to act more like architects, focusing on system design rather than boilerplate code, while AI tools handle frontend components, backend logic, and database optimization.

File chooser dialog can only be shown with a user activation

23 March 2026 @ 9:35 pm

This is part of a larger project, but I've boiled it down to the minimal example that shows my problem. I'm trying to define a div where a click anywhere in the div causes a file chooser popup. I've also included the file chooser inside the div. Javascript receives clicks in the div and launches the file chooser in response. For the div itself, it works perfectly. But if I click on the actual file chooser, I get File chooser dialog can only be shown with a user activation. Why am I getting this message when I am opening the chooser as a result of a user activation. And why when I click on the file chooser but not when I click on the div? I tried passing the click to the file chooser instead of calling showPicker() , but it got even weirder. Now the div gets two clicks in rapid succession, with the second one having the detail field (click count) at zero on the second notification. When I click on the

How to automatically add longer space in Word or LibreOffice?

23 March 2026 @ 9:00 pm

In this page from Twain, Mark – The Adventures of Huckleberry Finn (1886), longer spaces are typed after period so as to avoid different spacing between all the words: Image of a passage from "The Adventures of Huckleberry Finn" highlighting the "longer spaces" How to automatically do that while composing in MS Word or LibreOffice?

Wordpress site casues Andriod Tool Bar Color change

23 March 2026 @ 8:51 pm

I cannot for the life of me figure out what setting is turning my bar this green color in wordpress. any suggestions are appreciated, I've tried everything in appearance theme elementor and nothing has changed it. Website url is peakpowernh.com Is there an addon that can assist me locating this? Screenshot of website

How to properly serialize raw binary data in C/C++?

23 March 2026 @ 8:30 pm

What is the preferred way to serialize data to raw byte array (without any serialization libs)? I though these variants: #pragma (pack,1) struct A{...} #pragma (pop) or __attribute((packed))__ allows to just memcpy the entire struct into the byte array, but has a great flaw of unaligned access to its fields, which is slow and will have compatibility issues between architectures. Manually memcpy every field of the struct with corresponding offsets to the byte array. This doesn't mess with unaligned access at all. But looks very ugly. Which way is preferred, especially in terms of performance and stability? P.S. also would be helpful to get advice on deserialization, too.

How to get a list of functions called by another function during execution in python?

23 March 2026 @ 8:26 pm

I am trying to keep track of functions that are called at certain points of execution in my program. This is not for debugging purposes, but rather to evaluate what functions that I wrote get used with different input datasets. I am writing code that converts directed graphs into another format, so I want to keep track of which functions get called as each node/edge goes through the conversion. Because I want the information at the node/edge level, getting a call stack at the end of execution would not be ideal. I want something like this: def convert_node(node_info): # get the function that should be called from my library of ConversionFunctions node_conversion_fxn = getattr(ConversionFunctions, node_info['fxn_name']) # call the retrieved function node_conversion_fxn(**node_info['arguments']) # TODO: get list of which functions in the ConversionFunctions library were called

R - Sort individual rows of a data.table by ascending order of the value in each column

23 March 2026 @ 7:19 pm

I have a couple of data.tables with more rows (thousands more) and columns (at least 4 more columns) than what I am providing below in the example subset. I want to sort each row by ascending order of the integer value in each column. The rearranging of the column names does not matter in this case. Only keeping the existing row order matters here. Below is a subset of one of the data.tables: data <- structure(list(V1 = c(20, 2, 7, 20, 48, 12), V2 = c(1, 48, 23, 56, 28, 11), V3 = c(54, 20, 4, 51, 55, 30), V4 = c(5, 28, 6, 6, 52, 42), V5 = c(55, 6, 55, 22, 38, 10), V6 = c(33, 3, 40, 3, 15, 33)), row.names = c(NA, -6L), class = c("data.table", "data.frame"), .internal.selfref = <pointer: 0x55631730c3f0>) # > data # V1 V2 V3 V4 V5 V6 # <num> <num> <num> <num> <num> <num> # 1: 20 1 54 5 55 33 # 2: 2

Read just one byte with read() function from unistd

23 March 2026 @ 5:31 pm

I'm trying to start a hangman project, and first I want to take care of how to get user letter from the terminal, I know I can read just one byte and store that value into a pointer's address with char *ptr; int read_bytes; read_bytes = read(0, ptr, 1); //NULL checks but right now I did a function that is returning a NULL terminated buffer with just 2 chars (the user's input and a NULL char at the end). This is the code. #include "utils.h" char *read_one_byte(int fd) { char *buf; int read_bytes; if (!(buf = malloc(sizeof(char) * 2))) return (NULL); if ((read_bytes = read(fd, &buf, 1))) { buf[1] = '\0'; return (buf); } else return (NULL); } Is it worth it to NULL terminate the buffer even if its content is just one character, or should I not bother at all?