Changes goes whong
-
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?
-
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?
: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).
-
: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).
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.
-
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?
-
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.
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.
-
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?
-
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.
sergio_ykz wrote:
infallible validation using Javascript
that was a nice one :D
-
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.
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 -
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?
-
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:laugh: