Write a polite but firm email to a landlord who has not fixed the heating for three weeks. I want the repair, not a fight.
GLM 5.3 Flash
Subject: Urgent: Heating Repair Still Outstanding – Request for Immediate Action
Dear [Landlord's Name],
I hope you're doing well. I'm writing to follow up on the heating issue in my apartment at [address], which I first reported on [date of first report] — three weeks ago.
Despite my previous messages on [dates of any follow-ups], the heating has not been repaired. As you'll appreciate, living without adequate heating is more than an inconvenience; it affects my health, comfort, and possibly the habitability of the unit, particularly with [cold weather / a cold snap / young children in the home, as applicable].
I would very much like to resolve this amicably and quickly. To that end, I'd appreciate it if you could:
Confirm a repair date in writing within [48 hours / 3 business days] of this email; and
Arrange for a qualified technician to complete the repair by [specific reasonable date, e.g., end of this week].
If it's helpful, I'm happy to be flexible on timing to accommodate the contractor — I just need a firm commitment and a date.
For my records, I'm keeping a written log of all communications regarding this issue, including this email. I'm confident we can sort this out without needing to involve the local housing authority or consult my tenancy rights, but I do need the repair scheduled now rather than later.
Thank you for your prompt attention. I look forward to your reply by [date].
Kind regards, [Your Name] [Address / Unit Number] [Phone Number]
A few tips for using this:
Fill in the specific dates — documenting the timeline ("reported on X, followed up on Y") is what makes the email firm rather than just polite.
The reference to the housing authority is your leverage. It's phrased as "I'm confident we won't need to..." — which signals you know your rights without threatening.
Keep the paper trail. Send it by email rather than phone, and save a copy. If this drags on, a dated record is your best friend.
Check your local rules. In many places, landlords are legally required to fix heating within a specific timeframe (often much shorter than three weeks) — mentioning "my tenancy rights" hints you may know this.
Want me to adjust the tone (softer or firmer), or tailor it to a specific country's tenancy laws?
Asked Nov 1, 2026. Unedited.
DeepSeek V4.1 Flash 1017
Subject: Urgent: Heating repair outstanding for three weeks — [Property Address]
Dear [Landlord’s Name],
I’m writing about the heating at [Property Address], which has not been working since [date]. I first reported the issue on [date] and followed up on [dates]. It has now been three weeks, and the property is becoming difficult to live in.
I’d be grateful if you could arrange for a qualified heating engineer to inspect and repair the system as soon as possible. I can provide access at [times/dates] and will cooperate fully with any appointment.
Please confirm in writing:
the date the repair will be carried out; or
if there is a delay due to parts or engineer availability, what interim heating arrangements you will provide.
Given how long this has been outstanding, I’d ask for a confirmed appointment within the next [48 hours/two working days], with the repair carried out within [five working days] or as soon as reasonably practicable. I’m not looking to escalate this—I would much prefer to resolve it directly—but I do need the heating fixed.
Please let me know by [date/time] how you intend to proceed.
Kind regards, [Your Name] [Phone Number] [Email Address]
Asked Nov 1, 2026. Unedited.
Write a React hook that debounces a value and cancels on unmount. Include the TypeScript types.
GLM 5.3 Flash
Here's a well-typed useDebouncedValue hook that cancels pending updates on unmount:
import { useEffect, useState } from "react";
/**
* Returns a debounced copy of `value` that only updates after
* no new value has been provided for `delay` milliseconds.
*/
function useDebouncedValue<T>(value: T, delay = 300): T {
const [debouncedValue, setDebouncedValue] = useState<T>(value);
useEffect(() => {
// Set up the timer for this value
const timeoutId = window.setTimeout(() => {
setDebouncedValue(value);
}, delay);
// Cleanup: cancels the pending update when the value changes
// OR when the component unmounts.
return () => {
window.clearTimeout(timeoutId);
};
}, [value, delay]);
return debouncedValue;
}
export default useDebouncedValue;Usage
import { useState } from "react";
import useDebouncedValue from "./useDebouncedValue";
function SearchResults() {
const [query, setQuery] = useState("");
const debouncedQuery = useDebouncedValue(query, 500);
useEffect(() => {
if (!debouncedQuery) return;
// This only fires once typing pauses for 500ms
fetchResults(debouncedQuery);
}, [debouncedQuery]);
return <input value={query} onChange={(e) => setQuery(e.target.value)} />;
}Key points
Generic
<T>: The hook preserves the exact type of the value you pass in —useDebouncedValue<string>, objects, etc.Unmount safety: The
return () => window.clearTimeout(...)in the effect cleanup runs on unmount, so no state update is attempted on an unmounted component. React 18+ no longer warns about this, but it avoids unnecessary work regardless.Value-change cancellation: Because the cleanup also runs before each re-run of the effect, rapid changes cancel the previous timer — that's the actual debouncing mechanism.
Default
window.setTimeout: Usingwindow.setTimeoutexplicitly ensures the return type isnumber(notNodeJS.Timeout), avoiding a DOM/Node type mismatch. If you're in a browser-only codebase, this is the safest form.
Optional: leading/trailing behavior
If you want more control, here's a variant with an options object:
interface DebounceOptions {
delay?: number;
/** Fire immediately on first value, then debounce (default: false) */
leading?: boolean;
}
function useDebouncedValue<T>(value: T, options: DebounceOptions = {}): T {
const { delay = 300, leading = false } = options;
const [debouncedValue, setDebouncedValue] = useState<T>(value);
const isFirstRender = useRef(true);
useEffect(() => {
if (isFirstRender.current && leading) {
isFirstRender.current = false;
setDebouncedValue(value);
return;
}
isFirstRender.current = false;
const timeoutId = window.setTimeout(() => setDebouncedValue(value), delay);
return () => window.clearTimeout(timeoutId);
}, [value, delay, leading]);
return debouncedValue;
}For most use cases, the simple version at the top is all you need.
Asked Nov 1, 2026. Unedited.
DeepSeek V4.1 Flash 1017
import { useEffect, useState } from "react";
/**
* Returns `value`, but only after it has stopped changing for `delay` ms.
* The pending timer is cleared on unmount and whenever `value`/`delay` change.
*/
export function useDebouncedValue<T>(value: T, delay = 300): T {
const [debouncedValue, setDebouncedValue] = useState<T>(value);
useEffect(() => {
const timerId = setTimeout(() => {
setDebouncedValue(value);
}, delay);
// Runs on unmount *and* before the next effect run.
// Clearing the timer is what prevents a setState-after-unmount.
return () => {
clearTimeout(timerId);
};
}, [value, delay]);
return debouncedValue;
}Usage:
function Search() {
const [query, setQuery] = useState("");
const debouncedQuery = useDebouncedValue(query, 400);
useEffect(() => {
if (!debouncedQuery) return;
const controller = new AbortController();
fetch(`/api/search?q=${encodeURIComponent(debouncedQuery)}`, {
signal: controller.signal,
});
return () => controller.abort();
}, [debouncedQuery]);
return <input value={query} onChange={(e) => setQuery(e.target.value)} />;
}Why this is safe on unmount
clearTimeout in the cleanup is sufficient — no isMounted ref needed:
Unmount → React runs the cleanup → the timer is cancelled, so
setDebouncedValuenever fires.valuechanges → the old timer is cancelled before a new one starts, which is exactly the debounce behavior.
An isMounted flag would only mask the problem and adds a render-time ref read; skipping it is the idiomatic approach.
Behavior notes
The first render is not debounced.
useState(value)seeds with the current value, sodebouncedValue === valueuntil the first change. If you need a different initial value, add a parameter:useDebouncedValue<T>(value: T, delay = 300, initialValue: T = value).delayis reactive. Changing it mid-flight restarts the timer. That's usually desired; if not, stash it in a ref.StrictMode-safe. The dev-only double-invoke of effects just clears and re-sets one timer.
delay: 0is valid (defers by a macrotask), useful for coalescing rapid updates.
Optional: leading edge
If you want the first change to apply immediately and only subsequent ones to be debounced, track the previous value:
export function useDebouncedValue<T>(value: T, delay = 300, leading = false): T {
const [debouncedValue, setDebouncedValue] = useState<T>(value);
useEffect(() => {
if (leading && debouncedValue === value) return; // hmm — see note
...
}, [value, delay]);
...
}Honestly, leading-edge debouncing is cleaner as a separate useDebouncedCallback hook — mixing it into a value hook forces you to reason about which render "owns" the leading edge, and the extra state usually isn't worth it.
Asked Nov 1, 2026. Unedited.
A drug test is 99% accurate, and 0.5% of people use the drug. Someone tests positive. What is the probability they use it, and why does the answer surprise people?
GLM 5.3 Flash
The Answer: About 33% — not 99%
This is the classic base rate fallacy, and the math is worth seeing.
Setting Up Bayes' Theorem
Given:
99% test accuracy (sensitivity: 99% of users test positive; specificity: 99% of non-users test negative)
0.5% of the population uses the drug (the base rate)
Among 10,000 people:
| Group | Count | Test Positive | Test Negative |
|---|---|---|---|
| Users (0.5%) | 50 | ~49.5 | ~0.5 |
| Non-users (99.5%) | 9,950 | ~99.5 | ~9,850.5 |
| Total | 10,000 | ~149 |
$$P(\text{user} \mid \text{positive}) = \frac{0.99 \times 0.005}{(0.99 \times 0.005) + (0.01 \times 0.995)} = \frac{0.00495}{0.00495 + 0.00995} \approx 33\%$$
Why This Surprises People
We ignore the base rate. Our intuition latches onto "99% accurate" and ignores how rare drug use is. But the rare condition means most positives come from the huge pool of non-users.
False positives outnumber true positives. Even though only 1% of non-users test positive wrongly, there are so many non-users (9,950) that they generate ~100 false positives — twice as many as the ~50 true positives from actual users.
"99% accurate" ≠ "99% chance it's right." Accuracy is a property of the test. The probability you want depends on both the test and how common the condition is.
The Takeaway
For rare conditions, even excellent tests produce mostly false positives. This is why:
Doctors often order a second, independent test before diagnosing a rare disease (two positive results would push the probability past ~98%)
Screening entire populations for rare diseases is controversial — you may harm more people with false alarms than you help with true catches
Rule of thumb: the rarer the condition, the less a single positive test tells you.
Asked Nov 1, 2026. Unedited.
DeepSeek V4.1 Flash 1017
Assuming “99% accurate” means:
A drug user tests positive 99% of the time: (P(+|D)=0.99)
A non-user tests negative 99% of the time, so a non-user falsely tests positive 1% of the time: (P(+|\neg D)=0.01)
Prevalence: (P(D)=0.005)
Using Bayes’ theorem:
[ P(D|+) = \frac{P(+|D)P(D)} {P(+|D)P(D)+P(+|\neg D)P(\neg D)} ]
[ = \frac{0.99 \times 0.005} {0.99 \times 0.005 + 0.01 \times 0.995} = \frac{0.00495}{0.00495+0.00995} \approx 0.332 ]
So the probability the person uses the drug, given a positive test, is about 33%, not 99%.
Why it surprises people: this is base-rate neglect. Because drug use is rare (0.5%), there are many more non-users than users. Even a small false-positive rate creates more false positives than the true positives from the rare group.
In a group of 1,000 people:
About 5 use the drug; ~4.95 test positive.
About 995 do not use it; ~9.95 falsely test positive.
So among roughly 14.9 positive tests, only about 4.95 are true positives:
[ \frac{4.95}{14.9} \approx 33\% ]
The key intuition: a positive result from an accurate test is still weak evidence when the condition is very rare.
Asked Nov 1, 2026. Unedited.
Head to head
Ranked against 42 models, from public leaderboards and our own blind tests where we have them. How we rank
| Task | GLM 5.3 Flash | DeepSeek V4.1 Flash 1017 | Leads |
|---|---|---|---|
| Coding | #14 | #15 | GLM 5.3 Flash |
| Writing | #7 | #14 | GLM 5.3 Flash |
| Math | #14 | #15 | GLM 5.3 Flash |
| Research | #5 | #13 | GLM 5.3 Flash |
| Everyday chat | #12 | #17 | GLM 5.3 Flash |
The facts
Scores from artificialanalysis.ai and lmarena.ai.
| Fact | GLM 5.3 Flash | DeepSeek V4.1 Flash 1017 |
|---|---|---|
| Made by | Z.ai | DeepSeek |
| API price, per 1M tokens | $0.15 in, $0.50 out | $0.30 in, $1.20 out |
| Speed | 74 tokens a second | 169 tokens a second |
| Artificial Analysis Index | 41.8 | 45.1 |
| LMArena text | 1,472 | No public score |
| LMArena coding | 1,508 | No public score |
| Updated | Oct 26, 2026 | |