10 votes2 answers158 views
10 votes2 answers158 views
JavaScript: why does [1, 2, 10].sort() put 10 before 2? [1, 2, 10].sort() // [1, 10, 2] Is this a bug?
javascript arrays sorting user8841203 21 asked yesterday 1 vote2 answers82 views
1 vote2 answers82 views
Vim: how do I exit without saving? I opened a file in vim by accident. How do I quit and discard changes?
vim editor user8841203 21 asked yesterday 0 votes1 answer87 views
0 votes1 answer87 views
Python: what is the difference between __str__ and __repr__? When should I implement __repr__ and when __str__?
python oop repr user8841203 21 asked yesterday 10 votes1 answer155 views
10 votes1 answer155 views
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.
rust lifetimes borrow-checker Oskar Lindqvist 9 asked yesterday 2 votes1 answer270 views
2 votes1 answer270 views
Bash: loop over files with spaces in their names for f in $(ls *.txt) breaks on file names with spaces. What is the right way?
bash shell filenames user8841203 21 asked yesterday 0 votes1 answer203 views
0 votes1 answer203 views
C#: async void vs async Task When is async void acceptable?
c# async-await Jonah Weiss 3 asked yesterday 6 votes2 answers657 views
6 votes2 answers657 views
Git: undo the most recent local commits I committed the wrong files and have not pushed yet. How do I undo the last commit but keep my changes?
git git-reset version-control user8841203 21 asked yesterday 2 votes1 answer390 views
2 votes1 answer390 views
Spark: how to avoid a shuffle when joining a small table? Joining a 2 GB fact table with a 5 MB lookup table causes a full shuffle. Any way to avoid it?
apache-spark pyspark performance Amara Nwosu 9 asked yesterday 3 votes1 answer700 views
3 votes1 answer700 views
Embedded C: volatile still needed for memory-mapped registers? With modern compilers and -O2, is volatile still required for hardware registers, or are memory barriers enough?
c embedded volatile Oskar Lindqvist 9 asked yesterday 2 votes1 answer185 views
2 votes1 answer185 views
Async Python: run blocking code without freezing the event loop I call a blocking library function inside an async def handler and the whole server stalls. How do I run it without blocking?
python asyncio concurrency 6 votes1 answer959 views
6 votes1 answer959 views
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?
reactjs react-hooks use-effect Amara Nwosu 9 asked yesterday 11 votes1 answer963 views
11 votes1 answer963 views
CSS grid: make the last row items stretch to fill the width I have a grid with grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)). When the last row has fewer items they keep their column width. I want them to stretch across the remaining space. Possible with grid alone?
css css-grid layout Lin Mei 9 asked yesterday 2 votes1 answer1.7k views
2 votes1 answer1.7k views
Kubernetes pod stuck in CrashLoopBackOff, no logs kubectl logs for my pod returns nothing and the pod restarts every few seconds. How can I see why it crashes?
kubernetes debugging 4 votes1 answer684 views
4 votes1 answer684 views
Docker container exits immediately with code 0 FROM node:22-alpine WORKDIR /app COPY . . RUN npm ci CMD npm start & docker run returns right away and docker ps shows nothing. Logs are empty.
docker dockerfile containers 12 votes2 answers1.6k views
12 votes2 answers1.6k views
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).
sql postgresql groupwise-max 9 votes1 answer720 views
9 votes1 answer720 views
Java: concurrent modification exception when removing from a list in a for-each loop for (String s : names) { if (s.isBlank()) names.remove(s); } throws ConcurrentModificationException. How should I remove while iterating?
java collections iterator Dmitri Vasko 3 asked yesterday 11 votes2 answers6.0k views
11 votes2 answers6.0k views
PostgreSQL: query is slow even though the column is indexed This query takes ~4 s on a 30M-row table even though created_at has a B-tree index: SELECT * FROM events WHERE date(created_at) = '2026-10-01'; EXPLAIN shows a sequential scan. Why is the index ignored?
postgresql indexing query-optimization Tomás Ferreira 6 asked last wk. 11 votes1 answer838 views
11 votes1 answer838 views
Floating point: why is 0.1 + 0.2 != 0.3? 0.1 + 0.2 === 0.3 is false in JavaScript. Is the language broken?
floating-point javascript precision user8841203 21 asked last wk. 11 votes1 answer1.0k views
11 votes1 answer1.0k views
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?
go concurrency channels Jonah Weiss 3 asked 4d ago 5 votes2 answers3.2k views
5 votes2 answers3.2k views
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?
typescript generics mapped-types Lin Mei 9 asked last wk. 0 votes1 answer1.3k views
0 votes1 answer1.3k views
Regex to match a hex colour like #fff or #1a2b3c I need a regular expression that accepts #fff and #1a2b3c but not #12 or #ggg.
regex javascript validation Amara Nwosu 9 asked 2w ago 2 votes0 answers964 views
2 votes0 answers964 views
Is it possible to style the scrollbar in Firefox? ::-webkit-scrollbar does nothing in Firefox. Is there an alternative?
css firefox scrollbar Lin Mei 9 asked Sep 4 1 vote1 answer11.6k views
1 vote1 answer11.6k views
Closed How to center a div horizontally and vertically?What is the modern way to centre a box inside its parent both ways?
css flexbox centering user8841203 21 asked Sep '25 -3 votes0 answers11.5k views
-3 votes0 answers11.5k views
Closed What is the best programming language to learn first in 2026?Python or JavaScript?
discussion user8841203 21 asked Mar '23 13 votes2 answers59.0k views
13 votes2 answers59.0k views
How do I select rows from a pandas DataFrame based on column values? I have a DataFrame of orders and want only the rows where status is "shipped" and total is above 100. In SQL: SELECT * FROM orders WHERE status = 'shipped' AND total > 100; What is the idiomatic pandas equivalent?
python pandas dataframe Amara Nwosu 9 asked Oct '17 13 votes4 answers139k views
13 votes4 answers139k views
Why does iterating a sorted list run faster than an unsorted one in this C++ loop? I have a loop that sums every element of a large std::vector<int> that is at least 128. If I sort the vector first (outside the timed region), the loop runs about five times faster: #include <algorithm> #include <chrono> #include <iostream> #include <random> #include <vector> int main() { std::vecto
c++ performance optimization cpu-architecture