2012年2月13日

First JNI

摘要: http://hi.baidu.com/fwmf/blog/item/849c1cf7ece36c3a730eecee.htmlubuntu 11.04:cd to a dir:1,vim HelloWorld.java:public class HelloWorld { pr... 阅读全文

posted @ 2012-02-13 14:34 子非鱼焉 阅读(89) 评论(0) 推荐(0) 编辑

2012年2月7日

LInux 压缩解压命令

摘要: linux下解压命令大全.tar解包:tar xvf FileName.tar打包:tar cvf FileName.tar DirName(注:tar是打包,不是压缩!)———————————————.gz解压1:gunzip FileName.gz解压2:gzip -d FileName... 阅读全文

posted @ 2012-02-07 11:05 子非鱼焉 阅读(111) 评论(0) 推荐(0) 编辑

Java在并发环境下设置唯一标识

摘要: 使用hashcode static final ConcurrentMap allObjects = new ConcurrentHashMap(); private static Integer allocateId(Object obj) { Integer id =... 阅读全文

posted @ 2012-02-07 11:02 子非鱼焉 阅读(187) 评论(0) 推荐(0) 编辑

tomcat配置https连接

摘要: 1.首先用jdk自带的工具keytool生成一个"服务器证书"a.命令行进入$JAVA_HOME/bin目录($JAVA_HOME为jdk的安装目录)b.输入:keytool -genkey -alias tomcat -keyalg RSA -keystore C:\tomcat.keyc... 阅读全文

posted @ 2012-02-07 10:50 子非鱼焉 阅读(91) 评论(0) 推荐(0) 编辑

2012年2月2日

位图排序算法的一个实践

摘要: 适应场景:1,输入的数据限制在相对较小的范围内;2,数据没有重复;3,对于每条记录而言,除了单一整数外,没有任何其他相关联的数据。2,要求输入:一个最多包含n个正整数的文件F1,每个数小于n(n=1000000),而且整数没有重复;输出:包含按升序排列的整数列表的文件F2;约束:不超过1M的... 阅读全文

posted @ 2012-02-02 15:01 子非鱼焉 阅读(104) 评论(0) 推荐(0) 编辑

快速获取[0,n]之间的k个不同的随机顺序的随机整数

摘要: 如果生成位于0到n-1之间的k个不重复的随机顺序的整数呢?/** * 随机抽取[0,n)之前的k个不同的数并随机排序,(k n) { k = n; } int[] rets = new int[k]; // 保存取出的随机数 int[] array = new int[n];//... 阅读全文

posted @ 2012-02-02 13:18 子非鱼焉 阅读(131) 评论(0) 推荐(0) 编辑

2012年1月5日

Project Euler Problem 80-高精度开方-牛顿逼近法

摘要: It is well known that if the square root of a natural number is not an integer, then it is irrational. The decimal expansion of such square roots ... 阅读全文

posted @ 2012-01-05 12:09 子非鱼焉 阅读(195) 评论(0) 推荐(0) 编辑

2012年1月2日

Project Euler Problem 76-整数分拆

摘要: It is possible to write five as a sum in exactly six different ways:4 + 13 + 23 + 1 + 12 + 2 + 12 + 1 + 1 + 11 + 1 + 1 + 1 + 1How many different w... 阅读全文

posted @ 2012-01-02 18:49 子非鱼焉 阅读(93) 评论(0) 推荐(0) 编辑

Project Euler Problem 75

摘要: It turns out that 12 cm is the smallest length of wire that can be bent to form an integer sided right angle triangle in exactly one way, but ther... 阅读全文

posted @ 2012-01-02 18:18 子非鱼焉 阅读(82) 评论(0) 推荐(0) 编辑

2011年12月29日

用Java模拟Http请求

摘要: 1),利用httpclient4.× 写一个http的客户端,模拟浏览器请求,public void post(List payload) throws Exception{ HttpPost post = new HttpPost(uri); Http... 阅读全文

posted @ 2011-12-29 19:11 子非鱼焉 阅读(182) 评论(0) 推荐(0) 编辑

导航