20110222

An article about Named function expressions

In English: http://kangax.github.com/nfe/
In Chinese: http://www.cn-cuckoo.com/main/wp-content/uploads/2009/12/named-function-expressions-demystified.html#introduction

20101213

main.c:99: error: ‘LangParser_decl_return’ undeclared (first use in this function)

Page in ANTLR3C API : http://antlr.org/api/C/index.html

Something must be changed to fit your project:

1. All variables containing /.*Lang.*/, change "Lang" to "JavaScript" or your language which your grammar described. (I wrote a JavaScript.g file to describe JavaScript Language Grammar.)

2. Change "LangParser_decl_return" to "JavaScriptParser_program_return", where "JavaScript" is what I said ablow, and where "program" is the first token you define below the "option" token, in Grammar file (JavaScript.g).
ps: You may want to change all "decl" to "program", because "decl" only in file "ANTLR_Examples.zip/C/treeparser/Lang.g"

20101014

Bash: checking if a variable is a number

[code]
# v=1
# [ $v -eq $v ]
# echo $?
0
# v=a
# [ $v -eq $v ]
# echo $?
2
[/code]

Note: "-eq" compares number, but not string.

20100916

Windows 7下IE8即使导入了https证书仍然显示“证书错误”

现象:
Windows XP系统下,使用IE6/IE7/IE8,登录Web管理系统的时候提示证书错误,然后导入证书(自动选择证书存储区),重启IE(或者重启OS),再次登录Web管理系统,则没有提示证书错误。
Windows 7系统下,使用IE8,登录Web管理系统的时候提示证书不被信任,然后导入证书,重启IE(自动选择证书存储区),再次登录Web管理系统,地址栏里面仍然显示"证书错误"。
在证书管理器中比较这两个OS下的https证书存储区发现是不同的。

解决:
Windows 7系统下,使用IE8导入证书的时候请选择存储区为"受信任的根证书办法机构",否则自动选择的存储区。

20100912

IE gives warning when redirect from HTTPS to HTTP

If you use header() method provided by PHP, to redirect from HTTPS to HTTP,
IE will give out a warning, but if you use the code below above othe PHP code, no warning will show.
// =========================================================
<?php                                                                                                                                                                                                     
if($_SERVER['HTTPS'] == "on") {
    $redirect = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    echo "<meta http-equiv=\"refresh\" content=\"0; url=$redirect\">";
    exit();
}
?>
// ==========================================================
The tag "<meta>" will refresh the web page and jump/redirect to another web page.

--
from my gmail