主頁 > 前端設計 > MC9S12G128模塊化分層化軟體架構之八_QAC靜態代碼分析

MC9S12G128模塊化分層化軟體架構之八_QAC靜態代碼分析

2020-10-24 06:55:18 前端設計

內容

修改歷史

內容

1 overview

1.1 目的

2 QAC基礎知識

2.1 introduction

2.2 message等級

2.2.1 Level 0: information

2.2.2 Level 1: Obsolete Messages

2.2.3 Level2: Minor

2.2.4 Level 3: Major

2.2.5 Level 4: Local Standards

2.2.6 Level 5: Dataflow Analysis

2.2.7 Level 6: portability

2.2.8 Level7: Undefined behavior

3 meesage help

4 QAC 報issue的點

4.1 LEVEL6: [C99] Trailing comma at the end ofan enumerator-list.

4.1.1 修改的代碼

4.2 level 7: The identifier is reservedfor use by the library.

4.2.1 例子

4.2.2 修改的代碼

4.3 level3: An expression of ‘essentially signed’ type is being used as the operand ofthis bitwise operator.

4.3.1 例子

4.3.2 對應代碼中的message

4.3.3 修改的代碼

4.4 level3: An expression of ‘essentiallyBoolean’ type is being converted to unsigned type on assignment.

4.4.1 修改的代碼

4.5 level2: Loop control variable in this ‘for’ statement is modified in the body of theloop.

4.5.1 例子

4.5.2 對應的代碼中的message

4.5.3 修改的代碼

4.6 level2: This statement has no side-effect – it can be removed.

4.6.1 例子

4.6.2 對應的代碼中的message

4.6.3 修改的代碼

4.7 level2: function with internal linkage, is being defined without a previousdeclaration.

4.7.1 對應的代碼中的message

4.7.2 修改的代碼

4.8 level 2: A function counld probablybe used instead of this function-like macro.

4.8.1 例子

4.9 level 8: initializer pointer to amore heavily qualified type.

4.9.1 例子

4.9.2 對應的代碼中的message

4.9.3 修改的代碼

4.10 level 3: A non-constant expression of‘essentially signed’ type is being converted to unsigned type on assignment.

4.10.1 對應的代碼中的message

4.10.2 修改的代碼

4.11 level 2:Array declared with unknown size.

4.11.1 例子

4.11.2 修改的代碼

4.12 Macro parameter not enclosed in ().

4.12.1 更改的代碼

5 MISRA C 2004

5.1 MISARC introduction

5.2 Rule10.1 The value of an expression of integer type shall not be implicitlyconverted to a different underlying type if: a) it is not a conversion to awider integer type of the same signedness, or b) the expression is complex, orc) the expression is not constant and is a function argument, or d) theexpression is not constant and is a return expression.

5.2.1 例子

5.2.2 根據該條rule修改的代碼

5.3 Rule20.2 The names of standard librarymacros, objects and functions shall not be reused. & Rule 1.2:No reliance shall be placed on undefined or unspecified behaviour.

5.3.1 根據該條rule修改的代碼

5.4 Rule When an array is declared withexternal linkage, its size shall be stated explicitly or defined implicitly byinitialisation.

5.4.1 例子

5.4.2 根據該條rule修改的代碼

5.5 All if … else constructs shall beterminated with an else clause.

5.5.1 例子

5.5.2 根據該條rule修改的代碼

5.6 rule 12.7Bitwise operators shall not be applied to operands whose underlying typeis signed.

5.6.1 例子

5.6.2 根據該條rule修改的代碼

5.7 Rule14.2 All non-null statements shall either have at least one side effect howeverexecuted, or cause control flow to change.

5.7.1 根據該條rule修改的代碼

5.8 Rule 8.1 functions shall haveprototype declaration and the prototype shall be visible at both the functiondefinition and call.

5.9 Rule19.7 A function should be used in preference to a function-like macro.

5.9.1 例子

5.10 Rule 19.4: C macros shall only expandto a braced initialiser, a constant, a string literal, aparenthesisedexpression, a strorage class specifier, or a do-while-zero construct.

5.10.1 例子

5.11 Rule13.6: Numeric variables being used within a for loop for iteration countingshall not be modified in the body of the loop.

5.11.1 例子

5.12 Rule 19.10 in the definition of afunction-like macro each instance of a parameter shall be enclosed inparentheses unless it is used as the operand of # or ##.

5.13 Rule 8.12: When an array is declared with externallinkage, its size shall bestated explicitly or defined implicitly by initialisation.

6 MISAR C 2012

根據QAC檢測報告修改的最新代碼下載鏈接:

https://download.csdn.net/download/Sure_gengjia/12987470

修改后的代碼的QAC報告下載鏈接:

https://download.csdn.net/download/Sure_gengjia/12987399

未修改的代碼的QAC報告下載鏈接:

https://download.csdn.net/download/Sure_gengjia/12987383

關注激活未來公眾號,后臺回復“MISAR C 2012”即可免費獲取“MISRA C_2012 Guidelines for the use of the C language in critical systems.pdf

”檔案下載鏈接,回復“QAC”即可免費獲取QAC-8.1-Win-UsersGuide.pdf使用手冊下載鏈接,

1 overview

1.1 目的

本檔案用于起點開發板的軟體優化說明,

不局限于硬體功能的實作,著眼于實作高質量、優美的軟體

2 QAC基礎知識

2.1 introduction

QA·C是用于C代碼的深度靜態分析器, QA·C旨在幫助提高軟體開發的質量,

QA·C在逐個檔案和完整專案的基礎上分析源代碼,以識別C語言的危險用法,包含1300多個警告訊息的庫用于突出顯示那些不可移植的、難以維護的、過于復雜或可能引起問題的方式撰寫的原始碼,

該工具還可以識別不符合ISO C90標準(ISO / IEC 9899:1990)或依賴于未指定、未定義的行為的語言用法,該工具會在使用ISO C99標準的特定功能時發出警告,但確實支持其中許多功能的語意,

整個專案的源代碼的警告訊息通過瀏覽器顯示,該瀏覽器對所有源檔案中出現的訊息進行分類和分組,

該工具的其他功能包括:

?提供可量化衡量代碼屬性的代碼度量:基于函式的33個,基于檔案的30個和專案級別的4個;

?功能結構圖,可深入了解控制流程;

?關系圖,用于演示函式呼叫,全域參考和檔案樹;

?關系統計分析,根據行業基準對代碼質量進行全面評估;

?跨模塊分析(CMA)功能,分析功能遞回和各種全域識別符號問題;

?一個基準模塊,可簡化對遺留代碼的修改,

2.2 message等級

QAC中將message分為10個等級,

2.2.1 Level0:information

information等級的警告重要性最低,

annotations

注釋

注釋中的語法錯誤

CMA 資訊

跨模塊分析的產生的問題,

parsing recovery

分析恢復

從決議錯誤恢復的程序中生成的資訊,

dataflow recovery

從內部資料流分析故障中恢復的程序中生成的資訊,

sub-message

額外的背景關系子訊息,用于澄清主要資訊,

2.2.2 Level 1: Obsolete Messages

保留標記為過時的訊息是為了向后兼容2個產品版本,并將隨后將其洗掉,

2.2.3 Level 2: Minor

級別2資訊識別那些可能會違反編碼標準要求的問題,但這些問題不一定是嚴重的錯誤,級別2資訊組與C語言的不同方面相關聯,

2.2.4 Level 3: Major

Major資訊是那些可能會識別出重大編碼錯誤,例外或問題的資訊,通常認為這些資訊(如7、8和9級)太重要了,以至于沒有充分的理由就無法忽略, 3級資訊組與C語言的不同方面相關聯,

2.2.5 Level 4: Local Standards

級別4資訊識別那些不符合您的編程標準的功能,按照慣例,在安裝QA·C模塊時,會將其他資訊組添加到級別4,其中將包含與編碼標準中特定規則相對應的資訊,

2.2.6 Level5: Dataflow Analysis

此級別的資訊對運行時行為進行分析,確定問題,從嚴重的問題(如未定義的行為)到經常與編碼和邏輯錯誤相關的條件,

conversion to signed

轉換成有符號

轉化成不足夠大以表示期望值的帶符號型別,

conversion to unsigned

轉化成無符號

轉化為無符號的值,被轉化的值為負數或者是太大無法表示的值,

shift operations

移位操作

結果不確定或者導致非零位丟失的移位操作,

overflow and wraparound

溢位和環繞

導致有符號算術值溢位(未定義行為)或無符號算識訓繞的操作

Array

陣列

對陣列或指標型別的物件進行的操作導致未定義的行為,

Pointer

指標

比較或減去指向不同物件的指標,

NULL pointer

空指標

對NULL指標進行算識訓取消參考操作,

Unset data

未設定的資料

訪問未設定資料的值,

Redundancy

冗余

冗余的初始化,運算式或賦值,通常與錯誤的邏輯關聯

Invariant operations

不變的操作

總是評估為true或false的運算式,經常與錯誤的邏輯相關聯,

control flow

控制流

無法訪問的代碼,無限回圈,錯誤的回傳陳述句,

overflow and wraparound:

當整數值增加到太大而無法存盤在關聯表示中時,就會發生整數溢位或環繞,發生這種情況時,該值可能會變成非常小的值或負數,當結果用于控制回圈,做出安全性決定或確定行為的偏移量或大小(例如記憶體分配,復制,串聯等)時,這對安全性至關重要,

2.2.7 Level 6: portability

ISO-C90 conformance limits

ISO-C90一致性限制

識別違反C90標準中定義的轉換限制的資訊,超出這些限制的代碼可能無法移植到符合C90標準的實作中,

ISO-C99 conformance limits

ISO-C99 一致性限制

識別違反C99標準中定義的轉換限制的訊息,超出這些限制的代碼可能無法移植到符合C99標準的實作中,

Implementation defined

代碼結構的行為方式可能會因不同的編譯器而不同,

Language extensions

QA·C能夠決議不符合C90或C99標準的代碼結構,

ISO C99 language features

不屬于C90語言定義的C99代碼結構,

2.2.8 Level 7: Undefined behavior

CMA undefined behavior

其行為在語言標準中很明顯地是未定義的且已通過跨模塊分析定義的構造,

explicitly undefined

在語言標準中其行為被明顯地描述為“未定義”的構造(不歸類為依賴資料流)

implicitly undefined

其行為未在語言標準中描述的構造,因此其行為未通過隱式定義(僅),

3 meesage help

function-like macro

用帶括號的引數串列定義的宏,該串列由零個或多個引陣列成,

4 QAC 報issue的點

4.1 LEVEL6: [C99]Trailing comma at the end of an enumerator-list.

列舉串列末尾的逗號,

ISO C99language features.

在列舉常量串列的末尾有逗號,ISO:C90無法識別此語法,但是ISO:C99允許使用此語法,

forexample:

enum ED { ZERO=0, TWO=2, FOUR=4, };

對應的MISARC 2004 rule:1.1,

4.1.1 修改的代碼

4.1.1.1 drio.h

等,

4.1.1.2 mdio_cfg.h

等,

4.2 level 7: The identifier is reserved for use by the library.

識別符號保留給庫使用,

使用保留名稱去定義一個識別符號不可取,因為該名稱可能與系統庫的現有版本或將來版本中的識別符號沖突,以下識別符號保留:

a) 以2個下劃線開頭;

b) 以1個下劃線緊跟著一個大寫字母開頭;

c) 以1個下劃線和一個其他的識別符號開頭;

4.2.1 例子

int __glob = 0; /* 不符合 */

int _Glob = 1; /* 不符合 */

對應的MISAR C 2004 rule:20.2,

4.2.2 修改的代碼

4.2.2.1 apl_key.h

等,

4.3 level 3: An expression of ‘essentially signed’ type is being used asthe operand of this bitwise operator.

原始有符號型別的運算式用作位運算的運算元,

4.3.1 例子

void foo(int a)

{

a & 1u; /* 不符合 */

a | 1u; /* 不符合 */

~a; /* 不符合 */

a >> 1u; /* 不符合 */

1u << a; /* 不符合 */

}

對應的MISARrule 12.7,

4.3.2 對應代碼中的message

4.3.2.1 drint.c

4.3.3 修改的代碼

4.3.3.1 drint.c

4.4 level3: An expression of ‘essentially Boolean’ type is being converted tounsigned type on assignment.

分配時,“基本布爾”型別的運算式將轉換為無符號型別,

相關的MISARCrule 10.1,

例子:

void foo (unsigned b);

unsigned test (int a)

{

unsigned uia = (a != 0); /*不符合*/

foo(a < 0); /*不符合*/

uia = (a < 0); /*不符合*/

return (a == 0); /*不符合*/

}

對應的MISAR C 2004rule 10.1,

4.4.1 修改的代碼

4.4.1.1 bitop.h

BYTEOP_BIT_READ原宏定義:

#defineBYTEOP_BIT_READ_AT(data, bitidx) (((uint8)(data) & BYTEOP_POWER_2(bitidx)) != 0U)

回傳的值為bool型,true or false

改為:

#defineBYTEOP_BIT_READ_AT(data, bitidx) ((((uint8)(data) & BYTEOP_POWER_2(bitidx)) != 0U) ? (uint8)1U :(uint8)0U)

回傳的值為1U或0U

4.5 level 2: Loop control variable in this ‘for’ statement is modifiedin the body of the loop.

for陳述句的回圈控制變數在回圈體中被修改了,

在此“ for”回圈中,被識別為控制變數的變數在回圈體內進行了修改,

QAC通過檢查 “ for-loop”中的3個運算式的來識別控制變數,通常,它是第二個運算式中的變數,并且是關系運算子的運算元,

在常規的for回圈中,僅在for陳述句的第三個運算式中修改回圈控制變數,回圈中其他位置的修改可能會引起混亂,

4.5.1 例子

extern void foo(void)

{

int j;

for (j = 0; j < 10; j++)

{

++j;

}

}

對應的MISARC2004rule: 13.6,

4.5.2 對應的代碼中的message

4.5.3 修改的代碼

4.5.3.1 drint.c

4.6 level 2: This statement has no side-effect – it can be removed.

陳述句沒有side-effect,可以移除,

可以被優化掉的代碼,

sideeffects: 更改執行環境的動作,訪問易失性物件,修改物件,修改檔案或呼叫執行任何這些操作的函式都是副作用,

4.6.1 例子

void foo( int x )

{

int n = 0;

n == x; /*報警告*/

}

對應的MISAR2004Rule 14.2,

4.6.2 對應的代碼中的message

4.6.3 修改的代碼

4.6.3.1 mdio.c

等,

4.7 level 2: function with internal linkage, is being defined without aprevious declaration.

一個被內部參考的函式在定義時沒有提前的宣告,

在檔案中定義的所有的函式都應在檔案頂部加原型宣告,這很有幫助,這樣可以避免在函式被宣告之前被呼叫的可能性,在檔案開始處的一個位置記錄函式介面的方式也很有用,

例子:

static voidfoo(void) /*沒有提前宣告*/

{

}

對應的MISAR 2004rule 8.1

4.7.1 對應的代碼中的message

4.7.1.1 mdio.c

4.7.2 修改的代碼

4.7.2.1 mdio.c

在檔案頭部增加static uint8 mdio_find_in_input_cfg(uint8port, uint8 pin)函式宣告,

4.8 level 2:A function counld probably be used instead of this function-like macro.

類似函式的宏應當用函式替換,

該宏是運算式的形式,因此可以用一個函式代替,用函式替換類似函式的宏并不總是可行或方便,但是函式通常比宏更安全,因為可以對引數執行型別檢查,

下面這些類似函式的宏會導致該條資訊的產生:

· 有至少一個引數;

· 不包含’#’ or ‘##’運算子;

· 不包含’ {}; ‘或任何關鍵字;

對應的MISARC2004rule: 19.7,

4.8.1 例子

#define M1(a, b, c) ( (a) + (b) + (c)) /* 不符合 */

#define M6(A, B) ((A)[1] +(B)[2]) /* 不符合 */

對應的MISAR C2004 rule 19.7,

需要寫成do-while(0)格式,

為什么寫成do-while(0)格式,請看MISARC2004rule: 19.4 和 19.10,

4.9 level 8:initializer pointer to a more heavily qualified type.

初始化程式指向更嚴格的型別,

指標已使用運算式進行了初始化,該運算式指向更嚴格的型別,

ISO: C要求被初始化物件的型別必須具有初始化者指向的型別的所有的qualifier,因此,不允許使用型別為“ const TYPE *”(指向const TYPE的指標)或“ volatile TYPE *”(指向volatile TYPE的指標)的運算式來初始化型別“ TYPE *”(指向TYPE的指標)的物件;這樣做將違反型別資格限制,

另一方面,使用型別“ TYPE *”的運算式初始化“ const TYPE *”或“ volatile TYPE *”甚至“ const volatile TYPE *”型別的物件是完全合法的,

原文:

A pointer has been initialized with anexpression which points to a more heavily qualified type.

ISO:Crequires that the type pointed to by the initialised object must have all thequalifiers of the type pointed to by the initializer. It is therefore notpermissible to initialize an object of type "TYPE *" (pointer toTYPE) with an expression of type "const TYPE *" (pointer to constTYPE) or "volatile TYPE *" (pointer to volatile TYPE); to do so wouldpermit type qualification restrictions to be violated.

On theother hand, it is perfectly legitimate to initialize an object of type"const TYPE *" or "volatile TYPE *" or even "constvolatile TYPE *" with an expression of type "TYPE *".

4.9.1 例子

extern int *gpi;

extern const int *gpci;

extern volatile int *gpvi;

extern const volatile int * gpcvi;

void test (void)

{

int *xpia = gpi; /* no message */

int *xpb = gpci; /* 不符合 */

int *xpc = gpvi; /* 不符合 */

int *xpd = gpcvi; /* 不符合 */

const int *xpcia = gpi; /* no message */

const int *xpcib = gpci; /* no message */

constint *xpcic = gpvi; /* 不符合 */

constint *xpcid = gpcvi; /* 不符合 */

volatile int *xpvia = gpi; /* no message */

volatile int *xpvib = gpci; /* 不符合 */

volatile int *xpvic = gpvi; /* no message */

volatile int *xpvod = gpcvi; /* 不符合 */

const volatile int *xpcvia = gpi; /* no message */

const volatile int *xpcvib = gpci; /* no message */

const volatile int *xpcvic = gpvi; /* no message */

const volatile int *xpcvid = gpcvi; /* no message */

}

4.9.2 對應的代碼中的message

4.9.2.1 drio_cfg.c

4.9.3 修改的代碼

4.9.3.1 drio_cfg.h

typedef uint8 * DrRegType;

改為

typedef uint8 * DrRegType;

因為DDRE的定義和使用為:

4.10 level 3: A non-constantexpression of ‘essentially signed’ type is being converted to unsigned type onassignment.

“原始有符號的”型別的非常量的運算式轉換為無符號型別,

void foo(unsigned b);

unsignedtest(short a)

{

unsigned uia = a; /* 不符合 */

foo( a + 1 ); /* 不符合 */

uia = (a – 1); /* 不符合 */

return a; /* 不符合 */

}

4.10.1 對應的代碼中的message

4.10.2 修改的代碼

4.10.2.1 drio.c

4.11 level2: Array declared with unknown size.

大小未知的陣列宣告,

陣列宣告時型別不完整,

僅當陣列具有外部連接時才允許這樣做,一些編碼標準不贊成這種做法,因為它阻止工具檢查陣列下標操作的有效性,

4.11.1 例子

extern int xa[10];

extern int xb[]; /* 警告 */

extern void foo(void)

{

xa[10] = 0; /* 警告,越界 */

xb[10] = 0; /* 沒有警告,陣列大小未知 */

}

對應的MISAR C2004 rule: 8.12,

4.11.2 修改的代碼

4.11.2.1 drio_cfg.h

4.12 Macroparameter not enclosed in ().

宏引數未包含在()中,

在某些宏中,將引數括在替換串列的括號中這一操作很重要,并非所有的宏或所有引數都是如此,這取決于宏中如何使用引數,在某些型別的運算式中,將宏引數用作運算元時就會出現問題,考慮以下示例:

#define SQUARE(A) (A * A) /* 報警告 */

extern int foo(int n)

{

int r;

r = SQUARE(n);

r = SQUARE(n + 2); /* 報警告 */

return r;

}

對應MISARC2004rule19.10,

4.12.1 更改的代碼

4.12.1.1 typedef.h

轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/188476.html

標籤:其他

上一篇:QGIS基本功 | 12 圖層的混合模式

下一篇:火災煙霧檢測資料集下載最全整理——進QQ群可直接下載

標籤雲
其他(157675) Python(38076) JavaScript(25376) Java(17977) C(15215) 區塊鏈(8255) C#(7972) AI(7469) 爪哇(7425) MySQL(7132) html(6777) 基礎類(6313) sql(6102) 熊猫(6058) PHP(5869) 数组(5741) R(5409) Linux(5327) 反应(5209) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4554) 数据框(4311) css(4259) 节点.js(4032) C語言(3288) json(3245) 列表(3129) 扑(3119) C++語言(3117) 安卓(2998) 打字稿(2995) VBA(2789) Java相關(2746) 疑難問題(2699) 细绳(2522) 單片機工控(2479) iOS(2429) ASP.NET(2402) MongoDB(2323) 麻木的(2285) 正则表达式(2254) 字典(2211) 循环(2198) 迅速(2185) 擅长(2169) 镖(2155) 功能(1967) .NET技术(1958) Web開發(1951) python-3.x(1918) HtmlCss(1915) 弹簧靴(1913) C++(1909) xml(1889) PostgreSQL(1872) .NETCore(1853) 谷歌表格(1846) Unity3D(1843) for循环(1842)

熱門瀏覽
  • vue移動端上拉加載

    可能做得過于簡單或者比較low,請各位大佬留情,一起探討技術 ......

    uj5u.com 2020-09-10 04:38:07 more
  • 優美網站首頁,頂部多層導航

    一個個人用的瀏覽器首頁,可以把一下常用的網站放在這里,平常打開會比較方便。 第一步,HTML代碼 <script src=https://www.cnblogs.com/szharf/p/"js/jquery-3.4.1.min.js"></script> <div id="navigate"> <ul> <li class="labels labels_1"> ......

    uj5u.com 2020-09-10 04:38:47 more
  • 頁面為要加<!DOCTYPE html>

    最近因為寫一個js函式,需要用到$(window).height(); 由于手寫demo的時候,過于自信,其實對前端方面的認識也不夠體系,用文本檔案直接敲出來的html代碼,第一行沒有加上<!DOCTYPE html> 導致了$(window).height();的結果直接是整個document的高 ......

    uj5u.com 2020-09-10 04:38:52 more
  • WordPress網站程式手動升級要做好資料備份

    WordPress博客網站程式在進行升級前,必須要做好網站資料的備份,這個問題良家佐言是遇見過的;在剛開始接觸WordPress博客程式的時候,因為升級問題和博客網站的修改的一些嘗試,良家佐言是吃盡了苦頭。因為購買的是西部數碼的空間和域名,每當佐言把自己的WordPress博客網站搞到一塌糊涂的時候 ......

    uj5u.com 2020-09-10 04:39:30 more
  • WordPress程式不能升級為5.4.2版本的原因

    WordPress是一款個人博客系統,受到英文博客愛好者和中文博客愛好者的追捧,并逐步演化成一款內容管理系統軟體;它是使用PHP語言和MySQL資料庫開發的,用戶可以在支持PHP和MySQL資料庫的服務器上使用自己的博客。每一次WordPress程式的更新,就會牽動無數WordPress愛好者的心, ......

    uj5u.com 2020-09-10 04:39:49 more
  • 使用CSS3的偽元素進行首字母下沉和首行改變樣式

    網頁中常見的一種效果,首字改變樣式或者首行改變樣式,效果如下圖。 代碼: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, ......

    uj5u.com 2020-09-10 04:40:09 more
  • 關于a標簽的講解

    什么是a標簽? <a> 標簽定義超鏈接,用于從一個頁面鏈接到另一個頁面。 <a> 元素最重要的屬性是 href 屬性,它指定鏈接的目標。 a標簽的語法格式:<a href=https://www.cnblogs.com/summerxbc/p/"指定要跳轉的目標界面的鏈接">需要展示給用戶看見的內容</a> a標簽 在所有瀏覽器中,鏈接的默認外觀如下: 未被訪問的鏈接帶 ......

    uj5u.com 2020-09-10 04:40:11 more
  • 前端輪播圖

    在需要輪播的頁面是引入swiper.min.js和swiper.min.css swiper.min.js地址: 鏈接:https://pan.baidu.com/s/15Uh516YHa4CV3X-RyjEIWw 提取碼:4aks swiper.min.css地址 鏈接:https://pan.b ......

    uj5u.com 2020-09-10 04:40:13 more
  • 如何設定html中的背景圖片(全屏顯示,且不拉伸)

    1 <style>2 body{background-image:url(https://uploadbeta.com/api/pictures/random/?key=BingEverydayWallpaperPicture); 3 background-size:cover;background ......

    uj5u.com 2020-09-10 04:40:16 more
  • Java學習——HTML詳解(上)

    HTML詳解 初識HTML Hyper Text Markup Language(超文本標記語言) 1 <!--DOCTYPE:告訴瀏覽器我們要使用什么規范--> 2 <!DOCTYPE html> 3 <html lang="en"> 4 <head> 5 <!--meta 描述性的標簽,描述一些 ......

    uj5u.com 2020-09-10 04:40:33 more
最新发布
  • 我的第一個NPM包:panghu-planebattle-esm(胖虎飛機大戰)使用說明

    好家伙,我的包終于開發完啦 歡迎使用胖虎的飛機大戰包!! 為你的主頁添加色彩 這是一個有趣的網頁小游戲包,使用canvas和js開發 使用ES6模塊化開發 效果圖如下: (覺得圖片太sb的可以自己改) 代碼已開源!! Git: https://gitee.com/tang-and-han-dynas ......

    uj5u.com 2023-04-20 07:59:23 more
  • 生產事故-走近科學之消失的JWT

    入職多年,面對生產環境,盡管都是小心翼翼,慎之又慎,還是難免捅出簍子。輕則滿頭大汗,面紅耳赤。重則系統停擺,損失資金。每一個生產事故的背后,都是寶貴的經驗和教訓,都是專案成員的血淚史。為了更好地防范和遏制今后的各類事故,特開此專題,長期更新和記錄大大小小的各類事故。有些是親身經歷,有些是經人耳傳口授 ......

    uj5u.com 2023-04-18 07:55:04 more
  • 記錄--Canvas實作打飛字游戲

    這里給大家分享我在網上總結出來的一些知識,希望對大家有所幫助 打開游戲界面,看到一個畫面簡潔、卻又富有挑戰性的游戲。螢屏上,有一個白色的矩形框,里面不斷下落著各種單詞,而我需要迅速地輸入這些單詞。如果我輸入的單詞與螢屏上的單詞匹配,那么我就可以獲得得分;如果我輸入的單詞錯誤或者時間過長,那么我就會輸 ......

    uj5u.com 2023-04-04 08:35:30 more
  • 了解 HTTP 看這一篇就夠

    在學習網路之前,了解它的歷史能夠幫助我們明白為何它會發展為如今這個樣子,引發探究網路的興趣。下面的這張圖片就展示了“互聯網”誕生至今的發展歷程。 ......

    uj5u.com 2023-03-16 11:00:15 more
  • 藍牙-低功耗中心設備

    //11.開啟藍牙配接器 openBluetoothAdapter //21.開始搜索藍牙設備 startBluetoothDevicesDiscovery //31.開啟監聽搜索藍牙設備 onBluetoothDeviceFound //30.停止監聽搜索藍牙設備 offBluetoothDevi ......

    uj5u.com 2023-03-15 09:06:45 more
  • canvas畫板(滑鼠和觸摸)

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>canves</title> <style> #canvas { cursor:url(../images/pen.png),crosshair; } #canvasdiv{ bo ......

    uj5u.com 2023-02-15 08:56:31 more
  • 手機端H5 實作自定義拍照界面

    手機端 H5 實作自定義拍照界面也可以使用 MediaDevices API 和 <video> 標簽來實作,和在桌面端做法基本一致。 首先,使用 MediaDevices.getUserMedia() 方法獲取攝像頭媒體流,并將其傳遞給 <video> 標簽進行渲染。 接著,使用 HTML 的 < ......

    uj5u.com 2023-01-12 07:58:22 more
  • 記錄--短視頻滑動播放在 H5 下的實作

    這里給大家分享我在網上總結出來的一些知識,希望對大家有所幫助 短視頻已經無數不在了,但是主體還是使用 app 來承載的。本文講述 H5 如何實作 app 的視頻滑動體驗。 無聲勝有聲,一圖頂百辯,且看下圖: 網址鏈接(需在微信或者手Q中瀏覽) 從上圖可以看到,我們主要實作的功能也是本文要講解的有: ......

    uj5u.com 2023-01-04 07:29:05 more
  • 一文讀懂 HTTP/1 HTTP/2 HTTP/3

    從 1989 年萬維網(www)誕生,HTTP(HyperText Transfer Protocol)經歷了眾多版本迭代,WebSocket 也在期間萌芽。1991 年 HTTP0.9 被發明。1996 年出現了 HTTP1.0。2015 年 HTTP2 正式發布。2020 年 HTTP3 或能正... ......

    uj5u.com 2022-12-24 06:56:02 more
  • 【HTML基礎篇002】HTML之form表單超詳解

    ??一、form表單是什么

    ??二、form表單的屬性

    ??三、input中的各種Type屬性值

    ??四、標簽 ......

    uj5u.com 2022-12-18 07:17:06 more