MD5 digest of arrays and controls

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

MD5 digest of arrays and controls

Alejandro Tejada
Hi all,

How could I get the MD5digest of an Array and
all the properties of a control?

For example, I created a control, by script,
and I want to make sure that it's identical
to another control created by a different script.

How could I compare both controls using a
MD5digest of their relevant properties?
(obviously, their name should be different,
so I do not want to include that property
in the comparision).

And How could I do this with two global Array
variables?

I collect data in these two different arrays
using two different scripts and need to be
sure that their data is identical.

Thanks in advance!

Al

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: MD5 digest of arrays and controls

Terry Judd

On 01/08/2011, at 01:24 PM, Alejandro Tejada wrote:

> Hi all,
>
> How could I get the MD5digest of an Array and
> all the properties of a control?

I guess you could use arrayEncode() first and then get an MD5digest of the data.
>
> For example, I created a control, by script,
> and I want to make sure that it's identical
> to another control created by a different script.

How about copying the objects to the clipboard and then querying the clipboardData["objects"].

Terry...

>
> How could I compare both controls using a
> MD5digest of their relevant properties?
> (obviously, their name should be different,
> so I do not want to include that property
> in the comparision).
>
> And How could I do this with two global Array
> variables?
>
> I collect data in these two different arrays
> using two different scripts and need to be
> sure that their data is identical.
>
> Thanks in advance!
>
> Al
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: MD5 digest of arrays and controls

Alejandro Tejada
Hi Terry

Terry Judd wrote
 
>> How could I get the MD5digest of an Array and
>> all the properties of a control?

I guess you could use arrayEncode() first and then get an MD5digest of the data.
This command works great.
Many Thanks! :-D

Terry Judd wrote
 
> For example, I created a control, by script,
> and I want to make sure that it's identical
> to another control created by a different script.

How about copying the objects to the clipboard and then querying the clipboardData["objects"].
I am not sure how I could use this code
to compare the properties of two controls.

Thanks again for your help!

Al
Reply | Threaded
Open this post in threaded view
|

Re: MD5 digest of arrays and controls

Terry Judd

On 02/08/2011, at 03:57 AM, Alejandro Tejada wrote:

Hi Terry


Terry Judd wrote:

How could I get the MD5digest of an Array and
all the properties of a control?

I guess you could use arrayEncode() first and then get an MD5digest of the
data.


This command works great.
Many Thanks! :-D


Terry Judd wrote:

For example, I created a control, by script,
and I want to make sure that it's identical
to another control created by a different script.

How about copying the objects to the clipboard and then querying the
clipboardData["objects"].


I am not sure how I could use this code
to compare the properties of two controls.

How about comparing the properties arrays of the two controls

In the following example I simply created two identical buttons on a blank stack. They should be identical in almost every respect, the exceptions being their ids their rects and their layers. If you put the properties array of each object into separate variables and delete the elements for those three properties from each variable then the two variables should be equivalent.

on compareProps
   put the properties of btn 1 into t1
   put the properties of btn 2 into t2
   delete variable t1["id"]
   delete variable t2["id"]
   delete variable t1["rect"]
   delete variable t2["rect"]
   delete variable t1["layer"]
   delete variable t2["layer"]
   put t1 = t2
end compareProps

Alternatively, you could simply iterate through the keys of the properties of the two objects and compare the values of the individual properties.

Terry...



Thanks again for your help!

Al


--
View this message in context: http://runtime-revolution.278305.n4.nabble.com/MD5-digest-of-arrays-and-controls-tp3708824p3710396.html
Sent from the Revolution - User mailing list archive at Nabble.com<http://Nabble.com>.

_______________________________________________
use-livecode mailing list
[hidden email]<mailto:[hidden email]>
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: MD5 digest of arrays and controls

Alejandro Tejada
Hi Terry,

Finally, I found the property that was
blocking my code:

set the caseSensitive to true

Now, the question is:
Why setting the caseSensitive to true,
is impeding this line of code to work:

do "set the fillGradient of it to " & tGradientName
(where tGradientName is an arrayvariable
named like: "_Radial_Gradient_1")

I have verified (with your code) that contents of
arrayvariable is correct. Only setting this caseSensitive
property is the difference.

If one of you have some clue about this strange interaction
between the global property "caseSensitive" and the command
"do", I will be really grateful!

Have a nice day!

Al
Reply | Threaded
Open this post in threaded view
|

Re: MD5 digest of arrays and controls

slylabs13
What is in it? Is the object in it correct case sensitively? Why set the case sensitive to true anyway? What does that accomplish?

Bob


On Aug 2, 2011, at 6:30 AM, Alejandro Tejada wrote:

> Hi Terry,
>
> Finally, I found the property that was
> blocking my code:
>
> set the caseSensitive to true
>
> Now, the question is:
> Why setting the caseSensitive to true,
> is impeding this line of code to work:
>
> do "set the fillGradient of it to " & tGradientName
> (where tGradientName is an arrayvariable
> named like: "_Radial_Gradient_1")
>
> I have verified (with your code) that contents of
> arrayvariable is correct. Only setting this caseSensitive
> property is the difference.
>
> If one of you have some clue about this strange interaction
> between the global property "caseSensitive" and the command
> "do", I will be really grateful!
>
> Have a nice day!
>
> Al
>
> --
> View this message in context: http://runtime-revolution.278305.n4.nabble.com/MD5-digest-of-arrays-and-controls-tp3708824p3712329.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: MD5 digest of arrays and controls

Alejandro Tejada
Hi Bob,

slylabs13 wrote
What is in it? Is the object in it correct case sensitively?
Why set the case sensitive to true anyway?
What does that accomplish?

Bob
The code that I am debugging is part of this stack:
http://andregarzia.on-rev.com/alejandro/stacks/Eps_Import_V05B.zip

This stack reads an Ilustrator version 7 drawing and
convert the Ilustrator graphics to Polygonal vectors
inside a stack (including gradients, although this part
is a work in progress). If you download this stack,
you could find a folder with many test files that you
could import. Notice that I created this, many years
ago, to import vector clipart to my stacks.

Actually, my advice is to convert your clipart to uncompressed
svg, using Inkscape or any other program, and import
them using Ian Macphail's stack SVGL:
http://revonline2.runrev.com/stack/112/SVGL

Hopefully, my experiments to add gradients and
transparency to SVGL will produce results and
only after, I will post a link requesting for testers.

In the stack EPS import v05B, I need to change the
caseSensitive property to deal differently with similar
tags that appear inside Illustrator files.

For example: "Xa" sets a rgb color fill, while
"XA" sets a rgb color outline, "k" is flat CMYK color fill,
"K"  is a CMYK color outline, "g" is a grayscale fill,
"G" is a grayscale outline, etc...

Right now, I am testing for another solutions.

Thanks for your interest! :-)

Al
Reply | Threaded
Open this post in threaded view
|

Re: MD5 digest of arrays and controls

slylabs13
I Alejandro. I should have asked what is in the VARIABLE it when the script fails? heh heh. I see though why case sensitivity is needed. Wasn't there something about case sensitivity and arrays a while back?

Bob


On Aug 2, 2011, at 5:53 PM, Alejandro Tejada wrote:

> Hi Bob,
>
>
> slylabs13 wrote:
>>
>> What is in it? Is the object in it correct case sensitively?
>> Why set the case sensitive to true anyway?
>> What does that accomplish?
>>
>> Bob
>>
>
> The code that I am debugging is part of this stack:
> http://andregarzia.on-rev.com/alejandro/stacks/Eps_Import_V05B.zip


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode