Random snippets of all sorts of code, mixed with a selection of help and advice.
How to implement Yoast-style content analysis in Next.js without WordPress
2 May 2026 @ 11:28 am
I'm building a headless CMS with Next.js where editors write blog posts. I want to give them real-time SEO feedback — similar to what Yoast SEO does in WordPress — but my project is completely WordPress-free.
Specifically I need:
Check if the focus keyphrase appears in the title, meta description, headings, and body content
Validate keyphrase density (not too low, not too high)
Detect missing H1, broken heading hierarchy, and missing image alt text
Return a score so I can show a progress indicator in the editor UI
Optionally block publishing if the score is too low
What I've tried:
I've been manually writing regex checks, but they're fragile and don't scale:
// Manual keyphrase check — very basic and unreliable
const keyphraseInTitle = title.toLowerCase().includes
How to implement otp authentication
2 May 2026 @ 11:10 am
I am currently working on a freelancing project, user wants to add otp authentication system, like user verify number on the checkout page through otp.
Is there any free way to implement in WordPress website?
It's my first freelancing project so I am confused.
Okta as OIDC based external identity provider in Microsoft Entra External ID: provider not appearing on login screen
2 May 2026 @ 11:07 am
Environment / context
Microsoft Entra External ID (External ID) as the CIAM provider for our tenant
Okta configured as an OpenID Connect (OIDC) external identity provider in the External ID tenant
Created an External ID user flow and added Okta as a custom OIDC IdP
Next.js app using NextAuth v4 as the client
What I configured
Okta side:
Created an OIDC Web Application in Okta Admin Console
Grant type: Authorization Code
Added the following redirect/callback URLs to the Okta app:
https://<mytenant>.ciamlogin.com/<tenantId>/federation/oauth2
https://<mytenant>.ciamlogin.com/<mytenant>.onmicrosoft.com/federation/oauth2
https://<mytenant>.ciamlogin.com/<tenantId>/oauth2/v2.0/authresp
https://<mytenant>.ciamlogin.com/<m
Why Appstore IPA is still in Waiting for Review
2 May 2026 @ 10:57 am
I have setup IPA for the first time in AppStore, it's been a month it is not approving, will it approve when my new build will be approve? because 2-3 build has been rejected saying IPA is not working.
I am a unity game developer. So, I am not much aware about Apple systems.How do I return from a method an object of the class on which the method is invoked?
2 May 2026 @ 10:43 am
I have a class DNSRecord and I want to return the current object of this class from a method domain. Code is as follows:
public abstract class DNSRecord {
protected String domain;
public DNSRecord domain(String domain) {
this.domain = domain;
return this;
}
}
However, when I want another class, say NSRecord to extend this class, I can not chain method calls by: NSRecordObject.domain("pasta.org").nameserver("ns1.somedomain.net") as domain returns an object of type DNSRecord and not NSRecord and nameserver is a method defined in NSRecord class.
Code of NSRecord:
public final class NSRecord extends DNSRecord {
private String nameserver = null;
public NSRecord(String nameserver) {
this.nameserver = nameserver;
}
public NSRecord nameserver(String nameserver) {
this.nameserver = nam
Calling FindWindowW("Progman", "Program Manager") always returns a null handle
2 May 2026 @ 10:34 am
I'm using the koffi library to call Win32 APIs from TypeScript. However, I'm stuck at the very first step: FindWindowW consistently returns 0 (NULL), indicating that the Progman window cannot be found. Here are some part of the code:
const FindWindowW = user32.func("int FindWindowW(str lpClassNmae, str lpWindowName)");
export function attachToWallpaper(targetHwnd: number | bigint) {
// 步骤 1: 找到桌面顶层管理器 Progman
const progman = FindWindowW('Progman', "Program Manager");
console.log('Progman:', progman);
if (progman === 0) {
console.error('X Couldn\'t find Progman window');
return false;
}
// 步骤 2: 发送 0x052C 消息
const resultPtr = koffi.alloc('int', koffi.sizeof('int'));
SendMessageTimeoutW(progman, WM_SPAWN_WORKERW, 0, 0, SMTO_NORMAL, 1000, resultPtr);
koffi.free(resultPtr);
}
Discrepancy between api.stackexchange.com and data.stackexchange.com
2 May 2026 @ 10:19 am
I'm noticing that querying
https://api.stackexchange.com/2.3/questions
with those parameters:
"site": "stackoverflow",
"fromdate": 1772323200,
"todate": 1775001600,
"filter": "total",
(The dates correspond to 2026-03-01 00:00:00 UTC to 2026-04-01 00:00:00 UTC).
returns
3286.
But on data.stackexchange.com/stackoverflow, this:
SELECT COUNT(*) AS QuestionCount
FROM PostsWithDeleted
WHERE PostTypeId = 1
AND CreationDate >= '2026-03-01T00:00:00'
AND CreationDate < '2026-04-01T00:00:00';
gets me 3670 and if I query from Posts instead of PostsWithDeleted, I get 1993.
Why can't I find a query that makes api.stackexchange.com and data.stackexchange.com agree? I know there is a lag for data.stackexchange.com queries but we're talking
Finding the longest two words per input text file - linux
2 May 2026 @ 8:25 am
I am looking to adjust a bash script (shown below) in order to find the longest two words in each text file.
for i; do
if [[ -r $i ]]; then
max_word=
max_len=0
for j in $(strings $i); do
len=${#j}
if [[ $len -gt $max_len ]]; then
max_len=$len
max_word=$j
fi
done
echo "$i : '$max_word' ($max_len characters)"
fi
done
I understand that a second max word and max length variable (something like max_word2) need to be introduced and that its length will have to be compared to the first max_word. However, I am having trouble figuring out how to ensure that each result per input file is shown, rather than just the longest two across all the text files.
Databound ExpandoObject property won't update in dynamic XAML
2 May 2026 @ 1:50 am
I'm creating an AvaloniaUI app using the MVVM Community Toolkit, where I must render controls dynamically and data-bind them to a view model whose properties will be unknown until runtime. In fact, I'll be reading the properties and the fields to which they must bind out of a JSON file.
As a proof of concept I wrote this small app to test these dynamic bindings. I'm trying to use an ExpandoObject to encapsulate those dynamic properties to which I bind to the dynamically created controls. Unfortunately, any dynamically created property does not update per its dynamically created field.
My MainWindow contains:
<StackPanel>
<StackPanel Orientation="Horizontal">
<Button x:Name="btnCreateDynamicControls" Content="Create Settings Group" Click="btnCreateDynamicControls_Click" />
</StackPanel>
<StackPanel x:Name="stpSettingsGr
Is it possible for a newly requested FCM token to be identical to a previously expired one?
29 April 2026 @ 6:40 am
I would like to clarify whether FCM registration tokens can be recycled or reused.
User A's app Y request new token and get FCM Token X.
FCM Token X is expire.
User B's app Y request new token
in this Scenario, is it possible User B's app Y get FCM Token X?
If User B try this infinitely, can he get FCM Token X?