小编pd4*_*d40的帖子

支持ELB的双向TLS/HTTPS

使用Amazon Elastic Load Balancing的一种方式(或服务器端)TLS/HTTPS已有详细记录

从文档中可以清楚地看到对双向(或客户端)TLS/HTTPS的支持.

假设ELB正在终止TLS/HTTPS连接:

  1. ELB是否支持客户端经过身份验证的 HTTPS连接?
  2. 如果是这样,ELB服务的服务器是否收到一个X-Forwarded-*标头来识别ELB认证的客户端?

ELB确实支持TCP转发,因此EC2托管服务器可以建立双向TLS/HTTPS连接,但在这种情况下,我对ELB终止TLS/HTTPS连接和识别客户端感兴趣.

authentication ssl amazon-web-services two-way amazon-elb

26
推荐指数
1
解决办法
2万
查看次数

RequireJS加载脚本文件但传递的引用未定义

我有以下requireJS配置.当试图引用包/ ImagingX模块时,我总是得到未定义,即使我可以看到脚本已经加载到firebug中.如果我将有问题的js文件移动到baseUrl目录并删除package /它按预期工作.

我究竟做错了什么?

window.requirejs.config(
        {
            baseUrl: '/Scripts',
            paths: {
                "jquery": "./jquery-1.7.1.min",
                "jqx": "/Content/Plugins/jqWidgets",
                "package" : "/Scripts/packages"
            },
            urlArgs: "bust=" + (new Date()).getTime(),
            shim : {
                'jqx/jqxcore': ['jquery'],
                'jqx/jqxsplitter': ['jquery','jqx/jqxcore']
            }
        }
    );

    window.require(['jquery', 'layoutManager', 'container', 'package/ImagingX'],
        function ($,lm,container,px) {

            px.Focus();

            $(document).ready(function () {
                lm.Init(); // Sets up panes
                container.Init(); //Set up the containers
            });
    });
Run Code Online (Sandbox Code Playgroud)

更新15/10/2012

我现在急需解决这个问题,我已经把所有内容都删回了基础,所以这里是新的主文件:

(function () {

    requirejs.config({
        paths: {
            "packages": "packages"
        }
    });

    require([
            'packages/testmodule'
        ],
        function (tm) {
                alert(tm);
    });

})();
Run Code Online (Sandbox Code Playgroud)

以及名为packages的子文件夹中的模块.

define('testmodule',
function …
Run Code Online (Sandbox Code Playgroud)

amd requirejs

6
推荐指数
1
解决办法
2779
查看次数

4
推荐指数
1
解决办法
1225
查看次数

Python中数字向量或数字列表的平均值

我是Python的新手,所以请忍受我天真的问题.

我想写一个函数,它接受一个数字向量并计算它们的平均值.所以我写了一个小功能

def my_mean(*args):
    if len(args) == 0:
        return None
    else:
        total = sum(args)
        ave = 1.0 * total / len(args)
        return ave

my_mean(1, 2, 3)
2.0
Run Code Online (Sandbox Code Playgroud)

但是如果参数是数字列表,则此函数将不起作用.例如,

my_mean([1, 2, 3])
Traceback (most recent call last):
  File "/usr/lib/wingide-101-4.1/src/debug/tserver/_sandbox.py", line 1, in <module>
    # Used internally for debug sandbox under external interpreter
  File "/usr/lib/wingide-101-4.1/src/debug/tserver/_sandbox.py", line 21, in my_mean
TypeError: unsupported operand type(s) for +: 'int' and 'list'
Run Code Online (Sandbox Code Playgroud)

我知道NumPy有一个函数numpy.mean,它将列表作为参数,但不是数字向量my_mean.

我想知道是否有办法my_mean在这两种情况下都能开展工作?所以:

my_mean(1, 2, 3)
2.0 …
Run Code Online (Sandbox Code Playgroud)

python average function

3
推荐指数
1
解决办法
431
查看次数

如果对象可能未定义,则检查JavaScript对象值的最佳方法

我有一个textarea我附加了模糊事件.如果用户点击span.dontClick页面上的特定内容,我不希望运行模糊事件.但是,如果用户点击除了span.dontClick我希望运行模糊事件之外的任何其他内容.我找到了一种方法来做到这一点,但它看起来很糟糕,感觉非常hackey,而且我猜测那里有更好的解决方案.这是我想出的:

if (event.type === 'focusout') {
  if (
    typeof event.originalEvent !== 'undefined' &&
    typeof event.originalEvent.currentTarget !== 'undefined' &&
    typeof event.originalEvent.currentTarget.activeElement !== 'undefined' &&
    typeof event.originalEvent.currentTarget.activeElement.className !== 'undefined' &&
    event.originalEvent.currentTarget.activeElement.className === 'dontClick'
  ) {
    // abort the code for the blur event (in effect, do nothing)
  }
  else {
    // run code for when a user blurs by not clicking on span
  }
Run Code Online (Sandbox Code Playgroud)

应该注意,该event对象来自jQuery事件处理程序.我不确定它是否与本机event对象不同或相同.

还应该注意的是,对于大多数浏览器而言,这会无声地失败,但是如果我没有为每个对象指定"未定义"状态,我会在IE中获得一个调试窗口......

如果有人有一个更优雅的解决方案,我真的很感激看到它.谢谢!

javascript jquery

3
推荐指数
1
解决办法
594
查看次数