The weirdest bug in the answer entry form
-
Hullu
- Posts: 2
- Joined: Wed Nov 26, 2008 1:52 pm
The weirdest bug in the answer entry form
The strangest thing happened to me when tackling the problem 50 today. I got the right answer and tried to submit it in(copy paste). The website kindly told me that my answer was wrong.
Debugged for an hour. Tried it again, thought I probably mispasted it. Fail.
Two more hours of debugging, the algorithm unchanged. Now I consulted a friend on my logic, and he couldn't find a fault in my logic, told him my answer, he said it was correct.
Went back to answer form, checked num from another window, looked that browser autocomplete still had it, took it from there, fail.
Copypasted it, fail.
Typed it by hand, success.
Any ideas?(apart from the obvious 'type manually') I've pretty much used similiar copy paste for all my answer this far, this was the first one to act weird.
Debugged for an hour. Tried it again, thought I probably mispasted it. Fail.
Two more hours of debugging, the algorithm unchanged. Now I consulted a friend on my logic, and he couldn't find a fault in my logic, told him my answer, he said it was correct.
Went back to answer form, checked num from another window, looked that browser autocomplete still had it, took it from there, fail.
Copypasted it, fail.
Typed it by hand, success.
Any ideas?(apart from the obvious 'type manually') I've pretty much used similiar copy paste for all my answer this far, this was the first one to act weird.
- hk
- Administrator
- Posts: 12831
- Joined: Sun Mar 26, 2006 10:34 am
- Location: Haren, Netherlands
Re: The weirdest bug in the answer entry form
A possible reason could be that the answer you copy-pasted had a leading or trailing space.

War ruins the life and health of untold numbers of innocent children.
-
Hullu
- Posts: 2
- Joined: Wed Nov 26, 2008 1:52 pm
Re: The weirdest bug in the answer entry form
Aye, that is in the realm of possibilities. Actually I am more curious really than interested in ideas how to not make this happen again. I probably learnt my lesson;)
If someone with access to logs (if there are decent logs) would look at this, he could perhaps peek into what really happened in there and why the seemingly simple number comparison failed. My username is the same in there.
If someone with access to logs (if there are decent logs) would look at this, he could perhaps peek into what really happened in there and why the seemingly simple number comparison failed. My username is the same in there.
-
TripleM
- Posts: 384
- Joined: Fri Sep 12, 2008 3:31 am
Re: The weirdest bug in the answer entry form
Try checking the autocomplete again.. it may well come up with the two different versions.
- rayfil
- Administrator
- Posts: 1412
- Joined: Sun Mar 26, 2006 5:30 am
- Location: Quebec, Canada
- Contact:
Re: The weirdest bug in the answer entry form
You won't be able to do that with Problem 50 because the answer box will not be displayed since you already have solved that problem.TripleM wrote:Try checking the autocomplete again.. it may well come up with the two different versions.
However, you can try it in the answer box for any other problem you have not yet solved. Start entering your answer for Problem 50 and see if two apparently similar answers are suggested. If so, you had probably entered a trailing space or other trailing non-visible character. If only the Problem 50 answer is suggested, you may want to erase whatever you started entering and start over with a leading space followed by the first few digits and see if something is suggested.
When you assume something, you risk being wrong half the time.
-
Ikcelaks
- Posts: 28
- Joined: Wed Oct 15, 2008 9:08 pm
Re: The weirdest bug in the answer entry form
Has any consideration been given to modifying the answer processing code to trim leading and trailing white-space (since no nonevil problem would actually attribute any meaning to them)? I had this happen to me once soon after I joined, before I realized that I needed to be very carful with my copy and pasting.
Of course, it's also more than reasonable to expect the submitter to make sure that the answer exactly fits the formatting requirements, so I can see both sides.
Of course, it's also more than reasonable to expect the submitter to make sure that the answer exactly fits the formatting requirements, so I can see both sides.
-
LarryC
Re: The weirdest bug in the answer entry form
I agree very much with the idea that basic trimming should be added. Spaces, tabs and other whitespace characters, as said, don't change an answer in any way...
- hk
- Administrator
- Posts: 12831
- Joined: Sun Mar 26, 2006 10:34 am
- Location: Haren, Netherlands
Re: The weirdest bug in the answer entry form
Laziness rules.
Personally I think that's the user's responsibility.
Personally I think that's the user's responsibility.

War ruins the life and health of untold numbers of innocent children.
- arif
- Posts: 111
- Joined: Tue Oct 09, 2007 4:35 am
- Location: Lahore, Pakistan
Re: The weirdest bug in the answer entry form
One could say that about anything, but building a compiler that provides no syntax error feedback other than "Operator Error" would be considered a fault of the compiler. Although one could say that the programmer should have typed the program in without any syntax error in the first place.Personally I think that's the user's responsibility.
Similarly, here since most answers are computed elsewhere, and then copy-pasted into the answer box, there is a strong liklihood of leading trailing spaces or even CR-LF characters. A bit of trimming would be very helpful. Especially since if a right answer is marked wrong, the user goes into a deep spin trying to work out errors for days perhaps. Also, few people would be persistent enough to keep trying the same answer again.
So, even though laziness rules, I think it would be a feature that is amongst the more important ones, if we could provide it.
The i-th root of i = 4.810477381
-
nickmcclendon
- Posts: 2
- Joined: Fri Nov 28, 2008 4:43 am
Re: The weirdest bug in the answer entry form
Sometimes copy/paste will include null bytes and other unnoticeable characters.
- hk
- Administrator
- Posts: 12831
- Joined: Sun Mar 26, 2006 10:34 am
- Location: Haren, Netherlands
Re: The weirdest bug in the answer entry form
Come on guys, are you programmers or are you not.
Presumably your pet programming language has an instruction to put a string on the clipboard.
So instead of writing your answer to some output device, and copy-paste it from there, let your program write your answer directly to the clipboard as string.
In my pet programming language Delphi that's easy as pie:
1) add clipbrd to your uses clause.
2) convert your answer to a string, say s.
3) clipboard.astext:=s
That's all that is needed.
Presumably your pet programming language has an instruction to put a string on the clipboard.
So instead of writing your answer to some output device, and copy-paste it from there, let your program write your answer directly to the clipboard as string.
In my pet programming language Delphi that's easy as pie:
1) add clipbrd to your uses clause.
2) convert your answer to a string, say s.
3) clipboard.astext:=s
That's all that is needed.

War ruins the life and health of untold numbers of innocent children.
-
LarryC
Re: The weirdest bug in the answer entry form
I really can't see any argument against it.
And, as for the clipboard method, it isn't exactly elegant and would be extremely difficult in some languages such as C. Even on the assumption you can easily copy a string to the clipboard, it's hardly an elegant solution. Writing extra code, that could or could not be correct and working only adds further uncertainty to an answer.
I'm in the belief that the problems are the only thing that are supposed to be hard. When something could be easier or the same in all circumstances why not do it?
And, as for the clipboard method, it isn't exactly elegant and would be extremely difficult in some languages such as C. Even on the assumption you can easily copy a string to the clipboard, it's hardly an elegant solution. Writing extra code, that could or could not be correct and working only adds further uncertainty to an answer.
I'm in the belief that the problems are the only thing that are supposed to be hard. When something could be easier or the same in all circumstances why not do it?
- euler
- Administrator
- Posts: 5095
- Joined: Sun Mar 05, 2006 4:49 pm
- Location: Cheshire, England
- Contact:
Re: The weirdest bug in the answer entry form
The title of the thread made me chuckle: "The weirdest bug in the answer entry form". GIGO comes to mind.
Personally I agree with hk and wonder how someone could solve such a complex problem and then struggle to copy and paste a piece of data. However, I also appreciate that, in the excitement to see your carefully crafted script finally come to a stop and tantalisingly display its solution, you may inadvertently "over-highlight" and capture a leading or trailing character. So I've modified the script to "trim" the string. I just hope the server doesn't get a little over-zealous and start trimming one or two digits from your answer. Now that would be a weird bug!
Personally I agree with hk and wonder how someone could solve such a complex problem and then struggle to copy and paste a piece of data. However, I also appreciate that, in the excitement to see your carefully crafted script finally come to a stop and tantalisingly display its solution, you may inadvertently "over-highlight" and capture a leading or trailing character. So I've modified the script to "trim" the string. I just hope the server doesn't get a little over-zealous and start trimming one or two digits from your answer. Now that would be a weird bug!

impudens simia et macrologus profundus fabulae
- hk
- Administrator
- Posts: 12831
- Joined: Sun Mar 26, 2006 10:34 am
- Location: Haren, Netherlands
Re: The weirdest bug in the answer entry form
Anyhow, the whole discussion made me write a program that
1) looks if there is a string on the clipboard; if not quits.
2) if so fetches it and removes all whitespaces/non printable characters from it
3) writes the result back to the clipboard.
(took me a few minutes to write).
Very handy as I have to upload problems now and then and always have to pay special care I do not include trailing spaces.
(I did once: that was a nice bug.....).
I'll put a shortcut to it on my desktop. (Allbeit rather inelegant according to some).
1) looks if there is a string on the clipboard; if not quits.
2) if so fetches it and removes all whitespaces/non printable characters from it
3) writes the result back to the clipboard.
(took me a few minutes to write).
Very handy as I have to upload problems now and then and always have to pay special care I do not include trailing spaces.
(I did once: that was a nice bug.....).
I'll put a shortcut to it on my desktop. (Allbeit rather inelegant according to some).

War ruins the life and health of untold numbers of innocent children.