Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

agnos.is Forums

  1. Home
  2. Programmer Humor
  3. Why shouldn't you use YAML to store eye tracking data? /s

Why shouldn't you use YAML to store eye tracking data? /s

Scheduled Pinned Locked Moved Programmer Humor
programmerhumor
57 Posts 32 Posters 12 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N [email protected]

    True (in most contexts, probably including this one), but I think that only makes the case for SQLite stronger. What people do still care about is a good flexible, usable and reliable interface. I'm not sure how to get that with YAML.

    N This user is from outside of this forum
    N This user is from outside of this forum
    [email protected]
    wrote on last edited by
    #36

    YAML is not a good format for this. But any line based or steamable format would be good enough for log data like this. Really easy to parse with any language or even directly with shell scripts. No need to even know SQL, any text processing would work fine.

    1 Reply Last reply
    2
    • F [email protected]

      I'm amazed at developers who don't grasp that you don't need to have absolutely everything under the sun in a human readable file format. This is such a textbook case...

      C This user is from outside of this forum
      C This user is from outside of this forum
      [email protected]
      wrote on last edited by
      #37

      Yeah this isn't even human readable even when it's in YAML. What am I going to do? Read the floats and understand that the person looked left?

      S 1 Reply Last reply
      8
      • M [email protected]

        Even if you want it to be human readable, you don't need to include the name into every field and use balanced separators.

        Any CSV variant would be an improvement already.

        F This user is from outside of this forum
        F This user is from outside of this forum
        [email protected]
        wrote on last edited by
        #38

        Even using C#'s decimal type (128bit) would be an improvement! I count 22 characters per numbers here. So a minimum of 176bit.

        1 Reply Last reply
        3
        • F [email protected]

          I'm amazed at developers who don't grasp that you don't need to have absolutely everything under the sun in a human readable file format. This is such a textbook case...

          fuckbigtech347@lemmygrad.mlF This user is from outside of this forum
          fuckbigtech347@lemmygrad.mlF This user is from outside of this forum
          [email protected]
          wrote on last edited by
          #39

          Exactly. All modern CPUs are so standardized that there is little reason to store all the data in ASCII text. It's so much faster and less complicated to just keep the raw binary on disk.

          1 Reply Last reply
          2
          • Z [email protected]

            All yaml is just sparkling JSON.

            D This user is from outside of this forum
            D This user is from outside of this forum
            [email protected]
            wrote on last edited by
            #40

            How do you figure?

            tomasekeli@programming.devT 1 Reply Last reply
            2
            • S [email protected]

              Fuck yaml. I'm not parsing data structured with spaces and newlines with my eyes. Use visible characters.

              D This user is from outside of this forum
              D This user is from outside of this forum
              [email protected]
              wrote on last edited by
              #41

              Does your viewer/editor not show space chars or indent levels?

              1 Reply Last reply
              1
              • D [email protected]

                How do you figure?

                tomasekeli@programming.devT This user is from outside of this forum
                tomasekeli@programming.devT This user is from outside of this forum
                [email protected]
                wrote on last edited by
                #42

                Valid JSON is valid YAML.

                So valid YAML can contain JSON

                D 1 Reply Last reply
                11
                • tomasekeli@programming.devT [email protected]

                  Valid JSON is valid YAML.

                  So valid YAML can contain JSON

                  D This user is from outside of this forum
                  D This user is from outside of this forum
                  [email protected]
                  wrote on last edited by
                  #43

                  That's a long way from all or most YAML being JSON-compatible. I wonder if more YAML files in the wild parse as Markdown than JSON.

                  tomasekeli@programming.devT 1 Reply Last reply
                  0
                  • Q [email protected]

                    It's used to export tracking data to analyze later on. Something like SQLite seems like a much better choice to me.

                    E This user is from outside of this forum
                    E This user is from outside of this forum
                    [email protected]
                    wrote on last edited by
                    #44

                    If it's an export that will be consumed by a separate, unrelated program later, I think a CSV is most appropriate. Databases are persistence tools, not transport.

                    Q 1 Reply Last reply
                    1
                    • D [email protected]

                      That's a long way from all or most YAML being JSON-compatible. I wonder if more YAML files in the wild parse as Markdown than JSON.

                      tomasekeli@programming.devT This user is from outside of this forum
                      tomasekeli@programming.devT This user is from outside of this forum
                      [email protected]
                      wrote on last edited by
                      #45

                      JSON is valid YAML does not imply that YAML is valid JSON

                      D 1 Reply Last reply
                      5
                      • E [email protected]

                        If it's an export that will be consumed by a separate, unrelated program later, I think a CSV is most appropriate. Databases are persistence tools, not transport.

                        Q This user is from outside of this forum
                        Q This user is from outside of this forum
                        [email protected]
                        wrote on last edited by
                        #46

                        It's only intended to be used by the program itself. It's purely storage.

                        E 1 Reply Last reply
                        0
                        • Q [email protected]

                          It's only intended to be used by the program itself. It's purely storage.

                          E This user is from outside of this forum
                          E This user is from outside of this forum
                          [email protected]
                          wrote on last edited by
                          #47

                          Ah so it's not really an export, it's just the backing store used by some other (locally-running) program that you're trying to reverse engineer?

                          In that case yeah an sqlite database is probably most appropriate, though I can see a CSV still being desirable to remove a potential sqlite dependency.

                          1 Reply Last reply
                          0
                          • N [email protected]

                            Never said it had to be a text file. There are many binary serialization formats that could be used. But is a lot of situations the overhead you save is not worth the debugging effort of working with binary data. For something like this that is likely not going to be more then a GB or so, probably much less it really does not matter that much if you use binary or text formats. This is an export format that will likely just have one batch processing layer on. This type of thing is generally easiest for more people to work with in a plain text format. If you really need efficient querying of the data then it is trivial and quick to load it into a DB of your choice rather then being stuck with sqlite.

                            U This user is from outside of this forum
                            U This user is from outside of this forum
                            [email protected]
                            wrote on last edited by
                            #48

                            As long as it is something I want to be loading all at once, I would go with JSON and use the JSON binary format provided by QJsonDocument and forget about it.
                            But if I expect it to get bigger and need stuff partially loaded, things get lengthier.
                            Stream Reading libraries (e.g. the XML one in Qt) makes it much longer to write and that's where I would consider whether to use a database instead.

                            1 Reply Last reply
                            0
                            • B [email protected]

                              Cuelang: https://cuelang.org/docs/reference/spec/#numeric-values

                              Implementation restriction: although numeric values have arbitrary precision in the language, implementations may implement them using an internal representation with limited precision. That said, every implementation must:

                              • Represent integer values with at least 256 bits.
                              • Represent floating-point values with a mantissa of at least 256 bits and a signed binary exponent of at least 16 bits.
                              • Give an error if unable to represent an integer value precisely.
                              • Give an error if unable to represent a floating-point value due to overflow.
                              • Round to the nearest representable value if unable to represent a floating-point value due to limits on precision. These requirements apply to the result of any expression except for builtin functions, for which an unusual loss of precision must be explicitly documented.
                              deegeese@sopuli.xyzD This user is from outside of this forum
                              deegeese@sopuli.xyzD This user is from outside of this forum
                              [email protected]
                              wrote on last edited by [email protected]
                              #49

                              Thanks for teaching me something, but the obscurity of your answer just illustrates how rare that requirement is in human readable formats, and mostly limited to data formats designed for numeric precision, like HDF5, FITS or protobuf.

                              B 1 Reply Last reply
                              3
                              • deegeese@sopuli.xyzD [email protected]

                                Thanks for teaching me something, but the obscurity of your answer just illustrates how rare that requirement is in human readable formats, and mostly limited to data formats designed for numeric precision, like HDF5, FITS or protobuf.

                                B This user is from outside of this forum
                                B This user is from outside of this forum
                                [email protected]
                                wrote on last edited by [email protected]
                                #50

                                I don't think having well-defined precision is a rare requirement, it's more that most devs don't understand (and/or care) about the pitfalls of inaccuracy, because they usually aren't obvious. Also, languages like JavaScript/PHP make it hard to do things the right way. When I was working on an old PHP codebase, I ran into a popular currency library (Zend_Currency) that used floats for handling money, which I'm sure works fine up until the point the accountants call you up asking why they can't balance the books. The "right way" was to use the bcmath extension, which was a huge pain.

                                1 Reply Last reply
                                0
                                • tomasekeli@programming.devT [email protected]

                                  JSON is valid YAML does not imply that YAML is valid JSON

                                  D This user is from outside of this forum
                                  D This user is from outside of this forum
                                  [email protected]
                                  wrote on last edited by [email protected]
                                  #51

                                  That was my point, yes, but I was replying to @[email protected]'s suggestion that "all yaml is just sparkling json".

                                  1 Reply Last reply
                                  0
                                  • deegeese@sopuli.xyzD [email protected]

                                    What text based serialization formats do enforce numeric precision?

                                    AFAIK it’s always left up to the writer (serializer)

                                    S This user is from outside of this forum
                                    S This user is from outside of this forum
                                    [email protected]
                                    wrote on last edited by
                                    #52

                                    Technically, JSON enforces a specific numeric precision by enforcing that numbers are stored as JS-compatible floating point numbers with its associated precision.

                                    Other than that, the best way to go if you want to have a specific precision is to cast to string before serialisation.

                                    1 Reply Last reply
                                    0
                                    • C [email protected]

                                      Yeah this isn't even human readable even when it's in YAML. What am I going to do? Read the floats and understand that the person looked left?

                                      S This user is from outside of this forum
                                      S This user is from outside of this forum
                                      [email protected]
                                      wrote on last edited by
                                      #53

                                      It's human-readable enough for debugging. You might not be able to read whether a person look left, but you can read which field is null or missing or wildly out of range. You can also read if a value is duplicated when it shouldn't be.

                                      Human-readable is primarily about the structure and less about the data being human readable.

                                      V 1 Reply Last reply
                                      1
                                      • S [email protected]

                                        It's human-readable enough for debugging. You might not be able to read whether a person look left, but you can read which field is null or missing or wildly out of range. You can also read if a value is duplicated when it shouldn't be.

                                        Human-readable is primarily about the structure and less about the data being human readable.

                                        V This user is from outside of this forum
                                        V This user is from outside of this forum
                                        [email protected]
                                        wrote on last edited by [email protected]
                                        #54

                                        You could also not be an idiot and write a debug script that checks those values or atleast provides an interface

                                        But I guess they don't teach that kind of thing in the javascript and python school of dogshit programming

                                        S 1 Reply Last reply
                                        0
                                        • V [email protected]

                                          You could also not be an idiot and write a debug script that checks those values or atleast provides an interface

                                          But I guess they don't teach that kind of thing in the javascript and python school of dogshit programming

                                          S This user is from outside of this forum
                                          S This user is from outside of this forum
                                          [email protected]
                                          wrote on last edited by [email protected]
                                          #55

                                          Who pissed in your coffee?

                                          Sure you can write some script to interpret the data, but then you need to write an extra script that you need to run any time you step through the code, or whenever you want to look at the data when it's stored or transferred.

                                          But I guess you have never worked on an actually big project, so how would you know?

                                          I guess you aren't entirely wrong here. If nobody other than you ever uses your program and nobody other than you ever looks at the code, readability really doesn't matter and thus you can microoptimize everything into illegibility. But don't extrapolate from your hobby coding to actual projectes.

                                          V 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups