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. Changes goes whong

Changes goes whong

Scheduled Pinned Locked Moved The Weird and The Wonderful
question
10 Posts 9 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.
  • S Offline
    S Offline
    sergiogarcianinja
    wrote on last edited by
    #1

    This is the original code:

    DateTime dtInput;
    DateTime.TryParse(txtInputDate.Text, out dtInput);
    document.InputDate = dtInput;

    Lets do a change request: * Input date always will be the current date.

    DateTime dtInput;
    DateTime.TryParse(DateTime.Now.ToString(), out dtInput);
    document.InputDate = dtInput;

    What is wrong with these people? They start coding and stop thinking?

    B G L Z 4 Replies Last reply
    0
    • S sergiogarcianinja

      This is the original code:

      DateTime dtInput;
      DateTime.TryParse(txtInputDate.Text, out dtInput);
      document.InputDate = dtInput;

      Lets do a change request: * Input date always will be the current date.

      DateTime dtInput;
      DateTime.TryParse(DateTime.Now.ToString(), out dtInput);
      document.InputDate = dtInput;

      What is wrong with these people? They start coding and stop thinking?

      B Offline
      B Offline
      BobJanova
      wrote on last edited by
      #2

      :laugh: I think the best part of this one is that even the original code is broken – because it's not checking the result of TryParse and assigning a sensible default value, if the input string wasn't in a valid format, you get (DateTime)0 which is almost certainly not what they want (and will cause things further down the line to break in subtle ways).

      S 1 Reply Last reply
      0
      • B BobJanova

        :laugh: I think the best part of this one is that even the original code is broken – because it's not checking the result of TryParse and assigning a sensible default value, if the input string wasn't in a valid format, you get (DateTime)0 which is almost certainly not what they want (and will cause things further down the line to break in subtle ways).

        S Offline
        S Offline
        sergiogarcianinja
        wrote on last edited by
        #3

        The original code has a infallible validation using Javascript. It never fails. Except when you change you server locale, or disable javascript, oh shit, I remember now, I had fixed this too.

        T E 2 Replies Last reply
        0
        • S sergiogarcianinja

          This is the original code:

          DateTime dtInput;
          DateTime.TryParse(txtInputDate.Text, out dtInput);
          document.InputDate = dtInput;

          Lets do a change request: * Input date always will be the current date.

          DateTime dtInput;
          DateTime.TryParse(DateTime.Now.ToString(), out dtInput);
          document.InputDate = dtInput;

          What is wrong with these people? They start coding and stop thinking?

          G Offline
          G Offline
          GenJerDan
          wrote on last edited by
          #4

          On the other hand, it makes it easier to go back to the original someday. :p

          No dogs or cats are in the classroom. My Mu[sic] My Films My Windows Programs, etc.

          B 1 Reply Last reply
          0
          • G GenJerDan

            On the other hand, it makes it easier to go back to the original someday. :p

            No dogs or cats are in the classroom. My Mu[sic] My Films My Windows Programs, etc.

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

            I have often written a change request with the expectation that it will get switched back to the original when the user realizes that it isn't really what they want. However, I comment out the old line(s) and and new code, not try to shove a square peg into a round hole. ;) :sigh:

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

            1 Reply Last reply
            0
            • S sergiogarcianinja

              This is the original code:

              DateTime dtInput;
              DateTime.TryParse(txtInputDate.Text, out dtInput);
              document.InputDate = dtInput;

              Lets do a change request: * Input date always will be the current date.

              DateTime dtInput;
              DateTime.TryParse(DateTime.Now.ToString(), out dtInput);
              document.InputDate = dtInput;

              What is wrong with these people? They start coding and stop thinking?

              L Offline
              L Offline
              Lutoslaw
              wrote on last edited by
              #6

              sergio_ykz wrote:

              They start coding and stop thinking?

              Yeah, they still don't get all that multithreading stuff.

              Greetings - Jacek

              1 Reply Last reply
              0
              • S sergiogarcianinja

                The original code has a infallible validation using Javascript. It never fails. Except when you change you server locale, or disable javascript, oh shit, I remember now, I had fixed this too.

                T Offline
                T Offline
                TorstenFrings
                wrote on last edited by
                #7

                sergio_ykz wrote:

                infallible validation using Javascript

                that was a nice one :D

                1 Reply Last reply
                0
                • S sergiogarcianinja

                  The original code has a infallible validation using Javascript. It never fails. Except when you change you server locale, or disable javascript, oh shit, I remember now, I had fixed this too.

                  E Offline
                  E Offline
                  ekolis
                  wrote on last edited by
                  #8

                  sergio_ykz wrote:

                  infallible validation using Javascript

                  var pope = new Pope(); // TODO - check for existence of another pope already, don't want to cause a schism!
                  pope.setExCathedraMode(true); // makes pope infallible
                  var inquisition = pope.createInquisition();
                  var result = inquisition.interrogate($("form"));
                  if (result.isHeretical)
                  pope.excommunicate($("form"));
                  pope.setExCathedraMode(false); // done being infallible, be a regular pope now

                  B 1 Reply Last reply
                  0
                  • S sergiogarcianinja

                    This is the original code:

                    DateTime dtInput;
                    DateTime.TryParse(txtInputDate.Text, out dtInput);
                    document.InputDate = dtInput;

                    Lets do a change request: * Input date always will be the current date.

                    DateTime dtInput;
                    DateTime.TryParse(DateTime.Now.ToString(), out dtInput);
                    document.InputDate = dtInput;

                    What is wrong with these people? They start coding and stop thinking?

                    Z Offline
                    Z Offline
                    ZurdoDev
                    wrote on last edited by
                    #9

                    Maybe they were thinking of the Mayan calendar. Pretty soon DateTime.Now will not parse.

                    1 Reply Last reply
                    0
                    • E ekolis

                      sergio_ykz wrote:

                      infallible validation using Javascript

                      var pope = new Pope(); // TODO - check for existence of another pope already, don't want to cause a schism!
                      pope.setExCathedraMode(true); // makes pope infallible
                      var inquisition = pope.createInquisition();
                      var result = inquisition.interrogate($("form"));
                      if (result.isHeretical)
                      pope.excommunicate($("form"));
                      pope.setExCathedraMode(false); // done being infallible, be a regular pope now

                      B Offline
                      B Offline
                      BloodyBaron
                      wrote on last edited by
                      #10

                      :laugh:

                      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