| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
|
| I know there aren't that many Python users in this group... but...... If you have any interest in this, check out http://community.ingres.com/wiki/Django_1.0_Driver Code is in SVN at http://code.ingres.com/apps/main/django/ It is too early yet to suggest using this driver (the test suite has a number of failures) but if you want to help hack, the code is there. I was able to create a demo application using inspectdb to generate a quick model for the demodb airlines table. Ingres 9.1.1 partially works with it but the admin interface does expect Unicode to integer coercion to work so Ingres 9.2 is probably a better choice. Chris |
|
#2
|
| Hi All, I'm currently implementing a verhoeff check digit calculator in the OME...and with a view to including it in the Opensource. What I'm proposing is: There are three functions provided: char = verhoeff_digit(varchar) * Calculates the verhoeff check digit for the given varchar input. * Using a varchar as input rather than integer allows the inclusion of leading zeroes. * The routine throws a wobbly if there are any non-numeric characters in the input. * int1 = verhoeff_valid(varchar) * Returns 1 (yes) or 0 (No), to indicate if the varchar input has a * valid verhoeff digit on the left (ie end) of the string. varchar = verhoeff(varchar) * Return the varchar input with a verhoeff digit appended at the left (ie end). I have validated my voerhoff_digit() against the numbers produced by the calculator in: http://www.augustana.ab.ca/~mohrj/al....html#verhoeff What do people think of this? Do the function names make sense, seem reasonable to use? For instance, some of the people at work have suggested that instead of verhoeff(), I should call that function verhoeff_append(). Also, in passing, I have heard that there is more than one verhoeff 'style' out there, and that they return different numbers. But I can't find a reference to these on wikipedia. Does anyone have any idea about the truth of this multiple style stuff? Thanks in Advance, Martin Bowes |
|
#3
|
| Martin - I had a thought along these lines, which is similar to the way some Java functions work: - have a suite of check digit generation schemes - refer to them by name - pick a scheme internally by referencing the name - then apply the scheme using variations of the functions you describe, such as: char = generate_digit("verhoeff", varchar); or char = generate_digit("EFT", varchar); or using any of other defined / in-use check digits functions mentioned in your reference page. This is a bit more general and allows for expansion in the future for other (as yet undefined) schemes.... You could always choose to only implement the "verhoeff" variety of function for now if that is all you're interested in. Roger Whitcomb | Architect, Engineering | Roger.Whitcomb-at-ingres.com| Ingres | 500 Arguello Street | Suite 200 | Redwood City | CA | 94063 | USA <http://www.google.com/maps?f=q&hl=en...llo+Street+%7C +Suite+200+%7C+Redwood+City+%7C+CA+%7C+94063+%7C+U SA+&sll=37.0625,-95.67 7068&sspn=50.557552,73.037109&ie=UTF8&t=h&z=16&iwloc=addr> | +1 650-587-5596 | fax: +1 650-587-5550 ________________________________ From: info-ingres-bounces-at-kettleriverconsulting.com [mailto:info-ingres-bounces-at-kettleriverconsulting.com] On Behalf Of Martin Bowes Sent: Tuesday, September 23, 2008 11:50 AM To: Ingres and related product discussion forum Cc: Andrew Ross Subject: [Info-Ingres] verhoeff function for Ingres Hi All, I'm currently implementing a verhoeff check digit calculator in the OME...and with a view to including it in the Opensource. What I'm proposing is: There are three functions provided: char = verhoeff_digit(varchar) * Calculates the verhoeff check digit for the given varchar input. * Using a varchar as input rather than integer allows the inclusion of leading zeroes. * The routine throws a wobbly if there are any non-numeric characters in the input. * int1 = verhoeff_valid(varchar) * Returns 1 (yes) or 0 (No), to indicate if the varchar input has a * valid verhoeff digit on the left (ie end) of the string. varchar = verhoeff(varchar) * Return the varchar input with a verhoeff digit appended at the left (ie end). I have validated my voerhoff_digit() against the numbers produced by the calculator in: http://www.augustana.ab.ca/~mohrj/al....html#verhoeff What do people think of this? Do the function names make sense, seem reasonable to use? For instance, some of the people at work have suggested that instead of verhoeff(), I should call that function verhoeff_append(). Also, in passing, I have heard that there is more than one verhoeff 'style' out there, and that they return different numbers. But I can't find a reference to these on wikipedia. Does anyone have any idea about the truth of this multiple style stuff? Thanks in Advance, Martin Bowes |
|
#4
|
| Hi Roger, While I was reading around last night I was coming to that opinion myself. There are at least 4 easily coded and deliverable check digit functions: EFT, verhoeff, Luhn and Luhn Mod N. All we need are two functions: (char ) generate_digit((varchar )scheme, (varchar )string); This generates the check digit on the string using the nominated scheme(EFT, verhoeff, Luhn and Luhn Mod N, etc) (int1 ) validate_digit((varchar )scheme, (varchar )string); validates the string, returning 1 for yes and 0 for no. We don't need the 'append_digit' function, that afterall is just doing string + generate_digit((varchar )scheme, (varchar )string); I'll code these up, submit them to the code stream and then I'll even try to modify the Wikipedia entry! Marty From: info-ingres-bounces-at-kettleriverconsulting.com [mailto:info-ingres-bounces-at-kettleriverconsulting.com] On Behalf Of Roger L. Whitcomb Sent: 23 September 2008 21:32 To: Ingres and related product discussion forum Cc: Andrew Ross Subject: Re: [Info-Ingres] verhoeff function for Ingres Martin - I had a thought along these lines, which is similar to the way some Java functions work: - have a suite of check digit generation schemes - refer to them by name - pick a scheme internally by referencing the name - then apply the scheme using variations of the functions you describe, such as: char = generate_digit("verhoeff", varchar); or char = generate_digit("EFT", varchar); or using any of other defined / in-use check digits functions mentioned in your reference page. This is a bit more general and allows for expansion in the future for other (as yet undefined) schemes.... You could always choose to only implement the "verhoeff" variety of function for now if that is all you're interested in. Roger Whitcomb | Architect, Engineering | Roger.Whitcomb-at-ingres.com| Ingres | 500 Arguello Street | Suite 200 | Redwood City | CA | 94063 | USA <http://www.google.com/maps?f=q&hl=en...llo+Street+%7C +Suite+200+%7C+Redwood+City+%7C+CA+%7C+94063+%7C+U SA+&sll=37.0625,-95.67 7068&sspn=50.557552,73.037109&ie=UTF8&t=h&z=16&iwloc=addr> | +1 650-587-5596 | fax: +1 650-587-5550 ________________________________ From: info-ingres-bounces-at-kettleriverconsulting.com [mailto:info-ingres-bounces-at-kettleriverconsulting.com] On Behalf Of Martin Bowes Sent: Tuesday, September 23, 2008 11:50 AM To: Ingres and related product discussion forum Cc: Andrew Ross Subject: [Info-Ingres] verhoeff function for Ingres Hi All, I'm currently implementing a verhoeff check digit calculator in the OME...and with a view to including it in the Opensource. What I'm proposing is: There are three functions provided: char = verhoeff_digit(varchar) * Calculates the verhoeff check digit for the given varchar input. * Using a varchar as input rather than integer allows the inclusion of leading zeroes. * The routine throws a wobbly if there are any non-numeric characters in the input. * int1 = verhoeff_valid(varchar) * Returns 1 (yes) or 0 (No), to indicate if the varchar input has a * valid verhoeff digit on the left (ie end) of the string. varchar = verhoeff(varchar) * Return the varchar input with a verhoeff digit appended at the left (ie end). I have validated my voerhoff_digit() against the numbers produced by the calculator in: http://www.augustana.ab.ca/~mohrj/al....html#verhoeff What do people think of this? Do the function names make sense, seem reasonable to use? For instance, some of the people at work have suggested that instead of verhoeff(), I should call that function verhoeff_append(). Also, in passing, I have heard that there is more than one verhoeff 'style' out there, and that they return different numbers. But I can't find a reference to these on wikipedia. Does anyone have any idea about the truth of this multiple style stuff? Thanks in Advance, Martin Bowes |
|
#5
|
| >> What do people think of this?<< Nice work. You can do this in pure SQL via table look-up, but it is awful. I tried it when i wrote THINKING IN SETS. Uggh! >> Do the function names make sense, seem reasonable to use? << Minor nit -- the current convention is " |
|
#6
|
| Hi Jim, Thanks for the input. Doing that in SQL would have been an interesting exercise! FYI. I've changed the thing to be: ** (char ) generate_digit((varchar )scheme, (varchar )string); ** This generates the check digit on the string using the nominated ** scheme(verhoeff, Luhn and Luhn Mod N, etc) ** ** (int1 ) validate_digit((varchar )scheme, (varchar )string); ** Validates the string, returning 1 for yes and 0 for no. In regards to the 'styles' of verhoeff, I've tracked down the source of this to an algorithm in 'Numerical Recipes'. The essential difference between that algorithm and the ones described in Wikipedia etc is: (Numerical Recipes) k=ij[k][ ip[(c+2) % 10][7 &m++] ]; (mine) k = d[k][ F[7 & m++][atoi(&c)] ]; For some reason NR is adding 2 to each digit (c), and then modulo 10 to get it to fit into their ip[10][8]. I'm in the process of setting up a trial of the NR algorithm against mine to see if it actually produces different digits. I imagine it must. In which case, I'll modify my code to accept an input of "verhoeff[N]" where N is an offset, and code accordingly. Marty -----Original Message----- From: info-ingres-bounces-at-kettleriverconsulting.com [mailto:info-ingres-bounces-at-kettleriverconsulting.com] On Behalf Of --CELKO-- Sent: 24 September 2008 17:17 To: info-ingres-at-kettleriverconsulting.com Subject: Re: [Info-Ingres] verhoeff function for Ingres >> What do people think of this?<< Nice work. You can do this in pure SQL via table look-up, but it is awful. I tried it when i wrote THINKING IN SETS. Uggh! >> Do the function names make sense, seem reasonable to use? << Minor nit -- the current convention is " |
![]() |
| Thread Tools | |
| Display Modes | |