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.

candyman337 , in Password requirements are getting out of hand

“Password length requirements: 6 inches”

Guy tries to make an account

“Password requirements not met”

“Bro I swear that’s 6 inches 😢”

dingleberry ,

Can’t login when it’s cold.

mattd ,

My password was in the pool!

yum13241 , in Also not C# Block

I don’t get it.

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

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.

baseless_discourse ,

Until some idiot sends in “Sunday” as days of the week…

activ8r ,

/^(sun|sat)/i.test(day_of_week)

👍

snowe ,
@snowe@programming.dev avatar

Ah yes the ole sunweday. My favorite day of the weekend.

dbilitated ,
@dbilitated@aussie.zone avatar

yeah I like having an array of days that are weekend days then testing if the day is in the array. can change what days are considered weekend if we go to a three day weekend and it reads really well. I hate massive if statements

MonkderZweite , in Yes

Just don’t call it with ‘!#/bin/sh’. Because that’s POSIX shell, not bash.

philm , (edited )

but effectively it’s bash, I think /bin/sh is a symlink to bash on every system I know of…

Edit: I feel corrected, thanks for the information, all the systems I used, had a symlink to bash. Also it was not intended to recommend using bash functionality when having a shebang !#/bin/sh. As someone other pointed out, recommendation would be #!/usr/bin/env bash, or !#/bin/sh if you know that you’re not using bash specific functionality.

MonkderZweite , (edited )

Still don’t do this. If you use bash specific syntax with this head, that’s a bashism and causes issues with people using zsh for example. Or with Debian/*buntu, who use dash as init shell.

Just use #!/bin/bash or #!/usr/bin/env bash if you’re funny.

wolo ,

#!/bin/bash doesn’t work on NixOS since bash is in the nix store somewhere, #!/usr/bin/env bash resolves the correct location regardless of where bash is

JackbyDev ,

Are there any distos with /usr/bin/env in a different spot? I still believe that’s the best approach for getting bash.

Nobsi ,
@Nobsi@feddit.de avatar

My own. I use arch btw

MenacingPerson ,

All posix-compliant distros need /usr/bin/env

MonkderZweite ,

I do think a simple symlink is superior to a tool parsing stuff. A shame POSIX choose this approach.

Still the issue that a posix shell can be on a non-posix system and vice versa. And certificates versus used practice. Btw, isn’t there only one posix certified Linux distro? Was it Suse?

MenacingPerson ,

Posix certification is dumb but posix compliance is nice to ensure some level of compatibility.

Symlinks would be pretty bad in the case of nixos. Wouldn’t fit at all

quantenzitrone ,

/bin/bash won’t work on every system for example NixOS some other systems may have bash in /usr/bin or elsewhere

MonkderZweite ,

NixOS didn’t do /usr merge?

quantenzitrone ,

Binaries are not in /usr/bin or /bin except for /bin/sh and /usr/bin/env. Programs should not assume fixed paths for binaries and instead look for them in $PATH.

Aatube ,
@Aatube@kbin.social avatar

macOS
Debian
Ubuntu

SurpriseWaterfall ,

It is a symlink, but bash will automatically enable posix compliance mode if you use it. So any bash specific features will bomb out unless you explicitly reset it in the script.

callyral ,
@callyral@pawb.social avatar

i thought most unix-like systems had it symlinked to a shell like dash. it’s what i have on my system (void linux), of course not as an interactive shell lol

i use #!/bin/sh for posix scripts and #!/usr/bin/env bash for bash scripts. #!/bin/sh works for posix scripts since even if it’s symlinked to bash, bash still supports posix features.

JackbyDev ,

No no no no no, do not believe this you will shoot yourself in the foot.

wiki.debian.org/Shell

Beginning with DebianSqueeze, Debian uses Dash as the target of the /bin/sh symlink. Dash lacks many of the features one would expect in an interactive shell, making it faster and more memory efficient than Bash.

From DebianSqueeze to DebianBullseye, it was possible to select bash as the target of the /bin/sh symlink (by running dpkg-reconfigure dash). As of DebianBookworm, this is no longer supported.

UNWILLING_PARTICIPANT ,

Wut that is not even the case for Ubuntu. You’re probably thinking of dash example:


<span style="color:#323232;">sh -c '[[ true ]] &amp;&amp; echo ya' 
</span><span style="color:#323232;"># sh: 1: [[: not found
</span><span style="color:#323232;">
</span><span style="color:#323232;">bash -c '[[ true ]] &amp;&amp; echo ya' 
</span><span style="color:#323232;"># ya
</span>
Matombo , in Welcome to the wonderful world of code obfuscation

Ok another US local units are retarded rant: it’s called weekEND! why do you start your week at sunday and not monday! Sunday is part of the weekEND!

MrScottyTay ,

I’m English, not American but I see it as Saturday and Sunday are the two ends of the week. Like how a string has two ends. The weekend is both the start and the finishing end of the week.

ChrissieWF ,

So, when someone asks if you are free the next two weekends, you assume they’re talking about the next Saturday (tail weekend) and the next Sunday (front weekend)?

MrScottyTay ,

No, the two ends of a week create a singular weekend.

JohnEdwa ,

Just like the two ends of a string create a singular string end.

Magnetar ,

I’ve never understood string physics.

Matombo ,

since we are in a temporal context here i would argue that there is a clear distrinction between beginning and end here

MrScottyTay ,

End doesn’t always have to be the latter side of something though like I said earlier with the string analogy. The start is also an end.

Leate_Wonceslace ,
@Leate_Wonceslace@lemmy.dbzer0.com avatar

If you’re referring to an “end” of an object, it can refer to the extreme of a side of it. For example, aglets are at either end of a shoelace.

Matombo ,

I’m refering to end in a temporal sense because we are talking about a time context here. There is a clear direction so going backwards brings you to the begin.

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.

Cheesebaron , in me_irl

This always happens to me when I’ve written some genius code. Takes so long to review it, because my caveman colleagues don’t understand it.

nottheengineer ,

If you wrote good code, even a caveman would understand it.

magic_lobster_party ,

Are you sure your code isn’t just overly convoluted?

sbv ,

I’m pretty sure that’s what they just said.

Cheesebaron ,

Caveman no understand

Cheesebaron ,

It is amazing how many cavemen didn’t understand the sarcasm of my comment, and in their rage had to downvote it to hell. 😂

sbv ,

I feel like we Lemmites are not great at humour and we are quick to downvote. 🤷

Were you referencing grugbrain.dev ? I only ran into that recently, and I got a real kick out of it.

Cheesebaron ,

I read that recently as well, it is a great read. I can relate to a lot of the things. While it is meant as a humor piece, there is some solid advice in there.

I didn’t exactly have it in mind when I wrote my comment, but maybe subconsciously 😅

sbv ,

I’ve recently started dealing with architects. A lot of the comments hit close to home.

bellsDoSing ,

Great read, certainly had more relatable things in there than I’d expected.

1984 ,
@1984@lemmy.today avatar

With this attitude, the problem is you actually. Sorry.

lurch , in Password requirements are getting out of hand

Pretty unsafe, because it makes people prefer big letters, i.e. W

plistig ,

That’s why my password consists exclusively out of Assyrian cuneiform letters, e.g.

https://en.wiktionary.org/wiki/File:Assyrian_cuneiform_U12030_MesZL_293.svg

Yes, that’s one letter.

tetris11 ,
@tetris11@lemmy.ml avatar

The Assyrians knew what they were doing

sebsch , in Password requirements are getting out of hand

Thanks for pointing out on gooyey. Looking quite snazzy

github.com/khonsulabs/gooey/blob/…/buttons.rs

DieguiTux8623 , in me_irl

The worst case is when someone requires changes, you address them, but then they disappear/go on a leave.

If the repository rules require all conversations to be resolved before merging and only the original reviewer can mark them as solved, the PR is stuck forever even if the rest of the team approves it.

Blamemeta ,

At that point, you get your team lead to go in the repo settings and unblock it.

magic_lobster_party ,

Plot twist: it’s the team lead who goes on a leave

storcholus ,

That sounds like something you bring up in the retro

DieguiTux8623 ,

When the person came back from the leave I made some passive aggressive remark, hope this is enough 🤣

ohlaph ,

Have you tried ignoring their PRs for a few weeks?

Synthead , in The classic font size exploit

You might enjoy !veryrealtechpics

Sir_Kevin ,
@Sir_Kevin@lemmy.dbzer0.com avatar

That’s fuckin awesome! Subscribed!

Appoxo ,
@Appoxo@lemmy.dbzer0.com avatar

This has a tech related touch to WTFStockPics on reddit. Wonder if theres a community for that. Quite liked the community.

MonkderZweite ,

I see only an empty sub?

nyan ,

They used the type of link that goes to where the community would be on your server if someone there had already subscribed. Try the absolute location on lemmy.world to decide whether you’re interested or not (and I wonder how long it will take a bot to complain about that link?)

CommunityLinkFixer Bot ,

Hi there! Looks like you linked to a Lemmy community using a URL instead of its name, which doesn’t work well for people on different instances. Try fixing it like this: !veryrealtechpics

nyan ,

Sorry to tell you this, bot, but the URL works better for people on all but the most populous instances.

MonkderZweite ,

Still see only emptyness.

nyan ,

That’s weird. For me it has a full set of posts, most recent a day ago. Maybe it’s blocked for you for some reason?

MonkderZweite ,

Now if you say it, this somehow never worked for me. Neither with feddit.ch or other account, nor with differrnt apps.

nyan ,

Odd. Do you get anything from lemmy.world at all? Maybe your ISP is blocking the server?

MonkderZweite ,

Nah, commenting on posts from lemmy.world works.

fibojoly , in The classic font size exploit

You joke but I bet font embedding in webpages is like a big open door for hackers to get into your machine.

nyan ,

You mean you leave that enabled? 😱

fibojoly ,

Well, it’s that or Times New Roman everywhere!

nyan ,

(Looks at own screen, which is in fact set up for Times New Roman everywhere. Coughs.)

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 OP ,

A rope has two ends, and so does a week

DrunkenPirate ,

Sentences have both meanings and sound, yours have sound

subignition ,
@subignition@kbin.social avatar

Methinks your username is a little too relevant right now :p

Scrath ,

I like fancy insults

magic_lobster_party ,

Do you say weekend or weekends?

boredtortoise ,

Three-day workweek now

fl42v ,

So, where does it start then?

DroneRights OP ,

At the ends

atomkarinca , in Debugging

thank god that there’s a print function in every language.

odium ,

The worst is when you’re print statements aren’t outputting where you expected them to, and you have no idea where they’re outputting to.

Redkey ,

I tought myself programming as a kid in the 80s and 90s, and just got used to diagnostic print statements because it was the first thing that occurred to me and I had no (advanced) books, mentors, teachers, or Internet to tell me any different.

Then in university one of my lecturers insisted that diagnostic prints are completely unreliable and that we must always use a debugger. He may have overstated the case, but I saw that he had a point when I started working on the university’s time-sharing mainframe systems and found my work constantly being preempted and moved around in memory in the middle of critical sections. Diagnostic prints would disappear, or worse, appear where, in theory, they shouldn’t be able to, and they would come and go like a restless summer breeze. But for as much as that lecturer banged on about debuggers, he hardly taught us anything about how to use them, and they confused the hell out of me, so I made it through the rest of my degree without using debuggers except for one part of one subject (the “learn about debuggers” part).

Over 20 years later, after a little professional work and a lot of personal projects and making things for other non-coding jobs I’ve had, I still haven’t really used debuggers much. But lately I’ve been forcing myself to use them sometimes, partly to help me pick apart quirks in external libraries that I’m linking, and partly because I’d like to start using superscalar instructions and threading in my programs, and I remember how that sort of thing screwed up my diagnostic prints in university.

embed_me ,
@embed_me@programming.dev avatar

Even worse is when print statements cause the bug…

That was me before discovering interrupt safe print functions.

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