Click here to Skip to main content
15,888,286 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 3:21
obermd24-Jul-19 3:21 
GeneralRe: You learn something new every day Pin
Gary R. Wheeler24-Jul-19 15:15
Gary R. Wheeler24-Jul-19 15:15 
GeneralRe: You learn something new every day Pin
CodeWraith29-Jul-19 5:01
CodeWraith29-Jul-19 5:01 
GeneralRe: You learn something new every day Pin
Gary R. Wheeler29-Jul-19 15:01
Gary R. Wheeler29-Jul-19 15:01 
GeneralRe: You learn something new every day Pin
CodeWraith29-Jul-19 20:34
CodeWraith29-Jul-19 20:34 
GeneralRe: You learn something new every day Pin
Gary R. Wheeler31-Jul-19 11:39
Gary R. Wheeler31-Jul-19 11:39 
GeneralRe: You learn something new every day Pin
CodeWraith31-Jul-19 19:23
CodeWraith31-Jul-19 19:23 
GeneralRe: You learn something new every day Pin
Rob Grainger25-Sep-19 2:39
Rob Grainger25-Sep-19 2: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 4:22
CodeWraith25-Sep-19 4:22 
GeneralRe: You learn something new every day Pin
railita1-Aug-19 12:23
railita1-Aug-19 12:23 
GeneralRe: You learn something new every day Pin
Member 1433107618-Jul-19 3:10
Member 1433107618-Jul-19 3:10 
GeneralRe: You learn something new every day Pin
maze323-Jul-19 23:30
professionalmaze323-Jul-19 23:30 
GeneralRe: You learn something new every day Pin
Gary Wheeler24-Jul-19 1:44
Gary Wheeler24-Jul-19 1:44 
GeneralDragging Hairlines to Widen Fields Pin
David A. Gray29-Jun-19 8:10
David A. Gray29-Jun-19 8:10 
JokeRe: Dragging Hairlines to Widen Fields Pin
jsc4229-Jun-19 21:33
professionaljsc4229-Jun-19 21:33 
GeneralRe: Dragging Hairlines to Widen Fields Pin
David A. Gray30-Jun-19 10:37
David A. Gray30-Jun-19 10:37 
GeneralRe: Dragging Hairlines to Widen Fields Pin
englebart1-Jul-19 2:42
professionalenglebart1-Jul-19 2:42 
GeneralRe: Dragging Hairlines to Widen Fields Pin
David A. Gray1-Jul-19 6:08
David A. Gray1-Jul-19 6:08 
GeneralRe: Dragging Hairlines to Widen Fields Pin
englebart1-Jul-19 7:38
professionalenglebart1-Jul-19 7:38 
GeneralRe: Dragging Hairlines to Widen Fields Pin
David A. Gray1-Jul-19 7:47
David A. Gray1-Jul-19 7:47 
GeneralRe: Dragging Hairlines to Widen Fields Pin
Eddy Vluggen1-Jul-19 6:21
professionalEddy Vluggen1-Jul-19 6:21 
GeneralRe: Dragging Hairlines to Widen Fields Pin
David A. Gray1-Jul-19 7:48
David A. Gray1-Jul-19 7:48 
GeneralRe: Dragging Hairlines to Widen Fields Pin
Eddy Vluggen1-Jul-19 7:55
professionalEddy Vluggen1-Jul-19 7:55 
GeneralRe: Dragging Hairlines to Widen Fields Pin
Super Lloyd3-Jul-19 20:49
Super Lloyd3-Jul-19 20:49 
GeneralRe: Dragging Hairlines to Widen Fields Pin
Gary R. Wheeler11-Jul-19 14:51
Gary R. Wheeler11-Jul-19 14: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.