|
He made a perfect example of code reuse! Spared 17 times the $ sign!!!
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 was half expecting a musical reference...
|
|
|
|
|
A musical reference, and no code[^]?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
SELECT ISNULL(NULL,'') as [Email]
There's something oddly zen-like about it 
|
|
|
|
|
Getting information off the Internet is like taking a drink from a fire hydrant.
- Mitchell Kapor
|
|
|
|
|
Maybe someone wanted to make sure that a mapping framework (like .net EntityFramework) made a nullable string out of it 
|
|
|
|
|
Ed Bouras wrote: zen-like Yes: [Email] will always be an empty string, not null (except when ISNULL evaluates NULL as something different from NULL). String.Empty and NULL is an enormous difference for MS SQLServer and most (or all?) object-oriented programming languages. But not for zen-lacking Oracle.
|
|
|
|
|
Bernhard Hiller wrote: String.Empty and NULL is an enormous difference
Yes, obviously.
And I wish XML would recognize that too.
This space intentionally left blank.
|
|
|
|
|
|
Hence the post in this forum.
Honestly this was probably done in haste and without care for proper coding as part of a set of replacements in the stored proc of the "Email" field with NULL. Things do happen fast and furious around here and there is no dba to oversee/filter.
I found it humorous enough to share with those who like to smack themselves in the forehead 
|
|
|
|
|
This probably came up for .. historic reason!
|
|
|
|
|
|
|
After long though i decided to share this wonderful gem in c#
Today cannot get "better".
public enumType GetValueByInfo(string name, string id)
{
enumType result = enumDictionary[id];
return result;
}
And the enumDictionary is just declared Dictionary<string, enumtype=""> with (string, enumType) pairs
The names are changed.
This beautiful thing is written in c# from someone else than me, a colleague who worked longer than me in the firm. He is working mainly with c# projects i am working mainly with vc++ and MFC(oh the joy) When i have to change something my boss always says to me to write it in the same manner like the things are done in the project.
The worst part is this gem is written in my dll (the dll i should be working but all other are adding things but me)
I hate when someone else is touching my code.
Microsoft ... the only place where VARIANT_TRUE != true
|
|
|
|
|
haha awesome!
I would be interested to see, in the places where this is being called, the variety of values being supplied for name.
Well fads they come and fads they go.
And God I love that rock and roll!
Well the point was fast but it was too blunt to miss.
Life handed us a paycheck, we said, "We worked harder than this!"
|
|
|
|
|
I would like to see this working with a string which is not set as key in the dictionary.
Microsoft ... the only place where VARIANT_TRUE != true
|
|
|
|
|
Just supplying the correct name and an empty id string should do the trick.
The good thing about pessimism is, that you are always either right or pleasently surprised.
|
|
|
|
|
Time to institute code reviews.
/ravi
|
|
|
|
|
Ravi Bhavnani wrote: Time to institute code reviews hire good programmers.
FTFY 
|
|
|
|
|
/ravi
|
|
|
|
|
In one function, the following is used to call SomeFunc (names changed to protect the guilty):
If UCase(SomeFunc("" & int_var, bool_var)) = "YES" Then
F.chkBox.Value = 1
Else
F.chkBox.Value = 0
End If
(with two more calls to the same function further down).
Where F is a form variable (because frm would be too hard to type)
Looking at the definition...
Private Function SomeFunc(Result As Long, Optional cond As Boolean) As String
If cond = True Then
Select Case (Result)
Case Is < 3
SomeFunc = "No"
Case Is > 2
SomeFunc = "Yes"
End Select
Else
Select Case (Result)
Case 1
SomeFunc = "No"
Case Is >= 2
SomeFunc = "Yes"
End Select
End If
End Function
Why use a Boolean when a string comparison, case conversion and check for null string will do?
Why is that Boolean argument optional, when it is always supplied?
(before someone says, predictably, that the real WTF is VB, I'd like to point out I've seen code just as horrible in most languages.
The real real WTF is that people who produce such garbage are still employed.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
|
|
|
|
|
Rob Grainger wrote: (before someone says, predictably, that the real WTF is VB, I'd like to point out I've seen code just as horrible in most languages.
But VB seems to bring out the best in bad programming.
|
|
|
|
|
You need to try "View Source" on a few web pages then
I think it applies generally to many "high-level"/scripting languages, unless (like Dart, Smalltalk) they were well-designed in the first place.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
|
|
|
|
|
As I always say, it ain't the tool that is used, it's the tool that uses it that's the problem.
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
Spot on!
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
|
|
|
|