There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

programmer_humor

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

henfredemars , in Debugging

You’re sure that there was a crime? You’re fortunate that your bug is consistently reproducible.

Gormadt OP ,
@Gormadt@lemmy.blahaj.zone avatar

My “favorite” is when following the steps to reproduce a specific bug you get an entirely different bug then what was reported

Amends1782 ,

Actually think about that shit when I’m trying to sleep

sbv ,

Alleged crime.

kopczak1995 ,

Git blame would like to have a word with you.

NocturnalMorning , in Debugging

I know there’s a crime because my code runs, but it doesn’t do what I asked it to do.

Zacryon ,

The fact that it runs means that it has something delinquent to it. Otherwise it wouldn’t run. Better run after it and catch it. /j

(That was a bad pun and I am not sorry. It’s 3 am here and I can’t sleep. This helped me to burn a minute. Thank you.)

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.

Hadriscus ,

I was wondering why the second example returned monday and tuesday. I had no idea the week could start any day other than monday

kogasa ,
@kogasa@programming.dev avatar

The obvious solution is to inject an IWeekendDaysOfWeekProvider service in the inversion of control container. In your, uh, javascript web app.

coloredgrayscale ,

Just npm install isWeekend for the required locales.

Depends on: isMonday, isTuesday,…

Elderos ,

This but non-ironically.

RonSijm ,
@RonSijm@programming.dev avatar

Not using CultureInfo.InvariantCulture for basically everything

AndyLikesCandy ,

This dude(ette) globalizes.

looseanus , in Merge then review
dan , in GoOn
@dan@upvote.au avatar

This reminds me of something I saw online maybe 15-20 years ago now. Someone created a torrent with a name like “every IP address ever (hacking tool)” 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?

spuncertv , (edited )

That file would be ungodly large. There are 2^128 possible addresses, each weighing in at 128 bits, 16 bytes. 16 bytes times 340 trillion trillion trillion. That puts us around 5.44 trillion Zettabytes. The estimates I’ve seen for worldwide data storage sit aroun 60-70 zettabytes.

dan , (edited )
@dan@upvote.au avatar

IPv6 version is just a Python script that generates random 128-bit integers. Eventually you’ll hit a valid IPv6 address!

vrkr , in Merge then review
@vrkr@programming.dev avatar

Something like that happened to me yesterday. I reviewed one PR, then some Important Guy came in and said:

  • it is nice you reviewed my work, but we need to push this to production right now.
  • just fix these things, I described you how. Just copy/paste these snippets
  • these are cosmetics, I don’t care
  • "cosmetics", huh? Your shit may just crash
  • gfy and push this to production right now
  • well, ok

Of course, lack of these “cosmetics” caused crash in production. It’s my fault of course.

OneCardboardBox , in Welcome to the wonderful world of code obfuscation

Interesting that your days are 1-indexed. What happens on nullday?

xmunk ,

Zat is vhen ve party!

coloredgrayscale ,

Undefined

koper ,

Reserved for future use

ikidd , in Merge then review
@ikidd@lemmy.world avatar

The “send it” school of PRs.

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.

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.

usrtrv ,

Throwing UTC everywhere doesn’t solve comparisons around leap seconds. I’m sure they’re other issues with this method, but this is kinda the point of “just use a library”. Then it’s someone else’s problem.

kogasa ,
@kogasa@programming.dev avatar

I’m a .NET dev, I don’t have a concept of “just use a library.” Everything is a library. I don’t mean “using int for datetimes is ok as long as you label it utc,” I just mean “don’t deal with time zones.”

v9CYKjLeia10dZpz88iU ,

Unix is the easiest format I’ve used. It’s easy to parse, it’s consistent, there’s not usually competing unix like formats, it converts perfectly to other time formats, most file explorers can immediately sort it correctly, and it’s clearly the date from which the universe spawned into existence.

xmunk ,

It’s alright, but real programmers use Julian UTC.

v9CYKjLeia10dZpz88iU ,

I also really like the Bitcoin block number. It will likely be one of the most provable records of time passing, but not as convienent for tracking or converting time.

coloredgrayscale ,

Luckily we won’t colonize the moon or another planet anytime soon…

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.

DAMunzy ,

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

xmunk ,

There are two distinct time offsets used in Indiana but there are 11 different timezones en.m.wikipedia.org/wiki/Time_in_Indiana

Zanothis ,

Relevant talk by Jon Skeet

invidious.io.lol/watch?v=64X8rCy1jSA

Cosmicomical , in Welcome to the wonderful world of code obfuscation

You forgot weekend = dayOfWeek.name[0] == 'S';

xmunk ,

Can confirm this works completely as expected when the user’s system is set to lang=ES.

Schmeckinger , (edited )

Simple save the users language setting in a variable, change it to english, check if the first letter is “s” and then change the language back.

xmunk ,

Genius.

Cosmicomical ,

true but that's a precondition to some of the other examples as well

mac , in Welcome to the wonderful world of code obfuscation
@mac@programming.dev avatar

Image Transcription: Meme


[Paneled meme with a brain that gets increasingly glowing]


[The brain is smaller than the skull]


<span style="color:#323232;">if dayOfWeek.name == "Sunday" || dayOfWeek.name == "Saturday"
</span><span style="color:#323232;">    weekend = true
</span>

[The brain is glowing in some areas]


<span style="color:#323232;">if dayOfWeek &lt; 2 || dayOfWeek > 6
</span><span style="color:#323232;">    weekend = true
</span>

[The brain is shooting out rays of light]


<span style="color:#323232;">weekend = !((dayOfWeek - 1) % 6)
</span>

I am a human volunteer who transcribes posts to improve accessibility on programming.dev and you could be one too! !transcribing

DaveedMee , in GoOn
@DaveedMee@beehaw.org avatar

127.0.0.1

PepeLivesMatter , in Merge then review
@PepeLivesMatter@lemmy.today avatar

Developers: “Move fast and break things.”

Things: break

Developers: surprised Pikachu face

Waraugh ,

Except instead it’s: Developers: fuck ops, they stuck at their job

RenegadeTwister , in Merge then review

deleted_by_author

  • Loading...
  • MashedTech ,

    Modern agile is just waterfall with steps.

    DrMango ,

    Wait… waterfall is waterfall with steps 🤔

    MashedTech ,

    Agile just adds routines and extra steps

    MagicShel , in Welcome to the wonderful world of code obfuscation

    I’d make it a named function for clarity and testability and proceed to give zero shits how it is implemented. I would unironically write this code if it worked, but I wouldn’t inline it to reduce the cognitive load of reading it.

    Cosmicomical ,

    This, and maybe a couple of unit tests

    TheSlad ,

    7 unit tests should be enough I think

    Cosmicomical ,

    Lol i can't lie, it took me a while to get the joke. I feel so dumb

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines