FAQ Database Discussion Community


R - remove “one after another” duplicates

r,duplicates,zoo
I try to find a way to remove succesive duplicates in R language. I have a zoo object like: 2015-01-01 12:00:00 1 2015-01-01 13:00:00 1 2015-01-01 14:00:00 1 2015-01-01 15:30:00 4 2015-01-01 16:00:00 1 2015-01-01 17:00:00 6 and my expected result is: 2015-01-01 12:00:00 1 2015-01-01 15:30:00 4 2015-01-01 16:00:00...

How do unique indexes really work and avoid collisions?

mongodb,indexing,duplicates,unique-constraint
Suppose I have a collection where I create a unique index on a field: db.users.createIndex({username: 1}, {unique:true}) What happens if two documents with the same username are SIMULTANEOUSLY being inserted in the collection? How does the database prevent the collision? I mean which one gets inserted and which results in...

std::find in a vector of glm::vec3 is not working (OpenGLTriangle Normals with a crease angle)

c++,opengl,vector,find,duplicates
i am new in OpenGL and C++ and have a problem my code: vector<glm::vec3> vTempNormals; glm::vec3 normal{...}; ... if (angle < glm::radians(creaseAngle)) { if (angle != 0.0f) { if (std::find(vTempNormals.begin(), vTempNormals.end(), normal) == vTempNormals.end()) vTempNormals.push_back(normal); } } I'm trying to avoid duplicates of glm::vec3 normal in my vector-container by checking...

Count CLOB Duplicates in a large Oracle Table

sql,oracle,plsql,duplicates,clob
I have an Oracle database table LOG_MESSAGES with a CLOB column called MESSAGE. Some of the rows contain the same MESSAGE. For each MESSAGE which has at least a duplicate, I'd like to know the number of duplicates. Quite a number of these CLOBs are huge (> 100 kB), so...

Deleting duplicates in a time series

sql-server,duplicates,time-series,sql-delete
I have a large set of measurements taken every 1 millisecond stored in a SQL Server 2012 table. Whenever there are 3 or more duplicate values in some rows that I would like to delete the middle duplicates. Highlighted values in this image of sample data are the ones that...

How do I obtain the duplicated values of two ArrayLists?

java,arraylist,duplicates,array-merge
Let's say I have 2 ArrayList of Points: (0,2)->(0,3)->(0,4) (0,2)->(0,3)->(0,6) And I want to obtain a new list : (0,2)->(0,3) How do I do that? current solution Using two foreach loops to compare the two lists, element by element. I think it's a very inefficient way. Are there any other...

Delete files with same md5sum in cshell

shell,duplicates,md5sum
I am trying to implement a check where all files with same md5sum will be deleted keeping the first occurrence. Input: First column is of md5 values and 2nd is the file name. ab331f253704b84ae0aa5606adce4e7d 1.tcl ab331f253704b84ae0aa5606adce4e7d 2.tcl d86bbfda16f0d63ba35945e09dddce4d 3.tcl 1d0b140d16d32d2adbaa15643bdba412 4.tcl 8c97ae7965ae44ca6a4000d4e5988d54 5.tcl ddf373efda3bbdf83d2dfa9cb7fc4d96 6.tcl 1d0b140d16d32d2adbaa15643bdba412 7.tcl ddf373efda3bbdf83d2dfa9cb7fc4d96 8.tcl Output:...

Excel VBA code: Preventing duplicates in a column regardless the sensitive case of the entry

excel,vba,excel-vba,duplicates
i am entering data into a table using vba code, i type 3 entries in specific cells [A2,B2,C2] and i run the code to take this data to the first empty row in a table. the code also prevent the data duplicate based on the entered value in cell B2...

SQL - Select distinct on two column

sql,postgresql,sql-update,duplicates,distinct
I have this table 'words' with more information: +---------+------------+----------- | ID |ID_CATEGORY | ID_THEME | +---------+------------+----------- | 1 | 1 | 1 | 2 | 1 | 1 | 3 | 1 | 1 | 4 | 1 | 2 | 5 | 1 | 2 | 6 | 1...

Python: Rename duplicates in list with progressive numbers without sorting list

python,list,duplicates,rename
Given a list like this: mylist = ["name", "state", "name", "city", "name", "zip", "zip"] I would like to rename the duplicates by appending a number to get the following result: mylist = ["name1", "state", "name2", "city", "name3", "zip1", "zip2"] I do not want to change the order of the original...

SQL Show All column by one column distinct

sql,oracle,select,duplicates,distinct
I have a table with duplicate item's ... I need show the list of all columns without duplicate item's for example i have this table: ID CODE RANK TIME 1 12345 2 10:00 2 12345 2 11:00 3 98765 3 20:00 4 98765 3 22:00 5 66666 2 10:00 6...

Find Duplicates in SQL Server Table

sql-server-2008,duplicates
Somehow there are duplicate entries in my table. Data structure is set-up like this: RecordID, UserID, clockin, clockout So if one user has 2 entries with the same clockin/clockout time then it is a duplicate. A duplicate would look like this. The entry should only exist once, and the clockin...

create and insert randomly duplicates

python,random,duplicates
This is not probably a common question but I want to CREATE duplicates and INSERT it randomly in my String. Just like the following example. I have this file : AppleStrawberryBananaCitrusOrange And I expected this kind of output : trusppleStrawbeApplertrusryBananaCitrusOrangepple In this case my program randomly select a substring of...

Find a single duplicate in a list of lists Netlogo

list,duplicates,netlogo
I am trying to find a duplicate between the sublists of a list , if I have this list let listA [[-9 2] [-9 1] [-9 0][-9 -1][-9 -2][-9 -3][-9 -4][-8 0][-9 0]] and it is a restriction that this list can have only one sublist that can be repeated...

using ruby to delete duplicate words from text file

ruby,delete,duplicates,readfile
how would i use ruby to delete duplicate lines of word from a text file? for exmaple: file reads = line 1 = 345 line 2 = 234 line 3 = 456 line 4 = 789 line 5 = 234 line 6 = 345 I'm trying to write a script...

VB Remove duplicate lines from textbox

vb.net,visual-studio,textbox,duplicates
I am trying to extract the urls from the webpage below in the code. With this code it works but it give me all the urls a few times. I only need them once in my textbox. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load WebBrowser1.Navigate("https://www.youtube.com/results?search_query=test+search")...

Excel - Compare more than a column using VLOOKUP

excel,duplicates
I need to compare my list of latitude/longitude (columns 4 and 5) with a database containing latitude/longitude data (columns 1 and 2) and its associated data (column 3). This associated data I need to ascribe to the relevant latitude and longitude in column 6. There are no duplicates in the...

Regex/Algorithm to find 'n' repeated lines in a file

regex,algorithm,count,find,duplicates
I am looking for an advanced version of this. Basically, if I have a file with text: abc ghi fed jkl abc ghi fed I want the output to be:(for n=3) Duplicated Lines abc ghi fed Times = 2 ...

What happens with duplicates when inserting multiple rows?

sql,postgresql,exception,duplicates,upsert
I am running a python script that inserts a large amount of data into a Postgres database, I use a single query to perform multiple row inserts: INSERT INTO table (col1,col2) VALUES ('v1','v2'),('v3','v4') ... etc I was wondering what would happen if it hits a duplicate key for the insert....

hide options in comboBox java swing

java,swing,duplicates,jcombobox
I'm wanting to create the option for users in a game to select their own piece to play with from a list of piece's that I have made. To do this I have two comboBox's that contain the same items in them but i dont want users to be able...

How to display empty values after duplication of form

javascript,duplicates
I have this code javascript to duplicate form , the problem that if I fill in the form and I click on button "Add More" , the form will be duplicated with the same values that I have just filled them in the first form. How to fix it and...

Appending charactes to a string when duplicate found

sql-server,sql-server-2012,duplicates
Say i have a table of IDs, Names and a field to flag an update as follows: +----+-------+---------+ | ID | Name | Update? | +----+-------+---------+ | 1 | A | y | | 2 | B | y | | 3 | xxB | | | 4 | C...

Python duplicate a python-igraph

python,reference,duplicates,igraph
I have a python-igraph and need to make two copies of it and change each of the copies without changing the other one. Right now I am doing it like this: copy1 = fullGraph copy2 = fullGraph But it seems that this is not the correct way of doing it...

Diff an Array (without modifying original arrays)

javascript,arrays,duplicates
OBJECTIVE I am trying to highlight the dfferences between two arrays. Please note that arr1 and arr2 will vary in length and have multiple types present (strings and numbers). MY CODE function diff(arr1, arr2) { var diffArr = []; if (arr1.length >= arr2.length) { for (var i = 0; i...

Error : duplicate files during packaging of APK

android,duplicates,apk
I try to run an android eclipse on Android Studio. I try many solutions on the internet. But something wrong still happens Error:duplicate files during packaging of APK /home/sam/pst-adnew/panstage/build/outputs/apk/panstage-debug-unaligned.apk Path in archive: lib/armeabi-v7a/libmp3lame.so Origin 1: /home/sam/pst-adnew/panstage/build/intermediates/exploded-aar/pst-adnew/panstage_local_library/unspecified/jni/armeabi-v7a/libmp3lame.so Origin 2: /home/sam/pst-adnew/panstage/build/intermediates/ndk/debug/lib/armeabi-v7a/libmp3lame.so...

Check for duplicates in JSON

javascript,jquery,json,duplicates
I have a json object: var object1 = [{ "value1": "1", "value2": "2", "value3": "3", }, { "value1": "1", "value2": "5", "value3": "7", }, { "value1": "6", "value2": "9", "value3": "5", }, { "value1": "6", "value2": "9", "value3": "5", }] Now I want to take each record out of that...

cannot invoke get int on the array type comparable[ ]

java,arraylist,duplicates,syntax-error
I'm writing a method for finding whether an array has duplicates. I ran into some problem with the equals method, error at the bold line. Any adjustments I can make? Here's some of my partial code: public boolean duplicate(){ for (int i=0; i<data.length; i++){ for (int j=i+1; j<data.length; j++){ **if...

R !Duplicate by Factor Level

r,data.frame,duplicates
There is a way to remove duplicated rows... http://www.cookbook-r.com/Manipulating_data/Finding_and_removing_duplicate_records/ I am interested in doing the same thing, but by factor levels in my data frame. test <- data.frame(fact = c('a','a','a','b','b','b','b','c','c'), id = c('1','1','2','1','2','2','3','1','2'), value = c(1:9)) I would like to whittle down my test data frame to include the following.......

number of identical ids in a data frame [duplicate]

r,data.frame,duplicates
This question already has an answer here: Create counter with multiple variables 5 answers I have a data frame with a varying number of group-ids and corresponding events. Group DiffDate eventNumber 58390 0 0 58390 1765 0 24979 0 0 24979 61 0 24979 84 0 24979 1003 0...

Subset duplicates based on two columns [duplicate]

r,duplicates,subset
This question already has an answer here: R - Remove all unique rows 3 answers My data looks like this: A B 1 2 1A 2 1A 2 2 3 2 4 2 4 3A 0 3A 0 4A 1 4A 1 5 5 I want to subset the...

How to rename duplicate lines with awk?

awk,duplicates,rename
I have a file with 1 million lines and some lines are duplicate. I would like to rename the duplicate lines by appending "variant" + a number. The file is formatted as follows: I am a test line She is beautiful need for speed Nice day today I am a...

Removing duplicates from a data frame, very fast

r,duplicates
I have a data.frame with 50,000 rows, with some duplicates, which I would like to remove. SYMBOL INTENSITY CALL VALUE 1 DDR1 2464.3023 P 0.00016023613 2 RFC2 496.5190 P 0.0193034606 3 HSPA6 733.4763 P 0.0008046637 4 PAX8 2138.2882 P 0.0005617505 5 GUCA1A 176.3272 A 0.1896873022 6 UBA7 729.6157 P 0.0170004527...

Find duplicates with a suffix in excel and keep results

excel,excel-formula,duplicates
I have a spreadsheet with a list of items in one column (A) and in column C shows the total sold. I'm trying to find all the items within column A. The issue is, some items are the same, only they have a suffix, mostly separated by a -. The...

PHP / MySQL: How to return info if record already exists (without update)

php,mysql,ajax,insert,duplicates
I am using the below to insert a new row into a MySQL db. The query for this is stored in a PHP file (ajax.php) and the input values are passed to this via an Ajax call in jQuery. Everything works as intended but I would like to return a...

how to drop duplicate embedded document

mongodb,indexing,duplicates,mongodb-query
I have users' collection containing many lists of sub documents. Schema is something like this: { _id: ObjectId(), name: aaa, age: 20, transactions:[ { trans_id: 1, product: mobile, price: 30, }, { trans_id: 2, product: tv, price: 10 }, ...] ... } So I have one doubt. trans_id in transactions...

Collection without duplicates (based on id) but keeps the highest version number

java,collections,duplicates
This seems like something that should have a standard solution, but I can't find what I'm looking for. It's not difficult to implement by hand, but perhaps I'm just missing a tool in my toolbox? In pseudo-code, I want a set-like collection that, given existing entries {id_1, v_1}, {id_2, v_2}...

Remove first occurrence of a number from a list

r,duplicates
I have a vector in R with a list of characters, including some that are duplicates e.g. v<-c("d09","d11","d13","d01","d02","d10","d13") And another vector that includes single counts of those characters e.g. x<-c("d10","d11","d13") I want to remove the characters in the 2nd vector, from the first vector, but keep the duplicates. In the...

PHP multidimensional array, average of duplicate values

php,arrays,multidimensional-array,duplicates
I'm trying to insert high level product review data to SKU records but am stuck with trying to get the average value of duplicated keys. Array ( [0] => Array ( [sku] => 70835 [rating] => 5 ) [1] => Array ( [sku] => F6W/35 [rating] => 5 ) [2]...

Remove almost duplicated strings

arrays,string,perl,duplicates
Hi I have these strings and several other strings in an array. revised_1.4_1.4-1.05-jan revised_1.5_1.8-before revised_1.5_1.8-after revised_1.5_0.7-mid deleted&reviewed_0.9-0.8-1.05-jan deleted&reviewed_1.6_1.6-before deleted&reviewed_0.5_1.8-after deleted&uploaded_0.8_1.9-midweek deleted&uploaded_1.0_1.3-offweek accessedbeforesecondquarter_0.8._1.6-jan accessedbeforesecondquarter_0.9_1.7-feb I need to keep one of the almost similar strings in the array. How can I code to get this array? revised_1.4_1.4-1.05-jan...

What is the best and fast way to check data in string duplicate or not?

php,string,duplicates
What is the best and fast way to check data in string duplicate or not ? $data =...

Removing duplicate rows after checking all columns

excel,vba,excel-vba,duplicates
I have written the below macro to remove duplicate rows after checking all columns. I thought it was working correctly, based on the logic, but the output is not correct, and a few of the rows that should be showing up are being deleted. Can anyone help me with that?...

PHP - Compare a string to all in array and only echo once (unique)

php,arrays,duplicates
I'm trying to make a list of directories from a file. But I only want the list to contain unique entries i.e. - only echo once no duplicates. Example: From this log file: inactive : [2007-04-01 08:42:21] "home/club/member" 210.00 "r-200" inactive : [2008-08-01 05:02:20] "home/club/staff" 25.00 "r-200" active : [2010-08-11...

Delete common objects in two vectors/get duplicate objects in a vector (NOT erase)

c++,vector,duplicates
I am making a game using SDL 2. This game will have customizable controls. However, if one key is bound to more than one function/task, this key should be highlighted in all instances to inform the user that the key has been repeated. I am looking for the easiest way...

Pull all records only if 3 dups or more exist

sql,duplicates
I'm trying to pull ALL fields and records if two of the fields (category and measure) create 3 or more dups. SELECT category ,measure ,date FROM my_table for example: category measure date EVENTS COL 04/15/2014 EVENTS COL 05/21/2014 EVENTS COL 07/16/2014 So the above meets the criteria of 3 or...

highlight “partial” duplicates across entire sheet in Google Sheets using conditional formatting

formatting,duplicates,conditional,highlight,partial
Im trying to highlight partial duplicates in google sheets using conditional formatting. I need to highlight duplicates across multiple columns and rows in any matching cells. so far I'm using this... =countif(INDIRECT({"C2:Z18"}),C2)>1 Which works to a degree, but it only highlights exact matches. I need to find a way to...

Multiple duplicates (2 times, 3 times,…) in R

r,duplicates,duplicate-data
After searching for a while, I know that this question has not been answered yet. Assume that I have the following vector v <- c("a", "b", "b", "c","c","c", "d", "d", "d", "d") How do I find those values having more than 1 duplicates (should be "c","c","c", "d", "d", "d", "d")...

Counting the number of pairs in a vector

r,count,duplicates,categories
Suppose that I have the following vector: V<-c(-1,-1,1,1,1,-1,-1,1) And I want to know the number of different pairs in the following categories: (1,1), (-1,1), (1,-1), and (-1,-1) In my example, there is exactly 1 pair of each. I have been trying to solve this problem with the function split and...

removing and aggregating duplicates

r,duplicates,subset,lapply
I've posted a sample of the data I'm working with here. "Parcel.." is the main indexing variable and there are good amount of duplicates. The duplicates are not consistent in all of the other columns. My goal is to aggregate the data set so that there is only one observation...

How do I avoid saving duplicate records when saving objects with many to many relationships?

c#,entity-framework,asp.net-mvc-5,duplicates,many-to-many
I'm trying to wrap my mind around this but I could really use some pointers. Currently I have a many-to-many relationship between two entities and my application is working fine. However, I'd like to modify how my data gets stored regarding the tags table. I would like for only unique...

Excel three column duplication and averaging

excel,duplicates,average
I need to average data (3rd column) corresponding to a specific latitude and longitude(1st and 2nd columns). The results are then outputted to columns 4,5,6. Sample data and manual analysis is posted bellow. I think I need Index, Iferror or Vlookup. Most of the other questions dealing with this kind...

R — frequencies within a variable for repeating values

r,count,duplicates
I've got a column A, which has several values, some of them repeating. So, example: A = c(5, 9, 6, 5, 5). I need to go through A and count the frequencies of each of the values in A. So, for this example, for the set of 5s in A,...

Duplicates issue

duplicates,sas
I have a problem with duplicates. Actually what I need is only the see duplicates but my table has many variables something like the below: a b c d e 32 ayi dam som kem 32 ayi dam som tws 32 ayi dam tsm tws 12 mm ds de ko...

How to filter based on duplicate values in one column and consecutive values in another using PLSQL?

plsql,count,duplicates
I have a database table that contains some duplicate rows in one particular column. I'd like to show only those rows but ONLY when an adjacent column has consecutive numbers for each set of matching duplicates. The picture below demonstrates: Here's what I've come up with so far (the column...

why only adding last element arraylist on new arraylist [closed]

java,for-loop,arraylist,duplicates,element
there's the goal result : [[a],[a,b],[a,b,c]] but when I running my code, the result was : [[a,b,c],[a,b,c],[a,b,c]] this is the source code : public class Try { ArrayList<String> al=new ArrayList<String>(); List<List<String>> hm=new ArrayList<List<String>>(); public void addal2(){ for(int j=0; j<3;j++){ al.clear(); for(int i=0; i<1;i++){ if(j==0){al.add("a");} else if(j==1){al.add("a");al.add("b");} else if(j==2){al.add("a");al.add("b");al.add("c");} } hm.add(al);...

Return duplicates in a list based on 2 criteria

r,list,duplicates,subset
I have a list that contains 2 data sets. a = data.frame(c(1,1,1,1,1,2,2,2,2,2), c("a","b", "c", "d","e","e","f", "g", "h","i")) colnames(a) = c("Numbers","Letters") c = data.frame(c(3,3,3,3,3,4,4,4,4,4), c("q","r", "s", "t","u","u","v", "w", "x","y")) colnames(c) = c("Numbers","Letters") my.list = list(a,c) my.list I am interest in returning only the letters that are found in common between the...

Handle side effects caused by duplicate POST requests

web-services,rest,post,duplicates,idempotent
Let's say we have a web service that creates and updates meeting room bookings. Updates can change various aspects of a booking, such as time and room number. Let's imagine that user's network connection to the service may not be reliable (e.g. mobile network), and two users A and B...

C++ do…whille loop duplicate prints with getchar function

c++,loops,duplicates,do-while,getchar
The code below is printing "Menu" twice when input is different from 3. do{ puts("Menu"); option = getchar(); } while (option != '3'); ...

preventing adds of KVPs with duplicate key Values c#

c#,list,duplicates,key,keyvaluepair
I have a list of (int,int) KeyValuePairs and I want to prevent adds to this is if the key already exists. Is this function already present? or do I have to prevent the add in some other way? EDIT: Additionally I want to be able to sort the collection by...

SQL exclude duplicated pairs of columns from a two-column select

sql,select,duplicates,distinct,rows
I don't really know how to describe my problem and I haven't found an answer. I have two tables, rating and reviewer. I want to get for every pair of reviewers their names if they rated the same movie. I have this SQL query: SELECT DISTINCT re1.name, re2.name FROM reviewer...

“Duplicate” entries in ArrayList?

java,inheritance,arraylist,duplicates
i have this class thats going to fill a list with All employees that are pre made in an array. I can populate an ArrayList with employees but the only problem is that i get a few "Duplicate" entries, i use quotes cause they are not EXACTLY the same but...

java.util.zip.ZipException: duplicate entry |Android Studio

android-studio,duplicates
I'm struggling over this one for days now. I'm trying to add a library to my project, right now my current build.gradle is apply plugin: 'com.android.application' android { compileSdkVersion 21 buildToolsVersion "21.1.2" repositories { mavenCentral() } defaultConfig { applicationId "com.example.guycohen.cheaters" minSdkVersion 11 targetSdkVersion 21 versionCode 1 versionName "1.0" // Enabling...

Conditionally removing duplicate rows from a data frame

r,data.frame,duplicates,conditional
I have a data frame in R consisting of two columns: 'Genes' and 'Expression'. It has duplicate rows for some of the Genes, however these duplicate entries have differing Expression values. I want to condense the duplicate rows so there is just one row per Gene, and that this row...

Find duplicate element in a list of lists [closed]

python,duplicates,nested-lists
I am looking for Python ideas for the following problem. Given a list of lists... [[20, 21, 22], [17, 18, 19, 20], [10, 11, 12, 13]] If there is a duplicate element that is common between any or all the lists, return True. If all of the elements are unique,...

ld: duplicate symbols for architecture x86_64

c++,osx,duplicates,x86-64,symbols
How to solve this problem? Just getting following errors: g++ output: duplicate symbol _game in: /var/folders/w6/yqp0s0t92hl5g842hg8tztfr0000gn/T/main-62666f.o /var/folders/w6/yqp0s0t92hl5g842hg8tztfr0000gn/T/Game-a5a31d.o duplicate symbol _game in: /var/folders/w6/yqp0s0t92hl5g842hg8tztfr0000gn/T/main-62666f.o /var/folders/w6/yqp0s0t92hl5g842hg8tztfr0000gn/T/Write-83f8ee.o It seems like the problem is not in the header files. EDIT: Header files look like this: #ifndef GAME_H #define GAME_H #include "Color.h" #include "Tile.h" class Game...

Need to find duplicates from an array in c++, and then put them in another array

c++,arrays,input,duplicates,output
this is my first post here and I would be very happy if you could help me. The task is - Create an array from 6 input numbers, then put the duplicated numbers in another array and then output the array with the repeated numbers. Do you have any ideas?...

Returning a formatted string does not working properly

java,format,return,duplicates,string.format
I have created a dupe-check that makes sure that newly created usernames are unique. It looks like this: String p1 = <code>; //First 3 chars in first name String p2 = <code>; //First 3 chars in last name int p3 = 1; //Unique identifier. boolean dupeCheck; do { dupeCheck =...

Remove duplicates numbers above 10 in a String [duplicate]

java,string,char,duplicates
This question already has an answer here: How to efficiently remove duplicates from an array 16 answers I made a program that removes duplicates of characters in a String when pressing a button. So for example if the String is "23332" the output is "23". Now my problem is...

sql find and remove duplicate columns with trim

mysql,sql,duplicates,trim
I have a table "partner_entries" with 3 columns : our_ref | partner_ref | partner_tag where all thoses 3 fields form the primary key. I have a certain amount of "duplicate" rows like this : 42 | abc | tag1 42 | abc | tag1 As you can see it's not...

Return value based on duplicate columns

mysql,sql,replace,duplicates
Table: firstname | lastname | age Joey | Sanchez | 33 Joey | Sanchez | 33 Rachel | Dudok | 28 I'm trying to make a MySQL select statement that returns a value "ERROR" in the age column when 2 columns are duplicates I tried the Case statement but it...

Access SQL: How to find duplicate records between dates

sql,ms-access,duplicates
SN DATE =========== ========= 111 1/1/2014 222 2/1/2014 333 3/1/2014 111 4/1/2014 222 5/1/2014 333 6/1/2015 222 7/1/2015 111 8/1/2015 333 9/1/2015 111 10/1/2015 111 11/1/2015 I have a table with 2 columns (SN and DATE). I would like to create a query that will find duplicate SN between...

Create duplicate rows based on conditions in R

r,duplicates,conditional,data.table
I have a data.table that looks like this dt <- data.table(ID=c("A","A","B","B"),Amount1=c(100,200,300,400), Amount2=c(1500,1500,2400,2400),Dupl=c(1,0,1,0)) ID Amount1 Amount2 Dupl 1: A 100 1500 1 2: A 200 1500 0 3: B 300 2400 1 4: B 400 2400 0 I need to duplicate each row that has a 1 in the Dupl column...

Find duplicate values in input

java,hashmap,duplicates,hashset
I have an input like: Apple: 0 1 Apple: 4 5 Pear: 0 10 Pear: 11 13 Apple: 5 10 Apple: 2 4 And I'm looking for rows, where the fruits are the same and the first value equals to another row's second vale. So I'm looking for rows like:...

Finding all permutations of a number without duplicates (edited for clarity)

javascript,arrays,recursion,duplicates
I've finished this challenge from Coderbyte, but inelegantly: Have the function PrimeChecker(num) take num and return 1 if any arrangement of num comes out to be a prime number, otherwise return 0. For example: if num is 910, the output should be 1 because 910 can be arranged into 109...

duplicate an android studio project

android,gradle,duplicates,project,sync
Im using Android studio and Im trying to deplicate an existing project to make another new. i search in the web and also at the forum and i found this method : - copy the folder of the old project and rename it - change the package name in the...

Python - Find same values in a list and group together a new list

python,list,duplicates,append
I'm stuck figuring this out and wonder if anyone could point me in the right direction... From this list: N = [1,2,2,3,3,3,4,4,4,4,5,5,5,5,5] I'm trying to create: L = [[1],[2,2],[3,3,3],[4,4,4,4],[5,5,5,5,5]] Any value which is found to be the same is grouped into it's own sublist. Here is my attempt so far,...

Excel: Count of unique items while ignoring junk duplicates

excel,count,duplicates
I have a column with IDs and I need a count of the unique IDs only. The problem is that not all rows have unique IDs so those rows have a junk code of 99999. Also there can be text in the ID sometimes and it looks like this: D-00000...

Is there a better way to find duplicate rows _including_ the first/last?

python,pandas,duplicates
Consider a Pandas data frame: import pandas as pd df = pd.DataFrame({ 'a': pd.Series([1,1,1,2,3]), 'b': pd.Series(list('asdfg')) }) I want to return all of the rows with duplicate values for column a, including the first or last row. I can do this with df[df['a'].duplicated() | df['a'].duplicated(take_last=True)] Is there a better way?...

VBA for duplicate rows

excel-vba,duplicates
I have a sheet of columns. I want to compare data in multiple columns, and return a flag in another column to indicate rows that are duplicates. I found a little code online which was meant for checking one column of data, and have so far been unsuccessful in being...

Excel to sum value of duplicates while retaining its duplicate text

excel,duplicates,value
I need help on a loooong list of values that is possibly having duplicates with its quantity needed to sum however while retaining its duplicates. Hard to explain, example of scenario and goal I'd like to achieve. Please help. Current Situation material value a 10 b 10 a 10 c...

opening file error with duplicates

python,duplicates
I have this code: chain = '>' contain='' file = raw_input('Enter your filename : ') fileName = open(file,'r') for line in fileName: if chain in line : pass if not(chain in line): contain+=line print contain fileName.close() and this file.txt : Python supports multiple programming paradigms, including object-oriented, imperative and functional...

How to remove duplicates from a list of custom objects, by a property of the object [duplicate]

c#,linq,list,object,duplicates
This question already has an answer here: Linq Distinct on a particular Property 13 answers I want to remove the duplicates based on a property of my object: public class MyType { public string _prop1; public string _prop2; public LocationsClass(string prop1, string prop2) { _prop1= prop1; _prop2= prop2; }...

SQL Query Filter to locate DUPLICATES in a column based on Values in 2 other columns

sql-server,filter,duplicates
I am using SQL Server 2014 and I am working with a table named ReservationStay. It contains the records of all guests with their names, arrival dates and departure dates. An operation has been undertaken that has split the records of hundreds of guests into 2 separate entries, which means...

mysql self join with group_concat and without duplicates

mysql,duplicates,group-concat,self-join
I would like to get rid of duplicates in my DB. There can be several duplicates of one criterion, which are then grouped together. Let's say B is duplicate of A, and C is also duplicate of A then there should be a result like *id* | *duplicate* A |...

R create a column based on duplicate values of one column, and a second column

r,duplicates
I have two columns. One that has several duplicate values (col A) (like 10, 10, 20, 5, 10, 20, etc...). The other (col B) is a binary (0/1) variable. I need to get R to first sort the first column A, if necessary, and then look at all the duplicate...

How to find matching rows in Pandas DataFrame with identical values with same/opposite signs in certain columns?

python,pandas,duplicates,dataframes,matching
For the dataframe below, how can I return first and third row, as they have identical values in column "c" and "d", and have values opposite of each other in "a" and b"? df1=pd.DataFrame([ [1,2,3,4],[5,6,7,8], [-1,-2,3,4]], columns=['a', 'b', 'c', 'd']) a b c d 0 1 2 3 4 1...

Use tSQL to sequentially increment value based on other values

sql,sql-update,duplicates
I'm almost sure this is impossible, but I've been amazed so often at the power of the SQL language that I just thought I'd ask, because this would save me weeks of work. Let's say you have a table like this, with random numbers of duplicate records: First Last Title...

Adobe After Effects: Keep “Expression-Relations” when duplicating multiple layers

duplicates,expression,adobe,after-effects
just wanted to ask, whether there is a way to keep the relations of expressions going when duplicating layers. E.g. I have two layers, "LayerA" and "LayerB". Now I have an expression going on in "LayerB" saying, that its position always equals the position of "LayerA". Now when I duplicate...

I want to give same number to the duplicate data in excel

excel,duplicates,serial-number
I want to give same number to the duplicate data in excel A B apple 1 apple 1 apple 1 ball 2 bat 3 dog 4 dog 4 goat 5 ...

C++ duplicate symbols

c++,osx,cmake,duplicates
(Mac) I've tried namespaces, include guards, pragma once, etc. Basically, this is the structure: CMakeLists.txt add_executable(Game Game/main.cpp Game/rtexture.cpp) Game/main.cpp #include "cleanup.h" //... cleanup(foobar); Game/rtexture.cpp #include "cleanup.h" //... cleanup(foobar); cleanup.h //various includes template<typename T, typename... Args> void cleanup(T *t, Args&&... args){ //Cleanup the first item in the list cleanup(t); //Recurse to...

Ignore duplicate in string and print string once

java,string,if-statement,while-loop,duplicates
Pretty much for my assignment I have to List all the courses (just the course code) that have classes in a given building on a given day such that any part of the class is between the given times. Each course involved should only be listed once, even if it...

Create a new array adding duplicate values together

javascript,arrays,duplicates
I have a two dimensional array: [[bourbon, 2], [bourbon, 1],[scotch, 2]] I would like to end up with a new array that consolidates the duplicates so that the array would become [[bourbon, 3], [scotch, 2]] Here is how I create the array: for(var i=0; i< data.length; i++){ var typeW =...

Underscore.js, remove duplicates in array of objects based on key value

javascript,arrays,object,duplicates,underscore.js
I have the following JS array: var myArray = [{name:"Bob",b:"text2",c:true}, {name:"Tom",b:"text2",c:true}, {name:"Adam",b:"text2",c:true}, {name:"Tom",b:"text2",c:true}, {name:"Bob",b:"text2",c:true} ]; I want to eliminate the indexes with name value duplicates and recreate a new array, with distinct names, eg: var mySubArray = [{name:"Bob",b:"text2",c:true}, {name:"Tom",b:"text2",c:true}, {name:"Adam",b:"text2",c:true}, ]; As you can see, I removed "Bob" and "Tom",...

mysql duplicate rows and replace

mysql,replace,duplicates
I have, perhaps, 180 entries in my mysql table. I still have many rows to insert but I will eventually need to add an additional column called "style" which will have two options. First off I'll need to put an option for the first couple hundred entries I already have...

PHP: Checking two arrays for duplicate values

php,arrays,duplicates
I have two arrays, one that contains a persons first name and another one that contains a persons last name. $firstname = array ( "John", "Tom", "Ben", "John", "David", "Julie", "David"); $lastname = array ( "Kennedy", "Hyde", "Hughes", "Harper" "Walter", "Weber", "Walter"); A persons first and last names are in...

PHP MYSQL Prevent user or email inserted twice

php,mysql,insert,duplicates
I want to prevent if the user enters same email twice, which will create duplicate entry. Please help me to solve this small problem, I have searched stackoverflow for this problem but everyone has their own database with own method. Thank you <form action="create_subscriber.php" method="post"> <input placeholder="Name" name="inputName" type="name" required/>...

How to check if exists any duplicate in Java 8 Streams?

java,duplicates,java-8
In java 8, what's the best way to check if a List contains any duplicate? My idea was something like: list.size() != list.stream().distinct().count() Is it the best way?...

ms-access Group BY a match between several fields

sql,ms-access,duplicates,group
i have a table like: | id | field1 | field2 | field3 | --------------------------------------------- | 1 | A | B | C | | 2 | E | F | G | | 3 | H | A | I | | 4 | *null* | J | K...

trying to delete automatically added and sorted answers from a VBA textbox into excel cells

excel,vba,delete,duplicates,add
I have code that adds and that if an answer is provided based on a certain criteria it adds itself to a list. as i have been troubleshooting the rest of the program i have accrued a lot of answers that have been added. if i select the cells it...

Oracle - Arbitrarily pick one of multiple rows based on single unique key

sql,oracle,group-by,duplicates,candidate-key
Good Morning! I am looking for a trick to maintain a unique list of keys where a one-to-many relationship can occur. Problem I am working with a horribly non-normalized database at work and unfortunately redesign is out of the question. I have a 1NF master table which contains a number...

how to reject duplicate values [closed]

python,duplicates,prompt
I'm making a program whereby the user has two enter 10 integers: a = input('Enter an integer: ') b = input('Enter an integer: ') c = input('Enter an integer: ') d = input('Enter an integer: ') e = input('Enter an integer: ') f = input('Enter an integer: ') g =...