• 5 Posts
  • 61 Comments
Joined 1 year ago
cake
Cake day: June 12th, 2023

help-circle



  • Writing good comments is an art form, and beginner programmers often struggle with it. They know comments mostly from their text books, where the comments explain what is happening to someone who doesn’t yet know programming, and nobody has told them yet that that is not at all a useful commenting style outside of education. So that’s how they use them. It usually ends up making the code harder to read, not easier.

    Later on, programmers will need to learn a few rules about comments, like:

    • Assume that whoever reads your code knows the programming language, the platform and the problem domain at least in general terms. You are not writing a teaching aid, you are writing presumably useful software.
    • Don’t comment the obvious. (Aside from documentation comments for function/method/class signatures)
    • Don’t comment what a line is doing. Instead, write your code, especially names for variables, constants, classes, functions, methods and so on, so that they produce talking code that needs no comments. Reserve the “what” style comments for where that just isn’t possible.
    • Do comment the why. Tell the reader about your intentions and about big-picture issues. If an if-statement is hard to parse, write a corresponding if clause in plain English on top of it.
    • In some cases, comment the “why not”, to keep maintenance programmers from falling in the same trap you already found.



  • Floating Point Unit. The thing that does mathematical operations on floating point numbers. It used come separately from the CPU as an add-on chip, but around the 486 era, manufacturers started integrating it on the same die as the CPU. Of course, as these things go, from the system programmers point of view, there is still no difference between an add-on FPU and an integrated one.

    The one pictured here is an add-on FPU for an Intel 80386 CPU.









  • waigl@lemmy.worldtoMemes@lemmy.mlInvest in hwat?
    link
    fedilink
    English
    arrow-up
    21
    ·
    4 months ago

    Top Left – More or less the default position, sensible enough, if a bit naive. Nothing wrong with this.

    Top Right – Having knowledge is a good thing, and so is making decisions based on sound risk-benefit analysis.

    Bottom Right – Well, at least it’s an informed decision. Just don’t try to pass off the risk on someone else if it backfires.

    Bottom Left – Oooouuuuh, you don’t want to be in this quadrant, trust me…


  • In all seriousness, digging tunnels is a military tactic that gets some use sometimes. The Russians have done it in the southern part of Avdiivka. I haven’t heard of a case where militaries used an actual tunnel boring machine, though.

    Tunnel boring machines are not just extremely expensive, they’re also extremely bulky and highly visible when on top of the ground. If you ship one to where you want to start your tunnel, there is a high risk that enemy intel will spot it, ruining the surprise.

    The actual digging is extremely slow, meaning there is no way of knowing whether the tunnel will even still have some tactical use when you’re done.

    Once you emerge on the other side, it won’t be long until the enemy notices your exit and does something about it, like bombarding it, stationing troops there or sending something of their own back through the tunnel. That means even if you succeed, you only have a very short window to do something with your tactical advantage, and said something will very likely be a suicide mission.

    Tunneling through the loose mud of Ukraine would not be easy. You can do it if you send a work crew after the machine to immediately build strong walls behind it, but that would be even slower and more expensive.

    All in all, it would just be more useful to use either much smaller and shorter tunnels that don’t use tunnel boring machines or utilize some form of artillery or drones to achieve the desired effect behind enemy lines.





  • Several years ago now. On at least two of those tries, after maybe a month or some of daily driving, suddenly the fs goes totally unresponsive and because it’s the entire system, could only reboot. FS is corrupted and won’t recover. There is no fsck. There is no recovery. Total data loss.

    Could you narrow it down to just how long ago? BTRFS took a very long time to stabilise, so that could possibly make a difference here. Also, do you remember if you were using any special features, especially RAID, and if RAID, which level?