我正在制作Java 1.6-JDBC-Oracle 11代码.我创建了一个名为employee的表,其中包含id,name和age.我收到错误 - ORA-00911:无效字符.我怎样才能解决这个问题 ?
这是我的代码 -
import java.sql.*;
import java.util.Properties;
import java.io.IOException;
import java.io.FileInputStream;
public class HelloOracle {
static String query =
"SELECT emp_id, emp_name, emp_age " +
"FROM employee;";
public static void main(String[] args) {
String username = "";
String password = "";
Properties prop = new Properties();
try {
FileInputStream fis = new FileInputStream("Login.properties");
prop.load(fis);
} catch (IOException ex) {
ex.printStackTrace();
}
username = prop.getProperty("username").trim();
password = prop.getProperty("password").trim();
try {
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@//localhost:1521/xe", username, password); …
Run Code Online (Sandbox Code Playgroud) 我正在使用平台条件来控制在AWS上运行的环境类型.有很多共享资源,但我需要某些EC2实例与预先制作的AMI,具体取决于数量条件.
"Parameters": {
"Platform": {
"Description": "Select platform type - linux or windows",
"Default": "linux",
"Type": "String",
"AllowedValues": [ "linux", "windows", "both" ],
"ConstraintDescription": "Must enter either linux, windows, or both"
},
Run Code Online (Sandbox Code Playgroud)
然后我设置了conditions
.
"Conditions" : {
"LinuxPlatform" : {"Fn::Equals" : [{"Ref" : "Platform"}, "linux"]},
"WindowsPlatform" : {"Fn::Equals" : [{"Ref" : "Platform"}, "windows"]},
"BothPlatform" : {"Fn::Equals" : [{"Ref" : "Platform"}, "both"]}
},
Run Code Online (Sandbox Code Playgroud)
在资源中,我想使用linux或windows来触发Windows或Linux Ec2创建,或者使用它们来部署所声明的每个ec2资源.
我fn:or
在几个方面尝试了以下使用方法.
"Fn::Or": [{"Condition": "LinuxPlatform"}, {"Condition": "BothPlatform" }],
和...
"Condition" : {
"Fn::Or" : …
Run Code Online (Sandbox Code Playgroud) 我希望我的JavaFX应用程序可以通过Alt + Enter最大化,所以我补充说:
scene.addEventFilter(KeyEvent.KEY_PRESSED, event -> {
if (event.getCode() == KeyCode.ENTER) {
if (event.isAltDown()) {
setFullScreen(!stage.isFullScreen());
event.consume();
}
}
});
Run Code Online (Sandbox Code Playgroud)
但是,按下Alt + Enter时,默认情况下所有JavaFX应用程序都会发出"嘟嘟"声音效果(不知道为什么......).我将如何继续消除这种声音效果?
我有一个模板,可以使用 DynamoDB 和 DAX 为多个区域(例如 us-east-1 和 ap-southeast-1)创建 CloudFormation。虽然适用于 us-east-1,但此模板不适用于 ap-southeast-1,因为 DAX 尚不适用于该区域。
我预计这可以使用 来完成Conditions
,这样对于一个区域 (us-east-1),我将同时拥有 DynamoDB 和 DAX,而对于另一个区域 (ap-southeast-1) - 只有 DynamoDB:
Conditions:
isDAXAvailable: !Not [!Equals [ !Ref "AWS::Region", ap-southeast-1 ]]
Resources:
DynamoDBTable:
Type: AWS::DynamoDB::Table
Properties:
.....
DaxCluster:
Type: AWS::DAX::Cluster
Condition: isDAXAvailable
Properties:
.....
Run Code Online (Sandbox Code Playgroud)
但不幸的是我收到一个错误:
调用 ValidateTemplate 操作时发生错误 (ValidationError):模板格式错误:无法识别的资源类型:[AWS::DAX::Cluster]
是否可以配置这样的模板,或者应该创建一个单独的模板?
我想创建一个包含国家/地区的下拉列表,并创建一个包含城市的第二个下拉列表,这取决于第一个列表中的选定值。并且城市列表应动态更改。在视图(Thymeleaf)中,我有一个Map<CountryModel, Set<RegionModel>>
from控制器。CountryModel的名称应显示在第二个下拉列表中,而Set应显示在第二个(相关)下拉列表中。
在这里,我创建第一个下拉列表:
<tr>
<td th:text="#{country}"/>
<td>
<div class="form-group">
<select th:field="*{transferRequestModel.country}" class="form-control" id="country">
<option th:each="country : ${transferModel.countries}"
th:value="${country}"
th:text="${country.key.countryName}">Wireframe
</option>
</select>
</div>
</td>
</tr>
Run Code Online (Sandbox Code Playgroud)
那么如何创建第二个下拉列表,该列表取决于第一个列表中的所选国家/地区?
我已经集成了FindBugs插件,以便在出现错误时无法构建.
然后使用这个出色的答案我配置了FindBugs来生成html报告(xml版本几乎不可读).
问题是我将failOnError
属性设置为true
,这意味着如果出现bug,构建将失败.
.....
<configuration>
.....
<failOnError>true</failOnError>
</configuration>
Run Code Online (Sandbox Code Playgroud)
然后不会生成任何HTML报告.
我读到了Maven构建生命周期,并且没有"失败时执行"(如finally
Java中的块).那么,有没有可能的解决方法?它不应该是开箱即用的Maven功能吗?
我正在编写一个多线程解析器.解析器类如下.
public class Parser extends HTMLEditorKit.ParserCallback implements Runnable {
private static List<Station> itemList = Collections.synchronizedList(new ArrayList<Item>());
private boolean h2Tag = false;
private int count;
private static int threadCount = 0;
public static List<Item> parse() {
for (int i = 1; i <= 1000; i++) { //1000 of the same type of pages that need to parse
while (threadCount == 20) { //limit the number of simultaneous threads
try {
Thread.sleep(50);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
Thread thread …
Run Code Online (Sandbox Code Playgroud) 我有一个 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) 我希望在延迟3秒后执行任务,而我的一项任务需要2秒才能完成。
我得到的输出显示5秒的间隔
注意:Student类实现了Callable接口, 我有以下查询
我得到的输出是
The time is : Sat Nov 26 15:08:02 IST 2016
Doing a task during : prerna - Time - Sat Nov 26 15:08:06 IST 2016
pool-1-thread-1 Helloprerna
Doing a task during : abc - Time - Sat Nov 26 15:08:11 IST 2016
pool-1-thread-1 Helloabc
Doing a task during : def - Time - Sat Nov 26 15:08:16 IST 2016
pool-1-thread-2 Hellodef
Doing a task during : xyz - Time - Sat Nov 26 …
Run Code Online (Sandbox Code Playgroud)