|
Bahahaha .net doesn't come with an ini parser. That's awesome.
|
# ? May 1, 2012 01:05 |
|
|
# ? Jun 10, 2024 13:03 |
|
Spring is the devil for XML configuration. It's basically like writing code, except it's not type-checked, spell checked, or anything else. So you have potentially thousands of lines of 'configuration', where if something is wrong it can silently (or noisily) blow up at some unspecified time in the future. Additionally, here are a couple real pieces of XML we get back from a Nortel CS1000 webservice call: code:
code:
|
# ? May 1, 2012 01:08 |
|
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? There is also a built in JSON parser so you could go that direction if you desired.
|
# ? May 1, 2012 01:11 |
|
pokeyman posted:Bahahaha .net doesn't come with an ini parser. That's awesome. Jesus Christ I just assumed there was one cause win32 C API has GetPrivateProfileString/Int.
|
# ? May 1, 2012 01:14 |
|
etcetera08 posted:There is also a built in JSON parser so you could go that direction if you desired. Have a good example of one because every json config file looks like a XML one to me with quotes tracking instead of tag tracking. Either way I prefer a properties file for my configuration
|
# ? May 1, 2012 01:24 |
|
etcetera08 posted:There is also a built in JSON parser so you could go that direction if you desired. Unfortunately they both (yup there's more than one) blow and the one that blows less isn't available in the client profile.
|
# ? May 1, 2012 02:08 |
|
I used to bitch about old school EDI file formats (hard white space, type enforcement, magic numbers) but after having to try and untangle some of the grottier XML implementations I've seen I almost miss them.
|
# ? May 1, 2012 02:16 |
|
Kilson posted:The whole thing is like this, going on for several hundreds or thousands of lines. It's almost completely flat, and everything is an abbreviation or acronym of some kind. Oh, the product also had different defaults for escaping HTML entities at different stages of its lifetime, so you can find both & and & in the "tags". When stuff like this breaks the indexer the company says that it is "user error" because after all, you entered the data that way! (We don't edit the XML directly, you use their proprietary client).
|
# ? May 1, 2012 02:47 |
|
trex eaterofcadrs posted:Jesus Christ I just assumed there was one cause win32 C API has GetPrivateProfileString/Int. .ini format is terrible anyway.
|
# ? May 1, 2012 04:22 |
|
Reposting this because I don't know if there is a better way:MasterSlowPoke posted:I'm coding an app that reads data from user generated, but otherwise static, XML files like this one:
|
# ? May 1, 2012 04:27 |
|
gibbed posted:Which are deprecated and are only present for compatibility with 16-bit applications. That's why I put everything in the registry! (Qt )
|
# ? May 1, 2012 04:37 |
|
hobbesmaster posted:That's why I put everything in the registry! The core idea of the registry isn't a bad one. If you have some other process that changes a setting, you can get a notification that the key was changed, and update your behavior. Unfortunately, it's a terrible execution, leading to everybody just doing their own thing. Fun fact: did you know Steam invented their own binary format that emulates the Windows registry for some reason, including the STRING/DWORD/BINARY mess?
|
# ? May 1, 2012 04:41 |
|
Suspicious Dish posted:Fun fact: did you know Steam invented their own binary format that emulates the Windows registry for some reason, including the STRING/DWORD/BINARY mess? Also I don't see how it emulates the Windows registry.
|
# ? May 1, 2012 04:51 |
|
One time, while porting a Win32 C++ server app to Linux, I helped a guy implement the Windows registry API using XML and Xerces complete with key change notifications through inotify. I still feel pretty dirty about this.
|
# ? May 1, 2012 04:52 |
|
Just had a client tell me I was an idiot because I should be catching "the generic Java catch-all exception - NullPointerException - in my code." The error message he's seeing is coming from javascript. In his browser. In a totally different web application. This man is the lead developer at a very large institution.
|
# ? May 1, 2012 05:24 |
|
Suspicious Dish posted:If you have some other process that changes a setting, you can get a notification that the key was changed, and update your behavior.
|
# ? May 1, 2012 05:24 |
|
gibbed posted:Which are deprecated and are only present for compatibility with 16-bit applications. Well in my defense Win95 was big when I was last writing win32 software. And sure .ini isn't as good as simple properties files but it's a far cry better than xml for configuration.
|
# ? May 1, 2012 05:30 |
|
gibbed posted:Are you talking about VDF? It's not just a binary format if you're talking about that. No, I'm talking about the format that ClientRegistry.blob is in. It's a custom binary format, magics 0x5001 (uncompressed) and 0x4301 (zlib compressed). I don't think the format has been written up before. I, along with a few other people, reverse engineered it, so let me write a bit about it. Basically, there's two formats in play here. There's the blob format, which is a nested binary format - a blob has a bunch of key/value pairs, and the value may itself be a blob, with magic and everything (yes, this means that you can nest zlib compressed blobs). On top of that is the registry format, which uses blobs as storage. In the top-level blob there is a key calle, TopKey, which points to a RegistryKey. A RegistryKey has children blobs 1 and 2 (keys are longs, \x01\x00\x00\x00, \x02\x00\x00\x00). Blob 1 contains the subkeys. Blob 2 contains RegistryValues. A RegistryValue has children blobs 1 and 2. Blob 1 has the value's type as a long. 0 is STRING, 1 is DWORD, 2 is BINARY. Blob 2 contains the value. Here's some Python code I wrote a while ago:
https://github.com/magcius/pysteam/blob/master/pysteam/registry.py It's quite messy and most of it was written before I was proficient with Python.
|
# ? May 1, 2012 07:17 |
|
Otto Skorzeny posted:256k of ram? What monster uC are you using? The device actually has 1MB of ram. 512KB gets used by the manufacturer's OS. The other 256KB is available for code, stack and heap. My builds are around the 256KB mark, leaving 256KB to actually play around with. The fun part is that the heap just grows up from where your codespace ends, and the stack just grows down from the 1MB maximum, meaning a huge malloc can overwrite your stack, or a huge call stack can overwrite stuff on your heap. Also, if you try to malloc more memory than you have available, it just segfaults instead of returning null.
|
# ? May 1, 2012 07:36 |
|
Suspicious Dish posted:No, I'm talking about the format that ClientRegistry.blob is in. It's a custom binary format, magics 0x5001 (uncompressed) and 0x4301 (zlib compressed). I don't think the format has been written up before. I, along with a few other people, reverse engineered it, so let me write a bit about it. I would love to hear the story from Valve about why the hell they did this.
|
# ? May 1, 2012 17:24 |
|
Suspicious Dish posted:No, I'm talking about the format that ClientRegistry.blob is in. It's a custom binary format, magics 0x5001 (uncompressed) and 0x4301 (zlib compressed). I don't think the format has been written up before. I, along with a few other people, reverse engineered it, so let me write a bit about it. I deal with it in a passive way (I wrote code for it ages ago, but no longer use that). Thermopyle posted:I would love to hear the story from Valve about why the hell they did this.
|
# ? May 1, 2012 17:40 |
|
pokeyman posted:Bahahaha .net doesn't come with an ini parser. That's awesome. Or a CSV parser. Thermopyle posted:I would love to hear the story from Valve about why the hell they did this. Mac and Linux ports, obviously
|
# ? May 1, 2012 17:44 |
|
Thermopyle posted:I would love to hear the story from Valve about why the hell they did this. Even better: Some of their new protocol stuff uses compression. Which they do by placing the data into a .zip file. No, not just a DEFLATE block, a full zip file with headers and stuff. And the file inside the .zip containing the original data is just called "zip".
|
# ? May 1, 2012 18:06 |
|
Funnily enough Python has an ini-ish parser in its standard library.
|
# ? May 1, 2012 18:08 |
|
I know it's not nice to make fun instead of helping, but goddamn.
|
# ? May 1, 2012 19:05 |
|
Hammerite posted:I know it's not nice to make fun instead of helping, but goddamn. Oh god the varchar(2) that he will most assuredly use as the item count. 99 Erasers is enough for anyone!
|
# ? May 1, 2012 19:27 |
|
Hammerite posted:I know it's not nice to make fun instead of helping, but goddamn. The best part is (well, was) the guy with 22k reputation who comes in and says "I don't see any injection here nosiree" and then taking down his comment and question after you pointed out he doesn't know PHP for poo poo. It'd be kind of interesting if SO only displayed your reputation garnered for the tags relevant to the question you were answering. The worst part is that I kind of envy his blissful ignorance
|
# ? May 1, 2012 19:32 |
|
pokeyman posted:Bahahaha .net doesn't come with an ini parser. That's awesome.
|
# ? May 1, 2012 19:39 |
|
Geekner posted:Oh god the varchar(2) that he will most assuredly use as the item count. 99 Erasers is enough for anyone! I didn't know whether to be more offended by the database design or the injection vulnerability.
|
# ? May 1, 2012 19:44 |
|
JSLint has a new option: "tolerate stupidity" What it does is that it without it, JSLint will warn about properties containing the substring 'Sync'. I think I'll fork JSLint and rename all the options. The option to tolerate ++ will be renamed to "tolerate poopyheadedness" and the option to tolerate != and == will become "tolerate being a fartface"
|
# ? May 1, 2012 19:47 |
|
Wheany posted:JSLint has a new option: "tolerate stupidity" Um? What is this for?
|
# ? May 1, 2012 19:52 |
|
Suspicious Dish posted:Um? What is this for? http://tech.groups.yahoo.com/group/jslint_com/message/2835 Douglas Crockford posted:JSLint now warns when properties contain the substring 'Sync'. The use of that
|
# ? May 1, 2012 19:53 |
|
Douglas Crockford's shtick is really getting old.
|
# ? May 1, 2012 20:03 |
|
MasterSlowPoke posted:Reposting this because I don't know if there is a better way: If these are being generated by the public, especially if the node structure your software is expecting is very dynamic and/or specific to its requirements, hand editing XML like that can be a real pain especially for end users. (That being said, I don't think hand editing in any format, JSON, YAML, or whatever will be any better in this situation). For instance, if your software encounters node N, say it needs at minimum child nodes X, Y, Z defined, and say it's parsing a user submitted a document with a Node N with only X and Y defined. Do you have a fancy system of defaults to fill in any gaps, or will your internal data structures be incomplete without Z defined externally? If the latter, you'll want to make it easy for them to spot and fix this. One solution is you could offer a validator so they can quickly fix any mistakes right away. User generates the document, runs it through the validator (web tool or whatever), and it comes back with "Hey dummy! Node N at line 123 needs child node Z defined!". A better solution, though involves a lot more dev time, is to make an editor for them. It's on the fly validation as you can have the editor demand input where input is required, generate required child nodes and so on, so your user doesn't get lost in the weeds on your data structures. Also they don't have to worry about syntax or any of that meta data and instead just fill in the pertinent stuff. You could do this in a native app or make a page that builds out form elements with js/jquery/etc, submits to your server, and you feed them back the resulting xml. Note: I don't know how much use those xml documents will see from your userbase, though, so putting in the time to make a tool like this may not be an efficient sub-project to work on if you don't anticipate a lot of user generated documents. If 1 in 10 of your dedicated userbase will ever seriously dabble in it, maybe it's best to provide clear documentation & examples and leave it at that. Bhaal fucked around with this message at 20:29 on May 1, 2012 |
# ? May 1, 2012 20:26 |
|
Suspicious Dish posted:What if you're writing an XML parser for compatibility with a broken XML parser in a commercial product? We have a vendor application that uses some lovely old encoding format in all its xml style sheets so anything that isn't part of whatever character set was hip back in 1980 or whenever (such as "foreign hyphens") causes it to vomit out a stream of random characters converted from raw hex all over the place. What was the vendors response when we told them that they needed to change it to support UTF-8 because we're an international firm and get all sorts of crazy poo poo entered in to our systems? "The XML is working as intended, if you have a problem with it, we suggest you take it up with Microsoft".
|
# ? May 1, 2012 23:48 |
|
Back when I was a lowly undergrad, I spent a semester maintaining and adding some features to our crufty old automated grading system that we used in some of our intro C++ courses. One of the things I dealt with was the result reports that get generated for students and instructors. Not knowing any better at the time and wanting to make use of "hip new technologies", I had the servlet generate the report in XML format that was then converted to HTML using an XSLT processor when the user requested it My shame...
|
# ? May 2, 2012 01:01 |
|
Munkeymon posted:The best part is (well, was) the guy with 22k reputation who comes in and says "I don't see any injection here nosiree" and then taking down his comment and question after you pointed out he doesn't know PHP for poo poo. It'd be kind of interesting if SO only displayed your reputation garnered for the tags relevant to the question you were answering. I started on SO during beta, and continued until a month or two after (when it had been overrun with horrible people). Despite having not seriously used it in almost three years, my reputation continues to go up, I keep getting all sorts of badges, and I've only dropped from page one to page seven on the user list. My single top-scoring answer of all time is the difference between self and $this in PHP. My second highest is how to cancel a setInterval call in Javascript. Basically, StackOverflow's reputation is merely a metric of how common the questions are that you answer. If you spend an hour researching the answer to a thoughtful and interesting question, expect to get ~maybe~ 30 karma out of it. But if you rush for every "help how do I codes" question and drop a vaguely-related solution, you'll be rolling in karma forever.
|
# ? May 2, 2012 02:08 |
|
Janin posted:Stack overflow's reputation system is completely broken. If you meet someone with a high stack overflow reputation, chances are they'd make a great copy editor. It is a game that rewards those who can cannibalise other peoples answers into a way that garners approval from the idiot who can't google.
|
# ? May 2, 2012 02:31 |
|
Fren posted:Douglas Crockford's shtick is really getting old. Yep. Go look at his commit messages. They're all terrible. I shouldn't have to explain what commit messages are for to someone like Douglas Crockford: they're there to summarize a change, and more importantly, detail why it changed. In this commit, what happened? Did JSLint crash? Did it give a false positive warning? Maybe it identified a real error, but botched up its error reporting output? Now go look at the license. Despite evidence to the contrary, it is not an open-source license, as it contains the clause "This software should be used for good, not evil", and Crockford has the exclusive privilege of deciding who is good and who is evil. Crockford doesn't accept changes from others, instead opting to duplicate work in his own name. He has never merged a single pull request from others. Take this pull request for example. He closed the request, said "Thanks", and then fixed it on his own along with a ton of other changes in a commit so big GitHub won't show a diff online, with the helpful commit message "comments". (You can compare the two files at the commit vs. the parent, or generate a diff offline to verify this is the case)
|
# ? May 2, 2012 02:32 |
|
|
# ? Jun 10, 2024 13:03 |
|
Read the JSON rfc sometime, and see if you don't go wat.quote:To escape an extended character that is not in the Basic Multilingual
|
# ? May 2, 2012 02:35 |