Browsing 7239 questions and answers with Jon Skeet
The String generated for iteration 1 is no longer needed in iteration 2 and its storage space can be freed. I believe that is not happening here. It definitely is happening. You're creating 100 million strings, each of which is at... more 4/30/2014 5:43:38 AM
It seems to me that Database shouldn't be within BaseConfig<T> anyway - it should be a top-level class. You don't really want different types for BaseConfig<Foo>.Database, BaseConfig<Bar>.Database etc, do you? That's the... more 4/29/2014 12:32:12 PM
You're using YYYY which is the week year. You mean yyyy, which is the year. Just change your format to: SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); The YYYY format specifier is rarely used, and when it is used, it should... more 4/29/2014 12:07:33 PM
You haven't said what you want to happen if the direction isn't any of those values. Maybe that's currently the full set of directions, but in the future it may not be - and fundamentally the Java compiler doesn't check that you've covered... more 4/29/2014 11:31:34 AM
No, there's only one GUI thread - so you'll end up with the invoked delegates effectively being queued up to execute serially. If there were multiple GUI threads you would indeed have a race condition here - but you're fine with all the UI... more 4/29/2014 10:49:54 AM
You're calling executeQuery on something that isn't a query. But instead of calling execute with the same SQL, you should use a PreparedStatement: String sql = "insert into highscore (score) values (?)"; try (Connection conn =... more 4/29/2014 10:13:28 AM
I would just change it to: var query = s.Elements("ElementOne").Elements("ElementTwo") .Select(c => (int?) c.Attribute("Id") ?? 0); (Unless you really need the anonymous type, why bother with it?) If there are no... more 4/29/2014 9:07:00 AM
Well, I'd add new project configurations, and set the build type for each configuration, along with the output directory. So you might have "Debug x86" and "Debug x64" project configurations, with output directories of "bin\DebugX86" and... more 4/29/2014 8:39:32 AM
I suspect the problem isn't spamScore being null - it's the value in the map being null, because you haven't populated the map. You're then trying to unbox that null reference to an int, and that fails. So think of your code like... more 4/29/2014 6:58:42 AM
You can use ToDictionary to create a dictionary - but that won't actually achieve what you want. A Dictionary<,> simply isn't a sorted data structure. The ordering should not be relied on. Even though the current implementation may... more 4/29/2014 6:32:29 AM