我需要将使用拉丁字母书写的欧洲地方的名称与某些字符上的重音符号(变音符号)进行比较.有很多中央和写有像拉丁字符重音符号的东欧名称ž和ü,但有些人只是用常规的拉丁字符没有重音符号像写的名字z和u.
我需要一种方法让我的系统识别出例如与所用的所有其他重音字符mšk žilina相同msk zilina,并且类似.有一个简单的方法吗?
在计算机科学中,函数式编程是一种编程范式,它将计算视为数学函数的评估,并避免状态和可变数据.
http://en.wikipedia.org/wiki/Functional_programming
谁能解释一下状态和可变数据是什么?任何人都可以给我JAVA或JavaScript的例子.
我有这样一段代码:
void SHAPresenter::hashData(QString data)
{
QCryptographicHash* newHash = new QCryptographicHash(QCryptographicHash::Sha3_224);
newHash->addData(data.toUtf8());
QByteArray hashResultByteArray = newHash->result();
setHashedData(QString(hashResultByteArray.toHex()));
delete newHash;
}
Run Code Online (Sandbox Code Playgroud)
根据Qt规范,QCryptographicHash :: Sha3_224应该"生成一个SHA3-224哈希值.在Qt 5.1中引入".我想比较该代码的结果与其他来源的结果,以检查我是否以正确的方式放置数据.我找到了网站:https: //emn178.github.io/online-tools/sha3_224.html所以我们在两种情况下都有SHA3_224.问题是第一个会从"test"生成这样一个字节串:
3be30a9ff64f34a5861116c5198987ad780165f8366e67aff4760b5e
Run Code Online (Sandbox Code Playgroud)
第二个:
3797bf0afbbfca4a7bbba7602a2b552746876517a7f9b7ce2db0ae7b
Run Code Online (Sandbox Code Playgroud)
根本不相似.但也有一个网站做"Keccak-224":https://emn178.github.io/online-tools/keccak_224.html
结果是:
3be30a9ff64f34a5861116c5198987ad780165f8366e67aff4760b5e
Run Code Online (Sandbox Code Playgroud)
我知道SHA3是基于Keccak的功能 - 但这里的问题是什么?这两个实现中的哪一个以适当的方式遵循NIST FIPS 202,我们如何知道?
我正在测试HttpClientJava 11的新功能并遇到以下行为:
我正在向公共 REST API 发出两个异步请求以进行测试,并使用一个客户端和两个单独的请求进行了尝试。这个过程没有抛出任何异常。
String singleCommentUrl = "https://jsonplaceholder.typicode.com/comments/1";
String commentsUrl = "https://jsonplaceholder.typicode.com/comments";
Consumer<String> handleOneComment = s -> {
Gson gson = new Gson();
Comment comment = gson.fromJson(s, Comment.class);
System.out.println(comment);
};
Consumer<String> handleListOfComments = s -> {
Gson gson = new Gson();
Comment[] comments = gson.fromJson(s, Comment[].class);
List<Comment> commentList = Arrays.asList(comments);
commentList.forEach(System.out::println);
};
HttpClient client = HttpClient.newBuilder().build();
client.sendAsync(HttpRequest.newBuilder(URI.create(singleCommentUrl)).build(), HttpResponse.BodyHandlers.ofString())
.thenApply(HttpResponse::body)
.thenAccept(handleOneComment)
.join();
client.sendAsync(HttpRequest.newBuilder(URI.create(commentsUrl)).build(), HttpResponse.BodyHandlers.ofString())
.thenApply(HttpResponse::body)
.thenAccept(handleListOfComments)
.join();
Run Code Online (Sandbox Code Playgroud)
然后我尝试将其重构HttpClient为一个方法,当它尝试发出第二个请求时出现以下异常:
public void run() {
String singleCommentUrl = …Run Code Online (Sandbox Code Playgroud) java exception httprequest sslhandshakeexception java-http-client
我需要通过HTTP启动一些内容的下载,然后将数据作为反应流来读取.
因此,即使下载的数据很大,我几乎可以立即读取响应体的前几个字节(无需等待整个响应体).然后,做一些计算,并在几秒钟内读取另一部分数据.缓存数据必须有一些限制,因为操作内存无法处理整个内容(数十GB).
我一直在尝试使用HttpClient的sendAsync方法BodyHandlers.ofInputStream(),但它总是阻塞并等待所有数据到达.
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://..."))
.build();
HttpResponse<InputStream> response = client
.sendAsync(request, HttpResponse.BodyHandlers.ofInputStream())
.get(); // this finishes as soon as the header is received
try {
InputStream stream = response.body();
byte[] test = stream.readNBytes(20); // trying to read just a few bytes
// but it waits for the whole body
} catch (IOException ex) {}
Run Code Online (Sandbox Code Playgroud)
我需要更改什么才能逐渐下载响应正文?
I'm using Scene Builder (v11.0.0) to create FXML files for scenes in JavaFX (v12) but, despite instructing all containers to USE_COMPUTED_SIZE for the preferred widths and heights, the rendered scenes (as seen in Scene Builder and also when run as a JavaFX application which loads those FXML files) are being clipped at the right and bottom edges so that bits of nodes are chopped off.
And in Scene Builder it seems that the renderer must know that the scene won't …
我正在使用JavaScript在HTML页面上创建基本的图形时钟显示.我正在使用标准DOM机制更新数字图形(仅在必要时更新每个数字):
digitOne.src = "file/path/one.png";
Run Code Online (Sandbox Code Playgroud)
时钟工作正常,但我想知道是否所有或某些浏览器每次更改src属性时都会盲目地从我的站点获取图像,而不是将副本缓存在RAM中.我担心在某些情况下,也许在较旧的浏览器中,查看图形时钟会不断创建数据流量,并通过我的月度数据限额来咀嚼.
所以我希望有人可以告诉我这是否存在风险,或者指出我在JavaScript中交换图形的机制,这保证了现有图像将从内存中使用而不是每次触发网络获取.
(我一直在寻找一个明确的答案,但找不到一个.自1999/2000以来我没有使用过JavaScript作为DHTML,所以我有点落后于时代.至少不再需要写了每个JavaScript函数的两个版本,一个用于IE4/5,另一个用于Netscape 4.)
我有一个用日期索引的数据框(Python datetime 对象)。我怎样才能找到频率作为数据框中数据的月数?
我尝试了属性data_frame.index.freq,但它返回一个 none 值。我也尝试asfreq使用函数,data_frame.asfreq('M',how={'start','end'}但它没有返回预期的结果。请告知我如何获得预期的结果。
如果一个Git仓库结构看起来像这样:
master: A-C
dev: \B-D-E
Run Code Online (Sandbox Code Playgroud)
是否有可能将开发分支合并到master中,以便仅将一个提交添加到master中,其中包含在development分支中所有提交中找到的所有更改。因此,上述结构将合并为以下形式:
master: A-C-E'
Run Code Online (Sandbox Code Playgroud)
该E'承诺将包含所有来自开发分支的变化,只有最新提交信息,添加新的功能,掌握在一个整洁的承诺。
在Git中可能吗?我希望能够使GitHub存储库的历史记录保持整洁,因为我的开发分支通常包含未完成,未打磨且不适合人类消费的早期提交。
我正在使用新java.net.http类来处理异步 HTTP 请求+响应交换,并且我正在尝试找到一种方法让 BodySubscriber 处理不同的编码类型(例如 gzip)。
但是,映射 aBodySubsriber<InputStream>以使底层流被 a 包装GZIPInputStream(当在响应标头中找到“Content-Encoding:gzip”时)会导致挂起。没有例外,只是完全停止活动。
映射的代码BodySubscriber如下所示:
private HttpResponse.BodySubscriber<InputStream> gzippedBodySubscriber(
HttpResponse.ResponseInfo responseInfo) {
return HttpResponse.BodySubscribers.mapping(
HttpResponse.BodySubscribers.ofInputStream(),
this::decodeGzipStream);
}
private InputStream decodeGzipStream(InputStream gzippedStream) {
System.out.println("Entered decodeGzipStream method.");
try {
InputStream decodedStream = new GZIPInputStream(gzippedStream);
System.out.println(
"Created GZIPInputStream to handle response body stream.");
return decodedStream;
} catch (IOException ex) {
System.out.println("IOException occurred while trying to create GZIPInputStream.");
throw new UncheckedIOException(ex);
}
}
Run Code Online (Sandbox Code Playgroud)
接收到具有“gzip”编码的 HTTP 响应会导致控制台显示以下内容:
进入EncodedBodyHandler.apply方法。
进入decodeGzipStream方法。
没有看到更多内容,因此调用GZIPInputStream构造函数之后的行永远不会执行。 …
java ×6
javascript ×2
cryptography ×1
dhtml ×1
diacritics ×1
dom ×1
exception ×1
fxml ×1
git ×1
git-merge ×1
github ×1
http ×1
httprequest ×1
immutability ×1
java-11 ×1
javafx ×1
keccak ×1
pandas ×1
performance ×1
python ×1
qt ×1
scenebuilder ×1
sha-3 ×1
string ×1