Random snippets of all sorts of code, mixed with a selection of help and advice.
Latest leaf selected in MantineUI Tree component
27 December 2025 @ 6:12 pm
I'm trying to use MantineUI Tree component with very simple tree data:
const treeData: TreeNodeData[] = [
{
label: "parent 1",
value: "1",
children: [
{ label: "child 1-1", value: "1-1" },
{ label: "child 1-2", value: "1-2" },
],
},
{
label: "parent 2",
value: "2",
children: [
{ label: "child 2-1", value: "2-1" },
{ label: "child 2-2", value: "2-2" },
],
},
]
The parent nodes only serve as grouping, so clicking on them should only expand/collapse children. Instead, when user clicks on a child, I must know the clicked child value and other components will update depending on this.
I'm trying to get this with useTree hook, but it doesn't seem to have something like "onSelected" event. So I'm trying with
Puppeteer PDF generation uses wrong font in production
27 December 2025 @ 6:08 pm
I’m generating PDFs using Puppeteer in a Node.js application.
Locally, fonts render correctly, but in production, some fonts (notably Courier New) are replaced with a different font in the generated PDF.
Expected behavior
Text explicitly styled with Courier New should render using that font in the final PDF.
Actual behavior
In production, the PDF renders the text using a different monospace font, even though Courier New is specified.
Example HTML
<p><font face="Courier New">Text Here</font></p>
Or via CSS:
font-family: "Courier New", Courier, "Liberation Mono", monospace;
Why does Puppeteer replace Courier New with another font in production, and how can I ensure the exact font is used when generating PDFs?
Specifically:
Is this caused by missing sys
T-SQL ETL update evaluation recommendation: What is the most elegant & performative way to evaluate a source value to update a target value?
27 December 2025 @ 6:05 pm
What recommendations might be offered for the most elegant and performative way with T-SQL to evaluate whether a source value should update a target value as part of an ETL update process in which dozens of target table row values need to be evaluated?
This is a roll-your-own ETL design approach question using PowerShell for basic orchestration, leveraging stored procedures for performance where it matters. Reported raw files will be loaded to a table of unique rows containing the best reported values. This table will later in the ETL process be refactored into a 3NF normalized structure.
After a volatile staging area table (VSA) is populated with records from a source, each record in VSA needs to be evaluated as either a new record to insert into a target persistent staging area table (PSA), or to update an existing record in the target PSA table. Insert is easy (using a hash evaluation of essential record keys, such as a Person ID, if the hash of keys is unique). Upd
Angular Vitest not working in Test Explorer - Need to call TestBed.initTestEnvironment() first
27 December 2025 @ 5:53 pm
Why is it that when I run Angular Vitest tests in the terminal is works fine:
But running the same tests in the Test Explorer fails:
I tried adding
import { BrowserTestingModule, platformBrowserTesting } from "@angular/platform-browser/testing";
TestBed.initTestEnvironment(BrowserTestingModule, platformBrowserTesting());
But that just makes them both fail. There is also no @angular/platform-browser-dynamic in the project anymore as I'm using Angular 21
But running the same tests in the Test Explorer fails:
I tried adding
import { BrowserTestingModule, platformBrowserTesting } from "@angular/platform-browser/testing";
TestBed.initTestEnvironment(BrowserTestingModule, platformBrowserTesting());
But that just makes them both fail. There is also no @angular/platform-browser-dynamic in the project anymore as I'm using Angular 21Using getElements after building div's using JS
27 December 2025 @ 5:46 pm
I understand that building up the page using JS creates an issue using the getElements functions to create an array of objects, due to the DOM status. So I have tried a few different solutions but not found a good one for what I want to achieve. So I guess I try to solve this the wrong way.
I have a dynamic questionnaire where some answers are supposed to be sorted in order by the respondent. The original approach was something like this.
From my Django backend I feed the page with all questions/answers/type etc, and questions by page. I have reduced the types and stripped the code from formatting. I hope it is possible to follow.
var to_drag=null
function generateQ(q_id,Section) {
const questionObj = QData.find(q => q.q_id === q_id);
if (questionObj) {
// Example: Create a new div and append the question to it
const div = document.createElement("div");
div.setAttribute("id"
How to intercept a markdown file and display as HTML?
27 December 2025 @ 5:37 pm
As part of my application, I want to use QWebEngineView to display the contents of a local markdown file as an HTML page. Local files will end in '.md'.
In Qt version 6.9 I wrote the following code to override the QWebEnginePage behaviour:
from PyQt6.QtWebEngineCore import QWebEnginePage
from urllib.parse import urlparse
import markdown2
class MyView(QWebEnginePage):
def acceptNavigationRequest(self, qurl, navtype, mainframe) -> bool:
parse_info = urlparse(qurl.url())
if parse_info.scheme.lower() == "file":
if parse_info.path.lower().endswith(".md"):
my_html = markdown2.markdown_path(parse_info.path)
self.setHtml(myhtml,
baseUrl=qurl)
return False
In Qt 6.9, this worked, the file was rendered as an HTML page.
Today my system upgraded to Qt 6.10. This same code now crashes the application (no message - exit
Cannot publish Google site, no drop down beside Publish button [closed]
27 December 2025 @ 5:19 pm
Can anyone help?
Trying to set up a Google site.
I have got my domain name verified by Google but cannot publish the Google site and connect them.
If I press the publish button I get the screen below and if I add the address in the top box I get the above.
Any ideas?
I have got my domain name verified by Google but cannot publish the Google site and connect them.
If I press the publish button I get the screen below and if I add the address in the top box I get the above.
Any ideas?Finding an operator for 3 distinct values with bitwise operations
27 December 2025 @ 5:09 pm
Consider the set {A,B,C} and an operator op defined by the following table
A op A = A
A op B = A
A op C = A
B op A = A
B op B = B
B op C = C
C op A = A
C op B = C
C op C = B
I would like to encode A,B and C with bits values and then define the operator op by some bitwise operations. For instance, one can set
constexpr auto A = 0b001;
constexpr auto B = 0b010;
constexpr auto C = 0b100;
then one can (empirically) define the operator by
auto op (auto x, auto y) {
return ((x&A) | (y&A)) | (x&B & y&B) | ((x&C & y&C)>>1) | ((x<<1) & y&C) | ((y<<1) & x&C);
}
which seems to give correct results (see here).
However, I came to this solution by a trial and error approach and
Is there any performance difference between applying a bunch of CSS classes to each child of an element or using selectors in a CSS file
27 December 2025 @ 1:27 pm
Let's say I have a table with many many rows:
<ul>
<tr>
<td>column1</td><td>column2</td><td>column3</td><td>column4</td>
<td>column1</td><td>column2</td><td>column3</td><td>column4</td>
... add a bazillion more lines
</tr>
</ul>
if I had to add a lot of styling to those rows and cells, is there any performance difference between bloating the HTML markup with a framework's CSS classes, such as:
<tr class="table-row">
<td class="table-cell p-4 pl-8 text-gray-500 dark:border-white/10 dark:text-gray-300">column1</td>
<td class="table-cell p-4 pl-8 text-gray-500 dark:border-white/10 dark:text-gray-300">column2</td>
<td class="table-cell p-4 pl-8 text-gray-500 dark:border-white/10 dark:text-gray-300">column
Anomaly with padding, margin, and display
27 December 2025 @ 6:08 am
So, I have a div named highlights which contains a bunch of cards. When I put #highlights into another div, named about which only has padding: 5rem 0; (margin would cause the same effect) for its CSS, each card's content is cut short significantly. When highlights is not a child of about or if you remove about's CSS, the cards fully encapsulate their content. This anomaly is only, as far as I know, visible on mobile. I do not have this problem at all on my laptop nor when I use chrome's resolution simulator to test what my website would look like different resolutions. However, when I checked using my IPhone 14 Pro, all my cards' content were cut short even though it was all fine on my laptop under the same resolution.
The code below exemplifies the issue. The first highlight is under about and the second about is a direct child of body.