摘要: //复杂度:O(nlog2n) //n倍的以2为底n的对数 public static <T extends Comparable <? super T>> void msort(T[] arr,T[] tempArr,int start,int end) { 2 3 if(start + 1 < end) { 4 int mid = (start + end) / 2; 5 msort(arr,tempArr,start,mid); 6 msort(arr,tempArr,mid,end... 阅读全文
posted @ 2013-05-23 21:09 system("cls") 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 个人感觉,buffer最大的特点就是不能使用require('buffer')创建,其创建方法有三种1. buffer = new Buffer(size);//size指buffer大小,整型数字,开辟长度为size个字节的buffer(相当于数组)2.buffer = new Buffer(arr);//arr为字节数组(注意:是字节数组)3.buffer = new Buffer(str,charset);//对于str字符串使用charset指定的编码(不支持中文编码)对于第一种创建方法,buffer[i]表示一个字节 仅能表示0~255的数字,创建时,系统会随机给每个 阅读全文
posted @ 2013-05-22 20:52 system("cls") 阅读(1758) 评论(0) 推荐(0) 编辑
摘要: 1 public static <T extends Comparable<? super T>> void insertSort(T[] arr) { 2 //基本数据类型要转化成封装类 3 //平均排序效率:T(n)=1/2+2/2+3/2+...+(n-1)/2=n(n-1)/4,比较n-1轮 4 //大O表示法:平均:O(n^2),最好:O(n),最差:O(n^2) 5 int i,j; 6 T temp; 7 int n = arr.length; 8 for(i = 1;i... 阅读全文
posted @ 2013-05-21 07:12 system("cls") 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 对于collection调用fetch()方法,则以get方式,去服务器请求资源 1 BookShelf = Backbone.Collection.extend({ 2 model:Book 3 }); 4 5 var bookShelf = new BookShelf; 6 7 bookShelf.fetch({url:'collection.do',success:function(collection,response) { 8 collection.each(function(bo... 阅读全文
posted @ 2013-05-15 16:18 system("cls") 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 利用代理模式是解决ajax跨域问题的一种简单有效的途径,在这里,利用apache的组件HttpComponents(http://hc.apache.org/),利用下面的方法,传参为第三方服务的url,则返回响应字符串 1 public static String getHttpString(String url) { 2 HttpClient client = new DefaultHttpClient(); 3 try { 4 HttpGet httpGet = new HttpGet(url); 5 Htt... 阅读全文
posted @ 2013-05-14 17:01 system("cls") 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 1 import java.util.ArrayList; 2 import java.util.List; 3 4 public class Page<T> { 5 6 private int startIndex; //该页的起始行数 7 private int pageNum; //当前页码 8 private int totalPageNum; //总页数 9 private int totalNum; //总记录数10 private int pageSize = 2; //每页显示的记录数量11 private List<T> ... 阅读全文
posted @ 2013-05-13 22:10 system("cls") 阅读(627) 评论(0) 推荐(0) 编辑
摘要: 1 public static String getTime(String time) { 2 3 String now = DateUtil.getNow(); 4 if(time == null) { 5 time = DateUtil.getNow(); 6 } 7 int nowYear = Integer.valueOf(now.substring(0, 4)); 8 int year = Integer.valueOf(time.substring(0, 4)); 9 10 String temp;11 temp = now.substring(now.indexOf(" 阅读全文
posted @ 2013-05-13 22:08 system("cls") 阅读(253) 评论(0) 推荐(0) 编辑
摘要: $(".edit").dblclick(function(even) { var id = $(this).attr("ref"); var td = $(this); var input = $("<input>"); input.type = "text"; var val = $(this).html(); input.val($(this).html()); $(this).html(""); $(this).append(input); input.focus(); inp 阅读全文
posted @ 2013-05-13 22:04 system("cls") 阅读(544) 评论(0) 推荐(0) 编辑
摘要: <!DOCTYPE HTML><html><head> <meta charset="UTF-8"> <title></title> <style type="text/css"> #sf,#sc,#st{ padding-left:15px; } .first{ left:190px; } .second{ left:242px; } .third{ left:294px; } .help{ height:18px; width:50px; //background-c 阅读全文
posted @ 2013-03-24 21:42 system("cls") 阅读(345) 评论(0) 推荐(0) 编辑
摘要: 1安装MindManager时,显示安装Visual C++ 2005 Redistributable时报错解决方法:1.把安装程序移动到没有中文名的文件夹里再安装。一般都是可以正常安装的2.如果安装不成功,是因为系统的临时文件夹路径也包含中文名,比如临时文件路径是:“C:\Users\用户名\AppData\Temp”,所以还是出错了,把临时文件夹改为了“C:\Temp”,再安装,成功3.临时文件夹修改方法:在“系统—高级系统设置—环境变量”当中修改系统参数,将TMP和TEMP名称分别改为C:\TMP和C:\TEMP即可。 2安装好MindManager之后,报错得到如下提示:------- 阅读全文
posted @ 2012-11-25 22:16 system("cls") 阅读(1569) 评论(0) 推荐(0) 编辑