复习:StringBuilder和String拼接字符串效率差距真大
今天在解析一个5M的文本文件时,耗时两分多钟,找了半天才发现原因是使用String += s的方式拼接字符串导致的。
换成StringBuilder后速度提升了4个数量级!
至于原因,大家应该都懂,我就不再赘述了。
基础不能忘!!!
基础不能忘!!!
基础不能忘!!!
今天在解析一个5M的文本文件时,耗时两分多钟,找了半天才发现原因是使用String += s的方式拼接字符串导致的。
换成StringBuilder后速度提升了4个数量级!
至于原因,大家应该都懂,我就不再赘述了。
基础不能忘!!!
基础不能忘!!!
基础不能忘!!!
原文:what-is-a-good-java-library-to-zip-unzip-files
Demo:@user2003470
import net.lingala.zip4j.exception.ZipException;
import net.lingala.zip4j.core.ZipFile;
public static void unzip(){
String source = "some/compressed/file.zip";
String destination = "some/destination/folder";
String password = "password";
try {
ZipFile zipFile = new ZipFile(source);
if (zipFile.isEncrypted()) {
zipFile.setPassword(password);
}
zipFile.extractAll(destination);
} catch (ZipException e) {
e.printStackTrace();
}
}
The Maven dependency is:
<dependency>
<groupId>net.lingala.zip4j</groupId>
<artifactId>zip4j</artifactId>
<version>1.3.2</version>
</dependency>
如图:
通过 systemctl status snap.docker.dockerd.service
命令,可以找到daemon.json的路径
转发:https://superuser.com/questions/1431826/expose-api-over-tcp-of-snap-installed-docker-on-ubuntu-18-04
@Rumdex
By running:systemctl status snap.docker.dockerd.service
I was able
to see which was the loaded service file:/etc/systemd/system/snap.docker.dockerd.service
Just looked inside
this file looking for theExecStart
directive. It was there. So just
had to add-H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock
to
that line, so it ended up looking like:ExecStart=/usr/bin/snap run docker.dockerd -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock
Rebooted. Works.