• 0 Posts
  • 44 Comments
Joined 1 year ago
cake
Cake day: July 1st, 2023

help-circle






  • I once developed an electronic program guide for a cable TV company in New Zealand and I’d lose my mind if I had to use timezones. The basic rule of thumb was:

    a) Internally you use UTC religiously. UTC is the same everywhere on Earth, time always goes forward, most languages have classes that represent instants, durations etc. In addition you make damned sure your server time is correct and UTC.

    b) You only deal with timezones when presenting something to a user or taking input from a user

    Prior to that I had worked for a US trading company that set all their servers to EST and was receiving trades through the system which expressed time & date ambiguously. Just had to assume everywhere that EST was the default but it was just dumb programming and I bet to this day every piece of code they develop has time bugs.



  • arc@lemm.eetoProgrammer Humor@programming.devIs this a Nut?
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    7 months ago

    The only reason people use JS is because it’s the defacto language of browsers. As a language it’s dogshit filled with all kinds of unpleasant traps.

    Here is a fun one I discovered the other day:

    new Date('2022-10-9').toUTCString() === 'Sat, 08 Oct 2022 23:00:00 GMT'
    new Date('2022-10-09').toUTCString() === 'Sun, 09 Oct 2022 00:00:00 GMT'
    

    So padding a day of the month with a 0 or not changes the result by 1 hour. Every browser does the same so I assume this is a legacy thing. It’s supposed to be padded but any sane language would throw an exception if it was malformed. Not JavaScript.



  • The problem is, that most languages have no native support other than 32 or 64 bit floats and some representations on the wire don’t either. And most underlying processors don’t have arbitrary precision support either.

    So either you choose speed and sacrifice precision, or you choose precision and sacrifice speed. The architecture might not support arbitrary precision but most languages have a bignum/bigdecimal library that will do it more slowly. It might be necessary to marshal or store those values in databases or over the wire in whatever hacky way necessary (e.g. encapsulating values in a string).







  • Breivik is the sort of murderer, where there is absolutely zero doubt about his guilt, where the crimes themselves are heinous, and where he should never see the outside of a jail cell ever. If Norway had voted to throw him down a mineshaft, or imprison him in a windowless cell where he was fed slops for the rest of his life I couldn’t care less.

    But Norway isn’t like that and he is being treated exceptionally well by any standard for his category of offence. His pathetic narcissistic legal whining to the courts will go nowhere and he’ll stew in prison for as long as they can legally hold him. I think authorities would be relieved if he made good on his threats since it spares them the concern of what happens if he is eventually released.


  • Well obviously it was a failure and always was going to be a failure. Whereas before there was frictionless trade, travel, employment, living, there is now an ever expanding wall of bullshit and red tape. Getting goods to and from Europe is subject to import duties and delays that just kills trade - why would a Spanish company buy widgets from the UK when a supplier in Germany can supply them faster and reliably without any customs redtape?

    It will take the UK years to form other trade deals, none of which will be remotely as favourable as they would get with negotiating power of the entire EU behind them. There have already been noises in the UK press about having to take food from the US which would fail EU standards - bleached chicken, GM crops, growth hormones etc. And that’s because when the US comes to the negotiating table they’re going to bend the UK over and screw them. And China, India and the rest of the world will be lining up for some sloppy seconds.



  • Hamas are absolutely headbanging murderous zealots committing a lot of atrocities right now. But if you herd people up, deprive them of basic liberties, brutalize & kill a bunch of them, and steal their land at gunpoint and then you can hardly act all shocked that a bunch of them are radicalized and go on a rampage. Doesn’t matter if we’re talking what Israel has done to Palestinians or what the United States did to Native Americans. Maybe the lesson to learn here, is don’t do those things. But I expect that Israel will pound Gaza committing its own atrocities as payback and the same thing will happen again in another decade.