tianyalinfeng
tianyalinfeng · 共 355 篇文章
Robot Keywords
Name: Click Button Source: SeleniumLibrary <test library> Arguments: [ locator | dont_wait= ] Clicks a button identified by `locator`. Key attributes for buttons are `id`, `name` and `value`. See `introduction` for details about locating elements and about meaning of `dont_wait` argument.
2011-11-14 15:35 · Test · 评论(0)
汉字正则
^[\u2E80-\u9FFF]+$ 匹配所有东亚区的语言 ^[\u4E00-\u9FFF]+$ 匹配简体和繁体 ^[\u4E00-\u9FA5]+$ 匹配简体
Believe Me - Fort Minor
Believe Me - Fort Minor Yeah! [chorus] I guess That this is where we've come to If you don't want to Then you don't have to believe me But I won't be there when you go down Just so you know now You're on your own now believe me I don't want to be the one to blame You like fun and games Keep playing…
2011-11-09 14:23 · English · 评论(0)
正则表达式
常用的符号 . 表示任意一个字符 \s 空格字符(空格键,tab,换行,换页,回车) \S 非空格字符([^\s]) \d 一个数字(相当于[0-9]) \D 一个非数字字符(相当于[^0-9]) \w 一个单词字符(word character)(相当于[a-zA-Z_0-9]) \W 一个非单词字符(^\w) ^ 一行的开始 $ 一行的结束 \b 一个单词的边界 \B 一个非单词的 边界 \G 前一个匹配的结束 [] 匹配方括号内的一个字符(例如:[abc]表示字符a,b,c中的任意一个(与a|b|c相同) [a-zA-Z]表示从a到z或A到Z当中的任意一个字符) 表示次数的符号 * 重…
JavaCC options
quote from: http://javacc.java.net/doc/javaccgrm.html LOOKAHEAD : The number of tokens to look ahead before making a decision at a choice point during parsing. The default value is 1. The smaller this number, the faster the parser. This number may be overridden for specific productions within the g…
2011-11-02 11:37 · Java · 评论(0)
C基础题2
1、找错 void test1() { char string[10]; char* str1="0123456789"; strcpy(string, str1); } 这里string数组越界,因为字符串长度为10,还有一个结束符‘\0’。所以总共有11个字符长度。string数组大小为10,这里越界了。 PS:使用strcpy函数的时候一定要注意前面目的数组的大小一定要大于后面字符串的大小,否则便是访问越界。 void test2() { char string[10], str1[10]; for(i=0; i<10;i++) { str1[i] ='a'; } strcpy(str…
2011-11-02 09:17 · C · 评论(0)
C基础题1
1、局部变量能否和全局变量重名? 答:能,局部会屏蔽全局。要用全局变量,需要使用"::" 局部变量可以与全局变量同名,在函数内引用这个变量时,会用到同名的局部变量,而不会用到全局变量。对于有些编译器而言,在同一个函数内可以定义多个同名的局部变量,比如在两个循环体内都定义一个同名的局部变量,而那个局部变量的作用域就在那个循环体内。 2、如何引用一个已经定义过的全局变量? 答:extern 可以用引用头文件的方式,也可以用extern关键字,如果用引用头文件方式来引用某个在头文件中声明的全局变理,假定你将那个变写错了,那么在编译期间会报错,如果你用extern方式引用时,假定你犯了同样的错误,那…
2011-11-02 09:01 · C · 评论(0)
JavaCC-计算器
options{ STATIC = false; } PARSER_BEGIN(Calculator) package javacc; import java.io.PrintStream; public class Calculator{ double previousValue = 0.0; public static void main(String[]args)throws ParseException, TokenMgrError, NumberFormatException{ Calculator parser = new Calculator(System.in); parse…
2011-11-01 16:47 · Java · 评论(0)
JavaCC-简单加法
options{ STATIC = false; } PARSER_BEGIN(Adder) package javacc; public class Adder{ public static void main(String[]args)throws ParseException, TokenMgrError{ Adder parser = new Adder(System.in); System.out.println(parser.start()); } } PARSER_END(Adder) SKIP:{ " " } SKIP:{ "\n" | "\r" | "\r\n" } TOK…
2011-11-01 16:46 · Java · 评论(0)
What is love?
Love is not to serach for the similarities but to learn to respect the differences.
2011-10-28 12:57 · English · 评论(0)
Trie树
lTrie原理 Trie的核心思想是空间换时间。利用字符串的公共前缀来降低查询时间的开销以达到提高效率的目的。 lTrie性质 好多人说trie的根节点不包含任何字符信息,我所习惯的trie根节点却是包含信息的,而且认为这样也方便,下面说一下它的性质 (基于本文所讨论的简单trie树) 1. 字符的种数决定每个节点的出度,即branch数组(空间换时间思想) 2. branch数组的下标代表字符相对于a的相对位置 3. 采用标记的方法确定是否为字符串。 4. 插入、查找的复杂度均为O(len),len为字符串长度 lTrie的示意图 如图所示,该trie树存有abc、d、da、dda四个字符…
2011-10-26 15:29 · Java · 评论(0)
计算JVM使用情况
public class Memory { public static long usingMemory() { for(int i=0; i<3; i++) { System.gc(); } long total = Runtime.getRuntime().totalMemory(); long free = Runtime.getRuntime().freeMemory(); return total - free; } private final Runtime s_runtime = Runtime.getRuntime(); }
2011-10-25 17:31 · Java · 评论(0)
失意体前屈
Orz这个词就比较复杂了,叫做失意体前躯,用法也很多,你把下面这个帖子看完就基本知道怎么用Orz这个词了。 ^_^ =Orz=Orz=Orz=Orz=Orz=Orz=Orz=Orz=Orz=Orz=Orz=Orz=Orz= 这个符号叫失意体前屈 失意体前屈,原本指的是网路上流行的表情符号:_| ̄|○ 看起来像是一个人跪倒在地上,低着头,一副「天啊,你为何这样对我」的动作,虽然简单却很传神 在初期的时候,并没有人对这个符号起个名字,失意体前屈也是后来才出现的, 据说是某个餐厅的座垫上绣着这五个字,至於再之前又是谁想到的,就不可考了。 后来,又有人发现,用简单的三个英文字也可以表现这个动作,於是…
2011-10-25 16:12 · Fun · 评论(0)
二叉树
class TreeNode { private int data; private TreeNode Lchild; private TreeNode Rchild; TreeNode() { Lchild = null; Rchild = null; } TreeNode(int data) { this.data = data; Lchild = null; Rchild = null; } TreeNode(int data, TreeNode left, TreeNode right) { this.data = data; this.Lchild = left; this.Rch…
2011-10-15 14:00 · Java · 评论(0)
排序算法
public class SortUtil { public static void main(String[] args) { int[] data = { -1, 1, 42, 22, 61, 44, 12, 34 };// data[0]是辅助空间 System.out.print("the original array:"); print(data); // insertSort(data); // bInsertSort(data); // bubbleSort(data); quickSort(data, 1, data.length - 1); print(data); } p…
2011-10-11 13:32 · Java · 评论(0)