|
object o = new Potato() ;
o.Rotate();
Well OK, only if it's a spherical potato.
|
|
|
|
|
Doesn't Rotate have parameters? An Axis, a velocity, or force vector?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Does that matter to a spherical potato? Can you even see whether or not a sphere is rotating?
|
|
|
|
|
Well it can - it's got eyes!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
|
Sometimes people get a little bit LINQ giddy:-
int fileFormtId = ds.Tables["ExpectedDailyBrokerFiles"].AsEnumerable().Where(x => Fits(Utils.ISS(row["File Name"]), x.Field<string>("Mask")) && x.Field<int?>("CHID").HasValue && x.Field<int?>("CHID").Value == Utils.ISInt(row["FileSourceID"])).Select(x => x.Field<int>("FileFormatId")).ToList().FirstOrDefault();
|
|
|
|
|
Well, if you remove all the other cruft, a AsEnumerable().Where().Select().FirstOrDefault() isn't that bad.
However, ToList().FirstOrDefault() is overkill, and with nullable types, why check for HasValue ?
Marc
Latest Article - Merkle Trees
Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny
Artificial intelligence is the only remedy for natural stupidity. - CDP1802
|
|
|
|
|
..and the mixing type safe and type unsafe field access
..and the fact that it's wrong but I can't see where
..and its a client side join between tables for which a server side view already exists
and so on.
|
|
|
|
|
From code that is licensed under the MIT license, so feel free to use it
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
You have to be at least a little bit insane to be a developer. It's OK.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
that code means that it must really be 'true' not 'TRUE' or 1, or even non-zero.
There are a lot of cases where it makes sense. So such code might get enforced by some source code scanner policies.
You learn to honor such tools, when co-working with some code-jockeys
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
KarstenK wrote: There are a lot of cases where it makes sense In some alternate universe perhaps.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
KarstenK's post reminds me of DCL and the many things that test as True -- including (but not limited to) 'Y', '1'...
|
|
|
|
|
Because Javascript equality is so f*cked that you have to know when to use == vs. === , and even then there's some weird BS with the null, empty, void, dunno, you're guess is as good as mine states that a Javascript variable can be in that it only makes sense to equate to a literal string?
Marc
Latest Article - Merkle Trees
Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny
Artificial intelligence is the only remedy for natural stupidity. - CDP1802
|
|
|
|
|
for (int i = 0; i < foo.Length; i++)
{
addFlag = true;
if (oldFoo != null)
{
for (int j = 0; j < oldFoo.Length; j++)
{
if (foo[i].Guid == oldFoo[j].Guid)
{
addFlag = false;
}
}
}
if (addFlag)
{
newFooList.Add(foo[i]);
}
}
I should start holding code review classes with "WTF is wrong with this pyle of shyte".
Marc
|
|
|
|
|
Marc Clifton wrote: I should start holding code review classes with "WTF is wrong with this pyle of shyte". Too much accolades, right? I also added another for-loop, since you were going through the items in the wrong order.
for (<span int i = 0; i < foo.Length; i++)
{
addFlag = true;
if (oldFoo != null)
for (int j = 0; j < oldFoo.Length; j++)
for (int d = oldFoo.Length; d > 0; d++)
if (foo[i].Guid == oldFoo[j].Guid)
addFlag = false;
if (addFlag)
newFooList.Add(foo[i]);
} Semantically also incorrect, since "addFlag" is unknown at the start. The code should reflect that by using a nullable bool that is set to nothing. That way, you could determine (if an exception occurs) if the bool is unknown, true, or not very true.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Eddy Vluggen wrote: for (int d = oldFoo.Length; d > 0; d++)
There's at least 3 bugs in that one line!
Marc
|
|
|
|
|
You can improve performance by adding a "; " after "for (int d = oldFoo.Length; d > 0; d++) ". But I guess a smart guy like you introduced this possibility for exactly that purpose. Let's hope the compiler did not detect that and optimized it away...
|
|
|
|
|
|
0x01AA wrote: Dont't blame the people, try to help them
They're no longer here and were in India.
0x01AA wrote: If I Review some of my 30 year old code, a lot of time I'm asking me if I would know the guy who wrote this s**t
A client is still using code I wrote in C++ 25 years ago. I grimace every time I see DataMatrix , basically the .NET version of DataTable .
Marc
|
|
|
|
|
The answer is: YES
"Share your wisdom and enlight the clueless". It is good for your karma
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
And the answer to your question would be, but I found it on stackoverflow.
|
|
|
|
|
You cannot see the deeper meaning here. It is not user-friendly to make it too efficient[^].
|
|
|
|
|
This is why we need faster and faster processors. Think of it as price support for Intel.
|
|
|
|
|
Followed by some counter increments.
Marc
|
|
|
|