compare

compare List<string> and List<T>

别说谁变了你拦得住时间么 提交于 2020-01-24 00:45:11
问题 I'm using C# and framework 4.0. I have a list of type string and another list of type class T; How can I compare List with a List and save the difference? private void simpleButton_Compare_Click(object sender, EventArgs e) { try { bool Is_Egal = true; int i = 0; foreach (string Od_Scan in Ordre_Scan) { if (!Outils.Get_Ordre_Donne()[i].NoOrdre.Contains(Od_Scan) && !String.IsNullOrWhiteSpace(Od_Scan)) { Is_Egal = false; Temp_Od_Scan.Add(Od_Scan); } i++; } foreach (Pers_Compare Od_Done in Outils

BinarySearch array of objects by ID

偶尔善良 提交于 2020-01-23 07:07:04
问题 Good day! I have a List of ValueObj: class ValueObj { int ID; float value; } How to get binary search objects by id? (List tempValues) I make ValueComparer class,but dont know am i right? class ValueComparer<ValueObj> { public int Compare(ValueObjx, ValueObjy) { if (x == y) return 0; if (x == null) return -1; if (y == null) return 1; return -1; ///??? } } I need to sort List by ID. Like that?: tempValues.Sort(new ValueComparer()); And how to use BinarySearch? 回答1: The List class in C# has a

BinarySearch array of objects by ID

拜拜、爱过 提交于 2020-01-23 07:05:06
问题 Good day! I have a List of ValueObj: class ValueObj { int ID; float value; } How to get binary search objects by id? (List tempValues) I make ValueComparer class,but dont know am i right? class ValueComparer<ValueObj> { public int Compare(ValueObjx, ValueObjy) { if (x == y) return 0; if (x == null) return -1; if (y == null) return 1; return -1; ///??? } } I need to sort List by ID. Like that?: tempValues.Sort(new ValueComparer()); And how to use BinarySearch? 回答1: The List class in C# has a

LeetCode 165. Compare Version Numbers

☆樱花仙子☆ 提交于 2020-01-22 19:25:11
题目 题意:比较两个版本的大小 题解: class Solution { public: int ver1[1005]; int pos1; int pos2; int ver2[1005]; int compareVersion(string version1, string version2) { int i,j; string s=""; for(i=0;i<version1.length();i++) { if(version1[i]=='.') { ver1[pos1]=fun(s); pos1++; s=""; } else { s+=version1[i]; } } ver1[pos1++]=fun(s); s=""; for( i=0;i<version2.length();i++) { if(version2[i]=='.') { ver2[pos2]=fun(s); pos2++; s=""; } else { s+=version2[i]; } } ver2[pos2++]=fun(s); int ans=0; for( i=0,j=0;i<pos1&&j<pos2;i++,j++) { if(ver1[i]>ver2[j]) { return 1; } else if(ver1[i]<ver2[j]) { return -1; } } if(i==pos1&

Delphi 7 tguid compare

拈花ヽ惹草 提交于 2020-01-22 18:49:04
问题 Is any other way to compare 2 TGUID elements, except transform them into strings (the guidtostring function) and after evaluate the expression, in Delphi 7? 回答1: You can use IsEqualGUID API declared in SysUtils. 回答2: IsEqualGUID() (or IsEqualIID()), like TOndrej suggested. You can also use SysUtuils. CompareMem() instead, since TGuid is a binary array of bytes. 来源: https://stackoverflow.com/questions/4012581/delphi-7-tguid-compare

How can I compare two dates in PHP?

柔情痞子 提交于 2020-01-22 02:08:30
问题 How can I compare two dates in PHP? In the database, the date looks like 2011-10-2. If I wanted to compare today's date against the date in the database to see which one is greater, how would I do it? I tried this, $today = date("Y-m-d"); $expire = $row->expireDate //from db if($today < $expireDate) { //do something; } but it doesn't really work that way. What's another way of doing it? Update: I know this post is kinda old but i just wanted to mention carbon, which is a class thats used with

Beyond Compare在Mac下永久试用

两盒软妹~` 提交于 2020-01-22 01:55:38
(新知识:可执行文件也可以是bash文件,里面写命令行sh代码) 在官网(https://www.scootersoftware.com/download.php)下载Beyond Compare并安装成功后,执行如下操作: 1.进入Beyond Compare应用程序MacOS目录下(/Applications/Beyond Compare.app/Contents/MacOS) 2.将主启动程序BCompare重命名为BCompare.real 3.在同级目录下新建一个脚本文件命名为BCompare 4.给新建的文件BCompare,授权文件可写权限 chmod a+w /Applications/Beyond\ Compare.app/Contents/MacOS/BCompare 5 用vi等工具编辑第四步建立的文件 vi /Applications/Beyond\ Compare.app/Contents/MacOS/BCompare。 6 把以下内容粘贴到 /Applications/Beyond\ Compare.app/Contents/MacOS/BCompare 中 #!/bin/bash rm "/Users/$(whoami)/Library/Application Support/Beyond Compare/registry.dat" "`dirname

java的lambda表达式

霸气de小男生 提交于 2020-01-20 20:35:02
lambda表达式的格式 以->分隔,前边是参数列表,后边是表达式体也就是具体要执行得到逻辑。 根据参数列表的个数有无返回值等可以分为6种形式,这个不必多说。 lambda表达式依赖函数式接口 lambda表达式依赖于函数式接口,即只有一个抽象方法的接口。个人理解表达式体就是实现那个唯一抽象方法的。也就是创建了一个实现这个接口的一个对象。需要注意的是,若 Lambda 表达式抛出一个受检异常,那么该异常需要在目标接口的抽象方法上进行声明,也就是lambda表达式里不能抛出异常,或者try/catch。 我们可以在任意函数式接口上使用 @FunctionalInterface 注解,这样做可以检查它是否是一个函数式接口。 Java内置的四大函数式接口 @Test public void test6 ( ) { Supplier < String > supplier = ( ) - > "532323" . substring ( 0 , 2 ) ; System . out . println ( supplier . get ( ) ) ; } @Test public void test7 ( ) { Function < String , String > function = ( x ) - > x . substring ( 0 , 2 ) ; System . out

Oracle 中 decode 函数用法

邮差的信 提交于 2020-01-19 03:49:51
含义解释: decode (条件,值1,返回值1,值2,返回值2,...值n,返回值n,缺省值) 该函数的含义如下: IF 条件=值1 THEN     RETURN(翻译值1) ELSIF 条件=值2 THEN     RETURN(翻译值2)     ...... ELSIF 条件=值n THEN     RETURN(翻译值n) ELSE     RETURN(缺省值) END IF decode (字段或字段的运算,值1,值2,值3) 这个函数运行的结果是,当字段或字段的运算的值等于值1时,该函数返回值2,否则返回值3 当然值1,值2,值3也可以是表达式,这个函数使得某些sql语句简单了许多 使用方法: 1、比较大小 select decode (sign(变量1-变量2),-1,变量1,变量2) from dual; --取较小值 sign()函数根据某个值是0、正数还是负数,分别返回0、1、-1 例如: 变量1=10,变量2=20 则sign(变量1-变量2)返回-1, decode 解码结果为“变量1”,达到了取较小值的目的。 2、此函数 用在 SQL 语句中 ,功能介绍如下: Decode 函数与一系列嵌套的 IF-THEN-ELSE语句相似。base_exp与compare1,compare2等等依次进行比较。如果base_exp和 第i 个compare项匹配

(生信)RNA蛋白编码预测软件-CNCI的使用

做~自己de王妃 提交于 2020-01-18 17:35:51
(生信)RNA蛋白编码预测软件-CNCI的使用 CNCI简介: CNCI是由中科院研发的一款基于SVM(支持向量机)的LncRNA预测软件,它可以不依赖于已知的RNA注释信息来进行预测,同时其对不完全转录和反义的RNA有着良好的分类效果,本文将根据github的说明总结一些简单的操作。 软件安装与准备: linux 32位或者linux 64位系统 python 2.74或者2.0版本(详细安装步骤见:https://blog.csdn.net/sherri_du/article/details/51810221) CNCI下载地址:https://github.com/www-bioinfo-org/CNCI#install-cnci CNCI的安装 git clone git@github . com : www - bioinfo - org / CNCI . git cd CNCI unzip libsvm - 3.0 . zip cd libsvm - 3.0 make cd . . 程序简介: 共有三个.py程序可供使用,分别是:compare.py / CNCI.py / filter_novel_lincRNA 下面是官网说明书里面对它们的解释: 1, compare.py : compare the merged/assembled transcripts