小编Jen*_*sen的帖子

连接到AWS EC2上的redis服务器

我正在尝试连接到EC2上运行的redis服务器.我取消注释redis conf文件中的绑定行.

>> netstat -nlpt | grep 6379
tcp        0      0 0.0.0.0:6379            0.0.0.0:*               LISTEN      -
Run Code Online (Sandbox Code Playgroud)

但我仍然无法使用以下命令连接到它:

redis-cli -h ec2-xx-xx.us-west-1.compute.amazonaws.com -p 6379
Run Code Online (Sandbox Code Playgroud)

我错过了什么吗?我可以通过ssh连接ec2盒子:

ssh -i ~/.ec2/ec2.pem ubuntu@ec2-xx-xx.us-west-1.compute.amazonaws.com
Run Code Online (Sandbox Code Playgroud)

谢谢

remote-access amazon-ec2 amazon-web-services redis

5
推荐指数
1
解决办法
7134
查看次数

如何在textarea的右上角创建一个固定的浮动按钮

我想写下面的内容:

|------------------------------------------------------|</br>
|td                                                    |
| |--------------------------------------------------| |
| |textarea                          floating button | |
| |                                                  | |
| |                                                  | |
| |                                                  | |
| |                                                  | |
| |                                                  | |
| |--------------------------------------------------| |
|------------------------------------------------------|  
Run Code Online (Sandbox Code Playgroud)

outter是td元素,textarea在里面.我想在textarea或td的右上角有一个固定的浮动按钮.而这个textarea和td落后于这个浮动按钮.我尝试使用z-index来做到这一点,但没有用.

该按钮也是一个下拉菜单.

有人能告诉我如何实现这个吗?

谢谢

html css

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

已调用 cursorUpdate,但未更新光标

我已经为此工作了几个小时,不知道出了什么问题。我想要一个按钮的自定义光标,它是 NSTextView 的子视图,我添加了一个跟踪区域并在鼠标输入按钮时发送 cursorUpdate 消息。

每次鼠标进入跟踪区域时都会调用 cursorUpdate 方法。但光标停留在 IBeamCursor。

有任何想法吗?

Apple Docs 的参考:管理光标更新事件

- (void)cursorUpdate:(NSEvent *)event {
    [[NSCursor arrowCursor] set];
}

- (void)myAddTrackingArea {
    [self myRemoveTrackingArea];

    NSTrackingAreaOptions trackingOptions = NSTrackingCursorUpdate | NSTrackingMouseEnteredAndExited | NSTrackingActiveInKeyWindow;
    _trackingArea = [[NSTrackingArea alloc] initWithRect: [self bounds] options: trackingOptions owner: self userInfo: nil];
    [self addTrackingArea: _trackingArea];
}

- (void)myRemoveTrackingArea {
    if (_trackingArea)
    {
        [self removeTrackingArea: _trackingArea];
        _trackingArea = nil;
    }
}
Run Code Online (Sandbox Code Playgroud)

cocoa cursor nstextview nscursor

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

加速numpy矩阵逆

我正在使用Numpy/Scipy来反转20k矩阵,这很慢.我试过了:

(1) M_inv = M.I

(2) Ident = np.Identity(len(M))
    M_inv = scipy.linalg.solve(M, Ident)

(3) M_inv = scipy.linglg.inv(M)
Run Code Online (Sandbox Code Playgroud)

但没有看到任何加速.

还有其他方法可以加快速度吗?

performance numpy matrix linear-algebra matrix-inverse

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

jquery中.id和.attr('id')之间的区别是什么

var x = $(this).parent().parent().parent().parent();
Run Code Online (Sandbox Code Playgroud)

x.id给我的undefined同时x.attr('id')返回正确的id.

谁能告诉我这两者之间的区别.顺便问一下,有没有更好的方法$(this).parent().parent().parent().parent(),我不想给他们分配ID,因为这会使得更难以使用这些元素.

谢谢

jquery identity element this attr

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

如何在我的网页中制作图像无法下载

我想知道如何通过右键单击我的网页上的图像来阻止人们将图像另存为..

我正在考虑禁用右键单击,但似乎我必须编写javascript代码.有一个简单的方法来做到这一点?

webpage image download

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

如何让jQuery插件函数返回内在价值

我使用以下模式编写一个jquery插件,我希望bar函数返回内部值,但似乎总是返回$(this).
代码有什么问题吗?

(function($){

    var Foo = function(elements, options){
    ... ...
    }


    Foo.prototype = {

        constructor: Foo,

        bar: function(){
            var value = ...        
            // do something here
            return value;
        },

    }

    $.fn.foo = function (option, kwargs){  
        return this.each(function(){ 
            var $this = $(this),
                data = $this.data('foo'),
                options = typeof option == 'object' && option

            if (!data) $this.data('foo', (data = new Foo(this, options)))
            if (typeof option == 'string') return data[option](kwargs)
        })            
    }


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

jquery this return-value jquery-plugins

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

如何在Pyramid/Pylon中返回javascript

如何在Pyramid/Pylon框架中返回一些带有视图callables的javascript代码或javascript文件?

javascript python pyramid

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

setTimeout - 立即执行回调?

我想让一个元素淡入,并在它消失之前在页面上停留7秒.我可以随时取消它.我定义了以下功能.但是当我打电话时info_timeout.setup(ele, 'some msg here'),电子元件刚刚消失并立即消失.

我错过了什么吗?

var info_timeout = {
show_info: function(){
    this.ele.html(this.msg).fadeIn('normal');
    this.id = setTimeout(this.hide_info(), 7000);
},
hide_info: function(){
    console.log(this.ele, this.id);
    this.ele.fadeOut('slow');
    delete this.id;
},
setup: function(ele, msg) {
    this.ele = ele;
    this.msg = msg;
    this.cancel();
    this.show_info();
},
cancel: function() {
    if(typeof this.timeoutID == "number") {
        clearTimeout(this.id);
        delete this.id;
    }
}
Run Code Online (Sandbox Code Playgroud)

};

谢谢.

javascript timeout clear settimeout

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