好一个字段匹配我运行:
db.bios.find( { "Country":"Netherlands" } )
Run Code Online (Sandbox Code Playgroud)
我如何携带所有文件而不是带文件"Country":"Netherlands"?
也可以带上所有文件,但没有2个国家?
如何将travis-ci env变量用作Gradle的属性?
我在gradle路径下本地拥有gradle.properties:
sonatypeRepo = abcd
Run Code Online (Sandbox Code Playgroud)
我用的是build.gradle:
uploadArchives {
//more
repository(url: sonatypeRepo) {
// more
}
//more
}
Run Code Online (Sandbox Code Playgroud)
当然它在当地有效.在travis我已经在设置下添加了变量,所以我看到了构建日志:
Setting environment variables from repository settings
$ export sonatypeRepo=[secure]
Run Code Online (Sandbox Code Playgroud)
它失败了:
FAILURE: Build failed with an exception.
* Where:
Build file '/home/travis/build/Diolor/Swipecards/library/build.gradle' line: 49
* What went wrong:
A problem occurred evaluating project ':library'.
> No such property: sonatypeRepo for class: org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer
Run Code Online (Sandbox Code Playgroud)
如何将Travis的env变量用作Grable属性,还可以使用本地构建?
这更像是一个数学问题,而不是编程.
好吧,我想问你知道什么是材料设计中描述的插补器:

它似乎是一个AccelerateDecelerateInterpolator但减速效果衰减得更慢.
我最好的孵化是:
public class MaterialInterpolator implements Interpolator {
@Override
public float getInterpolation(float input) {
if(input<1./3f)
return new AccelerateInterpolator().getInterpolation(input);
else
return new DecelerateInterpolator().getInterpolation(input);
}
}
Run Code Online (Sandbox Code Playgroud)
这会在值之间产生差距:
Time / Value
...
0.3,0.09
0.317,0.100489
0.333,0.110889 <-- gap
0.35,0.57750005
0.367,0.599311
0.383,0.61931103
0.4,0.64
...
Run Code Online (Sandbox Code Playgroud)
减速AccelerateDecelerateInterpolator:
output = accelerateDecelerateInterpolator(decelerateInterpolator(input));
private float accelerateDecelerateInterpolator(float input) {
return (float)(Math.cos((input + 1) * Math.PI) / 2.0f) + 0.5f;
}
private float decelerateInterpolator(float input) {
// return 1.0f - (1.0f - input) * (1.0f - input);
return …Run Code Online (Sandbox Code Playgroud) 我试图onError()在项目中找到遗漏.这意味着应用程序崩溃,因为订阅不处理throwables所以我想找到该订阅并添加onError方法.
不幸的是,堆栈跟踪在这里并没有真正的帮助,它只显示了行,throw new IOException但仅此而已:
FATAL EXCEPTION: main
Process: my.app.example.dev, PID: 20309
java.lang.IllegalStateException: Fatal Exception thrown on Scheduler.Worker thread.
at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:54)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: rx.exceptions.OnErrorFailedException: Error occurred when trying to propagate error to Observer.onError
at rx.observers.SafeSubscriber._onError(SafeSubscriber.java:201)
at rx.observers.SafeSubscriber.onError(SafeSubscriber.java:111)
at rx.android.app.OperatorConditionalBinding$1.onError(OperatorConditionalBinding.java:69)
at rx.internal.operators.NotificationLite.accept(NotificationLite.java:147)
at rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber.pollQueue(OperatorObserveOn.java:177)
at rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber.access$000(OperatorObserveOn.java:65)
at rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber$2.call(OperatorObserveOn.java:153)
at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:47)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method) …Run Code Online (Sandbox Code Playgroud) 我有一个列表,数组或您熟悉的任何语言.例如名称:["John","Bas","Peter"]我想查询该name字段是否与其中一个名称相匹配.
一种方法是使用OR Filter.例如
{
"filtered" : {
"query" : {
"match_all": {}
},
"filter" : {
"or" : [
{
"term" : { "name" : "John" }
},
{
"term" : { "name" : "Bas" }
},
{
"term" : { "name" : "Peter" }
}
]
}
}
}
Run Code Online (Sandbox Code Playgroud)
任何更高级的方式?如果它是一个查询而不是过滤器,那就更好了.
我的一些文档包含一个以status值命名的字段404.我不希望返回这些文件,所以我使用$not运算符:
query = {
"venue_id": venue_id,
"status": {
"$not": 404
}
}
Run Code Online (Sandbox Code Playgroud)
但是我收到一个错误:
OperationFailure: database error: Can't canonicalize query: BadValue
$not needs a regex or a document
Run Code Online (Sandbox Code Playgroud)
这是否因为某些文档具有该字段而发生?我不希望出于速度原因使用正则表达式.如何正确有效地进行此查询?
可以在此处找到Linkedin文档
正如它所说,它需要:
og:title
og:description
og:image
og:url
Run Code Online (Sandbox Code Playgroud)
这是我的wordpress博客源代码的一个例子,为简单起见,我使用Jetpack插件:
<!-- Jetpack Open Graph Tags -->
<meta property="og:type" content="article" />
<meta property="og:title" content="Starbucks Netherlands Intel" />
<meta property="og:url" content="http://lorentzos.com/starbucks-netherlands-intel/" />
<meta property="og:description" content="Today I had some free time at work. I wanted to play more with Foursquare APIs. So the question: "What is the correlation of the Starbucks Chain in the Netherlands?". Methodology: I found all the p..." />
<meta property="og:site_name" content="Dionysis Lorentzos" />
<meta property="og:image" content="http://lorentzos.com/wp-content/uploads/2013/08/starbucks-intel-nl-238x300.png" />
Run Code Online (Sandbox Code Playgroud)
在Facebook它很棒,或者你可以在这里看到元数据.然而,LinkedIn更顽固,甚至没有真正解析数据 …
我可能在这里瞎了一些人,但无论如何我都会开枪.
我知道我能做到:
Class<Response> c = Response.class;
Run Code Online (Sandbox Code Playgroud)
获取对象的类.假设Response对象是Response<T>我想要执行以下操作
Class<Class<User>> c = Response<User>.class;
Run Code Online (Sandbox Code Playgroud)
我的完整问题:
public class RequestHelper<T> extends AsyncTask<String, Response, T> {
@Override
protected T doInBackground(String... strings) {
...
Response <T> r = objectMapper.readValue( result, Response.class );
return r .getResponse();
}
}
//and
public class Response <R> {
private R response;
public R getResponse() {
return response;
}
}
Run Code Online (Sandbox Code Playgroud)
但是上面的参数尚未在赋值中指定.理论上,正确的方法需要:
public class RequestHelper<T> extends AsyncTask<String, Response, T> {
@Override
protected T doInBackground(String... strings) {
...
Response <T> r = objectMapper.readValue( …Run Code Online (Sandbox Code Playgroud) 这是我的代码的基本思想:
HTML(玉):
#preferencesBox(ng-click="toggleCustom()")
.glyphicon.glyphicon-heart
Run Code Online (Sandbox Code Playgroud)
CSS:
#preferencesBox.active{
color: #d04f37;
}
Run Code Online (Sandbox Code Playgroud)
角度:
$scope.check = true;
$scope.toggleCustom = function() {
$scope.check = $scope.check === false ? true: false;
};
Run Code Online (Sandbox Code Playgroud)
我想color : #d04f37在用户点击父级时添加css #preferencesBox.添加/删除.active是jQuery的方式.我的ng-class或其他代码应该如何?
我已经拥有MongoDB并使用Mongoriver安装了Elasticsearch .所以我建立了我的河流:
$ curl -X PUT localhost:9200/_river/database_test/_meta -d '{
"type": "mongodb",
"mongodb": {
"servers": [
{
"host": "127.0.0.1",
"port": 27017
}
],
"options": {
"secondary_read_preference": true
},
"db": "database_test",
"collection": "event"
},
"index": {
"name": "database_test",
"type": "event"
}
}'
Run Code Online (Sandbox Code Playgroud)
我只是想得到country:Canada我尝试过的事件:
$ curl -XGET 'http://localhost:9200/database_test/_search?q=country:Canada'
Run Code Online (Sandbox Code Playgroud)
我得到:
{
"took": 2,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 0,
"max_score": null,
"hits": []
}
}
Run Code Online (Sandbox Code Playgroud)
我在网上搜索,我读到我应该首先用Elasticsearch索引我的收藏(丢失链接).我应该索引我的Mongodb吗?如何从现有的MongoDB集合中获取结果?