Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #12001 > unrolled thread

creating key / hash

Started byPhilipp Kraus <philipp.kraus@flashpixx.de>
First post2013-11-28 09:52 +0100
Last post2013-11-28 10:37 -0800
Articles 4 — 4 participants

Back to article view | Back to comp.lang.php


Contents

  creating key / hash Philipp Kraus <philipp.kraus@flashpixx.de> - 2013-11-28 09:52 +0100
    Re: creating key / hash Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-11-28 14:40 +0100
    Re: creating key / hash Jerry Stuckle <jstucklex@attglobal.net> - 2013-11-28 11:21 -0500
    Re: creating key / hash Michael Vilain <vilain@NOspamcop.net> - 2013-11-28 10:37 -0800

#12001 — creating key / hash

FromPhilipp Kraus <philipp.kraus@flashpixx.de>
Date2013-11-28 09:52 +0100
Subjectcreating key / hash
Message-ID<l77086$vhq$1@ariadne.rz.tu-clausthal.de>
Hello,

I need an idea for creating hash / key values. I use a WebDAV 
connection with sabredav to transform database table values in a webdav 
structure (vice versa).
The database stores BibTeX data and I would like to transform this data 
in a BibTeX file. BibTeX uses a cite key most in this structure: <first 
3 letters of each author><letter of the title><year>
In my case this key should be generated automatically with PHP in the 
backend, but we have a hierachical structure, eg: organisation / group 
/ authors / BibTeX publication

My BibTeX key should store also a reference of the organisation and 
group, the organisation can be shorten with 3 letters (we have got a 
shortcut), but I need also a unique key, so
my question is, did you have a good idea to create a "human readable 
short and unique hash with the hierachical organisation strucutre" in 
PHP ? At the moment I'm thinking about
suffix trees or anything else.

Thanks a lot for some ideas

Phil

[toc] | [next] | [standalone]


#12003

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2013-11-28 14:40 +0100
Message-ID<1414615.OY8q6s0ZgE@PointedEars.de>
In reply to#12001
Philipp Kraus wrote:

> I need an idea for creating hash / key values. I use a WebDAV
> connection with sabredav to transform database table values in a webdav
> structure (vice versa).
> The database stores BibTeX data and I would like to transform this data
> in a BibTeX file. BibTeX uses a cite key most in this structure: <first
> 3 letters of each author><letter of the title><year>
> In my case this key should be generated automatically with PHP in the
> backend, but we have a hierachical structure, eg: organisation / group
> / authors / BibTeX publication
> 
> My BibTeX key should store also a reference of the organisation and
> group, the organisation can be shorten with 3 letters (we have got a
> shortcut), but I need also a unique key, so
> my question is, did you have a good idea to create a "human readable
> short and unique hash with the hierachical organisation strucutre" in
> PHP ? At the moment I'm thinking about
> suffix trees or anything else.
> 
> Thanks a lot for some ideas

It would be helpful if you gave an example showing

1. which input you have
2. which output you need;
3. which problems you had implementing the steps that lead from (1) to (2).


PointedEars
-- 
var bugRiddenCrashPronePieceOfJunk = (
    navigator.userAgent.indexOf('MSIE 5') != -1
    && navigator.userAgent.indexOf('Mac') != -1
)  // Plone, register_function.js:16

[toc] | [prev] | [next] | [standalone]


#12006

FromJerry Stuckle <jstucklex@attglobal.net>
Date2013-11-28 11:21 -0500
Message-ID<l77qih$65j$1@dont-email.me>
In reply to#12001
On 11/28/2013 3:52 AM, Philipp Kraus wrote:
> Hello,
>
> I need an idea for creating hash / key values. I use a WebDAV connection
> with sabredav to transform database table values in a webdav structure
> (vice versa).
> The database stores BibTeX data and I would like to transform this data
> in a BibTeX file. BibTeX uses a cite key most in this structure: <first
> 3 letters of each author><letter of the title><year>
> In my case this key should be generated automatically with PHP in the
> backend, but we have a hierachical structure, eg: organisation / group /
> authors / BibTeX publication
>
> My BibTeX key should store also a reference of the organisation and
> group, the organisation can be shorten with 3 letters (we have got a
> shortcut), but I need also a unique key, so
> my question is, did you have a good idea to create a "human readable
> short and unique hash with the hierachical organisation strucutre" in
> PHP ? At the moment I'm thinking about
> suffix trees or anything else.
>
> Thanks a lot for some ideas
>
> Phil
>

Phil,

Any time there's a limited number of options available, you will always 
have the chance of having duplicate entries.  Of course, the more 
characters, the less likely you'll have a duplication.  Sequences will 
solve this problem (at least until you wrap around), but don't meet your 
definition of "human readable" (my question is - why does it have to be 
"human readable"?).

So unless you want to go with a long string of characters as part of the 
citation, I think your best bet would be to use a sequence (I would 
think 3 digits would be enough).  Create a unique index on the key and 
try to add the new item.  If you get a duplicate, increment the key.

But even then I don't think your cite key would be "human readable".  It 
would just be a bunch of encoded fields.  Personally, I'd just go with a 
sequence unless you have to be compatible with some other BibTex 
implementation, in which case you have to use their format, anyway.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#12008

FromMichael Vilain <vilain@NOspamcop.net>
Date2013-11-28 10:37 -0800
Message-ID<vilain-A9783A.10372828112013@news.individual.net>
In reply to#12001
In article <l77086$vhq$1@ariadne.rz.tu-clausthal.de>,
 Philipp Kraus <philipp.kraus@flashpixx.de> wrote:

> Hello,
> 
> I need an idea for creating hash / key values. I use a WebDAV 
> connection with sabredav to transform database table values in a webdav 
> structure (vice versa).
> The database stores BibTeX data and I would like to transform this data 
> in a BibTeX file. BibTeX uses a cite key most in this structure: <first 
> 3 letters of each author><letter of the title><year>
> In my case this key should be generated automatically with PHP in the 
> backend, but we have a hierachical structure, eg: organisation / group 
> / authors / BibTeX publication
> 
> My BibTeX key should store also a reference of the organisation and 
> group, the organisation can be shorten with 3 letters (we have got a 
> shortcut), but I need also a unique key, so
> my question is, did you have a good idea to create a "human readable 
> short and unique hash with the hierachical organisation strucutre" in 
> PHP ? At the moment I'm thinking about
> suffix trees or anything else.
> 
> Thanks a lot for some ideas
> 
> Phil

Half the time of design is figuring this sort of thing out.

What makes sense to you?  

What would make sense to someone who's not familiar with your project? 
(e.g. ask some non-involved person like your gf/bf)

There's nothing technical about this process, just figuring out what 
makes sense.

-- 
DeeDee, don't press that button!  DeeDee!  NO!  Dee...
[I filter all Goggle Groups posts, so any reply may be automatically ignored]

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web