Browsing 7239 questions and answers with Jon Skeet
You absolutely can reinitialize a string variable - but at the moment you're redeclaring it. Instead of: String[] locationProjection = { ... }; you want: locationProjection = new String[] { ... }; It's not entirely clear... more 5/27/2014 4:52:59 PM
I've never come across this pattern before myself, but I can imagine it being useful if: You want to implement an interface in a similar way in a bunch of nested classes (e.g. to be returned from public methods within the enclosing... more 5/27/2014 6:24:36 AM
Firstly, you should rewrite it to use avoid synchronously doing this on the UI thread. If you do a lot of work on the UI thread, it simply will freeze the UI thread. There are a few options here: If your web service proxy supports... more 5/26/2014 7:14:33 AM
It's almost certainly just the way the console handles non-ASCII characters in each case. However, that's a corollary to you doing something you shouldn't to start with: converting an arbitrary byte[] to String when you shouldn't do so, or... more 5/25/2014 7:28:34 AM
As well as the overhead Jonathon mentioned of opening and closing the file a lot, you're also calling write(int) for every single byte. Either use write(byte[]) with a big buffer, or use a BufferedOutputStream to wrap the... more 5/25/2014 7:17:03 AM
I'm pretty sure this is the problem: Log.i("===LoadDataActivity","rawdata: "+rawdata); You're assuming that a log entry can include all of your data - I believe each log entry is limited to 8192 characters. I suggest you log... more 5/24/2014 8:02:34 AM
You're going to have to have a new array to back the ArrayList anyway - so why is it a problem that it calls c.toArray()? The only inefficiency would be if it ends up in the branch calling Arrays.copyOf. more 5/24/2014 7:56:51 AM
You're calling setDate, which uses a java.sql.Date. That represents just a date, not a date and time. You should consider using setTimestamp instead, with a java.sql.Timestamp. (There may be other ways of doing it for your specific... more 5/23/2014 4:31:08 PM
Something like this, perhaps: var element = doc.Root.Element("connectionStrings"); element.ReplaceWith(new XComment(element.ToString())); Sample input/output: Before: <root> <foo>Should not be in a comment</foo> ... more 5/23/2014 3:39:14 PM
It's not exactly the same, but you can check whether the method has the ExtensionAttribute applied to it. var method = type.GetMethod("Square"); if (method.IsDefined(typeof(ExtensionAttribute), false)) { // Yup, it's an extension... more 5/23/2014 1:25:11 PM