头里面的
Content-Type: application/x-www-form-urlencoded
..坑了我两个小时(我渣不要鄙视我)
JavaScript回锅笔记
- Variables created without the keyword var, are always global, even if they are created inside a function.
- A closure is a function having access to the parent scope, even after the parent function has closed.
- A JavaScript function can be invoked without being called.
-
Accessing a function without () will return the function definition:.
<script> function toCelsius(f) { return (5/9) * (f-32); } document.getElementById("demo").innerHTML = toCelsius; </script>
输出:
function toCelsius(f) { return (5/9) * (f-32); }
- Avoid String, Number, and Boolean objects. They complicate your code and slow down execution speed.
- If you assign a value to a variable that has not been declared, it will automatically become a GLOBAL variable, even if it is executed inside a function. Do NOT create global variables unless you intend to.
- In HTML, the global scope is the window object: All global variables belong to the window object.
-
Your global variables (or functions) can overwrite window variables (or functions).
Any function, including the window object, can overwrite your global variables and functions. - W3Schools JavaScript Reference HTML DOM Events
-
You can also break up a code line within a text string with a single backslash:
document.getElementById("demo").innerHTML = "Hello \ Dolly!";
(The \ method is not a ECMAScript (JavaScript) standard.Some browsers do not allow spaces behind the \ character.)
- Integers (numbers without a period or exponent notation) are considered accurate up to 15 digits. The maximum number of decimals is 17, but floating point arithmetic is not always 100% accurate:
- In JavaScript, all data types have a valueOf() and a toString() method.
- JavaScript counts months from 0 to 11. January is 0. December is 11.
- Bit operators work on 32-bit numbers.
- The constructor property returns the constructor function for all JavaScript variables.
- The unary + operator can be used to convert a variable to a number:
-
5 + null // returns 5 because null is converted to 0
"5" + null // returns "5null" because null is converted to "null"
"5" + 2 // returns 52 because 2 is converted to "2"
"5" - 2 // returns 3 because "5" is converted to 5
"5" * "2" // returns 10 because "5" and "2" are converted to 5 and 2 - Complete JavaScript RegExp Reference
- Hoisting is JavaScript’s default behavior of moving all declarations to the top of the current scope (to the top of the current script or the current function).
- Do not use tabs (tabulators) for indentation. Different editors interpret tabs differently.
- Avoid global variables, avoid new, avoid ==, avoid eval()
JavaScript里的奇葩语法
排名不分先后。
-
"1234"+5
的结果是"12345"
, 而"1234"-4
的结果却是1230
.4+"1234"
的结果是"41234"
, 而4-"1234"
的结果是NaN
. -
true==2
的结果是false
,false==2
的结果也是false
. -
typeof null
的结果是"object"
. -
对于
str.slice(start, end)
,如果参数大于等于0,则结果不包括end
指示的字符;如果参数小于0,则结果不包括start
指示的字符. -
var x = 0.2 + 0.1; // x will be 0.30000000000000004
-
typeof NaN; // returns "number"
var x = NaN + "5"; var y = Infinity + "3"; // x will be "NaN5", and y will be "Infinity3"
-
0 < Number.MIN_VALUE // true
-
var txt = "";
var person = ["23", "12f", 2];
var x;
for (x in person) {
txt += typeof x + " ";
}
最成txt为string string string
git使用简易指南
git使用简易指南原文链接
中文电子书下载
留存后用。
Ubuntu安装MCrypt包后php仍提示缺少mcrypt扩展的解决方案
使用以下命令安装php的mcrypt扩展后,
$ sudo apt-get install php5-mcrypt
高兴地使用了mcrypt_*
函数,结果php告诉我:
PHP Fatal error: Call to undefined function mcrypt_encrypt() in .../encrypt.php on line 26
让我很是郁闷,明明装了mcrypt扩展。
我在/etc/php5/mods-available
目录下看到了mcrypt.ini
,无意中进了/etc/php5/apache2/conf.d
目录,看到了很多”05-“、”10-“等开头的文件,后面跟的好象是模块名,但是没有mcrypt.ini,于是我照着这些文件名创建了一个到/etc/php5/mods-available/mcrypt.ini
的软链接:
$ cd /etc/php5/apache2/conf.d $ sudo ln -s ../../mods-available/mcrypt.ini ./20-mcrypt.ini
再重启Apache
$ sudo /etc/init.d/apache2 restart
回去一看,问题没有了。
Linux服务器用Dropbox开发者应用程序接口{Developer API}实现自动备份
Dropbox开发者文档见: https://www.dropbox.com/developers
好像不需要再说什么..记得在应用控制台{App Console}里创建一个应用{app}
这里有个简易的用python实现的小程序仅供参考 。