<noframes id="395jp"><noframes id="395jp"><video id="395jp"><video id="395jp"></video></video>
<i id="395jp"><font id="395jp"><delect id="395jp"></delect></font></i>
<nobr id="395jp"></nobr><noframes id="395jp"><noframes id="395jp"><dl id="395jp"></dl><video id="395jp"></video><noframes id="395jp"><dl id="395jp"></dl>
<video id="395jp"><video id="395jp"><dl id="395jp"></dl></video></video> <nobr id="395jp"><nobr id="395jp"><meter id="395jp"></meter></nobr></nobr>
<video id="395jp"></video><nobr id="395jp"></nobr>
<video id="395jp"></video>

paulwong

2023年12月5日 #

STATE-MACHINE resource

實現一個狀態機引擎,教你看清DSL的本質
https://blog.csdn.net/significantfrank/article/details/104996419

管理訂單狀態,該上狀態機嗎?輕量級狀態機COLA StateMachine保姆級入門教程 
https://www.cnblogs.com/rude3knife/p/cola-statemachine.html

Spring-statemachine有限狀態機(FSM)使用教程詳解
https://blog.csdn.net/ZYC88888/article/details/112793317



https://github.com/alibaba/COLA/blob/master/cola-components/cola-component-statemachine/src/test/java/com/alibaba/cola/test/StateMachineChoiceTest.java


  

posted @ 2023-12-05 10:59 paulwong 閱讀(28) | 評論 (0)編輯 收藏

如何保證同事的代碼不會腐爛?一文帶你了解 Alibaba COLA 架構

本文開始前,問大家一個問題,你覺得一份業務代碼,尤其是互聯網業務代碼,都有哪些特點?

我能想到的有這幾點:

  • 互聯網業務迭代快,工期緊,導致代碼結構混亂,幾乎沒有代碼注釋和文檔。
  • 互聯網人員變動頻繁,很容易接手別人的老項目,新人根本沒時間吃透代碼結構,緊迫的工期又只能讓屎山越堆越大。
  • 多人一起開發,每個人的編碼習慣不同,工具類代碼各用個的,業務命名也經常沖突,影響效率。
  • 大部分團隊幾乎沒有時間做代碼重構,任由代碼腐爛。

每當我們新啟動一個代碼倉庫,都是信心滿滿,結構整潔。但是時間越往后,代碼就變得腐敗不堪,技術債務越來越龐大。

這種情況有解決方案嗎?也是有的:

  1. 小組內定期做代碼重構,解決技術債務。
  2. 組內設計完善的應用架構,讓代碼的腐爛來得慢一些。(當然很難做到完全不腐爛)
  3. 設計盡量簡單,讓不同層級的開發都能快速看懂并上手開發,而不是在一堆復雜的沒人看懂的代碼上堆更多的屎山。

而COLA,我們今天的主角,就是為了提供一個可落地的業務代碼結構規范,讓你的代碼腐爛的盡可能慢一些,讓團隊的開發效率盡可能快一些。

https://github.com/alibaba/COLA

https://blog.csdn.net/significantfrank/article/details/110934799





posted @ 2023-12-05 10:31 paulwong 閱讀(29) | 評論 (0)編輯 收藏

2022年11月11日 #

reinstall Mac OS

使用「磁碟工具程式」清除配備 Apple 晶片的 Mac
https://support.apple.com/zh-hk/HT212030

在 Mac 清除所有內容和設定
https://support.apple.com/zh-hk/HT212749

為 macOS 製作開機安裝程式
https://support.apple.com/zh-hk/HT201372

如何重新安裝 macOS
https://support.apple.com/zh-hk/HT204904

posted @ 2022-11-11 22:44 paulwong 閱讀(147) | 評論 (0)編輯 收藏

How to Downgrade macOS Ventura to Monterey, Big Sur, or Earlier

https://www.drbuho.com/how-to/downgrade-macos


posted @ 2022-11-11 11:27 paulwong 閱讀(124) | 評論 (0)編輯 收藏

difference between homebrew and homebrew cask

https://brew.sh/index_zh-tw

difference between homebrew and homebrew cask
https://www.zhihu.com/question/22624898

install jdk11 on Mac:
https://medium.com/@kirebyte/using-homebrew-to-install-java-jdk11-on-macos-2021-4a90aa276f1c



posted @ 2022-11-11 11:21 paulwong 閱讀(141) | 評論 (0)編輯 收藏

install docker on Mac


https://yeasy.gitbook.io/docker_practice/install/mac

posted @ 2022-11-11 11:07 paulwong 閱讀(128) | 評論 (0)編輯 收藏

2022年10月18日 #

MONGODB SPRING DISTINCT

SPRING 框架下 如果要做去重,在數據量大的時候會爆ERROR,可改用如下 寫法:

    private boolean needReorderCheck(String requestId) {
        boolean result = false;
//        try(MongoCursor<String> mongoCursor = 
//                mongoTemplate.getCollection(mongoTemplate.getCollectionName(AccountNumProductLineIndex.class))
//                             .distinct(KEY, Filters.eq(REQUEST_ID, requestId), String.class)
//                             .iterator()
//                )
        try(MongoCursor<Document> 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<Document> 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;
    }

posted @ 2022-10-18 10:22 paulwong 閱讀(181) | 評論 (0)編輯 收藏

2022年9月22日 #

SPRING JSON TIMEZONE問題大匯總

@JsonFormat(shape=JsonFormat.Shape.STRING, pattern="yyyy-MM-dd'T'HH:mm:ss.SSSZ", timezone="America/Phoenix")
private Date date;

posted @ 2022-09-22 13:18 paulwong 閱讀(182) | 評論 (0)編輯 收藏

Downloading Large Files using Spring WebClient

https://www.amitph.com/spring-webclient-large-file-download/

https://github.com/amitrp/spring-examples/blob/main/spring-webflux-webclient/src/main/java/com/amitph/spring/webclients/service/FileDownloaderWebClientService.java

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> 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> dataBuffer = webClient
                .get()
                .uri("/largefiles/1")
                .retrieve()
                .bodyToFlux(DataBuffer.class);

        DataBufferUtils.write(dataBuffer, destination,
                StandardOpenOption.CREATE)
                .share().block();
    }
}

posted @ 2022-09-22 13:14 paulwong 閱讀(250) | 評論 (0)編輯 收藏

2022年7月18日 #

JAVA-SECURITY資源

加密與安全
https://www.liaoxuefeng.com/wiki/1252599548343744/1255943717668160

JAVA KEYSTORE 存儲在MONGODB
默認情況下,證書是放保存在文件,如果要改成MONGODB做為存儲界質,則要做以下改動:
https://github.com/jmkgreen/keystore-mongo/tree/master/keystore-mongo/src/main/java/com/github/jmkgreen/keystore/mongo

關于證書,這里有你想知道的一切
http://ifeve.com/%e5%85%b3%e4%ba%8e%e8%af%81%e4%b9%a6%e8%bf%99%e9%87%8c%e6%9c%89%e4%bd%a0%e6%83%b3%e7%9f%a5%e9%81%93%e7%9a%84%e4%b8%80%e5%88%87-md/#more-59405

posted @ 2022-07-18 11:09 paulwong 閱讀(179) | 評論 (0)編輯 收藏

僅列出標題  下一頁
久久一级片
<noframes id="395jp"><noframes id="395jp"><video id="395jp"><video id="395jp"></video></video>
<i id="395jp"><font id="395jp"><delect id="395jp"></delect></font></i>
<nobr id="395jp"></nobr><noframes id="395jp"><noframes id="395jp"><dl id="395jp"></dl><video id="395jp"></video><noframes id="395jp"><dl id="395jp"></dl>
<video id="395jp"><video id="395jp"><dl id="395jp"></dl></video></video> <nobr id="395jp"><nobr id="395jp"><meter id="395jp"></meter></nobr></nobr>
<video id="395jp"></video><nobr id="395jp"></nobr>
<video id="395jp"></video>