Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. A real Mess

A real Mess

Scheduled Pinned Locked Moved The Weird and The Wonderful
graphics
34 Posts 24 Posters 83 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Dave Kreskowiak

    :WTF: is your problem?? All I did was bring up something I saw in a documentery about artillery and it's reliablilty and maintainability, and you think I'm picking on the Germans? Dude, back then, during the war, they tended to over-engineer their weapons. That's all I'm saying...

    A guide to posting questions on CodeProject[^]
    Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
         2006, 2007, 2008

    B Offline
    B Offline
    Bernard Laplace
    wrote on last edited by
    #23

    French code smells cheese and has blue spots... :laugh:

    J 1 Reply Last reply
    0
    • B Bernard Laplace

      This is just one method, but do not expect it to be short... :sigh: I spent my days debugging this kind of code... X|

      Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
      Dim i As Integer
      Dim r As Integer
      Dim sEmployeeID As String
      Dim dDateFrom As DateTime = Convert.ToDateTime(DateFrom.Text)
      Dim dDateTo As DateTime = Convert.ToDateTime(DateTo.Text)
      Dim dDateCurrent As Date = dDateFrom
      Dim sConsultantInfoDay As String = ""
      Dim sProjectInfo1 As String = ""
      Dim sProjectInfo2 As String = ""
      Dim sProject As String = ""
      Dim DateEnd As Object
      Dim DaysNoticeExt As Object
      Dim sColor1 As String = "#FFFFFF"
      Dim sColor2 As String = "#FFFFFF"
      Dim PreviousColor As String = "#FFFFFF"
      Dim hl As New HyperLink
      Dim lb As New Label
      Dim lb2 As New Label
      Dim iDayofWeek As Integer
      Dim sDayName As String
      Dim sExit As String
      Dim bgColor As Drawing.Color
      Dim sColorProject As String = "#FFFFFF"
      Dim bTSClosed As Boolean
      Dim Hours As Double
      Dim HoursClientMonth As Double
      Dim HoursMonth As Double
      Dim HoursTBPMonth As Double
      Dim HoursInternalMonth As Double
      Dim DailyHoursTBP As Double
      Dim TSID As Integer
      Dim oEmpDateStart As Object
      Dim oEmpDateEnd As Object
      Dim bClientProject As Boolean = False
      Dim bProjectFoundMonth As Boolean = False
      Dim WorkPerc As Double
      Dim sHoliday As String
      Dim ProjectID As Integer
      Dim TotalHoursMonth As Double
      Dim dteRenewal, dteCurrentNotification, dteCurrentEndProj As DateTime
      Dim intRenewalCpt As Integer = -1
      Dim blnIsFirstTime As Boolean = True
      Dim intRenewsEachNbMonths As Integer

      	Select Case e.Row.RowType
      		Case DataControlRowType.Header
      			Dim iMonth As Integer
      			e.Row.Cells(0).Visible = False
      			e.Row.Cells(1).Visible = False
      			e.Row.Cells(2).Visible = False
      			e.Row.Cells(3).Visible = False
      			e.Row.Cells(iColDaysStart - 1).Width = ConsultantColWidth
      			e.Row.Cells(iColDaysStart - 1).Text = sEmployeeHeader
      			e.Row.Cells(iColDaysStart - 1).Font.Size = iFontSizeEmployees
      			e.Row.Cells(iColDaysStart - 1).Font.Bold = True
      			e.Row.Cells(iColDaysStart - 1).ForeColor = Drawing.Color.White
      			e.Row.Cells(iColDaysStart - 1).BackColor = Drawing.Color.DarkBlue
      
      			i = iColDaysStart
      			Do While dDateCurrent <= dDateTo
      				iMonth = dDateCurrent.Month
      				sDayName = WeekdayName(DatePart("w", dDateCurrent), True, Microsoft.VisualBasic.FirstDayOfWeek.Sunday)
      				e.Row.Cells(i).Text = String.Concat(Left(sDayNam
      
      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #24

      I have seen worse Russian code. Best thing to do with monster code is to use some reflections on it.

      1 Reply Last reply
      0
      • A Alessandro Bernardi

        I agree with you ;) And what's about an italian like me? Would you like me to speak about spaghetti code? :laugh: Luckly italian people does not always write spaghetti as they eat!! :P

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #25

        LMAO! :laugh: Ever here the American sing-a-long: 'On top of old meatball...'

        1 Reply Last reply
        0
        • B Bernard Laplace

          Hoorray! I fixed it!!!! Well when the procedure found a time over 4 hours for a day it used to skip the next records for that day :doh: I am so proud that I can not resist to post the fixed method :-D

          Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
          Dim i As Integer
          Dim r As Integer
          Dim sEmployeeID As String
          Dim dDateFrom As DateTime = Convert.ToDateTime(DateFrom.Text)
          Dim dDateTo As DateTime = Convert.ToDateTime(DateTo.Text)
          Dim dDateCurrent As Date = dDateFrom
          Dim sConsultantInfoDay As String = ""
          Dim sProjectInfo1 As String = ""
          Dim sProjectInfo2 As String = ""
          Dim sProject As String = ""
          Dim DateEnd As Object
          Dim DaysNoticeExt As Object
          Dim sColor1 As String = "#FFFFFF"
          Dim sColor2 As String = "#FFFFFF"
          Dim PreviousColor As String = "#FFFFFF"
          Dim hl As New HyperLink
          Dim lb As New Label
          Dim lb2 As New Label
          Dim iDayofWeek As Integer
          Dim sDayName As String
          Dim sExit As String
          Dim bgColor As Drawing.Color
          Dim sColorProject As String = "#FFFFFF"
          Dim bTSClosed As Boolean
          Dim Hours As Double
          Dim HoursClientMonth As Double
          Dim HoursMonth As Double
          Dim HoursTBPMonth As Double
          Dim HoursInternalMonth As Double
          Dim DailyHoursTBP As Double
          Dim TSID As Integer
          Dim oEmpDateStart As Object
          Dim oEmpDateEnd As Object
          Dim bClientProject As Boolean = False
          Dim bProjectFoundMonth As Boolean = False
          Dim WorkPerc As Double
          Dim sHoliday As String
          Dim ProjectID As Integer
          Dim TotalHoursMonth As Double
          Dim dteRenewal, dteCurrentNotification, dteCurrentEndProj As DateTime
          Dim intRenewalCpt As Integer = -1
          Dim blnIsFirstTime As Boolean = True
          Dim intRenewsEachNbMonths As Integer

          	Select Case e.Row.RowType
          		Case DataControlRowType.Header
          			Dim iMonth As Integer
          			e.Row.Cells(0).Visible = False
          			e.Row.Cells(1).Visible = False
          			e.Row.Cells(2).Visible = False
          			e.Row.Cells(3).Visible = False
          			e.Row.Cells(iColDaysStart - 1).Width = ConsultantColWidth
          			e.Row.Cells(iColDaysStart - 1).Text = sEmployeeHeader
          			e.Row.Cells(iColDaysStart - 1).Font.Size = iFontSizeEmployees
          			e.Row.Cells(iColDaysStart - 1).Font.Bold = True
          			e.Row.Cells(iColDaysStart - 1).ForeColor = Drawing.Color.White
          			e.Row.Cells(iColDaysStart - 1).BackColor = Drawing.Color.DarkBlue
          
          			i = iColDaysStart
          			Do While dDateCurrent <= dDateTo
          				iMonth = dDateCurrent.Month
          				sDayName = WeekdayName(DatePart("w", dDateCurrent), True, Microsoft.V
          
          D Offline
          D Offline
          Dan Neely
          wrote on last edited by
          #26

          Arnaud Lhopiteau wrote:

          I am so proud that I can not resist to post the fixed method Big Grin

          No, 571 line long method can be considered non-broken.

          It is a truth universally acknowledged that a zombie in possession of brains must be in want of more brains. -- Pride and Prejudice and Zombies

          B 1 Reply Last reply
          0
          • D Dan Neely

            Arnaud Lhopiteau wrote:

            I am so proud that I can not resist to post the fixed method Big Grin

            No, 571 line long method can be considered non-broken.

            It is a truth universally acknowledged that a zombie in possession of brains must be in want of more brains. -- Pride and Prejudice and Zombies

            B Offline
            B Offline
            Bernard Laplace
            wrote on last edited by
            #27

            Well I can see I am not the only one practicing irony here, am I?

            1 Reply Last reply
            0
            • D DoctorMick

              In fairness, a lot of bad implementations are done in other languages, I dare say there are as many shocking apps developed in C# as there are VB.Net.

              N Offline
              N Offline
              nullpointer 0
              wrote on last edited by
              #28

              yup, I second that.

              {}*

              B 1 Reply Last reply
              0
              • B Bernard Laplace

                French code smells cheese and has blue spots... :laugh:

                J Offline
                J Offline
                jan larsen
                wrote on last edited by
                #29

                And Danish code is just sweet!...

                "God doesn't play dice" - Albert Einstein "God not only plays dice, He sometimes throws the dices where they cannot be seen" - Niels Bohr

                1 Reply Last reply
                0
                • N nullpointer 0

                  yup, I second that.

                  {}*

                  B Offline
                  B Offline
                  BillW33
                  wrote on last edited by
                  #30

                  I third that. I have seen far too much bad code in many languages. :sigh: Bill W

                  Just because the code works, it doesn't mean that it is good code.

                  1 Reply Last reply
                  0
                  • B Bernard Laplace

                    Well this code has been made in Switzerland...

                    G Offline
                    G Offline
                    Gautier Boder
                    wrote on last edited by
                    #31

                    Snif :'( I vote for removing the Swiss citizenship of this programmer ;)

                    1 Reply Last reply
                    0
                    • B Bernard Laplace

                      This is just one method, but do not expect it to be short... :sigh: I spent my days debugging this kind of code... X|

                      Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
                      Dim i As Integer
                      Dim r As Integer
                      Dim sEmployeeID As String
                      Dim dDateFrom As DateTime = Convert.ToDateTime(DateFrom.Text)
                      Dim dDateTo As DateTime = Convert.ToDateTime(DateTo.Text)
                      Dim dDateCurrent As Date = dDateFrom
                      Dim sConsultantInfoDay As String = ""
                      Dim sProjectInfo1 As String = ""
                      Dim sProjectInfo2 As String = ""
                      Dim sProject As String = ""
                      Dim DateEnd As Object
                      Dim DaysNoticeExt As Object
                      Dim sColor1 As String = "#FFFFFF"
                      Dim sColor2 As String = "#FFFFFF"
                      Dim PreviousColor As String = "#FFFFFF"
                      Dim hl As New HyperLink
                      Dim lb As New Label
                      Dim lb2 As New Label
                      Dim iDayofWeek As Integer
                      Dim sDayName As String
                      Dim sExit As String
                      Dim bgColor As Drawing.Color
                      Dim sColorProject As String = "#FFFFFF"
                      Dim bTSClosed As Boolean
                      Dim Hours As Double
                      Dim HoursClientMonth As Double
                      Dim HoursMonth As Double
                      Dim HoursTBPMonth As Double
                      Dim HoursInternalMonth As Double
                      Dim DailyHoursTBP As Double
                      Dim TSID As Integer
                      Dim oEmpDateStart As Object
                      Dim oEmpDateEnd As Object
                      Dim bClientProject As Boolean = False
                      Dim bProjectFoundMonth As Boolean = False
                      Dim WorkPerc As Double
                      Dim sHoliday As String
                      Dim ProjectID As Integer
                      Dim TotalHoursMonth As Double
                      Dim dteRenewal, dteCurrentNotification, dteCurrentEndProj As DateTime
                      Dim intRenewalCpt As Integer = -1
                      Dim blnIsFirstTime As Boolean = True
                      Dim intRenewsEachNbMonths As Integer

                      	Select Case e.Row.RowType
                      		Case DataControlRowType.Header
                      			Dim iMonth As Integer
                      			e.Row.Cells(0).Visible = False
                      			e.Row.Cells(1).Visible = False
                      			e.Row.Cells(2).Visible = False
                      			e.Row.Cells(3).Visible = False
                      			e.Row.Cells(iColDaysStart - 1).Width = ConsultantColWidth
                      			e.Row.Cells(iColDaysStart - 1).Text = sEmployeeHeader
                      			e.Row.Cells(iColDaysStart - 1).Font.Size = iFontSizeEmployees
                      			e.Row.Cells(iColDaysStart - 1).Font.Bold = True
                      			e.Row.Cells(iColDaysStart - 1).ForeColor = Drawing.Color.White
                      			e.Row.Cells(iColDaysStart - 1).BackColor = Drawing.Color.DarkBlue
                      
                      			i = iColDaysStart
                      			Do While dDateCurrent <= dDateTo
                      				iMonth = dDateCurrent.Month
                      				sDayName = WeekdayName(DatePart("w", dDateCurrent), True, Microsoft.VisualBasic.FirstDayOfWeek.Sunday)
                      				e.Row.Cells(i).Text = String.Concat(Left(sDayNam
                      
                      0 Offline
                      0 Offline
                      0x01AA
                      wrote on last edited by
                      #32

                      You are almost predestined to apply a Laplace transformation ;P :laugh:

                      1 Reply Last reply
                      0
                      • B Bernard Laplace

                        This is just one method, but do not expect it to be short... :sigh: I spent my days debugging this kind of code... X|

                        Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
                        Dim i As Integer
                        Dim r As Integer
                        Dim sEmployeeID As String
                        Dim dDateFrom As DateTime = Convert.ToDateTime(DateFrom.Text)
                        Dim dDateTo As DateTime = Convert.ToDateTime(DateTo.Text)
                        Dim dDateCurrent As Date = dDateFrom
                        Dim sConsultantInfoDay As String = ""
                        Dim sProjectInfo1 As String = ""
                        Dim sProjectInfo2 As String = ""
                        Dim sProject As String = ""
                        Dim DateEnd As Object
                        Dim DaysNoticeExt As Object
                        Dim sColor1 As String = "#FFFFFF"
                        Dim sColor2 As String = "#FFFFFF"
                        Dim PreviousColor As String = "#FFFFFF"
                        Dim hl As New HyperLink
                        Dim lb As New Label
                        Dim lb2 As New Label
                        Dim iDayofWeek As Integer
                        Dim sDayName As String
                        Dim sExit As String
                        Dim bgColor As Drawing.Color
                        Dim sColorProject As String = "#FFFFFF"
                        Dim bTSClosed As Boolean
                        Dim Hours As Double
                        Dim HoursClientMonth As Double
                        Dim HoursMonth As Double
                        Dim HoursTBPMonth As Double
                        Dim HoursInternalMonth As Double
                        Dim DailyHoursTBP As Double
                        Dim TSID As Integer
                        Dim oEmpDateStart As Object
                        Dim oEmpDateEnd As Object
                        Dim bClientProject As Boolean = False
                        Dim bProjectFoundMonth As Boolean = False
                        Dim WorkPerc As Double
                        Dim sHoliday As String
                        Dim ProjectID As Integer
                        Dim TotalHoursMonth As Double
                        Dim dteRenewal, dteCurrentNotification, dteCurrentEndProj As DateTime
                        Dim intRenewalCpt As Integer = -1
                        Dim blnIsFirstTime As Boolean = True
                        Dim intRenewsEachNbMonths As Integer

                        	Select Case e.Row.RowType
                        		Case DataControlRowType.Header
                        			Dim iMonth As Integer
                        			e.Row.Cells(0).Visible = False
                        			e.Row.Cells(1).Visible = False
                        			e.Row.Cells(2).Visible = False
                        			e.Row.Cells(3).Visible = False
                        			e.Row.Cells(iColDaysStart - 1).Width = ConsultantColWidth
                        			e.Row.Cells(iColDaysStart - 1).Text = sEmployeeHeader
                        			e.Row.Cells(iColDaysStart - 1).Font.Size = iFontSizeEmployees
                        			e.Row.Cells(iColDaysStart - 1).Font.Bold = True
                        			e.Row.Cells(iColDaysStart - 1).ForeColor = Drawing.Color.White
                        			e.Row.Cells(iColDaysStart - 1).BackColor = Drawing.Color.DarkBlue
                        
                        			i = iColDaysStart
                        			Do While dDateCurrent <= dDateTo
                        				iMonth = dDateCurrent.Month
                        				sDayName = WeekdayName(DatePart("w", dDateCurrent), True, Microsoft.VisualBasic.FirstDayOfWeek.Sunday)
                        				e.Row.Cells(i).Text = String.Concat(Left(sDayNam
                        
                        G Offline
                        G Offline
                        GKP1992
                        wrote on last edited by
                        #33

                        Most code is like Dr.Frankenstein's mosnter. The only difference between good monster and bad monster is the good one has it's legs and hands and all else where they should be.

                        1 Reply Last reply
                        0
                        • D Dave Kreskowiak

                          :WTF: is your problem?? All I did was bring up something I saw in a documentery about artillery and it's reliablilty and maintainability, and you think I'm picking on the Germans? Dude, back then, during the war, they tended to over-engineer their weapons. That's all I'm saying...

                          A guide to posting questions on CodeProject[^]
                          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                               2006, 2007, 2008

                          C Offline
                          C Offline
                          charlieg
                          wrote on last edited by
                          #34

                          that's just too funny. I guess he's a bit cranky. I happen to be a bit of an armor historian buff, and the big, bad German tanks of ww2 were mostly junk. Credit to the 88 and the high velocity 75, but reliability is everything. The Tiger 2 and Panther broke down at horrendous rates. The panther's armor was spotty at best with mediocre quality of the armor plate, etc. Kelly's Heroes Tiger Tank - YouTube[^] Reliability was key. So, I appreciate the comment on the complexity of the arty pieces. I just wish some of the defense contractors in the US would learn.

                          Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups