Random snippets of all sorts of code, mixed with a selection of help and advice.
How to unescape HTML entities in python
31 March 2026 @ 7:32 pm
I’m working with text data in Python that contains HTML-escaped entities such as &, <, and >. These entities appear in strings retrieved from external sources like web pages or APIs, and I need to convert them back into their original characters (for example, & → &). What is the most efficient and reliable way to unescape or decode these HTML entities in Python? Are there built-in libraries or recommended approaches for handling this, and how do they compare in terms of performance and simplicity?
integrate() returns 0 for large finite upper bounds but correct result for Inf
31 March 2026 @ 7:25 pm
I'm observing inconsistent behavior with integrate() in R when using large finite upper bounds versus Inf.
Consider the integral:
integrate(\(x) x^2 * exp(-x), 0, Inf)
# 2 with absolute error < 7.1e-05
This is correct (the true value is 2).
However, when I replace Inf with a large finite number:
integrate(\(x) x^2 * exp(-x), 0, 10000)
# 2 with absolute error < 0.00011
integrate(\(x) x^2 * exp(-x), 0, 100000)
# 2.429968e-41 with absolute error < 4.8e-41
integrate(\(x) x^2 * exp(-x), 0, 1000000)
# 0 with absolute error < 0
At some point, the result collapses to essentially zero, which is clearly incorrect.
Interestingly, reducing the upper bound again works:
integrate(\(x) x^2 * exp(-x), 0, 1000)
# 2 with absolute error < 1.6e-06
Questions:
Why does integrate() fail for
Interface and @overflow topic
31 March 2026 @ 7:16 pm
If an interface cannot extends a class then who it is possible to override to String method, equals method and hash method? As it is Interface it cannot implements the class property and doesn't have right to create a constructor. Then how it is possible to override the to String method, hash method and equals method?
For which urls is the http-authentication-factory name="application-http-authentication" from elytron used?
31 March 2026 @ 6:52 pm
I have an example from wildfly, wildfly-widgets. There credentials are in a realm which is added to ApplicationDomain. The following urls work:
https://<myhostname>:8443/wildfly-widgets/inventory
http://localhost:8080/wildfly-widgets/inventory
But I was wondering where the second http-authentication-factory below is used for. The first one, management-http-authencation is used: when I change it or remove it, login in the management gui doesn't work anymore. But if I remove the second one, everything still works, at least for the urls I gave above.
Here the how the two http-authentication-factory are defined:
<subsystem xmlns="urn:wildfly:elytron:18.0" final-providers="combined-providers" disallowed-providers="OracleUcrypto">
...
<http>
<http-authentication-factory name="management-http-authentication" security-domain="ManagementDomai
How To Get Tasker to match a date
31 March 2026 @ 5:10 pm
I am trying to get an "if" condition in a Tasker task to match any date of the form MM/DD/YYYY. I have tried many regex forms including \d{1,2}/\d{1,2}/\d{4} but it doesn't match. Any ideas of a condition that will match any date of the above form?
Merriweather Google Font doesn't work with font-stretch
31 March 2026 @ 2:17 pm
On the Google Fonts page for Merriweather, it shows it has a variable width that you can test on the site. But when I have the font embedded in a site, there is no option:
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Merriweather:ital,opsz,wght@0,18..144,300..900;1,18..144,300..900&display=swap" rel="stylesheet">
</head>
<body>
<h1 style="font-family: Merriweather; font-stretch: 87.5">Lorem ipsum</h1>
<h1 style="font-family: Merriweather; font-stretch: 100">Lorem ipsum</h1>
</body>
</html>
Migrating Delphi application to .NET: Framework 4.8 vs .NET 6+ for COM/Hydra interop
31 March 2026 @ 6:39 am
We're planning a phased migration of a large Delphi application to C#/.NET. The migration strategy involves:
Running Delphi and C# side-by-side during transition (12-24 months)
Using RemObjects Hydra (or COM interop) for Delphi ↔ C# communication
Gradually replacing Delphi modules with C# equivalents
Our dilemma: Should we target .NET Framework 4.8 initially or go directly to modern .NET (6/8/10)?
Option A: .NET Framework 4.8 → Later upgrade
Pros:
Well-documented Delphi interop patterns
Proven Hydra support
Lower risk during pilot phase
Cons:
Requires migration to modern .NET later
Creates temporary technical debt
Double deployment/testing effort
Option B: Mo
App Store Connect says RPBroadcastProcessMode is missing in ReplayKit broadcast upload extension, but archive and IPA both contain it
31 March 2026 @ 2:44 am
I’m trying to upload an iOS app that now includes a ReplayKit Broadcast Upload extension.
This app already had another extension (WidgetKit), and I had successfully uploaded/distributed multiple previous builds through App Store Connect. The upload issue only started after I added the ReplayKit Broadcast Upload extension.
App Store Connect validation now fails during upload with an error saying the broadcast extension is missing RPBroadcastProcessMode, even though that key is present in both the archived app and the exported IPA.
The validation error says that the value for RPBroadcastProcessMode in the broadcast extension is invalid, and that the key was not specified. It expects either RPBroadcastProcessModeSampleBuffer or RPBroadcastProcessModeMP4Clip.
In my extension plist, the extension is configured as a broadcast upload extension with:
NSExtensionP
Is there a better way to do this clunky function (maps, arrays, sets or none of them)?
30 March 2026 @ 8:46 pm
For context: I'm new to coding and still learning.
What I want:
I recently started to play around with JavaScript, and was trying to make this function as "unrepetitive" as possible. I'd like it so I could pick a random entry from an array (or something similar) that meets the logical comparison. In this case, if the type parameter is the same as the category in the entry.
You can see that I did somewhat achieve it like this, but it feels clunky... I'm not too sure. I haven't tested it just yet (kinda scared to see none of it works). So I'd appreciate constructive feedback!
function randStatus(type = "status") {
let status = "";
const buffOptions = [
"gunslinger",
"teamwork",
"sharpness",
"distraction",
"trick",
"undying",
"badassery",
"stabilit
Virtual range initializer in C++ to be used in range-based for loop
30 March 2026 @ 12:17 pm
I want an abstract class range initializer that can be used in a range-based for loop. Is such a thing even possible? Currently I only see how to do that with non-abstract classes.
Class TestRange acts as an iterator. TestRangeB and TestRangeC have different internal behaviour.
#include <array>
#include <iostream>
class A {
public:
class TestRange {
public:
friend bool operator==(const TestRange& lhs, const TestRange& rhs) {
return lhs.getId() == rhs.getId();
}
friend bool operator!=(const TestRange& lhs, const TestRange& rhs) {
return !(lhs == rhs);
}
virtual int operator*() = 0;
int index = 0;
virtual int getId() const = 0;
};
class TestRangeInitializer {
public:
virtual TestRange* begin() = 0;
int end() { return -1; }
};
virtual TestRangeI