Click here to Skip to main content
14,363,337 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: You learn something new every day Pin
obermd24-Jul-19 4:21
memberobermd24-Jul-19 4:21 
GeneralRe: You learn something new every day Pin
Gary R. Wheeler24-Jul-19 16:15
memberGary R. Wheeler24-Jul-19 16:15 
GeneralRe: You learn something new every day Pin
CodeWraith29-Jul-19 6:01
memberCodeWraith29-Jul-19 6:01 
GeneralRe: You learn something new every day Pin
Gary R. Wheeler29-Jul-19 16:01
memberGary R. Wheeler29-Jul-19 16:01 
GeneralRe: You learn something new every day Pin
CodeWraith29-Jul-19 21:34
memberCodeWraith29-Jul-19 21:34 
GeneralRe: You learn something new every day Pin
Gary R. Wheeler31-Jul-19 12:39
memberGary R. Wheeler31-Jul-19 12:39 
GeneralRe: You learn something new every day Pin
CodeWraith31-Jul-19 20:23
memberCodeWraith31-Jul-19 20:23 
GeneralRe: You learn something new every day Pin
Rob Grainger25-Sep-19 3:39
memberRob Grainger25-Sep-19 3:39 
You're oversimplifying. Evidently you need indicator columns, fixed column layout, and more. Here's subroutine from IBM's RPG language...
 *------------------------------------------------------------------------*
 * Subprocedure  -- calculates overtime pay.                              *
 *------------------------------------------------------------------------*
P CalcPay         B
D CalcPay         PI             8P 2
D   Rate                         5P 2 VALUE
D   Hours                       10U 0 VALUE
D   Bonus                        5P 2 VALUE
D Overtime        S              5P 2 INZ(0)

 /free
    // Determine any overtime hours to be paid.
    if Hours > 40;
      Overtime = (Hours - 40) * Rate * 1.5;
      Hours = 40;
    endif;
    // Calculate the total pay and return it to the caller.
    return(H)  Rate * Hours + Bonus + Overtime;
 /end-free
P CalcPay         E
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.

GeneralRe: You learn something new every day Pin
CodeWraith25-Sep-19 5:22
memberCodeWraith25-Sep-19 5:22 
GeneralRe: You learn something new every day Pin
railita1-Aug-19 13:23
grouprailita1-Aug-19 13:23 
GeneralRe: You learn something new every day Pin
Member 1433107618-Jul-19 4:10
memberMember 1433107618-Jul-19 4:10 
GeneralRe: You learn something new every day Pin
maze324-Jul-19 0:30
professionalmaze324-Jul-19 0:30 
GeneralRe: You learn something new every day Pin
Gary Wheeler24-Jul-19 2:44
memberGary Wheeler24-Jul-19 2:44 
GeneralDragging Hairlines to Widen Fields Pin
David A. Gray29-Jun-19 9:10
groupDavid A. Gray29-Jun-19 9:10 
JokeRe: Dragging Hairlines to Widen Fields Pin
jsc4229-Jun-19 22:33
professionaljsc4229-Jun-19 22:33 
GeneralRe: Dragging Hairlines to Widen Fields Pin
David A. Gray30-Jun-19 11:37
groupDavid A. Gray30-Jun-19 11:37 
GeneralRe: Dragging Hairlines to Widen Fields Pin
englebart1-Jul-19 3:42
memberenglebart1-Jul-19 3:42 
GeneralRe: Dragging Hairlines to Widen Fields Pin
David A. Gray1-Jul-19 7:08
groupDavid A. Gray1-Jul-19 7:08 
GeneralRe: Dragging Hairlines to Widen Fields Pin
englebart1-Jul-19 8:38
memberenglebart1-Jul-19 8:38 
GeneralRe: Dragging Hairlines to Widen Fields Pin
David A. Gray1-Jul-19 8:47
groupDavid A. Gray1-Jul-19 8:47 
GeneralRe: Dragging Hairlines to Widen Fields Pin
Eddy Vluggen1-Jul-19 7:21
mveEddy Vluggen1-Jul-19 7:21 
GeneralRe: Dragging Hairlines to Widen Fields Pin
David A. Gray1-Jul-19 8:48
groupDavid A. Gray1-Jul-19 8:48 
GeneralRe: Dragging Hairlines to Widen Fields Pin
Eddy Vluggen1-Jul-19 8:55
mveEddy Vluggen1-Jul-19 8:55 
GeneralRe: Dragging Hairlines to Widen Fields Pin
Super Lloyd3-Jul-19 21:49
memberSuper Lloyd3-Jul-19 21:49 
GeneralRe: Dragging Hairlines to Widen Fields Pin
Gary R. Wheeler11-Jul-19 15:51
memberGary R. Wheeler11-Jul-19 15:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.