compare

Comparing Strings in Java .equals()

感情迁移 提交于 2019-12-25 03:19:22
问题 I'm trying to filter the user's input to make sure its a max of 4 digits and it's not an empty string. Whether I leave it blank or I enter a number, !strInput.equals(null) still comes up true. Am I comparing the string incorrectly? I also tried: !strInput.equals("") , strInput != null , and strInput != "" though I think it should be .equals(...) since I'm trying to compare values. private void updateFast() { String strInput = JOptionPane.showInputDialog(null, "How many?"); if (!strInput

Batch file compare two folders return files that aren't in one folder

好久不见. 提交于 2019-12-25 03:08:40
问题 I'm trying to make a batch file that will compare two folders "core" and "custom" and return the names of the files that aren't in custom. So far I have this code, most of which is taken form another question on stack overflow. It creates "Arrays" of the files in each folder. How can I compare them? @echo off setlocal enableDelayedExpansion ::build "array" of folders set folderCnt=0 for /f "eol=: delims=" %%F in ('dir /B core') do ( set /a folderCnt+=1 set "folder!folderCnt!=%%F" ) ::print

Compare All strings in a array to all strings in another array, PHP

落爺英雄遲暮 提交于 2019-12-25 02:19:04
问题 What i am trying to do is really but i am going into a lot of detail to make sure it is easily understandable. I have a array that has a few strings in it. I then have another that has few other short strings in it usually one or two words. I need it so that if my app finds one of the string words in the second array, in one of the first arrays string it will proceed to the next action. So for example if one of the strings in the first array is "This is PHP Code" and then one of the strings

Comparing with current time SQL

[亡魂溺海] 提交于 2019-12-25 00:23:54
问题 I'm trying to get a page to display a list of all the records that are valid at the current time, so comparing the start and end time & date to the time at that current moment. This is the code I have at the moment: def self.time find_by_sql("SELECT * FROM screens s WHERE (s.starttime < CONVERT(varchar(30), GETDATE(), 114)) AND (s.finishtime > CONVERT(varchar(30), GETDATE(), 114))") end However I get this: ActiveRecord::StatementInvalid I know my code isn't right.. I just don't quite know how

Python - Perceptually detect the same object on two images - and selecting them

烂漫一生 提交于 2019-12-24 23:33:55
问题 I have some challenge and I try find any information, tips, examples which help me do that. First I looking many times google, and this forum with different ask but I don't found any this same task, algorithm. I try many commercial program to compare images, to find diffrent and common parts but all is don't do that good and smart. I have some website with many different boxes, modules, elements etc. Now I do do first printscreen, save this image as web1.png. Next step I change some boxes,

How to compare list of objects with nested lists?

陌路散爱 提交于 2019-12-24 20:03:09
问题 I have List of log events that I shoud check, that they are the same as should be. There is structure of Event object: public class Event { public String type; public List<Item> items; public Event(String type, List<Item> items) { this.type = type; this.items = items; } } public class Item { public String id; public String value; public Item(String id, String value) { this.id = id; this.value = value; } } List<Event> should = asList( new Event("1000", asList(new Item("server_id", "1"), new

Compare two values and make decision in Cypress

戏子无情 提交于 2019-12-24 19:53:09
问题 So I have two values on a page that I need to compare and as per the result perform some actions. //First Block cy.get('selctor1').invoke('text').then(somevalue => { cy.get('selector2').should('have.text', somevalue).then(() => { #Do Something when equal }) }) //Second Block cy.get('selctor1').invoke('text').then(somevalue => { cy.get('selector2').should('not.have.text', somevalue).then(() => { #Do Something when not equal }) }) So for the positive case when both values are equal everything

How to compare jaxb, object, string to find differences

蹲街弑〆低调 提交于 2019-12-24 16:52:47
问题 I would like to know how I can compare two String/Object (JaxB) to find the differences. What I mean with an example : I have this request: <zoo> <zooId>12321</zooId> <zooName>From Belgium</zooName> <zooAddress>berlin</zooAddress></zoo> The next day, I have this request (for an update): <zoo> <zooId>12321</zooId> <zooName>From Germany</zooName> <phone>0123456789</phone> <zooAddress>berlin</zooAddress></zoo> And the differences I would like to have is: <zoo> <zooName>From Germany</zooName>

Why in comparing python tuples of objects is __eq__ and then __cmp__ called?

谁说胖子不能爱 提交于 2019-12-24 16:41:37
问题 When comparing tuples of objects apparently the __eq__ method of the object is called and then the compare method: import timeit setup = """ import random import string import operator random.seed('slartibartfast') d={} class A(object): eq_calls = 0 cmp_calls = 0 def __init__(self): self.s = ''.join(random.choice(string.ascii_uppercase) for _ in range(16)) def __hash__(self): return hash(self.s) def __eq__(self, other): self.__class__.eq_calls += 1 return self.s == other.s def __ne__(self,

Bash while loop to compare two files and print line number

▼魔方 西西 提交于 2019-12-24 14:24:57
问题 I have file1: A B C D I have file2: B C I want to use a while read loop to go through both files compare them and print out the line number of file1 for any matching lines. COUNT=0 while read line do flag = 0 while read line2 do COUNT=$(( $COUNT + 1 )) if ( "$line" = "$line2" ) then flag = 1 fi done < file1 if ( flag -eq 1 ) then echo $COUNT > file3 fi done < file2 However I get an error: B command not found Please could someone let me know where I have gone wrong. Thanks. 回答1: There are