Browsing 7239 questions and answers with Jon Skeet
The simplest option would probably be to just convert the byte arrays to text using base64 or hex (not calling new String(bytes)) and then just use a property file or any other text storage scheme you fancy. You could go the other way,... more 2/13/2015 2:14:32 PM
That's impossible. Basically, the only operations you have with an event from the outside are "subscribe" and "unsubscribe". Now you could always unsubscribe before you subscribe. Unsubscribing is a no-op if the specified handler isn't... more 2/13/2015 1:57:45 PM
I suspect you're calling getInputString more than once. The first time, it should work fine - but then you're closing System.in (by closing the BufferedReader wrapping InputStreamReader wrapping System.in)... which means the next time you... more 2/13/2015 12:05:08 PM
Well, I'd do it in Noda Time, myself: LocalDate subscriptionDate = ...; LocalDate today = ...; // Need to take time zone into account int years = Period.Between(subscriptionDate, today); return subscription.PlusYears(years); With .NET... more 2/12/2015 5:00:23 PM
This is the problem: AppStoreXML.Root.Descendants("appSettings") You're trying to find descendant elements of appSettings which are also called appSettings and have the specified attributes. You want the add elements... more 2/12/2015 4:54:49 PM
Because it is initialized again in the second line , and called the constructor with (3,4). You've called the constructor, but the constructor itself hasn't finished - so the assignment to s never takes place. This of this: s = new... more 2/12/2015 2:57:46 PM
There's nothing special about running code in an executable jar file. If you run it from a console, e.g. with java -jar foo.jar the output will still go to the console. If you run the code in some way that doesn't attach a console - such... more 2/12/2015 12:36:04 PM
Here's a short but complete example showing how to build the c => c.Weight.HasValue && c.Weight.Value != 5000f expression tree. I've removed a lot of irrelevant code from the question: using System; using... more 2/12/2015 11:57:16 AM
You're ignoring the return value of comparator.compare("a", "b"). Calling compare() doesn't change the state of the existing comparison - it returns a comparison with the right state (which may or may not be the same - as long as the... more 2/12/2015 10:47:27 AM
Is there any method to find the type? Well, from a research point of view you could read the Java Language Specification. In particular, section 15.18.2 explains how the + operator works. If you want to do this just from an... more 2/12/2015 10:38:27 AM