|
I suspect this was written by Walt.
|
|
|
|
|
This coder has been around a long time, you may remember the redundancy design, tell me 3 times, he has just incorporated it at a lower level!
BTW this could use a renaming for greater accuracy.
if( this.idiotservice != null )
{
sOwner = this.idiotservice .Common.Security.Owner;
}
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Of course it could be that Mycroft's renaming is extremely accurate and the disservice is changing some global variable such that it could return different values each time its called.
|
|
|
|
|
To be completely boring: looks like someone had a race condition. Although you still need to be insane to attempt threading without knowing anything about it.
He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Chineese Proverb]
Jonathan C Dickinson (C# Software Engineer)
|
|
|
|
|
Well... if idiotservice were a getter that as part of its implementation attempts to connect to an external service, this could actually make a little bit of sense.
|
|
|
|
|
On asking 'how to select value from a combobox based on another combobox selected value', following was replied as one way:
private void m_CmbBox1_SelectedIndexChanged(Object Sender EventArgs e)
{
switch(m_CmbBox1.SelectedIndex)
{
case 0:
m_CmbBox2.SelectedIndex = 0;
break;
case 1:
m_CmbBox2.SelectedIndex = 1;
break;
case 2:
m_CmbBox2.SelectedIndex = 2;
break;
default:
m_CmbBox2.SelectedIndex = m_CmbBox2.Items.Count - 1;
}
}
Got to read a comment on this, to which I fully agree: A bright example of anti-programming!
modified 26-Jun-12 14:56pm.
|
|
|
|
|
I saw that one too, but was too distracted to notice the stupidity in it at the time. +5...
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
Okie! I just thought of sharing it here. Who knows someone might be implementing something like this somewhere.
|
|
|
|
|
If you didn't laugh, you'd cry...
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
What did you do?
|
|
|
|
|
A bit of both!
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
Sandeep Mewara wrote: default:
m_CmbBox2.SelectedIndex = m_CmbBox2.Items.Count - 1;
The items are not in common! But still the other cases can be avoided when the index falls with in the count.
Am i making sense?!
...
|
|
|
|
|
Don't ask. I have no idea how this default condition was thought of!
|
|
|
|
|
I'm cleaning up other people's mess again and came across this code to validate a date. The comments are from me, as our friend does not believe in comments or any other kind of documentation.
protected void cvaliDatum_ServerValidate(object source, ServerValidateEventArgs args)
{
if (tbDatum.Text.Trim() != "")
{
DateTime datok;
if (DateTime.TryParse(tbDatum.Text.Trim(), out datok))
{
if (datok > DateTime.Now)
{
TimeSpan span = DateTime.Now - datok;
if (span.Days > 14)
{
if ((Konstanten.Status == -1) || (Konstanten.Status == 1))
{
args.IsValid = false;
}
else
{
args.IsValid = true;
}
}
else
{
args.IsValid = false;
}
}
else
{
args.IsValid = true;
}
else
{
args.IsValid = false;
}
}
else
{
args.IsValid = false;
}
}
As a bonus, the same thing has been copied and pasted to do the validation for another date on the same page. The whole thing just would not be as much fun without some redundancy. Being constantly exposed to this kind of code, I certainly hope that whatever turned the poor author into a moron does not prove itself to be contagious.
At least artificial intelligence already is superior to natural stupidity
|
|
|
|
|
It probably took that contagious to get it working...
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
It never worked and never will. This is just a tiny sample of 9100 equally clueless lines of code in one single ASP .Net webpage. Another one of the coder's specialities is to wrap problematic parts into try blocks, always followed by an empty catch block. It sucessfully pretends that errors never happened and just goes on as if nothing had happened.
At least artificial intelligence already is superior to natural stupidity
|
|
|
|
|
void Code(ICodeContext ctx){
throw new BrainNotFoundException();
}
public class SysAdmin : Employee
{
public override void DoWork(IWorkItem workItem)
{
if (workItem.User.Type == UserType.NoLearn){
throw new NoIWillNotFixYourComputerException(new Luser(workItem.User));
}else{
base.DoWork(workItem);
}
}
}
|
|
|
|
|
1.34 in the middle of the night. But I really needed this. Thank you!
"Real men drive manual transmission" - Rajesh.
|
|
|
|
|
No problem.
Bill Gates is a very rich man today... and do you want to know why? The answer is one word: versions.
Dave Barry
Read more at BrainyQuote[ ^]
|
|
|
|
|
Beware of the "}" right after comment "// This is plain wrong - should be false"
What is Konstanten?
|
|
|
|
|
Konstanten is German for Constants.
So this seems to be a class with const and readonly properties.
|
|
|
|
|
The 'constants' actually are global variables and not constant at all. In web applications he usually (mis)uses the session for this. I can mail you some code if you ever want a scary example of how global variables can lead to an unpredictable mess.
At least artificial intelligence already is superior to natural stupidity
|
|
|
|
|
Bill Gates is a very rich man today... and do you want to know why? The answer is one word: versions.
Dave Barry
Read more at BrainyQuote[ ^]
|
|
|
|
|
Sorry, that must have been me when formatting the code.
At least artificial intelligence already is superior to natural stupidity
|
|
|
|
|
CDP1802 wrote: copied and pasted to do the validation for another date
Only such far yet? Things will become much nicer in near future, when a fix is introduced here, another (different) fix there, some extra validation elsewhere, and soon you'll have some ten (different) solutions for the same problem (and none working correctly).
Seems to be a wide-spread pattern. Highly contagious, terribly infectious...
|
|
|
|