Browsing 7239 questions and answers with Jon Skeet
Stop converting the values to strings and back. A java.sql.Timestamp already is a java.util.Date: long now = System.currentTimeMillis(); while (rs.next()) { Timestamp ts = rs.getTimestamp("HIGH_VALUE"); long diff = ts.getTime() -... more 8/11/2014 4:18:16 PM
The main problem is that you've got a generic method instead of a generic interface. That doesn't make a lot of sense. As soon as you make the interface generic instead, it works: @FunctionalInterface interface Pro<T> { void... more 8/11/2014 2:22:27 PM
Sounds like you want to group by ID and then convert to a dictionary, so that you end up with one dictionary entry per ID: var dictionary = entries.GroupBy(x => x.ID) .ToDictionary(g => g.Key, ... more 8/11/2014 1:51:41 PM
This line: if (s1 == s2) compares the values of the variables s1 and s2. Those values are just references. In other words, it's asking whether the values of s1 and s2 refer to the same object. They clearly don't, in this case. To ask... more 8/11/2014 1:44:32 PM
Yes, you can't do that, basically. You're expecting to be able to call toList with a type argument of int, and Java doesn't allow primitives to be used as type arguments. You basically need a different method for each primitive you want to... more 8/10/2014 7:57:09 PM
Three problems: You don't want the direct children of doc, you want the descendants. You're using x["_name"].Value<string>() even if there is no _name property You're using x["_name"].Value<string>() even on non-object... more 8/10/2014 5:13:22 PM
It's not clear why you've got the ToDictionary call at all. You just need a Select call: List<string> users = connections.Where(x => x.Value.IsNearby(anotherLocation) .Select(x => x.Key) ... more 8/10/2014 4:53:15 PM
You're calling Writer.write(int). That writes a single UTF-16 code point to the file, taking just the bottom 16 bits. If your platform default encoding isn't able to represent the code point you're trying to write, it will write '?' as a... more 8/10/2014 6:36:33 AM
Okay, as you now claim this has nothing to do with Lua, here's how you would call the method in C#, then log only when the task had completed: Task<bool> task = ReturnResult(); task.ContinueWith(t => Log("Returned " +... more 8/9/2014 8:50:21 AM
It's a different meaning of the word "singleton" - it's not "the singleton pattern", it's "create a collection from a single item", that's all. For example, from define:singleton: a single person or thing of the kind under... more 8/9/2014 8:38:50 AM