programmer_humor

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

space, in Welcome to the wonderful world of code obfuscation

You want to expand your business to Europe. Bam, your code is broken, in Europe the week starts on Monday.

Than you want to expand to the middle east. Bam, broken again… Because in arab countries and Israel, the weekend is on Friday and Saturday.

Then you want to expand to Mexico and India. Bam, broken again, their weekend is only on Sunday.

dan, in GoOn
@dan@upvote.au avatar

This reminds me of something I saw online maybe 20 years ago now. Someone created a torrent with a name like “every IP address ever (hacking tool)” and uploaded it to Suprnova, which ended up having thousands of people seeding it. It was just a text file with every IPv4 from 0.0.0.0 to 255.255.255.255 😂

coloredgrayscale,

Heard about that too! Is there an updated version for ipv6?

xmunk, in Welcome to the wonderful world of code obfuscation

As a Real Programmer™ I have developed such a deep fear of anything time and date related that I would fully endorse dispatching an API call to the tz_database instead of attempting any fucking part of this.

Kids, it’s fine to meme about silly stuff… but date and time is deadly serious, regardless of how careful you think you’re being you are wrong.

Do you know how many timezones there are in Indiana? No? Look it up and scream in horror.

AndyLikesCandy,

Here’s a fun thought experiment: What gregorian year and date will the spacian date value of zero correlate to? Trick question.

The atomic clock on the moon and every other celestial body colonized will simply start at zero, and thanks to relativity it will not actually be the same rate of time passing as on earth.

Enjoy your nightmares.

sunbeam60,

What if I told you that weekend days are locale dependent?!

Time and date is the black hole where optimistic programmers go to die. Nothing is simply with localisation and if you think it is, you mustn’t have worked enough with it.

Source: Run a system that schedules millions of interactions across the world and deeply depend on this. The amount of code to manage and/or call out to external services to give us information about time zones, summer time, locale specific settings, day names, calendar systems, week numbers etc etc.

kogasa,
@kogasa@programming.dev avatar

IMO every datetime should be in utc, and variables for datetimes should either be suffixed “Utc” or have a type indicating their time zone (DateTimeOffset or UtcDateTime etc). Conversion to local time happens at the last possible second (e.g. in the view model or an outbound http request parameter). Of course that doesn’t solve the problem of interoperating with other morons programmers who don’t follow these rules, but it keeps things a lot neater locally.

Scheduling based on regional time conventions (holidays, weekends, etc) is just not great though.

DAMunzy,

2 timezones but the complication is that it is dependent on which country you’re in?

xav, in GoOn

I’ll start.

0.0.0.1: Sophie

Your turn.

starman2112,
@starman2112@sh.itjust.works avatar

0.0.0.2 is Bob

irdc, in Welcome to the wonderful world of code obfuscation

<span style="color:#323232;">weekend = day_of_week in (“sat”, “sun”)
</span>

As a bonus this completely sidesteps the issue of what day is 0 or 1.

eluvatar, in Welcome to the wonderful world of code obfuscation

Honestly the first one is the only one that works when people define the first day of the week differently. On the other hand, it does make you wonder. If Sunday is the first day of the week (as it is in many places) then how is it also part of the weekend?

dauerstaender, in Welcome to the wonderful world of code obfuscation

Why would you call it weekend and the start the week with half of it?!

DroneRights,

A rope has two ends, and so does a week

blakeus12, in GoOn
@blakeus12@hexbear.net avatar

s.w.x.y/z

plug it into a 5-dimensional graph and there you go.

doctorcrimson, in GoOn

ipv4 [0,255].[0,255].[0,255].[0,255]

ipv6 [0000,ffff]:[0000,ffff]:[0000,ffff]:[0000,ffff]:[0000,ffff]:[0000,ffff]:[0000,ffff]:[0000,ffff]

spudwart, in GoOn
@spudwart@spudwart.com avatar

I mean if I name them do I have to own the domain or…

jeffhykin, in Oh yea, that's the good stuff **huffs glue**

If you think that’s good, then you’re gonna love this “simplified” real code posted as a real issue on one of my Github repos.

Edit: updated link to address the stack-trace comment

Socsa, in Yes

This is false, you also need vim and tmux

SpasmodicColon, in GoOn
@SpasmodicColon@hexbear.net avatar

127.0.0.1, I’m an introvert

baseless_discourse, in Oh yea, that's the good stuff **huffs glue**

Is this how you do Fin in peasant languages?

urquell, in Show me a better text format for serializing

So much json here. All wrong, it’s csv

  • All
  • Subscribed
  • Moderated
  • Favorites
  • programmer_humor@programming.dev
  • localhost
  • All magazines
  • Loading…
    Loading the web debug toolbar…
    Attempt #