小编Ale*_*ard的帖子

在bootstrap下拉元素上使用intro.js

我无法弄清楚如何在下拉元素上使用intro.js.

我发现了一个类似的问题没有答案:IntroJS Bootstrap菜单不起作用

如果要重现错误,请按照下列步骤操作:

http://recherche.utilitaire.melard.fr/#/carto

你必须点击"Aide"(右上角的绿色按钮),第二步就会出现问题.关于改变事件,我这样做:

$scope.ChangeEvent = function (e) { 
    if (e.id === 'step2') {
        document.getElementById('step1').click();
    } 
    console.log("Change Event called"); 
};
Run Code Online (Sandbox Code Playgroud)

在调试时,一切都像魅力一样工作,直到该函数结束:_showElement之后,我迷失在JQuery事件中,并且关闭了下拉列表......

如果你想重现,只需在_showElement函数的末尾添加一个断点,你就会理解我的意思......

javascript jquery navbar twitter-bootstrap drop-down-menu

23
推荐指数
2
解决办法
4011
查看次数

带文本选择和按钮的bootstrap输入组

我想使用bootstrap css:

引导输入组

我写了一个jsfiddle进行测试:http: //jsfiddle.net/xr4uofje/

<div class="container">
  <div class="col-lg-6">
    <div class="input-group">
      <input class="input-group-addon" size="8" type="text">
      <span class="input-group-btn">
        <select class="form-control"></select>
        <button type="button" class="btn btn-default">Get</button>
      </span>
    </div>
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

css css3 twitter-bootstrap twitter-bootstrap-3

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

elasticsearch得到的结果太多,需要帮助过滤查询

我在理解ES查询系统的基础方面遇到了很多问题.

我有以下查询例如:

{
  "size": 0,
  "query": {
    "bool": {
      "must": [
        {
          "term": {
            "referer": "www.xx.yy.com"
          }
        },
        {
          "range": {
            "@timestamp": {
              "gte": "now",
              "lt": "now-1h"
            }
          }
        }
      ]
    }
  },
  "aggs": {
    "interval": {
      "date_histogram": {
        "field": "@timestamp",
        "interval": "0.5h"
      },
      "aggs": {
        "what": {
          "cardinality": {
            "field": "host"
          }
        }
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

该请求获得了太多结果:

"status":500,"reason":"ElasticsearchException [org.elasticsearch.common.breaker.CircuitBreakingException:数据太大,字段[@timestamp]的数据将大于[3200306380/2.9gb]的限制];嵌套: UncheckedExecutionException [org.elasticsearch.common.breaker.CircuitBreakingException:数据太大,字段[@timestamp]的数据将大于[3200306380/2.9gb]的限制];嵌套:CircuitBreakingException [数据太大,字段数据[@时间戳]将大于[3200306380/2.9gb]]的限制;"

我试过了这个请求:

{
  "size": 0,
  "filter": {
    "and": [
      {
        "term": {
          "referer": "www.geoportail.gouv.fr"
        }
      },
      { …
Run Code Online (Sandbox Code Playgroud)

elasticsearch

8
推荐指数
2
解决办法
6473
查看次数

如何在服务ember.js中注入商店

我试图从初始化器注入商店但没有成功,所以我在我的服务中使用init查询,但我不太喜欢它,我宁愿保持分离并将注入放在初始化器中......

恩伯:1.11.1

Ember数据:1.0.0-beta.16.1

jQuery:1.11.2

不工作:初始化器

//app/initializers/initializer-store.js
export default {
  name: 'initializer-store',
  after: 'store',

  initialize: function(container, application) {
    application.inject('service:mtg-level-service', 'store', 'store:main');
  }
};
Run Code Online (Sandbox Code Playgroud)

工作:服务

//app/services/mtg-level-service.js
import Ember from 'ember';

export default Ember.Service.extend({
  availableIn: ['controllers', 'routes'],
  store: null,

  init: function() {
    this._super();
    this.set('store', this.container.lookup("store:main"));
  }
});
Run Code Online (Sandbox Code Playgroud)

ember.js

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

vagrant:如何从厨师食谱中获取hostonly ip地址?

我试图检索Vagrantfile中指定的hostonly IP地址:

config.vm.network :hostonly, "33.33.33.33"
Run Code Online (Sandbox Code Playgroud)

在食谱文件中:

mycookbook /文件/默认/ xdebug.ini

[xdebug]
zend_extension = "/usr/lib/php/modules/xdebug.so"
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "***HERE***"
xdebug.trace_output_dir = "/tmp"
xdebug.max_nesting_level = 200
Run Code Online (Sandbox Code Playgroud)

chef-infra vagrant

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

elasticsearch日期范围昨天得到

我正在寻找一种从"昨天"获取数据的方法,而不是:

"range" : {
    "price" : {
        "gt" : "2014-11-24",
        "lt" : "2014-11-26"
    }
}
Run Code Online (Sandbox Code Playgroud)

我想要像:

"range" : {
    "price" : {
        "eq" : "2014-11-25"
    }
}
Run Code Online (Sandbox Code Playgroud)

有人认为这可能吗?

我想的是:

"range" : {
    "price" : {
        "gt" : "now-2d",
        "lt" : "now"
    }
}
Run Code Online (Sandbox Code Playgroud)

但我想从00:00 am00:00 pm获取数据

elasticsearch

6
推荐指数
2
解决办法
7021
查看次数

单元测试Symfony2

我正在尝试使用Mockery来对我的sf2功能进行单元测试.我对我的第一次尝试感到不安.

首先尝试测试使用安全上下文的类:

public function setSecurityContext(SecurityContext $securityContext)
{
    $this->securityContext = $securityContext;
    try {
        $this->isLoggedIn = $securityContext->isGranted('IS_AUTHENTICATED_FULLY');
        $this->user = $securityContext->getToken()->getUser();
    } catch (\Exception $e) {
        $this->isLoggedIn = false;
        $this->user = $securityContext->getToken()->getUser();
    }
}
Run Code Online (Sandbox Code Playgroud)

我创建一个testsetSecurityContext函数,如下所示:

public function testsetSecurityContext()
{
    /* @var $securityContext SecurityContext */
    $securityContext = m::mock('Symfony\Component\Security\Core\SecurityContext');

    $securityContext->shouldReceive('isGranted')
    ->with('IS_AUTHENTICATED_FULLY')
    ->once()
    ->andReturn(true);

    $factory = m::mock('Knp\Menu\FactoryInterface');

    $menu = new MenuBuilder($factory);

    $menu->setSecurityContext($securityContext);
}
Run Code Online (Sandbox Code Playgroud)

运行单元测试时,我收到错误:

testsetSecurityContext

Mockery\Exception:方法isGranted标记为final,并且无法生成定义了此类方法的模拟对象.您应该将此对象的实例传递给Mockery以创建部分模拟.

所以我相应地改变了我的测试功能:

public function testsetSecurityContext()
{
    /* @var $securityContext SecurityContext */
    $securityContext = m::mock(new \Symfony\Component\Security\Core\SecurityContext());
    /* ... skipped ... …
Run Code Online (Sandbox Code Playgroud)

php phpunit symfony mockery

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

NGINX:当 proxy_pass 失败时提供静态文件

我有一个运行 nginx 的前端,它将请求代理到运行 Web 服务的后端。如果后端服务关闭,我想提供一个静态文件。

这是我正在使用的配置文件:

location ~ /api/admin {
        rewrite /xxxx/(.+) /$1 break;
        error_page 404 502 =200 /themes/yyyy/themes.json;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        add_header Access-Control-Allow-Credentials true;
        add_header Access-Control-Allow-Origin '*';
        add_header Access-Control-Allow-Methods 'GET, POST';
        proxy_intercept_errors on;
        proxy_pass http://xxxx;
}

location = /themes/yyyy/themes.json {
        rewrite /themes/yyyy/themes.json /api/admin/thematics/edito;
}
Run Code Online (Sandbox Code Playgroud)

当我打电话时:

http://url/themes/geoportail/themes.json
Run Code Online (Sandbox Code Playgroud)

我从 nginx 收到 502 错误,而不是 200 和静态文件...

2014/08/25 17:02:35 [error] 13551#0: *6719 connect() failed (111: Connection refused) while connecting to upstream, client: 160.92.103.160, server: uri, request: "GET …
Run Code Online (Sandbox Code Playgroud)

nginx

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