duplicates

Json.NET (Newtonsoft.Json) - Two 'properties' with same name?

我们两清 提交于 2019-11-27 02:16:08
I'm coding in C# for the .NET Framework 3.5. I am trying to parse some Json to a JObject. The Json is as follows: { "TBox": { "Name": "SmallBox", "Length": 1, "Width": 1, "Height": 2 }, "TBox": { "Name": "MedBox", "Length": 5, "Width": 10, "Height": 10 }, "TBox": { "Name": "LargeBox", "Length": 20, "Width": 20, "Height": 10 } } When I try to parse this Json to a JObject, the JObject only knows about LargeBox. The information for SmallBox and MedBox is lost. Obviously this is because it is interpreting "TBox" as a property, and that property is being overwritten. I am receiving this Json from a

Finding duplicate integers in an array and display how many times they occurred

回眸只為那壹抹淺笑 提交于 2019-11-27 01:49:52
问题 I'm working on a code that prints out duplicated integers from an array with the number of their occurrence. I'm not allowed to use LINQ, just a simple code. I think I'm so close but confused about how to get a correct output: class Program { static void Main(string[] args) { int[] array = { 10, 5, 10, 2, 2, 3, 4, 5, 5, 6, 7, 8, 9, 11, 12, 12 }; int count = 1; for (int i = 0; i < array.Length; i++) { for (int j = i; j < array.Length - 1 ; j++) { if(array[j] == array[j+1]) count = count + 1; }

Count duplicates records in Mysql table?

我们两清 提交于 2019-11-27 01:47:54
问题 I have table with, folowing structure. tbl id name 1 AAA 2 BBB 3 BBB 4 BBB 5 AAA 6 CCC select count(name) c from tbl group by name having c >1 The query returning this result: AAA(2) duplicate BBB(3) duplicate CCC(1) not duplicate The names who are duplicates as AAA and BBB. The final result, who I want is count of this duplicate records. Result should be like this: Total duplicate products ( 2 ) 回答1: The approach is to have a nested query that has one line per duplicate, and an outer query

Get the keys for duplicate values in an array

筅森魡賤 提交于 2019-11-27 01:38:23
I have the following array: $myarray = Array("2011-06-21", "2011-06-22", "2011-06-22", "2011-06-23", "2011-06-23", "2011-06-24", "2011-06-24", "2011-06-25", "2011-06-25", "2011-06-26"); var_dump($myarray); Result: Array ( [0] => 2011-06-21 [1] => 2011-06-22 [2] => 2011-06-22 [3] => 2011-06-23 [4] => 2011-06-23 [5] => 2011-06-24 [6] => 2011-06-24 [7] => 2011-06-25 [8] => 2011-06-25 [9] => 2011-06-26 ) Now how can I display the keys with duplicate values? Here the function should NOT return ([0],[9]) since there are no duplicates with the values. How to find the keys for the same value, eg. for

Word-oriented completion suggester (ElasticSearch 5.x)

与世无争的帅哥 提交于 2019-11-27 01:07:10
问题 ElasticSearch 5.x introduced some (breaking) changes to the Suggester API (Documentation). Most notable change is the following: Completion suggester is document-oriented Suggestions are aware of the document they belong to. Now, associated documents ( _source ) are returned as part of completion suggestions. In short, all completion queries return all matching documents instead of just matched words . And herein lies the problem - duplication of autocompleted words if they occur in more than

Fuzzy matching deduplication in less than exponential time?

痴心易碎 提交于 2019-11-27 00:31:10
问题 I have a large database (potentially in the millions of records) with relatively short strings of text (on the order of street address, names, etc). I am looking for a strategy to remove inexact duplicates, and fuzzy matching seems to be the method of choice. My issue: many articles and SO questions deal with matching a single string against all records in a database. I am looking to deduplicate the entire database at once. The former would be a linear time problem (comparing a value against

Find all duplicate documents in a MongoDB collection by a key field

大兔子大兔子 提交于 2019-11-26 23:52:21
Suppose I have a collection with some set of documents. something like this. { "_id" : ObjectId("4f127fa55e7242718200002d"), "id":1, "name" : "foo"} { "_id" : ObjectId("4f127fa55e7242718200002d"), "id":2, "name" : "bar"} { "_id" : ObjectId("4f127fa55e7242718200002d"), "id":3, "name" : "baz"} { "_id" : ObjectId("4f127fa55e7242718200002d"), "id":4, "name" : "foo"} { "_id" : ObjectId("4f127fa55e7242718200002d"), "id":5, "name" : "bar"} { "_id" : ObjectId("4f127fa55e7242718200002d"), "id":6, "name" : "bar"} I want to find all the duplicated entries in this collection by the "name" field. E.g. "foo

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

六月ゝ 毕业季﹏ 提交于 2019-11-26 23:51:14
问题 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 回答1: As an ex one-liner: :syn clear Repeat | g/^\(.*\)\n\ze\%(.*\n\)*\1$/exe 'syn match Repeat "^' . escape(getline('.'), '".\^$*[]') . '$"' | nohlsearch This uses the Repeat group to highlight the repeated lines.

How to find duplicates in 2 columns not 1

 ̄綄美尐妖づ 提交于 2019-11-26 23:49:53
问题 I have a MySQL database table with two columns that interest me. Individually they can each have duplicates, but they should never have a duplicate of BOTH of them having the same value. stone_id can have duplicates as long as for each upsharge title is different, and in reverse. But say for example stone_id = 412 and upcharge_title = "sapphire" that combination should only occur once. This is ok: stone_id = 412 upcharge_title = "sapphire" stone_id = 412 upcharge_title = "ruby" This is NOT ok

IntegrityError duplicate key value violates unique constraint - django/postgres

人盡茶涼 提交于 2019-11-26 23:47:28
I'm following up in regards to a question that I asked earlier in which I sought to seek a conversion from a goofy/poorly written mysql query to postgresql. I believe I succeeded with that. Anyways, I'm using data that was manually moved from a mysql database to a postgres database. I'm using a query that looks like so: """ UPDATE krypdos_coderound cru set is_correct = case when t.kv_values1 = t.kv_values2 then True else False end from (select cr.id, array_agg( case when kv1.code_round_id = cr.id then kv1.option_id else null end ) as kv_values1, array_agg( case when kv2.code_round_id = cr_m.id