
Hi Marcello, NOW who is laughing an has more egg in his face. 1) A very piss poor DB-server that has to reindex for every request 2) An even more piss poor programmer that can NOT do it! ALL your argumernts are MUTE. It is interesting that companies have costumer databases, databases for thier employees changing, data requesting data and all this is based a databases. Furthermore, what kind of database system are you using that has to role in all that information. Last and not least If you could understand have I said you would have understood that the information retrieved beiing presented to the user can be sorted!! You have a complete lack of programming and system engineering. I figured you would complain about my pseudo code (you do know what that is?) I simply just wrote it done without any correction or checking for typos. I put in more than I wanted to so that the simplest minds could unsterstand the basic simplicity of doing the task. True, I should have use "or" instead of "and" . I also, admit that I did forget the length check. But, again it was just to show how easy it can be done. But, I you consider i just wrote this down whithout any afterthought or thought at it took me less that a minute leaving me four minutes to clear up the rest. I could have been abstract about it and left the code out. Besides, I would for myself make it far more elaborate to account for encodings and different languages. Am 21.09.2009 um 19:40 schrieb Marcello Perathoner:
... which isn't even funny. Here it is:
Keith J. Schultz wrote:
The change I would like is to have spaces taken into account in the name sort.
So we would have something like this:
Green, Alice Green, Robert Greenacre, Janet Greenjeans, Mr.
instead of like this:
Greenacre, Janet Green, Alice Greenjeans, Mr. Green, Robert
Duhhhh !! If this is true there are some people that ougth to take a course in 101 programming or db design. It takes about 5 minutes to write the code.
And it took the writer of that post no longer than that to ruin his reputation forever.
Bowerbird, meet Keith, Keith, meet Bowerbird.
Obviously the writer's ignorance about modern web serving infrastructure is complete. Even a single afternoon class about database programming would have taught him enough to keep his mouth shut. The writer of this nonsense obviously does not know that:
- To sort a dataset locally on a web server, like the writer proposes, you have to request the whole dataset from the database server. This induces a considerable load on the database server and on the wire.
- Sorting on the web server is much slower than sorting on the database server because the database server uses precomputed tables (indexes) which are already sorted, but the web server needs to sort from scratch.
So instead of asking the database server to:
give me 100 authors sorted by name starting at offset 4500
which the server could almost instantly satisfy out of the pre- sorted index tables, you have to ask the server to
give me all authors
which are 12800 at present.
Instead of reading 100 rows from the disk and passing them over the wire to the web server, you'll end up reading from the disk 12800 rows and transmitting them. Already a factor of 128 times slower.
Then comes the gratuitous sorting of 12800 rows on the web server. After which sort we throw away 12700 rows and present the user with the 100 rows she requested.
But the ignorance of the writer is not only colossal regarding present day database systems, it becomes even more surrealistic when the writer tries to apply himself to programming.
The writer wastes 30 lines of code to re-implement a function that every programming language carries out-of-the-box. That alone would have sufficed to demonstrate that the writer's notions about programming are extremely vague at best.
We will furthermore see that the writer used pseudo-code not only to hide his ignorance of any actual programming language, but also to avoid having to test his absurd concoction, which test would have immediately revealed its uttermost bullshittiness even to himself.
The absurd proposal of the writer runs thus (feel free to skip to the beef, the irksomeness of this code is just good enough for a smile):
IsEntrySmallertThan(X, Y) :- Pos := 0; If (Length(X) < Length (Y)) then MaxPos = Length(X) -1; else MaxPos = Length(Y) - 1; end if While ((IsSmaller := CharSmaller(X[Pos], Y[Pos]) == 0) and Pos != MaxPos ) Pos := Pos +1; end While
return IsSmaller; end EntrySmallerThan
CharAtSmaller(X, Y) :- If (Cardinal(X) < Cardinal(Y) ) return 1 else If Cardinal(X) > Cardinal(Y) then return -1; else return 0; end if end if end CahrAtSmaller
Cardinal(X) :- If (X in set of standard Chars) then return X else return -1; end if end Cardinal
Put this ipseudo code what language you want and voila. Cardinal can be made as complex as you want if you needed finer distinctions.
regards Keith.
For the sake of playing let us call:
IsEntrySmallertThan ('a', 'ab').
MaxPos would then be set to 0.
The While loop will call CharSmaller, which does not exist, because the function is called CharAtSmaller. First Bug.
CharAtSmaller would then return 0 because it compares 'a' to 'a', which two are equal. The iteration will then stop because Pos == MaxPos == 0. The function will then return.
Conclusion:
IsEntrySmallertThan ('a', 'ab') returns 0
According to this guy's wisdom, 'a' is not `smallert´ than 'ab'.
QED
Moreover: this code would dump core on you the moment you call it with an empty string, Cardinal (X) returns X or -1 so you'll end up comparing characters with -1, which will not work on machines with unsigned characters ... and so on.
Throwing even one line of code over the wall without testing it, is the hallmark of the utter clueless beginner. Even people less full of themselves fall for it sometimes.
-- Marcello Perathoner webmaster@gutenberg.org _______________________________________________ gutvol-d mailing list gutvol-d@lists.pglaf.org http://lists.pglaf.org/mailman/listinfo/gutvol-d