duplicates

How do I prevent MySQL from auto-incrementing the Primary Key while using ON DUPLICATE KEY UPDATE when the duplicate is a different unique column?

Consider the following table: +-------------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------+------------------+------+-----+---------+----------------+ | vendor_id | int(10) unsigned | NO | PRI | NULL | auto_increment | | vendor...

Getting duplicates count for each distinct value from a datatable

Hello I've a datatable which has a single text column 'Title' which can have multiple values with duplicates. I can remove the duplicates using a dataview. DataView v = new DataView(tempTable); tempTable = v.ToTable(true, "Title"); But how can i get the number of duplicates for each distinct value without any looping? ...

find duplicates in integer array with boundaries.

Below is the problem description and algorithm that I have written. Is there anything to be done to improve this algorithm? Given an integer array of unknown size, containing only numbers between 0 and 30, write a function to return an integer array containing all of the duplicates. int[] findDupes(int[] array) { int[] found = new ...

What is the preferred way to filter a regex search for duplicate matches in C#

A new question has arisen in relation to an earlier question of mine. I have some code that is using a regex to find email addresses. It's working great except that it returns duplicate matches. I searched this site and found a question from a long time ago that was dealing with a similar problem, and the answer had something to do with ...

Sorting arrays of paired numbers and removing duplicates or overlaps?

How can I sort two arrays of coordinates in numerical order by the start coordinates e.g. my @starts = (100,100,200,300,400,500,525); my @ends = (150,125,250,350,450,550,550); but choose the biggest difference if there are two matching in either the starts or ends list? E.g. my @uniq_starts = (100,200,300,400,500); my @unique_ends ...

Check and return duplicates array php

Hello, I would like to check if my array has any duplicates and return the duplicated values in an array. I want this to be as efficient as possible. Example :$array = array(1,2,2,4,5) function returndup($array) should return 2 ; if array is array(1,2,1,2,5); it should return an array with 1,2 Also the initial array is always 5 posit...

Remove duplicate rows from a large file in Python

I've a csv file that I want to remove duplicate rows from, but it's too large to fit into memory. I found a way to get it done, but my guess is that it's not the best way. Each row contains 15 fields and several hundred characters, and all fields are needed to determine uniqueness. Instead of comparing the entire row to find a duplicat...

Displaying duplicate options values in a select with Cakephp

Hi, Using the form helper in Cakephp 1.3, I'm trying to display a list (drop-down list) which contains several duplicates value fields (in <option> tag of course), but cake seems not to want to let me doing it, and outputs only the first occurrence of each value. For instance, here's the 'options' array of the $form->input: array( ...

Update column value or delete it if duplicated?

I have a MySQL table which has three columns: Authority | MapID | Time --------------------------------------------------------- animuson@forums | 000000000000000 | 45.6758 132075829385895 | 000000000000000 | 49.7869 qykumsoy@forums | 000000000000000 | 44.45 439854390263565...

Counting duplicates in a Listbox

I am trying to develop a simple application in C# to count the number of duplicates in a listbox. I need to count all the number of duplicates and display a rank suffix to the top 3 elements most duplicated. For example, suppose a list has 7 elements called 'apple', 6 elements called 'pear', 4 elements called 'peach' and 3 elements calle...

finding duplicate file trees in backups

i changed computers and OSes here a few times and had a linux backup machine running at some point. I now have 2 disks, which contains backups of each other, where some file trees are nested in each other but might be identical. what is the best way to figure out which trees are identical, so I can get rid of some duplicate trees and cl...

SEO duplicate content

If you have an URL like this: http://stackoverflow.com/questions/123/this-is-my-question If someone creates a link on his website, but changes the name like this http://stackoverflow.com/questions/123/this-is-a-different-question-title that would cause duplicate content. Is it nessecary to check if the name in the url is the ...

php make unique hash of rss description

Hi all, im using php to create a sorta rss aggregator that stores data from multiple site rss feeds into a mysql database. since articles could be duplicated on many websites, i want to avoid this. ive been told you could use hashing to make unique hashes based on content of rss[description + title]. Now which hashing algorithm is fas...

Duplicates in QSet

For a class X and a QSet< X* >, how is it possible to make sure that the QSet doesn't contain duplicate elements? The unique property in each object of type X is a QString that can be fetched using getName(). I've implemented the qHash(X*) function, the operator==(), operator<() and operator>(), but the QSet still accepts duplicate elem...

Select multiple distinct fields, and summing another field

I have a table where I have 6 columns. 5 of these columns I have to make sure that I don't have any duplicates. So I used the statement: SELECT SUB_ACCT_NO_PAJ, CustomerType, POST_DTE_PAJ, IA_DateYear, ADJ_RSN_PAJ, count(*) AS [aCount] INTO TempTable1 FROM All_Adjustments GROUP BY SUB_ACCT_NO_PAJ, CustomerType, POST_DTE_PAJ, IA_DateYe...

How to control Jquery Ajax Reponse.

Hi, How to control Jquery Ajax Reponse. E.g. I want to fire multiple ajax request but Second ajax request will start when after getting first ajax reponse and so on.. Is there is any mechanisum to handle this. ...

To remove duplicate word in a string in php

I want to remove duplicate words in a string. For example: $str="oneone"; (without spaces) I want to remove duplicates and display as one. Can anyone suggest me a solution? ...

Removing bidirectional duplicates in MySQL

I'm modifying phpBB's table to have bidirectional relationships for friends. Unfortuntately, people that have already added friends have created duplicate rows: user1 user2 friend 2 3 true 3 2 true 2 4 true So I'd like to remove rows 1 and 2 from the example above. Currently, this is my query bu...

How to find duplicate records in SQL?

I am trying to develop a query to insert unique records but am receiving the SQL Server Primary Key error for trying to insert duplicate records. I was able to insert some values with this query but not for this record (score_14). So now I am trying to find duplicate record with the following query. The challenge is that my PK is ba...

Violation of Primary Key constraint error

I am using SSMS 2008 and trying to insert with this query but am getting the following error: Msg 2627, Level 14, State 1, Line 1 Violation of PRIMARY KEY constraint 'PK_j5c_MasterMeasures'. Cannot insert duplicate key in object 'dbo.j5c_MasterMeasures'. The statement has been terminated. Here is my query: insert into J5C_MasterMeasu...