Recent posts
The newest topics and replies across all categories.
| Post | Posted |
|---|---|
Pascal in school. We made program for the school library, to track who has which book. Librarian used it three years until the computer died. I think nobody made backup. | by tomasz |
Same two pass thing applies in numpy, compute everything from the old array then assign. Learned that from a very wrong heat diffusion plot. | by lena_w |
Lost an evening to this. Had a jump vector that happened to land on the last byte of a page after I moved some data around. JMP ($30FF) reads the low byte from $30FF and the high byte from $3000, not … | by zp_indirect |
Oh. That was a bug I had and didn't know. Thank you. | by tomasz |
at least you got paid | by vek |
For pairs from two separate halves, yes. For all pairs like you have, it just makes it harder to read. If you need to update both at once then split_at_mut, or swap to computing a list of deltas in on… | by ferrous |
Java, sadly, and I've been paying for it since. | by gcfail |
It works. There is also split_at_mut in documentation, is that better? | by tomasz |
ok worked ty | by pbj |
Run it with -print before -delete the first time. -delete does what it says and there's no bin. | by lintroller |
And if you do want xargs for something other than deleting, use find -print0 | xargs -0, then spaces and newlines in names are fine. Or find ... -exec cmd {} + which does the same batching with no pip… | by awkward |
find . -name '*.log' -delete Quote the pattern, or your shell expands it before find sees it. If you've got one .log in the current dir you're searching for that one exact name. | by vek |
find . -name *.log | xargs rm says no such file for some of them. how do i fix | by pbj |
vek is right in spirit, you do end up reinventing handles and arenas. Though that's how a lot of good C ended up as well. | by carcdr |
"Rewrite it in Rust" -> rewrites it in array indices, like Fortran | by vek |
Indices, usually. for i in 0..particles.len() { for j in 0..particles.len() { if i == j { continue; } let d = particles[j].pos - particles[i].pos; particles[i].vel += d * k; } } Each indexing is a sho… | by ferrous |
Next problem then. My real code is a list of particles, and each one should look at its neighbours and change itself. for p in particles.iter_mut() { for q in particles.iter() { ... } } Same error of … | by tomasz |
Yes. Non-lexical lifetimes. The borrow lasts until the last use. | by ferrous |
OK this makes sense. But if I swap the last two lines it compiles. So the borrow ends at the last use and not at end of the block? | by tomasz |
Can confirm the C++ part, I have the scars. | by jf |
push might reallocate. If the Vec is at capacity it allocates a bigger buffer, moves everything and frees the old one. Then first points at freed memory. The borrow checker doesn't know whether this p… | by ferrous |
I learn Rust since two weeks. This does not compile: let mut v = vec![1, 2, 3]; let first = &v[0]; v.push(4); println!("{}", first); error[E0502]: cannot borrow `v` as mutable because it is also borro… | by tomasz |
6502 assembly via a C64 monitor, because BASIC was too slow for the sprite routine I wanted. It wasn't useful as such, but it was useful to me | by zp_indirect |
I'm still working on this one to be honest! Started Python last year to help with marking. The first thing that actually saved me time was a script that renames the scanned worksheets using the class … | by bea |
That fixed it, thanks both! José is back. | by bea |