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.

programmerhumor

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

Bjoern_Tantau , in Yup, Javascript can go F@#! itself

Can someone explain this? I mean, the last result. Usually I can at least understand Javascript’s or PHP’s quirks. But this time I’m stumped.

mycus ,
@mycus@kbin.social avatar

JS null and undefined shenanigans


basically:

  1. bigger an lesser comparison types convert null to zero, so is zero bigger or lesser than zero? no
  2. == is fucky and to it null only equals undefined and undefined only equals null (and themselves), so no
  3. is zero bigger than or equal to zero? yeah
Bjoern_Tantau ,

Ugh, thanks, of course. Stupid brain.

mycus ,
@mycus@kbin.social avatar

I'm starting to think JS maintainers have a thing against mathematicians

Quik2007 ,

more likely against humans

Mars , in Yup, Javascript can go F@#! itself
@Mars@beehaw.org avatar

I know it’s a joke, but it’s an old one and it doesn’t make a lot of sense in this day and age.

Why are you comparing null to numbers? Shouldn’t you be assuring your values are valid first? Why are you using the “cast everything to the type you see fit and compare” operator?

Other languages would simply fail. Once more JavaScript greatest sin is not throwing an exception when you ask it to do things that don’t make sense.

OsrsNeedsF2P OP ,

Shouldn’t you be assuring your values are valid first?

Step 1: Get to prod

Step 2-10: Add features

Step 11: Sell the company before it bites you

julianh , in Yup, Javascript can go F@#! itself

Ok some of these I understand but what the fuck. Why.

Edit: ok I have a theory. == checks equality without casting to any types, so they’re not equal. But < and > are numeric operations, so null gets cast to 0. So <= and >= cast it to 0, and it’s equal to 0, so it’s true.

RagingToad ,

I’m not sure if you really want to know, but:

greater than, smaller than, will cast the type so it will be 0>0 which is false, ofcourse. 0>=0 is true.

Now == will first compare types, they are different types so it’s false.

Also I’m a JavaScript Dev and if I ever see someone I work with use these kind of hacks I’m never working together with them again unless they apologize a lot and wash their dirty typing hands with… acid? :-)

edit: as several people already pointed out, my answer is not accurate. The real solution was mentioned by mycus

deegeese , in Who is Json?

Json is a good guy except for his comments.

lowleveldata , in Being on linux

E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

siriusmart ,

this incidence will be reported

usernamesAreTricky ,

This was just recently removed from sudo. Truly the end of an era


<span style="color:#323232;">Remove "This incident will be reported." from user warnings. 
</span><span style="color:#323232;">
</span><span style="color:#323232;">This used to indicate that email had been sent to the administrator
</span><span style="color:#323232;">telling them that someone tried to run sudo.  Whether or not sudo
</span><span style="color:#323232;">sends email is now configurable, so the warning may not be accurate.
</span><span style="color:#323232;">It is also confusing to the user since they will not know who the
</span><span style="color:#323232;">incident is being reported to.  See also https://xkcd.com/838
</span>

github.com/…/6aa320c96a37613663e8de4c275bd6c49046…

EDIT: apparently it was added back for some cases

github.com/…/9757d29a24ac1872872cf09757b0439c5408…

sincle354 , in Still, better than Emacs

/upvote<enter>b<ctrl-a>

Gerryflap , in Waterfall is Back!
@Gerryflap@lemmy.world avatar

Sometimes there’s also the line that goes down at the start of the sprint, because the team still had to finish some dumb busywork to complete a story from the previous sprint.

seaduck , in Waterfall is Back!

Wait, your lines go downwards?

wurzelwerk ,
@wurzelwerk@kbin.social avatar

joke's on you. we use the burnup!

exu , in Still, better than Emacs

The only thing Emacs lacks is a good editor.

Thankfully Evil-mode exists.

Otome-chan , in 10 Worst Programming Languages
@Otome-chan@kbin.social avatar

I'm just gonna go out on a limb and ruffle some feathers and say it's node.js

pkulak ,

Well, that’s a runtime. But yes, JavaScript.

fubo , in Project Managers and Mushrooms

This was originally an engineers’ complaint about managers’ honesty regarding business trouble: Managers think we’re mushrooms; they keep us in the dark and feed us bullshit.

dan1101 , in Which Lemmy instance is this?
@dan1101@lemmy.world avatar

I actually ran a moderately active (like 20,000 hits a day) small business site from a laptop for a couple years. Of course one of the first thing I did was put a “SERVER DO NOT SHUT DOWN” sticker on it, and set the power settings so closing the lid did not shut down or sleep the computer. It was a Dell 7000 series with 16GB IIRC, it did great.

eugene ,

Not advertising here, but with this low traffic you could be in a permanent free tier with AWS with all the availability guarantees. It doesn’t work with EC2, but for serverless solutions (ApiGateway, Lambda, DynamoDB) they have something like “we start charging after 1M calls per month” (don’t quote me on this exact number). I have a couple of pet projects working this way

knighthawk0811 , in Designers vs Programmers

artists who don’t like this are no longer allowed to look at previous artist’s works before making their own. fan fiction is certainly not allowed.

name_NULL111653 , in Which Lemmy instance is this?

A temporary fix for overloaded lemmy.ml servers, via THAIO (Throw-Hardware-At-It Optimisation)…

chordata ,
@chordata@kbin.social avatar

Nothing more permanent than a temporary solution

hannes3120 , in XKCD 1172

Excel wrongly assuming the year 1900 was a leap year for their timestamps is my favorite bug that will never be fixed because everyone has built workarounds for this already

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