摘要: public static void insertionSort(int[] arr) { int in,out; for(out=1;out<arr.length;out++) { int temp=arr[out]; in=out; while(in>0&&arr[in-1]>temp) { arr[in]=arr[in-1]; --in; } arr[in]=temp; } }比冒泡排序和选择排序效率高。 阅读全文
posted @ 2013-06-06 08:59 刘文天 阅读(114) 评论(0) 推荐(0) 编辑
摘要: class Test { public static void main(String[] args) { Demo d1=new Demo(true); Demo d2=new Demo(false); Thread t1=new Thread(d1); Thread t2=new Thread(d2); t1.start(); t2.start(); }}class MyLock{ public static final Object locka=new Object(); public static final Object lockb=new Object();}class... 阅读全文
posted @ 2013-06-04 15:51 刘文天 阅读(104) 评论(0) 推荐(0) 编辑
摘要: sqlite3.exe test.db 创建并打开数据库.separator ‘,’ 改变分割符的命令.mode line/column/list 查询数据的现实格式.width 6 10 当模式是column时,默认列宽是10个字符,改变列宽.header on/off 显示和不显示列头.tables 查看当前数据库有哪些表.dump student 查看表结构.exit 退出数据库 阅读全文
posted @ 2013-05-31 09:11 刘文天 阅读(110) 评论(0) 推荐(0) 编辑
摘要: class StackClass{ int[] arr=new int[10]; private int index; public StackClass() { this.index=-1; } public void push(int number) { if(this.index<this.arr.length) this.arr[++index]=number; else System.out.println("Stack is full..."); } public int pop() { if(this.index>=0) return this.a 阅读全文
posted @ 2013-05-29 13:59 刘文天 阅读(133) 评论(0) 推荐(0) 编辑
摘要: class MyException extends Exception//自定义异常,继承自:Exception{ private int num; public MyException(String msg,int num) { super(msg); this.num=num; } public int getNum() { return this.num; }}class Test { public static void reg(int num) throws MyException//重点是词句。throws MyException 不可缺少。 { if(num<0) { .. 阅读全文
posted @ 2013-05-29 10:26 刘文天 阅读(117) 评论(0) 推荐(0) 编辑
摘要: class Test { public static void main(String[] args) { System.out.println("main start..."); System.out.println(Count.counter); new Count().printCounter(); System.out.println("main end..."); }}class Count{ public static int counter;// static//静态初始化器(Static Initializer)。仅在类装载的时候执行一次 阅读全文
posted @ 2013-05-27 14:29 刘文天 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 前提:mysql用户root密码为空.一、输入 use mysql步骤二、mysql> 状态下输入 update user set password=123456 where user='root';回显Query OK, 0 rows affected (0.00 sec)Rows matched: 2 Changed: 0 Warnings: 0步骤三、mysql> 状态下输入 FLUSH PRIVILEGES;回显Query OK, 0 rows affected (0.00 sec)步骤四、mysql> 状态下输入 quit退出 sql注意每个命令后都 阅读全文
posted @ 2013-05-14 11:22 刘文天 阅读(123) 评论(0) 推荐(0) 编辑
摘要: /// <summary> /// 发送 /// </summary> /// <returns></returns> public bool Send() {#if NET1 System.Web.Mail.MailMessage myEmail = new System.Web.Mail.MailMessage(); myEmail.BodyEncoding = Encoding.GetEncoding("utf-8"); myEmail.From = this.From; myEmail.To = this._recip 阅读全文
posted @ 2013-05-13 14:20 刘文天 阅读(149) 评论(0) 推荐(0) 编辑
摘要: IIS5.1使用虚拟目录时应注意的地方::在 网站→默认网站->属性->主目录TAB中,本地路径一定要选中发布网站的路径.否则,就需要复制到默认的路径中去.ASP.NET MVC程序时注意点:①/默认网站->属性->ISAPI筛选器中要加一个 任意名字的筛选器,可执行文件要选中aspnet_isapi.dll②/默认网站->属性->主目录->配置中:::还要添加一个扩展映射::扩展名为 ".*",可执行文件也为aspnet_isapi.dll博客园搜::mvc2 部署,可查看相关的文章. 阅读全文
posted @ 2013-05-13 13:44 刘文天 阅读(201) 评论(0) 推荐(0) 编辑
摘要: 最新新闻、最新文章,JavaScript实现无缝循环滚动(基于jQuery)。JS代码如下:<script type="text/javascript"> $(function () { if ($("#ulDynamic").height() > 200) { $("#ulDynamic").height(200); $("#ulDynamic").css("overflow", "hidden"); var scroll = new s("#u 阅读全文
posted @ 2013-03-21 16:39 刘文天 阅读(197) 评论(0) 推荐(0) 编辑