Browsing 7239 questions and answers with Jon Skeet
This is broken code: criptato = new String(encodeFile, "UTF8"); The contents of encodeFile is not UTF-8-encoded text. It's not text in any encoding - it's arbitrary binary data. Don't convert the byte[] into a String using the String... more 6/26/2015 10:25:05 AM
After doing this: B A = new B(); ... the identifier A refers to the variable, not the class. To avoid that being a problem, just don't do that... What is going on here and if this is guaranteed could it be used for obfuscation in... more 6/26/2015 10:19:30 AM
how do they show exact 0.1 while debugging 0.1 isn't the exact value of the float. It happens to be what you specified in the original assignment, but that's not the value of the float. I can see it's confusing :) I suspect the... more 6/26/2015 6:41:04 AM
You're closing the connection at the end of parseColumnnames - so when you try to use it later on, it won't work... you can't use a closed connection. I would suggest you don't try to cache connections like this. Instead, rely on the data... more 6/26/2015 5:57:03 AM
So, for each entry, we have: A Solution element containing: An ID element Some Property elements containing: A Name element A Value element (optional) I would first transform the XML to that structure in memory, and then you can... more 6/25/2015 6:31:15 PM
I need to write <name> Dolce & Gabanna </name> in an xml file using java. No, you don't. Not unless you're trying to create an invalid file. Whatever code you're using is doing exactly the right thing - any XML parser... more 6/25/2015 4:35:30 PM
You've been passed an IEnumerable<string> - that means you can iterate over it. Heck, there's even a language feature specifically for it - foreach: foreach (string line in lines) { _queue.Enqueue(line); } Unlike your existing... more 6/25/2015 3:28:33 PM
I believe Convert.ToSingle will be able to handle any "core" numeric type you throw at it. more 6/25/2015 3:17:14 PM
U+0000 isn't whitespace, basically. char.IsWhitespace('\0') returns false, it's not listed as whitespace... The null part of IsNullOrWhitespace refers to the string reference itself - not the contents, if that's what you were thinking... more 6/25/2015 2:56:31 PM
You can easily create a method to return an "inverted" predicate - you could even make it an extension method: public static Predicate<T> Invert<T>(this Predicate<T> predicate) { // TODO: Nullity checking return... more 6/25/2015 1:29:34 PM