随笔分类 -  Java

排序
摘要:网上有很多封装的mybatis 分页拦截器,但是看起来都比较乱,不能直接套用,在这里贴出项目中的分页源码出来供大家参考。 Controller 层: 先定义好page的属性,再用RowsBounds 类进行数据封装。 Page 类: Service 层很简单,直接调用Maper: Maper 对应m 阅读全文
posted @ 2017-02-16 11:33 phyxis_xu 阅读(2774) 评论(0) 推荐(0)
摘要:一般来说主要是字符流与字节流的处理出现不当,建议使用字节流。 比如讲printWriter 修改成 OutputStream 阅读全文
posted @ 2017-02-16 11:21 phyxis_xu 阅读(434) 评论(0) 推荐(0)
摘要:package com.java.main.test.thread; public class TestThread { public static Object object = new Object(); public static void main(String[] args) { //TestThread testThread = new T... 阅读全文
posted @ 2016-08-31 09:48 phyxis_xu 阅读(375) 评论(0) 推荐(0)
摘要:第一步:找到安装路径MyEclipse\configuration下名为:org.eclipse.update的文件夹;第二步:将org.eclipse.update删除掉;第三步:产出之后重启myeclipse,在打开此文件即可;备注:导致此问题主要原因myeclipse中编辑jsp页面时产生we 阅读全文
posted @ 2016-08-10 17:24 phyxis_xu 阅读(372) 评论(0) 推荐(0)
摘要:文件A1 包含字符Bi 的个数BiN1,文件A2 包含的字符Bi 的个数BiN2 利用余弦算法: 相似度 = (B1N1*B1N2 +B2N1*B2N2+....+BiN1*BiN2)/(Math.sqrt(B1N1^2 +B2N1^2+....+BiN1^2)*Math.sqrt(B1N2^2 + 阅读全文
posted @ 2016-06-20 17:47 phyxis_xu 阅读(1892) 评论(0) 推荐(0)
摘要:get 请求 post 请求 阅读全文
posted @ 2016-06-20 17:16 phyxis_xu 阅读(224) 评论(0) 推荐(0)
摘要:public static void main(String[] args) { C3p0Plugin cp = new C3p0Plugin("jdbc:mysql://localhost/safe", "root", "root"); cp.start(); ActiveRecordPlugin arp = new ActiveRecordPlugin(cp); ... 阅读全文
posted @ 2016-06-18 11:00 phyxis_xu 阅读(346) 评论(0) 推荐(0)
摘要:java 可以通过Executors 创建四类线程池: 1、缓存线程池:Executors.newCachedTreadPool();创建一个可缓存线程池,如果线程池长度超过处理需要,可灵活回收空闲线程,若无可回收,则新建线程。 2、定长线程池:Executors.newFixedThreadPoo 阅读全文
posted @ 2016-05-27 16:39 phyxis_xu 阅读(193) 评论(0) 推荐(0)
摘要:在项目中总会遇到一些关于加载的优先级问题,刚刚就遇到了一个问题,由于项目中使用了quartz任务调度,quartz在web.xml中是使用listener进行监听的,使得在tomcat启动的时候能马上检查数据库查看那些任务未被按时执行,而数据库的配置信息在是在web.xml中使用servlet配置的,导致tomcat启动后在执行quartz任务时报空指针,原因就是servlet中的数据库连接信息... 阅读全文
posted @ 2016-05-03 11:23 phyxis_xu 阅读(173) 评论(0) 推荐(0)
摘要:生成验证码方法: 阅读全文
posted @ 2016-04-23 11:45 phyxis_xu 阅读(225) 评论(0) 推荐(0)
摘要:读取文件1.txt中的文件内容,内容格式为: 名字|性别|出生日期|政治面貌。 读取之后存在对象中。 用户类: 方法类 阅读全文
posted @ 2016-03-21 15:20 phyxis_xu 阅读(3063) 评论(0) 推荐(0)
摘要:private static String getPath(String downUrl) throws Exception{ URL url = new URL(downUrl); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.ad... 阅读全文
posted @ 2016-03-19 15:09 phyxis_xu 阅读(325) 评论(0) 推荐(0)
摘要:首先下载需要的插件jar包并放置到eclipse或者myeclipse 的plugins 目录下。 重启myeclipse ,右击项目会出现如图的标志: 之后,选择图中的标志,就可以在弹出来的界面中选择自己的main方法,进而生成fat包详情可查看 http://jingyan.baidu.com/ 阅读全文
posted @ 2016-03-19 15:06 phyxis_xu 阅读(203) 评论(0) 推荐(0)
摘要:public static void parseZIP(String path,String filename,String resourcePath){ System.out.println("filename:"+filename); String filename0 = filename.su 阅读全文
posted @ 2016-03-09 09:30 phyxis_xu 阅读(199) 评论(0) 推荐(0)
摘要:/** * 压缩文件到zip * 将存放在sourceFilePath目录下的源文件,打包成fileName名称的zip文件,并存放到zipFilePath路径下 * @param sourceFilePath :待压缩的文件路径 * @param zipFilePath :压缩后存放路径 * @p 阅读全文
posted @ 2016-03-09 09:24 phyxis_xu 阅读(237) 评论(0) 推荐(0)
摘要:/** * 把资源文件上传到CDN */ public static boolean ftpUpload(String ip,String username,String password,String fileName,int port,String srcPath){ FTPClient ftp 阅读全文
posted @ 2016-03-09 09:21 phyxis_xu 阅读(751) 评论(0) 推荐(0)
摘要:饮料卖两块钱一瓶,两个空瓶子或者四个瓶盖均可以换一瓶新的饮料。10块钱可以喝多少瓶饮料? public static int getDrinkCount(int money ,int price){ int bottleCount = 2; int capCount = 4; int bottle 阅读全文
posted @ 2016-03-07 14:09 phyxis_xu 阅读(382) 评论(0) 推荐(0)
摘要:package com.ijiami.main.shiro.test; import java.util.ArrayList; import java.util.List; /** * * @author Administrator * list 实现栈、队列 * */ public class Q 阅读全文
posted @ 2016-02-17 11:18 phyxis_xu 阅读(366) 评论(0) 推荐(1)
摘要:/** * 求水仙花数 * @param left * @param right */ static void checkFlowerNumber(int left,int right){ for (int i = left; i <= right; i++) { char[] ch = (i+"" 阅读全文
posted @ 2016-02-16 15:36 phyxis_xu 阅读(141) 评论(0) 推荐(0)
摘要:/** * 求质数 * @param left * @param right */ static void checkPrime(int left,int right){ int count = 0; for (int i = left; i <= right; i++) { boolean fla 阅读全文
posted @ 2016-02-16 15:36 phyxis_xu 阅读(127) 评论(0) 推荐(0)