文本剪辑器有很多,个人一直喜欢用sublime.
安装Pretty JSON插件
直接百度吧
设置快捷键

在右侧输入:
[
{ "keys": ["ctrl+j"], "command": "pretty_json" }, //格式化
{ "keys": [ "ctrl+n" ], "command": "un_pretty_json" } //压缩
]
小于 1 分钟
文本剪辑器有很多,个人一直喜欢用sublime.
直接百度吧
在右侧输入:
[
{ "keys": ["ctrl+j"], "command": "pretty_json" }, //格式化
{ "keys": [ "ctrl+n" ], "command": "un_pretty_json" } //压缩
]
可以快速打开应用、查找文件等
截图、标注、历史截图等功能
粘贴板历史,windows也有自带的,不过记录的历史条数很少,貌似没有办法修改
直接上菜:
import org.slf4j.helpers.MessageFormatter;
import org.springframework.util.StopWatch;
public class PQSTest {
public static void main(String[] args) {
StopWatch stopWatch = new StopWatch("pqs");
stopWatch.start("MessageFormatter.format");
for (int i = 0; i < 10000000; i++) {
String s = MessageFormatter.format("哈哈哈 {}", i).getMessage();
}
stopWatch.stop();
stopWatch.start("String.format");
for (int i = 0; i < 10000000; i++) {
String s = String.format("哈哈哈 %d", i);
}
stopWatch.stop();
stopWatch.start("String add");
for (int i = 0; i < 10000000; i++) {
String s = "哈哈哈 " + i;
}
stopWatch.stop();
System.out.println(stopWatch.shortSummary());
System.out.println(stopWatch.prettyPrint());
}
}
现在有个后端下载csv文件的接口,在浏览器地址栏直接请求这个接口,下载的文件用office的excel打开不乱码(wps也能正常显示),但通过页面点击按钮来下载,保存的文件用office的excel打开就乱码(wps还是能正常显示)。
后端代码大概这样:
/**
*
* @param response
* @param checkResultFileUrl 这个文件要求是gkb编码
* @throws IOException
*/
@Override
public void downloadCheckResult(HttpServletResponse response, String checkResultFileUrl) throws IOException {
response.setCharacterEncoding("GBK");
response.addHeader("Content-Disposition", "attachment; filename=checkResult.csv");
response.addHeader("Content-Type", "text/csv");
ServletOutputStream outputStream = response.getOutputStream();
InputStream is = fileStorageService.getFileInputStream(checkResultFileUrl);
byte[] bytes = IOUtils.readFully(is, is.available());
outputStream.write(bytes);
outputStream.flush();
outputStream.close();
}
直接上图:
咋一看,怀疑红框几个是在哪定义的变量。全局一搜,并没有。奇了怪了,还能正常跑。
冷知识:jvm提供的千分位语法糖,1_000就等于1000 。
我就问:冷不冷?
比如某个ServiceA 内部引用了自身,目的是为了防止事务注解失效
public class ServiceA {
@Autowired
private ServiceA serviceA;
.......
}
在重启某个节点过程中,该节点已有的请求要求能正常响应
server:
# 开启优雅停机。关闭时如果有请求正在处理,会等待指定时间,以尽量把现有请求处理完。
# 接收到关闭请求后,不会再接受新的请求
shutdown: graceful
spring:
lifecycle:
timeout-per-shutdown-phase: 120s
@Data
public class XXXXStoreDTO {
@ExcelIgnore
private String aaaa;
@ExcelProperty(value = "*门店编码",index = 0)
private String storeNo;
@ExcelProperty("门店名称")
private String storeName;
@ExcelIgnore
private String bbbb;
}
@Override
public List<XXXXStoreDTO > getStore(String filePath) throws IOException {
URL url = new URL(filePath);
InputStream inputStream = new BufferedInputStream(url.openStream());
List<CampaignStoreDTO> allList = new ArrayList<>();
EasyExcel.read(inputStream, XXXXStoreDTO .class, new PageReadListener<XXXXStoreDTO >(dataList -> {
allList.addAll(dataList);
})).sheet().headRowNumber(1).doRead();
return allList;
}
当XXXXStoreDTO类上没有添加@Accessors(chain = true)注解后不能正常读取数据,
没有细究原因,记录下坑
我们知道如果通过docker cp 命令能提取docker容器中的文件,但这个需要要求一个能运行的容器。
那如果某个镜像在某些时候无法满足运行条件或其他原因导致不能运行的情况,如何提取镜像中的文件呢?
方法其实很简单
docker save -o aaa.tar 镜像名
如:
docker save -o aaaa.tar harbor.xxxxxx.cn/xxxxx-dev/xxxxxxxx:ce191aff7