01 2014 档案
摘要:java 中的 拷贝分为浅拷贝 和 深拷贝浅拷贝需要实现Cloneable接口,深拷贝需要实现Serializable接口。public class Square implements Cloneable, Serializable{ private Point location = new Point(0, 0); private float sideLength = 1F; @Override public Object clone() { Square tmp = null; try { tmp = (Square) supe...
阅读全文
摘要:1. 这条语句主要是用来修复一个表中的数据 , 在另一个统计表中没有统计时,进行修改统计表的操作 update expert_count ec inner join ( select sum(e.EFFECT_SCORE) es_count, sum(e.ATTITUDE_SCORE) as_count, sum(e.PROMOTE_REASONABLE_SCORE) pro_count, sum(e.PRICE_REASONABLE_SCORE) pri_count, sum(e.ENVIRONMENT_...
阅读全文
摘要:1.Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode, toggle the option in Preferences -> SQL Queries and reconnect. 解决方式: SETSQL_SAFE_UPDATES= 0; // 重要的是这一句 update T set col = 'xxx' where conditio..
阅读全文
摘要:有时候,我们希望一个集合只能读,不能写。像.NET语言就提供了只读的集合,可惜Java中却没有。 还好集合工具类Collections为我们提供了静态工厂方法来生成只读集合,包括Collection,List,Map,Set,SortedMap和SortedSet,下面给出了各自的方法签名。Collection unmodifiableCollection(Collection collection)List unmodifiableList(List list)Map unmodifiableMap(Map map)Set unmodifiableSet(Set set)SortedMa..
阅读全文
摘要:sonar 默认是英文的界面1.下载http://repository.codehaus.org/org/codehaus/sonar-plugins/l10n/sonar-l10n-zh-plugin/1.2/sonar-l10n-zh-plugin-1.2.jar2.把下载的压缩包放到sanar安装目录下的/extensions/plugins 中3.重启Sonar server ./sonar.sh restart
阅读全文
摘要:1) 下载 从sonar官网http://www.sonarsource.org/下载 (版本当然是最新的了) 在官网上是不分系统的,一个zip包,下下来之后,包里包含 windows 、linux 和mac的版本2)解压 执行 我用的是sonarqube-4.1 解压出这么一个文件夹后,打开bin/macosx-universal-64 ( 注: 我的系统是mac 64位的,所以选的这个目录 ) ./sonar.sh start 出现下面字样,说明运行成功 Starting sonar... Started sonar. 打开浏览器,http://localhos...
阅读全文
摘要:Hibernate 参数设置一览表属性名用途hibernate.dialect一个HibernateDialect类名允许Hibernate针对特定的关系数据库生成优化的SQL.取值full.classname.of.Dialecthibernate.show_sql输出所有SQL语句到控制台. 有一个另外的选择是把org.hibernate.SQL这个log category设为debug。eg.true|falsehibernate.format_sql在log和console中打印出更漂亮的SQL。取值true|falsehibernate.default_schema在生成的SQL中,
阅读全文
摘要:配置:一.在src目录下加入ehcache.xml:在使用ehcache的页面缓存之前,我们必须要了解ehcache的几个概念,1 timeToIdleSeconds,多长时间不访问该缓存,那么ehcache就会清除该缓存。2 timeToLiveSeconds,缓存的存活时间,从开始创建的时间算起。SimplePageCachingFilter是缓存的名字,maxElementsInMemory表示内存中SimplePageCachingFilter缓存中元素的最大数量为10,maxElementsOnDisk是指持久化该缓存的元素到硬盘上的最大数量也为10(),eternal=false意
阅读全文
摘要:临时性的完全关闭防火墙,可以不重启机器:#/etc/init.d/iptablesstatus##查看防火墙状态#/etc/init.d/iptablestop##本次关闭防火墙#/etc/init.d/iptablerestart##重启防火墙查看目录下的所有文件 : ls -l查看目录下的所有文...
阅读全文
摘要:cat /home/username/.bash_history :查看用户的历史操作记录 (centos , mac 支持) last -x :使用root登陆使用last -x可查看用户登陆历史。 补充说明:单独执行last指令,它会读取位于/var/log目录下 名称为wtmp的文件,并把该给文件的内容记录的登入系统的用户名单全部显示出来。 参 数: -a 把从何处登入系统的主机名称或IP地址,显示在最后一行。 -d 将IP地址转换成主机名称。 -f 指定记录文件。 -n 或- 设置列出名单的显示列数。 -R 不显示登入系统的主机名称或IP地址。 -x 显示系统关...
阅读全文
摘要:在jetty中是支持put方式操作的,在tomcat中默认是不支持的,解决方式很简单,在web.xml中添加一个过滤器即可。 httpPutFormContentFilter org.springframework.web.filter.HttpPutFormContentFilter httpPutFormContentFilter /*
阅读全文
摘要:客户端: 因为put只支持单一类型的资源进行传输,所以不能使用像 Multipart/form-data这样的content-type进行描述,而只能使用像image/jpeg 、image/png的形 式进行图片的传输。 代码: RestTemplate restTemplate = super.buildRestTemplate(); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.IMAGE_PNG); ...
阅读全文
摘要:post : 标识的是处理请求中资源表述的资源 put : 标识的是请求的资源表述 post : 支持多种类型的资源 put : 支持单一的资源
阅读全文
摘要:get、post、put、delete的安全性和幂等性安全性:指的是对资料是否有破坏性的操作幂等性:指的是对资源操作时,数据是一致性。
阅读全文