I wrote:
>3) I was unable to successfully insert ASCII 0's into MySQL.  It 
>would truncate the insert.  To remedy this, I am escaping ASCII 0's 
>*after* the solution has been scored, but *before* inserting into 
>the database.  Here's the regex I am using:  s/\0/\\0/g;  All other 
>characters (ASCII 1-255) are being inserted successfully.

OK, I am a moron.  Matthew Wickline provided some feedback to my 
PGAS changes which spurred me to reconsider my ASCII 0 fix.  As I 
was preparing to email [EMAIL PROTECTED], I did a final ASCII 0 
insert test when I realized that it had been working all along!  
It was the mysql prompt that was breaking on ASCII 0, not the database 
itself.  I discovered this when I queried a solution with ASCII 0 
directly to file and then viewed the file in vi.  What looked like 
"Dave       " in the mysql prompt, looked like "Dave^@Hoover" in 
vi.  :-)

So, that little bit of nastiness has been disposed of.  This is good,
because now you will be able to tell in the post-mortem whether 
someone used a literal ASCII 0 or the two character \0.

>4) I used Eugene's post-mortem suggestions, tweaking them a little 
>in order to not escape tabs, newlines or carriage returns.  Here 
>is the code being used to display the solutions in the post-mortem:
>
>$code =~ s{([\x01-\x08\x0B\x0C\x0E-\x1f])}
>          {'<FONT COLOR="red">^'.($1^"\x40").'</FONT>'}ge;

This has been updated to:
$code =~ s{([\x00-\x08\x0B\x0C\x0E-\x1f])}
          {'<FONT COLOR="red">^'.($1^"\x40").'</FONT>'}ge;

which prints ASCII 0 as ^@.  This brings up another issue, should 
ASCII 0 be represented as \0 or ^@?

>To submit solutions to help with testing:
>http://perlgolf.sourceforge.net/cgi-bin/PGAS/leader.cgi?course=12
>
>To view your test solutions as they would appear in the post-mortem:
>http://perlgolf.sourceforge.net/cgi-bin/PGAS/ref_peek.cgi?id=9&secret=pg
>
>To test the referee interface, let me know and I'll set you up.
>
>To view the source code:
>http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/perlgolf/






Reply via email to