FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » creating key / hash
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: creating key / hash [message #183947 is a reply to message #183942] Thu, 28 November 2013 16:21 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
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(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: converting numbers to ascii values
Next Topic: Regarding split text and match from data base
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 11:44:32 GMT 2024

Total time taken to generate the page: 0.04159 seconds