Random snippets of all sorts of code, mixed with a selection of help and advice.
Supabase OTP authentication error: Wrong OTP entered
23 February 2026 @ 8:10 am
I'm working on a project. Old users are able to login using OTP but new ones are facing the error while registration.
This is happening since I changed the original magic link for confirmation to OTP based only.
I've attached relevant attachments.
this is the verify OTP function i am implementing:
async function verifyOTP() {
if (otpVerifyInFlightRef.current) return
setError('')
if (otp.length !== 6) {
setError('Please enter the 6-digit code.')
triggerShake()
return
}
otpVerifyInFlightRef.current = true
setSending(true)
try {
const emailPrefix = normalizePrefix(otpEmail)
const email = ${emailPrefix}@iitb.ac.in
// signInWithOtp email codes should be verified as email for both lanes.
const verifyType = otpLane === 'signup' ? 'signup' : 'email'
const { data, error: verifyError } = await supabase.auth.verifyOtp({
email,
token: otp,
type: verify
Number of colors in a line plot
23 February 2026 @ 7:50 am
I have a fairly simple plot unsing plotnine 0.15.3: a line plot with different colors on a categorial variable:
ggplot(data, aes(x = 'snapshotDate', y = 'hits', group = 'query'))
+ geom_line(aes(color='query'))
This works fine - until the number of different "query"-ies hits a certain threshold (16?). As soon as I have more "queries" the colors seem to be reset. In that case all lines have the exact same color.
How to resolve that?
I know that such a large number of colors is fairly difficult to interpret.
Is it good practice to pass IRibbonUI into service classes to refresh Ribbon after async work in a VSTO Word add‑in?
23 February 2026 @ 7:38 am
I have a Word VSTO plugin solution with other supporting projects inside the solution. I need to change the icon of the ribbon button based on the result of an async task. To do this I use ribbon.Invalidate(). This refreshes my ribbon and load the new icon. These are just buttons, created in ribbon XML.
I cannot integrate the ribbon.Invalidate() in to my button clicks in the Ribbon.cs as the button clicks mostly calls Async functions, or function that calls async functions - in other projects. So just after the button click, the function immediately returns and invalidates the ribbon, before the background running async function completes it's process.
I tried sending the ribbon object as a parameter in the the function, which runs the sync task and calling the Invalidate from there - in the finally statement of the function. It was a success in some cases, but tricky in some instances. But I can make it work.
Worpress Plugin Error - Image not Showing in API Calls
23 February 2026 @ 7:14 am
Earlier we were using Yoast SEO and fetching image on the footer section for new blogs uploaded on example.com/blogs but then we switched to RankMath SEO Plugin and now we are not getting images data via the same API.
Code We were using earlier when images were showing via Yoast SEO Plugin Key. Now we are fetching older blogs using https://crystaivf.com/blogs/wp-json/wp/v2/posts
<Image
src={
item?.yoast_head_json?.og_image?.length > 0 &&
item.yoast_head_json.og_image[0].url
}
alt={item?.yoast_head_json?.og_title ?? "blogs"}
width={312}
height={160}
style={{ width: "100%", height: "auto" }}
loading="lazy"
/>
How can I compact a large, repetitive JSON payload for LLM prompts to reduce tokens without losing needed info?
23 February 2026 @ 5:50 am
I’m passing a fairly large JSON (More than 2500 lines) payload to an LLM. It’s full of repeated fields (especially ranges repeated in each historic entry), metadata we don’t actually use, and verbose keys. This burns a lot of tokens.
Example (trimmed) input:
{
"pid": "TEST_1010",
"biomarker": [
{
"simpleLabel": "Estim. Avg Glu (eAG)",
"ranges": {
"fair": [70, 126],
"optimal": [70, 97],
"inRange": [70, 126],
"good": [70, 108]
},
"result": 110.69,
"rawResult": 110.69,
"type": "biomarker",
"unit": "mg/dL",
"originalUnit": "mg/dL",
"label": "Estim. Avg Glu (eAG)",
"shortLabel": "Estimated Average Glucose (eAG)&q
How do I update Google Antigravity IDE to the latest version inside the IDE itself?
23 February 2026 @ 4:59 am
I am using Google Antigravity, the AI-powered integrated development environment (IDE) from Google (agent-first platform based on a fork of VS Code) and want to know how to update it from within the IDE itself.
I don’t want to manually download the installer every time. In tools like Visual Studio Code, updates can be triggered from the IDE (through the Settings or Help menu). What is the equivalent in Google Antigravity?
Specifically:
Is there a built-in update checker or auto-update feature?
Can I trigger updates via a menu command, command palette, setting, or terminal?
If not, what is the recommended way to keep Antigravity up to date?
Can we prove equal subcases have equal induction hypotheses in recursion principle?
22 February 2026 @ 11:47 pm
When performing recursion, it seems reasonable to assume that if two subcases f b1 and f b2 are equal, they will produce equal results IH b1 = IH b2: after all, we only expect to call the inductive step with IH = rec ∘ f . Can we prove this extended recursion principle, rec2 below? UIP/Axiom K is fine, but I don't want to assume function extensionality.
Axiom UIP : forall X (x1 x2 : X) (e1 : x1 = x2) (e2 : x1 = x2), e1 = e2.
Variables (A : Type) (B : A -> Type).
Inductive W : Type := suc : forall a, (B a -> W) -> W.
Variables (P : W -> Type).
Fixpoint rec (H : forall a f, (forall b, P (f b)) -> P (suc a f)) (x : W) : P x
:= match x with suc a f => H a f (fun b => rec H (f b)) end.
(* We would expect rec2 H (suc a f) =
H a f (fun b => rec H f b)
(fun b1 b2 => f_equal (fun x => existT P _ (rec x))) *)
Theorem rec2
(H
Why do I receive an error using System.Windows.Forms?
22 February 2026 @ 9:42 pm
When I try to use a code with
using System.Windows.Forms
to create a Form from Windows in VS Code, and execute it, I get a few errors - one is form itself that is marked with red underline and shows this message:
Error CS0234 The type or namespace name 'Forms' does not exist in the namespace 'System.Windows' (are you missing an assembly reference?)
I read in a topic, if I left click on the Solution Explorer icon and add "using System.Windows.Forms", the problem will be resolved. I installed the Solution Explorer extension, but I didn't find the "using System.Windows.Forms" header to enter into my file.
Best approach for server-side license key verification with HWID binding in C#
22 February 2026 @ 8:35 pm
I'm building a commercial desktop application in C# and I need to implement license verification that prevents key sharing between users.
What I'm trying to achieve:
Bind each license key to a specific machine using a Hardware ID (HWID)
Verify licenses server-side so the check can't be patched out client-side
Handle edge cases like hardware upgrades (HWID reset flow)
Blacklist compromised keys immediately without a new deployment
What I've tried: I've looked into generating HWIDs from a combination of CPU ID, motherboard serial, and MAC address hashed together. For server-side verification I'm currently calling an external REST API on startup and caching the session result.
Current C# code:
public async Task<bool> VerifyLicense(string licenseKey, string hwid)
{
var response = await _httpClient.PostAsJsonAsync("/licenses/verify", new {
key = licenseKey,
Branded types as object keys are not safe to use
22 February 2026 @ 6:59 pm
I realized today that branded types used as record (or Map) keys are not safe to use if you fail to pass the exact record shape.
Here's an example:
type KeyA = string & { readonly __branded__: unique symbol }
type KeyB = string & { readonly __branded__: unique symbol }
type Stats = { count: number };
type ObjA = Record<KeyA, Stats>;
type ObjB = Record<KeyB, Record<KeyA, Stats>>;
const a: ObjA = {} as any as ObjA;
const b: ObjB = {} as any as ObjB;
const c: ObjB = a; // no error
Playground
The same happens wi