2016年8月24日星期三

spring aop vs aspectj

AspectJ是编译期间修改代码,属于静态编入,不需要代理类。spring aop基于代理的,用的是aopalliance(aopalliance只是一个规范接口,不是实现),是运行期间植入,是动态植入,没自己的代理,得通过cglib或者jdk代理实现。jdk的出发实现了interface的object,缺不能促发没有实现任何interface的object。如果设置了proxy-target-class="true",就可以用cglib去触发。

静态编入 比 动态编入 应该效率好一些。  spring-aop不好用,没有注解,所以搞出来spring-aspects, 靠注解就能搞定,spring-aspects其实和AspectJ没有任何关系,没有用到aspect的实现,只是用了AspectJ的类定义,所以它不是编译植入,而是动态植入,所以也需要代理实现(jdk或者cglib)


http://docs.spring.io/spring/docs/current/spring-framework-reference/html/aop.html#aop-proxying
这个proxy-target-class,虽然可以在好几个个地方设置,但是其实只要设置一个地方,就影响到所有,也就是只要一个地方设置为true,那么就都是true。
<aop:config proxy-target-class="true"/>
<aop:aspectj-autoproxy proxy-target-class="true">
<tx:annotation-driven proxy-target-class="true"/> 
<task:annotation-driven proxy-target-class="true"/>
<cache:annotation-driven proxy-target-class="true/>
 ...

文档是这么写的,既然都是一票定,为啥还要搞一个
ScopedProxyMode?
proxyMode = ScopedProxyMode.TARGET_CLASS还能以bean单位进行的定义? 


找了个文章
http://www.udpwork.com/item/15373.html 

这个文字的意思
>>这个的答案是,aspectj虽然是静态,但spring-aspectj还是动态。用了@Aspectj注释的,就算method不是public的,也起作用,就多这么一个好处+可以不xml而可以注解来设置? 如果只是这样,@Aspectj用处就不算啥了。
 

2016年8月16日星期二

编译podofo时的错误

无论编译成静态还是动态,都会报
/home/advuser/src/lib/comm/pdf/podofo-src/src/base/PdfMemoryManagement.cpp:133: error: ‘SIZE_MAX’ was not declared in this scope,查看/usr/include/stdint.h的代码,

#if !defined __cplusplus || defined __STDC_LIMIT_MACROS
...
#  define SIZE_MAX              (18446744073709551615UL)
# else
#  define SIZE_MAX              (4294967295U)
# endif
...
#endif

#if !defined __cplusplus || defined __STDC_CONSTANT_MACROS
#endif

也就是得先定义__STDC_LIMIT_MACROS再include stdint.h。

那么就修改cmake的podofo_src下面的CMakeLists.txt,追加上

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS")

就OK了。

2016年8月14日星期日

typescript 2.0

https://zhongsp.gitbooks.io/typescript-handbook/content/doc/handbook/tutorials/ASP.NET%20Core.html

https://zhuanlan.zhihu.com/p/21629069

2016年8月7日星期日

sa弄长些,弄频繁些

默认是是10分钟一采集
cat /etc/cron.d/sysstat
*/10 * * * * root /usr/lib64/sa/sa1 1 1
把10修改为1,就变成一分钟了。

默认是保留7天,
cat /etc/sysconfig/sysstat
# How long to keep log files (in days).
# If value is greater than 28, then log files are kept in
# multiple directories, one for each month.
HISTORY=7
把7修改为27就可以

2016年8月4日星期四

angualr multi lang

https://www.sitepoint.com/multilingual-support-for-angularjs/

2016年8月3日星期三

why react

https://medium.freecodecamp.com/angular-2-versus-react-there-will-be-blood-66595faafd51#.fqz71jrb6


2016年8月1日星期一

oracle的并行查询

parallel_server不是并行查询用的,是给RAC用的,和并行查询没有一毛钱关系,这个糊涂了一下。


一般下面几个参数调节,hint里面的并行是会起作用的,就算table自身没有并行。
parallel_degree_policy
parallel_max_servers
parallel_min_servers
parallel_servers_target


测试如下
1.先disable并行
ALTER TABLE SKADVUSER.AD_ORDER_LEADINFO NOPARALLEL;
2 SELECT * FROM AD_ORDER,看计划,没有PX msg pool相关的东西。
3. select /*+ parallel(o 2) */ * from ad_order o,看机会,有了px。

还有个法子,就是直接enable session的并行,
alter session force parallel query;

不要并行
用no_parallel,或者直接将 parallel_max_servers设置为0。
parallel_degree_polic默认是manual,所以,如果表设置了并行,还是会并行。

http://m.blog.itpub.net/9240380/viewspace-1806660/
http://oracleinaction.com/statement-queueing/
http://blog.csdn.net/tianlesoftware/article/details/5854583