2019年10月17日 星期四

static, extern in C, C++

extern

例:
xx.h
extern int a;

xx.cpp
int a = 100;

即:
    當別的cpp檔,include xx.h時,即告知linker a不在此.h與.cpp內,要去其他.o檔找。而build xx.h與xx.cpp時,會告知此a變數,可以給其他.o找到



Function或variable非class member


static function();(此變數宣告不在function裡)
static variable;(此變數宣告不在function裡)


A static function is a function whose scope is limited to the current source file.

即:
    此function只會在自己對應的.h與.cpp內被看到,當.h與.cpp被build成.o檔時,其他程式如果
需要link此function會看不到。同理,此變數只在此.h與.cpp內看的到。

static variable;(此變數宣告在function裡)

即:
    call完此function後,此variable依然存在,不會消失。



Function或variable是class member

class xxx{
  static int a;
  static void function();
}

即:
    此variable不屬於任何instance,而是屬於此class的,所有instance共用此變數,可用此變數來計算instance個數。
    此function不屬於任何instance,而是屬於此class的,未有instance即可呼叫此function。



參考:
[C/C++] 靜態函式 (static function) 2011
C/C++ 中的 static, extern 的變數

2019年9月29日 星期日

Simplify MIUI - updater-script

Use updater-script to remove some unused apps.


ui_print("");
ui_print("");
ui_print("Remove some APPs");
ui_print("");
ui_print("");
ui_print("Mount System");
run_program("/sbin/busybox","mount","/system");
ui_print("");
ui_print("");
ui_print("Start to remove system apps.");
delete_recursive("/system/app/AntHalService");
delete_recursive("/system/app/BookmarkProvider");
delete_recursive("/system/app/BugReport");
delete_recursive("/system/app/BuiltInPrintService");
delete_recursive("/system/app/CatcherPatch");
delete_recursive("/system/app/Calculator");
delete_recursive("/system/app/ConfURIDialer");
delete_recursive("/system/app/Email");
delete_recursive("/system/app/FidoAuthen");
delete_recursive("/system/app/FidoClient");
delete_recursive("/system/app/FidoCryptoService");
delete_recursive("/system/app/FileExplorer");
delete_recursive("/system/app/greenguard");
delete_recursive("/system/app/HTMLViewer");
delete_recursive("/system/app/HybridPlatform");
delete_recursive("/system/app/Joyose");
delete_recursive("/system/app/KSICibaEngine");
delete_recursive("/system/app/LiveWallpapersPicker");
delete_recursive("/system/app/MiDrive");
delete_recursive("/system/app/MiuiCompass");
delete_recursive("/system/app/MiuiContentCatcher");
delete_recursive("/system/app/MiuiScreenRecorder");
delete_recursive("/system/app/MiWallpaper");
delete_recursive("/system/app/Notes");
delete_recursive("/system/app/PaymentService");
delete_recursive("/system/app/PrintRecommendationService");
delete_recursive("/system/app/PrintSpooler");
delete_recursive("/system/app/SecurityAdd");
delete_recursive("/system/app/SecurityCoreAdd");
delete_recursive("/system/app/TouchAssistant");
delete_recursive("/system/app/UserDictionaryProvider");
delete_recursive("/system/app/WallpaperBackup");
delete_recursive("/system/app/XMCloudEngine");
ui_print("");
ui_print("");
ui_print("Start to remove priv-apps.");
delete_recursive("/system/priv-app/BackupRestoreConfirmation");
delete_recursive("/system/priv-app/Browser");
delete_recursive("/system/priv-app/Calendar");
delete_recursive("/system/priv-app/CallLogBackup");
delete_recursive("/system/priv-app/CellBroadcastReceiver");
delete_recursive("/system/priv-app/CleanMaster");
delete_recursive("/system/priv-app/CloudBackup");
delete_recursive("/system/priv-app/DownloadProviderUi");
delete_recursive("/system/priv-app/EmergencyInfo");
delete_recursive("/system/priv-app/MiDrop");
delete_recursive("/system/priv-app/MiGameCenterSDKService");
delete_recursive("/system/priv-app/MiuiScanner");
delete_recursive("/system/priv-app/MiuiVideo");
delete_recursive("/system/priv-app/MiuiGallery");
delete_recursive("/system/priv-app/Music");
delete_recursive("/system/priv-app/QuickSearchBox");
delete_recursive("/system/priv-app/SoundRecorder");
delete_recursive("/system/priv-app/SpacesManagerService");
delete_recursive("/system/priv-app/VirtualSim");
delete_recursive("/system/priv-app/WallpaperCropper");
delete_recursive("/system/priv-app/YellowPage");
ui_print("");
ui_print("");
ui_print("Un-Mount System");
unmount("/system");
ui_print("");
ui_print("");
ui_print("Done");
ui_print("");
ui_print("");


ref:
[Android] 升級包中的 updater-script 簡易撰寫教學
updater-script命令详解教你写刷机脚本
[TUTORIAL] The updater-script completely explained

2019年9月5日 星期四

Mi6 - find device storage corrupted your device is unsafe now



My Problem is like the under reference website. Please check the under first one reference website #3,062.

I have fixed the problem, but I don't know the root cause.

1. Install OmniRom(clean dalvik, cache, and internal).
2. Install magisk to root OS(clean dalvik, cache, and internal).
3. Boot to os and reboot to twrp.
4. Reinstall xiaomi.eu_multi_MI6_V10.3.1.0.OCACNXM_v10-8.0.zip.
5. Boot to OS and I find the problem is fixed.

Reference:
MIUI 10.0/10.1/10.2/10.3/10.4 STABLE RELEASE
[Discussion] find device storage corrupted your device is unsafe now
find device storage corrupted your device is unsafe now

2019年9月2日 星期一

Facebook App 自動播放影片,音效關閉


右上三條線-->設定和隱私-->設定-->媒體和聯絡人-->媒體和聯絡人

自動播放影片,音效關閉
->動態消息的影片音效已開啟-->關閉

應用程式中的音效-->關閉

關閉自動播放影片功能
->自動播放-->永遠不要自動播放影片

2019年8月19日 星期一

汽車維修資訊

網路上找到相關文章,先整理。

底牌輪胎
銓威輪胎
銓哥
新竹市中華路一段182號
0972118795

保養維護
宇田汽車
華哥
新竹縣竹北市光明十四街20號(中華路路口~光明六路與福興路中間)
0933-118-245

聖發汽車保養廠
小黑
302新竹縣竹北市麻園三路210號
0928-649-226

冷氣維修
竹東-振騰
310新竹縣竹東鎮中興路一段147巷18號 竹北-誠天 302新竹縣竹北市中華路180號

大溪-權盛機電
桃園市大溪區仁和西街80號


PS濕式變速箱維修
台中志育變速箱整修, 含後曲軸油封 , 五萬一
保固一年
Power Shift 變速箱 (濕式)維修心得 - Mobile01
https://www.mobile01.com/topicdetail.php?f=260&t=5386626&p=47


台北正佳
台北市中山區濱江街301巷8號


泰誠變速箱
地址: 247新北市蘆洲區復興路323巷12-10號
電話: 02 2848 8834
Power Shift 變速箱 (濕式)維修心得 - FSC
http://www.focus-sport.club.tw/viewthread.php?tid=489594&extra=page%3D1&page=11

2019年6月27日 星期四

勁戰四 規格

輪胎:
前:100/90-12
後:120/70-12


大燈:
H4 60/55W


方向燈
前、後:1156斜角

2019年5月27日 星期一

Excel Function

=RAND()-->Random一個值,介於0~1( >= 0, < 1)

=RAND()*(b-a)+a-->Random一個值,介於a~b( >= a, < b)

=INT(RAND()*X)-->Random一個值,小於X的整數

=RANDBETWEEN(B1,C1) -->Random一個值,介於儲存格B1, C1

=IF(MOD(RANDBETWEEN(Parameters!B1,Parameters!C1), 2)=0,"+","-") -->Random一個值,介於儲存格B1, C1,再Mod 2,1的話顯示+, 2的話顯示-

=EVALUATE(A1&B1&C1),EVALUATE可以把字串當運算式,運算

Ctrl + F3(開名稱管理員)-->新增Function
Name: calculate(隨便命名)
參照=EVALUATE(A1&B1&C1)

在儲存格,輸入=calculate