Formerly /u/Zagorath on the alien site.

  • 0 Posts
  • 42 Comments
Joined 1 year ago
cake
Cake day: June 15th, 2023

help-circle
  • We could have used the tilde, which has been used in formal logic & maths for negation in very many contexts for a long time.

    It’s used instead in C and many C-like languages for the far less useful bitwise negation. Of course, we could have had it work in the same way as bitwise vs logical and & or, by dialling up the symbol. Which would have massively improved its visibility compared to the bang.

    But for some reason, no. They chose the bang instead.


  • Yeah I swear from when Nadella took over until like 2 years ago, Microsoft really seemed to be on the right route. They were becoming the “good guys” of big tech companies.

    WSL, actually being really good stewards of GitHub, Chredge actually (at first) being way better for users than Chrome, the amazing revitalisation of some of their oldest and most loved game franchises like Age of Empires and Flight Simulator.

    But then recently we’ve had Microsoft adding shitty AI to everything, from Edge to Windows. We’ve had that AoE revitalisation tarnshined by showing off a really shitty official mobile game with all the makings of a typical pay 2 win time sink. The Age of Mythology remake has obvious AI art featured in it despite them insisting no AI was used (though thankfully the actual gameplay is as good as hoped for, at least). We’ve got large layoffs and other shitty corporate bullshit towards workers.


  • This is absolutely fundamentally wrong. What you’ve described is what Nodatime calls an Instant, and it’s a very important data class, but there are valid reasons to use other classes.

    A LocalDateTime cares about the date and time locally. An event scheduled for 8am every Monday might use this. It would update accordingly if you move locations to a new locale.

    A ZonedDateTime can almost be directly translated into an Instant, except that one time zone might change. If you go into or out of daylight saving time, or your region decides to change its time offset. Oslo time is still Oslo time. You use this if your event occurs at a specific time in a specific location.

    An OffsetDateTime is like a ZonedDateTime, but instead of being tied to a specific time zone (e.g. “Oslo time”) it’s tied to a specific UTC offset (e.g. UTC+1).

    You don’t have to use Nodatime, but you should at least think deeply about what your time objects actually represent and what is the best way to represent them.

    See the creator of Nodatime’s presentation about thinking deeply about time for more.








  • I don’t think so. When I’ve seen it done it’s usually not been random values injected (except when those values are secret keys which should absolutely not be stored in code to begin with), it’s usually injecting a service. Another class, usually with a name that makes it easy to trace down. Like if you’re building an OrderService, that might take as a dependency an IProductService, which would have injected into it the class ProductService (personally, I don’t like the Hungarian notation that C# uses, but it’s a convention and my preference for sticking to strong conventions for the sake of consistency outweighs my distaste for Hungarian notation). That’s easy to find, and in fact your IDE can probably take you straight to it from the OrderService’s constructor.






  • Like @deadbeef79000@lemmy.nz, I was bothered by the contraction. So I decided to Google it in the hopes of explaining why exactly it’s wrong, in case you’re a second-language speaker.

    I honestly thought there would be a simple explanation, but it turns out that there doesn’t seem to be one. I found one Reddit thread which linked to a now-defunct blog (luckily, [it’s still available through the Wayback Machine), another that linked to an earlier Reddit thread, inside of which was yet another link to an even earlier thread. Here’s the most recent of the threads in that chain if anyone wants to read it. But below is quoted the important bit from that archived blog post:

    You CAN end a sentence with a contraction if it is a Type 2 (Verb-Negative), both in speaking and writing. You are always in safe territory when you end a sentence with a negative contraction.

    Examples:

    • No, I don’t.
    • I’m a student, but she isn’t.

    For a Type 3 (Modal + “have”), English expert Eugene Mohr says in his article in TESOL Quarterly, “The Independence of Contractions”, that “no contraction takes place if….have occupies the final position” in a sentence. HOWEVER, Mohr limits his explanations to contractions in written language, not spoken. In informal speech, native speakers often contract a modal with “have” at the end of a sentence. So, while it looks funny written out, you will hear people end a sentence this way.

    Example:

    • I didn’t go to church, but I should’ve.

    Last, and most importantly, you CANNOT end a sentence with contraction if it is a Type 1 (Pronoun-Verb). Not in formal English, not in informal English – never! In this case, you must write out the entire verb that follows the pronoun. So take a look at the contraction at the end of your sentence. Does it contain a pronoun? If it does, then break it up into its two original words.

    • INCORRECT: Yes, we’re.
    • CORRECT: Yes, we are.

    But the bottom line is yeah, the title here uses a contraction in a way that is not permitted by standard English prosody.


  • Let’s say it takes half a second to copy/paste and submit the message. That’s 50 seconds saved, round it to one minute. You’re only doing it once, so let’s cross over to yearly. According to the Munroe Automation Scale, you can spend up to 5 minutes on it.

    I’d say that code took about 1 minute to write. Maybe 2.

    Result: do the automation.