Redundancy at its finest
-
I found this code in the My.Power extension for Visual Studio:
Public ReadOnly Property BatteryPercent()
' This code will retrieve the BatteryLifePercent property and convert it to a percent.
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.PowerSta -
I found this code in the My.Power extension for Visual Studio:
Public ReadOnly Property BatteryPercent()
' This code will retrieve the BatteryLifePercent property and convert it to a percent.
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.PowerStaDon'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 found this code in the My.Power extension for Visual Studio:
Public ReadOnly Property BatteryPercent()
' This code will retrieve the BatteryLifePercent property and convert it to a percent.
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.PowerStaI 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.
-
I found this code in the My.Power extension for Visual Studio:
Public ReadOnly Property BatteryPercent()
' This code will retrieve the BatteryLifePercent property and convert it to a percent.
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.PowerStaGreat code.
SystemInformation.PowerStatus.BatteryLifePercent
is afloat
. And if the battery is empty, he'll say it's not available... -
I found this code in the My.Power extension for Visual Studio:
Public ReadOnly Property BatteryPercent()
' This code will retrieve the BatteryLifePercent property and convert it to a percent.
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.PowerSta:doh: The idiot! That should so obviously be a
Select Case
... :laugh:The only instant messaging I do involves my middle finger.
-
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.
-
I found this code in the My.Power extension for Visual Studio:
Public ReadOnly Property BatteryPercent()
' This code will retrieve the BatteryLifePercent property and convert it to a percent.
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.PowerSta -
I found this code in the My.Power extension for Visual Studio:
Public ReadOnly Property BatteryPercent()
' This code will retrieve the BatteryLifePercent property and convert it to a percent.
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.PowerSta -
I found this code in the My.Power extension for Visual Studio:
Public ReadOnly Property BatteryPercent()
' This code will retrieve the BatteryLifePercent property and convert it to a percent.
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.PowerStaAn idiot did not write this, for I'm sure they used copy/paste to comprise most of it with assistance from type-ahead. ;P Besides, being the
float
that it is, he merely wanted to float himself more hours to enable himself to float (er, buy a boat) on the lake. Thus, he used thefloat
associatively correct. -
Great code.
SystemInformation.PowerStatus.BatteryLifePercent
is afloat
. 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 aSingle
(32-bit float)?