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
2 answers

Groovy remove duplicate from list using unique function

I'm using soapui groovy script. I want to remove the duplicate from a list, using the next code: def myStr = "aaaa ; bbbb ; ccccc" def myList = myStr.split(";") myList = myList.unique() but when i tun the code i get exception: No signature of…
Adi Mor
  • 2,145
  • 5
  • 25
  • 44
2
votes
1 answer

How to enforce uniqueness on a polymorphic join table?

Suppose I have a Genre model that can be associated with either an instance of Book or Movie. Something like, class Genre < ActiveRecord::Base belongs_to :genreable, polymorphic: true end class Book < ActiveRecord::Base has_many :genres, as:…
ivan
  • 6,032
  • 9
  • 42
  • 65
2
votes
2 answers

how to count adjacent elements in a 3d numpy array efficiently

I have a 3d numpy array fill with integers from 1 to 7. I want to count the number of unique elements in neighbour cells of each cell. For exmaple, in a 2d array: a=[[1,1,1,7,4], [1,1,1,3,2], [1,1,1,2,2], [1,3,1,4,2], [1,1,1,4,2]] …
YC.Chui
  • 169
  • 1
  • 2
  • 7
2
votes
1 answer

R: Counting the number of matches between multiple data frames

I want to find the number of matches based on ID of unique matches within multiple data.frames Data looks like this: df1: KeyID x x y y z df2: KeyID x x x z z df3: KeyID …
CoryB
  • 75
  • 1
  • 3
  • 11
2
votes
5 answers

What is guid and how could I generate this in php?

I want to create a unique string for our users. our site in php. right now I am using uniqid() for this but it returns a new value every time when I refresh a page. how could I can stop to generate this every time? can anyone help me?
tutoground
  • 96
  • 7
2
votes
1 answer

SonataUserBundle FOSUserBundle UniqueEntity email & username

I have my own User Class, wich inherits Sonata's BaseUser (Sonata\UserBundle\Entity\BaseUser). My problem: If I try to create a user from sonata admin using an existing email, I get the following exception: "Failed to create object:…
2
votes
1 answer

Generate unique list from a list of lists

I'm trying to define a function that will accept an arbitrary number of lists and will generate a single list of unique elements from those lists. (I'm using Python 3.4) Example: a = ['lion', 'tiger', 'panther'] b = ['dog', 'lion', 'bear'] c =…
lagunazul
  • 257
  • 3
  • 5
  • 10
2
votes
2 answers

Using WHERE with SUM function SQL

SELECT imagename, SUM(ratingvalue) as "lol" FROM ratings GROUP BY imagename; How do I go about grabbing the total of a specific imagename so i can then display it onto the page, so for example instead of returning the results for all…
Emmett
  • 357
  • 2
  • 4
  • 15
2
votes
2 answers

MySQL UNIQUE error on 2 different UTF-8 string?

I create a tool to leech users for my xenforo forum but I have a mistake with 2 users, such as sample below. CREATE TABLE IF NOT EXISTS `xf_user` ( `user_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `username` varchar(50) NOT NULL, `email`…
2
votes
2 answers

Counting unique keys in Couchbase views

I'm trying to figure out a way to count the number of unique values in a bucket that is not a primary key. Couchbase 2.5 provides a n1ql method to do this. If we use their beer-sample you can issue the following command: select count(distinct…
2
votes
4 answers

Need help generating a unique request code for alarm

My app structure is like, there are 1000 masjids/mosques and each masjid has been given a unique id like 1,2,3,4 ..... 1000 . Now each mosque has seven alarms associated with it , I wish to generate a unique request code number for each alarm so…
user3671032
  • 211
  • 2
  • 16
2
votes
1 answer

Cartesian product of several vectors

similar questions have been asked before but I cant find an exact match to my question. I have 4 vectors each of which hold between 200-500 4 digit integers. The exact number of elements in each vector varies but I could fix it to a specific value.…
Stephen Blinkhorn
  • 637
  • 2
  • 7
  • 17
2
votes
2 answers

Generating Unique 6-digit numbers per day

I'm developing a multi-process solution and have to assign 6 digit unique numbers to some objects (specifying more than 6 digits or using alphanumeric characters is not possible. The length of this number is a third-party constraint). since this…
Kamyar
  • 18,639
  • 9
  • 97
  • 171
2
votes
2 answers

Non-repeated arrays in a matrix in matlab

I am looking for non-repeated rows in a matrix. Assume: A = 8 1 2 2 2 2 2 2 2 2 3 6 5 7 5 7 I would like to get "B" which is: B= 8 1 3 6 Please mind C=unique(A,'rows') will give us unique rows of…
Iman
  • 412
  • 4
  • 18
2
votes
0 answers

Unique Constraint Validation

I have a JPA Entity, and in this entity I have a field that is Annotated by: import javax.persistence.*; .... @Column(nullable=false, unique=true) private String name; Then I have a form on a XHTML Page wich the following form:
Sam
  • 313
  • 4
  • 21
1 2 3
99
100