- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Admin
I remember the day when after finnishing my java project and having a few weeks before the next java project kicked off my boss said 'In the mean time can you convert or old Delphi 1.0 code over to Delphi 6 please' It sounded oh so simple at the time. After getting my hands on the code it was a mess, year upon year of fix meant that some files contain classes of a different name which were duplicated across other files with unrelated names. Methods were in classes of completely unrelated relavance and funtionality, some methods were replicated dozens of times all with slightly different implemenations. Which method ran depended on the order that they were imorted and removing what looked like redundat versions resulted in system faults. What a nightmare :(
Admin
A few years ago i worked for a payroll company. They had one big 10.000 lines more then 300 pages compiler listing doing all the calculations program. (there was only one free lance programmer who was able to do maintance to this program. His contract was ended) Of course there was no documention fo this program.
When you had the evil mind to change some code the program strikes back with the most horrible errors.
Some time i wake-up in the middle of the screaming for mercy.
Admin
Admin
By default, primary keys in MS SQL are clustered. To create them without a clustered index on them, you have to specify "nonclustered", as in:
create table Accounts (
Account int identity primary key nonclustered,
Name varchar(100)...
If you don't, the data will be stored on the disk in the sequence of the primary key. In the case of an identity primary key, that will give you fast insert performance (which is advantageous in tables where inserts are more common than group selects). It will also give you fast selects if you are selecting either a single row by primary key, or a range of rows selected by a range of primary key values, but you can achieve the same with a normal index on your primary key (which it automatically has, even if it's nonclustered).
If, on the other hand, you want to select from that Accounts table by alphabetical order on the Name column, the select will be slower (unless you have a separate index on that column, which will slow down inserts, of course).
The rules I use: on primary tables, set the clustered index on the field you will most often sort by (that speeds up Order By statements significantly) or select by (if sorting is low importance); on subtables, set the clustered index on the most important foreign key (that will speed up joins significantly); on log tables, set the clustered index on the primary key and make the primary key an identity field, since that will speed up inserts significantly. I get good performance that way.
Admin
I don't think this qualifies as a WTF.
I'd common practice to include a small table and use select * from dummy as a 'functional ping' -- to test whether you can connect to and use the DB.
For example, it is used to see if a pooled DB connection is alive or not.
Admin
sounds like it was an ex-Oracle programmer who set that up, who was used to SELECTing from DUAL when you needed a value (like sysdate) but didnt care about an underlying table.
Admin
<font size="-1">Sounds more like bringing in the Lords of Chaos</font>.
Admin
Holy crap, that link should be tomorrow's WTF.
WTF? I guess this guy never wrote any O(n^2) code before. So instead of writing a nested loop, he creates a "tally table" and an obscene, 6-line "INSERT INTO table SELECT STATEMENT FROM HELL GROUP BY LEVEL OF HELL..." statement?
He fails to even solve the original purpose, which is to insert CSV. He is only handling a subset of CSV -- What if I want to insert "Company, Inc." into a company_name column? Algorithm fails, please come again.
Admin
Holy crap, that link should be tomorrow's WTF.
WTF? I guess this guy never wrote any O(n^2) code before. So instead of writing a nested loop, he creates a "tally table" and an obscene, 6-line "INSERT INTO table SELECT STATEMENT FROM HELL GROUP BY LEVEL OF HELL..." statement?
He fails to even solve the original purpose, which is to insert CSV. He is only handling a subset of CSV -- What if I want to insert "Company, Inc." into a company_name column? Algorithm fails, please come again.
Admin
size = size * 1.0;
Well, I'm still writting code like this when I want to cast an integer data type to a decimal one (of course, in languages which support this kind of data conversion, from a stricter type to a larger one to accomodate a result...) !!
:-))