Browsing 7239 questions and answers with Jon Skeet

java.lang.NoSuchMethodError while running the program

I have read this thread and as it says I must have public static void main(java.lang.String[] args) my main function is like this: public static void main(String[] args) throws...
Jon Skeet
people
quotationmark

It sounds like the version of hackystat-utilities that you're using is different to the version that jmotif was built against - so the jmotif jar file contains a reference to a method which isn't present at execution time. I suggest you... more 10/14/2013 3:37:22 PM

people

Decimal.Parse and Double.Parse System.FormatException Different behavior

I do not understand why I have to specify NumberStyles.Float when using decimal.Parse and not for double.Parse I can do: var tmp = double.Parse("1e-2"); but not: var tmp1 =...
Jon Skeet
people
quotationmark

It's just behaving as documented. From Double.Parse: The s parameter is interpreted using a combination of the NumberStyles.Float and NumberStyles.AllowThousands flags. Note that NumberStyles.Float includes... more 10/14/2013 3:10:40 PM

people

On Scope of Variables in .NET(c#)

Reference Code public void MyMethod() { string x; List sampleList = populateList(); foreach(MyType myType in sampleList) { string x; // why is this not...
Jon Skeet
people
quotationmark

I dont get it...isnt that the whole essence of block statements and scoping... No, not really. The intention of scoping isn't "to allow you to reuse names". I know i can just change my variable names and go ahead.but i'd like to... more 10/14/2013 2:40:49 PM

people

Won't continue executing statement on ACTION_DOWN

I am making a lunar lander game for my assignment i have a button and set an onTouchListener to it (not onClick) when the button is down or ACTION_DOWN the rocket flies up and...
Jon Skeet
people
quotationmark

The documentation makes this reasonably clear: On pointing devices with source class SOURCE_CLASS_POINTER such as touch screens, the pointer coordinates specify absolute positions such as view X/Y coordinates. Each complete gesture is... more 10/14/2013 6:22:51 AM

people

Save updated version of printWriter several times troughou a process

I am running very time-consuming analyses and only their (very short) results are outputed to text file using printWriter. Since my computer broke down twice recently and the...
Jon Skeet
people
quotationmark

I suspect all you're looking for is calling flush on the PrintWriter. Sounds like you should potentially look for a new computer, mind you... more 10/13/2013 8:05:19 PM

people

How to dynamically build properties on an object

It appears, the new "dynamic" object let's you create properties on the fly: dynamic v = new object(); v.x = "a"; v.y = "b"; ... I am wondering if there is an easy way to...
Jon Skeet
people
quotationmark

Your initial code is incorrect. It will fail at execution time. If you use ExpandoObject instead, then it will work - and then you can do it programmatically as well, using the fact that ExpandoObject implements IDictionary<string,... more 10/13/2013 7:56:23 PM

people

Getting all the Methods from a dll in an array or list

I'm using reflection to get all the methods from a particular dll that is decorated with a custom attribute. However im not able to get all those methods in an arraylist or a list...
Jon Skeet
people
quotationmark

Your current code is all over the place, I'm afraid. You're binding against a new list with a single entry for every attribute in every method, instead of collecting all the method names and then binding once You're calling AddRange with... more 10/13/2013 6:32:21 PM

people

How to get MemberInfo of ArrayLength type expressions?

Some trouble with UnaryExpressions. This works this way: Expression<Func<List<string>, object>> k = l => l.Count; //got member in this case like this var...
Jon Skeet
people
quotationmark

It's an ArrayLength node, which you can create with the Expression.ArrayLength method. It's just a UnaryExpression with an Operand which is the array expression, and a NodeType of ArrayLength. It's not entirely clear to me what you wanted... more 10/12/2013 4:07:52 PM

people

Parse enum when string is lowered

I have a pretty fun problem, which I am not sure you can even solve using this approach. I have some string, which is all lowercase. Let's just call it businesslaw. Now, I have...
Jon Skeet
people
quotationmark

You can use the overload of Enum.Parse with a final parameter to indicate case-sensitivity: return (EnumType) (Enum.Parse(typeof (EnumType), value, false)); There's a similar TryParse overload. However, bear in mind that there could be... more 10/12/2013 3:57:57 PM

people

No overload for method 'xxxxx' takes 8 arguments

I'm pretty new at c# so forgive me for the basic question, but how do you fix the problem "No overload for method 'SaveData' takes 8 arguments"? Here is my code: using...
Jon Skeet
people
quotationmark

Here's your method declaration: static void SaveData(string CustomerNumber, string CustomerName, string CustomerAddress, string CustomerRateType, float Peak, float OffPeak, float Standard) And... more 10/12/2013 1:57:54 PM

people