You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Nguyễn Minh Kha <nm...@gmail.com> on 2010/01/08 19:24:09 UTC

How to UUID in .Net

Hi, I'm writing Cassandra in .Net (C Sharp) but I have a problem on gen a
UUID for my project.
I used Guid to gen UUID Version 1 but when I add to Cassandra thow an
exception "TimeUUID only makes sense with version 1 UUIDs"

I used uuidgen.exe (Windows SDK) to gen this Guid.

Pls help me resolve this problem.

Thanks

Re: How to UUID in .Net

Posted by Tatu Saloranta <ts...@gmail.com>.
On Wed, Jan 13, 2010 at 3:13 PM, Jonathan Ellis <jb...@gmail.com> wrote:
> Checked the source, yes, it does do timestamp first.  Sorry for the
> misinformation, I must be thinking of something else entirely.  It's
> been a while. :)

Not at all, thanks for checking it. I might have mis-recalled it as
well... was just trying to think of why I had done it some other way!
:-)

-+ Tatu +-

Re: How to UUID in .Net

Posted by Jonathan Ellis <jb...@gmail.com>.
Checked the source, yes, it does do timestamp first.  Sorry for the
misinformation, I must be thinking of something else entirely.  It's
been a while. :)

-Jonathan

On Wed, Jan 13, 2010 at 5:09 PM, Tatu Saloranta <ts...@gmail.com> wrote:
> On Wed, Jan 13, 2010 at 1:37 PM, Jonathan Ellis <jb...@gmail.com> wrote:
>> Actually (hitting Send jogs my memory :) it was that it does lexical
>> compares which is invalid on type 1.  So be careful. :)
>
> Ah. I would be VERY surprised if it produced invalid ones (I wrote the
> thing years ago :) ).
> Curious about lexical sorting tho. I thought it sorted first by time
> stamp, then by Mac. But sounds like it doesn't?
> (you could of course you comparator anyway)
>
> -+ Tatu +-
>

Re: How to UUID in .Net

Posted by Tatu Saloranta <ts...@gmail.com>.
On Wed, Jan 13, 2010 at 1:37 PM, Jonathan Ellis <jb...@gmail.com> wrote:
> Actually (hitting Send jogs my memory :) it was that it does lexical
> compares which is invalid on type 1.  So be careful. :)

Ah. I would be VERY surprised if it produced invalid ones (I wrote the
thing years ago :) ).
Curious about lexical sorting tho. I thought it sorted first by time
stamp, then by Mac. But sounds like it doesn't?
(you could of course you comparator anyway)

-+ Tatu +-

Re: How to UUID in .Net

Posted by Jonathan Ellis <jb...@gmail.com>.
Actually (hitting Send jogs my memory :) it was that it does lexical
compares which is invalid on type 1.  So be careful. :)

On Wed, Jan 13, 2010 at 3:36 PM, Jonathan Ellis <jb...@gmail.com> wrote:
> I'm pretty sure that when I tested JUG it generated broken type 1 UUIDs.
>
> On Wed, Jan 13, 2010 at 3:14 PM, Tatu Saloranta <ts...@gmail.com> wrote:
>> 2010/1/13 Nguyễn Minh Kha <nm...@gmail.com>:
>>> Thank Jonathan, I will try to port to C Sharp.
>>
>> If you need to port something, could have a look at better uuid packages.
>> JUG (Java Uuid Generator) is simple, jakarta-commons has one, and
>> there was a third one as well that claimed mostly be slightly faster
>> than the other two.
>>
>> But it would seem odd if C# did not already have a package (open
>> source, if core M$ packages do not provide type1 version) that does
>> this. Have you searched for such?
>>
>> -+ Tatu +-
>>
>>>
>>> On Sat, Jan 9, 2010 at 7:47 AM, Jonathan Ellis <jb...@gmail.com> wrote:
>>>>
>>>> I didn't see any C# libraries that generate type 1 UUIDs.  You might
>>>> have to port this one from java:
>>>> http://johannburkard.de/software/uuid/
>>>>
>>>> 2010/1/8 Nguyễn Minh Kha <nm...@gmail.com>:
>>>> > Hi, I'm writing Cassandra in .Net (C Sharp) but I have a problem on gen
>>>> > a
>>>> > UUID for my project.
>>>> > I used Guid to gen UUID Version 1 but when I add to Cassandra thow an
>>>> > exception "TimeUUID only makes sense with version 1 UUIDs"
>>>> >
>>>> > I used uuidgen.exe (Windows SDK) to gen this Guid.
>>>> >
>>>> > Pls help me resolve this problem.
>>>> >
>>>> > Thanks
>>>> >
>>>
>>>
>>>
>>> --
>>> Nguyen Minh Kha
>>>
>>> NCT Corporation
>>> Email : khanm@nct.vn
>>> Mobile : 090 696 1314
>>> Y!M : iminhkha
>>>
>>
>

Re: How to UUID in .Net

Posted by Jonathan Ellis <jb...@gmail.com>.
I'm pretty sure that when I tested JUG it generated broken type 1 UUIDs.

On Wed, Jan 13, 2010 at 3:14 PM, Tatu Saloranta <ts...@gmail.com> wrote:
> 2010/1/13 Nguyễn Minh Kha <nm...@gmail.com>:
>> Thank Jonathan, I will try to port to C Sharp.
>
> If you need to port something, could have a look at better uuid packages.
> JUG (Java Uuid Generator) is simple, jakarta-commons has one, and
> there was a third one as well that claimed mostly be slightly faster
> than the other two.
>
> But it would seem odd if C# did not already have a package (open
> source, if core M$ packages do not provide type1 version) that does
> this. Have you searched for such?
>
> -+ Tatu +-
>
>>
>> On Sat, Jan 9, 2010 at 7:47 AM, Jonathan Ellis <jb...@gmail.com> wrote:
>>>
>>> I didn't see any C# libraries that generate type 1 UUIDs.  You might
>>> have to port this one from java:
>>> http://johannburkard.de/software/uuid/
>>>
>>> 2010/1/8 Nguyễn Minh Kha <nm...@gmail.com>:
>>> > Hi, I'm writing Cassandra in .Net (C Sharp) but I have a problem on gen
>>> > a
>>> > UUID for my project.
>>> > I used Guid to gen UUID Version 1 but when I add to Cassandra thow an
>>> > exception "TimeUUID only makes sense with version 1 UUIDs"
>>> >
>>> > I used uuidgen.exe (Windows SDK) to gen this Guid.
>>> >
>>> > Pls help me resolve this problem.
>>> >
>>> > Thanks
>>> >
>>
>>
>>
>> --
>> Nguyen Minh Kha
>>
>> NCT Corporation
>> Email : khanm@nct.vn
>> Mobile : 090 696 1314
>> Y!M : iminhkha
>>
>

Re: How to UUID in .Net

Posted by Tatu Saloranta <ts...@gmail.com>.
2010/1/13 Nguyễn Minh Kha <nm...@gmail.com>:
> Thank Jonathan, I will try to port to C Sharp.

If you need to port something, could have a look at better uuid packages.
JUG (Java Uuid Generator) is simple, jakarta-commons has one, and
there was a third one as well that claimed mostly be slightly faster
than the other two.

But it would seem odd if C# did not already have a package (open
source, if core M$ packages do not provide type1 version) that does
this. Have you searched for such?

-+ Tatu +-

>
> On Sat, Jan 9, 2010 at 7:47 AM, Jonathan Ellis <jb...@gmail.com> wrote:
>>
>> I didn't see any C# libraries that generate type 1 UUIDs.  You might
>> have to port this one from java:
>> http://johannburkard.de/software/uuid/
>>
>> 2010/1/8 Nguyễn Minh Kha <nm...@gmail.com>:
>> > Hi, I'm writing Cassandra in .Net (C Sharp) but I have a problem on gen
>> > a
>> > UUID for my project.
>> > I used Guid to gen UUID Version 1 but when I add to Cassandra thow an
>> > exception "TimeUUID only makes sense with version 1 UUIDs"
>> >
>> > I used uuidgen.exe (Windows SDK) to gen this Guid.
>> >
>> > Pls help me resolve this problem.
>> >
>> > Thanks
>> >
>
>
>
> --
> Nguyen Minh Kha
>
> NCT Corporation
> Email : khanm@nct.vn
> Mobile : 090 696 1314
> Y!M : iminhkha
>

Re: How to UUID in .Net

Posted by Nguyễn Minh Kha <nm...@gmail.com>.
Thank Jonathan, I will try to port to C Sharp.

On Sat, Jan 9, 2010 at 7:47 AM, Jonathan Ellis <jb...@gmail.com> wrote:

> I didn't see any C# libraries that generate type 1 UUIDs.  You might
> have to port this one from java:
> http://johannburkard.de/software/uuid/
>
> 2010/1/8 Nguyễn Minh Kha <nm...@gmail.com>:
> > Hi, I'm writing Cassandra in .Net (C Sharp) but I have a problem on gen a
> > UUID for my project.
> > I used Guid to gen UUID Version 1 but when I add to Cassandra thow an
> > exception "TimeUUID only makes sense with version 1 UUIDs"
> >
> > I used uuidgen.exe (Windows SDK) to gen this Guid.
> >
> > Pls help me resolve this problem.
> >
> > Thanks
> >
>



-- 
Nguyen Minh Kha

NCT Corporation
Email : khanm@nct.vn
Mobile : 090 696 1314
Y!M : iminhkha

Re: How to UUID in .Net

Posted by Jonathan Ellis <jb...@gmail.com>.
I didn't see any C# libraries that generate type 1 UUIDs.  You might
have to port this one from java:
http://johannburkard.de/software/uuid/

2010/1/8 Nguyễn Minh Kha <nm...@gmail.com>:
> Hi, I'm writing Cassandra in .Net (C Sharp) but I have a problem on gen a
> UUID for my project.
> I used Guid to gen UUID Version 1 but when I add to Cassandra thow an
> exception "TimeUUID only makes sense with version 1 UUIDs"
>
> I used uuidgen.exe (Windows SDK) to gen this Guid.
>
> Pls help me resolve this problem.
>
> Thanks
>

Re: How to UUID in .Net

Posted by JKnight JKnight <be...@gmail.com>.
Cassandra server use UUID version 1. Maybe the uuidgen.exe does not
generator correct UUID version.

2010/1/9 Nguyễn Minh Kha <nm...@gmail.com>

> Hi, I'm writing Cassandra in .Net (C Sharp) but I have a problem on gen a
> UUID for my project.
> I used Guid to gen UUID Version 1 but when I add to Cassandra thow an
> exception "TimeUUID only makes sense with version 1 UUIDs"
>
> I used uuidgen.exe (Windows SDK) to gen this Guid.
>
> Pls help me resolve this problem.
>
> Thanks
>



-- 
Best regards,
JKnight

Re: How to UUID in .Net

Posted by Tatu Saloranta <ts...@gmail.com>.
2010/1/8 Nguyễn Minh Kha <nm...@gmail.com>:
> Hi, I'm writing Cassandra in .Net (C Sharp) but I have a problem on gen a
> UUID for my project.
> I used Guid to gen UUID Version 1 but when I add to Cassandra thow an
> exception "TimeUUID only makes sense with version 1 UUIDs"
>
> I used uuidgen.exe (Windows SDK) to gen this Guid.

Perhaps you are not actually generation variant 1 UUIDs, but something
else (like random, which is 4)?

-+ Tatu +-