|
You would think a product as sophisticated as SQL Server would be able to optimize that down...
|
|
|
|
|
Only if the SQL standard allows it to.
|
|
|
|
|
I suppose theoretically the maths calc could have side effects.
Bram van Kampen
|
|
|
|
|
I saw the "SELECT 0 * Sum" and immediately thought this was a joke.
Apparently I was wrong.
Please don't bother me... I'm hacking right now. Don't look at me like that - doesn't anybody remember what "hacking" really means?
|
|
|
|
|
Perhaps a marriage of SQLServer with Unix.
There is something in Unix where you can divert junk files (howmuch ever huge it is, even beyond the capacity of the disk) to an infine sink called /dev/null .
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
MySQL has a fantastic storage engine called "Blackhole" It supports Inserts only, not deletes, selects or Updates.
|
|
|
|
|
Vasudevan Deepak K wrote: something in Unix
DOS and OpenVMS also have null devices.
|
|
|
|
|
I came across the following function:
private static string[] SplitByString(string testString, string split)
{
int offset = 0;
int index = 0;
int[] offsets = new int[testString.Length + 1];
while (index < testString.Length)
{
int indexOf = testString.IndexOf(split, index);
if (indexOf != -1)
{
offsets[offset++] = indexOf;
index = (indexOf + split.Length);
}
else
{
index = testString.Length;
}
}
string[] final = new string[offset + 1];
if (offset == 0)
{
final[0] = testString;
}
else
{
offset--;
final[0] = testString.Substring(0, offsets[0]);
for (int i = 0; i < offset; i++)
{
final[i + 1] = testString.Substring(offsets[i] + split.Length, offsets[i + 1]
- offsets[i] - split.Length);
}
final[offset + 1] = testString.Substring(offsets[offset] + split.Length);
}
return final;
}
and just had to run it in order to make sure that this function was really only a rewrite of String.Split(string[] seperator, StringSplitOptions option) which was taken from some website.
|
|
|
|
|
I agree that it's not very well written, but when was it written?
Splitting on string was added in .net 2.0; this may have been written before that... as was mine.
Mine also has the benefit of honoring quotes and escapes within the string, so splitting
12345,"Coyote, Wile E.","\"Super Genius\""
on comma will return the proper results.
Reinventing the wheel is acceptable if (and only if) it results in a better wheel.
|
|
|
|
|
PIEBALDconsult wrote: 12345,"Coyote, Wile E.","\"Super Genius\""
If he was that much of a genius, why did he keep buying all this crap from ACME after everything he bought repeatedly failed??
|
|
|
|
|
They're the only ones to give him a credit card.
|
|
|
|
|
I don't know about the original website where it was copied from, but the code I found it in was written/targeted for .NET 3.5.....
|
|
|
|
|
|
string.Split() was available in framework 1.0 and 1.1 too..
|
|
|
|
|
But only with splitting on single-character delimiters, not multi-character (string) delimiters.
|
|
|
|
|
The split(string, delim) function from earlier VB versions is still available and accepts multi-character delimiter parameters.
|
|
|
|
|
Less subtle, and probably posted a thousand times:
bool b = whatever;<br />
<br />
switch(b)<br />
{<br />
case true:<br />
break;<br />
<br />
case false:<br />
break;<br />
}
Seen as PHP-Code...
This is completely unrelated, but it just came to my mind...
"Obstacles are those frightening things you see when you take your Eyes off your aim"
- Henry Ford
Articles
Blog
|
|
|
|
|
Sometimes I ask myself. What’s the real horror in this rubric?
The people that wrote the code or the people that are posting it and reading it?
I think the last ones.
Did you ever see on the internet a website where plumbers are smiling with the mistakes of “newbie’s” plumbers?
In my company we have a positive approach.
Dirk
ApTools.Net
|
|
|
|
|
a.p@pandora.be wrote: What’s the real horror in this rubric?
The people that wrote the code or the people that are posting it and reading it?
The posting people: you & your company, with your positive approach are indeed the proof.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
And people like you ranting about people like us ranting about people like them are a horror on their own, too
|
|
|
|
|
Newbie plumbers don't learn plumbing from a book and then claim to be professionals worth the same hourly rate as properly-trained and experienced plumbers.
Plumbers and auto mechanics should have a horrors site for stories of what they find when a do-it-yourselfer's wife finally makes him call a professional.
|
|
|
|
|
...And posting the errors on the internet is the best way to make professionals from them?????
Give the newbies a compliment or flowers when they do something good. New programmers will be born
|
|
|
|
|
a.p@pandora.be wrote: Give the newbies a compliment or flowers when they do something good. New programmers will be born
When we get a paycheck for doing something stupid? I don't see it. You either do a good job because you see value in doing things well, or you don't do it at all.
But who is the king of all of these folks?
|
|
|
|
|
Give them a few compliments and new programmers will be born? What, no dinner first?
|
|
|
|
|
a.p@pandora.be wrote: In my company we have a positive approach.
Yes, catching such things in a peer review and enlightening the developer right then is best.
These stories tend to be about situations where that opportunity is gone, but the lessons may yet be passed along.
|
|
|
|