2
голосов
3ответов
4353 просмотров

dealing with duplicates in a bst

My bst has to be able to cope with duplicate entries. Does anyone have any strategies for how to go about this that doesn't require excessive amounts of code? I thought of consistently adding duplicates to the right but then that will mess up the bst order. for example what happens when the dupli...

6
голосов
4ответов
42004 просмотров

No duplicates in SQL query

I'm doing a select in MySQL with an inner join: SELECT DISTINCT tblcaritem.caritemid, tblcar.icarid FROM tblcaritem INNER JOIN tblprivatecar ON tblcaritem.partid = tblprivatecar.partid INNER JOIN tblcar ON tblcaritem.carid = tblcar.carid WHERE tblcaritem.userid=72; Sometimes I get duplicat...

187
голосов
14ответов
235355 просмотров

How do I check if there are duplicates in a flat list?

For example, given the list ['one', 'two', 'one'], the algorithm should return True, whereas given ['one', 'two', 'three'] it should return False.

1
голосов
4ответов
1792 просмотров

MySql "INSERT … ON DUPLICATE KEY UPDATE" still inserting duplicate records. What am I missing?

I have a simple table set up with two columns, each column is a key value. the values stored in each field are varchar(45) representing an email address and a keyword. It is possible that the information collected may duplicate itself as it is related to site browsing data collection. To avoid du...

92
голосов
34ответов
197888 просмотров

Algorithm: efficient way to remove duplicate integers from an array

I got this problem from an interview with Microsoft. Given an array of random integers, write an algorithm in C that removes duplicated numbers and return the unique numbers in the original array. E.g Input: {4, 8, 4, 1, 1, 2, 9} Output: {4, 8, 1, 2, 9, ?, ?} One caveat is that the ...

1
голосов
1ответов
1756 просмотров

ON DUPLICATE KEY UPDATE implementation/design

I have a table, sessionBasket, that holds a list of the items in the shopping baskets of visitors to my site. It looks like: id INT NOT NULL AUTO_INCREMENT PRIMARY KEY usersessid VARCHAR date_added DATETIME product_id INT qty INT My add to basket script first checks for the presence of an item...

0
голосов
1ответов
1260 просмотров

Duplicate Insertions in Database using sqlite, sqlalchemy, python

I am learning Python and, through the help of online resources and people on this site, am getting the hang of it. In this first script of mine, in which I'm parsing Twitter RSS feed entries and inserting the results into a database, there is one remaining problem that I cannot fix. Namely, dupli...

2
голосов
3ответов
11179 просмотров

sql query distinct on multiple columns

i have this data and i am trying to find cases where there are different ids but duplicate data in Field 1,2,3,4 id field1 field2 field3 field4 ==== ====== ====== ===== ======= 1 A B C D 2 A B C D 3 A A C B 4 ...

0
голосов
5ответов
302 просмотров

Make MySQL table unique

Hay, I created a spider to crawl through a PDF document and log every word in the document into a table in a MySQL database. Obviously words like 'the', 'and', 'or' etc appear in a book many, many times. I'm just wondering what's the quickest method to remove dupe values from a table?

27
голосов
5ответов
150467 просмотров

Java Scanner class reading strings

I got the following code: int nnames; String names[]; System.out.print("How many names are you going to save: "); Scanner in = new Scanner(System.in); nnames = in.nextInt(); names = new String[nnames]; for (int i = 0; i < names.length; i++){ System.out.print("Type a name: "); names[i] =...

4
голосов
4ответов
11370 просмотров

Java Scanner class reading strings

I got the following code: int nnames; String names[]; System.out.print("How many names are you going to save: "); Scanner in = new Scanner(System.in); nnames = in.nextInt(); names = new String[nnames]; for (int i = 0; i < names.length; i++){ System.ou...

0
голосов
2ответов
663 просмотров

Mechanize setting a field with a duplicate name

I'm using mechanize and have a problem on one form... the form has two select boxes with the same name. How can I select the second one? ie. NumNights second occurrence. i found in the docs something like this: form.set_fields( :foo => ['bar', 1] ) but this didn't work: form.field_with...

4
голосов
2ответов
7962 просмотров

Excel: Removing duplicates in one column while retaining highest value in the adjacent column

I have an excel spreadsheet with two columns. The first column is a label the second column is a numeric value. I would like to remove all the duplicate labels in column "A" and remain with the maximun numeric value in column "B". I've tried to illustrate below (the filter would result in "Consol...

0
голосов
3ответов
5114 просмотров

SQL query to get duplicate record counts based on other factors

I have a table (participants) which has multiple columns that could all be distinct. Two columns that are of special interest in this query are the userID and the programID I have a two part inquery here. I want to be able to acquire the list of all userIDs that appear more than once in this t...

0
голосов
4ответов
188 просмотров

Algorithm for Auto-Appending a Unique ID to Duplicate Titles

I have a user that enters a piece of data into my database and titles it "Widget Title". If he calls another item "Widget Title", and another, and another, when he sees them in his widget list I'd like to show them like such: Some Item Widget Title Some Other Item Widget Title 2 Widget Title 3 ...

3
голосов
3ответов
10228 просмотров

SQL Import skip duplicates

I am trying to do a bulk upload into a SQL server DB. The source file has duplicates which I want to remove, so I was hoping that the operation would automatically upload the first one, then discard the rest. (I've set a unique key constraint). Problem is, the moment a duplicate upload is attempt...

4
голосов
5ответов
18250 просмотров

MySQL delete all results of sub-query

Okay, so if you would like a back story, look at my previous question Figuring out which of my records is not a duplicate is quite easy: SELECT * FROM eventlog GROUP BY event_date, user HAVING COUNT(*) = 1 ORDER BY event_date, user This returns all of my non-duplicates. So I thought I'd move ...

1
голосов
3ответов
3741 просмотров

Showing all duplicates, side by side, in MySQL

I have a table like so: Table eventlog user | user_group | event_date | event_dur. ---- ---------- --------- ---------- xyz 1 2009-1-1 3.5 xyz 2 2009-1-1 4.5 abc 2 2009-1-2 5 abc 1 2009-1-...

5
голосов
6ответов
4653 просмотров

strategies for finding duplicate mailing addresses

I'm trying to come up with a method of finding duplicate addresses, based on a similarity score. Consider these duplicate addresses: addr_1 = '# 3 FAIRMONT LINK SOUTH' addr_2 = '3 FAIRMONT LINK S' addr_3 = '5703 - 48TH AVE' adrr_4 = '5703- 48 AVENUE' I'm planning on applying some string trans...

0
голосов
1ответов
96 просмотров

Duplicate JavaScript without a debugger statement?

I have and ASP.NET 3.5 page where I need to debug some JavaScript code. function checkAll(isChecked) { debugger; var dataGridElements = document.getElementById('" + DataGridSearchResults.ClientID + @"').getElementsByTagName('input'); for (var i = 0; i < dataGridEle...

2
голосов
7ответов
1097 просмотров

SQL Find Possible Duplicates

I need SQL code that will identify possible duplicates in a table. Lets say my table has 4 columns: ID (primary key) Date1 Date2 GroupID (Date1, Date2, GroupID) form a unique key. This table gets populated with blocks of data at a time, and it often happens that a new block is loaded in that...

2
голосов
4ответов
1135 просмотров

SQL Removing duplicates one row at a time

I have a table where I save all row-changes that have ever occurred. The problem is that in the beginning of the application there was a bug that made a bunch of copies of every row. The table looks something like this: copies |ID |CID |DATA | 1 | 1 | DA | 2 | 2 | DO | 2 | 3 | DO (copy of...

0
голосов
2ответов
3015 просмотров

How do I avoid copying duplicate images to the iPhone Photo Library?

I am writing a simple application to copy a set of images to the user's photo library so that the user may use them as backgrounds. The problem is that if the user runs the application more than once, duplicate images will be copied to the photo library. Given the restrictions Apple places on acc...

2
голосов
1ответов
958 просмотров

Split table with duplicates into 2 normalized tables?

I have a table with some duplicate rows that I want to normalize into 2 tables. user | url | keyword -----|-----|-------- fred | foo | kw1 fred | bar | kw1 sam | blah| kw2 I'd like to start by normalizing this into two tables (user, and url_keyword). Is there a query I can run to normalize t...

1
голосов
2ответов
3851 просмотров

Hibernate join tables duplicate entry - Could not execute JDBC batch update

I have a simple domain class Licensee: @Entity @Table(name = "LICENSEE") @Cache(usage = CacheConcurrencyStrategy.READ_WRITE) public class Licensee implements Serializable, Comparable { private Integer id; private String orgName; /* ... */ private Set<Address> address = ne...

16
голосов
8ответов
64074 просмотров

How to keep only one row of a table, removing duplicate rows?

I have a table that has a lot of duplicates in the Name column. I'd like to only keep one row for each. The following lists the duplicates, but I don't know how to delete the duplicates and just keep one: SELECT name FROM members GROUP BY name HAVING COUNT(*) > 1; Thank you.

0
голосов
1ответов
85 просмотров

h2 with sifr enabled duplicates

I'm having problems with h2 headlines. sifr does replace the text, but as soon as it replaces the text inside h2 tags, after that it repeats the text in h2 but without sifr. Can anyone point me to the right direction what could cause this problem? Tnx in advance..

31
голосов
8ответов
28077 просмотров

What exception type should be thrown when trying to add duplicate items to a collection?

Following code should throw exception to prevent adding duplicate collection item. ICollection<T> collection = new List<T>(); public void Add(T item) { if (collection.Contain(item)) { throw new SomeExceptionType() } collection.Add(item); } What standard ...

2
голосов
3ответов
1570 просмотров

Delete rows from an Excel spreadsheet that contain duplicate data?

I have an excel spreadsheet that has about 18k rows and three columns. I want to use this as a key in an Access database. So the three columns are [IDKeyNumber] [Name] [Category] The problem is in certain places the IDnumber is duplicated because the category has two category codes (type...

67
голосов
6ответов
29311 просмотров

How can I mark/highlight duplicate lines in VI editor?

How would you go about marking all of the lines in a buffer that are exact duplicates of other lines? By marking them, I mean highlighting them or adding a character or something. I want to retain the order of the lines in the buffer. Before: foo bar foo baz After: foo* bar foo* baz