Cool, that would be a welcome tag. --
Robert Garcia President - BigHead Technology VP Application Development - eventpix.com 15520 Coutelenc Rd Magalia, Ca 95954 ph: 530.645.4040 x222 fax: 530.645.4040 [email protected] - [email protected] http://bighead.net/ - http://eventpix.com/ On Oct 14, 2010, at 12:45 PM, Robert Shubert wrote: > I’ve added @GUID to the list. > > Robert > > From: Robert Garcia [mailto:[email protected]] > Sent: Thursday, October 14, 2010 3:39 PM > To: [email protected] > Subject: Re: Witango-Talk: generating unique codes > > This is a weakness in witango, but easily shored. Witango lacks the ability > to generate a GUID, but would probably be an easy feature to add, since I > think it can be done by the host OS. > > There are a few ways to shore this in witango... > > 1. If windows witango, find an old but reliable tool, called GUIDMKR. Its a > com object I have used for YEARS with witango. Let me know if you need code. > > 2. In mac or linux, use a command line, this can be done in pearl. > > You could then have code in witango turn that into your GUID into a BYTE > array, so it looks like a code, like a YOUTUBE id, much shorter. > > http://stackoverflow.com/questions/2983065/guid-to-bytearray > > I worked on this for many hours many moons ago. There was always dupes, the > better my algorithm got, the less dupes, but to be safe, start with a TRUE > UUID or GUID generator. GUIDMKR has always served me well on windows/witango. > > -- > > Robert Garcia > President - BigHead Technology > VP Application Development - eventpix.com > 15520 Coutelenc Rd > Magalia, Ca 95954 > ph: 530.645.4040 x222 fax: 530.645.4040 > [email protected] - [email protected] > http://bighead.net/ - http://eventpix.com/ > > On Oct 14, 2010, at 12:18 PM, Roland Dumas wrote: > > > I need to stare at this code a bit more. I made it witango 5 compatible > (while object and instead of @sleep, I just threw away output based on the > same timestamp) > results > > code: NZVWIXXX timestamp: 1287058511 > code: LURAVSXX timestamp: 1287058512 > code: LURAVSXX timestamp: 1287058513 > code: NZVWIXXX timestamp: 1287058514 > code: ZLNKFQXX timestamp: 1287058515 > code: BNCILFXX timestamp: 1287058516 > code: KRCCOCXX timestamp: 1287058517 > code: NZVWIXXX timestamp: 1287058518 > code: BNCILFXX timestamp: 1287058519 > code: BNCILFXX timestamp: 1287058520 > code: NZVWIYXX timestamp: 1287058521 > code: KRCCOCXX timestamp: 1287058522 > > Interesting, don't you think? > In a long sequence, the repeats are frequent and and trailing Xs... > > Thanks for the start. > > > On Oct 14, 2010, at 10:53 AM, Robert Shubert wrote: > > > Try this out: > > <@! start with epoch> > <@ASSIGN secs <@TSTOSECS <@CURRENTTIMESTAMP>>> > > <@! add salt> > <@ASSIGN secs "<@RANDOM low=1 high=9>@@secs<@RANDOM low=1 high=9>"> > > <@! convert to base 26> > <@WHILE expr="@@secs > 26"> > > <@! shift to ascii for capitals 65-90 convert to char and build code> > <@IF "<@CURROW>%2 = 0"> > <@ASSIGN code '<@CHAR <@CALC "abs(@@secs % 26) + 65">>@@code'> > <@ELSE> > <@ASSIGN code '@@code<@CHAR <@CALC "abs(@@secs % 26) + 65">>'> > </@IF> > > <@! shift place for base conversion> > <@ASSIGN secs <@CALC "@@secs / 26" precision=0>> > > </@WHILE> > > Final Code: @@code > > DISCLAIMER: It is possible to create the same code if this routine is run > multiple times in the same second. Add a <@SLEEP 1000> to prevent this. Also, > there is an abs() in there because doing modulo on large values produces a > negative value. This is incorrect behavior on Witango's part and something > that I'll need to fix in the server. I do not think it produces a collision > problem in this routine, but it may. It is likely tied to small floating > point variable used in the routine. Oh, and there is also a rounding error > that I didn't work out, but again, it only changed some shift points (26^1 > place increases at unit=13 rather than unit=0). This can removed by > floor()ing the base conversion shift in the final @CALC. Again, I do not > believe that this causes a collision situation. Also, this routine can > occasionally create a 7 character code. You may need to check for and ignore > these if you want them all to 8 characters (This may be able to be eliminated > by increasing the LOW value in the first @RANDOM) Lastly, I don't guarantee > this routine. I just whipped it up as a mental exercise, so you may want to > test it out some (see if you get a collision over a few million iterations), > or show it to someone who is good with algorithms or cryptography. > > Robert > > -----Original Message----- > From: Roland Dumas [mailto:[email protected]] > Sent: Thursday, October 14, 2010 11:42 AM > To: [email protected] > Subject: Witango-Talk: generating unique codes > > > looking for method to create unique and non-obvious n-digit codes to be used > as discount codes. > Should be short enough to use as consumer codes (8 digit?), and probably be > something simply to enter, such as an all caps, and not have an easily > discoverable pattern. > > I want to generate unique codes and not have to check the history to see if a > code has been used before. > > Suggestions? > > > > > > ---------------------------------------- > > To unsubscribe from this list, please send an email to [email protected] > with "unsubscribe witango-talk" in the body. > > > > ---------------------------------------- > > To unsubscribe from this list, please send an email to [email protected] > with "unsubscribe witango-talk" in the body. > > > > > ---------------------------------------- > > To unsubscribe from this list, please send an email to [email protected] > with "unsubscribe witango-talk" in the body. > > > > To unsubscribe from this list, please send an email to [email protected] > with "unsubscribe witango-talk" in the body. > > To unsubscribe from this list, please send an email to [email protected] > with "unsubscribe witango-talk" in the body. ---------------------------------------- To unsubscribe from this list, please send an email to [email protected] with "unsubscribe witango-talk" in the body.
