小编Cyr*_*ian的帖子

Material Design Angular md-autocomplete remote

在材料设计中自动完成(https://material.angularjs.org/#/demo/material.components.autocomplete)所有示例都显示如何从局部变量获取数据.通过AJAX调用完成自动完成没有任何帮助.

angularjs material-design

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

如果一个节点关闭,请禁用ElasticSeach重新平衡

想象一下我的情况

  • 3(AWS)节点
  • 索引(让我们称之为朋友)有3个分片和1个副本.

S1(索引朋友主要分片1)

S2(索引朋友主要碎片2)

S3(索引朋友主要分片3)

R1(碎片1的复制品)

R2(碎片2的复制品)R3(碎片3的复制品)

假设Node1有(S1 R2)并且是主节点

Node2具有(S2 R3)
Node3具有(S3 R1)

现在,如果由于连接故障,节点2发生故障.

将发生负载平衡,节点1将升级副本(R2)作为主要,并且将在Node3中创建(R2)的新副本

最后在负载平衡之后就会如此

Node1具有(S1 S2,R3)
Node3具有(S3 R1,R2)

在此重新平衡期间,重型IO操作发生,弹性搜索运行状况将变为红色 - >黄色,然后是绿色.

我的要求是,如果节点2关闭,节点必须不再平衡.如果查询结果显示仅来自shard S1和S3的结果,我很好.当节点2再次返回时,不会发生重新平衡.

sharding elasticsearch

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

在d3.js中调整图像大小时如何不保留纵横比

我有以下HTML:

<div id="MainDiv"></div>
Run Code Online (Sandbox Code Playgroud)

和Javascript代码:

    var cursor;
    var width, height;
    var testSVG = {
        x: 0,
        y: 0,
        id: 0,
        image: "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2f/Small_Flag_of_the_United_Nations_ZP.svg/488px-Small_Flag_of_the_United_Nations_ZP.svg.png",
        width: 280,
        height: 140
    };
    var svgContainer = d3.select("#MainDiv").append("svg").attr({
        width: 1920,
        height: 1080,
        version: 1.1,
        xmlns: "http://www.w3.org/2000/svg",
        viewBox: "-40, -40, 2000, 1160",
        "class": "GraphicDesigner"
    });

    createSVG(svgContainer, testSVG);

    function createSVG(container, object) {
        var d = [{
            x: object.x,
            y: object.y,
            moveX: object.x,
            movey: object.y
        }];
        var svgObjectGroup = container.data(d).append("g").attr("transform", function (d) {
            return "translate(" + d.x + "," + d.y …
Run Code Online (Sandbox Code Playgroud)

javascript svg d3.js

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

选项卡的语义UI回调

我指的是此文档:http : //semantic-ui.com/modules/tab.html#/settings

根据文档,我应该能够在可见的选项卡上执行回调。但是我遗漏了一些要点,因此没有发出警告。

这是一个工作代码段:http : //codepen.io/anon/pen/YXvXKG

我的JS

$('.top.menu .item').tab({'onVisible':function(){alert("Called")}});
Run Code Online (Sandbox Code Playgroud)

感谢有人可以帮助我!

javascript semantic-ui

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

为什么Java ExecutorService执行采用新的Runnable实现

在下面的指定代码段中:

private ExecutorService executor = Executors.newFixedThreadPool(2); //create a fixed thread pool

executor.execute(new Thread(() -> foo()));
executor.execute(new Thread(() -> foo()));
executor.execute(new Thread(() -> foo()));


Run Code Online (Sandbox Code Playgroud)

在上面的示例中,创建了2个或3个线程有多少个?

  • 2:因为执行程序池大小为2。
  • 3:如代码中所示,我执行了3次新线程。

为什么不executor.execute(Callable);呢?

java multithreading

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