Browsing 7239 questions and answers with Jon Skeet
You've created a thread, but you haven't overridden the run method - instead you've created a Run method. Java is case-sensitive. Change this: public void Run() { ... } to this: @Override public void run() { ... } Using... more 11/20/2013 12:59:54 AM
You just need to remember the line you're looking at, and check it before counting: int lines = 0; String line; while ((line = reader.readLine()) != null) { if (!line.isEmpty()) { lines++; } } Note that you should be... more 11/19/2013 11:00:08 PM
This is the problem: public int compareTo(PhoneNumber other) { super.compareTo(other); } You've specified that you're just implementing the raw type Comparable, which has a method with a signature of: int compareTo(Object) The... more 11/19/2013 10:26:40 PM
This is the problem, in your Add method: array.Insert(index, ToAdd); Your array variable isn't actually an array - it's a list. And you're inserting elements into it, rather than just setting the existing element. That will affect all... more 11/19/2013 9:11:36 PM
Don't read it as a string at all. Use the GetDateTime method on the reader to read it as a DateTime, and then you can specify that as the value of the DateTimePicker. It's worth avoiding string conversions wherever possible, in my opinion... more 11/19/2013 5:46:52 PM
It sounds like you should just be writing to a MemoryStream: var stream = new MemoryStream(); var buffer = new byte[8 * 1024]; long bytesRead; long index = 0; while ((bytesRead = reader.GetBytes(1, index, buffer, 0, buffer.Length)) >... more 11/19/2013 5:10:32 PM
How can I avoid the empty xmlns attribute ? Create the elements in the right namespace. Due to namespace defaulting, all your elements should be in the http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition... more 11/19/2013 2:55:26 PM
There's one issue: it's not thread-safe. Given that you appear to be using this via a singleton, I'd imagine you do need it to be thread-safe. If you're using .NET 4, you'd be best off using ConcurrentDictionary. Otherwise, add... more 11/19/2013 2:11:41 PM
Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problems: schemes cannot be resolved to a variable schemes cannot be resolved schemes cannot be resolved schemes cannot be resolved to a variable This... more 11/19/2013 12:56:15 PM
You need to use Select to project from one type to another, then ToList to create a list: // Property names changed to follow .NET naming conventions var list = query.Select(a => new B { X = a.A, Y = b.B, Z = c.C }) ... more 11/19/2013 4:51:04 AM