Search Results

Search found 3371 results on 135 pages for 'compare'.

Page 11/135 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • How to compare two "not integer" values in shell script

    - by Reem
    I had to do a division in shell script and the best way was: result1=`echo "scale=3; ($var1 / $total) * 100"| bc -l` result2=`echo "scale=3; ($var2 / $total) * 100"| bc -l` but I want to compare the values of $result1 and $result2 Using if test $result1 -lt $result2 or if [ $result1 -gt $result2 ] didn't work :( Any idea how to do that?

    Read the article

  • Trying to implement a method that can compare any two lists but it always returns false

    - by Tyler Pfaff
    Hello like the title says I'm trying to make a method that can compare any two lists for equality. I'm trying to compare them in a way that validates that every element of one list has the same value as every element of another list. My Equals method below always returns false, can anyone see why that is? Thank you! using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; public class IEnumerableComparer<T> : IEqualityComparer<IEnumerable<T>> { public bool Equals(IEnumerable<T> x, IEnumerable<T> y) { for(int i = 0; i<x.Count();i++){ if(!Object.Equals(x.ElementAt(i), y.ElementAt(i))){ return false; } } return true; } public int GetHashCode(IEnumerable<T> obj) { if (obj == null) return 0; return unchecked(obj.Select(e => e.GetHashCode()).Aggregate(0, (a, b) => a + b)); } } Here is my data I'm using to test this Equals method. static void Main(string[] args) { Car car1 = new Car(); car1.make = "Toyota"; car1.model = "xB"; Car car2 = new Car(); car2.make = "Toyota"; car2.model = "xB"; List<Car> l1 = new List<Car>(); List<Car> l2 = new List<Car>(); l1.Add(car1); l2.Add(car2); IEnumerableComparer<Car> seq = new IEnumerableComparer<Car>(); bool b = seq.Equals(l1, l2); Console.Write(b); //always says false Console.Read(); } } Car class class Car { public String make { get; set; } public String model { get; set; } }

    Read the article

  • How to compare filename of uploaded file and string

    - by user225269
    I use this code to upload image files in xammp server: <?php if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 100000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); echo "Stored in: " . "upload/" . $_FILES["file"]["name"]; } } } else { echo "Invalid file, File must be less than 100Kb in size with .jpg, .jpeg, or .gif file extension"; } ?> What do I do to compare the file name of the uploaded files with the text inputted by the user? My goal is to be able to compare the user input(ID number) and the file name of the image file which should also be an ID number. So that I will be able to display the image that corresponds with the ID Number provided. What do I need to do?Please give me an idea on how can I achieve this. Thanks

    Read the article

  • Compare versions as strings

    - by Dmitriy
    Comparing version numbers as strings is not so easy... "1.0.0.9" "1.0.0.10", but it's not correct. Obvious way to do it properly is parse these strings, convert to numbers and compare as numbers. Is it other way to do it more "elegant"? For example, boost::string_algo...

    Read the article

  • How do I compare two complex data structures?

    - by Phil H
    I have some nested datastructures, each something like: [ ('foo', [ {'a':1, 'b':2}, {'a':3.3, 'b':7} ]), ('bar', [ {'a':4, 'd':'efg', 'e':False} ]) ] I need to compare these structures, to see if there are any differences. Short of writing a function to explicitly walk the structure, is there an existing library or method of doing this kind of recursive comparison?

    Read the article

  • compare time using date command

    - by Andrei
    Say I want a certain block of bash script execute only if it is between 8 am (8:00) and 5 pm (17:00), and do nothing otherwise. The script is running continuously So far I am using date command. How to use it compare it current time within the range? Thanks

    Read the article

  • Objective C: Compare timeInMillis with current time

    - by Srivathsan Canchi
    Hello, In my iPhone application, I need to calculate the time difference between the time a message was created on the server, and the time my phone received it. The server (Java) puts in a number returned by System.currentTimeMillis() as metadata along with the message. How do I compare this number with the current time on the device? Could not find a suitable NSDate method to do this comparison. Thanks in advance!

    Read the article

  • Bulk Compare, Report, Update

    - by Tim Donaldon
    I need to import either csv or excel file into a dbase. The column headers will match but I will want to compare the file against the dbase using an ItemID field, list the rows to be affected and the differences, then allow an update to all the rows with the matching ID.

    Read the article

  • compare a directory of files with an svn revision

    - by JoelFan
    If I have a directory of files (with subdirectories) that is not under source control (no .svn directories), is there any way to compare it with a revision in svn (i.e. "svn diff")? Similar question: if I have a directory of files that is under source control, can I do a diff with to a different URL than the one it was checked out from?

    Read the article

  • WCF Compare objects on client

    - by Petoj
    Well i have a WCF service and has to methods one that gives a list of a object and one that gives a list of objects.. the object returned from method one is part of the list from method two. Im using wpf and binding a combo box to the two the results.. but the problem is that the combo box dosent know how to compare the objects as WCF did not generate this for me.. is there some way to fix this??

    Read the article

  • Compare class objects

    - by reto
    I have to compare a class object against a list of pre defined classes. Is it safe to use == or should I use equals()? if (klass == KlassA.class) { } else if (klass == KlassB.class) { } else if (klass == KlassC.class) { } else { } Note: I cannot use instanceof, I don't have an object, I just have the class object. I (mis)use it like an enum in this situation! Thanks!

    Read the article

  • MySQL function to compare values in a db table against the previous

    - by Stuart
    Iam quite new to functions in SQL and I would like to create a function to compare values in a MySQL table against previous and I am not sure how to do this. For example (iId is the input value) DECLARE pVal INT(20); DECLARE val INT(20); SELECT price INTO pVal FROM products WHERE Id=iId; SELECT price FROM products; IF price == pVal THEN SET val = price; END IF; Thanks

    Read the article

  • Compare filedate before download it

    - by Christian
    Hi, I have an app which is downloading several plist-files when starting the app and storing them in the NSHomeDirectory/Documents/ path. This will take some time and often there is only one file that changed. My questions are: -how can I get the date of the files (the stored one and the file on my webserver)? -how can I compare the date of the stored file with the date of the file on my webserver?

    Read the article

  • A problem with compare item value

    - by Tony
    Hi, I have defined my class: public class Host { public string Name; } then a strongly-typed dictionary: Dictionary<string, Host> HostsTable; then I try to compare a value: if (HostsTable.Values.Where(s => s.Name == "myhostname") != null) { doSomething } and the problem is, nothing is found, even I'm sure the item is on the list. What I'm doing wrong ?

    Read the article

  • Perl - Compare two files and copy intire line to final.log

    - by user2977141
    I need perl script to compare line from file1 with file2 and copy to final file, something like this: File1.txt: ASPO01 ASPO02 ASPO03 File2.txt: ASPO01 2013-11-10 19hrs ASPO10 2013-11-09 24hrs ASPO02 2013-11-08 10hrs ASPO16 2013-11-05 9hrs ASPO17 2013-11-06 6hrs ASPO03 2013-11-07 15hrs ASPO18 2013-11-02 25hrs ... Search into File2 and copy to final file called final.log, like this: final.txt: ASPO01 2013-11-10 19hrs ASPO02 2013-11-08 10hrs ASPO03 2013-11-07 15hrs Thanks for all good friends can help me!!!

    Read the article

  • Compare string with all values in array

    - by Hallik
    I am trying to fumble through python, and learn the best way to do things. I have a string where I am doing a compare with another string to see if there is a match: if paid[j].find(d)>=0: #BLAH BLAH If 'd' were an array, what is the most efficient way to see if the string contained in paid[j] has a match to any value in 'd'?

    Read the article

  • How to: compare array with string and create hastags before tweeting

    - by krike
    Let's say I have the following array (which is the returned value of a database query): Array ( [0] => PHP [1] => Webdesign [2] => Wordpress [3] => Drupal [4]) And the following string: Working With Wordpress Shortcodes How can I compare the array with the string to see if the string contains any word stored in the array? (hopefully that made sense to you :d ) When he finds a match (eg: Wordpress) it should create a hashtag like so: Working With #Wordpress Shortcodes

    Read the article

  • Precisely Compare 2 images for differences using OpenCV

    - by YS
    Hi, I am working on a project to capture images via webcam in a predefined time interval, and continuously compare the images to a template (good image) and give an error if the difference is tolerance set. I working out using OpenCV. Would like to have advice how should I do it, e.g. best method, etc. Appreciate if any one can help me on this. Thanks.

    Read the article

  • how to compare the values inside a table in sql

    - by Ranjana
    how to compare the values of same table(say for eg: Order table) each and every time the record get inserted , if the record with same values get inserted already in same table i should not insert the new record with same values. how to do that exactly in sql server 2008

    Read the article

  • Compare Two DLL's

    - by Goober
    Scenario I have a C# application compiled as a DLL. I have a build from last week and a build from this week. There has been a significant change in performance so I want to compare the the two builds to see what has changed. ANY IDEAS?........SUGGESTIONS? Cheers

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >