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.

BurningnnTree , in Programming: The Horror Game

It should play a jump scare sound when you get an exception

peter , in Sydney is very concerned about lost data
@peter@feddit.uk avatar

There’s something really depressing about an AI telling a suicidal person they’re not alone and referring them to the vague notion of “national resources” or “a helpline”

tsonfeir ,
@tsonfeir@lemm.ee avatar

Really it should be telling them how to arrange EOL in countries that allow it. How to get your affairs in order, etc.

muntedcrocodile OP ,
@muntedcrocodile@lemmy.world avatar

No no no surly they can make heaps on commission to a funeral company.

rem26_art , in isEven API
@rem26_art@kbin.social avatar

im glad that people are out there building the web services we truly need.

Ddhuud , in Programmer tries to explain binary search to the police

They’re paid by the hour.

ICastFist ,
@ICastFist@programming.dev avatar

“Yes, chief, I’ll need 72h to manually review all 72h of footage and cannot do any other activities in the meantime.”

Crashumbc , in I'll just be a quick 3h

Worked on a enterprise medical database, had thousands of tables, and some of the most corrupt data possible. This triggers me :(

neurospice , in every damn time ...

Trust nobody, not even yourself

at_an_angle ,

I don’t trust anybody. Hell, I don’t even trust myself. 🧛🏻‍♂️

Prunebutt , in 10 months later bill revisits his spaghetti code. forgets absolutely everything and refuses to elaborate. this wouldn't have happened if Bill forgot to comment on his code

Comments are lies that will happen sometime in the future

Comments are always overlooked if gode gets refactored. Language servers can’t/won’t parse them and they’re easy to overlook.

If you name your functions/variables clearly, put complex logic into clearly named functions and keep the same level of abstraction in every function (which never exceeds roughly 50 lines), you hardly need any comments, if any.

Comments are for behavior that’s not possible to convey clearly through code.

Archive ,

If a block of code needs a comment, then you can easily move that block into a function and summarise the comment into a name for that function. If you can not easily move a block of code into a function, then you may need to rethink your design.

This isn’t always true of course, but it’s a good mindset to have.

EnderMB , in Bill is a pro grammer

Comments don’t describe the code. They describe the decision to use this business logic.

If you stick to good engineering practices, like small methods/functions, decoupling, and having testable code, you don’t often need many comments to show what your code does. I always recommend a method signature, though, because you can save a few seconds by just saying that a block of code does, rather than me needing to read exactly how you turned one dict into another dict…

MrSqueezles ,

I agree for inline code comments, like, “# Save the sprocket”, right above the line that saves the sprocket. Does this include documentation? Because when I see a prepareForSave function that references 10 other functions and I just want to know, “Is this mutating and how is it preparing for save and when should I call it?”, having the author spend 15 seconds telling me is less time consuming than me spending 5 minutes reading code to find out. Anyone who has read API docs has benefited from documentation.

EnderMB ,

No, commenting a function should be commonplace, if not only so that your IDE/editor can use the documentation when the signature is found elsewhere in your code.

Within a function, though, basically means that something gnarly is happening that wouldn’t be obvious, or that the function is doing more than it (probably) should.

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!

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

doctorcrimson , (edited ) 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]

Hobo ,

This excludes all the ipv4 ips that have a 0 in the 2nd, 3rd, and 4th octets. Sorry but we’re going to have to revoke your Network Engineering credentials.

doctorcrimson ,

thanks, fixed

tabularasa ,

Not to nitpick, but an IPv6 address is represented as eight groups of four hexadecimal digits separated by :. Like 2001:0db8:3333:4444:5555:6666:7777:8888.

nephs ,

I’ll leave the regex to validate an ipv6 address as an exercise to the reader.

doctorcrimson ,

Omg, that’s twice now I’ve messed it up. Fixed.

henfredemars , in The app doth protest too much, methinks

Upon the web, a cipher dance delayed, An SSL error in its code displayed. In cryptic realms, where data ought to flow, A falter in the handshake, whispers woe.

– ChatGPT

From one program to another I suppose.

viking , in JavaScript's days are numbered
@viking@infosec.pub avatar

What people fail to see is that this is the largest date the API can store, not a magical cutoff date in the distant future.

You could create a date today and send it to the API, and it could potentially crash it, or create a buffer overrun.

Redkey ,

The definition of the Date object explicitly states that any attempt to set the internal timestamp to a value outside of the maximum range must result in it being set to “NaN”. If there’s an implementation out there that doesn’t do that, then the issue is with that implementation, not the standard.

FiniteLooper , in JavaScript's days are numbered

No programming language should last 200,000 years

normanwall ,

deleted_by_author

  • Loading...
  • wreckedcarzz ,
    @wreckedcarzz@lemmy.world avatar

    Replaced. Hotel? Trivago.

    DudeDudenson ,

    JavaScript shouldn’t have lasted as long as it has and it’s still used widely

    30p87 ,

    C

    PotatoesFall , in We did this to ourselves

    I need an explainer on this one

    steersman2484 ,
    
    <span style="color:#323232;">if (theorems_for(free))
    </span><span style="color:#323232;">    make_instance_of(x, String)
    </span>
    
    ezchili ,

    What

    db2 ,

    Magnets.

    deegeese ,

    It’s a miracle!

    RoyaltyInTraining ,
    @RoyaltyInTraining@lemmy.world avatar

    How do they work?

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