2016年1月28日星期四

form, component


控件
* @property {Object} $error An object hash with all failing validator ids as keys.
* @property {Object} $pending An object hash with all pending validator ids as keys.
*
* @property {boolean} $untouched True if control has not lost focus yet.没摸过
* @property {boolean} $touched True if control has lost focus.摸过,并失去了。
* @property {boolean} $pristine Truerol if user has not interacted with the cont yet.没交互过
* @property {boolean} $dirty True if user has already interacted with the control.交互过
* @property {boolean} $valid True if there is no error.合法
* @property {boolean} $invalid True if at least one error on the control.非法
* @property {string} $name The name attribute of the control.


form
 * @property {boolean} $pristine True if user has not interacted with the form yet.没交互
 * @property {boolean} $dirty True if user has already interacted with the form.已交互
 * @property {boolean} $valid True if all of the containing forms and controls are valid.合法
 * @property {boolean} $invalid True if at least one containing control or form is invalid.非法
 * @property {boolean} $submitted True if user has submitted the form even if its invalid.已提交,就算没提交成功也是已提交。



区分一下






 $dirty和$pristine是相反的
 $dirty是交互过,比如获得了焦点,并且输入了东西(比如输入A,然后删掉A)。
 $touched只是获得过焦点。

2016年1月27日星期三

babel输出deafult时,不要带default

https://www.npmjs.com/package/babel-plugin-add-module-exports

看了这个文章解决的

2016年1月26日星期二

做了一个dmz,用了selinux,比起没用selinux一堆麻烦

1。apache启动时,没法监听端口。
[root@dmz conf]# service httpd start
(13)Permission denied: make_sock: could not bind to address [::]:8085

这是因为selinux没有让8085运行。
semanage port -l命令可以看到,默认是
http_port_t                    tcp      80, 443, 488, 8008, 8009, 8443
需要追加上我的8085
semanage port -a -t http_port_t -p tcp 8085
追加上后,ok。

另外,rhel 6l里,默认semanage是没安装的。需要yum -y install policycoreutils-python
可以用
yum whatprovides /usr/sbin/semanage找到哪个包里有这个命令。

但是奇怪的是tomcat缺可以启动监听其他端口,不需要selinux,原因不知道,估计和用户所属组有关。

2.反向代理没法用
[Tue Jan 26 16:51:41 2016] [error] (13)Permission denied: proxy: HTTP: attempt to connect to 192.168.101.41:8080 (192.168.101.41) failed
[Tue Jan 26 16:51:41 2016] [error] ap_proxy_connect_backend disabling worker for (192.168.101.41)


需要执行
/usr/sbin/setsebool -P httpd_can_network_connect 1
才可以。 

2016年1月20日星期三

非root用户执行crontab时的环境变量

crontab -e,编辑完后,以为会按照指定的执行,结果发现crontab 执行虽然是以用户权限执行的,但是用户的环境根本没加载。

解决法子
1。最笨自然是用root用户里面crontab 然后 su - user -c "script.sh"咯
2。其实写script的时候,最前面加上-l就可以啦,#!/bin/bash -l这样子。也可以放job前面
* * * * * bash -l script.sh
3。要不然就是job的前面,加载也可以 . ~/.bash_profile;script.sh

2016年1月19日星期二

Invalid password while logging 12c ASM instance

12c的grid里


sqlplus / as sysdb ok
sqlplus / as sysasm ok
sqlplus sys/sys_pw as sysdba ok
sqlplus sys/sys_pw as sysasm NG


解决法子在这里
http://www.sqlplus.ca/blog/?p=1142


[grid@orasrv ~]$  ls -l $ORACLE_HOME/dbs
total 12
-rw-rw----. 1 grid oinstall 1328 Jan 19 15:41 ab_+ASM.dat
-rw-rw----. 1 grid oinstall 1544 Jan 19 15:41 hc_+ASM.dat
-rw-r--r--. 1 grid oinstall 2992 Feb  3  2012 init.ora


SQL> select * from v$pwfile_users;                              

USERNAME                       SYSDB SYSOP SYSAS SYSBA SYSDG SYSKM     CON_ID
------------------------------ ----- ----- ----- ----- ----- ----- ----------
SYS                            TRUE  TRUE  TRUE  FALSE FALSE FALSE          0
ASMSNMP                        TRUE  FALSE FALSE FALSE FALSE FALSE          0

[grid@orasrv ~]$ srvctl config asm -a
ASM home: <CRS home>
Password file: +DG_GRID/orapwasm
ASM listener: LISTENERASM
Spfile: +DG_GRID/ASM/ASMPARAMETERFILE/REGISTRY.253.865375963
ASM diskgroup discovery string: /dev/raw/*
ASM is enabled.
ASM is individually enabled on nodes:
ASM is individually disabled on nodes:

我的orapwasm缺是有的。sys也已经有了 SYSAS =true,想不通。
后来,connect / as sysasm后修改sys密码,alter user sys identified by oracle居然过了。
莫非asm实例的sys密码还有两份?一份给sysdba一份给sysasm?莫名其妙。

2015年12月17日星期四

windows7的keyboard layout

win7安装在esx上,通过vsphere去连接,结果怎么修改都是英文键盘。通过remote desktop连接也是英文键盘。

修改了驱动为日文键盘也没用。
增加"IgnoreRemoteKeyboardLayout"=dword:00000001也没用

 
后来发现,必须先在vsphere里面login,然后里面是session的keybard是日文后,再remote desktiop进同样的session去就是日文的。
如果用remote desktop直接login,就是英文了。

记下来,免得下次折腾。

2015年12月14日星期一

url-pattern

虽然一直用,因为基本不会遇到问题。
这里弄清楚一下

对tomcat,有4种
/*  wildcardWrappers

*. extensionWrappers

/ defaultWrapper

其他 exactWrappers

优先级是
1.精确匹配最优先,exactWrappers
2.前缀匹配,wildcardWrappers /*
3.扩展名匹配,extensionWrappers *.
4.显示welcome
5.使用默认的servlet来处理,defaultWrapper  /

到这里,就能区分开/*和/的区别了

例子,springmvc里,定义了/*来处理所有的请求给springmvc的DispatcherServlet,也定义了一个@RequestMapping为index.jsp,web目录里面也放一个index.jsp
如果输入http://xxxx/index.jsp,那么请求会被/*给拦截给springmvc,因为rule2比rule3优先。

如果springmvc的servlet里定义的是/, index.jsp就不会被拦截给springmvc,因为rule3比rule5高。

同时,我们还可能会碰到这样的问题
springmvc里面定义/*拦截,然后@RequestMapping定义为index,做一个viewResolver,指向WEB-INF/views/login.jsp。这个时候,如果访问index,会出现什么结果?
a。index会被springmvc拦截,然后去访问 WEB-INF/views/login.jsp
b。 结果WEB-INF/views/login.jsp又被springmvc再次拦截了(rule2比rule3优先级高)
结果导致出现
No mapping found for HTTP request with URI [/xiu_template/WEB-INF/views/login.jsp] in DispatcherServlet with name 'spring.mvc'
出来不了我们想要的东西。

解决法子,最简单的自然是定义springmvc为比如url-pattern *.html,然后访问index.html,然后去WEB-INF/views/login.jsp,然后去的*.jsp的servlet。是没有问题的。

如果就是不想用扩展名的的方法咋办?? url-pattern是没有exclude的。
其实,只要在web.xml里面多顶一个前缀匹配就ok了。default的名字,是固定的。tomcat还可以写为jsp,因为真正的名字是jsp(可以通过serveletcontext找到getServletRegistrations后知道里面注册的servelet是org.apache.jasper.servlet.JspServlet,名字是jsp)。

    <servlet-mapping>
     <servlet-name>default</servlet-name>
     <url-pattern>/WEB-INF/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
     <servlet-name>default</servlet-name>
     <url-pattern>/resources/*</url-pattern>
    </servlet-mapping>

追到这里,就不由想到难道springmvc就不能处理jsp或者static的东西了?查了一下,发现早就有一个
<mvc:default-servlet-handler/>来对应这个事情,定义了这个,拦截了后不能mapping的就给这个default了。
这下才算是完满了。 web.xml里面清爽了。
 default-servlet-handler自动发现server(tomcat)的默认serlet,交个它来出来自己搞不定的事情。

那是不是说定义了这个东西,事情就算完了?我发现如果网站在default-servlet-handler和spring-security搭配起容易出问题。