Gui Guan’s BLOG

There’s more than one way to do it

Archive for the ‘Programming’ Category

其实在C#中要实现这个很简单,只要运用DateTime.Now记下程序开始和结束的时间再相减就行了。语法如下:

DateTime startTime=DateTime.Now;
......
DateTime endTime=DateTime.Now;
Console.WriteLine("程序运行的时间是:{0}",(endTime-startTime));

例如我们可以用这个方法测试采用装箱和不装箱两种情况哪个效率更高
运行结果如下:

源代码如下:

(more…)

  • 1 Comment
  • Filed under: C#
  • 最近学编程,填一下心里的空虚,看到了这个代码,哈哈很有意思,大家都来玩玩啊~~~~

    打开任意一个网页(要有内容的,图片越多越好),再将下面代码贴到浏览器地址栏(覆盖掉以前的),回车看看发生了什么

    javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI=document.images; DIL=DI.length; function A(){for(i=0; i-DIL; i++){DIS=DI[ i ].style; DIS.position='absolute'; DIS.left=Math.sin(R*x1+i*x2+x3)*x4+x5; DIS.top=Math.cos(R*y1+i*y2+y3)*y4+y5}R++}setInterval('A()',5); void(0);
  • 2 Comments
  • Filed under: Javascript
  • These formal definitions are taken from the book by Chris J. Date: An Introduction to Database Systems Volume 1 4th edition, © 1996, Addison-Wesley Publishing Co., Inc., Reading, Massachusetts.

    First Normal Form

    ‘A relation R is in first normal form (1NF) if and only if all underlying domains contain atomic values only.’

    Second Normal Form

    ‘A relation R is in second normal form (2NF) if and only if it is in 1NF and every nonkey attribute is fully dependent on the primary key.’

    (more…)

  • 0 Comments
  • Filed under: Databases