2022年9月22日
#
@import ;@import url(/uploads/css/css/cuteeditor.css);
使用「磁碟工具程式」清除配備 apple 晶片的 mac
在 mac 清除所有內容和設定
為 macos 製作開機安裝程式
如何重新安裝 macos
@import ;@import url(/uploads/css/css/cuteeditor.css);
@import ;@import url(/uploads/css/css/cuteeditor.css);
@import ;@import url(/uploads/css/css/cuteeditor.css);
install brew:
difference between homebrew and homebrew cask
install jdk11 on mac:
@import ;@import url(/uploads/css/css/cuteeditor.css);
spring 框架下 如果要做去重,在数据量大的时候会爆error,可改用如下 写法:
private boolean needreordercheck(string requestid) {
boolean result = false;
// try(mongocursor mongocursor =
// mongotemplate.getcollection(mongotemplate.getcollectionname(accountnumproductlineindex.class))
// .distinct(key, filters.eq(request_id, requestid), string.class)
// .iterator()
// )
try(mongocursor mongocursor =
mongotemplate.getcollection(mongotemplate.getcollectionname(accountnumproductlineindex.class))
.aggregate(
arrays.aslist(
aggregates.project(
projections.fields(
projections.excludeid(),
projections.include(key),
projections.include(request_id)
)
),
aggregates.match(filters.eq(request_id, requestid)),
aggregates.group("$" key)
)
)
.allowdiskuse(true)
.iterator();
)
{
string key = null;
boolean breakme = false;
logger.info("needreordercheck.key --> start");
while(mongocursor.hasnext()) {
if(breakme) {
mongocursor.close();
break;
}
document keydocument = mongocursor.next();
key = keydocument.getstring("_id");
// key = mongocursor.next().getstring(key);
// logger.info("needreordercheck.keydocument --> {}, key --> {}", keydocument, key);
try(mongocursor indexmongocursor =
mongotemplate.getcollection(accountnumproductlineindex.collection_name)
.find(filters.and(filters.eq(request_id, requestid), filters.eq(key, key)))
.iterator()
)
{
int preindex = -1, currentindex = -1;
document preindexdocument = null, currentindexdocument;
while(indexmongocursor.hasnext()) {
currentindexdocument = indexmongocursor.next();
// system.out.println(currentindexdocument.tojson());
if(preindexdocument != null) {
currentindex = currentindexdocument.getinteger(index);
preindex = preindexdocument.getinteger(index);
if(currentindex - preindex > 1) {
indexmongocursor.close();
breakme = true;
result = true;
break;
}
}
preindexdocument = currentindexdocument;
}
}
}
}
return result;
}
@jsonformat(shape=jsonformat.shape.string, pattern="yyyy-mm-dd't'hh:mm:ss.sssz", timezone="america/phoenix")
private date date;
import lombok.requiredargsconstructor;
import org.springframework.core.io.buffer.databuffer;
import org.springframework.core.io.buffer.databufferutils;
import org.springframework.stereotype.service;
import org.springframework.web.reactive.function.client.webclient;
import reactor.core.publisher.flux;
import reactor.core.publisher.mono;
import java.io.ioexception;
import java.nio.file.files;
import java.nio.file.path;
import java.nio.file.standardopenoption;
import java.util.objects;
@service
@requiredargsconstructor
public class filedownloaderwebclientservice {
private final webclient webclient;
/**
* reads the complete file in-memory. thus, only useful for very large file
*/
public void downloadusingbytearray(path destination) throws ioexception {
mono<byte[]> monocontents = webclient
.get()
.uri("/largefiles/1")
.retrieve()
.bodytomono(byte[].class);
files.write(destination, objects.requirenonnull(monocontents.share().block()),
standardopenoption.create);
}
/**
* reading file using mono will try to fit the entire file into the databuffer.
* results in exception when the file is larger than the databuffer capacity.
*/
public void downloadusingmono(path destination) {
mono databuffer = webclient
.get()
.uri("/largefiles/1")
.retrieve()
.bodytomono(databuffer.class);
databufferutils.write(databuffer, destination,
standardopenoption.create)
.share().block();
}
/**
* having using flux we can download files of any size safely.
* optionally, we can configure databuffer capacity for better memory utilization.
*/
public void downloadusingflux(path destination) {
flux databuffer = webclient
.get()
.uri("/largefiles/1")
.retrieve()
.bodytoflux(databuffer.class);
databufferutils.write(databuffer, destination,
standardopenoption.create)
.share().block();
}
}