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.

Troubleshooting C++ types

9 May 2026 @ 7:01 am

I am coding a simple 2D game and when changing the structure of the program I got many, many errors relating to the way I'm using the variables, I tried to get AI to fix it without touching to much stuff because I don't know what's wrong with it but unsurprisingly it messed it up possibly more. //world.hpp #pragma once #include "glad/glad.h" #include "GLFW/glfw3.h" #include <iostream> #include <string> #include <functional> #include "texture.h" #include "events.hpp" // Declare stbi functions - implementation is in texture.cpp extern "C" { unsigned char *stbi_load(char const *filename, int *x, int *y, int *comp, int req_comp); void stbi_image_free(void *retval_from_stbi_load); } class armor { public: int defense; float weight; }; union item { //Possible items armor armorSlot; }; class entity { public: float x=0, y=0, width=0, height=0; float speedx=0, speedy=0, st

How Much Does a Dental Implants in Bayside Cost?

9 May 2026 @ 6:49 am

I'm tight on budget but looking for trustworthy family dentist. I have multiple teeth and would like a more permanent solution than a removable denture. It is really painful. I have been suffering it from years but i'm very scared of going to the dentist

Where are JS primitives and reference types actually stored? Stack vs. Heap vs. Execution Context (AO/GO)

9 May 2026 @ 5:58 am

I am confused about the storage of JavaScript values. I have seen two different explanations: Explanation 1: Primitive types are stored on the stack. Reference types are stored on the heap. Explanation 2: If a variable is global, it is in the Global Object (GO) -> stored in the heap. If it is in a function, it is in the Activation Object (AO) -> also stored in the heap. Which one is correct? Is this a difference between a conceptual model and the actual engine implementation?

MongoDB Partial Index still flagged as performance bottleneck for non-matching documents

9 May 2026 @ 5:51 am

I am working on a task for a high-load social media application. The collection posts has the following document structure: JSON { "createdAt": "2022-01-26T10:29:43.000Z", "text": "It's Wednesday my dudes!", "author": { "username": "froggy" } } The Scenario: One specific user (realElonTusk) has massive traffic. Users are constantly fetching his posts sorted by createdAt (descending). However, thousands of other users are also posting content simultaneously. The Goal: Create an index that speeds up find().sort({ createdAt: -1 }) for realElonTusk without slowing down the insertOne operations for all other users. What I've tried: I implemented a partial index to isolate the impact: JavaScript

Do I still use the walrus operator in Go for repeated error handling?

9 May 2026 @ 5:44 am

Given the lack of a try/except or try/catch block in Go (I still don't fully know why), we all know you need to do this: var num int _, err := fmt.Scanln(&num) if err != nil { return err } else { doStuff() } Now, for the million dollar question: if I do the check for an error again, do I reassign err, or do I use the walrus operator again (:=)? If you want too see the question in code, I'm asking whether I do var x int _, err := fmt.Scanln(&x) if err != nil { fmt.Println("Error during parsing") } else { doStuff() } var y int _, err := fmt.Scanln(&y) // does the walrus op shadow the old err? if err != nil { fmt.Println("Error during parsing") } else { doOtherStuff() } or do I do var x int _, err := fmt.

I'm having a trouble with my system because when i enter a data it will not reload its self its need to be refersh to see the save data

9 May 2026 @ 5:23 am

enter image description heremy name is Mike . I’m having an issue of my system this is the images can someone advice me how to fix it cause I'm struggle to fix it and and i our presentation is on next week who ever help me thanks in advance thank you.

How can I tell GitHub CoPilot CLI to always use MudBlazor?

8 May 2026 @ 9:48 pm

I'm looking for a best practice. How can I tell GitHub CoPilot CLI to always use MudBlazor when it's writing C# Blazor code? Would I put that instruction in a prompt, skill, agent, etc.?

Nested pie chart with variable number of subsections per section

8 May 2026 @ 9:16 pm

I am using: https://matplotlib.org/stable/gallery/pie_and_polar_charts/nested_pie.html BUT I'm feeding it a jagged array in the form of a masked array (through zero-padding), rectangularising it into a matrix. In other words from tensorflow.keras.utils import pad_sequences as ps vals = np.array(np.array(ps([[9.0, 8.0, 8.0], [2.0, 7.0, 8.0, 8.0], [6.0, 6.0, 8.0, 5.0], [2.0, 4.0, 10.0, 4.0, 5.0]] ))) Unfortunately this causes the color section ordering (specific hue for every section, divided into different lightnesses for every subsection) to scatter: any ideas to reorder the new colors with this unique data? I tried tab20c = plt.color_sequences["tab20c"] outer_colors = [tab20c[i] for i in [0, 4, 8, 12]] inner_colors = [tab20c[i] for i in np.array(p

Why does C++ conversion from double to float show digits after 8th decimal place?

8 May 2026 @ 3:08 pm

When we cast from double to float in C++, we obviously lose precision from about 15-17 to about 8 decimal digits, right? But, based on a remark from a co-worker, it would appear I have long misunderstood how the cast actually works in practice. My lack of low level engineering background is showing. So, I wrote the following simple app in Visual Studio 2026. I don't understand why the cast does what it does. Can someone explain this to me? int main() { double d1 = 0.12341470192384701; // Take a double of 17 decimal places... float f1 = static_cast<float>(d1); // ...cast it to float... double d2 = f1; // ...and back to double // Dump them all out to 12 decimal places to see what lies beyond the // float's significant digits after the cast. std::cout << "double was " << std::setprecision(12) << d1 << s

Using an Excel VBA script to copy data from one page to another in a workbook, but the copy fails without error

8 May 2026 @ 4:07 am

I have a VBA script that is designed to copy data from a range of cells on one page and pastes it to another range of cells on some other pages, the range being pasted to changes based on the day of the week. The script executes without error, but the data fails to copy. I am barely more than a beginner with VBA, and cannot find the problem with the code. I would appreciate where I am going wrong. Here is the code I am working with: Sub Test() ' Copy information Visual Basic control _ Script written on 05/07/2026 by me _ Copies data to appropriate locations for Thaw and Prep worksheets Dim wsMenu As Worksheet Dim wsThaw As Worksheet Dim wsPrep As Worksheet Dim wsHourly As Worksheet Dim destRange As String Dim dayName As String Application.ScreenUpdating = False Application.EnableEvents = False Application.DisplayAlerts = False ' Set worksheet references Set selectedSheet = ActiveSheet Set