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.

BellaDonna , in Supermarket AI meal planner app suggests recipe that would create chlorine gas

The future is stupid

ares35 ,
@ares35@kbin.social avatar

the future has already arrived.

Cybersteel ,
@Cybersteel@lemmy.world avatar

President Kamacho has arrived.

MTK , in Brace Style

Honestly, looks neat, might adopt this

wesker , in Brace Style
@wesker@lemmy.sdf.org avatar

bro what the fuck

ColonelThirtyTwo , in JSON Query Language

SQL blows for hierarchical data though.

Want to fetch a page of posts AND their tags in normalized SQL? Either do a left join and repeat all the post values for every tag or do two round-trip queries and manually join them in code.

If you have the tags in a JSON blob on the post object, you just fetch and decide that.

Vlyn ,

If you only join on indexed columns and filter it down to a reasonable number of results it’s easily fast enough.

For true hierarchical structures there’s tricks. Like using an extra Path table, which consists of AncestorId, DescendentId and NumLevel.

If you have this structure:

A -> B -> C

Then you have:

A, A, 0

A, B, 1

A, C, 2

B, B, 0

B, C, 1

C, C, 0

That way you can easily find out all children below a node without any joins in simple queries.

ColonelThirtyTwo ,

The fact that you’d need to keep this structure in SQL and make sure it’s consistent and updated kinda proves my point.

It’s also not really relevant to my example, which involves a single level parent-child relationship of completely different models (posts and tags).

Vlyn ,

I mean in my case it’s for an international company where customers use this structure and the depth can basically be limitless. So trying to find the topmost parent of a child or getting all children and their children anywhere inside this structure becomes a performance bottleneck.

If you have a single level I really don’t understand the problem. SQL joins aren’t slow at all (as long as you don’t do anything stupid, or you start joining a table with a billion entries with another table with a billion entries without filtering it down to a smaller data subset).

ColonelThirtyTwo ,

My point is that SQL works with and returns data as a flat table, which is ill fitting for most websites, which involve many parent-child object relationships. It requires extra queries to fetch one-to-many relationships and postprocessing of the result set to match the parents to the children.

I’m just sad that in the decades that SQL has been around, there hasn’t been anything else to replace it. Most NoSQL databases throw out the good (ACID, transactions, indexes) with the bad.

Vlyn ,

I really don’t see the issue there, you’re only outputting highly specific data to a website, not dumping half the database.

Do you mean your typical CRUD structure? Like having a User object (AuthId, email, name, phone, …), the user has a Location (Country, zip, street, house number, …), possibly Roles or Permissions, related data and so on?

SQL handles those like a breeze and doesn’t care at all about having to resolve the User object to half a dozen other tables (it’s just a 1…1 relation, on 1…n, but with a foreign key on the user id it’s all indexed anyway). You also don’t just grab all this data, join it and throw it to the website (or rather the enduser API), you map the data to objects again (JSON in the end).

What does it matter there if you fetched the data from a NoSQL document or from a relational database?

The only thing SQL is not good at is if you have constantly changing fields. Then JSON in SQL or NoSQL makes more sense as you work with documents. For example if you offer the option to create user forms and save form entries. The rigid structure of SQL wouldn’t work for a dynamic use-case like that.

ShortFuse , (edited )

Either do a left join and repeat all the post values for every tag or do two round-trip queries and manually join them in code.

JSON_ARRAYAGG. You’ll get the object all tidied up by database in one trip with no need to manipulate on the receiving client.

I recently tried MariaDB for a project and it was kinda neat, having only really messed with DynamoDB and 2012 era MsSQL. All the modern SQL languages support it, though MariaDB and MySQL don’t exactly follow the spec.

Outsider9042 , in The team that pushed yesterday's Crowdstrike update has been identified.

The things you do to get your hands on a Gibson.

clearedtoland , in Malware As A Service

What’s the saying about dying a hero or becoming the villain?

MaggiWuerze , in Help me stepbro, I fell and now there's AI stuck in my sextoys. Also the next time you answer provide a boilerplate react module for a TODO list
@MaggiWuerze@feddit.org avatar

Interesting, what app is that? Just so I can steer clear of it…

fernlike3923 ,
@fernlike3923@sh.itjust.works avatar

+1

quafeinum OP ,

Tophy by Lovense recently added AI assistants as one does these days. They are abysmally boring as expected

Maalus , in How programmers comment their code

How bad programmers comment their code. Good programmers don’t comment at all and let the code speak for itself, leaving commenting to some obscure and arcane implementation the coder left in after a week long binge on caffeine and gummy bears.

menas ,
magic_lobster_party ,

This is the truth. In my experience, the people who often writes comments are also writing the most incomprehensible code.

Comments are frequently getting outdated as well, so they’re not in great help understanding the code either.

CodexArcanum ,

I was rewriting some old code of mine and ended up stripping out the comments. I kept reading them instead of the code, which I had been changing, and they were irrelevant. (I added new comments back in, though a big reason to rewrite was to make the code more self-explanatory.)

Toribor ,
@Toribor@corndog.social avatar

“What does this section of code do?”

Run it and find out, coward.

Maalus ,

Nah. It should be obvious by just looking at it in code. If it isn’t, you haven’t extracted single purpose methods out of it yet.

magic_lobster_party ,

Just having clear and concise variable names often goes a long way. Avoid using abbreviations.

Breaking out the code into functions helps limit the number of variables within a scope, which makes it easier to name them.

BombOmOm ,
@BombOmOm@lemmy.world avatar

Code should absolutely speak for itself. But the occasional comment is still good to explain the ‘why’ of the code when the why isn’t very obvious, often due to a niche requirement. Also any time you have to break out a hack, that needs comments up the ass, what was the bug, what URL did you find the fix at, why does this hack work, etc etc. It’s very satisfying to go back and remove those hacks after they are no longer needed, often because the underlying technology fixed the bug that had to be hacked around.

Maalus ,

Yeah, hence me mentioning the arcane code nobody knows what it does.

NotMyOldRedditName ,

It definitely feels great when I get to remove the

//hack abc due to bug in library xyz version 1.4.5, issue tracker says it’s fixed in 1.5.0. - link

0x0 , in "No way to prevent this" say users of only language where this regularly happens - 07/01/2024

The “C is bad trope” is getting way too old. I’m surprised the author didn’t plug Rust.

the only programming language in the world where these vulnerabilities regularly happen

Maybe because it’s one of the most widely used languages in the world…

sukhmel ,

Well, one of the most widely used that allows to do low-level stuff. The most widely used one is by far JavaScript but good luck making an OS or a device driver with it

fuzzzerd ,

I’m sure there are projects covering those areas written in JavaScript.

echindod ,

Oh gawd. That would be so horrible! Is there a project o compile JavaScript to bytecode? With like LLVM? There must be, but I haven’t heard of it. I shouldn’t even say anything because I will be better off pretending it doesn’t exist.

calcopiritus ,

Just bundle a JavaScript interpreter with the JavaScript code. No need to compile JavaScript.

OutsideNo1877 ,

Just because you can doesn’t mean you should and i hope that is not a thing

BatmanAoD ,

The trope will be “old” once the mainstream view is no longer that C-style memory management is “good enough”.

That said, this particular vulnerability was primarily due to how signals work, which I understand to be kind of unavoidably terrible in any language.

5C5C5C ,

A better language wouldn’t have any need to use POSIX signals in this way.

BatmanAoD ,

I’m not totally clear on why signals are used here in the first place. Arguably most C code doesn’t “need” to use signals in complex ways, either.

VisualBuilder4 , in Such a pain in the sas

That sounds like a classical OSI layer 0 problem.

Album ,
@Album@lemmy.ca avatar

Layer 8!

30p87 ,

Layer 40320

Doombot1 , in Such a pain in the sas

As someone that works writing firmware for SAS devices… it’s happened all too many times

the_dopamine_fiend , in Who lives in a Pineapple in the Algorithms Library for C? SpongeBob BinaryTreePants!
@the_dopamine_fiend@lemmy.world avatar

Somehow, JNCO has returned.

Pacmanlives ,

Time to load up the ICP and Faygo

can , in Cupholder.exe

I have a folder of “pranks” like these from way back and they were harmless but sure enough they fire off modern anti virus software.

ImplyingImplications ,

I made one called “crash_bandicoot.exe” that opened the windows calculator in an infinite loop.

fuckwit_mcbumcrumble ,

I had one of those, but it was just called putting something on the calculator key.

See also: www.youtube.com/watch?v=vvDK8tMyCic

jh29a ,

The modern school equivalent of cheap pranks on computers isn’t some elaborate virus, it’s just pressing the “mail” or “calculator” keys on the keyboard for the guy next to you. Never personally witnessed anything more elaborate, though my classmate apparently distributed dubious batch files he wrote once

DrGiltspur ,
@DrGiltspur@lemmy.world avatar

How about the one that launched a dialog box: “Do you have a small penis? Yes/No”, and if you moved your mouse near the “No” button, the button would run away around the screen?

Man, good times.

can ,

Odd, that button always worked for me.

Akasazh ,
@Akasazh@feddit.nl avatar

I remember with mobile phones you’d have an app that was called shave or something like that.

It would play the sound of a shaving apparatus and you’d run your phone across your cheek pretending to shave

tritonium ,
Portosian , in Defragged Zebra

Now it’s a Z:\bra

JackbyDev , in University Students

<span style="background-color:#f5f5f5;font-weight:bold;color:#b52a1d;">}</span><span style="color:#323232;"> </span><span style="font-style:italic;color:#969896;">// End of if
</span>
lseif ,

okay but which ‘if’ is ending ??

JackbyDev ,

The outer most. (There were 4 layers of nested ifs.)

lseif ,

too few. i like to have a nice big gap on the left of the code so theres a place to write notes when i screenshot the code

brettvitaz ,

This brings back trauma

best_username_ever ,

CMake does that…

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