Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
Encryption is legit hard. It's so loving hard that it seems kinda sorta simple.

Add to that the dumbs who think that because they can't read it, it's encrypted.

Adbot
ADBOT LOVES YOU

Contero
Mar 28, 2004

Security by :effort:

tef
May 30, 2004

-> some l-system crap ->

Contero posted:

:stare:

I've seen this in a flight search api, because they struggled to get the xml to validate against their own schema.

beuges
Jul 4, 2005
fluffy bunny butterfly broomstick

Biowarfare posted:

Nah, that was base64 of the quoted post. I've actually seen it encapsulated in XML like three levels deep. And some people actually consider it encryption :psyboom:

I write embedded C for point of sale terminals (credit card readers with pinpads and displays essentially) for a bank as an external software vendor. The system which I've finally begun to rewrite uses xml over GPRS as its communications protocol. The xml structure is mostly plaintext, but the actual parameter values are encrypted using 3des with a MK/SK and then b64'd. Some of the parameters it downloads are xml configuration blobs. So, there's xml that's been encrypted and b64'd, which is then dumped into more xml as an element's value. Making the message parsing, decryption, and parsing the decrypted xml blob again all work within 256KB of effective userspace RAM was quite tricky...

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

beuges posted:

I write embedded C for point of sale terminals (credit card readers with pinpads and displays essentially) for a bank as an external software vendor. The system which I've finally begun to rewrite uses xml over GPRS as its communications protocol. The xml structure is mostly plaintext, but the actual parameter values are encrypted using 3des with a MK/SK and then b64'd. Some of the parameters it downloads are xml configuration blobs. So, there's xml that's been encrypted and b64'd, which is then dumped into more xml as an element's value. Making the message parsing, decryption, and parsing the decrypted xml blob again all work within 256KB of effective userspace RAM was quite tricky...

256k of ram? What monster uC are you using?

Contra Duck
Nov 4, 2004

#1 DAD

Contero posted:

:stare:

Yep, seen this one before :smith::hf::(

sklnd
Nov 26, 2007

NOT A TRACTOR

beuges posted:

The system which I've finally begun to rewrite uses xml over GPRS

We have a small uC and a tiny data pipe. I know, lets use XML! :psyboom:

hobbesmaster
Jan 28, 2008

Otto Skorzeny posted:

256k of ram? What monster uC are you using?

It looks like There are some ARM cortex SoCs with that kind of SRAM.
I've never even used a uC with 256kb of flash let alone RAM.

lamentable dustman
Apr 13, 2007

🏆🏆🏆

When doing defense contracting I wrote part of an experimental system that did real time XML updates (including base64 encoded pictures and videos in the XML!) to flying planes via a satellite or long range radio connection. Best case connection scenario was a directional radio beam.

I doubt that ever made it on to a plane.

raminasi
Jan 25, 2005

a last drink with no ice
So what is the correct use of XML? I'm going to get asked about it tomorrow and I know nothing about its best practices.

McGlockenshire
Dec 16, 2005

GOLLOCKS!
XML is for data transfer between different systems, usually in a way that can be validated for correctness.

MrMoo
Sep 14, 2000

i.e. http://en.wikipedia.org/wiki/Electronic_data_interchange

It's not for configuration files or for storing data which is what most muppets end up using it for. A recent discovery is using one XML tag with every configuration entity as an attribute. Added bonus of not being able not being able to insert comments between attributes. Consider 1,000+ lines of this:

code:
<config
  moo="cow"
  baa="sheep"
...
/>

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

GrumpyDoctor posted:

So what is the correct use of XML? I'm going to get asked about it tomorrow and I know nothing about its best practices.

XML was originally designed as an extensible document markup format, not as a data interchange format, and not as a data storage format. It didn't stop people from using it as either of those things. If you're going to get asked about it tomorrow, talk about data interchange, as that's widely considered the "accepted" use.

nielsm
Jun 1, 2009



Like it was discussed above, the actual place to use XML is for structured text markup, it only truly excels when it makes sense to have text and tags interspersed.

If your data must follow a very rigid structure where only very specific elements can be contained in other very specific elements and text nodes are generally only used at the innermost level (or not at all), then XML is probably the wrong choice. (Use JSON, Yaml, or even INI files, instead.)
If your data are mostly free-form and the elements allow for mostly free-form nesting, and meaning/intent is expressed through the choice of how to put text and tags inside other tags, then XML is probably a decent choice.

But it's questionable whether that's what an interviewer or professor wants to hear.

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

MrMoo posted:

It's not for configuration files or for storing data which is what most muppets end up using it for.
Developers use it for those things because it provides code reuse advantages over what was done before, namely defining a binary or otherwise ad hoc format. Trying to confine a technology to some historical vision is generally a losing bet.

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Gazpacho posted:

Developers use it for those things because it provides code reuse advantages over what was done before, namely defining a binary or otherwise ad hoc format. Trying to confine a technology to some historical vision is generally a losing bet.
It was used for that before JSON was discovered, and that's why it's still popular. It's not even bad at it, it's developer readable, and depending on how much metadata you have for your format, frighteningly easy to debug.

nielsm
Jun 1, 2009



BonzoESC posted:

It was used for that before JSON was discovered, and that's why it's still popular. It's not even bad at it, it's developer readable, and depending on how much metadata you have for your format, frighteningly easy to debug.

XML is also impressively easy to mess up on. I've seen software crash because there was whitespace between tags, which caused text nodes to be generated in the DOM tree where it expected another element.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
If you ever write an XML parser yourself you are doing something horribly wrong and should stop before you hurt someone.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Jabor posted:

If you ever write an XML parser yourself you are doing something horribly wrong and should stop before you hurt someone.

What if you're writing an XML parser for compatibility with a broken XML parser in a commercial product?

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

Suspicious Dish posted:

What if you're writing an XML parser for compatibility with a broken XML parser in a commercial product?

Well, then you're not really writing an XML parser, are you?

You're writing a parser for a DSL that just happens to look superficially similar to XML.

hobbesmaster
Jan 28, 2008

Jabor posted:

If you ever write an XML parser yourself you are doing something horribly wrong and should stop before you hurt someone.

Hell, I would go so far as to say that an overwhelming majority of coding horrors are a result of rolling your own stuff instead of using library functions.

Unless you're using php. In that case, :suicide:

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Jabor posted:

Well, then you're not really writing an XML parser, are you?

You're writing a parser for a DSL that just happens to look superficially similar to XML.

That's how I'll think of it from now on. Even though we're reimplementing an API called "XML".

(If you're curious, the Flash XML parser is extremely loving broken. We initially were using libxml2, but stopped.)

karms
Jan 22, 2006

by Nyc_Tattoo
Yam Slacker

Suspicious Dish posted:

(If you're curious, the Flash XML parser is extremely loving broken. We initially were using libxml2, but stopped.)

I remember when XML got introduced to flash, it was slow. It was so slow in fact that a homerolled actionscript version was remarkedly faster than the native approach.

This was in flash 5. Good to see adobe still hasn't quite gotten XML parsing yet.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

KARMA! posted:

Good to see adobe still hasn't quite gotten XML parsing yet.

If you're curious, you can read their XML parser, as they opened it as part of Tamarin: XMLParser16.cpp (yes, that filename means your fears are real)

Jonnty
Aug 2, 2007

The enemy has become a flaming star!

BonzoESC posted:

before JSON was discovered

I like this idea that markup languages are "discovered." I suppose it makes sense if you consider the space of markup languages which represent the same things as JSON does as a countably infinite set from which JSON merely needed to be picked out, though I think if you use that then the definition of "discover" starts to break down...

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.

Suspicious Dish posted:

If you're curious, you can read their XML parser, as they opened it as part of Tamarin: XMLParser16.cpp (yes, that filename means your fears are real)
code:
// !!@ I'm not sure what this was supposed to do originally but I've rewritten it
:buddy:

Huragok
Sep 14, 2011
:siren: Jeff Atwood strikes again! :siren:

El Jefe posted:

The upside is that once you enable [two-factor authenitcation for GMail], your email becomes extremely secure, to the point that you can (and I regularly do) email yourself highly sensitive data like passwords and logins to other sites you visit so you can easily retrieve them later.

good jovi
Dec 11, 2000

'm pro-dickgirl, and I VOTE!

In a case of strange coincidence (or not), here's Crockford talking about "discovering" JSON: http://inkdroid.org/journal/2012/04/30/lessons-of-json/

Optimus Prime Ribs
Jul 25, 2007

code:
thisLocation = "http://www.****.com/custom_events/****-20120209/site/";
function facebook () 
{
	var randomnumber=Math.floor(Math.random()*9999);
	window.open ("http://www.facebook.com/sharer.php?u=" + thisLocation );

}

function twitter () 
{
	mylink = thisLocation;	
	window.open ("http://twitter.com/home?status=Currently watching : " + mylink);

}
I'm not really sure what this person was thinking...

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
It makes no sense because those functions used to do other things and they've since been mostly trimmed to their current functionality but it works despite making no sense; fortunately you can check earlier versions to see what the functions did and who changed them into this mess so I'm sure it'll be no trouble at all to sort everything out.

cue lack of version control
cue rousing orchestral celebration of incompetence

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

pokeyman posted:

cue rousing orchestral celebration of incompetence

What would you recommend as the inverse of Fanfare for the Common Man? Chicken on the Rocks?

Toady
Jan 12, 2009

GrumpyDoctor posted:

So what is the correct use of XML? I'm going to get asked about it tomorrow and I know nothing about its best practices.

It's a language for generating markup languages.

Bhaal
Jul 13, 2001
I ain't going down alone
Dr. Infant, MD
I've been in maintenance programming hell the past week as I had to: A) find and fix horrible security flaws in one antique but still active site, and B) thud and blunder through another even older piece of software that is suckled onto our main app like a lamprey, so that I can gain enough understanding of its internals to properly clone all the functionality we want out of it and eventually migrate all data into this new section of our own app that I'm designing*.

That Chicken on the Rocks actually makes these tasks a little more endurable. I might have to make a "Bad code expedition" playlist with stuff like that and maybe the Cash for Gold song from southpark.

* It's not reinventing the wheel, I swear. It's more like kicking a rectangular table over and using it as a wheel. It's elimination of a huge technical debt that was docked onto our software long ago when time to market was critical and IT resources were thin and stretched. Now that the business has reaped short term gains from that move in their first couple years, it's time to mitigate the long term losses because in production it takes endless man hours to get anything done in that beast. And constructing accurate reports? Their super terrible schema makes it feel like you're reading tea leaves.

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Jonnty posted:

I like this idea that markup languages are "discovered." I suppose it makes sense if you consider the space of markup languages which represent the same things as JSON does as a countably infinite set from which JSON merely needed to be picked out, though I think if you use that then the definition of "discover" starts to break down...

It's not that they're all discovered, it's that somebody realized that the object literal notation in JS could be general-purpose.

Jonnty
Aug 2, 2007

The enemy has become a flaming star!

BonzoESC posted:

It's not that they're all discovered, it's that somebody realized that the object literal notation in JS could be general-purpose.

Oh. Fair enough. I'm still gonna stick to my definition though...

Zombywuf
Mar 29, 2008

BonzoESC posted:

It's not that they're all discovered, it's that somebody realized that the object literal notation in JS could be general-purpose.

And slowly the world caught up with Perl...

tef
May 30, 2004

-> some l-system crap ->

Internet Janitor posted:

What would you recommend as the inverse of Fanfare for the Common Man? Chicken on the Rocks?

https://www.youtube.com/watch?v=hpJ6anurfuw

HappyHippo
Nov 19, 2003
Do you have an Air Miles Card?
I used XML for a config file because the data is very basic and C# has built in libraries for serializing/deserializing it. Am I a bad person? :ohdear:

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

HappyHippo posted:

I used XML for a config file because the data is very basic and C# has built in libraries for serializing/deserializing it. Am I a bad person? :ohdear:

Was there a particular reason .ini wouldn't work?

Adbot
ADBOT LOVES YOU

HappyHippo
Nov 19, 2003
Do you have an Air Miles Card?
I'd have to write my own parser? Right now it's "deserialize this file -> now I have an object with the info" where the deserialization is built in. It also seems (to me) more extensible in the future with less effort.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply