duplicates

How can I remove duplicate nodes in XQuery?

I have an XML document I generate on the fly, and I need a function to eliminate any duplicate nodes from it. My function looks like: declare function local:start2() { let $data := local:scan_books() return <books>{$data}</books> }; Sample output is: <books> <book> <title>XML in 24 hours</title> <author>Some Guy</a...

MySQL: Retrieve Unique Values and Counts For Each

Is there a simple way to retrieve a list of all unique values in a column, along with how many times that value appeared? Example dataset: A A A B B C ... Would return: A | 3 B | 2 C | 1 Thanks! ...

How can I compare two tables and delete on matching fields (not matching records)

Scenario: A sampling survey needs to be performed on membership of 20,000 individuals. Survey sample size is 3500 of the total 20000 members. All membership individuals are in table tblMember. Same survey was performed the previous year and members whom were surveyed are in tblSurvey08. Membership data can change over the year (e.g. n...

Printing distinct integers in an array

I'm trying to write a small program that prints out distinct numbers in an array. For example if a user enters 1,1,3,5,7,4,3 the program will only print out 1,3,5,7,4. I'm getting an error on the else if line in the function checkDuplicate. Here's my code so far: import javax.swing.JOptionPane; public static void main(String...

Subqueries and Duplicates regarding Combination of fields

I have a database where I have records that come in sets of two. For example, these records will have the same Rec_ID and Veh_ID. I need to get these duplicates and then find the one with the higher Axl_Rating. Then I need to include that value in a query that hits multiple tables. I would like my query to return the rows denoted b...

Using two strongly typed models for one MVC view

Am I missing something fundamental to the principals of MVC or am I going mad? If I have a view that displays a list of books and a list of authors, I have to create class that would have the list of Books and list of authors as properties. Right? I would then strongly type the view to use this class. Now I want to create a new page ...

How to remove duplicates from int[][]

I have an array of arrays - information about selection in Excel using VSTO, where each element means start and end selection position. For example, int[][] selection = { new int[] { 1 }, // column A new int[] { 6 }, // column F new int[] { 6 }, // column F new int[] { 8, 9 } // columns H:I new int[] { 8, 9 } // columns H:I new int[] ...

Need Duplicates Allowed In SortedCollection (C#, 2.0)

Hello, I have a project that I'm working on that requires changing a 'BaseSortedCollection' class to allow duplicates. The class currently implements IEnumerable, IDisposable, ICollection, and ISerializable. The 'BaseSortedCollection' stores Items that have an ItemID (Int64), which is used as the key when accessing the collection. I n...

unix tool to remove duplicate lines from a file

I have a tool that generates tests and predicts the output. The idea is that if I have a failure I can compare the prediction to the actual output and see where they diverged. The problem is the actual output contains some lines twice, which confuses diff. I want to remove the duplicates, so that I can compare them easily. Basically,...

Finding duplicate files and removing them.

hello there to all, well, I am not a Programming guru in python but manage to write some of them :) The one I am writing is finding and removing the duplicate files from the folder. I have multiple copies of mp3 files, and same is the case with other files. So if anyone can help solving this problem then I will be thankful. I am using sh...

Update duplicate varchars to be unique in SQL database

I need to change a database to add a unique constraint on a table column, but the VARCHAR data in it is not unique. How can I update those duplicate records so that each value is unique by adding a sequential number at the end of the existing data? e.g. I would like to change 'name' to 'name1', 'name2', 'name3' ...

Flex: Duplicating instance of an image

I have a drag and drop handler in my Flex application. The drag proxy, or the 'ghost' image to be displayed while dragging, must be loaded before I drag, and that takes some time. How can I make it load immediately or preload? One solution is to duplicate the image, but as far as I know, image objects can't be duplicated without creating...

Removing redundant line breaks with regular expressions

Hello, I'm developing a single serving site in PHP that simply displays messages that are posted by visitors (ideally surrounding the topic of the website). Anyone can post up to three messages an hour. Since the website will only be one page, I'd like to control the vertical length of each message. However, I do want to at least par...

Best way to prevent output of a duplicate item in Perl in realtime during a loop

I see a lot of 'related' questions showing up, but none I looked at answer this specific scenario. During a while/for loop that parses a result set generated from a SQL select statement, what is the best way to prevent the next line from being outputted if the line before it contains the same field data (whether it be the 1st field or t...

Delete Duplicate SQL Records

What is the simplest way to delete records with duplicate name in a table? The answers I came across are very confusing. Related: Removing duplicate records from table ...

Find duplicate records in MySQL

I want to pull out duplicate records in a MySQL Database. This can be done with: SELECT address, count(id) as cnt FROM list GROUP BY address HAVING cnt > 1 Which results in: 100 MAIN ST 2 I would like to pull it so that it shows each row that is a duplicate. Something like: JIM JONES 100 MAIN ST JOHN SMITH 100 MAIN...

Duplicate text-finding

My main problem is trying to find a suitable solution to automatically turning this, for example: d+c+d+f+d+c+d+f+d+c+d+f+d+c+d+f+ into this: [d+c+d+f+]4 i.e. Finding duplicates next to each other, then making a shorter "loop" out of these duplicates. So far I have found no suitable solution to this, and I look forward to a respons...

MySQL on duplicate key update

If I have query like this, how can I refer to values I have already given in update statement, so that I don't need to insert same data to query again? Example I would like to update col1 value with 'xxx', but now I need to enter 'xxx' again in duplicate statement. Is there anyway to refer those values in duplicate statement? INSERT INT...

blinking Images

i have dynamic images from a database...i want to have a couple of images on top of each other..like a banner ad, when one image fades the other one displays... When you click on the image it should redirect to a specific link ...

Multiple AJAX requests on F5

Recently we've found one very strange bug in our application. There is a form for paid message sending. User selects his contact members, groups, enter phone numbers and text message, after that he click on Submit button and we send an AJAX request to validate the form and required account's balance for the operation. If user had selec...