[ / / / / / / / / / / / / / ] [ dir / ausneets / fur / hisrol / htg / hypno / kc / russian / vg ][Options][ watchlist ]

/tech/ - Technology

You can now write text to your AI-generated image at https://aiproto.com It is currently free to use for Proto members.
Name
Email
Subject
Comment *
File
Select/drop/paste files here
Password (Randomized for file and post deletion; you may also set your own.)
* = required field[▶ Show post options & limits]
Confused? See the FAQ.
Expand all images

File (hide): 27220f6079cc4be⋯.jpg (91.3 KB, 500x618, 250:309, modern programmers.jpg) (h) (u)

[–]

 No.902501>>903261 [Watch Thread][Show All Posts]

I'm writing a networked program which can send and store data either in XML or JSON. I've already mostly finished it and it uses JSON, but it's not too late to change. What are some good reasons to use or not use it?

>pros:

>data size is smaller than XML without needing compression

>it's easier to read if formatted properly

>cons:

>it's jabbascript inspired

>no comments (not a big problem for my use case)

Pic somewhat related.

 No.902505

json is used everywhere by everything, your going to be forced to use it to interact with something at some point.

it works seamlessly with python, C on the other hand is fun to deal with. there's a bunch of c libraries to read it though. I just got done implementing cJSON, which was fun, but once you get the hang of it it's not that complicated.

i've never even bothered with xml, nothing i've interacted with required it over json, and json seems to naturally fit the data with no text bloat. i don't know why you would really want to represent data in html with custom tags.


 No.902506>>902507

fast but dont expect to use it in security oriented environments


 No.902507>>902511 >>904003

>>902506

Care to elaborate? How can it impact security?


 No.902511>>902512 >>902515 >>902520 >>902522 >>902535 >>902546 >>902736

>>902507

>>how can javascript based language impact security

are you 5


 No.902512

>>902511

JSON isn't javascript.


 No.902515

>>902511

JSON is not executable, and therefore cannot directly post a security risk. Furthermore I'm not using jabbascript as my programming language.

Yes, I did state "jabbascript inspired" as a disadvantage, but that was an autistic joke and not intended to be serious.


 No.902516

If you use XML then never make anyone interact with it directly. The syntax is so painful to interact with.


 No.902519

>>not an executable thus its secure

that is retarded


 No.902520>>902521

>>902511

Are YOU retarded?


 No.902521>>902523 >>902546 >>902736

>>902520

you have a childs understanding of security


 No.902522

>>902511

>>902518

why claim a security issue and post zero evidence there's a security issue. how about you post some proof nigger. right now it sounds like the only thing you know about json is from a jewgle search to figure out what it stands for.


 No.902523

>>902521

You have no argument.


 No.902524>>902526 >>902527 >>902528 >>902546

>>there isnt a security issue until you post an issue

lol


 No.902526

>>902524

>its insecure because it looks like javascript

lol


 No.902527

>>902524

>there's a security issue just because i say so on an imageboard with zero proof


 No.902528

File (hide): 2aea3f50d339bd4⋯.png (26.13 KB, 274x321, 274:321, hurr durr durr durr.png) (h) (u)

>>902524

What if I told YOU...

Your computer is compromised. Your mouse and keyboard beam data directly to the NSA. The NSA has developed a microscopic, zero-waste-heat nuclear power source sufficient to power a long range high penetration wireless transmitter inside every single transistor, so they can continue to broadcast microphone and camera recordings to the NSA even if they are switched off. The only way to escape this is to throw all electronic devices out of the window, stop posting on 8ch and spare everyone from your retarded babbling.


 No.902529>>902706

http://langsec.org

All you need is a parser that's proven to be correct and bug-free.


 No.902535

File (hide): e47c3c5e2d6eafe⋯.jpg (59.59 KB, 515x518, 515:518, 7853475894378503.jpg) (h) (u)


 No.902536>>902539 >>902546

>>just write everything in low level javascript based trash language because who cares

on it


 No.902539

>>902536

>hurr javascrip

Use CBOR then, you autistic retard.


 No.902540>>902543

>>use the same crap that has slightly different lineage

great


 No.902543

>>902540

It's an IETF standard, moron.


 No.902544

>>same crap different standard

wow what a fucking sea of change there columbus


 No.902546>>902547

File (hide): 0561ca6e14ee901⋯.jpg (118.94 KB, 720x858, 120:143, 0561ca6e14ee9012e6d1ad7f1e….jpg) (h) (u)

>>902511

>>902521

>>902524

>>902536

Nigger it's a simple data interchange format, not a fucking language. What do you suggest we use instead, fucking XML?


 No.902547

>>902546

Let's just stop replying to him.


 No.902558

Protobuf is more efficient.


 No.902563>>902568 >>903366

XML is dead, there is no reason to use it anymore, unless you are facing a particular edge case where you need XML, and if you were facing that case you would already know. So, use JSON.


 No.902564>>902565 >>902568

Why has no one in this thread mentioned namespaces? Does JSON have an extension for them?


 No.902565>>902567 >>902568

>>902564

Plus, I may be an XML nerd, but I think XML entities may have a handful of valid uses as well.


 No.902567>>902568 >>902569 >>902571 >>902621

>>902565

is there data that can be expressed in xml and not in json and vice versa?


 No.902568

>>902567

>>902565

>>902564

>>902563

As I wrote in the OP, I've already implemented my stuff using JSON. So there's no pressing reason to change, I was just curious whether XML would offer any advantages. (Also I'm autistic about getting things perfect, so there's that.)


 No.902569>>902571

>>902567

Well, this depends on what you mean by "expression." You can add semantics like comment:'foo' or namespace:'bar' to your personal JSON format, but in order to endow such user-defined extensions with broader (context-insensitive) qualitative distinction, you would have to effectively fork JSON as a whole, so for those extensions to have permanent functional behaviors (being ignored, raising exceptions, and so on.)


 No.902571

>>902569

>>902567

But, to reply more straightforwardly, if you're asking about the subset of "hierarchical expression of text structures," no, I don't think so, unless either format imposes some obscure limitations on field length limits or character encodings.


 No.902621

>>902567

XML assumes some sort of schema/validation, so if you want that, it might be a valid reason to use XML. I'm sure there are are tools for validation of JSON too, but I don't think it's as common.


 No.902706>>902737 >>902741 >>902761 >>902767 >>903248

>>902529

I looked at a couple of those papers because I thought maybe it would be about solving actual problems, or just copying how Multics and VMS did it, but it's more UNIX and C bullshit. Multics in the 60s was better than UNIX in 2018.

http://langsec.org/papers/Bratus.pdf

>What unites the printf ’s handling of the format string argument and an imple-

>mentation of malloc?

They're both bugs caused by C bullshit that wouldn't happen if you used a different language.

>The “weird instruction” primitives they supply to exploits.

>This strange conf luence is explained in “Advanced Doug Lea’s malloc Exploits” [5],

>which follows the evolution of the format string-based “4-bytes-write-anything-

>anywhere” primitive in “Advances in Format String Exploitation” [14] to the

>malloc-based “almost arbitrary 4 bytes mirrored overwrite,” for which the authors

>adopted a special “weird assembly” mnemonic,

>aa4bmo .

In the time it took to turn bugs into a “weird assembly” language, they could have done a whole bunch of things, like building a Lisp machine.

>Such primitives enable the writing of complex programs, as explained by Gerardo

>Richarte’s “About Exploits Writing” [13]; Haroon Meer’s “The(Nearly) Complete

>History of Memory Corruption” [8] gives a (nearly) complete timeline of memory

>corruption bugs used in exploitation.

Do you know what's funny about all this? That “weird assembly” language is probably a better programming language than C.

If there's one thing which truly pisses me off, it is the
attempt to pretend that there is anything vaguely "academic"
about this stuff. I mean, can you think of anything closer
to hell on earth than a "conference" full of unix geeks
presenting their oh-so-rigourous "papers" on, say, "SMURFY:
An automatic cron-driven fsck-daemon"?

I don't see how being "professional" can help anything;
anybody with a vaguely professional (ie non-twinkie-addled)
attitude to producing robust software knows the emperor has
no clothes. The problem is a generation of swine -- both
programmers and marketeers -- whose comparative view of unix
comes from the vale of MS-DOS and who are particularly
susceptible to the superficial dogma of the unix cult.
(They actually rather remind me of typical hyper-reactionary
Soviet emigres.)

These people are seemingly -incapable- of even believing
that not only is better possible, but that better could have
once existed in the world before driven out by worse. Well,
perhaps they acknowledge that there might be room for some
incidental clean-ups, but nothing that the boys at Bell Labs
or Sun aren't about to deal with using C++ or Plan-9, or,
alternately, that the sacred Founding Fathers hadn't
expressed more perfectly in the original V7 writ (if only we
paid more heed to the true, original strains of the unix
creed!)

In particular, I would like to see such an article
separate, as much as possible, the fundamental design
flaws of Unix from the more incidental implementation
bugs.

My perspective on this matter, and my "reading" of the
material which is the subject of this list, is that the two
are inseparable. The "fundamental design flaw" of unix is
an -attitude-, and attitude that says that 70% is good
enough, that robustness is no virtue, that millions of users
and programmers should be hostage to the convenience or
laziness of a cadre of "systems programmers", that one's
time should be valued at nothing and that one's knowledge
should be regarded as provisional at best and expendable at
a moment's notice.

My view is that flaming about some cretin using a
fixed-sized buffer in some program like "uniq" says just as
much about unix as pointing out that this operating system
of the future has a process scheduler out of the dark ages
or a least-common-denominator filesystem (or IPCs or system
calls or anything else, it -doesn't matter-!)


The incidental -is- fundamental in dissecting unix, much as
it is in any close (say, literary or historical) reading.
Patterns of improbity and venality and outright failure are
revealed to us through any examination of the minutiae of
any implementation, especially when we remember that one
cornerstone of unix pietism is that any task is really no
more than the sum of its individual parts. (Puny tools for
puny users.)


 No.902736

>>902511

>>902521

>thinks JSON is insecure

>doesn't know about entity vulnerabilities and escaping tags in XML

I hate LARPers


 No.902737

File (hide): a7a16f600797acc⋯.png (258.07 KB, 528x297, 16:9, 1444601700261.png) (h) (u)

>>902706

>thread about json

>unixhater fag still finds an excuse to ramble about Unix and Lisp

Bravo.


 No.902741>>903218

>>902706

Look I think Unix is flawed as well but what the fuck are you even talking about


 No.902761

>>902706

Reminder that you could solve all of your problems by creating a new LispOS yourself.


 No.902767>>903218 >>903261

>>902706

I would like to thank you for your posts. You've made me take a step back and actually see that C and Unix was not as good as I thought they were. Thanks to your posts I actually tried out Common Lisp (using ecl) and actually enjoy the language quite a bit. It just really clicks with me and is nice to work in.

Once again thanks for your posting.


 No.903218>>903248 >>903257

>>902741

>what the fuck are you even talking about

I'm talking about how much C and UNIX suck compared to other languages and operating systems. If a malloc has so many bugs that they can form their own assembly language, it sucks. Why does C suck so badly with its array pointer bullshit that you can't even add bounds checking?

Here's another example.

http://langsec.org/insecurity-theory-28c3.pdf

>Not for lack of trying

>Various "trustworthy computing" initiatives

>Lots of "secure coding" books

>Mounds of academic publications

>Yet software still sucks!

Software sucks because UNIX weenies don't care and they ignore all that stuff. A lot of security and error handling techniques were known in the 60s when Multics was created, but that didn't stop the UNIX programmers from ignoring them.

>There must be something we are doing wrong

>Science to engineers: some problems are not solvable, do not set yourself up to solve them

>"There is a law of nature that makes it so, no matter how hard you try"

What they're doing wrong is using C. C sucking is a law of nature and the problem of C sucking is not solvable, but that doesn't mean all software has to suck forever, only C software. C sucks so badly that people completely give up on trying to make software not suck. Some languages have the opposite effect.

>>902767

That's what I'm trying to accomplish. I post these quotes because most of them are still valid today. The UNIX weenie mentality hasn't changed at all. Common Lisp does a lot of things well and is a good general purpose language. An OS written in it would eliminate an enormous amount of bloat and waste that is part of every program now.

    Yes, and they've succeeded.  Hordes of grumpy C hackers
are complaining about C++ because it's too close to the
right thing. Sometimes the world can be a frightening
place.

I've been wondering about this. I fantasize sometimes
about building better programming environments. It seems
pretty clear that to be commercially viable at this point
you'd have to start with C or C++. A painful idea, but.
What really worries me is the impression that C hackers
might actively avoid anything that would raise their
productivity.

I don't quite understand this. My best guess is that
it's sort of another manifestation of the ``simple
implementation over all other considerations'' philosophy.
Namely, u-weenies have a fixed idea about how much they
should have to know in order to program: the amount they
know about C and unix. Any additional power would come at
the cost of having to learn something new. And they aren't
willing to make that investment in order to get greater
productivity later.

This certainly seems to be a lot of the resistance to
lisp machines. ``But it's got *all* *those* *manuals*!''
Yeah, but once you know that stuff you can program ten times
as fast. (Literally, I should think. I wish people would
do studies to quantify these things.) If you think of a
programming system as a long-term investment, it's worth
spending 30% of your time for a couple years learning new
stuff if it's going to give you an n-fold speed up later.


 No.903248

>>902706

>>903218

kill yourself rustnigger


 No.903257>>903832

>>903218

>What they're doing wrong is using C. C sucking is a law of nature and the problem of C sucking is not solvable, but that doesn't mean all software has to suck forever, only C software. C sucks so badly that people completely give up on trying to make software not suck. Some languages have the opposite effect.

yes. yes.

C could be good for things like making Quake game for hundred-Mhz computers. but it's horrible for developing operating systems, where you need security and reliability.

Why did UNIX idiots choose and keep using C instead of something like Ada? Yes, UNIX is older than Ada, but they kept using C instead of switching to something better. And if OS turned out to be slow, they could rewrite *some* parts in something faster and audit that parts very much.

but unix and open source idiots cannot into DESIGN and PLANNING. that's why they will always lose. linux is a big poop where random devs shit into.


 No.903258

> what are the shortcomings

There are none.


 No.903261

>>902501 (OP)

I think the biggest advantage of JSON is that it's human-readable. You can write a JSON file by hand in a text editor without problems, or you can take generated JSON and see what's inside.

The downside is that the JSON grammar actually has holes and it's never really clear which version of JSON one means.

http://seriot.ch/parsing_json.php

Being human-readable means that it's harder and slower to parse. If you don't need your data to be human-readable (e.g. when used for IPC) that's a pure downside. A good alternative would be MessagePack, it's similar to JSON, but binary, so it's smaller, simpler, and faster to parse.

https://msgpack.org/

The idea behind MessagePack is that you have a stream of binary data, and the first byte of each datum tells you immediately how to interpret the following data. For example, when reading and array, the first byte tells you what type of array it is, and when you know that you know how many bytes to read to get the size of the array, so you can allocate the necessary amount of memory, and then you read the actual content of the array. By contrast, in JSON you would first have to iterate through the list until you reach the closing bracket and count along the way to find out how long the array is.

>>902767

> tried out Common Lisp (using ecl) and actually enjoy the language quite a bit

You could have at least picked a Scheme, but Common Lisp is a Frankenstein monster that begs to be put out of its misery. Everything about the design of the language makes me rage. There is a beatiful language hidden somewhere under all that MIT autism.


 No.903351

Give one fucking example of a security vulnerability embedded in JSON, or never talk to me and my board again.


 No.903366>>903840

File (hide): 51c905f063739f8⋯.jpg (10.23 KB, 192x192, 1:1, 1002.jpg) (h) (u)

>>902563

>XML is dead

>what is pom.xml

I wish. Fucking pajeet Java Maven sand niggers won't let it ever die. Java programmer genocide when?


 No.903832

>>903257

Ada is a terrible language and no-one should use it.


 No.903840>>903927

>>903366

The problem with Maven isn't XML, and the best alternative being Gradle, you just swapping one declarative format for another (JSON).


 No.903927>>904070 >>905600

>>903840

I hate gradle. It just seems to be REALLY slow to do anything.


 No.904003>>904021 >>904057

>>902507

The traditional (stupid) way of parsing JSON is to eval() it in a Javascript interpreter. This is the accepted, canonical (stupid) way to do it. When people continue to do this, it opens up tons of security holes. Therefore, even stupider people will ban JSON rather than firing the incompetents under their care.


 No.904021

>>904003

>This is the accepted, canonical (stupid) way to do it.

I thought that was JSON.parse or something.


 No.904057

>>904003

No, the canonical way to parse JSON in javascript is to fucking JSON.parse() it. You have no idea what you're talking about, retard.


 No.904070>>904072

>>903927

A developer wrote some pretty deep and unnecessary hacks in a "Gradle Commons" project that the other projects inherit where I work.

Now every project is stuck, pinned on an ancient Gradle version for all time because nobody wants to go unravel that shit.

Still beats npm.


 No.904072>>905600

>>904070

You can't really compare npm and gradle as they differ in usage. You have to rerun gradle for every change which means that you have to wait for extremely long time for gradle to startup before it can compile and you can test out your changes. With npm at least you only have to run it when you are pulling down new packages.

I think there might be some sort of daemon or something you can get for gradle or maybe I'm just basing this off of an experience I had years ago with it, but I find it to take forever to do a regular compile.


 No.905600




[Return][Go to top][Catalog][Screencap][Nerve Center][Cancer][Update] ( Scroll to new posts) ( Auto) 5
56 replies | 5 images | Page ???
[Post a Reply]
[ / / / / / / / / / / / / / ] [ dir / ausneets / fur / hisrol / htg / hypno / kc / russian / vg ][ watchlist ]