做IT,别浮躁。。。
Pages: 1/278 First page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 Next page Final page [ View by Articles | List ]
5月21
有时听几首不错的曲子让人很安静,静静的思考问题,这是很好的,也是难得的!
班得瑞《haven on earth》


班得瑞的《莱茵河波影》
5月17
A new beginning……
Highslide JS
5月13
The jqXHR objects returned by $.ajax() as of jQuery 1.5 implement the Promise interface, giving them all the properties, methods, and behavior of a Promise (see Deferred object for more information). These methods take one or more function arguments that are called when the $.ajax() request terminates. This allows you to assign multiple callbacks on a single request, and even to assign callbacks after the request may have completed. (If the request is already complete, the callback is fired immediately.) Available Promise methods of the jqXHR object include:

jqXHR.done(function( data, textStatus, jqXHR ) {});
An alternative construct to the success callback option, the .done() method replaces the deprecated jqXHR.success() method. Refer to deferred.done() for implementation details.

jqXHR.fail(function( jqXHR, textStatus, errorThrown ) {});
An alternative construct to the error callback option, the .fail() method replaces the deprecated .error() method. Refer to deferred.fail() for implementation details.

jqXHR.always(function( data|jqXHR, textStatus, jqXHR|errorThrown ) { });
An alternative construct to the complete callback option, the .always() method replaces the deprecated .complete() method.

In response to a successful request, the function's arguments are the same as those of .done(): data, textStatus, and the jqXHR object. For failed requests the arguments are the same as those of .fail(): the jqXHR object, textStatus, and errorThrown. Refer to deferred.always() for implementation details.

jqXHR.then(function( data, textStatus, jqXHR ) {}, function( jqXHR, textStatus, errorThrown ) {});
Incorporates the functionality of the .done() and .fail() methods, allowing (as of jQuery 1.8) the underlying Promise to be manipulated. Refer to deferred.then() for implementation details.

Deprecation Notice: The jqXHR.success(), jqXHR.error(), and jqXHR.complete() callbacks are deprecated as of jQuery 1.8. To prepare your code for their eventual removal, use jqXHR.done(), jqXHR.fail(), and jqXHR.always() instead.

The this reference within all callbacks is the object in the context option passed to $.ajax in the settings; if context is not specified, this is a reference to the Ajax settings themselves.

For backward compatibility with XMLHttpRequest, a jqXHR object will expose the following properties and methods:

readyState
status
statusText
responseXML and/or responseText when the underlying request responded with xml and/or text, respectively
setRequestHeader(name, value) which departs from the standard by replacing the old value with the new one rather than concatenating the new value to the old one
getAllResponseHeaders()
getResponseHeader()
statusCode()
abort()
No onreadystatechange mechanism is provided, however, since done, fail, always, and statusCode cover all conceivable requirements.

Callback Function Queues

The beforeSend, error, dataFilter, success and complete options all accept callback functions that are invoked at the appropriate times.

As of jQuery 1.5, the fail and done, and, as of jQuery 1.6, always callback hooks are first-in, first-out managed queues, allowing for more than one callback for each hook. See Deferred object methods, which are implemented internally for these $.ajax() callback hooks.

The callback hooks provided by $.ajax() are as follows:

beforeSend callback option is invoked; it receives the jqXHR object and the settings object as parameters.
error callback option is invoked, if the request fails. It receives the jqXHR, a string indicating the error type, and an exception object if applicable. Some built-in errors will provide a string as the exception object: "abort", "timeout", "No Transport".
dataFilter callback option is invoked immediately upon successful receipt of response data. It receives the returned data and the value of dataType, and must return the (possibly altered) data to pass on to success.
success callback option is invoked, if the request succeeds. It receives the returned data, a string containing the success code, and the jqXHR object.
Promise callbacks — .done(), .fail(), .always(), and .then() — are invoked, in the order they are registered.
complete callback option fires, when the request finishes, whether in failure or success. It receives the jqXHR object, as well as a string containing the success or error code.

官方文档写的很详细:http://api.jquery.com/jquery.ajax/

注意:complete和error时的textStatus不一样。



5月13
使用nginx搭建https服务器,最近在研究nginx,整好遇到一个需求就是希望服务器与客户端之间传输内容是加密的,防止中间监听泄露信息,但是去证书服务商那边申请证书又不合算,因为访问服务器的都是内部人士,所以自己给自己颁发证书,忽略掉浏览器的不信任警报即可。下面是颁发证书和配置过程。

首先确保机器上安装了openssl和openssl-devel

至此证书已经生成完毕,下面就是配置nginx

然后重启nginx即可。

ps: 如果出现“[emerg] 10464#0: unknown directive "ssl" in /usr/local/nginx-0.6.32/conf/nginx.conf:74”则说明没有将ssl模块编译进nginx,在configure的时候加上“--with-http_ssl_module”即可^^

至此已经完成了https服务器搭建,但如何让浏览器信任自己颁发的证书呢?

今天终于研究捣鼓出来了,只要将之前生成的server.crt文件导入到系统的证书管理器就行了,具体方法:

控制面板 -> Internet选项 -> 内容 -> 发行者 -> 受信任的根证书颁发机构 -> 导入 -》选择server.crt
5月13
Highslide JS
HTTP请求方法并不是只有GET和POST,只是最常用的。据RFC2616标准(现行的HTTP/1.1)得知,通常有以下8种方法:OPTIONS、GET、HEAD、POST、PUT、DELETE、TRACE和CONNECT。

使用node作为apiserver提供数据,h5ajax请求是无论如何过不了,
Highslide JS
试探请求

Highslide JS
真实请求

最终为node只支持了post和get,而没有对request method为options的请求做处理
添加如下代码搞定问题

5月2
4月27
Quotation

在Node.js 5.0发布近6个月之后,Node.js基金会终于正式发布了带2年长期支持(LTS)的Node.js 6.0版本。根据Node.js基金会的LTS计划,Node.js 6.x能够在2018年4月前收到正式支持,而维护更新则会延续至2019年4月。随着今日新版本的发布,该基金会也结束了对0.12旧分支的LTS支持。其正式支持的版本为4.x和6.x,而此前5.x版本则是给即将到来的6.x版本做测试铺垫的。

Highslide JS
Node.js 4.x的长期支持会在2017年4月截止,因而大家还有充足的时间切换到6.0x版本。2016年10月之前,Version 0.10和0.12只会收到维护更新;之后会在2016年12月迎来EoL(生命周期终止)。
Highslide JS
node-js-version-6-released-with-long-term-support-503452-3.png
值得一提的是,Node.js 6覆盖了93%的ECMAScript 6(发布于去年6月的JavaScript 2015标准)特性。相比之下,Node.js 5x仅支持56%的ES6标准。
团队还隆重介绍了全新的模块加载系统,据说速度是Node.js 4.x的四倍以上。其它显著变动还有Node.js 6已经切换到使用Google V8 5.0版本(作为Node的JavaScript引擎),以及大量bug修复和性能改进。
[编译自:Soft Pedia]
Tags:
Pages: 1/278 First page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 Next page Final page [ View by Articles | List ]