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.

RESOURCE LEAK in java visual studio code

9 May 2026 @ 7:16 pm

Resource leak: 'sc' is never closed, what to do about this warning, my program is working fine but this warning is distracting me import java.util.*; public class takingInput{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); // String name = sc.nextLine(); // System.out.println(name); //int number = sc.nextInt(); //System.out.println(number); float price = sc.nextFloat(); System.out.println(price); } }

Why can't I turn off legend warnings in Matplotlib?

9 May 2026 @ 7:13 pm

Does anyone know why this isn't working? plot.py: 355 logging.getLogger('matplotlib.legend').setLevel(logging.ERROR) 356 plt.set_loglevel("error") 357 plt.legend() I'm getting this: plot.py:357: UserWarning: No artists with labels found to put in legend. Note that artists whose label start with an underscore are ignored when legend() is called with no argument. plt.legend()

Incorrect color display when drawing a raw file in i8086 assembly

9 May 2026 @ 7:07 pm

I'm trying to read pixel data from a raw file and draw it directly using a program written with the emu8086 emulator. The program works correctly; the image file opens without errors, and the program draws the outlines of the original image. The problem is that the colors are completely incorrect: the image is quite gray and noisy. Inverting the image colors didn't improve the situation. I can guarantee that the loaded file is a raw file, 320 by 200 pixels in size, with a color depth of 8 bits. The image size is exactly 64,000 bytes. What could be the problem? .model small .stack 100h .data fname db "image.raw", 0 handle dw ? buffer db ? .code start: mov ax, @data mov ds, ax mov ax, 0013h int 10h mov ah, 3Dh mov al, 0 lea dx, fname int 21h jc exit mov handle, ax mov ax, 0A000h mov es, ax xor di, di mov cx, 6

Why do i have both `/Library/Developer/CoreSimulator` and `~/Library/Developer/CoreSimulator`

9 May 2026 @ 6:57 pm

I am an iOS engineer, and I am cleaning up my mac, and realize that I have both of the 2 folders. Why do I have both? What's the purpose of each? Can I delete them? Should I exclude them from my time machine backup?

How to customize specific leaflet CSS class

9 May 2026 @ 6:53 pm

I'm working on a leaflet map and have successfully customized most of the pop-up using the suggestions here. How would I customise the look and feel of the leaflet popup? My point layer is referencing a custom class imported from a css file: .bindPopup(content, {'className' : 'PastryPopUp'}) My .css file contains: .PastryPopUp .leaflet-popup-tip, .PastryPopUp .leaflet-popup-content-wrapper { background: #f88479; color: #e6eee8; border: 5px dotted #208AAE } .PastryPopUp .leaflet-popup-close-button { color: #208AAE; } The leaflet-popup-content-wrapper and leaflet-popup-tip-container classes are behaving how I would like, but I've been unable to have the leaflet-popup-close-button recognize the updated color.

c# Winforms simple number analyzer application

9 May 2026 @ 6:51 pm

I recently started learning and practicing C# WinForms again after quite a long break, and I’m currently rebuilding my basics with smaller practice projects before moving on to larger applications. This project is a simple number analyzer application. The main goal was to practice core WinForms concepts again, such as working with toolbox controls, event handling, List collections, updating UI elements dynamically, and implementing basic desktop application logic. The application currently allows the user to: add numbers using a NumericUpDown control display them inside a ListBox calculate count, sum, average, minimum, maximum calculate even/odd, positive/negative, and zero counts sort numbers in ascending/descending order delete selected numbers clear the list handle menu actions I used several common WinForms elem

Reactive layering in WebFlux + JPA application

9 May 2026 @ 6:46 pm

Given: A blocking Spring Data repository. A service layer wrapping the said repository. @Transactional, performs both read and write operations. And a WebFlux handler invoked by a RouterFunction. which layer should start wrapping data objects in Reactor publishers? Option 1. The service layer simply delegates to the repository, mapping data objects with an injected mapper. It's the handler class that wraps them in publishers. // TaskHandler @Operation(parameters = @Parameter(in = ParameterIn.PATH, name = "id"), description = "Retrieves task by id.") @ApiResponse(responseCode = "200", content = @Content(mediaType = "application/json"), description = "Task.") public Mono<ServerResponse> findById(ServerRequest request) { return Mono.fromCallable(() -> UUID.fromString(re

How to make an array of numbers into one single number? [duplicate]

9 May 2026 @ 4:26 pm

I have an array (or vector) of integers, and I want to turn them into a single number. For example: If the array contains single-digit numbers: {1, 2, 3, 4}, I want 1234. If the array contains multi-digit numbers: {12, 34, 5}, I want 12345. How can I do this?

Possible to convert existing StreamController to SendPort to communicate with Isolates?

8 May 2026 @ 8:30 pm

I am refactoring a Flutter class in order to run in a separate (from the UI) Isolate. The class already takes in, during construction, 2 StreamControllers for communicating its status with the caller. One for input, one for output. Prior to refactoring, communication with the caller works fine in the simple code provided here and also in my app (where the stream are consumed by StreamBuilders). I thought that I could reuse the StreamControllers I construct in the caller for communicating with the object when in a separate Isolate but this is not working. There is no exception or error. Messages just don't come through. The doc (https://dart.dev/language/isolates#receiveport-and-sendport) states : Ports behave similarly to Stream objects (in fact, receive ports implement Stream!) You can think of a SendPort an

Can I free a `PangoContext` after creating a layout on it?

27 March 2026 @ 6:29 am

I'm making a library function to measure text. However, it can't take a PangoLayout or anything to do with Pango except the font used. My current solution is just to create one for use specifically within the function, and that requires a PangoContext. We don't actually need the context, though, so I'm wondering if I can just free it here to save memory: static PangoLayout *layout = nullptr; if (!layout) { PangoContext *ctx = pango_context_new(); layout = pango_layout_new(ctx); // Can I call `g_object_unref` on `ctx` here? } Am I able to? Or, is this irrelevant and I'm just missing something?