compare

Javascript JSON comparison

天大地大妈咪最大 提交于 2019-12-08 11:01:46
问题 I am trying to build a webapp that gets data from server and shows it to user. Script gets data from server every 10 seconds and if data has changed it alerts user. This is the code I'm using now, but it alerts every 10 second whether the data has changed or not. So how do I need to alter my scipt to make it compare the old JSON and the new JSON and see if they are different, and if they are show alert before updating data shown to user? $('#ListPage').bind('pageinit', function(event) {

Batch - Compare file date with actual date

我是研究僧i 提交于 2019-12-08 10:47:31
问题 I get the file date from a file: for %%x in (%file_test%) do set file_date_test=%%~tx And then I get the system date : set year=%date:~-4% set month=%date:~3,2% if "%month:~0,1%" == " " set month=0%month:~1,1% set day=%date:~0,2% if "%day:~0,1%" == " " set day=0%day:~1,1% set hour=%time:~0,2% if "%hour:~0,1%" == " " set hour=0%hour:~1,1% set min=%time:~3,2% if "%min:~0,1%" == " " set min=0%min:~1,1% And then do an if statement with goto : IF %file_date_test% LSS %system_date_test% goto SOME

How to compare two array values in PHP

风格不统一 提交于 2019-12-08 09:25:44
问题 i have two functions, the first one is: public function computeGHComponents() { error_reporting (E_ALL^ E_NOTICE); $totals = NULL; foreach ($this->transaction as $t){ $amount = (float) $t['Amount']; if (isset($totals[ $t['SiteID'] ][ $t['TransactionType'] ])){ $totals[ $t['SiteID'] ][ $t['TransactionType'] ] += (float) $amount; } else { $totals[ $t['SiteID'] ][ $t['TransactionType'] ] = (float) $amount; } } foreach($totals as $key => $value) { $this->result[$key]['Deposit'] = isset($value['D'

Compare similar values from hashtable with loop in Powershell

不打扰是莪最后的温柔 提交于 2019-12-08 09:14:37
问题 I have 2 hash tables : [hashtable]$Localisation = @{ "Macdo" = "OU=France,OU=Paris"; "BurgerKing" = "OU=USA,OU=LA"; "Quick" = "OU=Japan,OU=Tokyo"; } [hashtable]$Profil = @{ "Big Mac" = "Macdo"; "Whooper" = "BurgerKing"; "Burger" = "Quick, BurgerKing, Macdo"; "Fries" = "BurgerKing, Macdo"; "Coke" = "Quick, Macdo"; "HappyMeal" = "Macdo"; } I need to get this kind of result: "Big Mac" = "OU=France,OU=Paris" "Whooper" = "OU=USA,OU=LA"; "Burger" = "OU=Japan,OU=Tokyo, OU=USA,OU=LA, OU=France,OU

c# list compare

蓝咒 提交于 2019-12-08 08:50:55
问题 Hi I need to find a way to compare many (c#) List objects to output what numbers occur in each one. E.g. List1{1, 2, 3, 4, 5} List2{1, 3, 6, 8} List3{1, 2, 3} this would return {1, 3} 回答1: Use the Linq extension method Intersect. var result = List1.Intersect(List2).Intersect(List3); 回答2: LINQ intersect is built for that. 来源: https://stackoverflow.com/questions/5106788/c-sharp-list-compare

SQL find the same column in different tables

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-08 08:48:49
问题 I have 2 very large tables. I try to figure out what they have in common. They do not have the same numbers of columns. I could go about to just look at each column name from each table and compare - but they both have hundreds of columns (I have to do it for many such tables). I use MS Sql server. There are no constrains and no foregin keys on any of them. How do I go about doing that ? Something like this: select * AS "RES" from Table1 where RES IN (select * column from Table2) Thanks in

Whats the best way to check whether one image is somewhere on/similar to another image?

北城以北 提交于 2019-12-08 08:42:27
I want to use openCV to check whether an image is somewhere on another image. This other image could also be a photo. I dont want to know the position or anything, I just want to know whether the image is there or not - or, if the images are "equal enough". Example: I use my iphone to take a photo of a static object. Now, one day later I take this photo again and I want to check if it is the mostly the same object. Whats the best way to do this? I alos tried CVMatchTemplate (but was not able to get a working check) and CVNorm. Maybe SURF (Speeded Up Robust Features) can to this. I used it to

How to compare two NSMutableArrays?

妖精的绣舞 提交于 2019-12-08 08:41:11
问题 I'm new to iOS development and having trouble comparing two NSMutableArray . One of them ( appDelegate.array in code) contains data coming from a database and another one ( dataArray in code) contains data coming from a server response. Now I want compare each element of ( dataArray ) with whole ( appDelegate.array ) and if some element of ( dataArray ) exist in ( appDelegate.array ) then do nothing or break and if doesn't exist then add it into database. I tried, but am unable to do this.

Compare and retrieve elements from ArrayList

空扰寡人 提交于 2019-12-08 08:16:15
问题 I'm trying to build a simple dictionary that compares a string to a word on the ArrayList and then returns a different value from the list. The ArrayList is laid out with the foreign word and then followed by the English equivalent so the idea is that I type in a word, use scanner to compare it to the array list and then return the index value +1 so if the word I type is 7th on the list, I want it to return the 8th word and print it out. I've got the basic idea of inputting a string and

comparing datetime in pig

╄→尐↘猪︶ㄣ 提交于 2019-12-08 07:46:56
问题 in pig 11, is there a support for comparing datetime types? for example: date1:datetime and filter has condition: date1 >= ToDate('1999-01-01') does this comparison returns correct result? 回答1: Date comparison can be considered as a numerical comparison. E.g: cat date1.txt 1999-01-01 2011-03-19 2011-02-24 2011-02-25 2011-05-23 1978-12-13 A = load 'date1.txt' as (in:chararray); B = foreach A generate ToDate(in, 'yyyy-MM-dd') as (dt:datetime); --filter dates that are equal or greater than 2011