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 DataWeave filter return an empty array when matching records exist?

25 March 2026 @ 4:06 am

I have a JSON array of employee records and I'm filtering for active employees in DataWeave: %dw 2.0 output application/json

Can OpenSSL-generated CSRs be used for Apple MDM APNs certificates (vs mdmctl)?

25 March 2026 @ 3:58 am

I am working on setting up an Apple Mobile Device Management (MDM) solution and need to generate an APNs certificate. I understand that this process requires creating a Certificate Signing Request (CSR), which is typically submitted to Apple via the Push Certificates Portal. I’ve seen tools like mdmctl generate CSRs specifically for MDM, and those seem to work without issues. However, I would prefer to generate the CSR manually using OpenSSL for more control over the process. I generated a CSR using OpenSSL with the following properties: RSA 2048-bit key SHA-256 PEM format The CSR appears valid, but when I upload it to the Apple Push Certificates Portal, it gets rejected with: "Invalid Certificate Signing Request" Can a CSR generated with OpenSSL be used for Apple MDM APNs certificates? Are the

How does C know the value of DBL_EPSILON in machines that do not follow the IEEE floating point convention

25 March 2026 @ 3:47 am

I was trying to solve the problem posed in this question where the author asks that the value of DBL_EPSILON be computed portably without using the macro. My solution : #include <stdio.h> int main(void) { double one = 1, next = 1, zero = -0.0; unsigned char * ptr_next = (unsigned char *)&next, * ptr_zero = (unsigned char *)&zero; int endianness; if (ptr_zero[7] >> 7) endianness = 0; if (ptr_zero[0] >> 7) endianness = 7; ptr_next[endianness] |= 1; printf("DBL_EPSILON = %e", (next - one)); return 0; } I determined the endianness of the machine by finding out at what position the 1 bit of -0.0 is located. I then incremented the mantissa of one by 1, obtaining the floating point number next to one. T

Is Apple MDM Vendor Certificate mandatory for internal (in-house) MDM solutions?

25 March 2026 @ 3:47 am

I am developing an in-house Mobile Device Management (MDM) solution for internal use within my company and trying to generate an APNs certificate. I understand that Apple typically requires a CSR signed with an MDM Vendor Certificate, but obtaining this vendor certificate requires special approval. In my case, I have an Apple Developer (Company) account and access to Apple Business Manager, but when I generate a standard CSR and upload it to the Apple Push Certificates Portal, it gets rejected, while third-party tools seem to work. Does this mean that obtaining a Vendor Certificate is mandatory in all cases, even for internal MDM solutions, or is there any supported way to generate and use a CSR without vendor signing for private deployments?

Precision Recall Curve Not Behaving As Expected

25 March 2026 @ 3:47 am

I am training a model in Python. The problem is a class-imbalance classification problem at ~1:50 ratio. In most problems, precision-recall curve follows a smooth drop from 100% precision & 0% recall to 0% precision and 100% recall (see: https://towardsai.net/p/l/precision-recall-curve) However, my model behaves such that it drops sharply. The first point is, as expected, 100% at 0% recall. Then it drops to 50% precision at ~5-10% recall. Afterward, it "behaves expectedly" as it increases recall all the way to 100% while precision drops from 50% to 0%. I am told that my graph looks unnatural because of that sharp drop. However, after exploring my own data and results, I concluded that this is unfortunately due to class imbalance problem. For example, if I have only 2 True Positive and 2 False Positive, my precision is 50%. But if I nudge the thres

MDM CSR without vendor signing – Unable to generate APNs certificate (“Invalid CSR” error)

25 March 2026 @ 3:41 am

Question: I am currently working on a prototype MDM (Mobile Device Management) solution, similar to JMAF, for internal use within my company. I have: An Apple Developer account (company) An Apple Business Manager account However, my Apple Developer account does not have permission to generate the MDM Vendor Certificate. What I’ve tried I was able to generate an APNs certificate using a third-party service (e.g., https://mdmcert.download), and I can successfully: Obtain an APNs certificate Push configuration profiles to devices However, when I try to generate my own CSR and upload it directly to the Apple Push Certificates Portal: https://identity.apple.com/

Why can't you pass props from +layout.svelte to +page.svelte files in SvelteKit?

25 March 2026 @ 3:39 am

From what I understand, $props from +layout.svelte are not inherited by its +page.svelte file (or any other child +page.svelte files), and there's no way to manually pass props from +layout.svelte using {@render children()} without setting up some kind of external scope. This seems a bit strange to me, having UI of +layout.svelte shared between pages but not the data, and no way to easily pass that data like I would with a normal component. I'm sure there's a good reason for this, which is why I'm asking this question, but I'm a bit confused as to why SvelteKit is structured that way.

Looking for assistance with a theory

25 March 2026 @ 3:35 am

I have a theory That solves : The suns 11 year cycle. Earths internal heat budget Discrepancy. The Heat Paradox in the Gas Giants in our Solar system. Thermal rings in Galaxy's I know this sound too good to be true, how ever there are a lot of unbelievable thing being said in the world. But just once in a while things are exceptional. I have been working on my theory for some time. Testing the theory to the best of my ability & it has held up to all of the testing that I can do. Need a specialist view for more testing. Can you help ?

C# Dependency Injection Without Objects?

25 March 2026 @ 3:33 am

When writing C# applications, it often feels like we’re encouraged to make methods instance-based even when they would naturally be static. Of course C# is an OOP-first language and patterns like dependency injection, mocking, and unit testing are built around instances. However C# 11 brought static methods in interfaces, so we can technically do this: public interface IFileHasher<T> where T : IFileHasher<T> { static abstract string ComputeHash(string filePath); } public class SHA256FileHasher : IFileHasher<SHA256FileHasher> { public static string ComputeHash(string filePath) {} } Traditionally we inject a dependency by creating and passing a new instance: FileProcessor<SHA256FileHasher> processor = new(new SHA256FileHasher()) But with this pattern, the dependency can be expressed purely as a type parameter: FileProcessor<SHA256File

How to implement multi-language support in a SaaS boilerplate with 33 themes?

25 March 2026 @ 3:30 am

I'm building a SaaS application and considering using a starter template that includes multi-language and theme switching capabilities. I found a boilerplate that claims to support 33 themes and multiple languages out of the box. I understand it uses a component-based architecture (React/Vue) with i18n and CSS variables for theming. What are the common patterns to: Dynamically switch themes without page reload Store user theme preferences securely Structure translation files for scalability I'm not asking for a specific product recommendation, but rather best practices to achieve this level of flexibility. Any code examples or architectural insights would be appreciated.