Re: array mystery

2012-05-14 Thread Bob Sneidar
Yup that is pretty much what Trevor did. 

Bob


On May 12, 2012, at 9:10 AM, Peter M. Brigham, MD wrote:

 On May 10, 2012, at 5:49 PM, Bob Sneidar wrote:
 
 I just forwarded an email Trevor sent to the list some time ago with the 
 code in it. 
 
 Bob
 
 
 On May 10, 2012, at 2:34 PM, Peter M. Brigham, MD wrote:
 
 It was apparently part of Trevor's sqlYoga, supposedly made available now 
 as an opensource utility handler, but I can't find it. The Nabble archives 
 show an altPrintKeys() function but the output is not a readable display 
 of the structure of an array, it's designed for utility work in massaging 
 arrays. I'd like to get hold of the original printKeys() handler somewhere. 
 Where can I find it?
 
 In case anyone else wants it, I'm posting below a slightly modified version 
 of the function, renamed displayArray to distinguish it from the variants 
 that Bob has posted for utility work. This version simply allows you to look 
 at the contents of an array in outline form, which makes the structure of the 
 array quite clear on inspection.
 
 -- Peter
 
 Peter M. Brigham
 pmb...@gmail.com
 http://home.comcast.net/~pmbrig
 
 --
 
 function displayArray @pArray, pFullData, pDimension
   -- displays an array as an outline-style list
   -- most useful for multidimensional arrays, to see the structure
   -- if an element of the array contains more than one line,
   --the first line only will be displayed (less confusing to look at)
   -- if you want to see the full data then pass pFullData = true
   -- pDimension is an internally used parameter
   -- pArray is referenced to avoid duplicating large arrays, but
   --the array is not altered by this function
 
   -- call it like this: put displayArray(tArray) into fld peruse
 
   -- requires spaces()
 
   if pDimension is empty then put 0 into pDimension
   if pFullData = empty then put false into pFullData
   put the keys of pArray into theKeys
   if line 1 of theKeys is a number then
  sort theKeys numeric
   else
  sort theKeys
   end if
   repeat for each line theKey in theKeys
  if pArray[theKey] is an array then
 put spaces(pDimension * 3)  theKey  cr after theText
 put pArray[theKey] into theTempArray
 put displayArray(theTempArray, pFullData, pDimension + 1) after 
 theText
  else
 if pFullData then
put spaces(pDimension * 3)  theKey  : \
pArray[theKey]  cr after theText
 else
put pArray[theKey] into tElement
if the number of lines of tElement  1 then
   put  ... into tTrailer
else
   put empty into tTrailer
end if
put spaces(pDimension * 3)  theKey  : \
(line 1 of tElement)  tTrailer  cr after theText
 end if
  end if
   end repeat
   return theText
 end displayArray
 
 function spaces n
   -- returns a string of n spaces
   put  into s
   repeat n
  put space after s
   end repeat
   return s
 end spaces
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: array mystery

2012-05-12 Thread Peter M. Brigham, MD
On May 10, 2012, at 5:49 PM, Bob Sneidar wrote:

 I just forwarded an email Trevor sent to the list some time ago with the code 
 in it. 
 
 Bob
 
 
 On May 10, 2012, at 2:34 PM, Peter M. Brigham, MD wrote:
 
 It was apparently part of Trevor's sqlYoga, supposedly made available now as 
 an opensource utility handler, but I can't find it. The Nabble archives show 
 an altPrintKeys() function but the output is not a readable display of the 
 structure of an array, it's designed for utility work in massaging arrays. 
 I'd like to get hold of the original printKeys() handler somewhere. Where 
 can I find it?

In case anyone else wants it, I'm posting below a slightly modified version of 
the function, renamed displayArray to distinguish it from the variants that 
Bob has posted for utility work. This version simply allows you to look at the 
contents of an array in outline form, which makes the structure of the array 
quite clear on inspection.

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig

--

function displayArray @pArray, pFullData, pDimension
   -- displays an array as an outline-style list
   -- most useful for multidimensional arrays, to see the structure
   -- if an element of the array contains more than one line,
   --the first line only will be displayed (less confusing to look at)
   -- if you want to see the full data then pass pFullData = true
   -- pDimension is an internally used parameter
   -- pArray is referenced to avoid duplicating large arrays, but
   --the array is not altered by this function
   
   -- call it like this: put displayArray(tArray) into fld peruse
   
   -- requires spaces()
   
   if pDimension is empty then put 0 into pDimension
   if pFullData = empty then put false into pFullData
   put the keys of pArray into theKeys
   if line 1 of theKeys is a number then
  sort theKeys numeric
   else
  sort theKeys
   end if
   repeat for each line theKey in theKeys
  if pArray[theKey] is an array then
 put spaces(pDimension * 3)  theKey  cr after theText
 put pArray[theKey] into theTempArray
 put displayArray(theTempArray, pFullData, pDimension + 1) after theText
  else
 if pFullData then
put spaces(pDimension * 3)  theKey  : \
pArray[theKey]  cr after theText
 else
put pArray[theKey] into tElement
if the number of lines of tElement  1 then
   put  ... into tTrailer
else
   put empty into tTrailer
end if
put spaces(pDimension * 3)  theKey  : \
(line 1 of tElement)  tTrailer  cr after theText
 end if
  end if
   end repeat
   return theText
end displayArray

function spaces n
   -- returns a string of n spaces
   put  into s
   repeat n
  put space after s
   end repeat
   return s
end spaces


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: array mystery

2012-05-10 Thread Peter M. Brigham, MD
Well, I've given up for the moment. Weeding out null characters made no 
difference, and arrayEncoding/decoding made no difference, and putting the text 
string into a field and getting the text of the field made no difference, so it 
wasn't the cross-platform line delimiter issue, as I had thought. I still don't 
know what the problem is. The debugger shows the correct array contents, but 
getting the array content from a script returns empty. I'm going to use a 
different page-scraping approach entirely when I can stand to go back to it -- 
that will be a bigger job.

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig

On May 9, 2012, at 5:53 PM, Peter Haworth wrote:

 Hi Peter,
 I know this is a bit late but I just remembered there's a pretty cool
 screen scraping plugin for Firefox called Outwit Hub.  I've used it a few
 times and it's worked very nicely.  Probably too late for you now since
 you've written LC handlers to do it.
 
 Pete
 lcSQL Software http://www.lcsql.com
 
 
 
 On Thu, May 3, 2012 at 10:47 AM, Peter M. Brigham, MD pmb...@gmail.comwrote:
 
 I have a customprop, CYPdata, that is an array, each element of which is
 an array itself. I am scraping the data to build CYPdata from an HTML page
 on the web, and filling it via script by parsing the HTML. There is an odd
 bug that I'm trying to get to the bottom of, and something strange is
 happening when I do the following in a test button:
 
 on mouseUp
  put the CYPdata of this stack into CYParray
  put CYParray[fluvoxamine] into aFLV
  put CYParray[doxepin] into aDOX
  put aFLV is an array into testFLV
  put aDOX is an array into testDOX
  breakpoint
 end mouseUp
 
 In the debugger variable pane at the breakpoint, expanding the array
 CYParray shows the keys, which are a whole list of drugs (as it should be),
 and each key/drug is indeed indicated as containing an array (with the
 little gray expansion triangle at the left). If I examine
 CYParray[fluvoxamine] by clicking the expansion triangle, it shows the
 elements of that array, as expected. Same for CYParray[doxepin]. The
 correct data is there in both cases. However, the aDOX variable does not
 display as an array (no expansion triangle) and testDOX = false, whereas
 aFLV is indeed an array, as displayed in the debugger and confirmed by
 testFLV = true.
 
 What could be going on here? As it happens, the doxepin case is handled
 differently from the fluvoxamine case when I parse the HTML in loading
 the array, since they appear in slightly different contexts, so that must
 be the source of the difference, but how can the debugger show the
 doxepin array keys properly but somehow CYParray[doxepin] not an array?
 Any ideas?
 
 -- Peter
 
 Peter M. Brigham
 pmb...@gmail.com
 http://home.comcast.net/~pmbrig
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: array mystery

2012-05-10 Thread Bob Sneidar
Have you tried to use printKeys() to convert the array to a string to view the 
array contents? Maybe you could set the clipboarddata[rtftext] to 
printkeys(myArray) and then paste the text into a text editor? You could make 
the array a global so you can see what it contains after the script finishes 
executing as well. 

Bob


On May 10, 2012, at 6:27 AM, Peter M. Brigham, MD wrote:

 Well, I've given up for the moment. Weeding out null characters made no 
 difference, and arrayEncoding/decoding made no difference, and putting the 
 text string into a field and getting the text of the field made no 
 difference, so it wasn't the cross-platform line delimiter issue, as I had 
 thought. I still don't know what the problem is. The debugger shows the 
 correct array contents, but getting the array content from a script returns 
 empty. I'm going to use a different page-scraping approach entirely when I 
 can stand to go back to it -- that will be a bigger job.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: array mystery

2012-05-10 Thread Peter M. Brigham, MD
Sorry, I know you've written about printkeys() but I don't have it. Is it a 
function handler? If so can you post it again or send it to me? Thanks.

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig

On May 10, 2012, at 12:02 PM, Bob Sneidar wrote:

 Have you tried to use printKeys() to convert the array to a string to view 
 the array contents? Maybe you could set the clipboarddata[rtftext] to 
 printkeys(myArray) and then paste the text into a text editor? You could make 
 the array a global so you can see what it contains after the script finishes 
 executing as well. 
 
 Bob
 
 
 On May 10, 2012, at 6:27 AM, Peter M. Brigham, MD wrote:
 
 Well, I've given up for the moment. Weeding out null characters made no 
 difference, and arrayEncoding/decoding made no difference, and putting the 
 text string into a field and getting the text of the field made no 
 difference, so it wasn't the cross-platform line delimiter issue, as I had 
 thought. I still don't know what the problem is. The debugger shows the 
 correct array contents, but getting the array content from a script returns 
 empty. I'm going to use a different page-scraping approach entirely when I 
 can stand to go back to it -- that will be a bigger job.
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: array mystery

2012-05-10 Thread Bob Sneidar
I believe it is part of the Datagrid library. Add a datagrid to your project 
and see if it works. 

Bob


On May 10, 2012, at 11:12 AM, Peter M. Brigham, MD wrote:

 Sorry, I know you've written about printkeys() but I don't have it. Is it a 
 function handler? If so can you post it again or send it to me? Thanks.
 
 -- Peter
 
 Peter M. Brigham
 pmb...@gmail.com
 http://home.comcast.net/~pmbrig
 
 On May 10, 2012, at 12:02 PM, Bob Sneidar wrote:
 
 Have you tried to use printKeys() to convert the array to a string to view 
 the array contents? Maybe you could set the clipboarddata[rtftext] to 
 printkeys(myArray) and then paste the text into a text editor? You could 
 make the array a global so you can see what it contains after the script 
 finishes executing as well. 
 
 Bob
 
 
 On May 10, 2012, at 6:27 AM, Peter M. Brigham, MD wrote:
 
 Well, I've given up for the moment. Weeding out null characters made no 
 difference, and arrayEncoding/decoding made no difference, and putting the 
 text string into a field and getting the text of the field made no 
 difference, so it wasn't the cross-platform line delimiter issue, as I had 
 thought. I still don't know what the problem is. The debugger shows the 
 correct array contents, but getting the array content from a script returns 
 empty. I'm going to use a different page-scraping approach entirely when I 
 can stand to go back to it -- that will be a bigger job.
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: array mystery

2012-05-10 Thread Peter M. Brigham, MD
It was apparently part of Trevor's sqlYoga, supposedly made available now as an 
opensource utility handler, but I can't find it. The Nabble archives show an 
altPrintKeys() function but the output is not a readable display of the 
structure of an array, it's designed for utility work in massaging arrays. I'd 
like to get hold of the original printKeys() handler somewhere. Where can I 
find it?

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig


On May 10, 2012, at 3:20 PM, Bob Sneidar wrote:

 I believe it is part of the Datagrid library. Add a datagrid to your project 
 and see if it works. 
 
 Bob
 
 
 On May 10, 2012, at 11:12 AM, Peter M. Brigham, MD wrote:
 
 Sorry, I know you've written about printkeys() but I don't have it. Is it a 
 function handler? If so can you post it again or send it to me? Thanks.
 
 -- Peter
 
 Peter M. Brigham
 pmb...@gmail.com
 http://home.comcast.net/~pmbrig
 
 On May 10, 2012, at 12:02 PM, Bob Sneidar wrote:
 
 Have you tried to use printKeys() to convert the array to a string to view 
 the array contents? Maybe you could set the clipboarddata[rtftext] to 
 printkeys(myArray) and then paste the text into a text editor? You could 
 make the array a global so you can see what it contains after the script 
 finishes executing as well. 
 
 Bob
 
 
 On May 10, 2012, at 6:27 AM, Peter M. Brigham, MD wrote:
 
 Well, I've given up for the moment. Weeding out null characters made no 
 difference, and arrayEncoding/decoding made no difference, and putting the 
 text string into a field and getting the text of the field made no 
 difference, so it wasn't the cross-platform line delimiter issue, as I had 
 thought. I still don't know what the problem is. The debugger shows the 
 correct array contents, but getting the array content from a script 
 returns empty. I'm going to use a different page-scraping approach 
 entirely when I can stand to go back to it -- that will be a bigger job.
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your 
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: array mystery

2012-05-10 Thread Bob Sneidar
I just forwarded an email Trevor sent to the list some time ago with the code 
in it. 

Bob


On May 10, 2012, at 2:34 PM, Peter M. Brigham, MD wrote:

 It was apparently part of Trevor's sqlYoga, supposedly made available now as 
 an opensource utility handler, but I can't find it. The Nabble archives show 
 an altPrintKeys() function but the output is not a readable display of the 
 structure of an array, it's designed for utility work in massaging arrays. 
 I'd like to get hold of the original printKeys() handler somewhere. Where can 
 I find it?


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: array mystery

2012-05-10 Thread Bob Sneidar
I had a conversation with someone some time ago and I had said it was part of 
the sqlYoga library. Someone corrected me and said it was part of the Datagrid 
Library. Seems I was initially correct. Adding a datagrid to your stack does 
not give you access to printkeys(), but using sqlYoga does. All moot since 
Trevor shared the function with us. 

Bob


On May 10, 2012, at 2:34 PM, Peter M. Brigham, MD wrote:

 I believe it is part of the Datagrid library. Add a datagrid to your project 
 and see if it works. 
 
 Bob
 


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: array mystery

2012-05-10 Thread Peter Haworth
I think it's in the datagrid library.  Form the message box, send
printkeys() to group yourdatagrid.  That works for me and I don't have
sqlYoga.
Pete
lcSQL Software http://www.lcsql.com



On Thu, May 10, 2012 at 2:51 PM, Bob Sneidar b...@twft.com wrote:

 I had a conversation with someone some time ago and I had said it was part
 of the sqlYoga library. Someone corrected me and said it was part of the
 Datagrid Library. Seems I was initially correct. Adding a datagrid to your
 stack does not give you access to printkeys(), but using sqlYoga does. All
 moot since Trevor shared the function with us.

 Bob


 On May 10, 2012, at 2:34 PM, Peter M. Brigham, MD wrote:

  I believe it is part of the Datagrid library. Add a datagrid to your
 project and see if it works.
 
  Bob
 


 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: array mystery

2012-05-10 Thread Bob Sneidar
Huh. I bet if I had saved the test stack then reopened it I would have been 
able to call the function. 

Bob


On May 10, 2012, at 3:12 PM, Peter Haworth wrote:

 I think it's in the datagrid library.  Form the message box, send
 printkeys() to group yourdatagrid.  That works for me and I don't have
 sqlYoga.
 Pete
 lcSQL Software http://www.lcsql.com
 
 
 
 On Thu, May 10, 2012 at 2:51 PM, Bob Sneidar b...@twft.com wrote:
 
 I had a conversation with someone some time ago and I had said it was part
 of the sqlYoga library. Someone corrected me and said it was part of the
 Datagrid Library. Seems I was initially correct. Adding a datagrid to your
 stack does not give you access to printkeys(), but using sqlYoga does. All
 moot since Trevor shared the function with us.
 
 Bob
 
 
 On May 10, 2012, at 2:34 PM, Peter M. Brigham, MD wrote:
 
 I believe it is part of the Datagrid library. Add a datagrid to your
 project and see if it works.
 
 Bob
 
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: array mystery

2012-05-09 Thread Peter Haworth
Hi Peter,
I know this is a bit late but I just remembered there's a pretty cool
screen scraping plugin for Firefox called Outwit Hub.  I've used it a few
times and it's worked very nicely.  Probably too late for you now since
you've written LC handlers to do it.

Pete
lcSQL Software http://www.lcsql.com



On Thu, May 3, 2012 at 10:47 AM, Peter M. Brigham, MD pmb...@gmail.comwrote:

 I have a customprop, CYPdata, that is an array, each element of which is
 an array itself. I am scraping the data to build CYPdata from an HTML page
 on the web, and filling it via script by parsing the HTML. There is an odd
 bug that I'm trying to get to the bottom of, and something strange is
 happening when I do the following in a test button:

 on mouseUp
   put the CYPdata of this stack into CYParray
   put CYParray[fluvoxamine] into aFLV
   put CYParray[doxepin] into aDOX
   put aFLV is an array into testFLV
   put aDOX is an array into testDOX
   breakpoint
 end mouseUp

 In the debugger variable pane at the breakpoint, expanding the array
 CYParray shows the keys, which are a whole list of drugs (as it should be),
 and each key/drug is indeed indicated as containing an array (with the
 little gray expansion triangle at the left). If I examine
 CYParray[fluvoxamine] by clicking the expansion triangle, it shows the
 elements of that array, as expected. Same for CYParray[doxepin]. The
 correct data is there in both cases. However, the aDOX variable does not
 display as an array (no expansion triangle) and testDOX = false, whereas
 aFLV is indeed an array, as displayed in the debugger and confirmed by
 testFLV = true.

 What could be going on here? As it happens, the doxepin case is handled
 differently from the fluvoxamine case when I parse the HTML in loading
 the array, since they appear in slightly different contexts, so that must
 be the source of the difference, but how can the debugger show the
 doxepin array keys properly but somehow CYParray[doxepin] not an array?
 Any ideas?

 -- Peter

 Peter M. Brigham
 pmb...@gmail.com
 http://home.comcast.net/~pmbrig


 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


array mystery

2012-05-03 Thread Peter M. Brigham, MD
I have a customprop, CYPdata, that is an array, each element of which is an 
array itself. I am scraping the data to build CYPdata from an HTML page on the 
web, and filling it via script by parsing the HTML. There is an odd bug that 
I'm trying to get to the bottom of, and something strange is happening when I 
do the following in a test button:

on mouseUp
   put the CYPdata of this stack into CYParray
   put CYParray[fluvoxamine] into aFLV
   put CYParray[doxepin] into aDOX
   put aFLV is an array into testFLV
   put aDOX is an array into testDOX
   breakpoint
end mouseUp

In the debugger variable pane at the breakpoint, expanding the array CYParray 
shows the keys, which are a whole list of drugs (as it should be), and each 
key/drug is indeed indicated as containing an array (with the little gray 
expansion triangle at the left). If I examine CYParray[fluvoxamine] by 
clicking the expansion triangle, it shows the elements of that array, as 
expected. Same for CYParray[doxepin]. The correct data is there in both 
cases. However, the aDOX variable does not display as an array (no expansion 
triangle) and testDOX = false, whereas aFLV is indeed an array, as displayed in 
the debugger and confirmed by testFLV = true.

What could be going on here? As it happens, the doxepin case is handled 
differently from the fluvoxamine case when I parse the HTML in loading the 
array, since they appear in slightly different contexts, so that must be the 
source of the difference, but how can the debugger show the doxepin array 
keys properly but somehow CYParray[doxepin] not an array? Any ideas?

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: array mystery

2012-05-03 Thread Ken Ray

On May 3, 2012, at 12:47 PM, Peter M. Brigham, MD wrote:

 I have a customprop, CYPdata, that is an array, each element of which is an 
 array itself. I am scraping the data to build CYPdata from an HTML page on 
 the web, and filling it via script by parsing the HTML. There is an odd bug 
 that I'm trying to get to the bottom of, and something strange is happening 
 when I do the following in a test button:
 
 on mouseUp
   put the CYPdata of this stack into CYParray
   put CYParray[fluvoxamine] into aFLV
   put CYParray[doxepin] into aDOX
   put aFLV is an array into testFLV
   put aDOX is an array into testDOX
   breakpoint
 end mouseUp
 
 In the debugger variable pane at the breakpoint, expanding the array CYParray 
 shows the keys, which are a whole list of drugs (as it should be), and each 
 key/drug is indeed indicated as containing an array (with the little gray 
 expansion triangle at the left). If I examine CYParray[fluvoxamine] by 
 clicking the expansion triangle, it shows the elements of that array, as 
 expected. Same for CYParray[doxepin]. The correct data is there in both 
 cases. However, the aDOX variable does not display as an array (no expansion 
 triangle) and testDOX = false, whereas aFLV is indeed an array, as displayed 
 in the debugger and confirmed by testFLV = true.
 
 What could be going on here? As it happens, the doxepin case is handled 
 differently from the fluvoxamine case when I parse the HTML in loading the 
 array, since they appear in slightly different contexts, so that must be the 
 source of the difference, but how can the debugger show the doxepin array 
 keys properly but somehow CYParray[doxepin] not an array? Any ideas?

Peter, instead of trying to store multidimensional arrays raw in the custom 
property; can you use arrayEncode/arrayDecode? I think it might help eliminate 
issues; so assuming you parse the HTML and you have the data in a 
multidimensional array variable CYParray, instead of doing:

  set the CYPdata of this stack to CYParray

do

  set the CYPdata of this stack to arrayEncode(CYParray)

… and then when you're ready to read it:

on mouseUp
  put arrayDecode(the CYPdata of this stack) into CYParray  -- changed line
  put CYParray[fluvoxamine] into aFLV
  put CYParray[doxepin] into aDOX
  put aFLV is an array into testFLV
  put aDOX is an array into testDOX
  breakpoint
end mouseUp

Ken Ray
Sons of Thunder Software, Inc.
Email: k...@sonsothunder.com
Web Site: http://www.sonsothunder.com/  

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: array mystery

2012-05-03 Thread Peter M. Brigham, MD
On May 3, 2012, at 3:10 PM, Ken Ray wrote:

 
 On May 3, 2012, at 12:47 PM, Peter M. Brigham, MD wrote:
 
 I have a customprop, CYPdata, that is an array, each element of which is an 
 array itself. I am scraping the data to build CYPdata from an HTML page on 
 the web, and filling it via script by parsing the HTML. There is an odd bug 
 that I'm trying to get to the bottom of, and something strange is happening 
 when I do the following in a test button:
 
 on mouseUp
  put the CYPdata of this stack into CYParray
  put CYParray[fluvoxamine] into aFLV
  put CYParray[doxepin] into aDOX
  put aFLV is an array into testFLV
  put aDOX is an array into testDOX
  breakpoint
 end mouseUp
 
 In the debugger variable pane at the breakpoint, expanding the array 
 CYParray shows the keys, which are a whole list of drugs (as it should be), 
 and each key/drug is indeed indicated as containing an array (with the 
 little gray expansion triangle at the left). If I examine 
 CYParray[fluvoxamine] by clicking the expansion triangle, it shows the 
 elements of that array, as expected. Same for CYParray[doxepin]. The 
 correct data is there in both cases. However, the aDOX variable does not 
 display as an array (no expansion triangle) and testDOX = false, whereas 
 aFLV is indeed an array, as displayed in the debugger and confirmed by 
 testFLV = true.
 
 What could be going on here? As it happens, the doxepin case is handled 
 differently from the fluvoxamine case when I parse the HTML in loading the 
 array, since they appear in slightly different contexts, so that must be the 
 source of the difference, but how can the debugger show the doxepin array 
 keys properly but somehow CYParray[doxepin] not an array? Any ideas?
 
 Peter, instead of trying to store multidimensional arrays raw in the custom 
 property; can you use arrayEncode/arrayDecode? I think it might help 
 eliminate issues; so assuming you parse the HTML and you have the data in a 
 multidimensional array variable CYParray, instead of doing:
 
  set the CYPdata of this stack to CYParray
 
 do
 
  set the CYPdata of this stack to arrayEncode(CYParray)
 
 … and then when you're ready to read it:
 
 on mouseUp
  put arrayDecode(the CYPdata of this stack) into CYParray  -- changed line
  put CYParray[fluvoxamine] into aFLV
  put CYParray[doxepin] into aDOX
  put aFLV is an array into testFLV
  put aDOX is an array into testDOX
  breakpoint
 end mouseUp
 
 Ken Ray

I'll try that. However, I'm suspecting a problem with the raw data fetched from 
the webpage, since after doing several filters on a section of the HTML 
containing doxepin I was left with something that looked like the correct 
list of meds, one to a line, but with some empty lines. When I tried to filter 
tList without empty it was left unchanged, and even doing a descending repeat 
loop to delete empty lines it was unchanged. I had to resort to a descending 
repeat loop checking if the number of words of line n of tList = 0 and deleting 
those. There appeared to be no tabs or detectable characters in tList (I would 
not expect tabs anyway in a distillation of HTMLtext). But there's something 
squirrely about the text I'm fetching. I'm wondering if it's related to line 
termination characters in some way, so I may try putting the raw text into a 
hidden field and then taking it out again before parsing it, to let the LC 
engine handle the cross-platform EOL/CR/LF complexities. But I'll try the 
arrayEncode/arrayDecode thing too.

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: array mystery

2012-05-03 Thread dunbarx
Peter.


There was a very recent thread about permissible chars for an array, and it 
seems that all chars except null work fine. is it possible that your 
recalcitrant empty lines might contain (or simply be) a null?


Craig



-Original Message-
From: Peter M. Brigham, MD pmb...@gmail.com
To: How to use LiveCode use-livecode@lists.runrev.com
Sent: Thu, May 3, 2012 4:33 pm
Subject: Re: array mystery


On May 3, 2012, at 3:10 PM, Ken Ray wrote:

 
 On May 3, 2012, at 12:47 PM, Peter M. Brigham, MD wrote:
 
 I have a customprop, CYPdata, that is an array, each element of which is an 
array itself. I am scraping the data to build CYPdata from an HTML page on the 
web, and filling it via script by parsing the HTML. There is an odd bug that 
I'm 
trying to get to the bottom of, and something strange is happening when I do 
the 
following in a test button:
 
 on mouseUp
  put the CYPdata of this stack into CYParray
  put CYParray[fluvoxamine] into aFLV
  put CYParray[doxepin] into aDOX
  put aFLV is an array into testFLV
  put aDOX is an array into testDOX
  breakpoint
 end mouseUp
 
 In the debugger variable pane at the breakpoint, expanding the array 
 CYParray 
shows the keys, which are a whole list of drugs (as it should be), and each 
key/drug is indeed indicated as containing an array (with the little gray 
expansion triangle at the left). If I examine CYParray[fluvoxamine] by 
clicking the expansion triangle, it shows the elements of that array, as 
expected. Same for CYParray[doxepin]. The correct data is there in both 
cases. 
However, the aDOX variable does not display as an array (no expansion triangle) 
and testDOX = false, whereas aFLV is indeed an array, as displayed in the 
debugger and confirmed by testFLV = true.
 
 What could be going on here? As it happens, the doxepin case is handled 
differently from the fluvoxamine case when I parse the HTML in loading the 
array, since they appear in slightly different contexts, so that must be the 
source of the difference, but how can the debugger show the doxepin array 
keys 
properly but somehow CYParray[doxepin] not an array? Any ideas?
 
 Peter, instead of trying to store multidimensional arrays raw in the custom 
property; can you use arrayEncode/arrayDecode? I think it might help eliminate 
issues; so assuming you parse the HTML and you have the data in a 
multidimensional array variable CYParray, instead of doing:
 
  set the CYPdata of this stack to CYParray
 
 do
 
  set the CYPdata of this stack to arrayEncode(CYParray)
 
 … and then when you're ready to read it:
 
 on mouseUp
  put arrayDecode(the CYPdata of this stack) into CYParray  -- changed line
  put CYParray[fluvoxamine] into aFLV
  put CYParray[doxepin] into aDOX
  put aFLV is an array into testFLV
  put aDOX is an array into testDOX
  breakpoint
 end mouseUp
 
 Ken Ray

I'll try that. However, I'm suspecting a problem with the raw data fetched from 
the webpage, since after doing several filters on a section of the HTML 
containing doxepin I was left with something that looked like the correct 
list 
of meds, one to a line, but with some empty lines. When I tried to filter 
tList 
without empty it was left unchanged, and even doing a descending repeat loop 
to 
delete empty lines it was unchanged. I had to resort to a descending repeat 
loop 
checking if the number of words of line n of tList = 0 and deleting those. 
There 
appeared to be no tabs or detectable characters in tList (I would not expect 
tabs anyway in a distillation of HTMLtext). But there's something squirrely 
about the text I'm fetching. I'm wondering if it's related to line termination 
characters in some way, so I may try putting the raw text into a hidden field 
and then taking it out again before parsing it, to let the LC engine handle the 
cross-platform EOL/CR/LF complexities. But I'll try the arrayEncode/arrayDecode 
thing too.

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

 
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: array mystery

2012-05-03 Thread Peter M. Brigham, MD
On May 3, 2012, at 3:10 PM, Ken Ray wrote:

 
 On May 3, 2012, at 12:47 PM, Peter M. Brigham, MD wrote:
 
 I have a customprop, CYPdata, that is an array, each element of which is an 
 array itself. I am scraping the data to build CYPdata from an HTML page on 
 the web, and filling it via script by parsing the HTML. There is an odd bug 
 that I'm trying to get to the bottom of, and something strange is happening 
 when I do the following in a test button:
 
 on mouseUp
  put the CYPdata of this stack into CYParray
  put CYParray[fluvoxamine] into aFLV
  put CYParray[doxepin] into aDOX
  put aFLV is an array into testFLV
  put aDOX is an array into testDOX
  breakpoint
 end mouseUp
 
 In the debugger variable pane at the breakpoint, expanding the array 
 CYParray shows the keys, which are a whole list of drugs (as it should be), 
 and each key/drug is indeed indicated as containing an array (with the 
 little gray expansion triangle at the left). If I examine 
 CYParray[fluvoxamine] by clicking the expansion triangle, it shows the 
 elements of that array, as expected. Same for CYParray[doxepin]. The 
 correct data is there in both cases. However, the aDOX variable does not 
 display as an array (no expansion triangle) and testDOX = false, whereas 
 aFLV is indeed an array, as displayed in the debugger and confirmed by 
 testFLV = true.
 
 What could be going on here? As it happens, the doxepin case is handled 
 differently from the fluvoxamine case when I parse the HTML in loading the 
 array, since they appear in slightly different contexts, so that must be the 
 source of the difference, but how can the debugger show the doxepin array 
 keys properly but somehow CYParray[doxepin] not an array? Any ideas?
 
 Peter, instead of trying to store multidimensional arrays raw in the custom 
 property; can you use arrayEncode/arrayDecode? I think it might help 
 eliminate issues; so assuming you parse the HTML and you have the data in a 
 multidimensional array variable CYParray, instead of doing:
 
  set the CYPdata of this stack to CYParray
 
 do
 
  set the CYPdata of this stack to arrayEncode(CYParray)
 
 … and then when you're ready to read it:
 
 on mouseUp
  put arrayDecode(the CYPdata of this stack) into CYParray  -- changed line
  put CYParray[fluvoxamine] into aFLV
  put CYParray[doxepin] into aDOX
  put aFLV is an array into testFLV
  put aDOX is an array into testDOX
  breakpoint
 end mouseUp

Well, arrayEncoding/decoding doesn't change anything and neither does putting 
the text into a hidden field and then putting the text of the field back into a 
variable. The debugger still sees CYParray[doxepin] as an array, with the 
correct keys and data visible, but
   put (CYParray[doxepin] is an array) into testDOX
still gives testDOX = false, and 
   put CYParray[doxepin][3A456] into shouldBeX
gives empty, when it should be x. The same construction for 
CYParray[fluvoxamine] works as expected.

I'm stumped. Looks as if I'll have to try a whole different approach, which I 
can do, but I'm very troubled by not understanding at all what is going on. It 
makes no sense. I can tolerate not understanding something if I have some 
glimmerings and know that I could get to the bottom of it if I work at it, but 
I hate not having a clue at all.

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: array mystery

2012-05-03 Thread Peter M. Brigham, MD
On May 3, 2012, at 5:34 PM, dunb...@aol.com wrote:

 Peter.
 
 There was a very recent thread about permissible chars for an array, and it 
 seems that all chars except null work fine. is it possible that your 
 recalcitrant empty lines might contain (or simply be) a null?

Would putting the string into a field then putting the text of the field back 
into a variable remove any null characters?

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: array mystery

2012-05-03 Thread Richard Gaskin

Peter M. Brigham wrote:

On May 3, 2012, at 5:34 PM, dunbarx at aol.com wrote:


Peter.

There was a very recent thread about permissible chars for an array, and it 
seems that all chars except null work fine. is it possible that your 
recalcitrant empty lines might contain (or simply be) a null?


Would putting the string into a field then putting the text of the field back 
into a variable remove any null characters?


I don't think so, but this will:

  replace NULL with empty in tSomeData

--
 Richard Gaskin
 Fourth World
 LiveCode training and consulting: http://www.fourthworld.com
 Webzine for LiveCode developers: http://www.LiveCodeJournal.com
 LiveCode Journal blog: http://LiveCodejournal.com/blog.irv

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: array mystery

2012-05-03 Thread Bob Sneidar
check for null or other special characters?

Bob


On May 3, 2012, at 10:47 AM, Peter M. Brigham, MD wrote:

 I have a customprop, CYPdata, that is an array, each element of which is an 
 array itself. I am scraping the data to build CYPdata from an HTML page on 
 the web, and filling it via script by parsing the HTML. There is an odd bug 
 that I'm trying to get to the bottom of, and something strange is happening 
 when I do the following in a test button:
 
 on mouseUp
   put the CYPdata of this stack into CYParray
   put CYParray[fluvoxamine] into aFLV
   put CYParray[doxepin] into aDOX
   put aFLV is an array into testFLV
   put aDOX is an array into testDOX
   breakpoint
 end mouseUp
 
 In the debugger variable pane at the breakpoint, expanding the array CYParray 
 shows the keys, which are a whole list of drugs (as it should be), and each 
 key/drug is indeed indicated as containing an array (with the little gray 
 expansion triangle at the left). If I examine CYParray[fluvoxamine] by 
 clicking the expansion triangle, it shows the elements of that array, as 
 expected. Same for CYParray[doxepin]. The correct data is there in both 
 cases. However, the aDOX variable does not display as an array (no expansion 
 triangle) and testDOX = false, whereas aFLV is indeed an array, as displayed 
 in the debugger and confirmed by testFLV = true.
 
 What could be going on here? As it happens, the doxepin case is handled 
 differently from the fluvoxamine case when I parse the HTML in loading the 
 array, since they appear in slightly different contexts, so that must be the 
 source of the difference, but how can the debugger show the doxepin array 
 keys properly but somehow CYParray[doxepin] not an array? Any ideas?
 
 -- Peter
 
 Peter M. Brigham
 pmb...@gmail.com
 http://home.comcast.net/~pmbrig
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode