• 0 Posts
  • 8 Comments
Joined 2 years ago
cake
Cake day: June 22nd, 2024

help-circle
  • Shell footgun. The || only looks at the return value of the preceding command, rm -fr /. There’s an edge case of the command returning a non-zero error code triggering the statement intended to run if, and only if, the condition is false.

    [ 0 -eq 0 ] && { echo "I am in your PCs, deleting your p0rn"; false; } || echo "Lucky you?"
    

    Use if clauses, people. These test abuses do not make one look extra-smart.

    On an unrelated note, I lost on the first try.






  • I would double down on sqlite for your case. If you are using python, the sqlite3 module is included, but looking at your pseudocode you are probably looking for Godot-SQLite instead. I have no idea what the #python line is supposed to be doing in the first line of your code snippet, besides confusing me.

    SQL is old, and it shows. “Proper” relational database design is a black art, as is optimizing SQL queries, but speaking from my own early experience, you’ll be doing 95% with INSERT, SELECT, UPDATE, DELETE, anyway, with an occasional simple JOIN. This is absolutely manageable and somewhat worth learning, as you’re basically custom building your own data structure according to how you plan to use it most easily. This SQL with sqlite tutorial seems solid to me.

    Beware LLM output. Wild guess is you’ll be sent off on a tangent to normalize your schema, unconditionally use synthetic, unique integer IDs everywhere, and other “best practices” that may not be necessary, and only complicate your structure beyond the point of understanding. Then it’ll be hell to use. Solid groundwork goes a long way, and you can always change things up when you realize “Damn, I’d love to have <some value> in that tuple for a really simple query!”

    Give it a try. Creating your own data structures in the way you want can be really rewarding in itself.

    If you’re gravitating towards a NoSQL database to avoid SQL, you’re basically using dicts again, and will have to learn a different query language, anyway. This may be a more approachable option for you IF your data structure isn’t very nested and uses few complex types, like arrays.

    And yes, you absolutely will find dozens of things to slap into a DB once you got a taste of it, and there’s little reason not to. Save your settings in there, debug info, events… everything can be a table if you’re brave enough. :)