[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

unique data

Peter Meier

9/24/2006 12:24:00 PM

Hi,

I'd like to use the gem "rubytree" to store some data in a tree.
But this requires a unique name for each node.

Does anybody has some advice, how to generate such a unique id?
Could be a random, but unique number, ...

Thanks
Peter
7 Answers

MonkeeSage

9/24/2006 1:10:00 PM

0

Peter Meier wrote:
> Does anybody has some advice, how to generate such a unique id?
> Could be a random, but unique number, ...

Hi Peter,

How about a type-4 UUID?

class UUID
@@range = %{0123456789abcdef}.split(//)
@@indices = [7,11,15,19]
def self.new
uuid=[]
32.times { |i|
uuid << @@range[rand(16)]
uuid << '-' if @@indices.include?(i)
}
uuid.join
end
end
puts UUID.new

Mabye just using the object_id of the node itself or the object you're
inserting into the node would work?

Regards,
Jordan

Robert Klemme

9/24/2006 3:11:00 PM

0

Peter Meier wrote:
> Hi,
>
> I'd like to use the gem "rubytree" to store some data in a tree.
> But this requires a unique name for each node.
>
> Does anybody has some advice, how to generate such a unique id?
> Could be a random, but unique number, ...

Why not use a counter?

robert

MonkeeSage

9/24/2006 7:31:00 PM

0

Robert Klemme wrote:
> Why not use a counter?

Doh! Curse you rubyists for always thinking of easy ways to do things!
I'm going to fire up perl5 and write some code, just to spite you! ;)

Regards,
Jordan

Chairman Mao , expert fucker of Chinese High School Girl 's cunts in China

2/26/2012 2:03:00 AM

0

AleXX

does this mean our CHINESE in Malaysia can take over
Malaysia in this century ?

just like all of OUR Chinese People in Malaysia are
demanding for racial EQUALITY in Malaysia with the Malays .?

If Malays allow every one to be EQUAL in Malaysia ,
that means our CHINESE PEOPLE in Malaysia can take over
Malaysia , if
Chinese are Equal to the Malays in Malaysia , if this is
going to be a Chinese century ?


You get What I mean , AleXX ?






Feb 25, 1:32 pm, Alex <kewkahfattsingap...@hotmail.com> wrote:
> On Feb 24, 11:48 pm, "AleXX®" <cir...@cycle.net> wrote:
>
> > No holds bar and see who will win this time; and to settle the score once
> > and for allhttp://www.asiaone.com/News/Latest%2BNews/World/Story/A1Sto......
>
> Stupid to use violence to settle score.
>
> The best solution is application of 'wu wei'
> Application is 'wu wei' is appointing a holy man as country president
> without political power.
> His main duty is meditation and dieting.
>
> This is a Chinese century.
> Chinese will conquer the world without a fight.
>
> See me herehttp://www.myspace.com/kewkahfatt,http://www.facebook.com/...
> ,  http://www.perfspot.co...

CPC , Chinese Imperialist Communist Party of CHINA , the New Imperialist Force in ASEAN

2/26/2012 5:05:00 AM

0

AleXX , you HOMO CHINK

does this mean our CHINESE in Malaysia can take over
Malaysia in this century ?


just like all of OUR Chinese People in Malaysia are
demanding for racial EQUALITY in Malaysia with the Malays .?


If Malays allow every one to be EQUAL in Malaysia ,
that means our CHINESE PEOPLE in Malaysia can take over
Malaysia , if
Chinese are Equal to the Malays in Malaysia , if this is
going to be a Chinese century ?


You get What I mean , AleXX ?

I KOMIN the GREAT , hate all CHINESE ,

That is why I am GAY .


Feb 25, 1:32 pm, Alex <kewkahfattsingap...@hotmail.com> wrote:



- Hide quoted text -
- Show quoted text -

> On Feb 24, 11:48 pm, "AleXX®" <cir...@cycle.net> wrote:

> > No holds bar and see who will win this time; and to settle the score once
> > and for allhttp://www.asiaone.com/News/Latest%2BNews/World/Story/A1Sto......


> Stupid to use violence to settle score.


> The best solution is application of 'wu wei'
> Application is 'wu wei' is appointing a holy man as country president
> without political power.
> His main duty is meditation and dieting.


> This is a Chinese century.
> Chinese will conquer the world without a fight.


> See me herehttp://www.myspace.com/kewkahfatt,http://www.facebook.com/...
> , http://www.perfspot.co...

Wakalukong

2/26/2012 8:09:00 AM

0

On Feb 26, 1:05 pm, "CPC , Chinese Imperialist Communist Party of
CHINA , the New Imperialist Force in ASEAN"
<communistpartyofchin...@gmail.com> wrote:
> AleXX  ,  you  HOMO  CHINK
(snip)
---------

Hey Dik Likker Komin, you've repeatedly said, "I hate Chinese, that's
why I'm gay." You're a bloody illogical hypocrite.

Time to get lost to downtown Cambodia, where the boys are waiting to
give your backside a good polish so that it'll glow in the drak.
Remember to wear your sister's panties for the audition and don't
steal the used condoms.

Wakalukong

wakalukong

2/26/2012 8:33:00 AM

0

I am HOMO Wakalukong , I worship and kiss the ass of the
GREAT KOMIN , and everyone knows now I am HO HO HOMO

my boyfriend DH is gone to rich man .

my CHINKLISH is not very good .

I , HOMO Wakalukong , always like to wear my sisters
panties and using her dildo .

Fucking hell ! It is good to be HOMO HO HO HOMO !!!

I want to fuck Frankie Lee in the ass like that great
KOMIN .


On Feb 26, 4:09 pm, Wakalukong <wakaluk...@yahoo.com.sg> wrote:
> On Feb 26, 1:05 pm, "CPC , Chinese Imperialist Communist  Party  of
> CHINA  , the  New  Imperialist  Force  in  ASEAN"<communistpartyofchin...@gmail.com> wrote:
> > AleXX  ,  you  HOMO  CHINK
>
> (snip)
> ---------
>
> Hey Dik Likker Komin, you've repeatedly said, "I hate Chinese, that's
> why I'm gay."  You're a bloody illogical hypocrite.
>
> Time to get lost to downtown Cambodia, where the boys are waiting to
> give your backside a good polish so that it'll glow in the drak.
> Remember to wear your sister's panties for the audition and don't
> steal the used condoms.
>
> Wakalukong