如何使用代码注释:关于JavaScript与TypeScript 注释和文档的自动生成
jcLee95:https://blog.csdn.net/qq_28550263?spm=1001.2101.3001.5343
邮箱 :291148484@163.com
本文地址:https://blog.csdn.net/qq_28550263/article/details/128991223
1. TSDoc:注释规范
-
1.1 注释标记简表
-
1.2 标记用法详解
- 1.2.1
@alpha - 1.2.2
@beta - 1.2.3
@decorator - 1.2.4
@deprecated - 1.2.5
@defaultValue - 1.2.6
@eventProperty - 1.2.7
@example - 1.2.8
@experimental - 1.2.9
@inheritDoc - 1.2.10
@internal - 1.2.11
@label - 1.2.12
@link - 1.2.13
@override - 1.2.14
@packageDocumentation - 1.2.15
@param - 1.2.16
@privateRemarks - 1.2.17
@public - 1.2.18
@readonly - 1.2.19
@remarks - 1.2.20
@returns - 1.2.21
@sealed - 1.2.22
@see - 1.1.23
@throws - 1.2.24
@typeParam - 1.2.25
@virtual
- 1.2.1
-
1.3 TSDoc 语法解析器的参考实现
@microsoft/TSDOC
2. JSDoc 模块:用于生成 JavaScript 接口文档
1. TSDoc:注释规范
TSDoc 是一个标准化 TypeScript 代码中使用的文档注释的建议,以便不同的工具可以提取内容而不会被彼此的标记混淆。
1.1 注释标记简表
| 注释 | 描述 |
|---|---|
@alpha | 指定 API 项的发布阶段为“alpha”。它旨在用于 第三方开发者最终,但尚未发布。该工具可能会从 公开发布。 |
@beta | 指定 API 项的发布阶段为“测试版”。它已通过实验性发布给第三方开发人员 为了收集反馈。 |
@decorator | ECMAScript 装饰器有时是一个重要的部分 的 API 协定。但是,今天TypeScript编译器不代表.d.ts输出文件中的装饰器 由 API 使用者使用。该标记提供了一种解决方法,允许将装饰器表达式括起来 在文档评论中。 |
@deprecated | 此块标记表示不再支持 API 项,并且可能会在将来的版本中删除。 标记后跟一个描述推荐替代方案的句子。它递归应用 容器的成员。例如,如果一个类被弃用,那么它的所有成员也是如此。 |
@defaultValue | 如果未显式分配值,则此块标记用于记录字段或属性的默认值。此标记只能与属于 TypeScript class 或 interface 成员的字段或属性一起使用。 |
@eventProperty | 当应用于类或接口属性时,这表示该属性 返回事件处理程序可以附加到的事件对象。事件处理 API 是实现定义的,但通常属性返回类型是一个类 与成员如 addHandler() 和 removeHandler()。文档工具可以 在“Events”标题下显示此类属性,而不是通常的“Properties”标题。 |
@example | 指示应作为示例演示如何使用 API 的文档部分。 它可能包括代码示例。 |
@experimental | 与 @beta 相同的语义,但由不支持@alpha发布阶段的工具使用。 |
@inheritDoc | 此内联标记用于通过从另一个 API 项复制 API 项的文档来自动生成该文档 接口项。内联标记参数包含对其他项的引用,该项可能是不相关的类, 甚至是从单独的 NPM 包导入。 |
@internal | 指定不计划由第三方开发人员使用 API 项。该工具可能会修剪 公开发布的声明。在某些实现中,可能允许某些指定的包 使用内部 API 项,例如,因为包是同一产品的组件。 |
@label | 内联 {@label} 标记用于标记声明,以便可以使用 TSDoc 声明引用表示法。 |
@link | {@link} 内联标记用于创建指向文档系统中其他页面或通用internet URLs的超链接。特别是,它支持引用API项的表达式。 |
@override | 这个修饰符的语义类似于C#或Java中的override关键字。对于成员函数或属性,显式指示此定义重写(即重新定义)从基类继承的定义。基类定义通常会被标记为虚拟的。 |
@packageDocumentation | 用于表示描述整个NPM包的文档注释(相对于属于该包的单个API项)。@packageDocumentation 注释位于 *.d.ts 文件中,该文件充当包的入口点,它应该是在该文件中遇到的第一个/** 注释。包含 @packageDocumentation标签的注释不应该用于描述单个API项。 |
@param | 用于记录函数参数。@param 标记后面是参数名,后面是连字符,再后面是描述。 |
@privateRemarks | 启动不面向公众的其他文档内容的一部分。 工具必须从 API 参考网站(生成的 *.d.ts 文件)中省略整个部分, 以及包含内容的任何其他输出。 |
@public | 指定 API 项的发布阶段为 “public”。已经正式发布给第三方开发者, 并且其签名保证稳定(例如,遵循语义版本控制规则)。 |
@readonly | 此修饰符标记指示API项应该被记录为只读的,即使TypeScript类型系统可能另有指示。例如,假设一个类属性有一个setter函数,它总是抛出一个异常,说明该属性不能赋值;在这种情况下,可以添加 @readonly 修饰符,以便该属性在文档中显示为只读。 |
@remarks | API项目的主要文件被分成一个简短的“总结”部分,随后是一个更详细的“备注”部分。在文档网站上,索引页(例如显示类的成员)将只显示简短的摘要,而详细页(例如描述单个成员)将显示摘要,后跟备注。@remarks 块标记结束摘要部分,并开始文档注释的备注部分。 |
@returns | 用于记录函数的返回值。 |
@sealed | 这个修饰符的语义类似于C#或Java中的 sealed 关键字。对于类,指示子类不能从类继承。对于成员函数或属性,表示子类不能覆盖(即重定义)成员。 |
@see | 用于生成对可能与 当前项目。 |
@throws | 用于记录可能由函数或属性引发的异常类型。 |
@typeParam | 用于记录通用参数。@typeParam 标记后面是参数名、连字符和说明。TSDoc解析器识别这种语法,并将它提取到DocParamBlock节点中。 |
@virtual | 这个修饰符的语义类似于C#或Java中的 virtual 关键字。对于成员函数或属性,显式指示子类可以重写(即重定义)成员。 |
1.2 标记用法详解
本节整理和翻译自 TSDoc 规范官网
1.2.1 @alpha
指定 API 项的发布阶段为“alpha”。它旨在用于 第三方开发者最终,但尚未发布。该工具可能会从 公开发布。
例如:
/*** Represents a book in the catalog.* @public*/
export class Book {/*** The title of the book.* @alpha*/public get title(): string;/*** The author of the book.*/public get author(): string;
};
在这个例子中,Book.author从包含它的类继承了它的@public名称,而Book.title被标记为“alpha”。
1.2.2 @beta
指定 API 项的发布阶段为“测试版”。它已通过实验性发布给第三方开发人员 为了收集反馈。
例如:
/*** Represents a book in the catalog.* @public*/
export class Book {/*** The title of the book.* @beta*/public get title(): string;/*** The author of the book.*/public get author(): string;
};
在这个例子中,Book.author从包含它的类继承了它的@public名称,而Book.title被标记为“beta”。
1.2.3 @decorator
ECMAScript装饰器 有时是API契约的重要组成部分。然而,今天TypeScript编译器并不表示API消费者使用的. d.ts输出文件中的装饰器。@decorator标签提供了一种变通方法,允许在doc注释中引用decorator表达式。
例如:
class Book {/*** The title of the book.* @decorator `@jsonSerialized`* @decorator `@jsonFormat(JsonFormats.Url)`*/@jsonSerialized@jsonFormat(JsonFormats.Url)public website: string;
}
1.2.4 @deprecated
此块标记表示不再支持 API 项,并且可能会在将来的版本中删除。 标记后跟一个描述推荐替代方案的句子。它递归应用 容器的成员。例如,如果一个类被弃用,那么它的所有成员也是如此。
例如:
/*** The base class for controls that can be rendered.** @deprecated Use the new {@link Control} base class instead.*/
export class VisualControl {. . .
}
1.2.5 @defaultValue
如果未显式分配值,则此块标记用于记录字段或属性的默认值。此标记只能与属于 TypeScript class 或 interface 成员的字段或属性一起使用。
例如:
enum WarningStyle {DialogBox,StatusMessage,LogOnly
}interface IWarningOptions {/*** Determines how the warning will be displayed.** @remarks* See {@link WarningStyle| the WarningStyle enum} for more details.** @defaultValue `WarningStyle.DialogBox`*/warningStyle: WarningStyle;/*** Whether the warning can interrupt a user's current activity.* @defaultValue* The default is `true` unless* `WarningStyle.StatusMessage` was requested.*/cancellable?: boolean;/*** The warning message*/message: string;
}
1.2.6 @eventProperty
当应用于类或接口属性时,这表示该属性 返回事件处理程序可以附加到的事件对象。事件处理 API 是实现定义的,但通常属性返回类型是一个类 与成员如 addHandler() 和 removeHandler()。文档工具可以 在“Events”标题下显示此类属性,而不是通常的“Properties”标题。
例如:
class MyClass {/*** This event is fired whenever the application navigates to a new page.* @eventProperty*/public readonly navigatedEvent: FrameworkEvent<NavigatedEventArgs>;
}
1.2.7 @example
指示应作为示例演示如何使用 API 的文档部分。 它可能包括代码示例。
例如:
/*** Adds two numbers together.* @example* Here's a simple example:* ```* // Prints "2":* console.log(add(1,1));* ```* @example* Here's an example with negative numbers:* ```* // Prints "0":* console.log(add(1,-1));* ```*/
export function add(x: number, y: number): number {
}
例如:
/*** Parses a JSON file.** @param path - Full path to the file.* @returns An object containing the JSON data.** @example Parsing a basic JSON file** # Contents of `file.json`* ```json* {* "exampleItem": "text"* }* ```** # Usage* ```ts* const result = parseFile("file.json");* ```** # Result* ```ts* {* exampleItem: 'text',* }* ```*/
1.2.8 @experimental
例如:
/*** Represents a book in the catalog.* @public*/
export class Book {/*** The title of the book.* @experimental*/public get title(): string;/*** The author of the book.*/public get author(): string;
};
在这个例子中,Book.author从包含它的类继承了它的@public名称,而Book.title被标记为“experimental”。
1.2.9 @inheritDoc
这个内联标签用于通过从另一个API项复制来自动生成一个API项的文档。inline tag参数包含对另一个项目的引用,它可能是一个不相关的类,甚至是从一个单独的NPM包导入的。
注意:声明引用的符号尚未最终确定。
什么被复制
@inheritDoc 标记不会复制整个注释体。仅复制以下组件:
- 摘要部分
@remarks块@params块@typeParam块@returns块
其他标签(如 @defaultValue 或 @example )不会被复制,需要显式包含在 @inheritDoc 标签之后。当指定了@inheritDoc标记时,不能在注释中指定summary部分和 @remarks 部分。
例如:
import { Serializer } from 'example-library';/*** An interface describing a widget.* @public*/
export interface IWidget {/*** Draws the widget on the display surface.* @param x - the X position of the widget* @param y - the Y position of the widget*/public draw(x: number, y: number): void;
}/** @public */
export class Button implements IWidget {/** {@inheritDoc IWidget.draw} */public draw(x: number, y: number): void {. . .}/*** {@inheritDoc example-library#Serializer.writeFile}* @deprecated Use {@link example-library#Serializer.writeFile} instead.*/public save(): void {. . .}
}
1.2.10 @internal
指定不计划由第三方开发人员使用 API 项。该工具可能会修剪 公开发布的声明。在某些实现中,可能允许某些指定的包 使用内部 API 项,例如,因为包是同一产品的组件。
例如:
/*** Represents a book in the catalog.* @public*/
export class Book {/*** The title of the book.* @internal*/public get _title(): string;/*** The author of the book.*/public get author(): string;
};
1.2.11 @label
内联 {@label} 标记用于标记声明,以便可以使用 TSDoc 声明引用表示法。
{@label}符号尚未最终确定。
例如:
export interface Interface {/*** Shortest name: {@link InterfaceL1.(:STRING_INDEXER)}* Full name: {@link (InterfaceL1:interface).(:STRING_INDEXER)}** {@label STRING_INDEXER}*/[key: string]: number;/*** Shortest name: {@link InterfaceL1.(:NUMBER_INDEXER)}* Full name: {@link (InterfaceL1:interface).(:NUMBER_INDEXER)}** {@label NUMBER_INDEXER}*/[key: number]: number;/*** Shortest name: {@link InterfaceL1.(:FUNCTOR)}* Full name: {@link (InterfaceL1:interface).(:FUNCTOR)}** {@label FUNCTOR}*/(source: string, subString: string): boolean;/*** Shortest name: {@link InterfaceL1.(:CONSTRUCTOR)}* Full name: {@link (InterfaceL1:interface).(:CONSTRUCTOR)}** {@label CONSTRUCTOR}*/new (hour: number, minute: number);
}
1.2.12 @link
{@link}内联标记用于创建指向文档系统中其他页面或通用internet URLs的超链接。特别是,它支持引用API项的表达式。
声明引用的符号尚未最终确定。
例如:
/*** Let's learn about the `{@link}` tag.** @remarks** Links can point to a URL: {@link https://github.com/microsoft/tsdoc}** Links can point to an API item: {@link Button}** You can optionally include custom link text: {@link Button | the Button class}** Suppose the `Button` class is part of an external package. In that case, we* can include the package name when referring to it:** {@link my-control-library#Button | the Button class}** The package name can include an NPM scope and import path:** {@link @microsoft/my-control-library/lib/Button#Button | the Button class}** The TSDoc standard calls this notation a "declaration reference". The notation supports* references to many different kinds of TypeScript declarations. This notation was originally* designed for use in `{@link}` and `{@inheritDoc}` tags, but you can also use it in your* own custom tags.** For example, the `Button` can be part of a TypeScript namespace:** {@link my-control-library#controls.Button | the Button class}** We can refer to a member of the class:** {@link controls.Button.render | the render() method}** If a static and instance member have the same name, we can use a selector to distinguish them:** {@link controls.Button.(render:instance) | the render() method}** {@link controls.Button.(render:static) | the render() static member}** This is also how we refer to the class's constructor:** {@link controls.(Button:constructor) | the class constructor}** Sometimes a name has special characters that are not a legal TypeScript identifier:** {@link restProtocol.IServerResponse."first-name" | the first name property}** Here is a fairly elaborate example where the function name is an ECMAScript 6 symbol,* and it's an overloaded function that uses a label selector (defined using the `{@label}`* TSDoc tag):** {@link my-control-library#Button.([UISymbols.toNumberPrimitive]:OVERLOAD_1)* | the toNumberPrimitive() static member}** See the TSDoc spec for more details about the "declaration reference" notation.*/
1.2.13 @override
这个修饰符的语义类似于C#或Java中的override关键字。对于成员函数或属性,显式指示此定义重写(即重新定义)从基类继承的定义。基类定义通常会被标记为虚拟的。
文档工具可以强制一致地应用@virtual、@override和/或@sealed修饰符,但是这不是TSDoc标准所要求的。
例如:
class Base {/** @virtual */public render(): void {}/** @sealed */public initialize(): void {}
}class Child extends Base {/** @override */public render(): void;
}
1.2.14 @packageDocumentation
用于表示描述整个NPM包的文档注释(相对于属于该包的单个API项)。
@packageDocumentation注释位于*.d.ts文件中,该文件充当包的入口点,它应该是在该文件中遇到的第一个/**注释。包含@packageDocumentation标签的注释不应该用于描述单个API项。
例如:
// Copyright (c) Example Company. All rights reserved. Licensed under the MIT license./*** A library for building widgets.** @remarks* The `widget-lib` defines the {@link IWidget} interface and {@link Widget} class,* which are used to build widgets.** @packageDocumentation*//*** Interface implemented by all widgets.* @public*/
export interface IWidget {/*** Draws the widget on the screen.*/render(): void;
}
1.2.15 @param
用于记录函数参数。
@param标记后面是参数名,后面是连字符,再后面是描述。
例如:
/*** Returns the average of two numbers.** @remarks* This method is part of the {@link core-library#Statistics | Statistics subsystem}.** @param x - The first input number* @param y - The second input number* @returns The arithmetic mean of `x` and `y`** @beta*/
function getAverage(x: number, y: number): number {return (x + y) / 2.0;
}
1.2.16 @privateRemarks
启动不面向公众的其他文档内容的一部分。 工具必须从 API 参考网站(生成的
*.d.ts文件)中省略整个部分, 以及包含内容的任何其他输出。
例如:
/*** The summary section should be brief. On a documentation web site,* it will be shown on a page that lists summaries for many different* API items. On a detail page for a single item, the summary will be* shown followed by the remarks section (if any).** @remarks** The main documentation for an API item is separated into a brief* "summary" section optionally followed by an `@remarks` block containing* additional details.** @privateRemarks** The `@privateRemarks` tag starts a block of additional commentary that is not meant* for an external audience. A documentation tool must omit this content from an* API reference web site. It should also be omitted when generating a normalized* *.d.ts file.*/
1.2.17 @public
指定 API 项的发布阶段为“public”。已经正式发布给第三方开发者, 并且其签名保证稳定(例如,遵循语义版本控制规则)。
例如:
/*** Represents a book in the catalog.* @public*/
export class Book {/*** The title of the book.* @internal*/public get _title(): string;/*** The author of the book.*/public get author(): string;
};
1.2.18 @readonly
此修饰符标记指示 API 项应记录为只读,即使 TypeScript 类型系统可能另有指示。例如,假设一个类属性有一个 setter 函数,该函数始终 引发异常,说明无法分配属性;在这种情况下,
@readonly修饰符 可以添加,以便属性在文档中显示为只读。
例如:
export class Book {/*** Technically property has a setter, but for documentation purposes it should* be presented as readonly.* @readonly*/public get title(): string {return this._title;}public set title(value: string) {throw new Error('This property is read-only!');}
}
1.2.19 @remarks
API项目的主要文件被分成一个简短的“总结”部分,随后是一个更详细的“备注”部分。在文档网站上,索引页(例如显示类的成员)将只显示简短的摘要,而详细页(例如描述单个成员)将显示摘要,后跟备注。
@remarks块标记结束摘要部分,并开始文档注释的备注部分。
例如:
/*** The summary section should be brief. On a documentation web site,* it will be shown on a page that lists summaries for many different* API items. On a detail page for a single item, the summary will be* shown followed by the remarks section (if any).** @remarks** The main documentation for an API item is separated into a brief* "summary" section optionally followed by an `@remarks` block containing* additional details.** @privateRemarks** The `@privateRemarks` tag starts a block of additional commentary that is not meant* for an external audience. A documentation tool must omit this content from an* API reference web site. It should also be omitted when generating a normalized* *.d.ts file.*/
1.2.20 @returns
用于记录函数的返回值。
例如:
/*** Returns the average of two numbers.** @remarks* This method is part of the {@link core-library#Statistics | Statistics subsystem}.** @param x - The first input number* @param y - The second input number* @returns The arithmetic mean of `x` and `y`** @beta*/
function getAverage(x: number, y: number): number {return (x + y) / 2.0;
}
1.2.21 @sealed
这个修饰符的语义类似于C#或Java中的sealed关键字。对于类,指示子类不能从类继承。对于成员函数或属性,表示子类不能覆盖(即重定义)成员。
文档工具可以强制一致地应用
@virtual、@override/或@sealed修饰符,但是这不是TSDoc标准所要求的。
例如:
在下面的代码示例中,Child.render()重写虚拟成员Base.render(),但是Base.initialize()不能被重写,因为它被标记为“sealed”。
class Base {/** @virtual */public render(): void {}/** @sealed */public initialize(): void {}
}class Child extends Base {/** @override */public render(): void;
}
1.2.22 @see
用于构建API项或可能与当前项相关的其他资源的引用列表。
注意:JSDoc试图自动超链接@see后面的文本。因为这对于纯文本是不明确的,所以TSDoc需要一个显式的{@link}标记来创建超链接。
例如:
/*** Parses a string containing a Uniform Resource Locator (URL).* @see {@link ParsedUrl} for the returned data structure* @see {@link https://tools.ietf.org/html/rfc1738|RFC 1738}* for syntax* @see your developer SDK for code samples* @param url - the string to be parsed* @returns the parsed result*/
function parseURL(url: string): ParsedUrl;
@see是块标签。每个块都成为参照列表中的一个项目。例如,文档系统可能会将上述块呈现如下:
`function parseURL(url: string): ParsedUrl;`Parses a string containing a Uniform Resource Locator (URL).## See Also
- ParsedUrl for the returned data structure
- RFC 1738 for syntax
- your developer SDK for code samples
1.1.23 @throws
用于记录可能由函数或属性引发的异常类型。
应该使用单独的
@throws块来记录每个异常类型。此标记仅供参考,并不限制引发其他类型。建议但不要求@throws块以只包含异常名的行开始。
例如:
/*** Retrieves metadata about a book from the catalog.** @param isbnCode - the ISBN number for the book* @returns the retrieved book object** @throws {@link IsbnSyntaxError}* This exception is thrown if the input is not a valid ISBN number.** @throws {@link book-lib#BookNotFoundError}* Thrown if the ISBN number is valid, but no such book exists in the catalog.** @public*/
function fetchBookByIsbn(isbnCode: string): Book;
1.2.24 @typeParam
用于记录通用参数。``@typeParam` 标记后面是参数名,后面是连字符,再后面是描述。TSDoc解析器识别这种语法,并将它提取到DocParamBlock节点中。
例如:
*** Alias for array** @typeParam T - Type of objects the list contains*/
type List<T> = Array<T>;/*** Wrapper for an HTTP Response* @typeParam B - Response body* @param <H> - Headers*/
interface HttpResponse<B, H> {body: B;headers: H;statusCode: number;
}
1.2.25 @virtual
这个修饰符的语义类似于C#或Java中的 virtual 关键字。对于成员函数或属性,显式指示子类可以重写(即重定义)成员。
文档工具可以强制一致地应用
@virtual、@override和/或@sealed修饰符,但是这不是TSDoc标准所要求的。
例如:
class Base {/** @virtual */public render(): void {}/** @sealed */public initialize(): void {}
}class Child extends Base {/** @override */public render(): void;
}
1.3 TSDoc 语法解析器的参考实现 @microsoft/TSDOC
2. JSDoc 模块:用于生成 JavaScript 接口文档
JavaScript 的 API 文档生成器。
2.1 JSDoc 的安装
npm install -g jsdoc
2.2 JSDoc 的用法
如果全局安装了 JSDoc,可以运行 jsdoc 命令来生成指定 .js 文件的文档。
例如:
jsdoc myfile.js
3. WebAPI 的 markdown 文档生成工具 apidoc-markdown
3.1 安装
pnpm install --global apidoc-markdown# For programmatic usage or local project CLI install
pnpm install apidoc-markdown
3.2 命令行工具用法
为您的API生成一个简单且可移植的Markdown文档。
其语法格式如下:
apidoc-markdown -i <path> -o <output_file> [-t <template_name>] [--multi] [--createPath] [--prepend <file_path>]
其中:
Options:--version Show version number [boolean]-i, --input Input source files path [string] [required] [default: "src"]-o, --output Output file or directory to write output to. [string] [required]-t, --template Name of the template to be used (`default`, `bitbucket`) or path to an EJS template file. [string] [default: "default"]--header Path to file content to add at the top of the documentation. [string]--footer Path to file content to add at the bottom of the documentation. [string]--prepend Path to file content to add before route groups documentation. [string]--multi Output one file per group to the `output` directory. [boolean] [default: false]--createPath Recursively create directory arborescence to the `output` directory. [boolean] [default: false]-h, --help Show help [boolean]
例如:
apidoc-markdown -i src -o doc.md Generate from `src` source files to `doc.md`apidoc-markdown --input src --output doc.md Generate from `src` source files to `doc.md`apidoc-markdown -i src -o doc.md -t bitbucket Generate from `src` source files to `doc.md` using the `bitbucket` templateapidoc-markdown -i src -o doc.md -t my_custom_template.md Generate from `src` source files to `doc.md` using a provided template fileapidoc-markdown -i src -o doc --multi Generate from `src` source files to `doc/<group>.md`apidoc-markdown - https://github.com/rigwild/apidoc-markdown
3.3 编程API用法
暂未编辑
相关文章:
如何使用代码注释:关于JavaScript与TypeScript 注释和文档的自动生成
如何使用代码注释:关于JavaScript与TypeScript 注释和文档的自动生成jcLee95:https://blog.csdn.net/qq_28550263?spm1001.2101.3001.5343 邮箱 :291148484163.com 本文地址:https://blog.csdn.net/qq_28550263/article/detail…...
Echarts 设置面积区域图(areaStyle核心)
第011个点击查看专栏目录Echarts折线区域面积图的视觉效果更加饱满丰富,在系列不多的场景下尤其适用。区域面积图将折线到坐标轴的空间设置背景色,用区域面积表达数据。通过 areaStyle 设置折线图的填充区域样式,将其设为为 {} 表示使用默认…...
pandas——字符串处理【建议收藏】
pandas——字符串处理 作者:AOAIYI 创作不易,如果觉得文章不错或能帮助到你学习,记得点赞收藏评论一下哦 文章目录pandas——字符串处理一、实验目的二、实验原理三、实验环境四、实验内容五、实验步骤1.cat() 拼接字符串2.split()切片字符串…...
反射,枚举,lambda表达式
目录 1、反射 1.1 基本概念 1.2 反射相关的类 1.3 创建 Class 对象 1.4 反射的使用 1.4.1 通过反射创建对象: 1.4.2 获取私有的构造方法 1.4.3 获取私有的成员变量 1.4.4 获取私有的方法 1.5 总结 2、枚举 2.1 认识枚举 2.2 使用枚举 2.3 枚举与反射…...
.Net Core对于RabbitMQ封装分布式事件总线
首先我们需要了解到分布式事件总线是什么; 分布式事件总线是一种在分布式系统中提供事件通知、订阅和发布机制的技术。它允许多个组件或微服务之间的协作和通信,而无需直接耦合或了解彼此的实现细节。通过事件总线,组件或微服务可以通过发布…...
GPIO功能描述
GPIO 文章目录 GPIO1. 功能描述1.1 OSCI/OSCO 引脚1.3 HSEIN/HSEOUT引脚1.2 Bit-Band1.4 VRTCAFx引脚1.5 EWKUPx引脚1.6 QSPI0 引脚1.7 LVDIN引脚1.8 SARADC引脚1.9 ADCIN引脚2. 测试项描述2.1 PAD Location2.2 LBOR和BOR复位2.3 驱动能力2.4 模拟态\高阻态2.5 SWD\JTAG2.6 输出…...
指派问题与匈牙利法讲解
指派问题概述:实际中,会遇到这样的问题,有n项不同的任务,需要n个人分别完成其中的1项,每个人完成任务的时间不一样。于是就有一个问题,如何分配任务使得花费时间最少。通俗来讲,就是n*n矩阵中&a…...
day5——冒泡排序,选择排序和插入排序的学习
选择排序冒泡排序插入排序 选择排序 选择排序的基本思路就是: 首先假定第一个的下表为所有元素中最小的一个, 然后用后面的每一个元素跟这个元素进行比较, 如果后面的元素比这个元素更小一点, 那么就将找到的最小的元素的下标和…...
Windows 数据类型 (Windows Data Types)
参考:https://learn.microsoft.com/en-us/windows/win32/winprog/windows-data-types 要求 要求值最低受支持的客户端Windows XP [仅限桌面应用]最低受支持的服务器Windows Server 2003 [仅限桌面应用]HeaderBaseTsd.h;WinDef.h;WinNT.hAPIENTRY 系统函数的调用约…...
九龙证券|本周5只新股申购,特斯拉、蔚来、理想的供应商来A股了!
据现在组织,2月13日到17日共有5只新股申购,其间上证主板2只,深证主板1只,北交所2只。 2月14日发动打新的深证主板新股多利科技成立于2010年,是一家专心于轿车冲压零部件及相关模具的开发、出产与出售的企业。从2020年…...
设计模式(持续更新)
本文主要是记录java的设计模式在实际工作中的应用案例,或者是对设计模式的个人理解及备忘 一、单例模式Singleton 工作场景(静态类): 在外部系统对接中,需要调用外部系统A的接口,但是接口是有身份校验的…...
Prometheus 告警规则
Prometheus 告警规则 Prometheus官方内置的第三方报警通知包括:邮件、 即时通讯软件(如Slack、Hipchat)、移动应用消息推送(如Pushover)和自动化运维工具(例如:Pagerduty、Opsgenie、Victorops) Promethe…...
mulesoft MCIA 破釜沉舟备考 2023.02.13.02
mulesoft MCIA 破釜沉舟备考 2023.02.13.03 1. According to MuleSoft, which deployment charcateristic applies to a microservices application architecture?2. A mule application designed to fulfil two requirements3. A mule application must periodically process…...
获取DLL运行时路径的方法
之前项目中发现的问题,记录下解决方案1. 问题背景OVVRNTool项目中,底层图像基本操作功能由DLL库函数提供,上层基于DLL封装了两个应用CMD和GUI,然后通过Qt打包分发;发布是直接采用绿色免安装的方式打包,具体…...
“华为杯”研究生数学建模竞赛2006年-【华为杯】D题:学生面试中教师安排的优化与算法(附获奖论文)
赛题描述 高校自主招生是高考改革中的一项新生事物,现在仍处于探索阶段。某高校拟在全面衡量考生的高中学习成绩及综合表现后再采用专家面试的方式决定录取与否。该校在今年自主招生中,经过初选合格进入面试的考生有N人,拟聘请老师M人。每位学生要分别接受4位老师(简称该学…...
【JavaScript】复习 【对象参数】【函数参数】
js不会检查任何参数类型,任何参数都可以作为参数传递 1、对象参数 改变量随便改,改对象要看这个对象是不是有多个变量同时指向这个对象 const 用来定义常量,只能赋值一次。 变量------->对象------->属性 被const修饰的对象 …...
如何批量提取文件名到excel表格?
批量提取文件名到excel表格?关于这个问题相信很多人都遇到过,大多数人在第一次碰到的时候都不知道如何下手,大家都会立即在百度里面搜索相关方法教程,小编也试着搜索了一下,发现找到的很多方法都大同小异,需…...
CUDA线程层次一文搞懂|参加CUDA线上训练营
设备术语 Host:CPU 和 内存 (host memory)Device:GPU 和显存 (device memory) CUDA 线程层次 CUDA 线程层次分为: Thread 所有线程执行相同的核函数并行执行 Thread Block 执行在一个 Streaming Multiprocessor (SM)…...
Linux文件默认权限:umask
umask就是指定目前用户在建立文件或目录时候的权限默认值 查看方式有两种:一种可以直接输入umask,就可以看到数字类型的权限设置值,一种则是加入umask后加入-S(Symbolic)选项,就会以符号类型的方式来显示出…...
SonicWall:请立即修复SMA 1000 漏洞
近日,网络安全供应商SonicWall发布了关于安全移动访问 (SMA) 1000设备的三个安全漏洞的紧急报告,其中包括一个高威胁性的身份验证绕过漏洞。SonicWall指出,攻击者可以利用这些漏洞绕过授权,并可能破坏易受攻击的设备。 从报告中可…...
SpringBoot-17-MyBatis动态SQL标签之常用标签
文章目录 1 代码1.1 实体User.java1.2 接口UserMapper.java1.3 映射UserMapper.xml1.3.1 标签if1.3.2 标签if和where1.3.3 标签choose和when和otherwise1.4 UserController.java2 常用动态SQL标签2.1 标签set2.1.1 UserMapper.java2.1.2 UserMapper.xml2.1.3 UserController.ja…...
Swift 协议扩展精进之路:解决 CoreData 托管实体子类的类型不匹配问题(下)
概述 在 Swift 开发语言中,各位秃头小码农们可以充分利用语法本身所带来的便利去劈荆斩棘。我们还可以恣意利用泛型、协议关联类型和协议扩展来进一步简化和优化我们复杂的代码需求。 不过,在涉及到多个子类派生于基类进行多态模拟的场景下,…...
最新SpringBoot+SpringCloud+Nacos微服务框架分享
文章目录 前言一、服务规划二、架构核心1.cloud的pom2.gateway的异常handler3.gateway的filter4、admin的pom5、admin的登录核心 三、code-helper分享总结 前言 最近有个活蛮赶的,根据Excel列的需求预估的工时直接打骨折,不要问我为什么,主要…...
Java多线程实现之Callable接口深度解析
Java多线程实现之Callable接口深度解析 一、Callable接口概述1.1 接口定义1.2 与Runnable接口的对比1.3 Future接口与FutureTask类 二、Callable接口的基本使用方法2.1 传统方式实现Callable接口2.2 使用Lambda表达式简化Callable实现2.3 使用FutureTask类执行Callable任务 三、…...
Spring AI与Spring Modulith核心技术解析
Spring AI核心架构解析 Spring AI(https://spring.io/projects/spring-ai)作为Spring生态中的AI集成框架,其核心设计理念是通过模块化架构降低AI应用的开发复杂度。与Python生态中的LangChain/LlamaIndex等工具类似,但特别为多语…...
第7篇:中间件全链路监控与 SQL 性能分析实践
7.1 章节导读 在构建数据库中间件的过程中,可观测性 和 性能分析 是保障系统稳定性与可维护性的核心能力。 特别是在复杂分布式场景中,必须做到: 🔍 追踪每一条 SQL 的生命周期(从入口到数据库执行)&#…...
Kafka主题运维全指南:从基础配置到故障处理
#作者:张桐瑞 文章目录 主题日常管理1. 修改主题分区。2. 修改主题级别参数。3. 变更副本数。4. 修改主题限速。5.主题分区迁移。6. 常见主题错误处理常见错误1:主题删除失败。常见错误2:__consumer_offsets占用太多的磁盘。 主题日常管理 …...
Modbus RTU与Modbus TCP详解指南
目录 1. Modbus协议基础 1.1 什么是Modbus? 1.2 Modbus协议历史 1.3 Modbus协议族 1.4 Modbus通信模型 🎭 主从架构 🔄 请求响应模式 2. Modbus RTU详解 2.1 RTU是什么? 2.2 RTU物理层 🔌 连接方式 ⚡ 通信参数 2.3 RTU数据帧格式 📦 帧结构详解 🔍…...
《信号与系统》第 6 章 信号与系统的时域和频域特性
目录 6.0 引言 6.1 傅里叶变换的模和相位表示 6.2 线性时不变系统频率响应的模和相位表示 6.2.1 线性与非线性相位 6.2.2 群时延 6.2.3 对数模和相位图 6.3 理想频率选择性滤波器的时域特性 6.4 非理想滤波器的时域和频域特性讨论 6.5 一阶与二阶连续时间系统 6.5.1 …...
数据库正常,但后端收不到数据原因及解决
从代码和日志来看,后端SQL查询确实返回了数据,但最终user对象却为null。这表明查询结果没有正确映射到User对象上。 在前后端分离,并且ai辅助开发的时候,很容易出现前后端变量名不一致情况,还不报错,只是单…...
