我正在使用根据同事提供的外部图像构建的容器。整个应用程序是生产环境的测试实例。我需要知道容器内正在运行哪个Java版本。我认为是这样的:
docker container_name java -version
Run Code Online (Sandbox Code Playgroud)
但这不是正确的命令。非常感谢您的帮助和建议。
我有一个场景从我的 Kafka 主题中读取 JSON 数据,通过使用 Kafka 0.11 版本,我需要编写 Java 代码来流式传输 Kafka 主题中存在的 JSON 数据。我的输入是一个包含字典数组的 Json 数据。
现在我的要求是从 json 数据中获取“文本”字段,键入包含在数组中的字典,并通过 Kafka Streaming 将所有这些文本推文传递给另一个主题。
我写代码到这里。请帮我解析数据。
final Serializer<JsonNode> jsonSerializer = new JsonSerializer();
final Deserializer<JsonNode> jsonDeserializer = new JsonDeserializer();
final Serde<JsonNode> jsonSerde = Serdes.serdeFrom(jsonSerializer, jsonDeserializer);
KStreamBuilder builder = new KStreamBuilder();
KStream<String, JsonNode> personstwitter =builder.stream(Serdes.String(), jsonSerde, "Persons");//taking the json node as input
personstwitter.to(Serdes.String(), jsonSerde,"Persons-output");
Run Code Online (Sandbox Code Playgroud) 在postgres(9.4)中,我试图通过select创建一个临时表并将“提交时提交”应用于同一表。我正在使用以下语法。
CREATE TEMPORARY TABLE t5 ON COMMIT DROP AS select * from test4
Run Code Online (Sandbox Code Playgroud)
它给消息
Query returned successfully: 5 rows affected, 62 ms execution time.
Run Code Online (Sandbox Code Playgroud)
但是当我查询同一张表时,
select * from t5
Run Code Online (Sandbox Code Playgroud)
它引发错误,
ERROR: relation "t5" does not exist
LINE 1: select * from t5
^
********** Error **********
ERROR: relation "t5" does not exist
SQL state: 42P01
Character: 15
Run Code Online (Sandbox Code Playgroud)
请理解后,让我知道问题出在哪里。
谢谢
我想用Python创建一个递归方法来打印这个字典:
partners = {
'manager-1': {
'name': 'Manager 1',
'children': {
'manager-2': {
'name': 'Manager 2',
'children': {
'employee-1': {
'name': 'Employee 1',
'children': {
'employee-7': {
'name': 'Employee 7',
},
'employee-8': {
'name': 'Employee 8',
}
}
},
'employee-2': {
'name': 'Employee 2',
},
'employee-3': {
'name': 'Employee 3',
},
},
},
'manager-3': {
'name': 'Manager 3',
'children': {
'employee-4': {
'name': 'Employee 4',
},
'employee-5': {
'name': 'Employee 5',
},
'employee-6': {
'name': 'Employee 6',
},
},
}, …Run Code Online (Sandbox Code Playgroud) 语境:
所以基本上我有一个Map包含名称的类和另一个名为 的类Room。Room包含一个 int 表示门的数量,以及一个名为 的类Door。Door包含一个表示门位置的字符,可以是 N(orth)、E(ast)、S(outh)、W(est)。
问题:
这就是我设置Room班级的方式:
public class Room {
int doors;
Door door;
public Room(int doors, Door door) {
this.doors = doors;
this.door = door;
}
}
Run Code Online (Sandbox Code Playgroud)
但这样我只能给它一扇门,而且我需要能够分配相当于 int 门值的门数量。有任何想法吗?
SELECT count(*)FROM表WHERE列ilike'%/%';
给我包含"/"的值的数量
如何为"\"做同样的事情?
假设我们有字典:
items = {'a': 7, 'b': 12, 'c': 9, 'd': 0, 'e': 24, 'f': 10, 'g': 24}
Run Code Online (Sandbox Code Playgroud)
我想得到另一个字典,其中包含 4 个具有最大值的元素。例如,我希望得到:
subitems = {'e': 24, 'g': 24, 'b': 12, 'f': 10}
Run Code Online (Sandbox Code Playgroud)
什么将是最 Pythonic 和最有效的(内存消耗,执行速度 - 当 fe 我将拥有 1000000 个元素的 dict)方法来做到这一点?生成器、lambda 表达式,还有别的东西吗?
我能够使用Postgresql(9.4.x)xpath搜索来匹配xml属性或元素.是否可以搜索属性和元素值的组合?
<name>
<firstname>test</firstname>
<lastname>user</lastname>
<role num="10">admin</role>
<role num="8">readonly</role>
</name>
Run Code Online (Sandbox Code Playgroud)
我试图在上面的示例xml中将admin角色与数字10匹配,并且下面的查询也为8-admin组合返回TRUE.
select xpath('//role/@num="8" and //role/text()="admin"', '<above xml>');
Run Code Online (Sandbox Code Playgroud)
请建议是否有更好的方法来匹配精确的索引组合.
谢谢.
我正在为我的项目创建一个build.sbt,并且它具有类似的依赖项
libraryDependencies ++= Seq(
"com.typesafe.akka" % "akka-actor_2.11" % "2.3.15",
"org.scalaz" % "scalaz-core_2.11" % "7.2.0",
"org.scalactic" % "scalactic_2.11" % "2.2.6" ,
"org.scalatest" % "scalatest_2.11" % "2.2.6" % "test",
"org.scalamock" % "scalamock-scalatest-support_2.11" % "3.2.2" % "test",
"org.springframework" % "spring-context" % "4.1.6.RELEASE",
"org.springframework" % "spring-beans" % "4.1.6.RELEASE",
"org.springframework" % "spring-core" % "4.1.6.RELEASE",
"org.springframework" % "spring-context" % "4.1.6.RELEASE",
"org.springframework" % "spring-web" % "4.1.6.RELEASE",
"com.google.guava" % "guava" % "14.0.1",
"com.google.code.gson" % "gson" % "2.3",
"commons-lang" % "commons-lang" % "2.5",
"net.sf.opencsv" % "opencsv" % "2.3",
"com.thoughtworks.xstream" …Run Code Online (Sandbox Code Playgroud) 已解决:prop.setProperty("driver","oracle.jdbc.driver.OracleDriver")必须将此行添加到连接属性中.
我正试着在当地吃午餐.我用maven创建了一个带依赖关系的jar.
这是我的pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.agildata</groupId>
<artifactId>spark-rdd-dataframe-dataset</artifactId>
<packaging>jar</packaging>
<version>1.0</version>
<properties>
<exec-maven-plugin.version>1.4.0</exec-maven-plugin.version>
<spark.version>1.6.0</spark.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>${spark.version}</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.11</artifactId>
<version>${spark.version}</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<executions>
<execution>
<id>scala-compile-first</id>
<phase>process-resources</phase>
<goals>
<goal>add-source</goal>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>scala-test-compile</id>
<phase>process-test-resources</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<!-- get all project dependencies --> …Run Code Online (Sandbox Code Playgroud) postgresql ×3
dictionary ×2
java ×2
python ×2
apache-spark ×1
backslash ×1
class ×1
docker ×1
gradle ×1
jdbc ×1
jsonschema ×1
oop ×1
parsing ×1
python-3.x ×1
sbt ×1
scala ×1
temp-tables ×1
xml ×1
xpath ×1