Random snippets of all sorts of code, mixed with a selection of help and advice.
Why can't I get the Invoice ID if I have a valid Invoice Number?
15 June 2026 @ 4:34 pm
When I query the /Invoices?InvoiceNumbers=INV-1111 endpoint [for some invoices], I get a response containing some invoice details but there's no Invoice ID (Xero's UUID for the invoice).
I have tried several different approaches, querying by Contact ID (which is contained in the response); querying the /payments endpoint with "where=invoice.invoiceNumber==INV-1111"; querying the seemingly undocumented /InvoiceNumber endpoint, and in every case I get back a detailed set of invoice attributes but no ID.
{"company_id":662,"tenant_id":"xxxxxxxx-xxxxxxx-xxxxxx-xxxxxx-xxxxxxxxx","invoice":{"Date":"2025-08-11","InvoiceNumber":"INV-1111","Type":"ACCPAY","Status":"AUTHORISED","Contact":{"ContactID":"xxxxxxxx-xxxxxxx-xxxxxx-xxxxxx-xx
Optimizing Month Naming
15 June 2026 @ 4:11 pm
I am very new to SQL, I am learning it for my job, can I get any advice on how to optimize the naming for the months in the following code:
(The date convention with the database is 'YYYY-MM-DD')
Select
strftime('%Y-%m', order_date) AS month,
COUNT(id),
CASE
When order_date LIKE '2023-01-%' Then 'January'
When order_date LIKE '2023-02-%' Then 'Feburary'
When order_date LIKE '2023-03-%' Then 'March'
When order_date LIKE '2023-04-%' Then 'April'
When order_date LIKE '2023-05-%' Then 'May'
When order_date LIKE '2023-06-%' Then 'June'
When order_date LIKE '2023-07-%' Then 'July'
When order_date LIKE '2023-08-%' Then 'August'
When order_date LIKE '2023-09-%' Then 'September'
When order_date LIKE '2023-10-%' Then 'October'
When order_date LIKE '2023-11-%' Then 'November'
Else 'December'
END AS Month
From
orders
Group by
strftime('%Y-%m', order_date)
Order by
order_date
Why are my hyperlinks not creating properly for Markdown with HelpNDoc dynamic script?
15 June 2026 @ 4:07 pm
I am trying to use the Dynamic content library item in HelpNDoc:
<%
var current := HndTopics.GetCurrentTopic();
var parent := HndTopics.GetTopicParent(current);
var prev := HndTopics.GetTopicPreviousSibbling(current);
var next := HndTopics.GetTopicNextSibbling(current);
%>
<h2>Navigation</h2>
<%
if parent <> '' then
begin
%>
<p>
<a href="<%= HndTopics.GetTopicUrlLink(parent) %>">Back to <%= HndTopics.GetTopicCaption(parent)%></a>
</p>
<%
end;
%>
<%
if prev <> '' then
begin
%>
<p>
<strong>Previous Section:</strong>
<a href="<%= HndTopics.GetTopicUrlLink(prev) %>"><%= HndTopics.GetTopicCaption(prev)%></a>
</p>
<%
end;
%>
&l
Opening links into new windows from JavaScript code
15 June 2026 @ 3:58 pm
I have a block of JavaScript code that is responsible for a header bar on my website that scrolls from bottom or top. This header bar has both text and icon links embedded within. The icon links open in new windows when clicked but the text links do not. What code would have to be added or adjusted to have the text links open in new windows as well?
I believe I've the blocks of code responsible for link behavior, see below.
From the core code:
// Create the menu options
var menuOptions = $('<div>', { id : 'ctd-menu-options' });
menuOptions.css({
position : 'relative', zIndex : 100,
padding : '30px 10px 30px 0', textAlign: 'right'
});
showIntro ? menuOptions.css(config.bottomMenuÖptionsStyle) : menuOptions.css(config.topMenuOptionsStyle);
var menuOptionsHtml = '';
config-menuOptions (''] = "';
Object.keys(config-menuOptions).reverse(). forEach((key, i) => {
var target = "window.location.href=\'&quo
Implications of VLA Compound literal GCC extension
15 June 2026 @ 3:51 pm
Browsing through the GCC docs, I noticed the following:
As a GNU extension, GCC allows compound literals with a variable size. In this case, only empty initialization is allowed.
And indeed, the following is possible in GCC 16(previous versions of GCC would result in error: compound literal has variable size):
int n=5;
char*p=(char[n]){};
Are the rules for the lifetime of a VLA compound literal analogous to those of a named VLA object? Namely, lifetime beginning at the point of construction (analogous to point of declaration) and ending at containing block exit.) An implication of this would be that jumping to a point in the containing block before the compound literal is constructed, is undefined.
{
int n;
char*p=(char[n]){}; //lifetime of vla compound literal begins here?
}//and ends here
Furthermore, the standard explicitly prohibits jumping from outside
C++ equivalence of Python code for HDF5. Is possible to write 2d std::vector to HDF5 file similarly to 2d std::array? or more simplified in general [closed]
15 June 2026 @ 1:58 pm
This question is about what is the C++ equivalence of the Python code below about HDF5, trying to keep the C++ part simplified.
The general process is the next:
The goal is to create a .h5 file with one or more datasets.
Writing/reading if the file exists, and if not, then creating the file and writing/reading.
Each dataset in the file will contain data that comes from a 2d-collection.
The 2d-collection to insert in the dataset is returned by a function and we don't know its exact size in advance. In some parts of the program we could know the number of rows and in other parts we could know the number of columns. This is the reason because the C++ code below shows tests with different 2d-collections.
Python code as reference:
import numpy as np
import h5py
file_name = "f.h5"
dataset_name = "dset_1"
# 2d list representing a function call that returns a 2d list.
l_2d = [[1, 1, 1], [
Minesweeper mine counting
15 June 2026 @ 1:54 pm
I'm making Minesweeper using pygame and I'm have one problem: mine counting.
minesweeper.visuals.draw_tiles(number, top left corner x position, top left corner y position) draws the numberless versions.
Numberless color:
rgb(48, 48, 48) Dark Gray #303030
rgb(0, 0, 196) Blue #0000C0
rgb(0, 196, 0) Green #00C000
rgb(196, 0, 0) Red #C00000
rgb(196, 0, 255) Purple #C000FF
rgb(255, 128, 0) Orange #FF8000
rgb(0, 196, 196) Teal / Cyan #00C0C0
rgb(0, 0, 0) Black #000000
rgb(128, 128, 128) Medium Gray #808080
Mine background color. rgb(255, 255, 255) White #FFFFFF
Mine color. rgb(0, 0, 0) Black #000000
import pygame as game
from random import randint as random
game.display.set_caption("Flagless Minesweeper")
size = [450, 450]
screen = game.display.set_mode(size)
level = [
[0] *
What is the R package equivalent to Stata xtpcse and eststo commands? Trying to find an alternative to panelAR (removed from the CRAN)
15 June 2026 @ 1:42 pm
I am trying to reproduce this Stata code in R for fixed effect regression model with Standard Errors (PCSE) method (Dielman 1983; Ward & Leigh 1993; Hoechle 2007) and AR1 autocorrelation and panel-level heteroskedastic errors.
xtpcse bi1_low ECECenrolmentrate02yearol_MA PublicspendingFamilybencash_MA
N_co_ld N_par1_ld N_rr N_usd lnGDPpcPP MA1Blow Femaleemployment2554OECD
i.country_num i.year
if predclass ==1, correlation(ar1) hetonly
eststo
From what I understood panelAR package is the R equivalent of the xtpcse command in Stata. The problem is that it doesn't exist any more: as you may know it was removed from the CRAN a couple of years ago. I saw some people managed to install it nevertheless from the archive, but I didn't manage to do that.
Could someone help figure out what packages and code lines could approximate the above-mentioned Stata code in R? Or help me undertsand exactly how to download it from t
TabView with CanTearOutTabs: dragging the custom title bar after switching tabs tears out a new window instead of moving the window
15 June 2026 @ 1:08 pm
I'm currently developing a desktop application using the WinUI3 framework and encountered an issue with the TabView. After checking the official repository's issue list and consulting AI without finding a solution, I'd like to ask if anyone has encountered the same problem or has a fix.
Describe the bug
When TabView.CanTearOutTabs="True" is used together with a custom title bar, switching between tabs corrupts the title bar's drag region. After a switch, dragging the empty area of the custom title bar (not a tab) no longer moves the window — instead the tear-out logic captures the drag: a new window is torn out and follows the cursor while the original window stays frozen in place.
This reproduces in the official WinUI 3 Gallery → "Complete TabView windowing sample".
Repro project: (download)[https://github.com/user-attachments/files/28949890/TabTearRepro.zip]
When should I use a Binary Tree in Python, and what problems does it solve?
15 June 2026 @ 9:24 am
I'm learning Python and recently came across Binary Trees.
I understand that each node can have up to two children, but I don't understand when I would use a Binary Tree in a real program.
What problems does it solve, and when would I choose it over a list or dictionary?
A few practical examples would be helpful.