• 43 Posts
  • 2.35K Comments
Joined 6 years ago
cake
Cake day: May 31st, 2020

help-circle
  • Ephera@lemmy.mltoProgrammer Humor@programming.devTOML
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 hour ago

    They’re not supposed to contain data, but some parsers will allow you to access what’s written into comments. And so, of course, someone made use of that and I had to extract what was encoded basically like that:

    <!--
        Host: toaster,
        Location: moon,
    -->
    <data>Actual XML follows...</data>
    

    My best guess is that they added this data into comments rather than child nodes or attributes, because they were worried some of the programs using this XML would not be able to handle an extension of the format.


  • Ephera@lemmy.mltoProgrammer Humor@lemmy.mlTOML
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    9 hours ago

    We just document that this is how you write the config file:

    [network]
    bind.host = "127.0.0.1"
    bind.port = 1234
    
    # etc.
    

    And that seems straightforward enough. Yeah, technically users can opt to use inline tables or raw strings or whatever, but they don’t have to.



  • Ephera@lemmy.mltoProgrammer Humor@programming.devTOML
    link
    fedilink
    English
    arrow-up
    8
    ·
    13 hours ago

    I don’t feel like it will stray very far from what’s dubbed “TOML 0.1” in the meme. Yes, it has inline tables and as of TOML 1.1, they’re allowed to span multiple lines, so it’s technically not anymore illegal to do what’s in the meme. But all things considered, this is still a miniscule change compared to TOML 1.0.


  • Ephera@lemmy.mltoProgrammer Humor@lemmy.mlTOML
    link
    fedilink
    English
    arrow-up
    3
    ·
    14 hours ago

    Well, you can still decide how much of the TOML features you actually use in your specific application. For example, I’m currently involved in two projects at $DAYJOB where we read TOML configurations and we don’t make use of the inline tables that OP memes about in either of them.

    Ultimately, the big advantage of TOML over INI is that it standardizes all kinds of small INI extensions that folks have come up with over the decades. As such, it has a formal specification and in particular only one specification.
    You can assume that you can read the same TOML file from two different programming languages, which you cannot just assume for INI.



  • Ephera@lemmy.mltoProgrammer Humor@lemmy.mlTOML
    link
    fedilink
    English
    arrow-up
    26
    ·
    edit-2
    21 hours ago

    Counterpoints:

    • TOML is intended for configuration, not for data serialization, so you shouldn’t be sending it over the wire in all too crazy ways anyways.
    • Most protocols will have a built-in way of knowing when the whole content has been transferred, typically by putting a content length into the header.
    • Having to wait until the closing } or ] can also be a disadvantage of JSON, since you cannot stream it, i.e. start processing the fields/elements before the whole thing has arrived. (You probably still don’t want to use TOML for that, though. JSONL, CSV or such are a better idea.)

  • Ephera@lemmy.mltoProgrammer Humor@lemmy.mlTOML
    link
    fedilink
    English
    arrow-up
    3
    ·
    21 hours ago

    Well, TOML is essentially just an extension of the INI format (which helped its adoption quite a bit, since you could just fork INI parsers for all kinds of programming languages).

    And then, yeah, flattening everything is kind of baked into INI, where it arguably made more sense.
    Although, I do also feel like non-techies fare better with flat files, since they don’t have to understand where into the structure they have to insert the value. They just need find the right “heading” to put the line under, which is something they’re familiar with.




  • Ephera@lemmy.mltolinuxmemes@lemmy.worldFeels more polite for sure.
    link
    fedilink
    English
    arrow-up
    9
    ·
    edit-2
    2 days ago

    It’s kind of bad for scripts, where it can be either annoying or genuinely problematic, when your script hangs on a password prompt. You typically do want it to just fail right away, because if you have monitoring, then you’ll be able to spot it failing.

    These days, it is (largely reliably) possible to detect whether a command is being run interactively or as part of an unattended script, so you do see some commands that trigger a sudo password prompt only for interactive use, for example systemctl does this. But this adds quite a bit of complexity to each individual program, so it isn’t really something that’s going to be implemented universally.

    I also have to say that systemctl kind of gets on my tits when it does that, because it throws up a GUI dialog for grabbing the password, which is quite jarring.


  • Most developers I’ve looked at would happily just paste the curl|bash thing into the terminal.

    I mean, I typically see it used for installing applications, and so long as TLS is used for the download, I’m still not aware of a good reason why you should check the Bash script in particular in that case, since the application itself could just as well be malware.

    Of course, it’s better to check the Bash script than to not check it, but at that point we should also advise to download the source code for the application, review it and then compile it yourself.
    At some point, you just have to bite the bullet and I have not yet seen a good argument why the Bash script deserves special treatment here…

    Having said that, for cases where you’re not installing an application, yeah, reviewing the script allows you to use it, without having to trust the source to the same degree as you do for installing an application.


  • One thing that will become important pretty quick if you continue making these scripts is that it’s almost always better to wrap your variables in quotes - so it becomes yt-dlp -x “$a.

    Oh man, this reminds me of the joke that any program that’s more complex than Hello World has bugs – and folks still don’t even agree how to spell “Hello, World!”.

    Of course, Bash is a particular minefield in this regard…





  • Ephera@lemmy.mltoMemes@lemmy.mlAI advice
    link
    fedilink
    English
    arrow-up
    42
    ·
    4 days ago

    Man, I really hate how much they waffle. The only valid response is “You have to drive, because you need your car at the car wash in order to wash it”.

    I don’t need an explanation what kind of problem it is, nor a breakdown of the options. I don’t need a bulletpoint list of arguments. I don’t need pros and cons. And I definitely don’t need a verdict.