Browsing 7239 questions and answers with Jon Skeet
I'd just use the selection methods within LINQ to XML instead: XElement fname = country.Element("country") .Elements("city") .Elements("major") .Where(x =>... more 10/31/2013 7:23:50 AM
It's executed as part of a constructor. The code executed within a constructor is just normal code - there's no odd control flow there. (I mean after the call to the superclass constructor, and the variable/instance initializers being... more 10/31/2013 7:12:48 AM
Yes, SelectSingleNode("recordsDirectory") will return null, because you're applying that XPath to the document itself - which doesn't have a recordsDirectory element at the top level, it has a configuration element. You... more 10/31/2013 7:08:11 AM
This is the problem: URLDecoder.decode("url", "UTF-8") That should be: URLDecoder.decode(url, "UTF-8") Otherwise you're decoding the literal "url" - which will decode to itself ("url") - and the string "url" doesn't contain any... more 10/31/2013 6:59:04 AM
You can use Thread.join() to basically block one thread until another thread terminates: // In thread B threadA.join(); doStuff(); Note that this won't work properly if you use a thread pool e.g. via an executor service. If you need to... more 10/31/2013 6:45:52 AM
Yes, that should be absolutely fine, so long as the method isn't using/modifying any shared mutable state, and you only call it within normal servlet processing - so each thread that calls it will be passing in the request/response that... more 10/30/2013 9:04:51 PM
Your linked list is only singly linked - each item contains a reference to the next item, but not the previous one. You can't walk backwards through a list like that. (Not without effectively building another collection with all of the... more 10/30/2013 9:01:40 PM
Yes, that would show the same value in every case (or milliseconds apart) because the three calendars all refer to the same instant in time (execution time notwithstanding) and that's all that a java.util.Date represents. That's the result... more 10/30/2013 9:00:04 PM
No, they'll be compiled to absolutely identical IL. The using directive (there's no such term as "namespace accessor") is just a way of telling the C# compiler that it should look in that namespace when trying to resolve simple names to... more 10/30/2013 5:49:58 PM
Look at this loop: while(fgets(buffer, BUFFERSIZE, stdin) != NULL){ text[i] = buffer; i++; } You're setting every element of your array to the exact same value: the value of buffer, which is a pointer to a piece of memory. On... more 10/30/2013 5:45:44 PM