Below is a code snippet (from Nick Berardi's Coder Journal ) public static Guid GenerateTimeBasedGuid(DateTime dateTime) { long ticks = dateTime. Ticks - GregorianCalendarStart. Ticks; byte guid = new byteByteArraySize; byte clockSequenceBytes = BitConverter.
GetBytes(Convert. ToInt16(Environment. TickCount % Int16. MaxValue)); byte timestamp = BitConverter.
GetBytes(ticks); // copy node Array. Copy(Node, 0, guid, NodeByte, Node. Length); // copy clock sequence Array.
Copy(clockSequenceBytes, 0, guid, GuidClockSequenceByte,clockSequenceBytes. Length); // copy timestamp Array. Copy(timestamp, 0, guid, 0, timestamp.
Length); // set the variant guidVariantByte &= (byte)VariantByteMask; guidVariantByte |= (byte)VariantByteShift; // set the version guidVersionByte &= (byte)VersionByteMask; guidVersionByte |= (byte)((int)GuidVersion. TimeBased.
Below is a code snippet (from Nick Berardi's Coder Journal) public static Guid GenerateTimeBasedGuid(DateTime dateTime) { long ticks = dateTime. Ticks - GregorianCalendarStart. Ticks; byte guid = new byteByteArraySize; byte clockSequenceBytes = BitConverter.
GetBytes(Convert. ToInt16(Environment. TickCount % Int16. MaxValue)); byte timestamp = BitConverter.
GetBytes(ticks); // copy node Array. Copy(Node, 0, guid, NodeByte, Node. Length); // copy clock sequence Array.
Copy(clockSequenceBytes, 0, guid, GuidClockSequenceByte,clockSequenceBytes. Length); // copy timestamp Array. Copy(timestamp, 0, guid, 0, timestamp.
Length); // set the variant guidVariantByte &= (byte)VariantByteMask; guidVariantByte |= (byte)VariantByteShift; // set the version guidVersionByte &= (byte)VersionByteMask; guidVersionByte |= (byte)((int)GuidVersion. TimeBased.
Cassandra expects UUIDs to conform to RFC 4122, so you'll need to either generate compliant values yourself or use an existing library for the language of your choice (most languages have free UUID generation libraries readily available).
I am just continuing where "Schildmejir" has stopped. This how you can actually use the generated GUID in inserting values to columnfamilies. Mutation foobar = new Mutation() { Column_or_supercolumn = new ColumnOrSuperColumn() { Super_column = new SuperColumn() { Name = GuidGenerator.
GenerateTimeBasedGuid(DateTime. Now).ToByteArray(), Columns = listOfSomeColumns } } }; List foobarlist = new List(); listOfChannelIds. Add(new Column() { Name = utf8Encoding.
GetBytes("somename"), Value = utf8Encoding. GetBytes(somestring), Timestamp = timeStamp }); You can use the generated GUID either in SupercolumnName or columnName depending on the requirement.
We have an API for that" :-) https://github. Com/rantav/hector/blob/master/core/src/main/java/me/prettyprint/cassandra/utils/TimeUUIDUtils. Java This class makes it easy to build type1 UUIDs and extract the timestamps as needed.
See the related test case for examples. Hector is MIT licensed, so if you are set on doing your own thing, feel free to use whatever helps.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.