Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • 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
Code Project
  1. Home
  2. General Programming
  3. Design and Architecture
  4. Making data notation extending another language

Making data notation extending another language

Scheduled Pinned Locked Moved Design and Architecture
asp-netjsonquestion
37 Posts 5 Posters 0 Views 1 Watching
  • 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.
  • L Lost User

    Member 7989122 wrote:

    Be prepared for Chinese macro names. Russian XML tags. ÆØÅ in variable names.

    We are, since we're no longer limited to ASCII.

    Member 7989122 wrote:

    Dates in ISO format and 24 hour clock.

    Date-formats are another topic; you should save in ISO, but display nicely in the format that the user has set as his preference in Windows. That's not a suggestion, nor is there a discussion.

    Member 7989122 wrote:

    For multi-lingual applications, binary formats give a lot of flexibilty compared to text formats.

    Ehr.. no. You could have ASCII in binary, with a completely useless date format.

    Member 7989122 wrote:

    Of course you can translate on-the-fly, but using a plain integer as an index into a language table is a lot easier than word-to word translation. And you may supply extra info in that language table, e.g. indicated plural forms, gender etc. giving a much better translation.

    We use keys, not integers, and resource-files. You started with a wheel, now you're also including a dashboard and breaks. I have no idea what you are trying to say :)

    Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

    K Offline
    K Offline
    kalberts
    wrote on last edited by
    #12

    Eddy Vluggen wrote:

    We are, since we're no longer limited to ASCII.

    I was primarily thinking of readability and comprehension, not representation. If you are receiving a support request or error report, and all supporting documentation uses characters that make no sense to you, you may have great difficulties in interpreting the bug report or error request. And: The alternative to UTF-16 (which is hardly used at all in files) is UTF-8, not ASCII. In the Windows world, you may still see some 8859-x (x given by the language version of the 16-bit Windows), but to see 7-bit ASCII, you must go to legacy *nix applications. Some old *nix-based software and old compilers may still be limited to ASCII - I have had .ini files that did not even allow 8859-1 in comments! But you must of course be prepared for 8859 when you read plain text files from an arbitrary source (and ASCII is the lower half of 8859).

    you should save in ISO, but display nicely in the format that the user has set as his preference in Windows

    Then we are talking about not reading a text representation as as text file, but using an interpreter program to present the information. Just as you would do with a binary format file.

    Ehr.. no. You could have ASCII in binary, with a completely useless date format.

    I am not getting this "ASCII in binary". Lots of *nix files with binary data use Unix epoch to store date and time. If your data is primarily intended for the Windows market, you might choose to store it as 100 ns ticks since 1601-01-01T00:00:00Z - then you can use standard Windows functions to present it in any format. Conversion to Unix epoch is one subtraction, one division. If you insist on ISO 8601 character format, you may store it in any encoding you want, all the way down to 5-bit baudot code :-)

    You started with a wheel, now you're also including a dashboard and breaks.

    Did you ever roll snowballs to make a snowman when you were a kid?

    I have no idea what you are trying to say

    One major point is that binary data file formats, as opposed to a character representation, is underestimated; most programmers are stuck in the *nix style of representing all sorts of data in a character format, where a binary format would be more suitable. (The same goes for network protocols!) I am surprised that you haven't discovered that poi

    L 1 Reply Last reply
    0
    • K kalberts

      Eddy Vluggen wrote:

      We are, since we're no longer limited to ASCII.

      I was primarily thinking of readability and comprehension, not representation. If you are receiving a support request or error report, and all supporting documentation uses characters that make no sense to you, you may have great difficulties in interpreting the bug report or error request. And: The alternative to UTF-16 (which is hardly used at all in files) is UTF-8, not ASCII. In the Windows world, you may still see some 8859-x (x given by the language version of the 16-bit Windows), but to see 7-bit ASCII, you must go to legacy *nix applications. Some old *nix-based software and old compilers may still be limited to ASCII - I have had .ini files that did not even allow 8859-1 in comments! But you must of course be prepared for 8859 when you read plain text files from an arbitrary source (and ASCII is the lower half of 8859).

      you should save in ISO, but display nicely in the format that the user has set as his preference in Windows

      Then we are talking about not reading a text representation as as text file, but using an interpreter program to present the information. Just as you would do with a binary format file.

      Ehr.. no. You could have ASCII in binary, with a completely useless date format.

      I am not getting this "ASCII in binary". Lots of *nix files with binary data use Unix epoch to store date and time. If your data is primarily intended for the Windows market, you might choose to store it as 100 ns ticks since 1601-01-01T00:00:00Z - then you can use standard Windows functions to present it in any format. Conversion to Unix epoch is one subtraction, one division. If you insist on ISO 8601 character format, you may store it in any encoding you want, all the way down to 5-bit baudot code :-)

      You started with a wheel, now you're also including a dashboard and breaks.

      Did you ever roll snowballs to make a snowman when you were a kid?

      I have no idea what you are trying to say

      One major point is that binary data file formats, as opposed to a character representation, is underestimated; most programmers are stuck in the *nix style of representing all sorts of data in a character format, where a binary format would be more suitable. (The same goes for network protocols!) I am surprised that you haven't discovered that poi

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #13

      Member 7989122 wrote:

      I was primarily thinking of readability and comprehension, not representation.

      Readability can't be without representation.

      Member 7989122 wrote:

      If you are receiving a support request or error report, and all supporting documentation uses characters that make no sense to you, you may have great difficulties in interpreting the bug report or error request.

      No, I mail the provider of said and burn them for not documenting.

      Member 7989122 wrote:

      And: The alternative to UTF-16 (which is hardly used at all in files) is UTF-8, not ASCII.

      That's not an alternative. One is a more limited version of wheel then the other.

      Member 7989122 wrote:

      But you must of course be prepared for 8859

      No, in general I'm not; the specs specify what I should support, and outdated isn't supported.

      Member 7989122 wrote:

      Then we are talking about not reading a text representation as as text file, but using an interpreter program to present the information. Just as you would do with a binary format file.

      Bin nor text need an interpreter.

      Member 7989122 wrote:

      I am not getting this "ASCII in binary". Lots of *nix files with binary data use Unix epoch to store date and time.

      ASCII is a text-representation that is stored as bits. Unix epoch has nothing to do with any discussion of text-formats.

      Member 7989122 wrote:

      Did you ever roll snowballs to make a snowman when you were a kid?

      No. What's the use of that?

      Member 7989122 wrote:

      One major point is that binary data file formats, as opposed to a character representation, is underestimated

      A representation is not a format. They're all stored as bytes. Google for an ASCII-table, it shows what bytes are used for the character.

      Member 7989122 wrote:

      I am surprised that you haven't discovered that point.

      I deduce you're not asking a question, but trying to make a point. Mixing text-encodings and date-encodings, trying to prove that not human readable binary is somehow superiour. You fail to give a simple example to prove so, and

      1 Reply Last reply
      0
      • L Lost User

        Why reinvent the wheel?Both JSON and XML provide everything you could need already. And they are both supported by nearly all major programming languages.

        N Offline
        N Offline
        nedzadarek
        wrote on last edited by
        #14

        XML is very verbose and JSON doesn't have extendable types.

        L 2 Replies Last reply
        0
        • K kalberts

          JSON and XML and YAML and ... Isn't the whole bunch of them wheel reinventions? When everybody else are creating new wheels which are better suited for the purpose than all the old ones, why shouldn't I do the same? :-) Now I have personally come to one conclusion, in particular from many years of exposure to XML: Data description languages are for computers, not for humans. This kind of stuff you, a human, do not handle better than a computer does. You make typos, you do not structure it according to the rules, in brief: You mess it up. So keep humans out of it! The best way of doing that is to make it unreadable. Binary. I know that is a highly Politically Uncorrect statement; yet I think that what humans should not mess up, should not be made available for messing up - especially not with as simple tool as a plain text editor. You can also mess up by using a binary generator (/editor), but that takes a lot more deliberate action. The mess comes from "You asked for it, you got it" - not from "Ooooops!" So when I need to store data for my own applications (and there are no requirements for sharing the data files with other applications), I do it as binary files. Always in a Tag-Length-Value format, evading all sorts of escape mechanisms. No need to search for the end of the field. Arbitrary binary data. Space allocation for the value can be made before it is actually read. Parsing the file is extremely fast. The space overhead is quite moderate. Details of how you do the TLV format may vary slightly. E.g. in some applications, there will never be more than a couple hundred distinct tags, so it is stored in 15 bits; the "sign bit" is a flag indicating that the Value is in fact a sequence of TLV values. If values are small, the length is 16 bits, too. If there is any risk at all of overflow, I use the BER style of variable length handling: The length of the enclosing TLV is 0, each member carries its own length; the member sequence is terminated by and all zero TLV. (Then you cannot preallocate space for the entire structure without reading it, but usually a composite value won't be stored as a single unit anyway.) Like all class definitions have a ToString, they have a ToTLV. And a FromTLV. The "Schema" is represented by these ToTLV funcitons. If any other application needs data in, other formats, adding ToXML, ToJSON, ToYAML, ... alongside with ToString and ToTLV is straigtforward. But for the application's private file, the binary ToTLV is used.

          N Offline
          N Offline
          nedzadarek
          wrote on last edited by
          #15

          While binary format described by you is interesting it's not what I asked about. I'll try creating one in the future nevertheless.

          1 Reply Last reply
          0
          • N nedzadarek

            XML is very verbose and JSON doesn't have extendable types.

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #16

            XML existed before JSON. And data interchange formats benefit from being verbose. Due to readability; it's not a binary format. Come to the point please.

            Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

            K N 2 Replies Last reply
            0
            • L Lost User

              XML existed before JSON. And data interchange formats benefit from being verbose. Due to readability; it's not a binary format. Come to the point please.

              Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

              K Offline
              K Offline
              kalberts
              wrote on last edited by
              #17

              How does "XML existed before JSON" relate to either "XML is very verbose" or "JSON doesn't have extendable types"? In which ways do "data interchange formats benefit from being verbose"? Most users today do not read the raw data interchange format directly, as-is - they process it by software that e.g. highlights labels, closing tag etc, and allow collapsing of substrucures. When you pass it through software anyway, what impact on readability does the format of the input to this display processor have? With semantically identical information, but binary coded, as input to the display processor, why would the readabilty be better with a character encoding of the information rather than by a binary encoding?

              L 1 Reply Last reply
              0
              • L Lost User

                XML existed before JSON. And data interchange formats benefit from being verbose. Due to readability; it's not a binary format. Come to the point please.

                Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                N Offline
                N Offline
                nedzadarek
                wrote on last edited by
                #18

                They are not good enough so I won't use it.

                L 1 Reply Last reply
                0
                • K kalberts

                  How does "XML existed before JSON" relate to either "XML is very verbose" or "JSON doesn't have extendable types"? In which ways do "data interchange formats benefit from being verbose"? Most users today do not read the raw data interchange format directly, as-is - they process it by software that e.g. highlights labels, closing tag etc, and allow collapsing of substrucures. When you pass it through software anyway, what impact on readability does the format of the input to this display processor have? With semantically identical information, but binary coded, as input to the display processor, why would the readabilty be better with a character encoding of the information rather than by a binary encoding?

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #19

                  Semantical bullshit, aka wordsmithing. I been on that train before. You trying to do as if binary is the solution to formats; it's not. Anything, text or date, is stored as bits, and is thus in binary. ASCII is a representation of that, UTF is a better form of ASCII. Dates are stored as floats. I don't care what university. You can either learn or be rediculed. And damn right I will, at every opportunity. And yes, being "kind" :suss:

                  Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                  K 1 Reply Last reply
                  0
                  • N nedzadarek

                    They are not good enough so I won't use it.

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #20

                    :D They might not be efficient to you; but lots of us use them, both, where appropriate. Try to explain why XML isn't good enough, and to how many floppy-discs you're limited to that you need that optimization. Do elaborate, please.

                    Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                    K N 2 Replies Last reply
                    0
                    • L Lost User

                      Semantical bullshit, aka wordsmithing. I been on that train before. You trying to do as if binary is the solution to formats; it's not. Anything, text or date, is stored as bits, and is thus in binary. ASCII is a representation of that, UTF is a better form of ASCII. Dates are stored as floats. I don't care what university. You can either learn or be rediculed. And damn right I will, at every opportunity. And yes, being "kind" :suss:

                      Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                      K Offline
                      K Offline
                      kalberts
                      wrote on last edited by
                      #21

                      If you really want me to explain to you the difference between storing an integer, say, as a 32 bit binary number vs. storing it as a series of digit characters, bedayse "ASCII is bits, hence digital", then I give up. Sorry.

                      L 1 Reply Last reply
                      0
                      • L Lost User

                        :D They might not be efficient to you; but lots of us use them, both, where appropriate. Try to explain why XML isn't good enough, and to how many floppy-discs you're limited to that you need that optimization. Do elaborate, please.

                        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                        K Offline
                        K Offline
                        kalberts
                        wrote on last edited by
                        #22

                        You have several times in this thread more or less insisted on relating to (7-bit) ASCII and floppy disks. Noone else her care about either of those. If they are your frame of reference, then refer your experience to them. I don't care to. And I don't think it the effort to explain why not will be justified. I am not (and I guess there are a few others agreeing) are not demanding of you that you critically assess you choice of data formats and other solutions. You may go on as you please, with the formats that pleases you, with or without any critical evaluation. You are welcome.

                        L 1 Reply Last reply
                        0
                        • K kalberts

                          If you really want me to explain to you the difference between storing an integer, say, as a 32 bit binary number vs. storing it as a series of digit characters, bedayse "ASCII is bits, hence digital", then I give up. Sorry.

                          L Offline
                          L Offline
                          Lost User
                          wrote on last edited by
                          #23

                          Member 7989122 wrote:

                          If you really want me to explain to you the difference between storing an integer, say, as a 32 bit binary number vs. storing it as a series of digit characters

                          I didn't say that; and not going to explain either. I've no need to, nor any desire.

                          Member 7989122 wrote:

                          then I give up. Sorry.

                          :) Good timing. And please do.

                          Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                          1 Reply Last reply
                          0
                          • K kalberts

                            You have several times in this thread more or less insisted on relating to (7-bit) ASCII and floppy disks. Noone else her care about either of those. If they are your frame of reference, then refer your experience to them. I don't care to. And I don't think it the effort to explain why not will be justified. I am not (and I guess there are a few others agreeing) are not demanding of you that you critically assess you choice of data formats and other solutions. You may go on as you please, with the formats that pleases you, with or without any critical evaluation. You are welcome.

                            L Offline
                            L Offline
                            Lost User
                            wrote on last edited by
                            #24

                            Not with or without critical evaluation, but an education. One expects that a developer knows the different text-formats (and encodings, which is the same to you), data-formats, and date-formats. One who mixes those in a semantical bullshit argument gets called out. So damn right I will. Either play your cards or fold.

                            Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                            1 Reply Last reply
                            0
                            • N nedzadarek

                              XML is very verbose and JSON doesn't have extendable types.

                              L Offline
                              L Offline
                              Lost User
                              wrote on last edited by
                              #25

                              What does that have to do with anything? I merely pointed out that there are two existing, well tried and widely supported systems for data interchange. You can use them or not as you choose.

                              N 1 Reply Last reply
                              0
                              • L Lost User

                                :D They might not be efficient to you; but lots of us use them, both, where appropriate. Try to explain why XML isn't good enough, and to how many floppy-discs you're limited to that you need that optimization. Do elaborate, please.

                                Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                                N Offline
                                N Offline
                                nedzadarek
                                wrote on last edited by
                                #26

                                I don't mean that I won't use XML/JSON. I think they are not good enough so I still want to create my data notation. It's just me saying that this is off topic (I used stackexchange sites before) and I just don't want to discuss it any farther (as it doesn't bring anything to my first question).

                                1 Reply Last reply
                                0
                                • L Lost User

                                  What does that have to do with anything? I merely pointed out that there are two existing, well tried and widely supported systems for data interchange. You can use them or not as you choose.

                                  N Offline
                                  N Offline
                                  nedzadarek
                                  wrote on last edited by
                                  #27

                                  Well, pointing XML/JSON was off topic as well.

                                  L 1 Reply Last reply
                                  0
                                  • N nedzadarek

                                    Well, pointing XML/JSON was off topic as well.

                                    L Offline
                                    L Offline
                                    Lost User
                                    wrote on last edited by
                                    #28

                                    nedzadarek wrote:

                                    I want to create data notation (like JSON is used).

                                    So your mention of JSON in your original question was off topic?

                                    N 1 Reply Last reply
                                    0
                                    • N nedzadarek

                                      I want to create data notation (like JSON is used). 1) Is it good enough to use languages built-in features (types, notation etc), extend it (e.g. with another types), and output some JSON? 2) Or should I build it from scratch and parse all built-in features and add my additions then output it into JSON? By using 1) I don't have to implement core things. If there are fixes - then it's good. If there are changes that I don't like I can deal with them from case to case... I guess. Howerer I'm tied to a programming language - so users had to use the programming language (instead library). By using 2) I have to build everything but I'm not tied to one particular language. Maybe I can mix it ( 1) for the language, 2) for other languages). What are your toughts on this topic. ps. I was thinking about using the Red ( red-lang.org/ ). It's in alpha but I don't think it will change a lot.

                                      Richard DeemingR Offline
                                      Richard DeemingR Offline
                                      Richard Deeming
                                      wrote on last edited by
                                      #29

                                      Are you looking for something like protobuf?

                                      Protocol Buffers  |  Google Developers[^]:

                                      Protocol buffers are a language-neutral, platform-neutral extensible mechanism for serializing structured data.


                                      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                                      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                                      N 1 Reply Last reply
                                      0
                                      • L Lost User

                                        nedzadarek wrote:

                                        I want to create data notation (like JSON is used).

                                        So your mention of JSON in your original question was off topic?

                                        N Offline
                                        N Offline
                                        nedzadarek
                                        wrote on last edited by
                                        #30

                                        I don't want to waste time on your trolling.

                                        L 1 Reply Last reply
                                        0
                                        • N nedzadarek

                                          I don't want to waste time on your trolling.

                                          L Offline
                                          L Offline
                                          Lost User
                                          wrote on last edited by
                                          #31

                                          How is that trolling? As I said i made a couple of suggestions which you were free to ignore. I get the distinct impression (reading your other threads above) that you only came here for a fight.

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


                                          • Login

                                          • Don't have an account? Register

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