|
Marc Clifton wrote: YOU ARE RIGHT!!!!
I'm going to show that to my wife so I can proved that I'm right every once in a while. She remains unconvinced.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Being right when another man is wrong doesn't count.
|
|
|
|
|
I think it's a universal constant that only one man can e right at a time. When it's someone else's turn, I'll gladly pass the torch.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Not enough this morning?
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt
|
|
|
|
|
Wow! I can't believe I've never noticed that difference between casting and Convert.ToInt32(double) and IConvertible.ToInt32(IFormatProvider) . I would have bet against both. Though, in honesty, I seldom use either of these ToInt32 methods.
I'm glad I read this post. This is almost certain to bite me in the hind quarters at some point in the future. Though, by then I'll probably have forgotten
|
|
|
|
|
John Simmons / outlaw programmer wrote: It seems to be doing exactly what you'd expect it to do
Exactly.
|
|
|
|
|
John Simmons / outlaw programmer wrote: What happens when you pass it a string? Does it return the value "Idiot"?
The compiler complains about some "ID10T" error.
|
|
|
|
|
Why did they feel the need to provide that method? Were the existing Math.Floor , Math.Ceiling and Math.Round options not good enough?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard Deeming wrote: Why did they feel the need to provide that method?
Because of this:
FormatString('{0:d2}',Floor(sumSum([seconds]) % 60))
Prints nothing in the report.
ToInt() is required:
FormatString('{0:d2}',ToInt(Floor(sumSum([seconds]) % 60)))
Latest Article - A Concise Overview of Threads
Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny
Artificial intelligence is the only remedy for natural stupidity. - CDP1802
|
|
|
|
|
Math.Floor/Ceiling still return a floating point type. He wanted an int.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Because Convert.ToInt (and ToInt16 , ToInt32 , ToInt64 ) are conversion methods (as the "Convert" suggests); they take arguments that can be numeric (int, long etc) but can also be string, boolean, char, even DateTime etc. The Math.Floor / Round / Ceiling functions are mathematical functions that modify an existing numeric argument.
Whilst the result might be the same, they perform distinctly different purposes. [Plus, what John Simmons says! ]
|
|
|
|
|
in SQL, the statement of SELECT CONVERT(INT, 0.6) simply drops the decimal part and returns 0.
TOMZ_KV
|
|
|
|
|
That's another reason to dislike SQL!
- I would love to change the world, but they won’t give me the source code.
|
|
|
|
|
I think Marc wrote SQL.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
He worked for IBM then.
TOMZ_KV
|
|
|
|
|
Well, 1 is 'more equivalent' than 0 .
|
|
|
|
|
(*)Inane Coding Style Question of the Day
Have you ever used two underscores ("__ ") in a row in an identifier, and why did you do it?
I have in my current code. I have C# properties that dig in to a structure, providing a 'flat' access API to it. The properties are named Structure__minimum , Structure__maximum , and so on. A single underscore didn't seem to distinguish the values sufficiently, while two seem to emphasize the relationship between the structure and the value being manipulated.
Excuse me a moment while I grab a stick and the bag of marshmallows. Let the flame wars begin!
Yes, I'm bored. I'm also somewhat chemically-enhanced in that I can feel a migraine coming on just in time for the weekend, and have a taken a pre-emptive round of meds .
Software Zen: delete this;
|
|
|
|
|
The only places a double underscore should ever be used is at the beginning or less commonly the end of an identifier!
Anywhere else is wrong.
Because: because!
Message Signature
(Click to edit ->)
|
|
|
|
|
I've always avoided double underscores at the beginning of an identifier because compiler vendors use them for their own purposes. "__int64 " comes to mind.
Software Zen: delete this;
|
|
|
|
|
I do it for compiler definitions. For instance :
#define __DEPRECATED__
It's a hold-over from my days of doing C++.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Hmm. I have done that trick in one spot in our 'legacy' C++ stuff. We had a pile of shared code that occasionally needed to know exactly which product it was being compiled in to:
#define __Product_A__ 0x00000001
#define __Product_B__ 0x00000002
#define __Product_C__ 0x00000003
...
#define __Product__ __Product_J__ We had non-preprocessor identifiers like "_Product " in a number of places, so the leading and trailing underscores helped.
Software Zen: delete this;
|
|
|
|
|
if (____ ^^ _______)
____________()
"If we don't change direction, we'll end up where we're going"
|
|
|
|
|
|
Apparently, it's quite popular in Python:
Wear a Dunder Cap - The Daily WTF[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I'm going to have to use this:This is an impressive amount of effort into constructing a footgun
Software Zen: delete this;
|
|
|
|