- 博客(35)
- 资源 (9)
- 收藏
- 关注

原创 xml2bean 把xml文件直接封装成bean
公司有个业务,要从ftp下载文件,文件中是xml,把xml信息存入数据库,如果一个一个字段去填充bean,那简直是个噩梦,果断写个xml2bean工具,在此分享(有待改进)private static T XML2Bean(String ecinfo,Class t) throws DocumentException, InstantiationException, IllegalAccessE
2013-08-20 08:55:04
1337

原创 计算文件夹大小,当前目录下个文件夹的大小
最近发现想看看当前目录下个文件夹的大小,苦于win7没有此功能,自己写个吧。python实现import globimport osdef get_dir_size(root): size = 0 for path, dirs, files in os.walk(root): for f in files: size += os.
2013-05-15 21:37:39
858
原创 ubuntu apt-get update 失败 解决方案
找了好多资料,最终都没有搞定,自己研究吧(当然也要查资料)失败的主要原因是不能访问到repository,至于为什么访问不到,可能是被强了,也可能是真的老了1,关闭所以源 (怎么着software sources 自己搜索吧)2,删除/var/lib/apt/lists 所有文件3,添加阿里云镜像https://launchpad.net/ubunt
2014-10-09 19:06:27
1717
原创 hibernate date query
hibernate 在比较日期的时候 不要直接拼hql语句,要用setParameter的方式,不然可能会错的,最好日期是timestamp的,其他的我没有试,但是可以试试
2013-09-10 12:50:56
631
原创 数据字典统一管理,动态下拉框
前端xhr jsvar buildTag = { /* *构建数据字典某一项的下拉框 */ getInfoTypeDatas:function(selectId,infoCode,defaultValue){ $.get(basePath+"/tag/build!getInfoTypeDatas.action?infoCode="+infoCode,function(arg
2013-09-06 17:41:00
1764
原创 xpath 解析xml 不是万能的,有时候xpath是不行的
@Testpublic void dom4jXpath() throws DocumentException, ParserConfigurationException, SAXException, IOException, TransformerException{// DocumentBuilderFactory builderFactory = DocumentBuilderFactory.
2013-08-30 16:40:59
4540
原创 正则表达式 one day( demo is used language by js)
1,sytax 语法var testRE = new RegExp(Pattern,Modifies)or 更简单var testRE = /Pattern/Modifiespattern 就是正则表达式的规则modifies 就是是否 大小写,全局啊,什么的。 the origin word is : modifies specify if a search is global,
2013-08-30 00:37:52
539
原创 ztree + artdialog,弹出树思路
1,art.dialog.open(url,param); //artdialog直接打开一个页面,这个页面上就是个ztree2,ztree 简单用法 见http://www.ztree.me/v3/demo.php#_2043,art.dialog中取到父页面数据 artDialog.open.origin.document 此引用取到的就是top页面的docum
2013-08-28 10:43:12
1253
原创 box unbox 中的 NullPointException
box unbox出现NullPointException:obj有这样一个字段,其字段是Integer类型的,并且没有赋值此时就要抛出NullPointException了int param = obj.getSomeFiledInterger();原因是:unbox的缘故,不言而喻吧。
2013-08-28 10:30:29
1377
翻译 Lucene to search text so good
IntroductionLucene is an open source, highly scalable text search-engine library available from the Apache Software Foundation. You can use Lucene in commercial and open source applications. Lucen
2013-08-27 13:26:11
859
原创 struts2 fileuplaod 上传文件 例子,带有源码
记个网址:http://www.mkyong.com/struts2/struts-2-file-upload-example/点击打开链接上传文件demo,很详细
2013-08-25 11:19:31
751
原创 log4j 屏蔽掉 System.out
运用log4j level屏蔽掉 System.out 输出,让那些可恶的System.out 去见鬼吧
2013-08-23 10:24:58
3053
原创 java MessageFormat 应用 和 疑惑
先来个demoString string = "{0}\"{1}\"";System.out.println(MessageFormat.format(string, "test","justfortest"));这个代码片段说明了MessageFormat的简单用法,比较方便,省去了我们的字符串的拼装。MessageFormat.format(String partten,Obje
2013-08-22 12:04:38
935
原创 struts2 全局格式化,格式化时间,金钱,数字
//在前台页面去控制时间,数字,小数,金钱,是极其不明智的选择,除非你是写了良好的 js api像freemarker , struts 都有良好的标签,我们应该好好利用,才发现的,给大家分享一下单独的properties 文件 for example,a.propertiesformat.time = {0,time}format.number = {0,n
2013-08-21 20:56:08
889
原创 lucene series 2 document 文档 索引创建 基本索引操作
1 ,添加索引Adding documents to an index2,删除索引 Deleting documents from an index 3,更新索引Updating documents in the index示例代码:添加索引 directory = new RAMDirectory(); IndexWriter writer = new
2013-08-21 10:41:47
1012
原创 lucene series 1 document 文档 索引创建
lucene series 1 document 文档 索引创建 过程,与大家分享
2013-08-21 09:11:29
1124
原创 dom4j 的小小测试
dom4j 的一些测试,公司需要抓取网页,写了个抓取工具,支持配置 xpath获取想要的内容,你仅仅需要的就是 把xpath 写对的啊
2013-08-17 16:06:36
880
原创 java-谈谈工作中遇到的问题
时间过得很快,转眼之间,工作已经一年多了,这一年了看到了好多,也想了好多。工作之中看到了好多让我不能理解的地方。我喜欢看书,所以这一年我看了好多书,但是
2013-07-19 15:38:42
1487
原创 every day learn,the knowlege I do not know very well
1,MIME multipuipose Internet Mail Extensions type / subtype
2013-06-13 13:34:32
453
原创 some ideas for the common issue
1,properties 文件怎么用,是不是可以转化成inmuttable globle bean 比较好呢
2013-06-09 11:24:30
493
原创 @Nullable 应用 避免 NullPointerExceptions
避免 NullPointerExceptions public Person(String firstName, String lastName, @Nullable Phone phone) { this.firstName = checkNotNull(firstName, "firstName"); this.lastName = checkNotNull(l
2013-06-05 13:59:35
639
原创 resultSet2Bean
public List resultSet2Bean(ResultSet rs,Class cls){ List lists = new ArrayList(); T bean = null; try { ResultSetMetaData rsmd = rs.getMetaData(); int cols = rsmd.getColumnCount(); while
2013-06-04 14:07:14
615
原创 manage the code for clear
1,.properties file is a very dangerous file,because some programer's program ability is not very good, they are easy to make no comments and also have some prompt in the code,so it is very hard t
2013-05-13 17:23:28
447
原创 mvn 批量上传jar到私服 工具 python实现 (并且生成 dependencies 文件)
给公司搭建mvn 私服时遇到 jar包太多的问题果断编写 工具,批量一键上传到私服并且生成 dependencies 文件from xml.etree.ElementTree import Element, SubElement, tostring,ElementTreeimport globimport osdef mvn_script(filename): return
2013-05-10 13:48:32
1086
原创 java web 中遇到的问题
1.数据已经从数据库中取出来了,但是前台el却不能取到,(是否有此字段的get方法)2.struts2 中表单提交不上去(类型是否匹配,struts2 拦截器会把不匹配的拦截掉啊)3.struts2 中用debug标签会出现 调用方法错误的问题。4.struts2 中有些字段接受不到参数可能是此字段是struts的保留字。5.spring注入不了,看看方法的修饰符要是private
2013-05-10 13:37:13
306
原创 java web struts2 mybatis 分页
page.java类import java.util.List;public class Page { /** 当前页 */ private int curPage; /** 总页数 */ private int total; /** 总的记录数 */ private int sum; /** 结果集 */ private List result; public
2013-05-10 13:35:31
711
转载 get提交遇到
提交的两种方式,GET和POST 1.记住超链接是GET方式提交 2.POST方式提交可以统一转码(这样获得的参数可以统一转码) 例:request.setCharacterEncoding("UTF-8"); //如果你用的编码方式是GBK就写GBK,要写在获得参数的前面 String name=request.getParameter("name"); Syste
2013-05-10 13:17:33
314
refectoring - improve the exiting code
indirection and refectoring 1,enable sharing of logic2,to explain intention and implemetation separately3,to isolate change4,to encode conditional logic the rule is so cool and so usefu...
2013-01-14 10:20:38
186
jaxws-rt 2.1.4 jar java webservice依赖包
2014-04-02
java ajax fileupload demo
2013-08-26
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人