- 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
Not only that ...
<pedant>
Although it's not common, and it's not taught this way any longer (the dogma of "there's no way to ensure breasts like Dolly Parton's" was pounded into me in high school, even though it was wrong...), Merriam-Webster lists "ensure" and "insure" as synonyms.
</pedant>
I'd suggest renting a clue and a dictionary.
Admin
Didn't you notice all of the references to the movie Office Space? Please tell me you've seen the movie (if not you can complete the sentence 'the real WTF is')
Admin
How many years went by between the insertion of the div0 and the uncovering of the same? WTF?
Admin
It's awfully nice when your developers actually include a comment in their CVS commits. It's always a bitch when you know an error was introduced in the last month, in file X, but file X has been committed 12 times without a single commit comment in the last month. Totally makes the 'cvs log' command useless.
Admin
I hadn't even heard of the film until this comment, let alone watched it (I obviously don't get out enough!)
In case anyone else out there is in the same situation as me: http://en.wikipedia.org/wiki/Office_Space
Admin
If you look at Michael Bolton's myspace account, you'll see that his username is notalentassclown00. I think that explains everything.
http://www.myspace.com/notalentassclown00
Admin
And I can almost envision M. Bolton rubbing his hands together with eager, conniving glee.
This kind of childishly literal means of evasion of actual design seems to be a strategy commonly favored by neurotic, neophobic "Look, at least it works" types. In an environment lacking peer reviews, it's almost impossible to stop such behavior. And the other developers pay the price.
Admin
"I'd have gotten away with it, too, if it weren't for you darn kids."
Admin
Two things fix that problem:
1. CVS trigger to require a commit comment. This works really well unless your developers just begin using bogus comments (i.e., "laskjdfal"), in which case you can explain to them why they should not do that and then ask them to find employment elsewhere.
2. CodeHistorian to find the bug. It's a neat little utility that helps you do find the source of the problem. (http://www.codehistorian.com/codehistorian-overview.php).
Admin
Yet they're not thinking far enough ahead.
Some day, my friends, humanity will learn how to divide by zero.
And then where will they be?
Admin
<FONT color=#ff0000>Bob Slydell: So we just went ahead and fixed the glitch.</FONT>
<FONT color=#000080>Bill Lumbergh: Great.</FONT>
<FONT color=#800080>Dom Portwood: So um, Milton has been let go?</FONT>
<FONT color=#ff0000>Bob Slydell: Well just a second there, professor. We uh, we fixed the *glitch*. So he won't be receiving a paycheck anymore, so it will just work itself out naturally. </FONT>
<FONT color=#a52a2a>Bob Porter: We always like to avoid confrontation, whenever possible. Problem solved from your end.</FONT>
http://www.angelfire.com/oh/quotations/movies/o/officespace.html
Admin
I'm not sure whether this advance would be much appreciated. As a German soccer coach once said: "I could walk on water and people would complain that I can't even swim."
Admin
Shouldn't that produce a "Division by Very Null" error instead...?
Thank you, Bruce Dickinson...
Admin
Admin
works for me. You can also back out commits with fake comments, or else require that they be fixed before they get commit privs back.
Admin
<font size="1"><font size="3">Needless to say, Initech's expertise is not in Oracle, so I tried to anticipate where they were going with the code. For clarity, I left out some production-class stuff like PL/SQL exception handlers, which is what they should have been looking at for the original code:
</font>
</font><font face="Courier New" size="1">CREATE OR REPLACE PACKAGE credt_union_exceptions IS
c_money_overflow_limit CONSTANT PLS_INTEGER := 3;
c_overflow CONSTANT PLS_INTEGER := -22053;
c_zero_divide CONSTANT PLS_INTEGER := -1476;
x_overflow EXCEPTION;
PRAGMA EXCEPTION_INIT(x_overflow,-22053);
PROCEDURE handle(
p_value IN OUT NUMBER,
p_sql_code IN NUMBER,
p_sql_errm IN VARCHAR2);
END credt_union_exceptions;
/
SHO ERR PACKAGE credt_union_exceptions
CREATE OR REPLACE PACKAGE BODY credt_union_exceptions IS
--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==
-- Parameters: NONE ==
-- Purpose: FORCE END OF STORED PROCEDURE ==
-- Interval: Called From Other Programs. ==
-- Tables: NONE ==
-- Sub Programs: NONE ==
-- Author: S. Nagheenanajar ==
-- Create Date: 2002-10-08 ==
-- Revisions: ==
-- Author Date Description ==
-- ------------------------- ---------- ------------------------------------------------- ==
-- M. Bolton 2003-06-09 Changed to DIV0 error instead of overflow error ==
-- P. Gibbons 2006-05-22 Subsumed into general exception handler ==
--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==
FUNCTION overflow (p_value IN OUT NUMBER) RETURN NUMBER IS
v_new_value NUMBER := TRUNC(p_value,c_money_overflow_limit);
v_overflow NUMBER := p_value-v_new_value;
BEGIN
-- really underrated movie, actually
UPDATE cu_balances SET
balance = balance + v_overflow
WHERE account_id = 99238468;
COMMIT;
RETURN v_new_value;
END overflow;
PROCEDURE handle(
p_value IN OUT NUMBER,
p_sql_code IN NUMBER,
p_sql_errm IN VARCHAR2) IS
BEGIN
CASE p_sql_code
WHEN c_overflow THEN
p_value := overflow(p_value);
WHEN c_zero_divide THEN
p_value := 0;
ELSE RAISE_APPLICATION_ERROR(-20000,p_sql_errm);
END CASE;
END handle;
END credt_union_exceptions;
/
SHO ERR PACKAGE BODY credt_union_exceptions
</font><font size="1">
</font>
Admin
And I thought the real WTF was that SQL Server doesn't allow the use of RaIsError (The Sun God boo boo. Thanks, Bill, for saving me a vowel!) in user defined functions. Divide by zero begins to look pretty useful.
Admin
More along the lines of, "It's almost time for me to leave, I'll fix this tomorrow."
Then they get drunk and promptly forget the whole thing.
Admin
Admin
Admin
Thank you, I have gotten sick of explaining that to people. I see this mistake everywhere, even in newspaper articles.
Admin
Ok, I stand partly corrected. My English teachers never allowed us to use them as synonyms. Probably because of the entry for "ensure" states that there is a difference in some context between the two words, so by using the correct word, you will insure against any confusion about what was intended.
Admin
My understanding is that the conflation of "insure" and "ensure" into "insure" is a U.S. dialectal difference. As a Canadian, I ensure that I use "ensure" for to make certain of.
Sincerely,
Gene Wirchenko
Admin
You mean:
<font face="Courier New">throw myBackOut();</font>
Admin
Ahh, I remember all those orange VMS manuals all too well. Thanks for the memories, dude!
Admin
Comments are better because the person who writes the code isn't necessarily the person who checks it in. If you're trying to get your codebase stable, say for a beta release, you would not want to be checking in new features. That means that people writing new features may have to wait a while (perhaps months) to get new features checked in. I've had code that I've written checked in 5-6 months after I no longer worked there.
Admin
I've seen teams branch off a "release" stream and keep the main branch as a development branch (which is incorrect, but workable). Better to branch off a new development stream for the next release, in order to submit code which isn't intended for the current release. There's no excuse for having either the current or the next release become unstable because some code hasn't been checked in for many months after it's been changed.
Admin
Rut row.
Admin
A dozen thank you!s.
Admin
The rea... Hell, you know what I mean... Anyway, it's that I don't even know if Office Space ever came to Sweden... It must've, but I can't remember it, even though at that point in time I didn't even have any kids to disctract me from living :)
Swedes, did you watch Office Space in Sweden? Was it as good as it seems?
Admin
Of course. If he'd been a Pratchett fan it would have been 8, a Douglas Adams fan 42,
but with 7 he's gotta be an Iron Maiden or Orson Scott Card guy.
Admin
Not the yanks this time, but eh - good try lads!
I WORKED AT THE COMPANY WITH THIS GUY!
He used to listen to Michael Bolton so loudly on his iPOD that you could hear it 3 desks away.
Bolton's not that bad on the 4th listen.
Admin
No one brought this up yet? How, exactly, do you get a COMMIT LOG from a set of STORED PROCEDURES? Unless you have a diabolical DBA who runs every update through source control before uploading it, how do you get people to not abuse it? Or has cvs/svn been extended inside databases while I wasn't looking? (I know a couple have proprietary code control.)
One of these days I'll figure my password out again.
Admin
I think you are looking for "SET XACT_ABORT" ;)
Admin
That wall's not 4 ft high!
Admin
No no, it is Charles Dikkens, the famous dutch author.
Admin
I think it could somehow be done with Oracle's system triggers but the best and easiest way is to prevent programmers from creating/replacing stored procedures directly in the (staging / productive) database; instead of that, scripts to create/replace stored procedure are checked out from the CVS and run in a "build" process.
For my personal needs, I have configured SlickEdit (my favourite PL/SQL editor) to load the previous version of a stored procedure from the database and append it to a save file before actually compiling the stored procedures. (Yes, that means 10 versions of the procedure if I need 10 attempts to fix all syntax errors, but who cares, disk space is cheap)
This way, even if one of my undisciplined coworkers makes changes directly in the database, his version is saved so I can compare/merge it if the collission is detected. By far not perfect, but a life-saver anyway.
Admin
<FONT style="BACKGROUND-COLOR: #ffff8c">This is the type of comment that is typically made by egocentric types who haven't yet discovered that customer satisfaction ought to be a higher priority interest than programmer satisfaction. And that "other developers paying the price" (of designs that are anywhere in the range of absolutely terrible to slightly imperfect) is a lesser evil than "customers paying the price" (of developers getting stuck in endless debates over how to organise "proper" error handling).</FONT>
Admin
Where is my quoted text ????
Grrrrrrrrrrr.
Admin
I think a little sick just came up in my mouth...
(Seriously - this is bad enough to make me post....Oh dear, oh dear...)
Admin
In the long term, what is bad for the other developers will most likely be bad for the customer, too. Systems live longer than expected, changes are more frequent than expected. Unmaintainable code makes changes more expensive and by far more likely to have undesired side effects (aka bugs).
Admin
1) What's wrong with that? If it gets too long and obsolete, just trim it. You also don't ned to comment *every* change; just major changes. I'd rather turn to a guy sitting two desks away and say "Why did you do this?" Than hunt through 2 or 3 years of source control and THEN turn to him. I maintain legacy systems. This is a daily occurrence for me, though I have now leared to identify the developers from the style of the hack and which word(s) they can't spell in comments :)
2) You are identified anyway, by source control.
3) If you let the users see your source code, and put a developer's email address in there, then you deserve everything you get...
Admin
--He he he
<FONT color=#0000ff>BEGIN</FONT>
<FONT color=#008000>-- Do Stuff</FONT>
<FONT color=#0000ff>EXCEPTION
WHEN OTHERS THEN</FONT> <FONT color=#008000>-- Completely mask the preceding error</FONT>
ABORT_PROCEDURE<FONT color=#0000ff>;</FONT>
<FONT color=#0000ff>END;</FONT>
Admin
Forget Dikkens sir, I have proof that the wall is indeed 4ft
http://www.mlchapel.org/photogallery/04Apr/bof/corner%20of%20cbloc%204ft%20wall418.jpg
Admin
Regarding all the comments about putting comments in your code/cvs. I recently finished working for a client, where you were never supposed to remove code, even for major changes, instead, just comment it out with a defect number, description & date.
This just about worked in the proc, except for where I had to do major rewrites (nasty with the lack of highlighting in vi), but absolutely horrific in the eGate editor. There would be huge swathes of collaboration that had been 'commented' out by putting in a code statement of '/' and somewhere much further down '*/'. The editor wasn't clever enough to realise this code was a comment, so the only way of finding what had been commented out was by scrolling up and down, hoping you didn't miss the closing comment.
If I had to do a fix, or work out what was going on, I normally just copied the code into metapad and deleted the comments which made it a lot easier to read/modify. Then I'd have to make the changes back into the collaboration...
Admin
The TortoiseSVN folks did not invent that, they took it from the name of the command it invokes: "svn blame". Subversion, again, took it from "cvs blame" (which is a synonym for "cvs annotate").
Admin
maybe he wasn't refering to such a harmless overflow. MAYBE he was talking about a stack or heap overflow!
Admin
Until mathmeticians/compilers realize that divide by zero is both zero and infinity at the same time...
Admin
Assuming you mean the development database (developers should not be in the production database), the canonical solution is to keep code in a separate schema whose password is only known by the CM tool. You would also give each developer a personal schema to play around in; Oracle's scope rules give precedence to code in the schema you log in from. In anything but personal schemas, the developer would not have the RESOURCE privilege.
You can't do much about diabolical DBAs except figure out what they did after the fact.
Admin
I can't even think any possible way to even JUSTIFY this one! I mean, the author obviously knows what a stored proceedure is, but he thinks a good way to get out of running proceedure is to call another proceedure which causes the other one to abort with an error. Argh, its too early for this ... my mind, it can't take it this morning.