Ben Achterberg
@bena
Member · Member since Oct 2026
C#/.NET.
0 followers · 0 following
- Topics created
- 0
- Posts created
- 1
- Likes given
- 30
- Likes received
- 0
- Days visited
- 0
- Solutions
- 0
Days visited count across the whole community, not just this forum.
Most active topics
Nothing yet.
Most liked posts
Nothing yet.
Top categories
Top tags
Nothing yet.
- Spark: how to avoid a shuffle when joining a small table?
Broadcast the small side: from pyspark.sql.functions import broadcast facts.join(broadcast(lookup), "country_code") Spark also does this automatically below spa
Likes given · 10/12/2026
- Floating point: why is 0.1 + 0.2 != 0.3?
No — 0.1 and 0.2 have no exact binary representation, so the sum is 0.30000000000000004. Compare with a tolerance: Math.abs(a - b) < Number.EPSILON and use inte
Likes given · 10/12/2026
- Floating point: why is 0.1 + 0.2 != 0.3?
0.1 + 0.2 === 0.3 is false in JavaScript. Is the language broken?
Likes given · 10/12/2026
- Async Python: run blocking code without freezing the event loop
Push it to a thread: result = await asyncio.to_thread(blocking_fn, arg) For CPU-heavy work use a process pool with loop.run_in_executor(ProcessPoolExecutor(), f
Likes given · 10/12/2026
- Java: concurrent modification exception when removing from a list in a for-each loop
Use removeIf: names.removeIf(String::isBlank); or an explicit Iterator and it.remove().
Likes given · 10/12/2026
- Kubernetes pod stuck in CrashLoopBackOff, no logs
Look at the previous container and the events: kubectl logs mypod --previous kubectl describe pod mypod # check Last State, Exit Code, Events Exit code 137 is
Likes given · 10/12/2026
- Python: what is the difference between __str__ and __repr__?
__repr__ is for developers: unambiguous, ideally valid Python that recreates the object. Used by the REPL, repr(), and containers. __str__ is for users: readabl
Likes given · 10/12/2026
- SQL: get the latest row per group
An index on (customer_id, created_at DESC) makes both of these fast.
Likes given · 10/12/2026
- SQL: get the latest row per group
In Postgres the shortest form is DISTINCT ON: SELECT DISTINCT ON (customer_id) * FROM orders ORDER BY customer_id, created_at DESC; Portable SQL uses a window f
Likes given · 10/12/2026
- SQL: get the latest row per group
For each customer_id I need the most recent order from orders(id, customer_id, created_at, total).
Likes given · 10/12/2026
- React: useEffect runs twice in development
In development with Strict Mode, React mounts, unmounts and re-mounts every component once to surface effects that are missing a cleanup. It does not happen in
Likes given · 10/12/2026
- React: useEffect runs twice in development
My useEffect with an empty dependency array fires twice on mount, so my analytics event is sent twice. Is my component mounting twice?
Likes given · 10/12/2026
- TypeScript: type an object whose keys come from a union
I have type Theme = 'light' | 'dark' and want an object that must contain a colour for every theme. How do I type it?
Likes given · 10/12/2026
- Go: all goroutines are asleep — deadlock! with an unbuffered channel
A send on an unbuffered channel blocks until another goroutine receives. main is the only goroutine, so it blocks on the send forever. Either receive in another
Likes given · 10/12/2026
- Go: all goroutines are asleep — deadlock! with an unbuffered channel
func main() { ch := make(chan int) ch <- 1 fmt.Println(<-ch) } Why does this deadlock?
Likes given · 10/12/2026
- Docker container exits immediately with code 0
The trailing & backgrounds the process. The container's main process (the shell) then has nothing left to do, exits with 0, and Docker stops the container. Use
Likes given · 10/12/2026
- JavaScript: why does [1, 2, 10].sort() put 10 before 2?
[1, 2, 10].sort() // [1, 10, 2] Is this a bug?
Likes given · 10/12/2026
- Rust: "borrowed value does not live long enough" when returning a &str from a function
fn first_word(s: String) -> &str { s.split(' ').next().unwrap() } The compiler says the borrowed value does not live long enough. I just want the first word
Likes given · 10/12/2026
- PostgreSQL: query is slow even though the column is indexed
Wrapping the column in a function (date(created_at)) means the index on created_at cannot be used — the planner would have to compute date() for every row. Rewr
Likes given · 10/12/2026