duplicate-removal

XSL - remove the duplicate node but keep the original

独自空忆成欢 提交于 2019-12-06 15:32:04
Need help in removing the duplicate node from the input xml using XSLT This is how my XML looks like, <?xml version="1.0"?> <NodeA NodeAattr="123"> <NodeB NodeBattr="456"></NodeB> <NodeC> <NodeD="ValueD"> <NodeE Name="ValueABC"> <NodeF Value="0"></NodeF > </NodeE > <NodeE Name="ValueABC"> <NodeF Value="0"></NodeF > </NodeE> </NodeD> </NodeC> </NodeA> My final output should look like <NodeA NodeAattr="123"> <NodeB NodeBattr="456"></NodeB> <NodeC> <NodeD="ValueD"> <NodeE Name="ValueABC"> <NodeF Value="0"></NodeF> </NodeE > </NodeD> </NodeC> </NodeA> Here the Name attribute of Node E has

Remove all duplicate characters from NSString

烂漫一生 提交于 2019-12-06 12:00:29
问题 How to do this using standard methods (without manual iteration through source string)? PS: At final I want to get sorted characters of source string. I tried to use NSCharacterSet , but can't find a method to convert character set to string (without iterating the set). 回答1: There is no built-in method for this, but it's pretty easy to iterate over the characters of the string and build a new string without duplicates: NSString *input = @"addbcddaa"; NSMutableSet *seenCharacters =

Delete duplicate rows in calc?

旧街凉风 提交于 2019-12-06 03:34:33
问题 I have a column in openoffice calc with a set of codes. For example: B1 B1 Br Bh Ht C3 C3 So what I would like to do is delete all the duplicates so I am left with just: Br Bh Ht Any help much appreciated. Cheers 回答1: Select the entire range containing data to filter, then click on the menu Data > Filter > Standard Filter and: Use a condition that is always TRUE, like field1 = Not empty Click on the button more, select Remove Duplicate, select Copy to and put the address of an empty cell The

SQL: Removing Duplicate records - Albeit different kind

社会主义新天地 提交于 2019-12-06 01:35:48
问题 Consider the following table: TAB6 A B C ---------- ---------- - 1 2 A 2 1 A 2 3 C 3 4 D I consider, the records {1,2, A} and {2, 1, A} as duplicate. I need to select and produce the below record set: A B C A B C ---------- ---------- - ---------- ---------- - 1 2 A or 2 1 A 2 3 C 2 3 C 3 4 D 3 4 D I tried the below queries. But to no avail. select t1.* from t6 t1 , t6 t2 where t1.a <> t2.b and t1.b <> t2.a and t1.rowid <> t2.rowid / A B C ---------- ---------- - 1 2 A 2 1 A 2 1 A 2 3 C 3 4 D

Improving performance with a Similarity Postgres fuzzy self join query

空扰寡人 提交于 2019-12-05 23:26:48
I am trying to run a query that joins a table against itself and does fuzzy string comparison (using trigram comparisons) to find possible company name matches. My goal is to return records where the trigram similarity of one record's company name (ref_name field) matches another record's company name. Currently, I have my threshold set to 0.9 so it will only bring back matches that are very likely to contain the a similar string. I know that self joins can result in many comparisons by nature, but I want to optimize my query the best I can. I don't need results instantaneously, but currently

HashSet storing equal objects

痴心易碎 提交于 2019-12-05 15:07:38
Below is the code for finding duplicate objects from a list of object. But for some reason the hashset is storing even the equal objects. I am certainly missing out something here but when I check the size of hashset it comes out 5. import java.util.ArrayList; import java.util.HashSet; public class DuplicateTest { public static void main(String args[]){ ArrayList<Dog> dogList = new ArrayList<Dog>(); ArrayList<Dog> duplicatesList = new ArrayList<Dog>(); HashSet<Dog> uniqueSet = new HashSet<Dog>(); Dog a = new Dog(); Dog b = new Dog(); Dog c = new Dog(); Dog d = new Dog(); Dog e = new Dog(); a

Scheme: Remove duplicated numbers from list

半世苍凉 提交于 2019-12-05 09:37:56
I wrote this code to create a list from en number of arguments given (define (create-list . e) e) But I need it to remove any duplicated numbers from the list within this block itself. I have tried and searched for hours and can't find a solution without placing dozens of lines of code on other blocks. For example let's say my input is (create-list . 2 2 3 5 5 ) I need the list created to be '(2 3 5) and not '(2 2 3 5 5 )... The order of the numbers doesn't matter. Basically, you need to do something like: (define (create-list . e) (dedupe e)) I can think of a really simple but probably

Remove duplicates from a Json String in Java?

瘦欲@ 提交于 2019-12-05 06:10:13
I have a Json String with duplicate values: String json = "{\"Sign_In_Type\":\"Action\",\"Sign_In_Type\":\"Action\"}"; that correctly throws an exception when I try to create a JSONObject: try { JSONObject json_obj = new JSONObject(json); String type = json_obj.getString("Sign_In_Type"); } catch (JSONException e) { throw new RuntimeException(e); } Error: Exception in thread "main" java.lang.RuntimeException: org.json.JSONException: Duplicate key "Sign_In_Type" at com.campanja.app.Upload.main(Upload.java:52) Caused by: org.json.JSONException: Duplicate key "Sign_In_Type" at org.json.JSONObject

Best Algorithm for Removing Duplicate Values from a List

a 夏天 提交于 2019-12-05 01:36:38
问题 What is best algorithm for removing duplicate values from a list ? I've tried this: for (int i = 0; i < AuthorCounter-1; i++) { for (int j = 0; j < AuthorCounter-1; j++) { if (i != j) { if (AuthorGroupNode.Nodes[i].Text == AuthorGroupNode.Nodes[j].Text) { AuthorGroupNode.Nodes[j].Remove(); AuthorCounter--; } } } } Here, AuthorGroupNodes is a list on nodes. It did things right to some extent, but not perfect. Any one have better solution ??? 回答1: Your current algorithm is O(N-squared), which

Remove duplicate rows in a table having no primary key

蓝咒 提交于 2019-12-05 00:26:49
问题 I have a table item that contains items like name ------ alpha alpha beta charlie charlie In this case how would I delete duplicate rows but one record should remain. The above table does not have any primary key. 回答1: Try this DELETE FROM item WHERE GREATEST(0,@num := IF(NAME = @NAME, @num + 1, 0),LEAST(0, LENGTH(@NAME := NAME)))>0 回答2: Recreate that table: RENAME TABLE `testTable` TO `testTable2`; CREATE TABLE `testTable` SELECT DISTINCT `name` FROM `testTable2`; OR Add UNIQUE INDEX on your