forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


GUID Howto

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Advanced Help for VDS 5 & Up
View previous topic :: View next topic  
Author Message
X-Tools
Valued Contributor
Valued Contributor


Joined: 20 Sep 2001
Posts: 296
Location: Germany

PostPosted: Fri Oct 10, 2003 6:28 am    Post subject: GUID Howto Reply with quote

Hi,

I want to use a unique - computer ID for calculating activation keys for my perfect-intranet-app. I like the GUID DSU very much, but I need
to know, how the number is generated, because we need something
similar for Linux/PHP.

Can somebody give some tips for generating unique id's ?
I think mostly registry values are captured, but which are good for
doing this ?

Thanks,

Fabian
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Fri Oct 10, 2003 6:44 am    Post subject: Reply with quote

Vic once made some VDS code to generate GUIDs. I'll ask him if I see him online at MSN Messenger... Smile
_________________
[ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Back to top
View user's profile Send private message
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Fri Oct 10, 2003 9:28 am    Post subject: Reply with quote

He already uploaded a DSU to create GUIDs, maybe it's some of your use. You can download it here.
_________________
[ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Back to top
View user's profile Send private message
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Fri Oct 10, 2003 12:37 pm    Post subject: Reply with quote

When I run this, I get on 3 consecutive occasions:

Code:
{A1DACCEB-3272-BB2A-28E0-A005615522DE}
{62B66C71-CA6E-626D-B3EA-E6DB4C3CE14E}
{1B262EBC-ADB2-BDD5-0E0A-CA620ADE3EAA}


If I close the project and reload, the sequence continues. Whenever I start the IDE and run the script again, the sequence starts from the beginning again. Do other people get the same numbers, or different ones?

_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
X-Tools
Valued Contributor
Valued Contributor


Joined: 20 Sep 2001
Posts: 296
Location: Germany

PostPosted: Fri Oct 10, 2003 12:59 pm    Post subject: Reply with quote

Hi Jules,

you are right - I get exactly the same numbers every time.

Bye, Fabian
Back to top
View user's profile Send private message Send e-mail Visit poster's website
CodeScript
Moderator Team


Joined: 08 Jun 2003
Posts: 1060
Location: India

PostPosted: Fri Oct 10, 2003 5:25 pm    Post subject: Reply with quote

Yes Jules I confirmed it.
I think he is geetting GUID from a given string using API (CLSIDFromString) and changes it (string) by math stores the result in a regkey or something.
BTW lot of privacy issues are involved with GUIDs, gettting even big companies into trouble.

_________________
Regards
- CodeScript
Arrow Give your application a professional look with the VDSGUI Extension
Back to top
View user's profile Send private message Visit poster's website
Vic D'Elfant
Past Contributor
Past Contributor


Joined: 26 Jun 2002
Posts: 673
Location: The Netherlands

PostPosted: Sat Oct 11, 2003 12:54 pm    Post subject: Reply with quote

I use the @random function to create the random characters/numbers... I'll have a look at it and update the dsu as soon as possible

Vic

_________________
phpBB Development Team
Back to top
View user's profile Send private message Visit poster's website
Vic D'Elfant
Past Contributor
Past Contributor


Joined: 26 Jun 2002
Posts: 673
Location: The Netherlands

PostPosted: Sat Oct 11, 2003 1:06 pm    Post subject: Reply with quote

I really don't understand what's going wrong...
Could this bug be caused because VDS doesn't really create random numbers, but just goes thruh a list with previously generated numbers or something like that? I don't know if vds really works like this, but it could be Confused

EDIT:
Try this script:
Code:

info @random(0,5)@random(0,5)@random(0,5)

run the script, write down the number which is generated, close vds, open the script again, and run it again. And guess which number is returned: the same number! At my computer the first number was 004.

Greetings,
Vic

_________________
phpBB Development Team
Back to top
View user's profile Send private message Visit poster's website
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Sat Oct 11, 2003 1:26 pm    Post subject: Reply with quote

Vic wrote:
I really don't understand what's going wrong...
Could this bug be caused because VDS doesn't really create random numbers


No it doesn't. Actually, it uses the Delphi random number function. It does generate a repeatable sequence each time, unless you randomize it first by using the RANDOM command with something like a value obtained from the date and time. Often it is actually useful to have a repeatable (pseudo-)random number sequence.

However, there's a probablility doing it that way you might end up with an ID that isn't globally unique. There are APIs to obtain these numbers which presumably will always produce a unique ID, so that if you use it in your program you won't trash the registration of some COM object or something.

_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Sat Oct 11, 2003 2:48 pm    Post subject: Reply with quote

jules wrote:
Often it is actually useful to have a repeatable (pseudo-)random number sequence.


If I want a repeatable random number, I'd store it into a variable or list... Wink

_________________
[ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Back to top
View user's profile Send private message
Vic D'Elfant
Past Contributor
Past Contributor


Joined: 26 Jun 2002
Posts: 673
Location: The Netherlands

PostPosted: Sat Oct 11, 2003 3:57 pm    Post subject: Reply with quote

jules wrote:
There are APIs to obtain these numbers which presumably will always produce a unique ID, so that if you use it in your program you won't trash the registration of some COM object or something.


Do you know where I can get those?

Vic

_________________
phpBB Development Team
Back to top
View user's profile Send private message Visit poster's website
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Sat Oct 11, 2003 4:06 pm    Post subject: Reply with quote

Search on MSDN.com for GUID... Smile
_________________
[ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Back to top
View user's profile Send private message
Vic D'Elfant
Past Contributor
Past Contributor


Joined: 26 Jun 2002
Posts: 673
Location: The Netherlands

PostPosted: Sat Jan 24, 2004 2:34 pm    Post subject: Reply with quote

I've updated the GUID dsu... it now generates presumably unique numbers Very Happy

Regards,
Vic

_________________
phpBB Development Team
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Advanced Help for VDS 5 & Up All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group