duplicates

How to remove duplicate words from a plain text file using linux command

I have a plain text file with words, which are separated by comma, for example: word1, word2, word3, word2, word4, word5, word 3, word6, word7, word3 i want to delete the duplicates and to become: word1, word2, word3, word4, word5, word6, word7 Any Ideas? I think, egrep can help me, but i'm not sure, how to use it exactly.... ...

How to add to a MySQL table only if the record doesn't already exist?

I'm getting an array of strings from a JSON object. I want to save these strings in a DB, but only if they're not already in there. What's the best way to compare what's already in the DB with what I'm about to enter, and exclude matches? I'm using PHP and MySQL. Thanks! ...

Deleting duplicate lines in a file using Java

As part of a project I'm working on, I'd like to clean up a file I generate of duplicate line entries. These duplicates often won't occur near each other, however. I came up with a method of doing so in Java (which basically made a copy of the file, then used a nested while-statement to compare each line in one file with the rest of the ...

What is a class interface?

I'm currently working my way through Code Complete and the word "interface" keeps popping up! I'm trying to get my head round what an interface is. Can you define the term? Also what actually makes up a "class interface"? ...

Deleting duplicate rows from a table

I have a table in my database which has duplicate records that I want to delete. I don't want to create a new table with distinct entries for this. What I want is to delete duplicate entries from the existing table without the creation of any new table. Is there any way to do this? id action L1_name L1_data L2_name...

(Java) Good Libraries and What they are.

Lets compile a list of 3rd party java libraries that we like and/or find useful. I will post my choices as a reply ...

Can Primary-Keys be re-used once deleted?

0x80040237 Cannot insert duplicate key. I'm trying to write an import routine for MSCRM4.0 through the CrmService. This has been successful up until this point. Initially I was just letting CRM generate the primary keys of the records. But my client wanted the ability to set the key of a our custom entity to predefined values. Potential...

Table Merge Without Dupes

I have an Access 2007 database that works asynchronously with a MAS200 database. Due to various office politics and red tape, I cannot get access to the MAS200 data, even though ODBC makes it easy, and must import data dumps from MAS200 to Access. Because of this and the way reports are run, I occasionally have duplicate data on a dump...

counting duplicates in a sorted sequence using command line tools

I have a command (cmd1) that greps through a log file to filter out a set of numbers. the numbers are in random order, so i use sort -gr to get a reverse sorted list of numbers. there may be duplicates within this sorted list. I need to find the count for each unique number in that list. For e.g. if the output of cmd1 is 100 100 ...

Can NHibernate Criteria Pull From Cache

I'm loading a lot of data into the database with NHibernate. As I'm inserting, I want to check for duplicates. I call saveorupdate in each loop without flushing the session. Is there a way to query this session for duplicates without flushing? ...

Recommendations for simple SCM

DUPE: http://stackoverflow.com/questions/1091086/simple-single-user-revision-control What are the best options for a single developer SCM set-up ? Previously I've used Perforce and Visual Source Safe, but now I'm a single developer, but still want at least basic SCM ...

C#: A good and efficient implementation of IEnumerable<T>.HasDuplicates

Does anyone have a good and efficient extension method for finding if a sequence of items has any duplicates? Guess I could put return subjects.Distinct().Count() == subjects.Count() into an extension method, but kind of feels that there should be a better way. That method would have to count elements twice and sort out all the distict...

TimeSpan to friendly string library (C#)

Duplicate: This is one of the earliest question on StackOverflow posted by Jeff. http://stackoverflow.com/questions/11/how-do-i-calculate-relative-time Does anyone know of a good library (or code snippet) for converting a TimeSpan object to a "friendly" string such as: Two years, three months and four days One week and two days (...

Eliminating duplicate same-level elements in XSLT

I'm looking to display a list of same-level node names, without duplicates. Let's say I have <a> <b> <c /> <d /> <d /> </b> <b> <e /> <c /> <f /> </b> </a> I'd want c,d,e,f to be displayed. I've found several solutions to a similar problem, eliminating duplicate siblings...

MySQL duplicate entry error when no duplicate exists

EDIT: I seem to get the error listed below on every insert no matter what data I try to insert. So maybe my table was corrupted or something? Anyway, here's my question: I have a MySQL table CREATE TABLE `AcpConfig` ( `ndss_id` int(11) NOT NULL default '0', `acp_id` int(11) NOT NULL default '0', `run_date` date NOT NULL default...

SQL Query - Delete duplicates if more than 3 dups?

Does anyone have an elegant sql statement to delete duplicate records from a table, but only if there are more than x number of duplicates? So it allows up to 2 or 3 duplicates, but that's it? Currently I have a select statement that does the following: delete table from table t left outer join ( select max(id) as rowid, dupcol1, dup...

Online Java Book

Hello, So I have seen topics regarding Java books, and it really looks like "Effective Java" is a very good book regarding Java. Well, unfortunately, I don't have $50 to blow on a new hobby. My question is, can anybody recommend a quality complete online Java book (preferably one available in PDF)? The closest thing I could think to r...

PHP - Array search for multiple values

I need to get the keys from values that are duplicates. I tried to use array_search and that worked fine, BUT I only got the first value as a hit. I need to get both keys from the duplicate values, in this case 0 and 2. The search result output as an array would be good. Is there a PHP function to do this or do I need to write some mul...

counting duplicate entries in Data base

I want to count the amount of times that a zip code is entered into a database. I'm not sure if I am using the right function or not. Also eventually I need to separate the zip codes by the year they were entered int the data base. I know how to separate the years-I think. What I really need help on is counting duplicate entries Here is ...

how to create .doc file using java?

Can anyone tell me how to create doc files using java? I know, there's a POI library, but it seems like it can save only simple documents. You can read anything you wish, but you can't save it all back again. Or may be i missed something? How can i save whole document with pictures, tables and styles? ...