Author Topic: Code replacement bug?  (Read 4808 times)

Offline dsidaway

  • Newcomer
  • *
  • Posts: 27
    • View Profile
Code replacement bug?
« on: April 22, 2010, 03:56:38 PM »
Hi Kirk

I'm wondering if there is a bug related to code replacements.
When using code replacements, I don't write the code replacement script when I'm filling out my caption, I have most of the script applied to the caption field at the Ingest point (example below). I've added a link to an 18 second video of the quirk in action.

Example caption after Ingest.
"MONTREAL, QUEBEC: MARCH 13, 2010 - \tpnzXX vs \tpnxXX during 1st period action at the Bell Centre in Montreal, on Saturday, March 13, 2010. (THE GAZETTE/Dave Sidaway)"

Here's what's happening.
I delete the "XX" and add the jersey number and \ to the rightside code (\tpnxXX) and the return looks like this = \tpnx8\. Next, I do the left code...  "\tpnzXX" becomes "Montreal Canadiens left wing Mike Cammalleri #13"... as expected. I return to the "\tpnx8\", delete the "8", retype 8" and the return = "Washington Capitals left wing Alex Ovechkin #8".

I have yet to replicate this bug when I do my code replacement starting with the "\tpnzXX" then do the "\tpnxXX".

Example video.
http://files.me.com/davesidaway/z229v4.mov

PM 4.6.3
MB Pro Intel OS 10.5.8

Dave

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 25020
    • View Profile
    • Camera Bits, Inc.
Re: Code replacement bug?
« Reply #1 on: April 22, 2010, 04:45:52 PM »
Dave,

I'm wondering if there is a bug related to code replacements.
When using code replacements, I don't write the code replacement script when I'm filling out my caption, I have most of the script applied to the caption field at the Ingest point (example below). I've added a link to an 18 second video of the quirk in action.

Example caption after Ingest.
"MONTREAL, QUEBEC: MARCH 13, 2010 - \tpnzXX vs \tpnxXX during 1st period action at the Bell Centre in Montreal, on Saturday, March 13, 2010. (THE GAZETTE/Dave Sidaway)"

Here's what's happening.
I delete the "XX" and add the jersey number and \ to the rightside code (\tpnxXX) and the return looks like this = \tpnx8\. Next, I do the left code...  "\tpnzXX" becomes "Montreal Canadiens left wing Mike Cammalleri #13"... as expected. I return to the "\tpnx8\", delete the "8", retype 8" and the return = "Washington Capitals left wing Alex Ovechkin #8".

I have yet to replicate this bug when I do my code replacement starting with the "\tpnzXX" then do the "\tpnxXX".

What does your Code Replacement file look like?  If you can, please upload it using the 'Additional Options...' link when you're composing your message.

-Kirk

Offline dsidaway

  • Newcomer
  • *
  • Posts: 27
    • View Profile
Re: Code replacement bug?
« Reply #2 on: April 25, 2010, 07:05:45 PM »
Kirk

Here's the file... downloaded from Stonepix.com.

[attachment deleted by admin]
« Last Edit: April 25, 2010, 07:58:44 PM by dsidaway »

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 25020
    • View Profile
    • Camera Bits, Inc.
Re: Code replacement bug?
« Reply #3 on: April 26, 2010, 12:17:40 PM »
Dave,

Here's the file... downloaded from Stonepix.com.

I was able to reproduce the issue.  The parser was a bit naive.  In your example you've got:

\tpnzXX vs \tpnxXX

Notice that "\tpnzXX vs \" is a fully delimited code.  Code Replacement found no match for "tpnzXX vs " so it skipped onto searching the rest of the string and found no other fully delimited codes.  So when you erased the "XX" of "tpnxXX" and entered '8\' the text looked like this:

\tpnzXX vs \tpnx8\

Code Replacement still sees "\tpnzXX vs \" as the first fully delimited code but finds no match and scans beyond that match and finds "\ during 1st period action at the Bell Centre in Montreal, on Saturday, March 13, 2010. (THE GAZETTE/Dave Sidaway)" but finds no ending delimiter.  So when you go back and cause the first code to become "\tpnz13\" it performs the replacement and now sees "\tpnx8\".

I have changed the code to start the scan for matches from the character following the first delimiter it finds.  This solves the problem and does not introduce any side effects that I know of.

The next beta will have this correction.

Thanks for the video, the sample Code Replacement text file, and the description of the problem.

-Kirk

Offline Bob

  • Member
  • **
  • Posts: 70
    • View Profile
Re: Code replacement bug?
« Reply #4 on: April 26, 2010, 06:07:59 PM »
Kirk...
does that mean \tpn36 will generate a code replacement without the last "\" ?
and if so, how would you discriminate between \tpn3 and \tpn36  ?  Wouldn't you get a replacement before you got to the last 6?

or am I not reading your change right?

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 25020
    • View Profile
    • Camera Bits, Inc.
Re: Code replacement bug?
« Reply #5 on: April 26, 2010, 07:02:36 PM »
Bob,

does that mean \tpn36 will generate a code replacement without the last "\" ?
and if so, how would you discriminate between \tpn3 and \tpn36  ?  Wouldn't you get a replacement before you got to the last 6?

No, it just won't get fooled by "\blah and \foo\" as long as the text 'blah and' isn't a code and you don't have a default replacement, otherwise the default replacement will be inserted in place of 'blah and '.

You will still need both 'ends' of the code delimiters.

-Kirk

Offline dsidaway

  • Newcomer
  • *
  • Posts: 27
    • View Profile
Re: Code replacement bug?
« Reply #6 on: April 26, 2010, 08:06:18 PM »
Thanks Kirk

It would have been smarter if I had made the replacement code \tpnz\ vs \tpnx\. Delete the delimiter, then add the number and then add the delimiter.