|
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.
|
|
|
|
|
Good thing the battery can't give 110% like some developers do.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I wonder what he would have done if they suddenly wanted to display the battery life at 0.1% accuracy...
.
|
|
|
|
|
An idiot did not write this, for I'm sure they used copy/paste to comprise most of it with assistance from type-ahead.
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 the float associatively correct.
|
|
|
|
|
A padded number in a file name!
int fileCount = Directory.GetFiles("[censored]", "*.csv", SearchOption.AllDirectories).Length + 1;
string fileCountStr = (fileCount <= 999 ? fileCount <= 99 ? fileCount <= 9 ? "000" : "00" : "0" : "") + fileCount;
I think this should win an award for readability in a triply-nested ternary condition .
|
|
|
|
|
And what about when someone deletes 085.csv ?
speramus in juniperus
|
|
|
|
|
Oh, don't worry. None of the accounts have delete permissions.
|
|
|
|
|
It's so good to know that the hard work of the developers of String.PadLeft[^] and Int32.ToString[^] is providing so much joy to so many, other than you.
By the way, what language is that? It can't be C#, or did you also override the + operator?
|
|
|
|
|
PIEBALDconsult wrote: It can't be C#
Really?
When one or both operands are of type string, + concatenates the string representations of the operands.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard Deeming wrote: When one or both operands are of type string
Yes, and are they?
|
|
|
|
|
PIEBALDconsult wrote: Yes, and are they?
Yes, the first operand is a string. It's the result of the ternary operator:
fileCount <= 999
? fileCount <= 99
? fileCount <= 9
? "000"
: "00"
: "0"
: ""
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
PIEBALDconsult wrote: And the second?
Doesn't matter. The documentation clearly states, "When one or both operands are of type string...", so the type of the other operand is irrelevant.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I missed that the first time also.
BDF
The internet makes dumb people dumber and clever people cleverer.
-- PaulowniaK
|
|
|
|
|
|
|
PIEBALDconsult wrote: I'm fairly sure that no self-respecting C# professional uses it that way. Heh, I go for the shorter version. If it doesn't make sense with a mishmash of ints/strings I use brackets or ToString() to clarify.
int i = 124, j = 253;
string s = "JD" + i + j;
string t = "JD" + (i + j);
But yeah, usually I don't bother.
Although, theoretically, I could now do
string s = 0;
string t = "" + 0;
So, let's get back to self-respecting...
|
|
|
|
|
string t = System.String.Format ( "JD{0}" , i + j ) ;
|
|
|
|
|
Make that:
string t = string.Format(CultureInfo.InvariantCulture, "JD{0:D}", i + j);
You typically don't want culture-specific formatting or group separators in the result.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I've never had that problem.
|
|
|
|