Browsing 7239 questions and answers with Jon Skeet
I would suggest you stop using floating point types at all. Just use integers, as that's basically what you've got. (It's a shame that your data type is textual when you're logically just using integers.) string currentHighest =... more 9/23/2013 6:26:14 AM
Is the explicit specification of array lists considered as a bad practice since Java7? It's not "bad practice" - it's just a little more longwinded than it might be. The two statements have exactly the same effect, so there's no... more 9/23/2013 6:02:09 AM
You're returning response immediately - even though the callback which assigns a useful value to response will only fire later. Do you understand how BeginGetResponse works? It would be worth studying the documentation and examples... more 9/22/2013 4:30:27 PM
It sounds like you want: var allTypes = AppDomain.CurrentDomain.GetAssemblies() .SelectMany(assembly => assembly.GetTypes()) .ToList(); Use SelectMany when one "input" item (an assembly... more 9/21/2013 8:14:04 PM
You only assign a value to markup within if statements. The compiler doesn't keep track of what's feasible, and whether you've covered all cases... so the variable still isn't definitely assigned as far as the compiler is concerned. The... more 9/21/2013 8:09:53 PM
I would like to know why 'ac' object is NULL here, even if we the collection is empty, as per MSDN FirstOrDefault should return NULL for reference types if it does't find the match. This shows that GetMyClasses() returns a collection... more 9/21/2013 6:50:26 PM
I'd use Guava and its ByteStreams.toByteArray method: byte[] data = ByteStreams.toByteArray(System.in); Without using any 3rd party libraries, I'd use a ByteArrayOutputStream and a temporary buffer: ByteArrayOutputStream baos = new... more 9/21/2013 6:43:59 PM
The first version converts a Date to a string and parses it, which is a pretty pointless thing to do - and in some cases could lose information, I suspect. (Imagine during a DST transition, when the clock goes back - the same local times... more 9/21/2013 6:13:30 PM
It's println which is adding the \r\n, but you've got fundamental problems here beyond that. You're treating binary data as if it's text. That will bite you sooner or later. If you're trying to work with binary data, use OutputStream and... more 9/21/2013 3:51:45 PM
This code is clearly broken: if (_imagesPath == null) { for (int i = 0; i <= 1; i++) { _imagesPath[i] = _userImagePath[i]; _originalBitmaps[i] = BitmapFactory.decodeFile(_imagesPath[i]); } } If you get into... more 9/21/2013 3:44:25 PM