object checkSum?
MisterX
b.xavier at internet.lu
Wed Jul 6 21:25:55 EDT 2005
write out a file? why?
Here's an old version for a card checksum...
Same can be applied to the props and the script. Of course it wont catch a
color change in the props for example unless you add the numbers to the sum
- it's very unlikely you'll find duplicates this way but nature has its
ways. So the MD5 or a content to content comparison is usually the best way
to catch a change...
function GetCdStamp
local y
put 0 into y
put length(cdScript()) into y
put number of flds into fcount
repeat with x = 1 to fcount
add length(fld x) to y
end repeat
put number of flds into bcount
repeat with x = 1 to bcount
add length(bg btn x) to y
end repeat
put number of flds into fcount
repeat with x = 1 to fcount
add length(cd fld x) to y
end repeat
put number of flds into bcount
repeat with x = 1 to bcount
add length(btn x) to y
end repeat
return y
end GetCdStamp
> -----Original Message-----
> From: use-revolution-bounces at lists.runrev.com
> [mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of
> Chipp Walters
> Sent: Thursday, July 07, 2005 03:12
> To: How to use Revolution
> Subject: Re: object checkSum?
>
> Here's what I've got so far..any suggestions?
> X, I'm not so sure about size, as it makes it necessary to
> write out a file, which certainly must take more time than MD5digest?
>
>
>
> function altObjChecksum pObjID
> --> THIS CREATES A CHECKSUM FOR RR OBJECTS
> --> IT INCLUDES PROPERTIES, SCRIPTS AND CUSTOMPROP SETS AND THEIR
> CUSTOM PROP VALUES
>
> --> PROPERTIES OF OBJECT
> put the properties of pObjID into tData
>
> --> THESE NECESSARY AS THEY CHANGE FROM STACK TO STACK
> --> ANYONE THINK OF ANY OTHERS WHICH MIGHT CHANGE?? TIA!!
> put "" into tData["id"]
> put "" into tData["visited"]
> put "" into tData["layer"]
>
> combine tData using cr and ":"
>
> --> SCRIPT OF OBJECT
> put cr & the script of pObjID after tData
>
> --> CUSTOM PROP SETS AND CUSTOM PROPS
> put the customPropertySets of pObjID into tCPlist
>
> repeat for each line L in tCPlist
> --> NO NEED TO 'MATCH' REV'S IDE PROPS
> if L is "cRevGeneral" then next repeat
>
> put the customProperties[L] of pObjID into tKeys
> combine tKeys using cr and ":"
> put cr & L & cr & tKeys after tData
> end repeat
>
> return URLencode(md5digest(tData))
>
> end altObjChecksum
>
>
> Richard Gaskin wrote:
> > Chipp Walters wrote:
> >
> >> Short of MD5digesting the concatenation of all properties,
> scripts,
> >> custom props and propsets of an object, *OR* MD5digesting a single
> >> stack file with a specified object copied to it and saved
> locally...
> >>
> >> Is there an *easier* way to create a checkSum for a single
> RR object
> >> that I'm missing?
> >
> >
> > I had a similar need recently, and decided to go with the
> MD5 of the
> > props and custom props (the objects I was working on have
> no scripts).
> > If there's a better way I'd love to learn it, but for the
> moment the
> > MD5/props route works pretty well.
> >
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage
> your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
More information about the use-livecode
mailing list