包装枚举是否有Java 约定?如果没有最佳做法?我应该将它们全部放在一个包"myapp.enum"中,还是应该将每个枚举放在相关的包中?
我从docker运行kibana 5.2.1.我正在使用这个图像:FROM docker.elastic.co/kibana/kibana:5.2.1
问题是如果我移除容器,在kibana上完成的工作将会丢失.如何在docker实例上保存kibana仪表板?
我可以使用泊坞窗卷吗?如果是容器中的哪个文件夹存储kibana数据,那么我可以将它映射到本地文件夹.
谢谢!
我将Docker版本升级到最新版本,我收到此错误:
来自流中守护程序的错误:获取日志时出错:无效字符'\ x00'正在查找值的开头
我无法使用以下方式读取日志:
docker-compose logs -f myservice
Run Code Online (Sandbox Code Playgroud)
也不是:
docker logs -f 6f454c73ff9c
Run Code Online (Sandbox Code Playgroud)
Docker版本的输出:
Client:
Version: 17.09.0-ce
API version: 1.32
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:42:18 2017
OS/Arch: linux/amd64
Server:
Version: 17.09.0-ce
API version: 1.32 (minimum version 1.12)
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:40:56 2017
OS/Arch: linux/amd64
Experimental: false
Run Code Online (Sandbox Code Playgroud)
Docker信息的输出:
Containers: 11
Running: 11
Paused: 0
Stopped: 0
Images: 8
Server Version: 17.09.0-ce
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing …
Run Code Online (Sandbox Code Playgroud) 我在SpagoBI下使用groovy脚本.我想使用聚合.我想要例如执行以下聚合:
db.myCollection.aggregate(
[
{
$group : {
_id : { day: { $dayOfMonth: "$recvTime" } }
}
}
]
)
Run Code Online (Sandbox Code Playgroud)
我试过了:
DBObject projectFields = new BasicDBObject('$dayOfMonth',"recvTime");
DBObject project=new BasicDBObject('$project',projectFields)
DBObject groupFields = new BasicDBObject( "_id",project);
DBObject group = new BasicDBObject('$group', groupFields);
iterable = db.getCollection('myCollection').aggregate(group)
Run Code Online (Sandbox Code Playgroud)
我收到了这个错误:
An unexpected error occured while executing dataset: { "serverUsed" : "192.168.1.160:27017" , "errmsg" : "exception: invalid operator '$project'" , "code" : 15999 , "ok" : 0.0}
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
更新:在Mongo shell中执行的查询
db['cygnus_/kurapath_enocean_power_enocean'].aggregate(
... [
... {
... …
Run Code Online (Sandbox Code Playgroud) 我正在 Docker 上使用 MQTT 插件运行 RabbitMQ。我的 Docker 文件是:
FROM rabbitmq
RUN rabbitmq-plugins enable --offline rabbitmq_management
RUN rabbitmq-plugins enable --offline rabbitmq_mqtt
EXPOSE 15671 15672
EXPOSE 1883
Run Code Online (Sandbox Code Playgroud)
如何确保与 MQTT 插件的连接安全?例如,对于身份验证,可以将 MQTT 适配器配置为使用用户名/密码allow_anonymous
如何更改 RabbitMQ docker 镜像配置?
谢谢!
我的服务被正确地绑定到我的第一个活动但是当我尝试将它绑定到第二个活动时它不起作用这是onresume的代码和我的第一个活动的暂停
@Override
protected void onResume() {
super.onResume();
connection = new ServiceConnection() {
@Override
public void onServiceDisconnected(ComponentName name) {
service = null;
}
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
shareInfos.this.service = (IService) service;
}
};
bindService(new Intent(this, shareInfos.class), connection,
Context.BIND_AUTO_CREATE);
}
@Override
protected void onPause() {
super.onPause();
if (service != null) {
service = null;
unbindService(connection);
}
}
Run Code Online (Sandbox Code Playgroud)
我对第二个活动做了同样的事情,但是当我尝试使用该服务时,它始终为null这是我的第二个活动的代码:
@Override
protected void onResume() {
super.onResume();
connection = new ServiceConnection() {
@Override
public void onServiceDisconnected(ComponentName name) {
service = null; …
Run Code Online (Sandbox Code Playgroud) 我正在寻找一个支持EEP的EnOcean JAVA库:D2-01-08,或者用于添加新的EEP profil并且在USB 300和EnOcean PI两种设备上都可以使用的文档.
我发现:https: //github.com/aleon-GmbH/aleoncean 但不幸的是它不支持文档中提到的EnOcean Pi.
以及:https: //github.com/dog-gateway/enj-library ,我还没有测试过,有人测试了吗?还是有人和另一个图书馆合作过?
非常感谢你的帮助!
我正在使用Jetty开发我的客户端应用程序端.我没有在服务器部分使用Jetty.我需要在客户端配置什么才能使用Jetty客户端发送"https"请求?
这就是我为HTTP客户端做的事情:
httpClient = new HttpClient();
// Configure HttpClient
httpClient.setFollowRedirects(false);
httpClient.start();
Request request = httpClient.newRequest(url);
//code
httpClient.stop();
Run Code Online (Sandbox Code Playgroud)
如果我尝试使用"https"发送请求,则会出现此异常:
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at org.eclipse.jetty.client.util.FutureResponseListener.getResult(FutureResponseListener.java:118)
at org.eclipse.jetty.client.util.FutureResponseListener.get(FutureResponseListener.java:101)
at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:653)
at egm.httpClient.jetty.TestBackend.POST(TestBackend.java:204)
at egm.httpClient.jetty.TestStep.execute(TestStep.java:77)
at egm.httpClient.jetty.TestSuite.execute(TestSuite.java:57)
at egm.httpClient.jetty.TestLauncher.main(TestLauncher.java:139)
Caused by: java.lang.NullPointerException
at org.eclipse.jetty.io.ssl.SslClientConnectionFactory.newConnection(SslClientConnectionFactory.java:57)
at org.eclipse.jetty.client.AbstractHttpClientTransport$ClientSelectorManager.newConnection(AbstractHttpClientTransport.java:187)
at org.eclipse.jetty.io.ManagedSelector.createEndPoint(ManagedSelector.java:411)
at org.eclipse.jetty.io.ManagedSelector.access$1600(ManagedSelector.java:56)
at org.eclipse.jetty.io.ManagedSelector$CreateEndPoint.run(ManagedSelector.java:587)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:213)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.execute(ExecuteProduceConsume.java:101)
at org.eclipse.jetty.io.ManagedSelector.run(ManagedSelector.java:136)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)
at java.lang.Thread.run(Unknown Source)
Run Code Online (Sandbox Code Playgroud) 我正在使用 org.json 解析器。我正在使用 .json 获取一个 json 数组jsonObject.getJSONArray(key)
。问题是jsonArray.length()
返回我1
并且我的 json 数组有 2 个元素,我做错了什么?
String key= "contextResponses";
JSONObject jsonObject = new JSONObject(jsonInput);
Object value = jsonObject.get("contextResponses");
if (value instanceof JSONArray){
JSONArray jsonArray = (JSONArray) jsonObject.getJSONArray(key);
System.out.println("array length is: "+jsonArray.length());/*the result is 1! */
}
Run Code Online (Sandbox Code Playgroud)
这是我的json:
{
"contextResponses" : [
{
"contextElement" : {
"type" : "ENTITY",
"isPattern" : "false",
"id" : "ENTITY3",
"attributes" : [
{
"name" : "ATTR1",
"type" : "float",
"value" : ""
}
] …
Run Code Online (Sandbox Code Playgroud)