Seniority = Stupidity?



  • Mr. A. Malick is working as a Senior Programmer. He needed to substract some days of a given date. He knew about DateAdd as the code shows:

    <FONT style="BACKGROUND-COLOR: #ffffff" face="Courier New" color=#008000 size=2>'*************************************************
    '>>>>>DateMan for DateAdd and DateSub
    '>>>>>DateAdd is a defualt function
    '>>>>>DateSub is the fuction will help us to determine
    '>>>>>the no. of days before the given date.
    '<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>
    '<<<<< Developed by A. XXXXX Malick  >>>>>
    '<<<<<      Senior Programmer        >>>>>
    '<<<<<      </FONT><FONT style="BACKGROUND-COLOR: #ffffff" face="Courier New" color=#008000 size=2>XXXXXXX@yahoo.com</FONT><FONT face="Courier New" size=2><FONT style="BACKGROUND-COLOR: #ffffff" color=#008000>        >>>>>
    '<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>
    'Add Microsoft Windows Common Controls-2 6.0 (SP4) to your project
    'Add two DTPikcer to the form</FONT>
    <FONT color=#0000ff>Option Explicit</FONT>
    <FONT color=#0000ff>Dim <FONT color=#000000>SDate</FONT> As Date
    Dim <FONT color=#000000>PDate</FONT> As Date
    Dim <FONT color=#000000>D</FONT> As Integer
    Private Sub <FONT color=#000000>Command1_Click()
    Text2.Text = DateSub(DTPicker1.Value, Val(Text1))
    </FONT>End Sub</FONT></FONT>

    <FONT face="Courier New" color=#0000ff size=2>Private Function <FONT color=#000000>DateSub</FONT><FONT color=#000000>(Date1</FONT> As Date, <FONT color=#000000>NoofDays</FONT> As Integer<FONT color=#000000>)</FONT> As Date
    On Error GoTo <FONT color=#000000>ErrPart</FONT>
    <FONT color=#000000>PDate = Date1
    D = NoofDays</FONT>
    If <FONT color=#000000>Day(PDate</FONT><FONT color=#000000>) - D <= 0</FONT> Then
        Select Case <FONT color=#000000>Month(PDate)</FONT> - 1
        Case 0:
            <FONT color=#000000>SDate = CDate(31 - Abs(Day(PDate) - D) & "/" & 12 & "/" & Year(PDate))</FONT>
        Case 1, 3, 5, 7, 8, 10, 12:
            <FONT color=#000000>SDate = CDate(31 - Abs(Day(PDate) - D) & "/" & Month(PDate) - 1 & "/" & Year(PDate))
    </FONT>    Case 4, 6, 9, 11:
            <FONT color=#000000>SDate = CDate(30 - Abs(Day(PDate) - D) & "/" & Month(PDate) - 1 & "/" & Year(PDate))
    </FONT>    Case 2:
            If <FONT color=#000000>Year(PDate) Mod 4 = 0</FONT> Then
               <FONT color=#000000> SDate = CDate(29 - Abs(Day(PDate) - D) & "/" & Month(PDate) - 1 & "/" & Year</FONT><FONT color=#000000>(PDate))
    </FONT>        Else
                <FONT color=#000000>SDate = CDate(28 - Abs(Day(PDate) - D) & "/" & Month(PDate) - 1 & "/" & Year(PDate))
    </FONT>        End If
        End Select
    ElseIf <FONT color=#000000>Day(PDate) - D > 0</FONT> Then
        <FONT color=#000000>SDate = CDate(Day(PDate) - D & "/" & Month(PDate) & "/" & Year(PDate))
    </FONT>End If
    <FONT color=#000000>DateSub = SDate
    </FONT>Exit Function
    <FONT color=#000000>ErrPart:
        MsgBox Err.Number & ": " & Err.Description
    </FONT>End Function</FONT>

    <FONT face="Courier New" color=#0000ff size=2>Private Sub Command2_Click()
    <FONT color=#000000>Text4.Text = DateAdd("d", Val(Text3.Text), DTPicker2.Value)
    </FONT>End Sub</FONT>

    How come Mr. Sr. Programmer never thought about adding NEGATIVE values then? A simple <FONT face="Courier New" size=2>DateAdd("d",-7,SomeDate)</FONT> would've done the trick [:D] And how come this guy ever became a senior? Who promoted him? CONFESS! Who was it?

    Yes, I xxx-ed out some personal stuff, but if you look for it on PSC* it's easy to find [;)]

    * One of the bigger WTF-sources I know to exsist [:P]

    <FONT style="BACKGROUND-COLOR: #ffffff" color=#ff0000 size=2><crosses fingers and hits "post"></FONT>



  • Nice to see that all my hand-colored code (syntax highlighting) is gone. Crappy forum <grmbl>



  • ... NoofDays?



  • I guess it's a typo for NoobDays which was a remake of Happy Days where Fonzie was left out and only the nerds appeared in [:D]



  • This entire system will break down when we finally introduce the 13th month, which has 4 days!  He'll have to rewrite the entire subroutine!  What was he thinking???



  • @Albatross said:

    This entire system will break down when we finally introduce the 13th month

     

    Will it be called Smarch?



  • Floopuary





  • @RobIII said:


    <font style="background-color: rgb(255, 255, 255);" color="#008000" face="Courier New" size="2">'<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>
    '<<<<< Developed by A. XXXXX Malick  >>>>>
    '<<<<<      Senior Programmer        >>>>>
    '<<<<<      </font><font style="background-color: rgb(255, 255, 255);" color="#008000" face="Courier New" size="2">XXXXXXX@yahoo.com</font><font face="Courier New" size="2"><font style="background-color: rgb(255, 255, 255);" color="#008000">        >>>>>
    '<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>
    </font></font>

    <font style="background-color: rgb(255, 255, 255);" color="#ff0000" size="2"><crosses fingers="" and="" hits="" post=""></crosses></font>


    The real WTF is that he put his title in the code. What happens when he gets promoted to Director?


  • @John Smallberries said:

    @RobIII said:

    <FONT style="BACKGROUND-COLOR: rgb(255,255,255)" face="Courier New" color=#008000 size=2>'<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>
    '<<<<< Developed by A. XXXXX Malick  >>>>>
    '<<<<<      Senior Programmer        >>>>>
    '<<<<<      </FONT><FONT style="BACKGROUND-COLOR: rgb(255,255,255)" face="Courier New" color=#008000 size=2>XXXXXXX@yahoo.com</FONT><FONT face="Courier New" size=2><FONT style="BACKGROUND-COLOR: rgb(255,255,255)" color=#008000>        >>>>>
    '<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>
    </FONT></FONT>

    <FONT style="BACKGROUND-COLOR: rgb(255,255,255)" color=#ff0000 size=2><CROSSES post="" hits="" and="" fingers=""></CROSSES></FONT>


    The real WTF is that he put his title in the code. What happens when he gets promoted to Director?

    Don't worry, he won't [:D]

    Also, I apologize for posting this thread in the wrong (sub)forum. I didn't even notice it before...



  • @SeekerDarksteel said:

    @Albatross said:

    This entire system will break down when we finally introduce the 13th month

     

    Will it be called Smarch?

    Nebruary or Nonvember.  Take your pick.



  • Hey guys, do a google search for floopuary and look at the fourth result...



  • Scary.



  • @Albatross said:

    Hey guys, do a google search for floopuary and look at the fourth result...


    Superb!



  • <ConneryVoice>Febtober!</ConneryVoice>



  • @Albatross said:

    Hey guys, do a google search for floopuary and look at the fourth result...

    Now do a search for Floopuary on Google and look at the third result.  Looks like we edged out that broken link for a usegroup post.



  • sounds like someone wishes he was a senior programmer... picking out 1 crap piece of code that someone else wrote to say he is rubbish is a bit unfair - how about we go through some of your code...


Log in to reply