I'm trying to think of the best algorithm that generates user names, based on first and last names. I have other data available to me, but it seems best to keep it limited to these fields. I'm looking for simple peer review, the idea is to eliminate 'teh stupidness' of allowing users to create their own names in a massively overloaded system. Domains will function as namespaces. But, the demo namespace will most probably implement a pollution of all other namespaces. This will function for the 'beta' version of our product and for demonstrations to non-clients.
My current plan is to implement the following fallback system. Abbreviations as follows
- fi
- first name initial.
- li
- last name initial
- fn
- first name
- ln
- last name
- md5 randomness. (4chars of md5 on pkid or something)
Algo should work as following
- fi.ln
- or fn.li
- or fn.ln
- cycle through again with .md5
I think these odds are sufficient enough to eliminate any chances of duplicates. logins (unique constraint will still be in effect.) I would implement this database-side, and return the first username that passes.
Any other ideas on generating logins, that are typically easy to remember, but fall back gracefully? I'm trying to proactively avoid the situation like aim, where you have to guess logins for an hour to find an available one, while being able to generate demo logins, from preexisting information.
Alternativly, I could cycle through fi.ln, adding on one letter to fi untill i have a match. and then alternating with the full first name, adding on letters of the li untill the last name has been completed, but in the event 'John Smith' you would be talking about many hits on the DB rather than my 5 max system - doubt it would be an issue though
Evan Carroll
www.EvanCarroll.com
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.