原创 git submodule 操作

Git 使用submodule 管理外鏈庫 submodule 是固定conle 的commit,默認是head 執行執行```git submodule add```或對於新clone下來宿主項目執行 ```git su

原创 Seastar- complete tutorial (3)

Seastar 是一個 c + + 庫,用於在現代多核機器上編寫高效的複雜服務器應用程序。 傳統上,用於編寫服務器應用程序的編程語言庫和框架被劃分爲兩個不同的陣營: 注重效率的陣營和注重複雜性的陣營。 有些框架非常高效,但是隻允許

原创 GDB調試core與multi-threads

1 Multi-threads debug modle 下build項目應該使用-g參數: g++ -g sample.cpp -o sample 兩種方式去進入gdb調試: Start the debugging with

原创 tip:linux終端輸出帶色彩的文本

. 終端中生成彩色輸出比較好玩,可以使用轉義序列來實現. 每種顏色都有對應的顏色碼。臂如:重置=0,黑色=30,紅色=31,綠色=32,藍色=34,洋色=35,青色=36,白色=37。 要打印彩色輸出,使用以下命令: echo -

原创 Seastar不能使用引用蒱獲的原因

seastar::future<int> incr(int i) { using namespace std::chrono_literals; // Oops, the "&" below is wrong:

原创 Seastar-Basic knowledge(1)

SeaStar is an event-driven framework allowing you to write non-blocking, asynchronouscode in a relatively straightf

原创 linux系統安裝boost庫及使用

boost::asio網絡庫編譯 安裝教程 boost 庫安裝教程 使用 server #include <boost/system/error_code.hpp> #include <iostream> #include <bo

原创 前後端交互的方式

因爲興趣想要獨立開始一個網站,在考察如何使用C++作爲後端,查到以下結論: 1、 link標籤的href屬性 2、 script標籤的src屬性 3、 img標籤的src屬性 4、 ajax發送請求 5、 表單提交發送請求 6、 a標籤的

原创 C++異步定時事件

異步std::async,std::future C++標準庫提供std::async ,std::future,兩個高級接口。 async() ,使一個callable object,在後臺運行成爲一個獨立線程。 class

原创 std::vector擴容驗證以及刪除操作

#include <vector> #include <iostream> #include <algorithm> #include <cstdlib> #include <iterator> void capacity_incre

原创 Seatsar mini-tutorial(2)

Future and promise A future is a result of a computation that may not be available yet. Examples include: 未來是計算的結果,

原创 Effective C++ item 2&3

條款2,3:使用const 1. const 和 pointer char p[] = {"1233"}; const char* ptr = p; const char* str = "awk"; 其中str指向字符串常量,

原创 Effective C++ item 4

條款四:確定對象使用前已經優化 多個編譯單元,non-local-static 對象產生時機不能確定的問題。 三點建議: - 爲內置對象進行手工初始化,因爲C++不保證初始化它們 - 構造函數最好使用初始化列表,而不要在構造函數

原创 Cmake用法彙總(二)

Cmake使用 一 ,Cmake 初級使用 項目主目錄中的 CMakeLists.txt 1 PROJECT(main) #項目名稱 2 CMAKE_MINIMUM_REQUIRED(VERSION 2.6) #版本

原创 Cmake鏈接靜態庫(一)

生成第三方庫的目錄下CMakeLists.txt: AUX_SOURCE_DIRECTORY(. DIR) #create static link library ADD_LIBRARY(sort ${DIR}) 生成第三方庫的目錄下