|
I know, that's exactly what I did. Still, it threw the organization into chaos since such WebPart was at their intranet's home page...
|
|
|
|
|
threw not throwed
FTFY!
"With sufficient thrust, pigs fly just fine."
Ross Callon, The Twelve Networking Truths, RFC1925
|
|
|
|
|
Methinks me just threwed up a little bit.
|
|
|
|
|
Second bug in a row... today I wrote "escribido" rather than "escrito" on a SLA proposal... I really need to get some sleep...
|
|
|
|
|
Damn, sorry! I knowed that!
|
|
|
|
|
Why give "useful" info to someone who obviously doesn't need it? (Someone slammed by someone else's non-thinking moment, not, "What did I do wrong?".)
|
|
|
|
|
Yes, it is bad but understandable. The equivalent of that code works just fine in Excel, for example. Try "=Date(2011,Month(Today())+1,1)" and you get 1/1/2012 which seems sensible to me. It's a coding style I have used for years.
No excuses, I'm just saying.
|
|
|
|
|
Depends on the language. I know that in Java it was explicitly decided that you just can't set a date to a 'wrong value' and let it auto correct. You have to use the methods to add days or months.
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|
Mmm, then it surely is valid in SharePoint, when dealing with lists and calculated columns. Since the WebPart is used in a SharePoint installation, perhaps the developer got his idea from that...
|
|
|
|
|
I don't think it's "understandable" when an ASP.Net programmer makes a mistake like this. Presumably they weren't hired for their Excel skills?
|
|
|
|
|
That's pretty funny...
|
|
|
|
|
the real WTF is, that this may fail in the very rare case, when the year switches between the evaluation of DateTime.Today.Year and DateTime.Today.Month, leading to a primer one year back in the past... but this may not be an issue if the code will not be executed during new years eve
|
|
|
|
|
LOL.
*points and laughs loudly at incompetance*
No excuses for this one.
|
|
|
|
|
You need to convince your employer that their calendars are wrong.
Admitting mistakes in code cannot end well.
|
|
|
|
|
Hehehe, actually, aside from me being called at 4 A.M., it turned out pretty well for us: the other software company got their asses kicked off of the project, and we already got another project with this customer... So, all in all, it worked for us!
|
|
|
|
|
well IT industry is funny
|
|
|
|
|
Maybe he got the calendar mixed up with the zodiac... when exactly is the sign of Ophiucus again?
(OH GOD now I have "we are now in the age of aquarius... aquarius... AQUAAAARIUS" stuck in my head...)
|
|
|
|
|
The coding horror is when you see the same Code Project Discussion two days in a row. That's horrible.
|
|
|
|
|
Reminds me of a project I worked on in 1992. I was controlling a piece of hardware which had its own real-time clock. We discovered that it did not handle the rollover for leap year correctly, so we reported a bug to the developer for the firmware on the device.
He 'solved' the problem by disallowing setting the date to the month of February .
Software Zen: delete this;
|
|
|
|
|
I can see him now... "FIXED!"
|
|
|
|
|
Quote: It was the 13th hour of the 13th day of the 13th month...
Nice subject!
|
|
|
|
|
Another coding horror. Have you ever thought that usual assigning operation, like a=b , can crash your application? Not yet? You gotta be ready. One of my teammates has already prepared:
public class InspectionMethod
{
private string name_;
[XmlElementAttribute()]
public string Name
{
get
{
return name_;
}
set
{
name_ = value;
}
}
public void Resuscitate()
{
try
{
name_ = this.Name;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Serialization error has happened.",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
}
And indeed, never forget about message boxes. User must be warned, right?
|
|
|
|
|
Especially nice considering the getter... This translates to a fancy "name_ = name_", well done
'As programmers go, I'm fairly social. Which still means I'm a borderline sociopath by normal standards.' Jeff Atwood
'I'm French! Why do you think I've got this outrrrrageous accent?' Monty Python and the Holy Grail
|
|
|
|
|
I didn't spotted that initially (perhaps I was way too attracted by try/catch ). But now I've fallen from my chair, thank you.
|
|
|
|
|
I think this is incomplete. You should add this in the try block:
if (this.Name != name_)
throw new InvalidOperationException("Bad XML !");
'As programmers go, I'm fairly social. Which still means I'm a borderline sociopath by normal standards.' Jeff Atwood
'I'm French! Why do you think I've got this outrrrrageous accent?' Monty Python and the Holy Grail
|
|
|
|