Ctrl+C&Ctrl+V
knight_black_bob · 共 487 篇文章
spring ehcache 缓存管理
<aop:config> <!-- 事务切入点通知 --> <aop:advisor advice-ref="txAdvice" pointcut="execution(* *..*Service.*(..))" order="2"/> <!-- 缓存切入点通知 --> <aop:advisor advice-ref="cacheAdvice" pointcut="execution(* *..*Service.*(..))" order="0"/> </aop:config> <!-- 缓存管理器 --> <bean id="cacheManager" class="org.springf…
2015-06-02 14:38 · spring · 评论(0) · Spring · ehcache
spring log 日志管理
import java.util.Map; import javax.annotation.Resource; import org.aspectj.lang.ProceedingJoinPoint; /** * Logger */ public class Logger { @Resource private LogService logService ; public Object record(ProceedingJoinPoint pjp){ Log log = new Log(); try { ActionContext ac = ActionContext.getContext(…
2015-06-02 14:18 · spring · 评论(0) · Spring · log · 日志管理
solr 测试
public static void main(String[] args) throws Exception { SolrServer server = new HttpSolrServer("http://localhost:8080/solr/db"); //SolrServer server = new CommonsHttpSolrServer( "http://localhost:8080/solr/db" ); SolrQuery params = new SolrQuery(); params.set("q", "nickname:baoyou"); params.set("…
2015-06-02 13:39 · solr · 评论(0)
solr 入门 (安装 mysql数据库安装 )
solr 入门 (安装) 非数据库安装 ------------------------------------------------------------------------------------------------------------------------------ 1.下载 solr http://mirrors.cnnic.cn/apache/lucene/solr/4.10.4/solr-4.10.4.zip 2.解压solr 拷贝 solr-4.10.4 \dist \solr.war 到tomcat7\webapps\下 solr-xxx .war 改名为…
2015-05-29 16:30 · solr · 评论(0) · MySQL · 入门 · 安装
IText pdf 生成
itextpdf-5.2.1.jar iText-2.1.7.jar iText-rtf-2.1.7.jar iTextAsian.ja 生成 pdf //Step 1—Create a Document. Document document = new Document(); //Step 2—Get a PdfWriter instance. PdfWriter.getInstance(document, new FileOutputStream(FILE_DIR + "createSamplePDF.pdf")); //Step 3—Open the Document. documen…
2015-05-29 14:51 · java · 评论(0) · 生成 · PDF · itext
redis 集成到 spring 中
redis 集成到 spring 中 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.…
2015-05-29 13:47 · spring · redis · 评论(0) · Redis · Spring · 集成
map 遍历
public static void main(String[] args) { Map<String, String> map = new HashMap<String, String>(); map.put("1", "value1"); map.put("2", "value2"); map.put("3", "value3"); //第一种:普遍使用,二次取值 System.out.println("通过Map.keySet遍历key和value:"); for (String key : map.keySet()) { System.out.println("key= "+ key…
2015-05-29 13:38 · java · 评论(0) · Java · map · 遍历
简单部署一个 tomcat 系统
简单部署一个 tomcat 系统 方法一: 1.把web 系统 打个 war 包 2.上传到wepapps中 3.启动 tomcat service tomcat start 方法二: 1. 讲 Java class 文件 拷贝到 WEB-INF 下,如果有些 jsp 在这里 也要 拷贝 2.jsp js 拷贝在 根目录下 ,也就是 web-inf 同级目录下 3. 进入 tomcat /bin 找到自己的tomcat 的进程 然后 kill -9 xxx , xxx是自己的进程 然后 启动 tomcat 在这里 我们使用 ./start.sh启动 ---------------------…
2015-05-28 11:47 · tomcat · 评论(0) · Tomcat · 系统 · 部署 · 简单
java file 进度条 文件上传
java file 进度条 public class MyProgressListener implements ProgressListener { private HttpSession session; public MyProgressListener(HttpServletRequest req) { session = req.getSession(); FileUploadStatus status = new FileUploadStatus(); session.setAttribute("status", status); } /* * pBytesRead 到目前为止读…
2015-05-28 11:33 · java · 评论(0) · upload · 上传 · 文件 · File · 进度条
json 遍历 jsonobject jsonarray
public static void main(String[] args) { String str = "{'TI':[{'value':'aa1','count':10},{'value':'aa2','count':15},{'value':'aa3','count':20}]," + "'AB':[{'value':'ab','count':110},{'value':'ab2','count':115},{'value':'ab3','count':210}]}"; JSONArray newArray = new JSONArray(); JSONObject newJson …
2015-05-28 10:45 · json · 评论(0) · json · 遍历 · jsonobject · jsonarray
jsonp jquery
一客户端( url:http://192.168.1.2:81/jsonp_test.jsp ) 客户端页面首先在body 中放置一个div: <div id="res"></div> 将远程调用的数据写入该div中 <script type="text/javascript" src="/js/jquery-1.3.2.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $.ajax({ url: 'http://192.168.9.5/jsonp_test1.jsp', dataT…
2015-05-28 10:45 · java · 评论(0) · jsonp · jQuery
jsonobject jsonarray
jsonobject jsonarray public static void main(String[] args) { String str = "{'TI':[{'value':'aa1','count':10},{'value':'aa2','count':15},{'value':'aa3','count':20}]," + "'AB':[{'value':'ab','count':110},{'value':'ab2','count':115},{'value':'ab3','count':210}]}"; JSONArray newArray = new JSONArray()…
2015-05-22 12:08 · java · 评论(0) · jsonobject · jsonarray
mysql 存入 blob类型数据
mysql 存入 blob类型数据 最佳 解决方案 如果是字符串 的 blob , 在 bean 中 把 该字段 设置成 byte[] 即可,遇到汉字 不会乱码 如果是文件 可以采用下面方法。 方案一 把String类型转为Blob类型很简单,只要将 newSerialBlob(String对象的.getBytes())就可以获得一个Blob对象, 要是把Blob对象转为String 一种是new String(Blob.getBytes(0,Blob对象.length)) 可是在开发中这样是不行了,总提示一个错误,只有获得Blob对象的输入流才可以 IntputStream is = Bl…
2015-05-21 12:07 · java · 评论(0) · MySQL · 类型 · blob · Save
地域统计 测试
地域统计 测试 package com.sq.test; import org.json.JSONArray; import org.json.JSONObject; import com.sq.utilities.Constants; import com.sq.utilities.JSONArrayProcessHelper; /** * <pre> *----the day before yesterday----------------------------- * 北京 1 123 * 上海 3 101 *----yesterday-------------------------…
2015-05-20 17:30 · java · 评论(0) · Java · json
mysql 保存 blob 类型数据 乱码 解决
本人问题:mysql 保存 blob 类型数据 乱码 解决 未解决,??? 之前 private string archiveValue; 导致 写入的进去之后的中文 都是乱码 改正后 ,即可 private byte[] archiveValue; // blob 其他解决方法 http://knight-black-bob.iteye.com/blog/2213090 ---------------------------------------------------------------------------------------------------------------…
2015-05-20 17:29 · spring · 评论(0) · MySQL · 乱码 · 中文 · blob