我的程序中有一个简单的操作:
exposureNoDecimals =
BigDecimal.valueOf(curEffSpreadPremium).multiply(BigDecimal.valueOf(100)).divide(wsRate, 0,
java.math.RoundingMode.HALF_UP).longValue();
Run Code Online (Sandbox Code Playgroud)
exposureNoDecimals - long curEffSpreadPremium - long wsRate - BigDecimal
但是我得到了
"java.lang.ArithmeticException: Division is undefined"
at java.math.BigDecimal.longScaledDivide(BigDecimal.java:3105)
at java.math.BigDecimal.divide(BigDecimal.java:2409)
at java.math.BigDecimal.divide(BigDecimal.java:2396)
at java.math.BigDecimal.divide(BigDecimal.java:2361)
Run Code Online (Sandbox Code Playgroud)
问题是问题是在生产而不是在我的机器上可以恢复(无法调试,或者无法看到输入)
这可能是什么问题?有什么建议/想法吗?
我有以下几点:
class Foo implements Inter {
void doSomething();
}
Optional<Inter> getPossible() {
Optional<Foo> possible = ...;
possible.ifPresent(Foo::doSomething);
return possible.map(f -> f);
}
Run Code Online (Sandbox Code Playgroud)
getPossible需要返回 anOptional<Inter>因为它覆盖了超类的实现。
方法末尾的映射纯粹是为了转换类型。有没有更优雅的选择?
我需要一些帮助,因为我无法安装任何npm软件包。当我尝试安装某些东西时,出现此错误。
我的节点版本是6.11.0,npm版本是3.10.10。
npm-debug.log:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'server:dev',
1 verbose cli '--',
1 verbose cli '--hot',
1 verbose cli '--proxy-requests' ]
2 info using npm@3.10.10
3 info using node@v6.11.0
4 verbose stack Error: missing script: server:dev
4 verbose stack at run (C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:151:19)
4 verbose stack at C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:61:5
4 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:356:5
4 verbose …Run Code Online (Sandbox Code Playgroud) 地图结构和数据如下
Map<String, BigDecimal>
Run Code Online (Sandbox Code Playgroud)
现在我想要在范围内对值进行分组,输出的范围为键,元素的数量为值.如下所示:
我们如何使用java流做到这一点?
我试图绘制一条垂直线和一条水平线,指向鼠标指向的位置,我希望看到“光标”随鼠标移动。
因此,我试图在图表中添加一条折线,但由于折线图没有getChildren()函数,因此无法添加任何内容。因此,我想拥有这样的东西:
我还在想,如果这些“光标”可以是一个对象,当我将我的类称为“光标”时,它将创建2条线,一条垂直线,一条水平线?
我的代码:
我试图使用LineBuilder画一条线,但是现在我想要的是。现在,我成功获得了鼠标的位置,现在如何绘制2条线?
NumberAxis x = new NumberAxis();
NumberAxis y = new NumberAxis();
LineChart<Number,Number> chart = new LineChart<Number,Number>(x,y);
XYChart.Series series1 = ...;
// creating a series then giving this series 100 random values
chart.getData().add(series1);
chartPane.getChildren().add(chart);
chart.setOnMousePressed((MouseEvent event) -> {
Point2D mouseSceneCoords = new Point2D(event.getSceneX(), event.getSceneY());
double x = xAxis.sceneToLocal(mouseSceneCoords).getX();
double y = yAxis.sceneToLocal(mouseSceneCoords).getY();
primaryStage.setTitle("" +
xAxis.getValueForDisplay(x) + ", " +
yAxis.getValueForDisplay(y)
);
});
Run Code Online (Sandbox Code Playgroud)
因此,现在我成功将您的代码应用到我的应用程序上,我遇到了一个问题:
我的鼠标指向该点(800,10),但是光标完全远离我的鼠标的位置。
我有一些 CI 测试,都是在 maven 中进行的。当我在本地(Windows 10)的 eclipse 中运行它们时,以及当我通过 ec2 linux 服务器中的命令行运行它们时,构建成功。
只有当我从 Jenkins 构建相同的项目时,才会出现以下错误:
Waiting for Jenkins to finish collecting data[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:compile (default-compile) on project invalidlogin: Error while storing the mojo status: /var/lib/jenkins/workspace/project/invalidlogin/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst (Permission denied) -> [Help 1]
我使用 PhantomJS 作为浏览器。
如何让它从詹金斯工作?
这是我的 pom
<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>InvalidLoginV1</groupId>
<artifactId>invalidlogin</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>invalidcredentials</name>
<description>invalidcredentials</description>
<properties>
<suiteXmlFile>src/main/resources/testng.xml</suiteXmlFile>
</properties>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.34.0</version>
<scope>test</scope> …Run Code Online (Sandbox Code Playgroud) 我在 Windows 7 之上安装了 virtual box 5.2。我按照 docker 快速入门指南安装了 docker。用于 Windows 的泊坞窗
由于我的机器位于公司代理后面,我设置
HTTP_PROXY=http://xxx:port
HTTPS_PROXY=https://xxx:port
NO_PROXT="192.168.99.1/24"
Run Code Online (Sandbox Code Playgroud)
通过在创建 docker 机器时传递它,并在机器启动后进行导出。'docker-machine create -d virtualbox --engine-env HTTP_PROXY="http://xxx:80" --engine-env HTTPS_PROXY="https://xxx:80" --engine-env NO_PROXY="192.168.99.1/24" default
docker run hello-world显示以上错误。
我有一个 Jenkins 管道作业(除其他外)使用Job DSL plugin创建另一个 pipelineJob (以在之后清理所有内容) 。
pipeline {
agent { label 'Deployment' }
stages {
stage('Clean working directory and Checkout') {
steps {
deleteDir()
checkout scm
}
}
// Complex logic omitted
stage('Generate cleanup job') {
steps {
build job: 'cleanup-job-template',
parameters: [
string(name: 'REGION', value: "${REGION}"),
string(name: 'DEPLOYMENT_TYPE', value: "${DEPLOYMENT_TYPE}")
]
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
问题是,我只需要构建这个新生成的作业一次,然后,如果构建成功,则应删除该作业。
pipeline {
stages {
stage('Cleanup afterwards') {
// cleanup logic
}
}
post {
success {
// delete this …Run Code Online (Sandbox Code Playgroud) java ×5
java-8 ×2
jenkins ×2
boot2docker ×1
docker ×1
java-stream ×1
javafx ×1
maven ×1
node.js ×1
optional ×1