|
PIEBALDconsult wrote: and had one report a count of -10. But it worked just fine.
Ouch. That's probably even worse than it simply failing, because you could have production code giving bad results without an exception.
.-.
|o,o|
,| _\=/_ .-""-.
||/_/_\_\ /[] _ _\
|_/|(_)|\\ _|_o_LII|_
\._. |\_/|"` |_| ==== |_|
|_|_| ||" || ||
|-|-| ||LI o ||
|_|_| ||'----'||
/_/ \_\ /__| |__\
|
|
|
|
|
WTF? That is rather strange. I wonder what else the framework has in store for this forum?
Getting information off the Internet is like taking a drink from a fire hydrant.
- Mitchell Kapor
|
|
|
|
|
|
And sadly the interface doesn't match the regular queue's.
|
|
|
|
|
The day you find an error message that accurately describes the error, then you can be surprised.
|
|
|
|
|
Getting information off the Internet is like taking a drink from a fire hydrant.
- Mitchell Kapor
|
|
|
|
|
Sad but true... 
|
|
|
|
|
Brisingr Aerowing wrote: Visual Studio 2013 Premium.
The extra lines come from being a Premium version. 
|
|
|
|
|
Getting information off the Internet is like taking a drink from a fire hydrant.
- Mitchell Kapor
|
|
|
|
|
"Error on line 551291232"
Now would be a good time to argue for payment by lines of code. Even at a penny a line, you'd be doing well.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
|
|
|
|
|
It was a C# project file that I had modified manually (changed framework version, removed file upgrade-related tags, fixed references) but I had accidentally removed a required end tag on line 15, which caused the error.
Getting information off the Internet is like taking a drink from a fire hydrant.
- Mitchell Kapor
|
|
|
|
|
He called for my help when he couldn't understand a piece of code.
After 2 hours digging, we finally understood what the code does. A convoluted piece of junk that just shows a string on a field on the page.
But the most facepalming thing we found was this piece of "code":
public string GetLimitMessage(int total, int limit){
if(total > limit)
try
{
return "The Limit has been reached!"
}
catch(Exception)
{
return "";
}
else
return string.Empty;
}
Aside from translation (the original is on Portuguese), that's the exactly code we found. We are still facepalming.
|
|
|
|
|
Do you know the one wrote this? I want to hire him! My office is too dirty lately...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is (V).
|
|
|
|
|
He doesn't work here anymore (actually can be anyone of 4 people, but none of them work here now).
The thing is that all of them bragged about how their code was better and how they were the best
I don't want to see the worst. 
|
|
|
|
|
Of course they bragged about their code. They used the advanced feature "try-catch" so it must be great code! Well, great in their minds, anyway.
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
So I assume all over the codebae you have something like this?
if (GetLimitMessage(a, b).Length > 0)
MessageBox.Show(GetLimitMessaage(a, b));
The good thing about pessimism is, that you are always either right or pleasently surprised.
|
|
|
|
|
Are you mad! That would be far too risky to write it like that, far better would be:
if (!GetLimitMessage(a, b).equals(GetLimitMessage(1, -1)) {
if (!String.IsNullOrEmpty(GetLimitMessage(a, b)) {
MessageBox.Show(GetLimitMessaage(a, b));
}
else
{
MessageBox.Show("The monkey's dead!");
}
}
speramus in juniperus
|
|
|
|
|
Now I need some more mind bleach...
|
|
|
|
|
Surely a MessageBox is rather "old hat"? How do you display a Fail Whale in a MessageBox?
|
|
|
|
|
Woah up there, you're missing a major source of defensive coding here...
try {
if (GetLimitMessage(a,b) != null && GetLimitMessage(a,b).Equals(GetLimitMessage(1, -1))) {
if (!string.IsNullOrEmpty(GetLimitMessage(a,b)) {
try {
MessageBox.Show(GetLimitMessage(a,b));
}
catch (Exception ex) {
throw;
}
}
}
}
catch (Exception ex) {
MessageBox.Show("The monkey's dead!");
}
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
|
|
|
|
|
It's an APS.NET MVC 3 Application, so it's:
Controller:
if(Helper.GetLimitMessage(total, 100))
{
ViewBag.LimitMessage = Helper.GetLimitMessage(total, 100);
ViewData["LimitMessage"] = Helper.GetLimitMessage(total, 100);
}
View:
@if(ViewBag.LimitMessage != "")
{
@Helper.GetLimitMessage(total, 100)
}
else if (ViewData["LimitMessage"] != null)
{
@ViewData["LimitMessage"]
}
Even my coworker who normally doesn't rant on code is cursing this one.
|
|
|
|
|
There isn't a large enough for this.
|
|
|
|
|
Is this the real life?
Is this just fantasy?
caught in a landslide
no escape from reality
open your eye's
look up to the ceiling and stare
I'm just a poor coder, I get no sympathy
because I make simple things, make them work
respect my deadlines, don't be a jerk
Any way management blows, doesn't really matter to meeeee
To meeeeeee
MAMAAAAA I just killed my coworker
put a gun against his head
pulled my trigger, now he's dead...
.
|
|
|
|
|
|
I produced this little gem, a few months ago:
QMutex statusMutex;
int status;
int GetStatus(){
statusMutex.lock();
return status;
statusMutex.unlock();
}
Needles to say that it didn't really work as great as I expected it to
Veni, vidi, caecus
|
|
|
|