I gave Blakeyrat advice when he didn't ask for it.
-
Scifi.SE is good for killing time, provided you can tolerate all the pendants incessantly arguing over plot holes.
-
Found a Stack Overflow question for @boomzilla
-
@Jaloopa The guy who answered this is pretty serious about keeping people off his lawn, but delusional about weed killer:
I would say to be off the lawn for at least 3-4 weeks.
-
@boomzilla maybe he has a lot of weed he needs to kill?
-
@Jaloopa said in Blakeyrat Reads StackOverflow While Bored At Work:
a lot of weed he needs to kill
why doesn't he just smoke it like normale people?
-
@Jaloopa Are you Blakeyrat? Get out of here with that shit.
-
@blakeyrat the topic is Blakeyrat Reads Stack Overflow. I'm giving you things to read
-
@boomzilla said in Blakeyrat Reads StackOverflow While Bored At Work:
@Jaloopa The guy who answered this is pretty serious about keeping people off his lawn, but delusional about weed killer:
I would say to be off the lawn for at least 3-4 weeks.
Pfft. That guy's trying to confuse the weedkiller, so what does he know?
-
@blakeyrat said in Blakeyrat Reads StackOverflow While Bored At Work:
@Jaloopa Are you Blakeyrat? Get out of here with that shit.
we're all blakeyrat. you're the one that didn't figure we have multiple personality disorder.
-
@blakeyrat said in XML Streaming Deserializer in C#:
@xaade said in XML Streaming Deserializer in C#:
But seriously, I've used SAX a lot; I'm surprised you don't know of it.
I don't work in XML very much. As should be obvious from this question.
I'd still much rather have a type-aware XmlReader, and I'm more than a little surprised that no such thing exists.
Then write one. Patent it. Realize that is no money in software patents and open source it. Then get pissed off at the community and piss all over it. Come back here and tell us how you trolled an entire industry. We would build statues in your likeness.
If you have access to the code it shouldn't be that hard serialize it. Much easier then fucking about in xml one would think. Less time consuming too.
-
@blakeyrat said in XML Streaming Deserializer in C#:
@xaade said in XML Streaming Deserializer in C#:
But seriously, I've used SAX a lot; I'm surprised you don't know of it.
I don't work in XML very much. As should be obvious from this question.
I'd still much rather have a type-aware XmlReader, and I'm more than a little surprised that no such thing exists.
Erm, that doesn't really work. As in it can't and still do it's job.
XmlSerializer is an application of XML. It generates XML that in many ways is specific to what that class knows. That's why you use the same class to serialize and deserialize. It's not a universal format, nor is it a format inherent to XML. It works because you use the same code on both ends, not because XML is inherently meaningful.
I mean, what did you think this was doing?
var serializer = new XmlSerializer(typeof(BlahSet));
This is you teaching XmlSerializer what your XML data file looks like and what those data objects are named and what types they have.
XmlReader, on the other hand, just knows how to parse XML. Any XML. It knows what elements and attributes are, how to validate a document. You could feed it MathML or HTML as well as XmlSerializer XML. There's no way to map attributes or elements to C# types, because that idea only makes sense to a class like XmlSerializer or a similar class or serialization library. XmlReader is too abstract or too generic.
It's like saying, "I want a System.IO.FileStream that automatically understands what format my video files are using so I don't have to figure it out." Well, no, you can't do that. FileStream doesn't implement that type of thing because it's a generic class meant for reading and writing all file streams.
-
@Groaner Oh, cool, this is my thread now!
-
@Groaner WTF happened to this thread? why is the XML thread here now?
-
@bb36e said in I gave Blakeyrat advice when he didn't ask for it.:
@Groaner WTF happened to this thread? why is the XML thread here now?
Hell if I know. I'm just the new OP. If I had to guess, I would say that this thread's title has something to do with it.
-
@Groaner It's not the title I suggested, which was much better.
-
You know, I did a little test with XMLSerializer.
I added a property to my class that wasn't in the XML.
I added a property to the XML that wasn't in my class.It didn't choke on either, so I'm not sure what you're going on about.
It's pretty universal.
-
@BaconBits said in I gave Blakeyrat advice when he didn't ask for it.:
I mean, what did you think this was doing?
It was..... not being as useful at the JSON serializer, which will either blindly interpret, or will add namespace/class information to every entry in a mixed array if you tell it to, so that it can deserialize mixed arrays.
Still not sure why XML is so much more difficult than JSON, it's just a few characters different.
-
@xaade said in I gave Blakeyrat advice when he didn't ask for it.:
Still not sure why XML is so much more difficult than JSON, it's just a few characters different.
It shouldn't be. But sometimes a design decision to make things slightly easier on one side can go a bit wonky on the other.
-
@bb36e said in I gave Blakeyrat advice when he didn't ask for it.:
WTF happened to this thread? why is the XML thread here now?
It's the thread full of advice jeffed out of Blakey's threads.
-
@xaade said in I gave Blakeyrat advice when he didn't ask for it.:
Still not sure why XML is so much more difficult than JSON, it's just a few characters different.
json is a serialization format; xml is a markup language. The purpose of json is to store data; the purpose of xml is to annotate documents. xml is entirely inappropriate as a serialization format. It doesn'teven have any concept of arrays. And xml properties are awkward to deal with — what if you've got a property on an element, and a tag with the same name? You can't even pretty print xml without getting a schema involved, because there's no way of knowing which whitespace is or isn't ignorable. Plus all of the tooling related to xml is total garbage. A client generated some wsdls for me using wcf, when I generated the java classes from them, wcf had added xsi:nillable to most of the element definitions, so instead of doing x.setVerboselyNamedElement(stringValue) I had to do x.setVerboselyNamedElement(objectFactory.createVerboselyNamedElement(stringValue)). Now obviously that's java's fault for being shitty, but the point is this shit would never have happened if we were using json.
-
@Buddy said in I gave Blakeyrat advice when he didn't ask for it.:
You can't even pretty print xml without getting a schema involved, because there's no way of knowing which whitespace is or isn't ignorable.
Bullshit; so long as the document is well-formed, you can pretty print it.
-
@RaceProUK said in I gave Blakeyrat advice when he didn't ask for it.:
Bullshit; so long as the document is well-formed, you can pretty print it.
not if the document encodes something that considers whitespace inside tags to be significant.
you'd be surprised at how much difference you can get out of an XHTML page when you pretty print it versus ..... is smushed printed a thing? yeah i'm going to call it that.... anyway you can really get a hugely significant difference in rendering when you pretty print XHTML vs not.
yeah, that's more the fault of the browser and the HTML standard than XML, but the XML standard does say that documents are allowed to treat any whitespace that is outside of a tag as semantically significant.
-
@accalia That's not a fault of XML itself, that's a fault of what's interpreting it
-
@RaceProUK lmgtfy.com
-
@RaceProUK said in I gave Blakeyrat advice when he didn't ask for it.:
@accalia That's not a fault of XML itself, that's a fault of what's interpreting it
yes, and then again no, see the spec says whitespace is allowed to be semantically significant, so it's not always legal to pretty print a document, as some documents will change their meaning when pretty printed.
thus it is not always safe to pretty print an XML document.
i consider this to be a misfeature of the spec, and believe that any document that
abuses this feature is a naughty document, but the fact remains that they are well formed, legal documents according to the XML spec.
-
@accalia No amount of XSD can stop someone pressing Ctrl + A Ctrl + K Ctrl + F
-
@RaceProUK said in I gave Blakeyrat advice when he didn't ask for it.:
@accalia No amount of XSD can stop someone pressing Ctrl + A Ctrl + K Ctrl + F
this is true.
but doing so in some documents alters their meaning. it's stupid, it's idiotic even, but the spec allows significant whitespace and some people just love to abuse the spec.
then again the sort of person who would design a document where whitespace is significant is also propbably the sort of person who would try to parse any SGML (of which XML is a subset) document with REGEX so pretty printed documents are probably the least of their worries.
-
-
@Buddy said in I gave Blakeyrat advice when he didn't ask for it.:
@RaceProUK lmgtfy.com
For the record, I did actually google that for you. Found a couple of articles that seemed to explain it pretty well. In the end I didn't post them, because I didn't want “helped someone better understand xml” on my conscience.
One of the things I have had to deal with was an xsl that converted xml data to csv. The entire xsl was stored as an element within wso2's configuration xml. Every time the server would restart, it would pretty print the document, leading to the newline character that was supposed to go at the end of each csv row being removed, as the xml formatter assumed it was ignorable whitespace.
-
@blakeyrat said in I gave Blakeyrat advice when he didn't ask for it.:
It's not the title I suggested, which was much better.
Unlikely.
-
@xaade said in I gave Blakeyrat advice when he didn't ask for it.:
You know, I did a little test with XMLSerializer.
I added a property to my class that wasn't in the XML.
I added a property to the XML that wasn't in my class.It didn't choke on either, so I'm not sure what you're going on about.
What value and data type did your class get back out when you deserialized the XML with the property that wasn't in the class you specified? Unless it's spitting out an ExpandoObject, I'm not sure how that would work once you try to cast the output of XmlSerializer.Deserialize into the class. That is, I'd expect this to work just fine:
serializer.Deserialize(blahXMLStream);
but I'd be surprised if this did:(BlahSet)serializer.Deserialize(blahXMLStream);
Or perhaps my question is, "What do you mean by 'doesn't choke'?" "Silently throws away properties that don't map to the class when deserializing XML" isn't what I'd call "not choking."
It's pretty universal.
That's not what I meant by universal.
So you couldn't serialize your Person class and give it to a totally unrelated application and it'd magically map your
Person.LastName
to the other guy'sPerson.Surname
. And not everything we represent in any arbitrary XML will be serializable into C# objects. Sure, yes, "everything is a string," but that's not exactly type-aware like serialization is supposed to be, is it? Think about things that are totally unrelated that XML is used to represent. Are you going to deserialize SVG or MathML and get something useful out of it? I mean, what happens when the SVG has two elipse elements?
-
@accalia said in I gave Blakeyrat advice when he didn't ask for it.:
but doing so in some documents alters their meaning.
It's because
<pre>
is a thing in HTML. We can beat around the bush a while, but that's the core of it. However, the default option for whitespace handling (unless a doctype or schema overrides) is to collapse whitespace. Feel free to reformat.
-
@dkf said in I gave Blakeyrat advice when he didn't ask for it.:
It's because
is a thing in HTML.
nope. it's because the spec allows semantic whitespace, as you later admitted wrt doctype and specs..
though the pre tag is the most notable "offender"
@dkf said in I gave Blakeyrat advice when he didn't ask for it.:
However, the default option for whitespace handling (unless a doctype or schema overrides) is to collapse whitespace
it should be the only option. use cdata escaping if you need semantic whitespace.
-
@accalia said in I gave Blakeyrat advice when he didn't ask for it.:
use
cdata escapingjson if you needsemantic whitespaceto serialize data.To my knowledge, xml does not distinguish between
<![CDATA[ ]]>
,
. If a tool preserves whitespace in xml just because it's in a cdata section, that is either a quirk or a bug.There are several issues with cdata that make it difficult to work with. A
goodrule of thumb I have seen is that cdata should only be used as a convenience when hand-generating xml.QualitySome tools will remove cdata sections as soon as possible, xml-encoding entities as appropriate.
-
@dkf said in I gave Blakeyrat advice when he didn't ask for it.:
HTML
This discussion is about xml, which is garbage. Html is ok, though the absence of / from self-closing tags does irk me.
-
@accalia said in I gave Blakeyrat advice when he didn't ask for it.:
nope. it's because the spec allows semantic whitespace, as you later admitted wrt doctype and specs..
You're mixing cause and effect.
HTML had
<pre>
, which could work because HTML is an application of SGML and allows all sorts of weird things. However, once the first version of HTML was done, it became clear that revisiting SGML to make it less abysmally complicated was a very good idea; that led to XML and eventually supporting HTML-like things (i.e., XHTML) was very much a use case that they would have considered. But they didn't want to make a mechanism that was only going to be special in one place, hence the birth of what's now thexml:space
attribute because generality.XHTML's
<pre>
is specified to havexml:space
fixed topreserve
.
-
Unrelated to this thread: does anyone get emails when the cooties detects NodeBB's shit itself? Because you must have been getting a lot of emails today.
-
@Lorne-Kates said in I gave Blakeyrat advice when he didn't ask for it.:
Unrelated to this thread: does anyone get emails when the cooties detects NodeBB's shit itself? Because you must have been getting a lot of emails today.
What the shitfuck @abarker ?
-
@Lorne-Kates Your post was in a @blakeyrat thread in the Look at Me category, and he flagged it for moving. So it got moved. No one else in this thread has complained.
-
@abarker said in I gave Blakeyrat advice when he didn't ask for it.:
@Lorne-Kates Your post was in a @blakeyrat thread in the Look at Me category, and he flagged it for moving. So it got moved.
Well maybe I'll flag to have it moved back. :|
-
@Lorne-Kates Oh come on.
You're not an infant, you know how this works by now.
If the topic had naturally veered in the direction of server monitoring emails, then fine. Sure. But you just posted that completely off-topic out of completely nowhere and, even worse, you admitted in the first couple words that you knew exactly what you were doing.
Fuck you.
-
@Lorne-Kates Won't work. The Look At Me category clearly states:
@boomzilla said in About the Look At Me! category:
This is a vanity category for people to post stuff like Ask Me Anythings.
Please respect the OP's ground rules in their topics.You broke the rules in a @blakeyrat Look At Me topic, your post got moved.
-
@blakeyrat said in I gave Blakeyrat advice when he didn't ask for it.:
@Lorne-Kates Oh come on.
You're not an infant, you know how this works by now.
If the topic had naturally veered in the direction of server monitoring emails, then fine. Sure. But you just posted that completely off-topic out of completely nowhere and, even worse, you admitted in the first couple words that you knew exactly what you were doing.
Fuck you.
Flagged for "offtopic"
-
@Lorne-Kates said in I gave Blakeyrat advice when he didn't ask for it.:
Flagged for "offtopic"
Dude, don't start. I'm finally making progress on training him to keep his "my thread" tantrums in the Look at Me category.
-
@blakeyrat said in I gave Blakeyrat advice when he didn't ask for it.:
Oh come on.
You're not an infant, you know how this works by now.Of all the ironic things you've said on this forum, this probably is the most unselfawarely ironic of them all. You the dark singularity at the heart of a black hole, calling #999999 black.
-
@blakeyrat said in I gave Blakeyrat advice when he didn't ask for it.:
You're not an infant, you know how this works by now.
So when someone makes a comment pointing out a NodeBB problem (uptime) in a thread about pointing out NodeBB problems... you know what, you are a whiny baby fucker. Can't wait for the "ignore thread" feature.
-
@Lorne-Kates said in I gave Blakeyrat advice when he didn't ask for it.:
about pointing out NodeBB problems
It's a thread about BLAKEYRAT pointing out NodeBB problems.
Make your own if you want one.
Threads don't cost money. They aren't locked behind some gamification shit. They're free. So there's no reason for you to be a jerk and shit all over someone else's thread instead of making your own.
(Of course I know why you don't make your own, it's because you're thinking: "Blakeyrat's popular and I'm not and if the thread has my icon next to it nobody will read it but everybody reads Blakeyrat's threads because he's so kewl." Which is all true, but cope.)
-
@RaceProUK said in I gave Blakeyrat advice when he didn't ask for it.:
@accalia No amount of XSD can stop someone pressing Ctrl + A Ctrl + K Ctrl + F
Go to start of line, kill the line, then go forward one character? Why would that be bad? :gnu-troll.elc:
-
@blakeyrat said in I gave Blakeyrat advice when he didn't ask for it.:
It's a thread about BLAKEYRAT pointing out NodeBB problems.
Make your own if you want one.Oh, so it's OK for you to give out unasked for advice but not other people?
-
@boomzilla said in I gave Blakeyrat advice when he didn't ask for it.:
@Lorne-Kates said in I gave Blakeyrat advice when he didn't ask for it.:
Flagged for "offtopic"
Dude, don't start. I'm finally making progress on training him to keep his "my thread" tantrums in the Look at Me category.
I don't think it's unreasonable to say that he's not allowed to throw tantrums in this specific thread, though. This is actually the one thread that should be explicitly exempt from him throwing tantrums because it's where all of the posts that he's thrown tantrums about get moved to so they won't bother him anymore.