|
I've unintentionally had that happen after some refactoring. A couple text boxes contained values, and were later converted to a single box. Refactoring the name of the second to be the same as the first created the circumstance found here.
Of course, that situation only lasted for a little while, since I did check all the references to make sure nothing too stupid happened...
Software Zen: delete this;
|
|
|
|
|
At least give the guy credit for ensuring that no variable leaves empty-handed.
|
|
|
|
|
Somebody knows the "Tell me 3 times and it must be true" rule (see Heinlein's "Number of the Beast")
|
|
|
|
|
This post is about dates and certificates.
On the 7th of October, 2013 I needed to install the September update of SQL Server 2012 Data Tools (I'll be using the acronym SSDT further). Imagine how surprized I was when after attempting to download something the installer failed claiming that the reason for the failure is a wrong certificate which is already out of a valid date range. I tried to google some solution, but the only thing that I found is a post from some guy which had the same problem.
After some thinking I have come to the solution (just taste it): in order to install the stuff you have to correct a date on your PC to something close to the release date of that update! I used September, 20th. Wonderful, isn't it?
Was it way too hard for the Microsoft guys to just ensure their certificate doesn't expire before they release another update?
lifecycle of a lifecycle of a lifecycle
|
|
|
|
|
When I started working in my current position four years ago, I inherited a system full of bugs and was given the task to iron out all of the bugs.
The first step i though would be to turn on the logger and try to find out where and when the crashes happen.
I turned on the logger and after a few minutes...
BIG MISTAKE!
My system crashed.
It took me 2 days to re-install everything, and turn on the logger again.
and it happened again.
The next time i was smarter, and ghosted my disk.
I also finally found the correct source code version (which was hidden among multiple copies of various
versions and test made by the person), and run it through a debugger.
and then i found out this little beauty:
public void errorCatcher(string msg)
{
RegistryKey key = Registry.CurrentUser.OpenSubKey(KEY_NAME_START + @"\errors", true);
if (key != null)
{
key.SetValue(DateTime.Now.ToString(), msg);
key.Close();
}
}
and every method in the system had the same reference in it's catch clause:
catch (Exception exception)
{
errorCatcher(exception.ToString());
return "";
}
I took me two weeks to rewrite the whole thing, throw away 90% of the code, and roll out a bug free system.
(I still keep the original code as proof, as no one believes me when i tell people about it.)
|
|
|
|
|
Elephant me!
A registry logger? And people wonder why it's getting harder and harder to access it...
The only instant messaging I do involves my middle finger.
|
|
|
|
|
From that day on, whenever i need to get into this person code, i start pounding my head on the wall (literally) and swear.
My boss then calls from the next office: "is it ###### code again?"
|
|
|
|
|
I take it the person in question has departed the company?
The only instant messaging I do involves my middle finger.
|
|
|
|
|
Obviously.
Unfortunately he had enough time to wreck havoc in the company code base.
|
|
|
|
|
Guy Lavi wrote: Obviously.
Because you aren't on remand awaiting a murder trial?
The only instant messaging I do involves my middle finger.
|
|
|
|
|
Exactly!
|
|
|
|
|
I thought, if the person was still there, he would be banging this person's head against the wall instead of his own.
The good thing about pessimism is, that you are always either right or pleasently surprised.
|
|
|
|
|
OriginalGriff wrote: A registry logger? I could top that, believe it or not, if it wasn't for the non disclosure agreement of one of my former employers.
|
|
|
|
|
You made it up!!!
It can't be.
If it's true it can be easily will a gold medal.
I can't understand why such a creative people was send on his way. Company's greatest lost...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is (V).
|
|
|
|
|
This is "the pearl".
His code contains many more of these gems.
|
|
|
|
|
|
I can imagine a few situations in which this could actually make sense. But of course, it is not meant to be permanently turned on, especially if a lot of exceptions are caught.
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Do not feed the troll ! - Common proverb
|
|
|
|
|
|
I found this code in the My.Power extension for Visual Studio:
Public ReadOnly Property BatteryPercent()
Get
If SystemInformation.PowerStatus.BatteryLifePercent.ToString = "1" Then
Return "100%"
ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.99" Then
Return "99%"
ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.98" Then
Return "98%"
ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.97" Then
Return "97%"
ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.96" Then
Return "96%"
...
ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.06" Then
Return "6%"
ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.05" Then
Return "5%"
ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.04" Then
Return "4%"
ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.03" Then
Return "3%"
ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.02" Then
Return "2%"
ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.01" Then
Return "1%"
Else
Return "NA"
End If
End Get
End Property
What idiot would write this?
How about:
If SystemInformation.PowerStatus.BatteryLifePercent <= 0 OrElse _
SystemInformation.PowerStatus.BatteryLifePercent > 1 OrElse _
IsNothing(SystemInformation.PowerStatus.BatteryLifePercent) OrElse _
Single.IsNaN(SystemInformation.PowerStatus.BatteryLifePercent) OrElse _
Single.IsInfinity(SystemInformation.PowerStatus.BatteryLifePercent) Then
Return "NA"
Else
Return FormatNumber(SystemInformation.PowerStatus.BatteryLifePercent * 100, 0) & "%"
End If
P.S. Code shortened by about 96%
modified 6-Oct-13 3:59am.
|
|
|
|
|
Don't call him idiot! He had a bad day week year decade!
(And he didn't published it on VS Galery...)
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is (V).
|
|
|
|
|
I guess that coder works for the Department Of Redundancy Department.
I wonder if the Government of the US Government has a Department Of Redundancy Department. It sure seems like a lot of things come from there.
Keep Clam And Proofread
--
√(-1) 23 ∑ π...
And it was delicious.
|
|
|
|
|
Wow, you can say that again.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Great code.
SystemInformation.PowerStatus.BatteryLifePercent is a float .
And if the battery is empty, he'll say it's not available...
|
|
|
|
|
Is the VB.NET equivalent of a float a Double (64-bit float) or a Single (32-bit float)?
|
|
|
|
|
The idiot! That should so obviously be a Select Case ...
The only instant messaging I do involves my middle finger.
|
|
|
|