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.

Why does my Java array print extra zeros in Eclipse?

26 May 2026 @ 9:36 pm

I'm learning Java in Eclipse and practicing arrays. When I run this code, the output is: 10 20 30 0 0 I only added 3 numbers to the array, so I expected it to print only those values. I already checked the loop and the array size, but I still don't understand why the extra zeros appear. Why does Java print those zeros and how can I avoid them? public class Main { public static void main(String[] args) { int[] numbers = new int[5]; numbers[0] = 10; numbers[1] = 20; numbers[2] = 30; for(int i = 0; i < numbers.length; i++) { System.out.println(numbers[i]); } } }

Title: Unclear Spa Massage Reversal for Heartist 50% Discount — Base Revenue Reversed Without Tax & Service

26 May 2026 @ 9:30 pm

We found unclear postings dated 15/10/2025 in the Accounting Posting Report. As per the attached screenshot, it appears that Cashier 1619 posted a reversal on PM 9004 related to a Heartist Discount 50% for Spa Massage. The original Spa Massage amounts eligible for the discount before tax and service are: 104.81 JOD 43.67 JOD However, we found that the reversed amount was posted as 70.00 JOD base revenue only under Spa Massage. My question is: What method was used to calculate or reverse this 70.00 JOD amount? Because if the total charges were: 120 + 50 = 170 JOD Then the 50% discount should be: 170 × 50% = 85 JOD And if we exclude tax and service from this 85 JOD, the

using Linux bash shell: how would you split a string with unknown number of substrings separated by a delimiter character

26 May 2026 @ 9:25 pm

for example, $PATH is a list of directories paths, separated by colons. but it is not known at any time how many directories there are in the PATH list. how can we split the list of directories using Linux bash.

Camera rotation issue

26 May 2026 @ 9:20 pm

So I have been trying to figure out why when i rotate the camera left and right, the position of the camera moves. I`m watching a tutorial on how to make a simple 3d renderer in c but i wanted to challenge myself to make it in python and I am stuck. Any help would be heavily appreciated. https://docs.google.com/document/d/1nado3aBCj8KS-bvBKunZ1o2JYUP1M49BYpYkB7XKwx8/edit?usp=sharing (code was too long to paste)

Sometimes setting "default actor isolation" to "main actor" setting still treats a type as non-isolated

26 May 2026 @ 9:16 pm

I have set default actor isolation to main actor for my 2 libraries: LibApp and LibGame. In LibApp, I have: public protocol PluginTheme {} Then in LibGame, which depends on LibApp: public protocol GamePluginTheme: PluginTheme public struct BasicGamePluginTheme: GamePluginTheme { // ... } This gives me warning: Conformance of 'BasicGamePluginTheme' to protocol 'GamePluginTheme' crosses into main actor-isolated code and can cause data races; this is an error in the Swift 6 language mode However, if I add @MainActor to PluginTheme, the warning is gone. This is very confusing, I have set the default actor isolation to main, why is it still non-isolated?

Table cell colspan misalignment in iOS Safari

26 May 2026 @ 9:13 pm

I am trying to get a table to render properly in Safari on iOS (I am using Safari 17 to test this). The table is supposed to: Have 2 rows. Have 3 cells in the first row. Have 2 cells in the second row. Have both rows be of equal widths as measured by the total number of "columns" their cells take up. Here is my test HTML: <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <style type="text/css"> table, td { border: 1px solid black; border-collapse: collapse; } </style> </head> <body> <table> <tbody> <tr> <td align="center" valign="middle" colspan="2">AAAA</td> <td align="center" valign="middle" colspan="2">BBBB</td> <td align="center" valign="middle" colspan="2">CCCC</td> </tr>

Creating a list of mutable strings

26 May 2026 @ 9:04 pm

I want to have a management wrapper to a collection of mutable strings. A std::vector<std::string> as a member variable came to mind. Creating an entry in the list with vector.emplace_back() and returning the reference to the created string sounded sane. std::string is supposed to manage the memory and space of its content on its own. I now want to modify the entries regularily at later moments to track some values for debugging: auto& entry = collection.create_entry(); [...] while(something) { [...] entry = std::format("Something to track: {}", value); [...] } This breaks as soon as I have multiple entries, probably because inside the vector there was only memory allocated for the empty strings upon entry creation and modifying them writes into memory not owned by the string anymore, breaking the system. How can I get a list of MUTABLE string e

How do I setup GIT Remote Groups to ease controlling fetch / remote update from multiple repositories

26 May 2026 @ 8:34 pm

I work on a number of projects with a number of co-workers where everyone has a fork. I also work on a number of other projects that simply happen to operate on forked models. Sometimes I only have a reference to the 'origin' which is either 'me' or 'central repo' other times I have both an 'origin' (myself) and an upstream (central) and possibly many random other folks in any of these cases. I want to keep things updated and or have quick commands to 'refresh' a given project. I generally prefer to fetch from a specific user's work because i usually dont even want their entire repo... but I do almost always want to fetch origin and upstream if they both exist. It seems like I could create a remote.group in each working repo... through remote.groups but I wonder if I could do this through git global config. Will it ignore attempts to try a remote reference that doesn't exist in a specific working repo? note This

How can a MECM app be cloned with Powershell?

26 May 2026 @ 6:23 pm

I'm trying to clone a MECM app with Powershell, the same way you can do so in the GUI when you right click on the app and click copy, which MECM then clones the app and places it in the same directory the original is, and with the same name the original has except with "- Copy" appended to it. When I try Export-CMApplication -Name "2025_PS script" -Path "C:\temp\test.zip"Import-CMApplication -FilePath "\\xxx\c$\temp\test.zip" -ImportActionType DirectImport I get a "cannot be imported because it already exists" When I try Export-CMApplication -Name "2025_PS script" -Path "C:\temp\test.zip" Set-CMApplication -Name "2025_PS script" -NewName "2025_PS script - Copy" Import-CMApplication -FilePath "\\xxx\c$\temp\test.zip" -ImportActionType DirectImport It completes the renames the app to append copy to it and then when

Does Power Query's Table.Profile Treat emty strings (" ") as null/missing values?

26 May 2026 @ 1:21 pm

Details I am using Excel Power Query for data profiling and data cleaning. My dataset cntains texts columns where missing values are represented in two different ways: null empty strings (" ") I am analyzing the data using the Table.Profile function to understand column completeness and missing value distribution. However, I am unclear whether Power Query treats empty strings as missing values in profiling results or if they are considered valid text vaues. This distinction is important for my data quality checks and for standardizing missing data before performing analysis. What I tried / Expected vs Actual Result What I tried: I imported a dataset with both null values and empty strings (" ") I applied Table.Profile to the table. I compared counts of missing values across colu