如何在Sublime Text中查看文件的当前编码?
这似乎是一件非常简单的事情,但搜索并没有产生太大的影响.任何指针将不胜感激!
我想更新git clone上的子模块.
有没有办法用Jenkins管道Git命令做到这一点?
目前我正在这样做......
git branch: 'master',
credentialsId: 'bitbucket',
url: 'ssh://bitbucket.org/hello.git'
Run Code Online (Sandbox Code Playgroud)
但是,一旦克隆,它就不会更新子模块
摘要:
GSON是否直接访问类的私有成员而不调用其getter方法来获取值?
后跟的Java的规则是,如果B类有它的私有成员不能被访问的A级不getter/setter方法.
现在我正在与GSON合作开发一个项目,我觉得getter/setter方法被绕过[未使用,私有成员被直接访问]
我只是一名学生,所以我可能会错过一些常见的工作.
A级
public class A {
public static void main(String[] args) {
B b = new B();
Gson gson = new GsonBuilder().setPrettyPrinting().create();
System.out.println(gson.toJson(b));
System.out.println("--end--");
}
}
Run Code Online (Sandbox Code Playgroud)
B级
public class B {
private int a;
public B() {
a = 1;
}
public int getA() {
System.out.println("I am invoked!");
return 10;
}
public void setA(int a) {
this.a = a;
}
}
Run Code Online (Sandbox Code Playgroud)
注意:Ba的值为1,我将getA()编码为总是返回10
如果我从A级访问Ba,一切都按预期工作,它不会让我这样做,一切都很好,直到这里
GSON怀疑从这里开始 …
在 AWS Java SDK 1.x 中,我可以S3Object从这样的一个中得到一个S3Client。
S3Object obj = mS3Client.getObject(pBucket, pKey);
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用 AWS Java SDK 2.0(并以 结束S3Object)复制该功能,但我能得到的最接近的是GetObjectResponse,而且我找不到任何简单的方法调用来将响应转换为S3Object.
GetObjectResponse response = mS3Client.getObject(
GetObjectRequest.builder()
.bucket(pBucket)
.key(pKey)
.build())
.response();
Run Code Online (Sandbox Code Playgroud)
我怎样才能S3Object从 2.0 中获得一个S3Client,或者从GetObjectResponse.
我需要查看为某些C函数生成的汇编代码,编译C代码时应该使用哪些标志?
编辑:使用G ++编译器,抱歉!
我只是检查一些OCJP问题,并在字符串数组初始化和异常期间遇到了这种差异.
情况1
try {
String[][] b = new String[10][10]; // 1
System.out.println(b[0][0]); // 2
} catch (Exception e) {
System.out.println("Exception during array 'b' initialization");
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
案例2
try {
String[][] a = new String[10][]; // 3
System.out.println(a[0][0]); // 4
} catch (Exception e) {
System.out.println("Exception during array 'a' initialization");
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
第2行不会抛出任何异常,而第4行会抛出空指针异常.第2行确实输出了值null.
当指定数组的大小时,java的初始化默认值是否有差异?
我正在尝试使用 Gradleplugin: 'project-report'生成依赖关系报告。
运行gradle htmlDependencyReport任务时,我可以获取html报告,但是当我将其配置为生成时xml(如文档中的示例所示),我收到错误。
// build.gradle
htmlDependencyReport {
projects = project.allprojects
reports {
html {
enabled false
}
xml.destination "build/reports/myReport.xml"
}
}
Run Code Online (Sandbox Code Playgroud)
~# gradle htmlDependencyReport
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/the_storyteller/Projects/my_project/build.gradle' line: 84
* What went wrong:
A problem occurred evaluating root project 'my_project'.
> Could not get unknown property 'xml' for Report set of type org.gradle.api.reporting.dependencies.internal.DefaultDependencyReportContainer.
* Try:
Run with --stacktrace option to get the …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用他们的Java SDK从Google Cloud Storage下载一个字节范围。
我可以像这样下载整个文件。
Storage mStorage; // initialized and working
Blob blob = mStorage.get(pBucketName, pSource);
try (ReadChannel reader = mStorage.reader(blob.getBlobId())) {
// read bytes from read channel
}
Run Code Online (Sandbox Code Playgroud)
如果我愿意,我可以ReadChannel#seek(long)直到达到所需的起始字节,然后从该点下载一个范围,但这似乎效率低下(尽管我不知道实现中到底发生了什么。)
理想情况下,我想指定Google Cloud Storage REST API 中所示的Range: bytes=start-end标头,但我不知道如何在 Java 中设置标头。
如何在 Java SDK Storage get 调用中指定字节范围,或指定标头,以便我可以有效地下载所需的字节范围?
我得到了以下项目结构
project
-- build.gradle
-- gradle
| -- java.gradle
| -- artifacts.gradle
Run Code Online (Sandbox Code Playgroud)
在我的root build.gradle中,我写道
apply from: 'gradle/artifacts.gradle'
Run Code Online (Sandbox Code Playgroud)
在我的artifacts.gradle中,我构建了一个耳朵,并希望将war任务(也在artifacts.gradle)设置为部署依赖关系
project(path: ':myWar', configuration: 'myWar')
Run Code Online (Sandbox Code Playgroud)
现在gradle抛出了我的错误 Project with path <path> could not be found in root project <project>.
我究竟做错了什么?
我实际上是在Ubuntu 18.04上使用C语言.我不使用任何IDE.
#include <stdio.h>
void main()
{
message();
printf("\nCry, and you stop the monotomy!\n");
}
void message()
{
printf("\nSmile, and the worldsmiles with you...");
}
Run Code Online (Sandbox Code Playgroud)
当我运行它时,它返回错误消息,如下所示.
msg.c: In function ‘main’:
msg.c:5:2: warning: implicit declaration of function ‘message’ [-Wimplicit-function-declaration]
message();
^~~~~~~
msg.c: At top level:
msg.c:8:6: warning: conflicting types for ‘message’
void message()
^~~~~~~
msg.c:5:2: note: previous implicit declaration of ‘message’ was here
message();
^~~~~~~
Run Code Online (Sandbox Code Playgroud)
当我把消息函数放在上面时,main()它显示没有错误.为什么?我们不能把功能放到后面main()吗?什么是隐含声明?