我有一个(看似)简单的maven问题我无法解决.在我的POM中,我已经指定了对openrdf-sesame的依赖,如下所示:
<dependency>
<groupId>org.openrdf.sesame</groupId>
<artifactId>sesame-runtime</artifactId>
<version>2.7.2</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
从eclipse运行项目效果很好,我甚至可以导出一个可运行的jar文件.不幸的是,我无法通过cmd-line maven正常工作.为了建立一个罐子,我已经将以下内容添加到我的pom中:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>foo.bar.Cli</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
编译失败,出现以下错误:
.../PLDReducer.java:[25,29] package org.openrdf.rio.rdfxml does not exist
.../PLDReducer.java:[27,33] package org.openrdf.sail.nativerdf does not exist
.../LowPLDReducer.java:[25,29] package org.openrdf.rio.rdfxml does not exist
.../Cli.java:[23,33] package org.openrdf.sail.nativerdf does not exist
.../SchemaBuilder.java:[30,33] package org.openrdf.sail.nativerdf does not exist
.../RepoQuerier.java:[23,33] package org.openrdf.sail.nativerdf does not exist
.../PLDReducer.java:[78,44] cannot find symbol
Run Code Online (Sandbox Code Playgroud)
奇怪的是,只要我将编译插件添加到pom并更新项目设置,eclipse似乎也不再编译了.我检查了我的存储库,所有芝麻文件都在那里.
mvn --version给出了这个输出:
Apache Maven …Run Code Online (Sandbox Code Playgroud) 我想使用matplotlib创建混淆矩阵的可视化.下面显示的方法的参数是类标签(字母表),分类结果列表(conf_arr)和输出文件名.到目前为止,我对结果非常满意,最后一个问题是:
我无法使网格线之间的轴刻度标签居中.如果我将extent参数传递给imshow方法,如下所示,网格按照我希望的方式对齐.如果我把它评论出来,那么网格就会错位,但标签是我希望的.我想我需要一种方法来在关联的tick和下一个tick之间移动ticklabel,但我不知道是否以及如何做到这一点.
总而言之,我希望左图像中的网格/刻度,但是像右图中一样定位的刻度标记:

def create_confusion_matrix(alphabet, conf_arr, outputname):
norm_conf = []
width = len(conf_arr)
height = len(conf_arr[0])
for i in conf_arr:
a = 0
tmp_arr = []
a = sum(i, 0)
for j in i:
tmp_arr.append(float(j)/float(a))
norm_conf.append(tmp_arr)
fig = plt.figure(figsize=(14,14))
#fig = plt.figure()
plt.clf()
ax = fig.add_subplot(111)
ax.set_aspect(1)
ax.grid(which='major')
res = ax.imshow(np.array(norm_conf), cmap=plt.cm.binary,
interpolation='none', aspect='1', vmax=1,
##Commenting out this line sets labels correctly,
##but the grid is off
extent=[0, width, height, 0]
)
divider = make_axes_locatable(ax)
cax = divider.append_axes("right", size="5%", pad=0.2) …Run Code Online (Sandbox Code Playgroud) 我想创建一个Docker Image作为可执行文件,用户将令牌作为环境变量传递给它.可执行文件具有用户应通过docker CMD传递的子命令(通过Env考虑git和身份验证).但是,Docker不会将CMD附加到入口点.我的Dockerfile的相关部分如下所示:
ENTRYPOINT ["/bin/sh", "-c", "/usr/bin/mycmd --token=$MY_TOKEN"]
CMD ["pull", "stuff"]
Run Code Online (Sandbox Code Playgroud)
因此,如果此容器在没有任何CMD覆盖的情况下执行,并且secret作为MY_TOKEN变量,我会期望
mycmd --token=secret pull stuff
Run Code Online (Sandbox Code Playgroud)
被执行.如果用户使用覆盖启动容器,例如
docker run -it -e MY_TOKEN=secret myimage push junk
Run Code Online (Sandbox Code Playgroud)
我期待
mycmd --token=secret push junk
Run Code Online (Sandbox Code Playgroud)
被执行.但是,如上所述,只有mycmd --token=secret执行,CMD才会被忽略 - 无论我是在启动时覆盖它还是在Dockerfile中设置它.
I have a problem with test console output in IntelliJ 2016. When I run JUnit tests via IntelliJ, the console window is flooded with enormous amounts of log lines, for example
DEBUG reactor.ipc ....
DEBUG io.netty.buffer.ByteBufUtil ....
Run Code Online (Sandbox Code Playgroud)
It's a simple Spring-Boot application which uses the default logging - I think it's slf4j. I tried setting
logging.level.reactor.ipc=WARN
Run Code Online (Sandbox Code Playgroud)
in my src/main/resources/application.properties and also setting
-Dlogging.level.root=WARN on the RunConfig's VM arguments, but neither has any effect on the log output.
What is the …
我正在使用application.yml文件配置Spring Boot应用程序:
foo:
bar: foobar
foolist:
- bar: foobar1
baz: foobaz1
- bar: foobar1
baz: foobaz1
Run Code Online (Sandbox Code Playgroud)
我可以使用环境变量轻松设置foo.bar值,例如
export FOO_BAR=value
Run Code Online (Sandbox Code Playgroud)
如何设置foolist入口的值?FOOLIST[0]_BAR不是有效的标识符,FOOLIST_0_BAR因此不起作用。
在我的 ansible playbook 中,我将目录列表读入列表。然后我想从这些目录中的每一个读取“config.yml”文件并将它们的内容放入字典中,以便我可以通过该字典中的目录名称引用配置数据。第一部分没问题,但我无法让第二部分工作:
第一步,加载目录:
- name: Include directories
include_vars:
file: /main-config.yml
name: config
Run Code Online (Sandbox Code Playgroud)
第 2 步,从目录加载配置:
- name: load deploymentset configurations
include_vars:
file: /path/{{ item }}/config.yml
name: "allconfs.{{ item }}" ## << This is the problematic part
with_items:
- "{{ config.dirs }}"
Run Code Online (Sandbox Code Playgroud)
我尝试了不同的东西,例如"allconfs['{{ item }}'],但似乎都不起作用。剧本成功完成,但数据不在字典中。我也尝试过预先定义外部字典,但这也不起作用。
配置文件本身非常简单:
/main-config.yml:
dirs:
- dir1
- dir2
- dir3
Run Code Online (Sandbox Code Playgroud)
/path/dir1/config.yml:
some_var: "some_val"
another_var: "another val"
Run Code Online (Sandbox Code Playgroud)
我希望能够像这样访问 config.yml 文件的值:
{{ allconfs.dir1.some_var }}
更新以尝试 Konstantins 方法:
- name: load deploymentset configurations
include_vars:
file: …Run Code Online (Sandbox Code Playgroud) 我想创建一个Grafana'singlestat'面板,根据是否存在测试失败指标来显示正常运行时间或SLA'百分比'。
我已经有了适合e2e_tests_failure_count不同测试框架的适当指标。这意味着以下查询返回观察到的测试失败的总和:
sum(e2e_tests_failure_count{kubernetes_name=~"test-framework-1|test-framework-2|test-framework-3",kubernetes_namespace="platform-edge"})
Run Code Online (Sandbox Code Playgroud)
我已经设法创建一个图形,如果一切正常,则为“ 1”,如果有任何测试失败,则为“ 0”:
1 - clamp_max(sum(e2e_tests_failure_count{kubernetes_name=~"test-framework-1|test-framework-1|test-framework-1",kubernetes_namespace="platform-edge"}), 1)
Run Code Online (Sandbox Code Playgroud)
我现在想使用一个百分比值来显示一段时间(例如最近5天)的“正常运行时间”(=环境处于“健康状态”的时间)。例如“ 99.5%”,或更适合屏幕截图的是“ 65%”。
我尝试过这样的事情:
(1 - clamp_max(sum(e2e_tests_failure_count{kubernetes_name=~"service-cvi-e2e-tests|service-svhb-e2e-tests|service-svh-roundtrip-e2e-tests",kubernetes_namespace="platform-edge"}), 1))[5d]
Run Code Online (Sandbox Code Playgroud)
但这只会导致解析器错误。谷歌搜索并没有真正让我进一步,所以我希望可以在这里找到帮助:)
我正在开发一个启动嵌入式Jetty服务器的Spring应用程序.然后它将Spring MVC Web应用程序"部署"到此Jetty服务器.
一切都适用于多个控制器,但我无法将Spring Security添加到Web应用程序中.我使用基于编程和注释的配置,Jetty服务器配置如下:
Server server = new Server(8080);
server.setStopAtShutdown(true);
AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
context.setConfigLocation("com.mypackage.web");
context.setParent(mainContext);
ServletContextHandler contextHandler = new ServletContextHandler();
contextHandler.setErrorHandler(null);
contextHandler.setContextPath("/");
DispatcherServlet dispatcherServlet = new DispatcherServlet(context);
DefaultServlet staticServlet = new DefaultServlet();
contextHandler.addServlet(new ServletHolder(dispatcherServlet), "/");
contextHandler.addServlet(new ServletHolder("staticServlet", staticServlet), "/res");
contextHandler.addEventListener(new ContextLoaderListener(context));
contextHandler.setResourceBase("webapp");
server.setHandler(contextHandler);
Run Code Online (Sandbox Code Playgroud)
我还创建了一个类com.mypackage.web.SecurityConfig,它扩展WebSecurityConfigurerAdapter并覆盖configure方法,如下所示:
@Configuration
@EnableWebMvcSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.anyRequest().authenticated()
.and()
.formLogin().and()
.httpBasic();
}
}
Run Code Online (Sandbox Code Playgroud)
据我了解文档,这应该足以"锁定"我的应用程序.当我在调试模式下启动应用程序时,在configure方法中遇到一个断点,因此Spring似乎检测到了配置类.
但是,我仍然可以访问我的应用程序中的任何页面,而无需重定向到默认登录表单.
我是否需要告诉Jetty Servlet容器有关此配置或我错过了其他内容?
spring ×2
spring-boot ×2
ansible ×1
dictionary ×1
docker ×1
docker-image ×1
dockerfile ×1
grafana ×1
java ×1
jetty ×1
junit ×1
log-level ×1
logging ×1
matplotlib ×1
maven ×1
prometheus ×1
promql ×1
python ×1
spring-mvc ×1
yaml ×1