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.
Gemini 3.1 Pro Preview
Here is a template that strikes the right balance. It clearly lays out the timeline, gently reminds them of their legal obligation (providing a habitable space), and sets a firm deadline for a response—all without using aggressive language.
Subject: URGENT: Follow-up regarding heating repair at [Your Unit/Address]
Dear [Landlord's Name],
I hope you are having a good week.
I am writing to follow up on the maintenance request I submitted on [Date of original request] regarding the broken heating system in my unit.
As of today, it has been three weeks without heat. While I understand that scheduling maintenance can sometimes be delayed, living without a functioning heater for this long is highly uncomfortable and is becoming a habitability issue as the temperatures drop.
I value our good relationship and would like to get this resolved as smoothly as possible. Could you please reply to this email by [Day of the week, e.g., Wednesday] at [Time, e.g., 5:00 PM] to confirm exactly when a repair technician will be coming to the property?
If the current technician is unavailable, please let me know so we can discuss alternative solutions to get the heat restored this week.
Thank you in advance for your prompt attention to this matter. I look forward to hearing from you today.
Best regards,
[Your Name] [Your Phone Number] [Your Unit Number]
A few quick tips before you send:
Keep a paper trail: If your previous requests were over the phone or in person, you can slightly tweak the first paragraph to say: "I am writing to follow up on our [phone call / conversation] on [Date] regarding..."
Set a specific deadline: Giving a specific day and time for them to respond (e.g., Wednesday at 5 PM) is a highly effective way to be firm without being rude. It forces them to acknowledge the message.
Take photos/logs: If you bought a space heater or have a thermometer showing the temperature inside your apartment, take a photo of it just in case you need it for your records later.
Asked Nov 1, 2026. Unedited.
Write a React hook that debounces a value and cancels on unmount. Include the TypeScript types.
Gemini 3.1 Pro Preview
Here is the complete React hook written in TypeScript.
It uses a generic type <T> so it automatically infers and maintains the exact type of the value you pass into it.
import { useState, useEffect } from 'react';
/**
* A hook that debounces a value.
*
* @param value The value to debounce.
* @param delay The delay in milliseconds (defaults to 500ms).
* @returns The debounced value.
*/
export function useDebounce<T>(value: T, delay: number = 500): T {
const [debouncedValue, setDebouncedValue] = useState<T>(value);
useEffect(() => {
// Set up the timeout to update the value after the delay
const handler = setTimeout(() => {
setDebouncedValue(value);
}, delay);
// The cleanup function clears the timeout.
// React calls this on two occasions:
// 1. When the 'value' or 'delay' changes (to cancel the previous timeout).
// 2. When the component unmounts (to prevent memory leaks/state updates on unmounted components).
return () => {
clearTimeout(handler);
};
}, [value, delay]);
return debouncedValue;
}How to use it in a component
Here is a common real-world example: debouncing a search input so you don't hit your API on every single keystroke.
import React, { useState, useEffect } from 'react';
import { useDebounce } from './useDebounce'; // Adjust path as needed
export const SearchComponent: React.FC = () => {
const [searchTerm, setSearchTerm] = useState<string>('');
// This value will only update 500ms after the user stops typing
const debouncedSearchTerm = useDebounce<string>(searchTerm, 500);
useEffect(() => {
if (debouncedSearchTerm) {
// Trigger your API call or search logic here
console.log(`Fetching results for: ${debouncedSearchTerm}`);
}
}, [debouncedSearchTerm]);
return (
<div>
<input
type="text"
placeholder="Search..."
value={searchTerm}
onChange={(e) => setSearchTerm(e.target.value)}
/>
<p>Current value: {searchTerm}</p>
<p>Debounced value: {debouncedSearchTerm}</p>
</div>
);
};Why this works
The magic happens inside the return () => clearTimeout(handler); block inside the useEffect. React guarantees that this cleanup function will run right before the component is destroyed (unmounted), completely neutralizing the setTimeout and preventing the dreaded "Can't perform a React state update on an unmounted component" warning.
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?
Gemini 3.1 Pro Preview
If someone tests positive, the probability that they actually use the drug is only about 33.2%.
Here is the breakdown of exactly how this works, followed by why this answer goes against our intuition.
The Math: Let's look at 10,000 people
To understand the math without using complex probability formulas, let's imagine a town with exactly 10,000 people in it.
1. Separate the users from the non-users:
Because 0.5% of people use the drug, there are 50 users (0.005 × 10,000).
This means there are 9,950 non-users in the town.
2. Administer the test to the 50 drug users:
The test is 99% accurate. So, out of the 50 users, it correctly identifies 49.5 of them with a positive result (True Positives).
3. Administer the test to the 9,950 non-users:
Because the test is 99% accurate, it is inaccurate 1% of the time.
1% of the 9,950 non-users will incorrectly test positive. That equals 99.5 people (False Positives).
4. Calculate the final probability:
Total number of positive tests: 49.5 (true) + 99.5 (false) = 149 total positive tests.
Your chance of actually being a drug user if you test positive is the number of True Positives divided by the Total Positives.
49.5 / 149 = 0.3322... or 33.2%.
Why does this surprise people?
This mathematical puzzle is a famous example of a cognitive bias called the Base Rate Fallacy (or base rate neglect). It surprises people for two main reasons:
1. We ignore the "base rate"
When humans hear a highly specific number like "99% accurate," our brains immediately latch onto it. We focus entirely on the reliability of the test and completely forget to factor in the base rate—the fact that the drug use is extremely rare (0.5%).
2. We misunderstand what the false positives are being applied to
Our intuition tells us that a 1% error rate is tiny. However, we fail to realize that this 1% error rate is being applied to a massive pool of innocent people.
Because the vast majority of people do not use the drug, even a tiny 1% false-positive rate generates a mountain of incorrect positive results. That mountain of false positives completely overwhelms the small handful of actual drug users.
The takeaway: Whenever you are testing for something very rare—whether it is drug use, a rare disease, or a terrorist in an airport—even a highly accurate test will result in mostly false positives. (Mathematically, this is solved using Bayes' Theorem).
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
- #21of 42 for research
- #23of 42 for math
- #24of 42 for coding
The facts
Gemini 3.1 Pro Preview is a preview release of Google’s Gemini 3.1 Pro. It reads images and PDFs as well as text.
Scores from artificialanalysis.ai and lmarena.ai.
- Made by
- API price, per 1M tokens
- $2 in, $12 out
- Speed
- 132 tokens a second
- Artificial Analysis Index
- 29.7
- LMArena text
- 1,480
- LMArena coding
- 1,484
- Updated
- Oct 26, 2026