Questions tagged [unique]

Refers to an element that is distinctly different from any other element in a collection.

Refers to an element that is distinctly different from any other element in a collection.

6072 questions
2
votes
5 answers

C# dictionary uniqueness for sibling classes using IEquatable

I would like to store insances of two classes in a dictionary structure and use IEquatable to determine uniqueness of these instances. Both of these classes share an (abstract) base class. Consider the following classes: abstract class Foo { …
anthony
  • 40,424
  • 5
  • 55
  • 128
2
votes
9 answers

Delete unique elements from a list

I faced some problem with solving the next problem: We have a list of elements (integers), and we should return a list consisting of only the non-unique elements in this list. Without changing order of the list I think the best way is to delete or…
Nikolay
  • 80
  • 1
  • 2
  • 9
2
votes
1 answer

DataTable case sensitive characters on Primary Key

I am in the following situation : I have to patch a problem in a very poorly designed application. In the code, the previous developer get informations from DB and put it in a DataTable. Then, he sets Primary Key on a field of this…
user2687153
  • 427
  • 5
  • 24
2
votes
7 answers

Pulling distinct values from a array in java

Have a program where the user inputs 10 int values into the array. Lastly I need to pull out the distinct values and display them. Added my second for loop which would determine if the the value is distinct (i.e. meaning if the number appears…
Chewy
  • 85
  • 2
  • 4
  • 15
2
votes
0 answers

Customize Auto_Increment using prefix YYYY-0000001 [SQL]

Is their any simple way to auto generate a project id like 0001, 0002, 0003 but instead of 0001 its 2014-0000001, 2014-0000002, 2014-0000003 ... UserID = {YEAR}-{0000001} > continuous. Sample: UserID | Name 2014-0000001 | Gary …
Pseudorandom
  • 716
  • 3
  • 14
  • 30
2
votes
1 answer

Multiple independent pseudo random number generation in hardware (Verilog or VHDL)

I need pseudo random numbers generated for hardware (either in VHDL or Verilog) that meet the following criteria. - Each number is 1-bit (doesn't have to be, but that would complicate things more) - The N pseudo random numbers cannot be correlated…
mxo
  • 21
  • 1
2
votes
4 answers

SQL Server Create Table With Column Unique Not Null and Not Empty(Check)

How to create a table with a column which is unique, not null and not empty(Check)? I tried below Query CREATE TABLE Persons ( P_Id int NOT NULL UNIQUE, LastName nvarchar(255) NOT NULL, FirstName nvarchar(255), Address nvarchar(255), City…
Psyche Genie
  • 687
  • 1
  • 10
  • 26
2
votes
2 answers

Is it possible to create an UNIQUE KEY using only the date from a datetime column as one of the parameters?

This is the query I am trying to execute but it doesn't work. ALTER TABLE values ADD UNIQUE(id_cod, id_op, (SELECT date(V.completed_date) FROM values V;)); I have these 3 columns in the values table: id_cod, id_op and completed_date which I want to…
adrian
  • 21
  • 1
  • 2
2
votes
4 answers

How to add a new unique string to text file

I have a text file contains several lines with words, for example like this cards door lounge dog window I want to add a new word into that list with the condition that it does not already exist in the list. For example I want to add wind or car I…
Hien Tran
  • 1,443
  • 2
  • 12
  • 19
2
votes
1 answer

Numpy.unique behavior (flattening insconsistencies?)

I have two lists from which I need to find the indices associated with unique pairs (all the SO posts I could find are only interested in the pairs themselves). I've been trying to use numpy.unique to do so, but am hitting an oddity. I zipped the…
Ajean
  • 5,528
  • 14
  • 46
  • 69
2
votes
1 answer

How to avoid duplicate values in an array of arrays?

I know how to avoid duplicates in a one-dimensional array. However, I have an array of arrays, and two lines of it may hold arrays with different references, but same values. I tried this: sub unique { my %seen; grep…
jackthehipster
  • 978
  • 8
  • 26
2
votes
1 answer

Effective approach on fast look up of unique words in C#

I have the following problem. I have to store a list of unique words in multiple languages in memory and of course when I add new words I have to check whether the new word already exist. Of course this needs to be blazingly fast, primarily because…
Itay Grudev
  • 7,055
  • 4
  • 54
  • 86
2
votes
4 answers

How to take a random sample of variable with multiple observations

Rookie here -- I have a large data set of about 75,000 observations and 2000 unique IDs. Therefore, each ID has about 37 observations. Now, how can I take a random sample of unique IDs, say 4, such that I have a new data frame that contains 4 random…
kstats9pt3
  • 799
  • 2
  • 8
  • 28
2
votes
0 answers

Unique has_many through combination

I just have this simple setup: class Team < ActiveRecord::Base has_many :players has_many :users, -> { uniq }, through: :players end class User < ActiveRecord::Base has_many :players has_many :teams, -> { uniq }, through: :players end class…
Chrisn
  • 88
  • 1
  • 7
2
votes
4 answers

Restrict application to install only on specific imei android devices

I have developed an education app for specific people. I want that my app only get installed on their devices (on specific IMEI devices). I know that, After application installed, my app can verify those IMEI numbers. But as we all know that, we can…
RStar
  • 100
  • 2
  • 7
1 2 3
99
100