Browsing 7239 questions and answers with Jon Skeet
I want to check equality of first and last two characters of a string That's not what you're doing though. You're using startsWith and endsWith - you're asking whether a string starts with its own first two characters, and whether it... more 5/12/2015 6:02:40 AM
Look at this code: if(word.length() > MAX_COUNT) compWord(); return word; If the word that is picked is longer than your limit, you're calling compWord recursively - but ignoring the return value, and just returning the "too... more 5/11/2015 6:12:29 PM
You're currently flushing f, but not s. You're flushing the FileStream, but the StreamWriter wraps that, so it could easily have its own buffer. Don't forget that the FileStream doesn't know anything about the StreamWriter - the... more 5/11/2015 4:55:09 PM
It sounds to me like you could do with a dictionary: var results = temp.Where(o => o.IsSign == (short) OrderStateEnum.Success) .GroupBy(o => o.SignMonth) .ToDictionary(g => g.Key, g =>... more 5/11/2015 4:27:52 PM
I suggest you have one thread doing all the reading, then put the lines into a producer/consumer queue (e.g. a LinkedBlockingQueue) - you can then have multiple threads servicing that queue as consumers. You really don't want multiple... more 5/11/2015 1:24:41 PM
This is the problem: cmd.CommandText = fl.ToString(); You're passing in the filename as the command text, instead of the text itself. You're loading the text here: string scripts = file.OpenText().ReadToEnd(); ... but then not using... more 5/11/2015 9:08:37 AM
I wouldn't focus on the performance. I'd focus on the massive correctness difference between them: FileReader always uses the platform-default encoding, which is almost never a good idea. I believe that's actually slightly more efficient... more 5/11/2015 9:03:05 AM
It looks like after reading the file for first time, reader does not get to beginning of the file. No - and I don't know why you would expect it to given the documentation you quoted. Basically, the lines() method doesn't "rewind" the... more 5/11/2015 6:23:47 AM
Each time you call getNextRequestsChunkStartingChunkId you're skipping the specified number of chunks, without "rewinding" the RandomAccessFile to the start. So for example, if you... more 5/11/2015 5:45:38 AM
No - think about it, the compiler runs once, but the same binary output can be used on multiple machines. Now you can specify any symbols you want when you compile - so you could easily compile three different times and pass in different... more 5/10/2015 4:34:50 PM