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.
DeepSeek V4.1 Flash
Subject: Heating repair — three weeks without heating — request for a confirmed repair date
Dear [Landlord’s name],
I hope you’re well. I’m writing about the heating at [property address], which stopped working on [date]. It has now been three weeks, and despite reporting it on [date(s)], I still haven’t had a repair or a confirmed appointment.
This is making the property very cold and difficult to live in. I’m not looking for an argument — I’d much rather resolve this directly with you — but I do need the heating fixed as soon as possible. Please treat this as a formal repair request.
Could you please confirm by [date, e.g. end of day Friday]:
When a qualified engineer will attend;
The date and time once it’s booked; and
Whether you’ll provide temporary heaters in the meantime, or whether I should arrange them and seek reimbursement.
I can provide access at [times] and will make sure the area is clear. If there’s a delay because of parts or contractor availability, please let me know — I’m happy to be patient if there’s a clear timeline.
I’d appreciate a reply by [date]. If I haven’t heard back by then, I’ll send a written reminder, but my strong preference is to get this sorted with you quickly and without needing to take it further.
Thank you — please let me know what you can arrange.
Best regards, [Your name] [Phone number] [Email address]
Tip before sending: Keep it factual, attach any previous emails/texts, and note the dates you reported the issue. That keeps the tone reasonable while making clear you’re keeping a record.
Asked Nov 1, 2026. Unedited.
Write a React hook that debounces a value and cancels on unmount. Include the TypeScript types.
DeepSeek V4.1 Flash
useDebouncedValue
import { useEffect, useState } from 'react';
/**
* Returns a debounced copy of `value`; it only updates after `delay`
* milliseconds have elapsed without `value` changing.
*
* Any pending update is cancelled on unmount (and whenever `value` or
* `delay` changes), so state is never set on an unmounted component.
*/
export function useDebouncedValue<T>(value: T, delay = 300): T {
// Seed with the initial value so the first render isn't delayed.
const [debouncedValue, setDebouncedValue] = useState<T>(value);
useEffect(() => {
// Nothing to debounce — apply on the next commit.
if (delay <= 0) {
setDebouncedValue(value);
return;
}
const timer = setTimeout(() => {
setDebouncedValue(value);
}, delay);
// Runs when value/delay change *and* on unmount:
// clearTimeout is what cancels the pending state update.
return () => clearTimeout(timer);
}, [value, delay]);
return debouncedValue;
}Why this is unmount-safe
The cleanup function returned from useEffect is invoked both when the dependencies change and when the component unmounts. Clearing the timeout means the setDebouncedValue call is discarded in both cases — no "Can't perform a React state update on an unmounted component" warnings, and no leaked timers.
Also note the hook doesn't debounce the initial mount: debouncedValue starts as value.
Usage
function SearchBox() {
const [query, setQuery] = useState('');
const debouncedQuery = useDebouncedValue(query, 300);
useEffect(() => {
if (!debouncedQuery) return;
const controller = new AbortController();
fetch(`/api/search?q=${encodeURIComponent(debouncedQuery)}`, {
signal: controller.signal,
})
.then((res) => res.json())
.then(setResults)
.catch((err) => {
if ((err as Error).name !== 'AbortError') console.error(err);
});
return () => controller.abort();
}, [debouncedQuery]);
return <input value={query} onChange={(e) => setQuery(e.target.value)} />;
}Gotchas worth knowing
Object/array identity. The effect re-runs on referential inequality, so passing a freshly-created object each render resets the timer forever. Pass a primitive, or memoize/JSON-serialize before passing.
delaychanges reset the timer. Ifdelayis dynamic, expect an extra debounce window when it changes.Timer typing. If you're in an environment where
setTimeoutreturns aNodeJS.Timeout,ReturnType<typeof setTimeout>is the portable type — not needed here since it's inferred, but keep it in mind if you hoist the ref.
Optional companion: useDebouncedCallback
If you need arguments or a cancel() handle rather than a value:
import { useCallback, useEffect, useRef } from 'react';
export function useDebouncedCallback<Args extends unknown[]>(
callback: (...args: Args) => void,
delay = 300,
): (...args: Args) => void {
const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
const callbackRef = useRef(callback);
// Keep the latest callback without invalidating the returned function.
useEffect(() => {
callbackRef.current = callback;
});
// Cancel on unmount.
useEffect(
() => () => {
if (timeoutRef.current !== null) clearTimeout(timeoutRef.current);
},
[],
);
return useCallback(
(...args: Args) => {
if (timeoutRef.current !== null) clearTimeout(timeoutRef.current);
timeoutRef.current = setTimeout(() => {
timeoutRef.current = null;
callbackRef.current(...args);
}, delay);
},
[delay],
);
}For pure render-priority work (no network/expensive side effect), React's built-in useDeferredValue is often a better fit than a timer-based debounce.
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?
DeepSeek V4.1 Flash
Assuming “99% accurate” means:
99% sensitivity: a user tests positive 99% of the time.
99% specificity: a non-user tests negative 99% of the time, so 1% falsely test positive.
Let (D) = uses the drug, (+) = tests positive.
[ P(D \mid +)=\frac{P(+ \mid D)P(D)}{P(+ \mid D)P(D)+P(+ \mid \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} =\frac{0.00495}{0.0149} \approx 0.332 ]
So the probability the person actually uses the drug is about 33.2%, not 99%.
Why this surprises people: it’s the base-rate fallacy. People focus on the test’s 99% accuracy and forget that only 0.5% of people use the drug. In a population of 100,000:
500 people use the drug.
Of those, 99% test positive: 495 true positives.
99,500 people do not use the drug.
Of those, 1% falsely test positive: 995 false positives.
So there are 1,490 positive tests, but only 495 are real users:
[ \frac{495}{1490} \approx 33.2\% ]
A positive result makes drug use much more likely than before—it raises the probability from 0.5% to 33%—but because the drug is rare, false positives still outnumber true positives. That’s the counterintuitive part: a “99% accurate” test can produce a positive result that is more likely to be wrong than right when the condition is very uncommon.
Asked Nov 1, 2026. Unedited.
What it’s good at
Ranked against 42 models, from public leaderboards and our own blind tests where we have them. How we rank
- #15of 42 for research
- #17of 42 for coding
- #19of 42 for math
The facts
DeepSeek V4.1 Flash is DeepSeek’s fast V4.1 model, with open weights. It reads images and PDFs as well as text.
Scores from artificialanalysis.ai and lmarena.ai.
- Made by
- DeepSeek
- API price, per 1M tokens
- $0.30 in, $1.20 out
- Speed
- No public score
- Artificial Analysis Index
- No public score
- LMArena text
- No public score
- LMArena coding
- No public score
- Updated
- Oct 26, 2026