摘要: Java中内部类使用场景:1、隐藏实现 当一个类单独出现的时候,是不能以private,protected关键字修饰的,但是作为内部类出现的时候,是可以加这类关键字修饰,所以,内部类第一个作用,就是隐藏实现,参见代码:public interface InterfaceA{ public void f();}public class InnerClassExam1{ private class InnerClass implements InterfaceA{ public void f(){ System.out.println("Inner... 阅读全文
posted @ 2013-05-17 17:03 Simple Happiness 阅读(377) 评论(0) 推荐(1) 编辑
摘要: 1、关联 一个对象可以发送消息给另外一个对象,简单讲就是一个对象持有另外一个对象的指针或者引用,典型情况如下:public class A{ private B b; }public class B{} 或者这种情况:public class A{ public void f(B b){} }public class B{}2、聚合(aggregation) 聚合表示一种has-a关系,通常用于表示整体-部分关系,但是这个“部分”的生命周期并不依赖于“整体”,可以理解为一个弱化的has-a关系,也就是说,“整体”和“部分”是单独存在的,其UML图如下: public cla... 阅读全文
posted @ 2013-05-17 15:44 Simple Happiness 阅读(304) 评论(0) 推荐(0) 编辑
摘要: 生产异常日志:java.lang.IllegalStateException: Queue full原因:当使用add方法的时候,队列满了,再放入元素,就会报这个异常解决方法:将add方法替换成put方法,队列变成阻塞队列。引用java doc:BlockingQueue methods come in four forms, with different ways of handling operations that cannot be satisfied immediately, but may be satisfied at some point in the future: one 阅读全文
posted @ 2013-04-10 17:13 Simple Happiness 阅读(2695) 评论(0) 推荐(0) 编辑
摘要: dom4j解析xml字符串中包含转义字符,解决方法:org.apache.commons.lang.StringEscapeUtils.unescapeXml(String xml)org.apache.commons.lang.StringEscapeUtils.escapeXml(String xml)引入commons-lang-2.3.jar到classpath 阅读全文
posted @ 2013-04-08 16:45 Simple Happiness 阅读(986) 评论(0) 推荐(0) 编辑
摘要: 代码:#中文注释month = []报错内容:SyntaxError: Non-ASCII character '\xe4' in file date.py on line 1, but no encoding declared; seehttp://www.python.org/peps/pep-0263.html for details解决方法:在py文件第一行添加注释#encoding=utf-8#中文注释month = [] 阅读全文
posted @ 2013-04-03 10:31 Simple Happiness 阅读(1568) 评论(0) 推荐(0) 编辑
摘要: mysql>grant all privileges on *.* to root@"%" identified by "123456";mysql>flush privileges; 阅读全文
posted @ 2013-03-21 11:20 Simple Happiness 阅读(130) 评论(0) 推荐(0) 编辑
摘要: mysql> mysqldump [options] db_name [tables] 备份某个数据库或具体到某个数据表mysql> mysqldump [options] --databases db1 [db2 db3 ..] 备份多个数据库mysql> mysqldump [options] --all-databases 备份所有的数据库备份存储过程和函数:>mysqldump -uroot -h127.0.0.1 -uroot -p123456 -ntd -R db_name> ./db_name_procedure_function.sql备份数据:& 阅读全文
posted @ 2013-03-21 10:26 Simple Happiness 阅读(165) 评论(0) 推荐(0) 编辑
摘要: What you should try to do is locate and edit the my.cnf file your server is currently using. In the[mysqld]section alter the max_allowed_packet settings to something like[mysqld]max_allowed_packet=32MDon't forget to restart the server after altering the configuration. 阅读全文
posted @ 2013-03-21 10:19 Simple Happiness 阅读(198) 评论(0) 推荐(0) 编辑