• 74 Posts
  • 417 Comments
Joined 1 year ago
cake
Cake day: April 4th, 2025

help-circle




  • They’ll keep doing that, over and over. And it usually ends up with them insisting on a meeting to “discuss” where they essentially get in a loop of “it’ll work, just do it”

    And it’s like pulling fucking teeth to get them to admit the only thing they’re basing that on, is a chatbot told them it would work.

    Strange. I am experiencing the same. In one case, I had to make, after six months of discussing an interface, an end-to-end test to show it didn’t work and their, ahem, unit tests failed to show that. That was for a stepper motor interface and driver with three essential methods.

    This guy is senior software architect at my workplace.

    Boss insisting that I get to an agreement with him on ai usage.




  • Two ways:

    1. Say you want to rename the files Sevilla_big{number}.jpg to Sevilla_small{number}.jpg:

    in bash, using the extglob option:

     shopt -s extglob
    for f in pics/**/Sevilla_big*.jpg
    do 
         mv "${f}" "${f/big/small/}"
    done
    

    (If you want to type it in a single line, you need to add semicolons as separators.)

    The ‘"’ are only needed if file names contain whitespaces.

    1. Using find:

      find . -name ‘Sevilla.*big.jpg’ > t

      now, you edit the file named “t” with Emacs or vim so that you duplicate the file names, modify them as you want, and copy them using the copy-rectangle command right to the collumn with the original names. (Vim also offers this functionality, it is super useful to learn!) Delete any names of files you don’t want to change. save the result to t.

    Then, in bash:

     <t while read a b; do mv $a $b; done
    

    Alternatively, you could also insert the mv command as a first collumn in t, save t and do:

    source t
    

    This variant wouldn’t work with spaces in filenames.

    1. Bonus option:

    Use the mmv command










  • I don’t know how those bugs get there in the first place.

    Easy to explain.

    Visualizing program code as cables, this is how a shiny new program would look:

    And this how, for example in a commercial environment, or if the programmers are not absolute masters, such a program will look after 15 years of bug fixing, feature requests, urgent changes, deadlines, and unfinished restructurings:

    The thing is that especially C code contains tons of implicit invariants which you simply cannot maintain in such code.

    And don’t forgot that the picture above shows perhaps 500 cables, but a codebase can easily contain 50000 lines of code…


  • So it was a linker issue?

    No, that would have resulted in a linker error, not random undefined behaviour

    But industry is still working with a fifty year old language written for systems where 32 kilobytes were a lot of memory.

    Especially for embedded and DSP stuff there are so many architectures that aren’t even supported by the Rust compiler. And on those systems 32 kiB of RAM is sometimes a lot of memory.

    These niches still exist but they get rapidly smaller every year. Because:

    • Cheap hardware gets more powerful
    • Demands rise… even some electric toothbrushes are networked now
    • Rust support for embedded devices is rapidly expanding

    Plus:

    • In some domains, security is becoming a real issue



  • What part of Rust is fun?

    C is fun to me because the syntax is easy to understand and straight to the point.

    You probably had never the pleasure to search for bugs caused by C Undefined Behaviour in multithreaded code.

    When I was writing my diploma thesis, I was writing multi-threaded code for an embedded DSP system. Results were wrong all the time. I tracked it down to atan2() giving wrong results. I searched for about six weeks how to fix that and it disappeared when I changed the position of the program’s data segment.

    (If the concept of Undefined Behaviour is new to you, I can recommend the web pages of Jens Regehr).

    The above debugging experience was 25 years ago. We have better languages now. Rust has no Undefined Behaviour. That means you can track any bug (except compiler bugs) deterministically down to where the actual logic of the code, and the model of it which was in your head depart. This is great.

    Rust is fun because you can compile a complex program and it runs.

    But industry is still working with a fifty year old language written for systems where 32 kilobytes were a lot of memory. At work, I am still searching for bugs in multi-threaded C code with manual memory management (the previous developer didn’t think this needs locks), and I have to explain to the CTO that no, wo won’t have a release this fall, while the company literally drowns in technical debt.