• 10 Posts
  • 143 Comments
Joined 4 years ago
cake
Cake day: May 31st, 2020

help-circle
  • I always hated the implementation for .toString() of Duration. It gives you a string like that: PT8H6M12.345S (not a hash)

    Apparently, it’s an ISO 8601 thing, but what the hell am I supposed to do with that?
    It’s not useful for outputting to end users (which is fair enough), but I don’t even want to write that into a log message.
    I got so used to this just being garbage that I would automatically call .toMillis() and write “ms” after it.

    Well, and not to gush about Rust too much, but I recently learned that its debug string representation is actually really good. As in, it’s better than my Java workaround, because it’ll even do things like printing 1000ms as 1s.
    And that’s just like, oh right, libraries can actually provide a better implementation than what I’ll slap down offhandedly.



  • Yeah, I came to Rust from Scala and Kotlin, where equality is default-implemented (for case class and data class respectively, which is basically all we ever used), so this meme surprised me a bit.

    I do actually like that you can decide a type cannot be compared, because sometimes it really just doesn’t make sense. How would you compare two HTTP clients, for example? But yeah, it certainly is a choice one can disagree with.


  • I find these videos give a very visual explanation and help to put you into the right mindset: http://intorust.com/
    (You can skip the first two videos.)

    Sort of when it clicked for me, was when I realized that your code needs to be a tree of function calls.
    I mean, that’s what all code is anyways, with a main-function at the top calling other functions which call other functions. But OOP adds a layer to that, i.e. objects, and encourages to do all function calls between objects. You don’t want to do that in Rust. You kind of have to write simpler code for it to fall into place.

    To make it a bit more concrete:
    You will have functions which hold ownership over some data, typically because they instantiated a struct. These sit at the root of a sub-tree, where you pass access to this data down into further functions by borrowing it to them.

    You don’t typically want to pass ownership all over the place, nor do you typically want to borrow (or pass references) to functions which are not part of this sub-tree.
    Of course, there’s situations where this isn’t easily possible, e.g. when having two independent threads talking to each other, and then you do need Rc or Arc, but yeah, the vast majority of programming problems can be solved with trees of function calls.






  • Ephera@lemmy.mltoProgrammer Humor@lemmy.mlDesigners cry quietly
    link
    fedilink
    arrow-up
    45
    arrow-down
    3
    ·
    6 days ago

    I, unfortunately, have to use GitHub at $DAYJOB and this is me. I navigate most of the webpage via the URL bar now.

    Basically, let’s say I’m working on a repo github.com/tomato/sauce/ and want to navigate to the Releases page.

    Via the webpage:

    1. Type github.com into the URL bar.
    2. Don’t find tomato/sauce/ in the list of recent repos, even though it’s the only repo I work on.
    3. Click on some other repo that’s at least in the tomato/ org.
    4. Navigate up to the tomato/ org.
    5. Find the sauce/ repo in the list.
    6. Traverse half the fucking screen to hit the “Releases” heading in the middle of the About-section.

    Via the Firefox URL bar:

    1. Type gi→t→s→r.
    2. Hit Enter.

    I admit, it’s hard to compete with the latter, but I wouldn’t know how to navigate that way, if the former wasn’t so terrible.






  • I find that difficult. Aside from code reviews, often times your job as a maintainer is:

    • getting a refactor or code cleanup in while everyone’s asleep
    • shuffling commits around between branches
    • fixing the CI toolchain
    • rolling back or repairing a broken change
    • unfucking the repo
    • fixing a security vulnerability

    A required review slows all of these tasks to a crawl. I do agree that the kernel is important enough that it might be worth the trade-off.
    But at the same, I do not feel like I could do my (non-kernel) maintainer job without direct commit access…



  • That is a very good question. It all started as a dainty test setup, and I guess, we had lost the routine of always scripting hardware setups, because our previous project hadn’t required it.

    Obviously, the second-best time to start doing it is now, but I’d need to properly learn one of these first to be able to lead the way on that.
    Which collides with me not really wanting to use any of the ones I’ve experienced so far (Ansible, Puppet) in my freetime. 🫠



  • Recently had to edit the hosts-file on a remote host, and I don’t know if using two proxy jumps to SSH into it broke it, but it just wouldn’t let me select text with the mouse.
    I had to duplicate seven lines and edit the IP addresses, and without being able to copy-paste, I already saw myself manually typing it out.

    Then I remembered that in Vim, you can do d5↓ to delete 5 lines. Surely that would also work with copying/yanking. And yep, a y7↓ and a paste later and I had duplicated the lines.

    Then use the multi-line cursor like I routinely do for changing all 7 IP addresses…
    …and now I feel like I’ve crossed the line where people will think I’m just a wizard.



  • Recently saw a streamer talk about this, and not a tech streamer or anything. She didn’t get quite all the details right, but I think that’s the massive fuckup of Google here: If you don’t get the details right, your interpretation is simply that Google is killing ad blocking.

    She’s actually using Opera and understands that it’s Chromium-based, so her takeaway was that Firefox might be the only option left.
    In that vein, she also talked about how Google Search is now just ads and bad results, and when someone mentioned DuckDuckGo, she responded that she’s been genuinely been thinking about switching.

    Like, damn, I know Google is big and this alone won’t kill them. But her talking about it still felt like the initial drop before the rollercoaster goes downhill. I don’t think, I’ve heard a non-techie talk so negatively about Google, possibly ever…