Friday 31 May 2013

Fixing 500 OOPS: vsftpd: refusing to run with writable root inside chroot ()

After I upgrade my vsftp to newest version. I find I could not log in my vsftp as follow error:


500 OOPS: vsftpd: refusing to run with writable root inside chroot ()
This is becasue the new added feature of upgrade:
- Add stronger checks for the configuration error of running with a writeable root directory inside a chroot(). This may bite people who carelessly turned on chroot_local_user but such is life.
To fix this problem you should remove write permissions on the users root directory
chmod a-w /www/ftp
or
For the standard vsFTPd build (vsftpd): (still error for upload file)

allow_writeable_chroot=YES

Tuesday 28 May 2013

[Android]call to OpenGL ES API with no current context (logged once per thread)

Questions:
call to OpenGL ES API with no current context (logged once per thread)
for java you could not call the Opengl on main thread, you should build opengl running in subthread.
You can use  GLSurfaceView to do this by your own thread.

The wrong way:

public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.clear:
            GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
            break;
        // ...
    }
}

The correct way:

public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.clear:
            // GLSurfaceView.queueEvent
            surface.queueEvent(new Runnable() {
                @Override
                public void run() {
                    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
                }
            });
            break;
        // ...
    }
}

Tuesday 21 May 2013

css, css2, css3 selector

选择符类型                            表达式            描述
通配选择符                               *               选定文档目录树(DOM)中的所有类型的单一对象                *[lang=fr]  *.div
类型选择符                               E               以文档语言对象类型作为选择符                                              a
属性选择符                           E[attr]
包含选择符                           E1  E2
子 对象选择符                       E1 > E2        选择所有作为E1子对象的 E2                                                  body > p { font-size:14px; }
ID选择符                              #sID
类选择符                          E1.className
选 择符分组                      E1,E2,E3           将同样的定义应用于多个选择 符                                           .td1,div a,body { font-size:14px; }
子串匹配的属性选择符     E[attr=value]
子串匹配的属性选择符     E[attr~=value]
子串匹配的属性选择符    E1[attr|=value]   匹配具有attr属性且属性值为一用连字符分隔的字词列表
子 串匹配的属性选择符     E[att^="val"]     匹配具有att属性、且值以val开头的E元 素                                                         --------------------- 以下-css3独有
子串匹配的属性选择符     E[att$="val"]     匹配具有att属性、且值以val结尾的E元素
子串匹配的属性选择符     E[att*="val"]     匹配具有att属性、且值中含有val的E元素
结构性伪类                         E:root              匹配文档的根元素。在HTML中,根元素永远是HTML
结构性伪类                       E:nth-child(n)     匹配父元素中的第n个子元素E
结构性伪类                     E:nth-last-child(n)     匹配父元素中的倒数第n个结构子元素E
结构性伪类                     E:nth-of-type(n)     匹配同类型中的第n个同级兄弟元素E
结构性伪类                   E:nth-last-of-type(n)     匹配同类型中的倒数第n个同级兄弟元素E
结构性伪类                         E:last-child         匹配父元素中最后一个E元素
结构性伪类                      E:first-of-type     匹配同级兄弟元素中的第一个E元素
结构性伪类                        E:only-child     匹配属于父元素中唯一子元素的E
结构性伪类                    E:only-of-type     匹配属于同类型中唯一兄弟元素的E
结构性伪类                      E:empty     匹配没有任何子元素(包括text节点)的元素E
目标伪类                           E:target     匹配相关URL指向的E元素
UI元素状态伪类                E:enabled     匹配所有用户界面(form表单)中处于可用状态的E元素
UI元素状态伪类                E:disabled     匹配所有用户界面(form表单)中处于不可用状态的E元素
UI元素状态伪类              E:checked     匹配所有用户界面(form表单)中处于选中状态的元素E
UI元素状态伪类              E::selection     匹配E元素中被用户选中或处于高亮状态的部分
否定伪类                            E:not(s)        匹配所有不匹配简单选择符s的元素E
通用兄弟元素选择器            E ~ F            匹配E元素之后的F元素