I must create unique keys for certain objects I create (needed for React key prop), where key can be any random string or number, but has to be truly unique for each time it's generated in program lifetime.  I tried to use new Date().getTime() as key, but encountered problem where multiple objects got assigned the same key when creating them in loop.  Is there a function which returns something purely unique each call as long as the program is running, or do I have to implement my own counter?
23615
I'm trying to create globally-unique identifiers in JavaScript.  I'm not sure what routines are available on all browsers, how &quot;random&quot; and seeded the built-in random number generator is, etc. The GUID / UUID should be at least 32 characters and should stay in the ASCII range to avoid trouble when passing them around.
1512
I am looking for a generic, bidirectional 1 to 1 Dictionary class in C# (2), ie. a BiDictionaryOneToOne&lt;T, S&gt; which is guaranteed to only contain one of each value and key (up to RefEquals anyway), and which can be searched using either key or value. Anyone know of one, or should I just implement it myself? I can't believe that I'm the first person to need this...  There is a BiDictionary in the answers to , but it is not for unique elements (and also does not implement RemoveByFirst(T t) or RemoveBySecond(S s)).   Thanks!
71065
I see a lot of Q/A where persons are trying to generate a specific key pair using static data such as a password. Now say we use a known PRNG (dangerous assumption), seeded with a the data as a static seed, would this always generate the same key pair?  I presume it would generate the same key pair if you would use the exact same generation method - the application would be deterministic. I would however expect differences between implementations. The random data could be used differently, the sizes of p and q could differ and there may be subtle differences when choosing the prime numbers themselves.
41144
As made clear in update 3 on , this notation: var hash = {}; hash[X]  does not actually hash the object X; it actually just converts X to a string (via .toString() if it's an object, or some other built-in conversions for various primitive types) and then looks that string up, without hashing it, in &quot;hash&quot;. Object equality is also not checked - if two different objects have the same string conversion, they will just overwrite each other. Given this - are there any efficient implementations of hashmaps in JavaScript? (For example, the second Google result of  yields an implementation which is O(n) for any operation. Various other results ignore the fact that different objects with equivalent string representations overwrite each other.
122241
So for each round in AES a different key is used, and as I saw the keys are created form a master key.  My question is how these round keys are generated.   Are they created via a Key Derivation Function as the session keys, or its something else ?
73102
I am having problem while looping.  I am always getting an extra button. Please help.   {this.state.items.map(myitems1 =&gt; {     return (        &lt;div key={myitems1.Id}&gt;            &lt;span&gt;{myitems1.Item_x0020_Name}&lt;/span&gt;            &lt;button onClick={e =&gt; this.dosometing(myitems1.Id)}&gt;Offline&lt;/button&gt;        &lt;/div&gt;     ); })}   I can see the collection has only three (3) values, But I am getting 4 buttons on screen.   Getting always extra
120061
Shouldn't be repeated in any case; if the numbers appeared is exactly the same as another but different orders, that doesn't count as a new set. For example: $11,13,18,19,19,20$ is the same as $13, 18, 19,11,19,20$.
27098
I once read that one way to obtain a unique filename in a shell for temp files was to use a double dollar sign ($$).   This does produce a number that varies from time to time... but if you call it repeatedly, it returns the same number.  (The solution is to just use the time.)  I am curious to know what $$ actually is, and why it would be suggested as a way to generate unique filenames.
113672
For example:  &gt;&gt;&gt; x = [1, 1, 2, 'a', 'a', 3] &gt;&gt;&gt; unique(x) [1, 2, 'a', 3]   Assume list elements are hashable.  Clarification: The result should keep the first duplicate in the list. For example, [1, 2, 3, 2, 3, 1] becomes [1, 2, 3].
56376
I'm trying to get my head around mutable vs immutable objects. Using mutable objects gets a lot of bad press (e.g. returning an array of strings from a method) but I'm having trouble understanding what the negative impacts are of this. What are the best practices around using mutable objects? Should you avoid them whenever possible?
120146
I have a point shapefile with thousands of points. It has an ID code field that is supposed to be unique. Every now and then the data entry clerk wrongly type the ID creating duplicates. Right now I'm manually scrolling the field to find the duplicate.   Is there another way to do this using the Search Query Builder?
100856
Do you know if there is a built-in function to build a dictionary from an arbitrary object? I'd like to do something like this:  &gt;&gt;&gt; class Foo: ...     bar = 'hello' ...     baz = 'world' ... &gt;&gt;&gt; f = Foo() &gt;&gt;&gt; props(f) { 'bar' : 'hello', 'baz' : 'world' }   NOTE: It should not include methods. Only fields.
4495
How do I check if an object has a specific property in JavaScript?  Consider:  x = {'key': 1}; if ( x.hasOwnProperty('key') ) {     //Do this }   Is that the best way to do it?
34214
How can I efficiently create a unique index on two fields in a table like this: create table t (a integer, b integer);  where any unique combination of two different numbers cannot appear more than once on the same row in the table.  In order words if a row exists such that a=1 and b=2, another row cannot exist where a=2 and b=1 or a=1 and b=2.  In other words two numbers cannot appear together more than once in any order.  I have no idea what such a constraint is called, hence the 'two-sided unique index' name in the title.  Update: If I have a composite key on columns (a,b), and a row (1,2) exists in the database, it is possible to insert another row (2,1) without an error.  What I'm looking for is a way to prevent the same pair of numbers from being used more than once in any order...
70884
I made many copies of an object, then I thought it would've been better if I made them to share the same Data (being an instance of the same original object), I know how to do it one by one, is there a way to do it for all of them at once? I tried Copy Attribute add-on but didn't find what option can do that, or even if this is possible in the first place.
44606
I'm trying to generate unique purchase order numbers that start at 1 and increment by 1. I have a PONumber table created using this script:  CREATE TABLE [dbo].[PONumbers] (   [PONumberPK] [int] IDENTITY(1,1) NOT NULL,   [NewPONo] [bit] NOT NULL,   [DateInserted] [datetime] NOT NULL DEFAULT GETDATE(),   CONSTRAINT [PONumbersPK] PRIMARY KEY CLUSTERED ([PONumberPK] ASC)     );   And a stored procedure created using this script:  CREATE PROCEDURE [dbo].[GetPONumber]  AS BEGIN     SET NOCOUNT ON;      INSERT INTO [dbo].[PONumbers]([NewPONo]) VALUES(1);     SELECT SCOPE_IDENTITY() AS PONumber; END   At the time of creation, this works fine. When the stored procedure runs, it starts at the desired number and increments by 1.  The strange thing is that, if I shut down or hibernate my computer, then the next time the procedure runs, the sequence has advanced by almost 1000.   See results below:    You can see that the number jumped from 8 to 1002!   Why is this happening?  How do I ensure that numbers aren't skipped like that?  All I need is for SQL to generate numbers that are:   a) Guaranteed unique.  b) increment by the desired amount.    I admit I'm not a SQL expert. Do I misunderstand what SCOPE_IDENTITY() does?  Should I be using a different approach? I looked into sequences in SQL 2012+, but Microsoft says that they are not guaranteed to be unique by default.
27944
I know how to successfully duplicate an object by using  bpy.ops.object.add_named(name = 'TemplateObjectName')   If the template object named 'TemplateObjectName' has animations, particle systems and modifiers attached to it, the previous call will create a duplicate object that also has those components. However, if I duplicate an object using   template_object = bpy.data.objects['TemplateObjectName'] new_object = bpy.data.objects.new('NewObjectName', template_object.data) collection.objects.link(new_object)   how do I attach the template object's animation, modifiers, particle systems...?