|
He better get to it fast, Intel and Android are catching up fairly quickly.
|
|
|
|
|
Nish Nishant wrote: He better get to it fast, Intel and Android are catching up fairly quickly.
I noticed that.
Marc
|
|
|
|
|
John Simmons / outlaw programmer wrote: When do you anticipate that you'll reach your lofty goal?
The goal is, by the end of the year.
Marc
|
|
|
|
|
2... Bugfixes? Because if that's the case you only have 79 more to go
|
|
|
|
|
Sander Rossel wrote: Because if that's the case you only have 79 more to go
I think that's optimistic.
Marc
|
|
|
|
|
I vaguely remember when you went past me, think that was quite a few years ago. I thought you were #1 now, and looked at the who's who just now. An ASP.NET community account is #1? Wow. And Android and Intel accounts are close on your heels. Maybe the who's who needs an IsIndividualHuman filter
|
|
|
|
|
Nish Nishant wrote: I thought you were #1 now, and looked at the who's who just now. An ASP.NET community account is #1 Only if you value quantity over quality
|
|
|
|
|
Jeremy Falcon
|
|
|
|
|
Nish Nishant wrote: I vaguely remember when you went past me, think that was quite a few years ago.
Yes, you were actually my inspiration/motivation (I'm quite serious.)
Nish Nishant wrote: An ASP.NET community account is #1?
Yes, but none of those, IMHO, count. They're entities, not people.
Nish Nishant wrote: Maybe the who's who needs an IsIndividualHuman filter
Exactly. But then...
Marc
|
|
|
|
|
Marc Clifton wrote:
Yes, you were actually my inspiration/motivation (I'm quite serious.)
Heh - feels nice to hear that
|
|
|
|
|
He probably meant as an example of bad practices not to follow
|
|
|
|
|
Well, I mean...
|
|
|
|
|
So I got the following declaration in a class:
public class ExpressionModel
{
public static readonly IEnumerable<string> ConditionOperators = new[] { "eq", "neq", "gt", "gte", "lt", "lte", "between" };
} I'm using it in one place as follows:
ExpressionModel.ConditionOperators.Contains(e.Operator) It went well a couple of times and then I got a NullReferenceException on ExpressionModel.ConditionOperators ...
I'm not even sure how ConditionOperators could EVER be null (even if I tried)...
|
|
|
|
|
Are you sure that it was not e.Operator that was null instead? I can hardly imagine how a static variable can lead to a NullReferenceException (since, by design, there is no instance needed).
You always obtain more by being rather polite and armed than polite only.
|
|
|
|
|
Yep, really sure.
ExpressionModel.ConditionOperators was null, hence the exception when trying to invoke Contains on it.
My first thought was that it should've been e too, but it wasn't.
I actually had it right there in the watch window: ExpressionModel.ConditionOperators: null
|
|
|
|
|
Do you have the problem if you use:
public static readonly List<string> ConditionOperators = new List<string>("eq", "neq", "gt", "gte", "lt", "lte", "between");
instead?
You always obtain more by being rather polite and armed than polite only.
|
|
|
|
|
Actually I don't have the problem at all anymore. It was a one time thing.
Why do you think the List<string> would be different than IEnumerable<string> string[]?
|
|
|
|
|
Don't know; the use of a fixed, identified type instead of an interface declaration, maybe. But that's really a blind shot.
You always obtain more by being rather polite and armed than polite only.
|
|
|
|
|
Get LINQPad - The .NET Programmer's Playground[^]
Then add the following code and run it.
Even if e.Operator is set to null (each time x is an odd number) then it never fails.
I blame Visual Studio!!!
void Main()
{
Console.WriteLine(ExpressionModel.ConditionOperators);
for (int x = 0; x<100;x++)
{
Console.WriteLine(ExpressionModel.ConditionOperators.Contains(null));
if (x % 2 == 0)
{
e.Operator = "eq";
}
else{
e.Operator = null;
}
Console.WriteLine(ExpressionModel.ConditionOperators.Contains(e.Operator));
}
}
public static class e{
public static String Operator;
static e()
{
Operator = null;
}
}
public class ExpressionModel
{
public static readonly IEnumerable<string> ConditionOperators = new[] { "eq", "neq", "gt", "gte", "lt", "lte", "between" };
}
Output
5String[] (7 items)4
eq
neq
gt
gte
lt
lte
between
False
True
False
False
False
True
False
False
False
True
...
|
|
|
|
|
Yeah, but e.Operator wasn't the problem
|
|
|
|
|
I know. I was showing that neither the original array was the problem nor the e.Operator was.
There was a question about whether it was null -- so I answered.
|
|
|
|
|
raddevus wrote: There was a question about whether it was null -- so I answered There was a statement that it was null. I'm glad you disagree
|
|
|
|
|
If this was C++, I'd wonder if loop unrolling and parallel execution of the individual loop iterations was happening. That would cause race conditions on the value in e.Operator.
Maybe try rerunning that with affinity set to a single core. Or maybe try it with a Fibonacci computation in the loop -- something whose result depends on inputs from the previous iterations, and therefore prevents loop unrolling and parallel execution.
We can program with only 1's, but if all you've got are zeros, you've got nothing.
|
|
|
|
|
Interesting ideas.
|
|
|
|
|
No programming questions in the lounge!
Even if they're Microsoft bug programming questions!
Marc
|
|
|
|