我的生活
xyliufeng · 共 40 篇文章
wget 参数
[code="java"] NAME Wget - The non-interactive network downloader. SYNOPSIS wget [option]... [URL]... DESCRIPTION GNU Wget is a free utility for non-interactive download of files from the Web. It supports HTTP, HTTPS, and FTP protocols, as well as retrieval through HTTP proxies. Wget is non-interact…
2011-07-01 09:32 · 评论(0)
Swing 动态添加控件JTabbedPane
import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTabbedPane…
2011-06-21 14:00 · 评论(0) · C · Java · C++ · C# · Swing
java随机函数用法Random
import java.util.Random; public class RandomNumber{ public static void main(String args) { // 使用java.lang.Math的random方法生成随机数 System.out.println("Math.random(): " + Math.random()); // 使用不带参数的构造方法构造java.util.Random对象 System.out.println("使用不带参数的构造方法构造的Random对象:"); Random rd1 = new Random(); // 产生各种类型的…
2011-06-02 10:43 · 评论(0) · Java
Spring AOP 代理
以前,在看Spring AOP代理时,老是不明白书上说的Point Cut(切入点),Join Point(连接点), Advice(通知), Advisor(配置器),这些词倒底是什么意思,最近,看了好多遍,反复的测试,终于明白一些了. Point Cut (切入点) = (Join Point 连接点的集合) Advice (通知) 是要执行代理的代码 Advisor = Point Cut + Advice 其实一个类TestDaoImpl,如果想实现代理,首先要实现一个接口TestDao,然后再要有一个代理类,如日志代理 (MyLoggerProxy), MyLoggerProxy这…
2011-03-28 17:31 · 评论(0) · DAO · Spring · XML · AOP · Bean
手机日常使用技巧、和手机停机如何免费上网
在待机情况下按: 一、米井06井,是查手机的序列号! 二、米井0000井,查看手机的版本、出厂日期和手机型号! 三、米井92702689井,查看手机的总计时器,要买全新手机的就可以用这个,如果没有用过的就显示000000:00 ! 四、米井2820井,查看蓝牙蕊片地址! 五、米井7780井、也是恢复原厂设置,《此不同于软格式机,恢复后不会将C盘文件清空,手机经常死机、反应慢就可以用这个》. 六、硬格式化手机,先将手机关机,然后按:拨号键、米键、3号键,三个键同时按住不放,然后开机,直到屏幕显示选择地区再放!硬格式会将C盘内所有的东西清掉,使手机反应更快! 七、诺基亚的初始化密码为:12345…
2011-03-21 13:22 · 评论(0) · 咨询 · 中国移动
lucene实现结果分组统计,类似group by
import java.io.IOException; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.Field.Index; import org.apache.lucene.document.Field.Store; import org.apache.lucene.index.…
2011-02-10 17:02 · lucene · 评论(0) · Apache · Lucene
java 排序
[code="java"] import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; public class ArrayListSort { public static void main(String[] args) { ArrayList persons = new ArrayList(); Person zhangsan = new Person("zhangsan", 20, true,3.55f); Person lisi = new Person("lisi", …
2011-02-10 15:39 · 评论(0) · Java
java 时间戳和PHP时间戳 的转换
总结一下java 时间戳和PHP时间戳 的转换问题: 由于精度不同,导致长度不一致,直接转换错误。 JAVA时间戳长度是13位,如:1294890876859 PHP时间戳长度是10位, 如:1294890859 主要最后三位的不同,JAVA时间戳在PHP中使用,去掉后三位,如:1294890876859-> 1294890876 结果: 2011-01-13 11:54:36 echo date('Y-m-d H:i:s','1294890876'); PHP时间戳在JAVA中使用,最后加三位,用000补充,如:1294890859->1294890859000 结果: 2011-01-1…
2011-01-13 12:32 · 评论(0) · Java · PHP
Spring Hibernate集成配置文件
applicationContext.xml [code="java"] org.hibernate.dialect.MySQLDialect true po/BookPO.hbm.xml com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/test?characterEncoding=UTF-8 root 111111 [/code] [b]Spring C3p0配置[/b] [code="java"] ${mysqljdbc.driverClassName} ${mysqljdbc.url} ${mysqljdbc.username} ${…
2010-11-01 15:17 · 评论(0) · Spring · JDBC · MySQL · Hibernate · 配置管理
httpclient设置连接超时读取数据超时
//连接超时(毫秒) client.getHttpConnectionManager().getParams().setConnectionTimeout(5000); //读取超时(毫秒) client.getHttpConnectionManager().getParams().setSoTimeout(5000); 超时异常处理: try{ //client代码 f1();//到这一步表示没有超时 }catch(SocketTimeoutException e){ //这一步表示超时了 f2(); }
2010-09-27 10:27 · 评论(2) · Java
solr竟价排名的实现
如果想在solr实现像百度一样相似的竟价的排名,也是可以的,在solr中实现竟价排名,主要使用QueryElevationComponent组件,[code="java"] string elevate.xml myqueryparser explicit elevator [/code] 通过相应的URL,[code="java"]http://localhost:8088/solr/elevate?q=天山长宁&enableElevation=true&forceElevation=true&exclusive=true&debugQuery=true[/code] Solr中实现竟价排…
2010-09-26 17:52 · solr · 评论(0) · Solr · 百度 · XML
Solr 查询 Ajax autoComplete 实现
在搜索时关键字自动提示功能,在Solr中主要利用TermsComponent组件实现的, [code="java"] true termsComponent [/code]通过ajax后台solr的接口,进行查询,返回相应的数据格式,进一步的处理,可以在前台显示。相应的URL:[code="java"]http://localhost:8088/solr/terms?terms.fl=text&terms.prefix=中国人&wt=json&terms.limit=10[/code] 效果如下图:
2010-09-26 17:13 · solr · 评论(2) · Solr · Ajax · json
MD5生成
package test; import java.security.MessageDigest; public class Md5Digest { public static String md5(String string) { char hexDigits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; try { byte[] bytes = string.getBytes(); MessageDigest messageDigest = MessageDig…
2010-09-16 09:16 · 评论(0) · HTML · C · C++ · C# · Security
solr分布式查询URL
1.multicores http://localhost:8088/solr-cores/core0/select/?q=南京&version=2.2&start=0&rows=10&indent=on&shards=localhost:8088/solr-cores/core0,localhost:8088/solr-cores/core1 2.multihosts shards http://localhost:8088/solr/select/?q=fly&version=2.2&start=0&rows=10&indent=on&shards=localhost:8088/solr…
2010-09-03 16:13 · solr · 评论(0) · Solr