小编Dhi*_*kur的帖子

启用nginx Chunked Transfer编码

看起来nginx 0.8.35可能支持分块传输编码:

nginx的变化0.8.35 2010年4月1日

*) Change: now the charset filter runs before the SSI filter.

*) Feature: the "chunked_transfer_encoding" directive.
Run Code Online (Sandbox Code Playgroud)

这很好,因为我试图通过nginx反向代理将git更改推送到git-http-backend进程.由于客户端效率原因, Git HTTP利用了分块传输编码.

但是,我无法让它发挥作用.我在Debian Lenny上使用nginx 0.8.44并进行以下配置调用:

./configure \
--sbin-path=/usr/sbin \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--user=www-data \
--group=www-data \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--with-http_ssl_module \
--with-http_gzip_static_module \
--with-http_realip_module
Run Code Online (Sandbox Code Playgroud)

以下conf文件:

server {
    server_name example.com;
    location / {
        proxy_pass  http://192.168.0.10;
        include     /etc/nginx/proxy.conf;
        chunked_transfer_encoding on;
    }
}
Run Code Online (Sandbox Code Playgroud)

proxy.conf看起来像这样:

proxy_redirect          off;
proxy_set_header        Host $host;
proxy_set_header        X-Real-IP $remote_addr;
proxy_set_header …
Run Code Online (Sandbox Code Playgroud)

nginx chunked-encoding

9
推荐指数
2
解决办法
4万
查看次数

如何获取单击的<a>标记的名称

这是我的HTML代码:

<div class="span4">
<div class="hero-unit" style="padding:10px 10px 10px 10px">
    <div class="accordion" id="accordion2">
        <div class="accordion-group">
            <div class="accordion-heading">
                <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
                North Delhi
                </a>
            </div>
            <div style="height: 0px;" id="collapseOne" class="accordion-body collapse">
                <div class="accordion-inner">
                    <ol>
                        <li><a id='link' href="#" name="Some name1 ">Some link1</a> </li>
                        <li><a id='link' href="#" name="Some name2">Some link2</a> </li>
                    </ol>
                </div>
            </div>
        </div>
    </div>
Run Code Online (Sandbox Code Playgroud)

这是我的jQuery代码

$(document).ready(function() {
    $('#link').click(function() {
        var n = $(this).attr(name); //alerts undefined
        alert(n);
        $('#results').html('&nbsp;').load('/donate/?n=' + n);
    });
});
Run Code Online (Sandbox Code Playgroud)

我的HTML代码有几个带有多个链接的accordion-inner div.我想获取点击链接的name属性.这段代码警告我undefined检查我的jQuery代码,请告诉我我做错了什么?

我是jquery的新手所以请帮助.

javascript jquery

0
推荐指数
1
解决办法
202
查看次数

string [i:length]给出内存错误

def suffix(stng):
    list = []
    length = len(stng)
    for i in range(length):
         x = stng[i:length]   ## This gives a Memory Error..See below
         list.append(x)
    return list
Run Code Online (Sandbox Code Playgroud)

这段代码是我在interviewstreet.com上解决问题的一部分,但是当我提交它时,我得到一个内存错误...我想知道如何纠正它?

这是追溯:

Original exception was:
Traceback (most recent call last):
File "/run-1342184337-542152202/solution.py", line 35, in
listofsuffix=suffix(var)
File "/run-1342184337-542152202/solution.py", line 13, in suffix
x=stng[i:length]
MemoryError
Run Code Online (Sandbox Code Playgroud)

python python-2.7

0
推荐指数
1
解决办法
1272
查看次数

将网站地址http://127.0.0.1:8000/更改为http://www.google.com

如何将默认地址更改为http://127.0.0.1:8000/有用的网站名称.

我正在使用Django附带的开发服务器.

我用Google搜索了大约1个小时但找不到合适的解决方案.我是初学者,所以请帮帮我.

在本地计算机上,如何能够使用主机名而不是环回地址?

python django django-1.3

0
推荐指数
1
解决办法
2384
查看次数