Duplicating XML tree

2014-06-16 Thread Mark Schonewille

Hi,

I have an XML tree in memory, loaded with revXMLCreateTreeFromFile. Now 
I want to make a copy of the tree. I could load it from file again, but 
it seems more logical to me to duplicate the existing tree, something 
like revXMLCopyTree, but that function doesn't seem to exist. Is there a 
command or function for this purpose that I haven't discovered yet?


--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Installer Maker for LiveCode:
http://qery.us/468

Buy my new book Programming LiveCode for the Real Beginner 
http://qery.us/3fi


LiveCode on Facebook:
https://www.facebook.com/groups/runrev/

___
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: Duplicating XML tree

2014-06-16 Thread Martin Koob
I think you can do it this way.

   put revXMLtext(tTreeID) into tXMLdata
   put revXMLCreateTree(tXMLdata,false,true,false) into tTreeIDCopy

Martin



--
View this message in context: 
http://runtime-revolution.278305.n4.nabble.com/Duplicating-XML-tree-tp4680494p4680495.html
Sent from the Revolution - User mailing list archive at Nabble.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: Duplicating XML tree

2014-06-16 Thread Mark Schonewille

Hi Martin,

I was hoping to copy the tree directly. I thought of your solution and I 
could also load the tree from file twice in this particular case, but 
I'd rather copy an existing tree directly if possible.


--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Installer Maker for LiveCode:
http://qery.us/468

Buy my new book Programming LiveCode for the Real Beginner 
http://qery.us/3fi


LiveCode on Facebook:
https://www.facebook.com/groups/runrev/

On 6/16/2014 16:07, Martin Koob wrote:

I think you can do it this way.

put revXMLtext(tTreeID) into tXMLdata
put revXMLCreateTree(tXMLdata,false,true,false) into tTreeIDCopy

Martin



___
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


numberFormat question

2014-06-16 Thread dfepstein


I am trying to set the numberFormat so that calculation is precise enough for 
the situation.  Since I don't know ahead of time how many decimal places will 
be used, I wrote a function that I hoped would adjust things as necessary. 
But when this function is called with parameters m = 1.09131 and n = .001 
and k = 1, it returns 1.09131 rather than 1.0913101. 
The last couple of lines were added for testing, and the debugger shows that 
the numberFormat is being set correctly but that the truncated value is put 
into hold. 
Can anybody see what is going wrong? 



Many thanks. 



David Epstein 



function preciseEnough m,n,k 
   -- return the value m + k*n 
   -- default numberFormat shows up to 6 decimal places 
   -- If m, n, or k  has more than that precision, this function sets the 
numberFormat with a margin of safety 
   -- before returning the answer 
   put length(m) - offset(.,m) into aPlaces 
   put length(n) - offset(.,n) into bPlaces 
   put length(k) - offset(.,k) into cPlaces 
   put the numberFormat into myString 
   if max(aPlaces,bPlaces,cPlaces) + 4  length(myString) then 
  get myString   
  set the numberFormat to it 
   end if 
   put the numberFormat into nf 
   put m + k*n into hold 
   return hold 
end preciseEnough 
___
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

Diagnosing server error 400

2014-06-16 Thread J. Landman Gay
I need help figuring out why AWS is returning an error 400 bad request 
in a limited number of cases. We have a test group of some dozens of 
people and only 2 have the problem.


What I know:

The data sent to the server is the same for everyone, and is correctly 
formatted. I have logs of that and the requests are okay.


One person moved to another computer (and consequently another network) 
and the problem resolved itself.


Once, my client was getting the same 400 error all morning and then that 
afternoon it started working again by itself, without changing anything.


This definitely seems network-related to me but I don't know what it 
could be. The queries are reaching AWS and it is returning the error. We 
don't have access (or don't know how) to see the server logs that Amazon 
has; we only have access to the logs on our own server, and the requests 
never get that far.


Any ideas?

--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.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: numberFormat question

2014-06-16 Thread Mark Schonewille

David,

The numberformat doesn't affect precision. It only affects output as is 
shown by


on mouseUp
   set the numberformat to 00
   put 0.01*1 into x
   set the numberformat to 00.00
   put x*1
end mouseUp

It even only affects the current handler and doesn't affect precision in 
calling handlers:


on mouseUp
   // default is 0.##
   put a1() into x
   put x*1
end mouseUp

function a1
   set the numberformat to 00
   return 0.01*1
end a1

The above script returns 0.01 instead of 00.

I don't think LiveCode allows you to adjust the precision as other 
languages to with e.g. signed and unsigned integers and floating 
precision. You'd have to write special routines for this.


I think there is quite a lot of discussion to find in the archives about 
high precision and floating point numbers.


--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Installer Maker for LiveCode:
http://qery.us/468

Buy my new book Programming LiveCode for the Real Beginner 
http://qery.us/3fi


LiveCode on Facebook:
https://www.facebook.com/groups/runrev/

On 6/16/2014 20:13, dfepst...@comcast.net wrote:



I am trying to set the numberFormat so that calculation is precise enough for 
the situation.  Since I don't know ahead of time how many decimal places will 
be used, I wrote a function that I hoped would adjust things as necessary.
But when this function is called with parameters m = 1.09131 and n = .001 
and k = 1, it returns 1.09131 rather than 1.0913101.
The last couple of lines were added for testing, and the debugger shows that 
the numberFormat is being set correctly but that the truncated value is put 
into hold.
Can anybody see what is going wrong?



Many thanks.



David Epstein



function preciseEnough m,n,k
-- return the value m + k*n
-- default numberFormat shows up to 6 decimal places
-- If m, n, or k  has more than that precision, this function sets the 
numberFormat with a margin of safety
-- before returning the answer
put length(m) - offset(.,m) into aPlaces
put length(n) - offset(.,n) into bPlaces
put length(k) - offset(.,k) into cPlaces
put the numberFormat into myString
if max(aPlaces,bPlaces,cPlaces) + 4  length(myString) then
   get myString  
   set the numberFormat to it
end if
put the numberFormat into nf
put m + k*n into hold
return hold
end preciseEnough



___
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: numberFormat question

2014-06-16 Thread J. Landman Gay

On 6/16/2014, 1:13 PM, dfepst...@comcast.net wrote:



I am trying to set the numberFormat so that calculation is precise enough for 
the situation.  Since I don't know ahead of time how many decimal places will 
be used, I wrote a function that I hoped would adjust things as necessary.
But when this function is called with parameters m = 1.09131 and n = .001 
and k = 1, it returns 1.09131 rather than 1.0913101.
The last couple of lines were added for testing, and the debugger shows that 
the numberFormat is being set correctly but that the truncated value is put 
into hold.
Can anybody see what is going wrong?



Many thanks.



David Epstein



function preciseEnough m,n,k
-- return the value m + k*n
-- default numberFormat shows up to 6 decimal places
-- If m, n, or k  has more than that precision, this function sets the 
numberFormat with a margin of safety
-- before returning the answer
put length(m) - offset(.,m) into aPlaces
put length(n) - offset(.,n) into bPlaces
put length(k) - offset(.,k) into cPlaces
put the numberFormat into myString
if max(aPlaces,bPlaces,cPlaces) + 4  length(myString) then
   get myString  
   set the numberFormat to it
end if
put the numberFormat into nf
put m + k*n into hold
return hold
end preciseEnough


As Mark said, numberformat is only retained during the local handler so 
you need to reset it each time the handler runs.


When you use #, it means to include a numerical value in that postion 
only if there is an actual value there; if there is no value then that 
position is ignored. If you use 0 in the numberformat instead, empty 
positions are padded with zeros. So, to get the precision you want, you 
don't need to calculate the number of places/positions, just use the # 
as you are now. Include enough #s to cover your longest anticipated 
number, up to LC limits (I think that's 16 places.)


Since numberformat only affects the display, you need to force the 
calculation from a numerical value to a text value. You can do that by 
simply putting the result of the calculation into a field. If you want 
it in a variable, you can use value() to do that instead.


So your whole handler can be like this:

function preciseEnough m,n,k
  put m + k*n into hold
  set the numberformat to 0.## -- add more if you want
  put value(hold) into hold
  return hold
end preciseEnough

--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.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: numberFormat question

2014-06-16 Thread Bob Sneidar
Also, if you don’t care about display, just set the *precision* to LC max. 
Numberformat is as others have posted, really a display function. After you are 
done, set the numberFormat back to default or “0”. I bit myself in the butt 
because I had a counter that I was using to append a number to a variable name, 
and it hosed my names.  

Bob S


On Jun 16, 2014, at 11:13 , dfepst...@comcast.net dfepst...@comcast.net 
wrote:

 
 
 I am trying to set the numberFormat so that calculation is precise enough for 
 the situation.  Since I don't know ahead of time how many decimal places will 
 be used, I wrote a function that I hoped would adjust things as necessary. 
 But when this function is called with parameters m = 1.09131 and n = .001 
 and k = 1, it returns 1.09131 rather than 1.0913101. 
 The last couple of lines were added for testing, and the debugger shows that 
 the numberFormat is being set correctly but that the truncated value is put 
 into hold. 
 Can anybody see what is going wrong? 
 
 
 
 Many thanks. 
 
 
 
 David Epstein 
 
 
 
 function preciseEnough m,n,k 
-- return the value m + k*n 
-- default numberFormat shows up to 6 decimal places 
-- If m, n, or k  has more than that precision, this function sets the 
 numberFormat with a margin of safety 
-- before returning the answer 
put length(m) - offset(.,m) into aPlaces 
put length(n) - offset(.,n) into bPlaces 
put length(k) - offset(.,k) into cPlaces 
put the numberFormat into myString 
if max(aPlaces,bPlaces,cPlaces) + 4  length(myString) then 
   get myString   
   set the numberFormat to it 
end if 
put the numberFormat into nf 
put m + k*n into hold 
return hold 
 end preciseEnough 
 ___
 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: Diagnosing server error 400

2014-06-16 Thread Shawn Blc
Are you using sessions?


On Mon, Jun 16, 2014 at 2:25 PM, J. Landman Gay jac...@hyperactivesw.com
wrote:

 I need help figuring out why AWS is returning an error 400 bad request
 in a limited number of cases. We have a test group of some dozens of people
 and only 2 have the problem.

 What I know:

 The data sent to the server is the same for everyone, and is correctly
 formatted. I have logs of that and the requests are okay.

 One person moved to another computer (and consequently another network)
 and the problem resolved itself.

 Once, my client was getting the same 400 error all morning and then that
 afternoon it started working again by itself, without changing anything.

 This definitely seems network-related to me but I don't know what it could
 be. The queries are reaching AWS and it is returning the error. We don't
 have access (or don't know how) to see the server logs that Amazon has; we
 only have access to the logs on our own server, and the requests never get
 that far.

 Any ideas?

 --
 Jacqueline Landman Gay | jac...@hyperactivesw.com
 HyperActive Software   | http://www.hyperactivesw.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

___
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: Diagnosing server error 400

2014-06-16 Thread As_Simon
Hi Jacque, 
AWS does have logs, you have to set them up for each bucket.

Simon



--
View this message in context: 
http://runtime-revolution.278305.n4.nabble.com/Diagnosing-server-error-400-tp4680498p4680503.html
Sent from the Revolution - User mailing list archive at Nabble.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: Diagnosing server error 400

2014-06-16 Thread As_Simon
Sorry that was a cop-out.
I'm using CloudBerry Explorer for Amazon.
Right click on the bucket
Logging  Logging Settings or Cloudfront logging settings.

Simon



--
View this message in context: 
http://runtime-revolution.278305.n4.nabble.com/Diagnosing-server-error-400-tp4680498p4680504.html
Sent from the Revolution - User mailing list archive at Nabble.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: numberFormat question

2014-06-16 Thread Kay C Lan
On Tue, Jun 17, 2014 at 4:34 AM, J. Landman Gay
jac...@hyperactivesw.com wrote:
   set the numberformat to 0.## -- add more if you want

I think the reason David isn't doing that, and is trying to limit the
number of # to the absolute minimum is because of this note in the
Dictionary:

Note: Since LiveCode does not use decimal numbers for its internal
calculations (for reasons of speed), the decimal representation of a
number is sometimes slightly off the correct number. For example,
10^-1 is equal to 0.1, but is calculated (to eighteen decimal places)
as 0.16. Because of this, setting the numberFormat to
specify many decimal places after the decimal point may produce
unexpected results in a statement that tests for an exact number. To
prevent this, either avoid setting the numberFormat to a value more
precise than you need, or use the abs function instead of the =
operator to test equality:

I think we all know that at least once or twice a year we get a post
to this List questioning why LC is getting it's math wrong and the
reason is as stated above. For anyone whose app requires precision
math that shouldn't be a note, it should be a CAUTION! It's so easy to
have your app work perfectly 99.% of the time... but
then ruin someone's day.

___
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: Diagnosing server error 400

2014-06-16 Thread J. Landman Gay

On 6/16/2014, 6:21 PM, As_Simon wrote:

Sorry that was a cop-out.
I'm using CloudBerry Explorer for Amazon.
Right click on the bucket
Logging  Logging Settings or Cloudfront logging settings.


I'm in the dark about what's going on over at the server side, but on my 
end, I'm just doing a GET to a URL. There is an SQS queue (I'm not sure 
what that is actually,) which is being processed server-side. I think we 
need to know what's happening before my request hits the queue. Sorry to 
be so vague, but my understanding of the process is really limited. Does 
this make any sense? Do you know if there is logging available under 
this scenario?


I'll pass on your comment to the right person though. Thanks.

@Shawn: no, we're not using sessions. Each send to the server is 
independent.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.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: Diagnosing server error 400

2014-06-16 Thread J. Landman Gay

On 6/16/2014, 10:28 PM, J. Landman Gay wrote:

I'm just doing a GET to a URL. There is an SQS queue (I'm not sure what
that is actually,) which is being processed server-side. I think we need
to know what's happening before my request hits the queue.


I should expand that a little bit. The server person said my requests 
are hitting the SQS queue, which isn't related to Cloudfront. She knows 
about Cloudtrail logs but suspects that the hit isn't even making it to 
SQS to get logged. This is sort of gibberish to me, but it means something.


Maybe a better question to everyone would be: can a server 400 error be 
related to a bad SSL certificate chain? Because that's the only thing I 
can think of. Are these security chains static or do they vary depending 
on the computer/network involved? That is, is it like a URL request that 
can take any path to the destination, or more like a specific, 
unchanging set of security checkpoints?


Amazon talks about a PEM file that lists the security checkpoints, so I 
suspect the latter. If so, my theory isn't correct.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.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: Diagnosing server error 400

2014-06-16 Thread Trevor DeVore
On Mon, Jun 16, 2014 at 3:25 PM, J. Landman Gay jac...@hyperactivesw.com
wrote:

 I need help figuring out why AWS is returning an error 400 bad request
 in a limited number of cases. We have a test group of some dozens of people
 and only 2 have the problem.


I think that some XML should be sent back by the server as well. It will
contain additional error information about what went wrong. Have you looked
at that?

-- 
Trevor DeVore
Blue Mango Learning Systems
www.screensteps.com-www.clarify-it.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: Diagnosing server error 400

2014-06-16 Thread Mark Wieder
Jacque-

Monday, June 16, 2014, 8:56:40 PM, you wrote:

 Maybe a better question to everyone would be: can a server 400 error be
 related to a bad SSL certificate chain?

I'd expect something more like a 401 for a security problem. The
official definition of a 400 response is malformed syntax.

-- 
-Mark Wieder
 ahsoftw...@gmail.com

This communication may be unlawfully collected and stored by the National 
Security Agency (NSA) in secret. The parties to this email do not 
consent to the retrieving or storing of this communication and any 
related metadata, as well as printing, copying, re-transmitting, 
disseminating, or otherwise using it. If you believe you have received 
this communication in error, please delete it immediately.


___
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