Re: How to hash fields and detect changes in a record

2022-06-15 Thread Ryan Nowakowski
On June 14, 2022 10:29:40 PM CDT, Mike Dewhirst wrote: >On 14/06/2022 11:20 pm, Ryan Nowakowski wrote: >> >> Summing the ordinal of the characters won't catch transposition: >> >> >>> chars = 'ab' >> >>> sum([ord(c) for c in chars]) >> 195 >> >>> chars = 'ba' >> >>> sum([ord(c) for c in chars

Re: How to hash fields and detect changes in a record

2022-06-14 Thread Mike Dewhirst
On 14/06/2022 11:20 pm, Ryan Nowakowski wrote: Summing the ordinal of the characters won't catch transposition: >>> chars = 'ab' >>> sum([ord(c) for c in chars]) 195 >>> chars = 'ba' >>> sum([ord(c) for c in chars]) 195 Better to use a real hash algorithm if you're trying to detect changes. 

Re: How to hash fields and detect changes in a record

2022-06-14 Thread Ryan Nowakowski
On 6/12/22 11:40 PM, Mike Dewhirst wrote: Original message From: Ryan Nowakowski Date: 13/6/22 07:09 (GMT+10:00) To: django-users@googlegroups.com Subject: Re: How to hash fields and detect changes in a record On Sat, Jun 11, 2022 at 12:13:16AM +1000, Mike Dewhirst wrote

Re: How to hash fields and detect changes in a record

2022-06-12 Thread Mike Dewhirst
--(Unsigned mail from my phone) Original message From: Ryan Nowakowski Date: 13/6/22 07:09 (GMT+10:00) To: django-users@googlegroups.com Subject: Re: How to hash fields and detect changes in a record On Sat, Jun 11, 2022 at 12:13:16AM +1000, Mike Dewhirst wrote:> On 10

Re: How to hash fields and detect changes in a record

2022-06-12 Thread Ryan Nowakowski
On Sat, Jun 11, 2022 at 12:13:16AM +1000, Mike Dewhirst wrote: > On 10/06/2022 11:24 pm, Ryan Nowakowski wrote: > > On Fri, Jun 10, 2022 at 05:52:48PM +1000, Mike Dewhirst wrote: > > > I think the solution might be to hash note.title and note.note into a new > > > field note.hash on being auto-crea

Re: How to hash fields and detect changes in a record

2022-06-10 Thread Mike Dewhirst
Ryan Thanks very much - you triggered the necessary amount of thinking and I reckon you are correct - hashing is overkill. I just need a self-referential value comparison where the value is independent of outside influences. That means I should not use a hash library from anywhere. I'll ju

Re: How to hash fields and detect changes in a record

2022-06-10 Thread Mike Dewhirst
On 10/06/2022 11:24 pm, Ryan Nowakowski wrote: On Fri, Jun 10, 2022 at 05:52:48PM +1000, Mike Dewhirst wrote: The use case is auto-deletion of out-of-date records if they have not changed. That might sound weird but it is the solution I have come to for a particular problem. My software analyse

Re: How to hash fields and detect changes in a record

2022-06-10 Thread Ryan Nowakowski
On Fri, Jun 10, 2022 at 05:52:48PM +1000, Mike Dewhirst wrote: > The use case is auto-deletion of out-of-date records if they have not > changed. > > That might sound weird but it is the solution I have come to for a > particular problem. My software analyses chemical properties and writes note >

How to hash fields and detect changes in a record

2022-06-10 Thread Mike Dewhirst
The use case is auto-deletion of out-of-date records if they have not changed. That might sound weird but it is the solution I have come to for a particular problem. My software analyses chemical properties and writes note records containing advice, each with a FK to the chemical. When value