duplicates

The same class file in multiple .jar files. How bad is this?

I have a library that writes data in either a text or binary format. It has the following three components: common data structures text writer (depends on 1) binary writer (depends on 1) The obvious way to distribute this is as 3 .jar files, so that users can include only what they need. However, the "common data structures" compon...

MySQL ON DUPLICATE KEY UPDATE for multiple rows insert in single query

Hello All. I have a sql query where I want to insert multiple rows in single query. so I used something like: $sql = "INSERT INTO beautiful (name, age) VALUES ('Helen', 24), ('Katrina', 21), ('Samia', 22), ('Hui Ling', 25), ('Yumie', 29)"; mysql_query( $sql, $conn ); The problem is when I execute this query, I want to ch...

What is the most elegant way to find index of duplicate items in C# List

I've got a List<string> that contains duplicates and I need to find the indexes of each. What is the most elegant, efficient way other than looping through all the items. I'm on .NET 4.0 so LINQ is an option. I've done tons of searching and connect find anything. Sample data: var data = new List<string>{"fname", "lname", "home", "ho...

In SQL / MySQL, can a Left Outer Join be used to find out the duplicates when there is no Primary ID index?

I would like to try using Outer Join to find out duplicates in a table: If a table has Primary Index ID, then the following outer join can find out the duplicate names: mysql> select * from gifts; +--------+------------+-----------------+---------------------+ | giftID | name | filename | effectiveTime | +--------+--...

SQL to retrieve the latest records, grouping by unique foreign keys

I'm creating query to retrieve the latest posts in a forum using a SQL DB. I've got a table called "Post". Each post has a foreign key relation to a "Thread" and a "User" as well as a creation date. The trick is I don't want to show two posts by the same user or two posts in the same thread. Is it possible to create a query that contai...

How to remove duplicates from a list in C#

I want to remove duplicates from this list: List<Dictionary<string, object>> val = new List<Dictionary<string, object>>(); It does not work if I apply Distinct() in this way: List<Dictionary<string, object>> result = val.Distinct().ToList<Dictionary<string, object>>() Update: Problem is now solved. I used the MySQL union command t...

R get rid of rows with duplicate attribute

hi there I have a big dataframe with columns such as: ID, time, OS, IP Each row of that dataframe corresponds to one entry. Within that dataframe for some IDs serveral entries (rows) exist. I would like to get rid of those multiple rows (obviously the other attributes will differ for the same ID). Or put different: I only want one single...

Eliminate duplicates in SQL query

i have a table with 6 fields. the columns are ID, new_id price,title,Img,Active. I have datawhich is duplicated for the price column. When I do a select i want to show only distinct rows where new_id is not the same. e.g.- ID New_ID Price Title Img Active 1 1 20.00 PA-1 0X4... 1 2 1 10.00 PA-10 ...

NSArrayController that is sorted and unique (no duplicates) for use in a pop-up in a core-data app

I have core data app with an entity OBSERVATION that has as one of its attributes DEALNAME. I want to reference through Interface Builder or by making custom modifications to an NSArrayController a list of unique sorted dealnames so that I can use them in a pop-up. I have attempted to use @distinctUnionOfSets (and @distinctUnionOfArrays...

Duplicate XML namespaces in .NET generated SOAP messages

Is there a way to automatically remove duplicate XML namespaces from messages generated by the WCF? It seems half of the message consists of duplicate namespaces. Here is an example generated by WCF: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt; <s:Header /> <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-...

changing existing duplicate entries in mysql

sorry for the (probably) noob question, but I', new at this stuff. i have a table that has column 'position', and I want to, when inserting a new row, change positions of every row that has position lower than row that is inserted. for example, if I add row with position 4, if there is a duplicate, it should become 5, 5 should shift to ...

Is it possible to remove a duplicate value from a datatable in c#?

I have a datatable with a column MobileNo.... My datatable has 150 rows and each row has MobileNo... Now how to check every MobileNo is unique by parsing all the datarows of the datatable in c#? EDIT: "This datatable is being created by reading a CSV file" ...

JQuery: Remove duplicate elements?

Say I have a list of links with duplicate values as below: <a href="#">Book</a> <a href="#">Magazine</a> <a href="#">Book</a> <a href="#">Book</a> <a href="#">DVD</a> <a href="#">DVD</a> <a href="#">DVD</a> <a href="#">Book</a> How would I, using JQuery, remove the dups and be left with the following for example: <a href="#">Book</a...

Removing Duplicates in an array in C

The question is a little complex. The problem here is to get rid of duplicates and save the unique elements of array into another array with their original sequence. For example : If the input is entered b a c a d t The result should be : b a c d t in the exact state that the input entered. So, for sorting the array then checking co...

UPDATE query that fixes orphaned records

I have an Access database that has two tables that are related by PK/FK. Unfortunately, the database tables have allowed for duplicate/redundant records and has made the database a bit screwy. I am trying to figure out a SQL statement that will fix the problem. To better explain the problem and goal, I have created example tables to use...

Is there a better way of replacing duplicates in a list (Python)

Given a list: l1: ['a', 'b', 'c', 'a', 'a', 'b'] output: ['a', 'b', 'c', 'a_1', 'a_2', 'b_1' ] I created the following code to get the output. It's messyyy.. for index in range(len(l1)): counter = 1 list_of_duplicates_for_item = [dup_index for dup_index, item in enumerate(l1) if item == l1[index] and l1.count(l1[index]) > 1]...

Remove duplicates from a list

Hello i want to remove duplicates from a list i do this but not working List<Customer> listCustomer = new ArrayList<Customer>(); for (Customer customer: tmpListCustomer) { if (!listCustomer.contains(customer)) { listCustomer.add(customer); } } ...

php remove duplicates from array..

Hi all, I was wondering if anyone could help me out, I'm trying to find a script that will check my entire array and remove any duplicates if required, then spit out the array in the same format. Here's an example of my array (as you will see there are some duplicates): Array ( [0] => Array ( [0] => stdClass Obj...

How to find duplicate values in SQL Server

Hi, I'm using SQL Server 2008. I have a table Customers customer_number int field1 varchar field2 varchar field3 varchar field4 varchar ... and a lot more columns, that don't matter for my queries. Column *customer_number* is pk. I'm trying to find duplicate values and some differences between them. Please, help me to find all...

remove repeated vaules _stack&array

I want to write a program to implement an array-based stack, which accept integer numbers entered by the user.the program will then identify any occurrences of a given value from user and remove the repeated values from the stack,(using Java programming language). I just need your help of writing (removing values method) e.g. input:6 2 ...