• 0 Posts
  • 7 Comments
Joined 2 years ago
cake
Cake day: August 15th, 2024

help-circle

  • I got a 1U rack server for free from a local business that was upgrading their entire fleet. Would’ve been e-waste otherwise, so they were happy to dump it off on me. I was excited to experiment with it.

    Until I got it home and found out it was as loud as a vacuum cleaner with all those fans. Oh, god no…

    I was living with my parents at the time, and they had a basement I could stick it in where its noise pollution was minimal. I mounted it up to a LackRack.

    Since moving out to a 1 bedroom apartment, I haven’t booted it. It’s just a 70 pound coffee table now. :/



  • pixelscript@lemm.eetoMemes@lemmy.mlSwitch for Christmas
    link
    fedilink
    English
    arrow-up
    14
    ·
    2 years ago

    It’s basically a power strip:

    but specifically for cables that carry Internet traffic instead of electrical power.

    A more direct analogy would be a telephone switchboard (which is why it is called a “switch”), basically a computerized version of those old-timey operator ladies who used to sit in a room waiting for you to make a phone call, and they’d physically move a plug connected to your phone and plug it directly into the phone line of whoever you were trying to call. That, but for computers trying to talk to one another over network cables instead of making telephone calls.


  • pixelscript@lemm.eetoProgrammer Humor@lemmy.mlComenting code
    link
    fedilink
    English
    arrow-up
    21
    ·
    2 years ago

    I recognize three kinds of comments that have different purposes.

    The first kind are doc block comments. These are the ones that appear above functions, classes, class properties, methods. They usually have a distinct syntax with tags, like:

    /*
     * A one-line description of this function's job.
     *
     * Extra details that get more specific about how to use this function correctly, if needed.
     *
     * @param {Type} param1
     * @param {Type} param2
     * returns {Type}
     */
    function aFunctionThatDoesAThing(param1, param2) {
        // ...
    }
    

    The primary thing this is used for is automatic documentation generators. You run a program that scans your codebase, looks for these special comments, and automatically builds a set of documentation that you could, say, publish directly to a website. IDEs can also use them for tooltip popups. Generally, you want to write these like the reader won’t have the actual code to read. Because they might not!

    The second kind is standalone comments. They take up one or more lines all to themselves. I look at these like warning signs. When there’s something about the upcoming chunk of code that doesn’t tell the whole story obviously by itself. Perhaps something like:

    /* The following code is written in a weird way on purpose.
    I tried doing <obvious way>, but it causes a weird bug.
    Please do not refactor it, it will break. */
    

    Sometimes it’s tempting to use a standalone comment to explain what dense, hard-to-read code is doing. But ideally, you’d want to shunt it off to a function named what it does instead, with a descriptive doc comment if you can’t cram it all into a short name. Alternatively, rewrite the code to be less confusing. If you literally need the chunk of code to be in its confusing form, because a less confusing way doesn’t exist or doesn’t work, then this kind of comment explaining why is warranted.

    The last kind are inline comments. More or less the same use case as above, the only difference being they appear on the same line as code, usually at the very end of the line:

    dozen = 12 + 1; // one extra for the baker!
    

    In my opinion, these comments have the least reason to exist. Needing one tends to be a signal of a code smell, where the real answer is just rewriting the code to be clearer. They’re also a bit harder to spot, being shoved at the ends of lines. Especially true if you don’t enforce maximum line length rules in your codebase. But that’s mostly personal preference.

    There’s technically a fourth kind of comment: commented-out code. Where you select a chunk of code and convert it to a comment to “soft-delete” it, just in case you may want it later. I highly recommend against this. This is what version control software like Git is for. If you need it again, just roll back to it. Don’t leave it to rot in your codebase taking up space in your editor and being an eyesore.


  • Easily my vote for the most unweildy named concept in software development.

    It always reads like a typo of memorization. Not exactly an accident, of course. Memorize is memory + -ize, while memoize is memo + -ize, and memo is short for memorandum, which comes from memory. Both terms refer to some kind of storage and retreival of information. The similarities are deliberate.

    My gripe with it is that memo in my head exclusively refers to a one-paragraph email sent to my company to notify me about something. Not remembering something. Definitely not the very specific case of linking input parameters to results of pure functions.

    So we have this made-up word that looks suspiciously like an existing word that is related and means something related but is not the same thing, and the words it is actually adapted from don’t mean the thing it’s supposed to mean. Thanks, I hate it.

    Really ought to call memoization what it what it really is. Lazy-loaded lookup tables.


  • pixelscript@lemm.eetoPolitical Memes@lemmy.worldRepublicans love DEI
    link
    fedilink
    English
    arrow-up
    13
    arrow-down
    1
    ·
    2 years ago

    Abolish political parties.

    I’m very curious to know how exactly you want to word this law to acheive the effect you’re dreaming of without it being unenforceable, without it being weaponizeable as a mass voter suppression tool, and without creating a freedom of speech or freedom of assembly violation.

    A fair voting system allows people to vote for whatever reason they want. Voters want to win. Banding together to focus and force multiply campaign resources increases chances to win. Political parties are an inevitability in a fair system.

    I understand the vibe of your sentiment is to not allow political parties to grow to the overcentralizing control they have today. You’re not particularly concerned about, say, a band of guys who meet up at the pub to figure out who they’re gonna organize a collective vote for. At least I hope not, because the alternative sounds wildly dystopian. But like, what’s the line in the sand between the two? How do you define the difference, legally?