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. What will you call this???

What will you call this???

Scheduled Pinned Locked Moved The Weird and The Wonderful
questionworkspace
23 Posts 12 Posters 0 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.
  • A AhsanS

    Assume that pTimeText is containing 2 dates seperated by space. Like pTimeText = "31/12/2008 15:36 29/12/2008 15:36"

    this.txtTime.Text = Convert.ToDateTime(pTimeText.Substring(0, pTimeText.IndexOf(":") + 3)).ToString(Logic.DateConfigurer.DateFormatWithTime) + Environment.NewLine + Convert.ToDateTime(pTimeText.Substring(pTimeText.IndexOf(":") + 3)).ToString(Logic.DateConfigurer.DateFormatWithTime);

    Guess what will above code return. I found it in a file.

    Ahsan Ullah Senior Software Engineer

    M Offline
    M Offline
    Maximilien
    wrote on last edited by
    #2

    I call it ugly. I call it a "code" bug. I call it refactoring target #1.

    1 Reply Last reply
    0
    • A AhsanS

      Assume that pTimeText is containing 2 dates seperated by space. Like pTimeText = "31/12/2008 15:36 29/12/2008 15:36"

      this.txtTime.Text = Convert.ToDateTime(pTimeText.Substring(0, pTimeText.IndexOf(":") + 3)).ToString(Logic.DateConfigurer.DateFormatWithTime) + Environment.NewLine + Convert.ToDateTime(pTimeText.Substring(pTimeText.IndexOf(":") + 3)).ToString(Logic.DateConfigurer.DateFormatWithTime);

      Guess what will above code return. I found it in a file.

      Ahsan Ullah Senior Software Engineer

      D Offline
      D Offline
      Dr Walt Fair PE
      wrote on last edited by
      #3

      Now that deserves to be listed in the dictionary as a definition of "fugly"! Must have been a Power User who wrote that -- you know, someone who figured out how to do desktop word processing using the Calculator.

      The PetroNerd

      Walt Fair, Jr. Comport Computing Specializing in Technical Engineering Software

      1 Reply Last reply
      0
      • A AhsanS

        Assume that pTimeText is containing 2 dates seperated by space. Like pTimeText = "31/12/2008 15:36 29/12/2008 15:36"

        this.txtTime.Text = Convert.ToDateTime(pTimeText.Substring(0, pTimeText.IndexOf(":") + 3)).ToString(Logic.DateConfigurer.DateFormatWithTime) + Environment.NewLine + Convert.ToDateTime(pTimeText.Substring(pTimeText.IndexOf(":") + 3)).ToString(Logic.DateConfigurer.DateFormatWithTime);

        Guess what will above code return. I found it in a file.

        Ahsan Ullah Senior Software Engineer

        T Offline
        T Offline
        Thomas Weller 0
        wrote on last edited by
        #4

        It seems to me that your job is really really hard... :omg: I have no words for the code snippet you presented - at least none that I will use in public. It is enough that one has to use the word guess when it comes to source code. This IMHO says it all. Poor you. Regards Thomas

        _Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

        Programmer - an organism that turns coffee into software._

        A 1 Reply Last reply
        0
        • A AhsanS

          Assume that pTimeText is containing 2 dates seperated by space. Like pTimeText = "31/12/2008 15:36 29/12/2008 15:36"

          this.txtTime.Text = Convert.ToDateTime(pTimeText.Substring(0, pTimeText.IndexOf(":") + 3)).ToString(Logic.DateConfigurer.DateFormatWithTime) + Environment.NewLine + Convert.ToDateTime(pTimeText.Substring(pTimeText.IndexOf(":") + 3)).ToString(Logic.DateConfigurer.DateFormatWithTime);

          Guess what will above code return. I found it in a file.

          Ahsan Ullah Senior Software Engineer

          P Offline
          P Offline
          PIEBALDconsult
          wrote on last edited by
          #5

          I'm guessing the effect will be to replace that space with a newline if the Logic.DateConfigurer.DateFormatWithTime is "dd/MM/yyyy HH:mm"

          A 1 Reply Last reply
          0
          • A AhsanS

            Assume that pTimeText is containing 2 dates seperated by space. Like pTimeText = "31/12/2008 15:36 29/12/2008 15:36"

            this.txtTime.Text = Convert.ToDateTime(pTimeText.Substring(0, pTimeText.IndexOf(":") + 3)).ToString(Logic.DateConfigurer.DateFormatWithTime) + Environment.NewLine + Convert.ToDateTime(pTimeText.Substring(pTimeText.IndexOf(":") + 3)).ToString(Logic.DateConfigurer.DateFormatWithTime);

            Guess what will above code return. I found it in a file.

            Ahsan Ullah Senior Software Engineer

            C Offline
            C Offline
            CPallini
            wrote on last edited by
            #6

            AhsanS wrote:

            What will you call this???

            That. :rolleyes:

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
            [My articles]

            A 1 Reply Last reply
            0
            • P PIEBALDconsult

              I'm guessing the effect will be to replace that space with a newline if the Logic.DateConfigurer.DateFormatWithTime is "dd/MM/yyyy HH:mm"

              A Offline
              A Offline
              AhsanS
              wrote on last edited by
              #7

              You are wrong. It runs the same thing it gets as input. I was getting an error and i had to debug the code when i found it. that after doing all that stuff it was doing no change to original values. Surprised???? ;P

              Ahsan Ullah Senior Software Engineer

              P R 2 Replies Last reply
              0
              • C CPallini

                AhsanS wrote:

                What will you call this???

                That. :rolleyes:

                If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                [My articles]

                A Offline
                A Offline
                AhsanS
                wrote on last edited by
                #8

                why not "What the hell is thatttttttttttt"

                Ahsan Ullah Senior Software Engineer

                1 Reply Last reply
                0
                • T Thomas Weller 0

                  It seems to me that your job is really really hard... :omg: I have no words for the code snippet you presented - at least none that I will use in public. It is enough that one has to use the word guess when it comes to source code. This IMHO says it all. Poor you. Regards Thomas

                  _Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

                  Programmer - an organism that turns coffee into software._

                  A Offline
                  A Offline
                  AhsanS
                  wrote on last edited by
                  #9

                  Thomas Weller wrote:

                  It seems to me that your job is really really hard

                  Programming is never hard ( if it is programming :doh: )

                  Ahsan Ullah Senior Software Engineer

                  T 1 Reply Last reply
                  0
                  • A AhsanS

                    Thomas Weller wrote:

                    It seems to me that your job is really really hard

                    Programming is never hard ( if it is programming :doh: )

                    Ahsan Ullah Senior Software Engineer

                    T Offline
                    T Offline
                    Thomas Weller 0
                    wrote on last edited by
                    #10

                    AhsanS wrote:

                    Programming is never hard

                    I fully agree. But psst, don't you tell this to a customer or boss...:cool:

                    AhsanS wrote:

                    if it is programming

                    Is it ? Sounds more like refactoring/code review. Regards Thomas

                    _Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

                    Programmer - an organism that turns coffee into software._

                    A 1 Reply Last reply
                    0
                    • T Thomas Weller 0

                      AhsanS wrote:

                      Programming is never hard

                      I fully agree. But psst, don't you tell this to a customer or boss...:cool:

                      AhsanS wrote:

                      if it is programming

                      Is it ? Sounds more like refactoring/code review. Regards Thomas

                      _Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

                      Programmer - an organism that turns coffee into software._

                      A Offline
                      A Offline
                      AhsanS
                      wrote on last edited by
                      #11

                      Re-factoring is part of programming i guess. isn't it?

                      Ahsan Ullah Senior Software Engineer MCTS 2.0

                      T 1 Reply Last reply
                      0
                      • A AhsanS

                        Re-factoring is part of programming i guess. isn't it?

                        Ahsan Ullah Senior Software Engineer MCTS 2.0

                        T Offline
                        T Offline
                        Thomas Weller 0
                        wrote on last edited by
                        #12

                        Sure, you can see it that way... Regards Thomas

                        _Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

                        Programmer - an organism that turns coffee into software._

                        V 1 Reply Last reply
                        0
                        • A AhsanS

                          You are wrong. It runs the same thing it gets as input. I was getting an error and i had to debug the code when i found it. that after doing all that stuff it was doing no change to original values. Surprised???? ;P

                          Ahsan Ullah Senior Software Engineer

                          P Offline
                          P Offline
                          PIEBALDconsult
                          wrote on last edited by
                          #13

                          Did he set Environment.NewLine to a space?

                          1 Reply Last reply
                          0
                          • A AhsanS

                            Assume that pTimeText is containing 2 dates seperated by space. Like pTimeText = "31/12/2008 15:36 29/12/2008 15:36"

                            this.txtTime.Text = Convert.ToDateTime(pTimeText.Substring(0, pTimeText.IndexOf(":") + 3)).ToString(Logic.DateConfigurer.DateFormatWithTime) + Environment.NewLine + Convert.ToDateTime(pTimeText.Substring(pTimeText.IndexOf(":") + 3)).ToString(Logic.DateConfigurer.DateFormatWithTime);

                            Guess what will above code return. I found it in a file.

                            Ahsan Ullah Senior Software Engineer

                            P Offline
                            P Offline
                            Paul Conrad
                            wrote on last edited by
                            #14

                            What will you call this? A mess. Needs to be cleaned up and broken down a bit.

                            "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

                            A 1 Reply Last reply
                            0
                            • P Paul Conrad

                              What will you call this? A mess. Needs to be cleaned up and broken down a bit.

                              "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

                              A Offline
                              A Offline
                              AhsanS
                              wrote on last edited by
                              #15

                              And what if all this mess is totally of no use???

                              Ahsan Ullah Senior Software Engineer MCTS 2.0

                              1 Reply Last reply
                              0
                              • T Thomas Weller 0

                                Sure, you can see it that way... Regards Thomas

                                _Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

                                Programmer - an organism that turns coffee into software._

                                V Offline
                                V Offline
                                vlebed01
                                wrote on last edited by
                                #16

                                Excellent

                                1 Reply Last reply
                                0
                                • A AhsanS

                                  You are wrong. It runs the same thing it gets as input. I was getting an error and i had to debug the code when i found it. that after doing all that stuff it was doing no change to original values. Surprised???? ;P

                                  Ahsan Ullah Senior Software Engineer

                                  R Offline
                                  R Offline
                                  RubensFarias
                                  wrote on last edited by
                                  #17

                                  Actually, "that" removes the 'seconds [and milliseconds]' part from entered datetime, so "2008-11-10 08:00:30.123" => "2008-11-10 08:00:00". Ugly, I agree.

                                  P 1 Reply Last reply
                                  0
                                  • A AhsanS

                                    Assume that pTimeText is containing 2 dates seperated by space. Like pTimeText = "31/12/2008 15:36 29/12/2008 15:36"

                                    this.txtTime.Text = Convert.ToDateTime(pTimeText.Substring(0, pTimeText.IndexOf(":") + 3)).ToString(Logic.DateConfigurer.DateFormatWithTime) + Environment.NewLine + Convert.ToDateTime(pTimeText.Substring(pTimeText.IndexOf(":") + 3)).ToString(Logic.DateConfigurer.DateFormatWithTime);

                                    Guess what will above code return. I found it in a file.

                                    Ahsan Ullah Senior Software Engineer

                                    L Offline
                                    L Offline
                                    Louis Cipher
                                    wrote on last edited by
                                    #18

                                    A compound-complex sentence.

                                    1 Reply Last reply
                                    0
                                    • R RubensFarias

                                      Actually, "that" removes the 'seconds [and milliseconds]' part from entered datetime, so "2008-11-10 08:00:30.123" => "2008-11-10 08:00:00". Ugly, I agree.

                                      P Offline
                                      P Offline
                                      PIEBALDconsult
                                      wrote on last edited by
                                      #19

                                      Depends on what "Logic.DateConfigurer.DateFormatWithTime" is.

                                      A 1 Reply Last reply
                                      0
                                      • P PIEBALDconsult

                                        Depends on what "Logic.DateConfigurer.DateFormatWithTime" is.

                                        A Offline
                                        A Offline
                                        AhsanS
                                        wrote on last edited by
                                        #20

                                        It contains "DD MMM YYYY HH:mm:ss"

                                        Ahsan Ullah Senior Software Engineer MCTS 2.0

                                        P 1 Reply Last reply
                                        0
                                        • A AhsanS

                                          It contains "DD MMM YYYY HH:mm:ss"

                                          Ahsan Ullah Senior Software Engineer MCTS 2.0

                                          P Offline
                                          P Offline
                                          PIEBALDconsult
                                          wrote on last edited by
                                          #21

                                          Then the format is changed too.

                                          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