Browsing 7239 questions and answers with Jon Skeet
I strongly suspect that the problem is that you're ignoring the return value from InputStream.read, other than to check for the end of the stream. So this: while (in.read(inBuff) > 0) { // This always decodes the *complete* buffer ... more 9/30/2015 5:57:44 AM
Your first problem is that you're using DateTime.Now instead of DateTime.Today - so subtracting 6 months will give you another DateTime with a particular time of day, which is very unlikely to be exactly the date/time you've parsed. For... more 9/29/2015 4:43:43 PM
As ever, the answer is in the JLS - in this case, section 14.20.3.2. Basically, if you have catch or finally blocks in your try-with-resources statement, that's converted into a "normal" try/catch/finally block which contains a... more 9/29/2015 4:26:43 PM
You want ToLookup here - it's designed for precisely this scenario. var lookup = list.ToLookup(x => x.InvoiceID, x => x.ProductID); That will still contain the duplicate product IDs, but you can easily make them distinct when you... more 9/29/2015 12:58:43 PM
Firstly, the null-coalescing operator makes this a lot simpler. Next, assuming ConfigurationManager.AppSetting["ConnectionString"] doesn't change over time, you could use: // TODO: Rename this... class Constants { private static... more 9/29/2015 12:19:03 PM
Well basically the for loop should only contain the creation of the GEH element. You can move the creation of the DEF element outside the loop... However, I'd also strongly recommend using LINQ to XML rather than the old XmlDocument... more 9/29/2015 12:17:00 PM
Your predicate is a predicate for tbl_login. But here, you're projecting to an anonymous type: (x, y) => new { userID = x.LNG_USER_PRIMARY_ID, loginTime = x.DAT_LOGIN_TIME, ageGroup = y.INT_AGE_GROUP } That predicate... more 9/29/2015 11:28:56 AM
Yes - don't put large amounts of data in source code, basically. Just include a text file with all the names, and load that at execution time instead. (In normal Java I'd use Class.getResourceAsStream; in Android you should probably be... more 9/29/2015 7:32:08 AM
The simplest way to check whether it's an image is to load it as an image, e.g. using Image.FromStream. If that throws an exception, it's not an image (or at least, not a supported image format). I'd trust that more than just using either... more 9/29/2015 7:23:37 AM
There are ways of doing this using signalling if you're also using async/await - you could await a task which is completed by the button being clicked for example - but in general you should think about user interfaces in a more... more 9/29/2015 5:55:20 AM