I'm working on a project in Perl that would need to have certain items ordered according to user preference (similar to nodelets here.) My initial thought was in remeberance of the days of qbasic--numbering lines in increments of ten and if something was to be added between 20 and 30, I'd add a 25 between them. This obviously has the downfall in that if you messed with your code enough, it would always eventually need to be renumbered.
So I scratched that idea. Even if I used reals, it still would not be as clean as I would like. It would be possible to renumber all elements when the user chose to modify one, but that would be terribly inefficient when the number of total number of elements increased. My second idea would be to set a cron to run at 2AM (or the slowest time of activity for the server) and renumber _all_ elements for _all_ users to keep things clean. (The numbers integral.)
Needless to say, I'm not too happy with any of these ideas. There has got to be a more efficient way! Anyone have any insight onto this topic?
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.