当前位置: 首页 > news >正文

如何使用代码注释:关于JavaScript与TypeScript 注释和文档的自动生成

如何使用代码注释:关于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.3 TSDoc 语法解析器的参考实现 @microsoft/TSDOC

2. JSDoc 模块:用于生成 JavaScript 接口文档


1. TSDoc:注释规范

TSDoc 是一个标准化 TypeScript 代码中使用的文档注释的建议,以便不同的工具可以提取内容而不会被彼此的标记混淆。

1.1 注释标记简表

注释描述
@alpha指定 API 项的发布阶段为“alpha”。它旨在用于 第三方开发者最终,但尚未发布。该工具可能会从 公开发布。
@beta指定 API 项的发布阶段为“测试版”。它已通过实验性发布给第三方开发人员 为了收集反馈。
@decoratorECMAScript 装饰器有时是一个重要的部分 的 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 修饰符,以便该属性在文档中显示为只读。
@remarksAPI项目的主要文件被分成一个简短的“总结”部分,随后是一个更详细的“备注”部分。在文档网站上,索引页(例如显示类的成员)将只显示简短的摘要,而详细页(例如描述单个成员)将显示摘要,后跟备注。@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 注释和文档的自动生成

如何使用代码注释&#xff1a;关于JavaScript与TypeScript 注释和文档的自动生成jcLee95&#xff1a;https://blog.csdn.net/qq_28550263?spm1001.2101.3001.5343 邮箱 &#xff1a;291148484163.com 本文地址&#xff1a;https://blog.csdn.net/qq_28550263/article/detail…...

Echarts 设置面积区域图(areaStyle核心)

第011个点击查看专栏目录Echarts折线区域面积图的视觉效果更加饱满丰富&#xff0c;在系列不多的场景下尤其适用。区域面积图将折线到坐标轴的空间设置背景色&#xff0c;用区域面积表达数据。通过 areaStyle 设置折线图的填充区域样式&#xff0c;将其设为为 {} 表示使用默认…...

pandas——字符串处理【建议收藏】

pandas——字符串处理 作者&#xff1a;AOAIYI 创作不易&#xff0c;如果觉得文章不错或能帮助到你学习&#xff0c;记得点赞收藏评论一下哦 文章目录pandas——字符串处理一、实验目的二、实验原理三、实验环境四、实验内容五、实验步骤1.cat() 拼接字符串2.split()切片字符串…...

反射,枚举,lambda表达式

目录 1、反射 1.1 基本概念 1.2 反射相关的类 1.3 创建 Class 对象 1.4 反射的使用 1.4.1 通过反射创建对象&#xff1a; 1.4.2 获取私有的构造方法 1.4.3 获取私有的成员变量 1.4.4 获取私有的方法 1.5 总结 2、枚举 2.1 认识枚举 2.2 使用枚举 2.3 枚举与反射…...

.Net Core对于RabbitMQ封装分布式事件总线

首先我们需要了解到分布式事件总线是什么&#xff1b; 分布式事件总线是一种在分布式系统中提供事件通知、订阅和发布机制的技术。它允许多个组件或微服务之间的协作和通信&#xff0c;而无需直接耦合或了解彼此的实现细节。通过事件总线&#xff0c;组件或微服务可以通过发布…...

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 输出…...

指派问题与匈牙利法讲解

指派问题概述&#xff1a;实际中&#xff0c;会遇到这样的问题&#xff0c;有n项不同的任务&#xff0c;需要n个人分别完成其中的1项&#xff0c;每个人完成任务的时间不一样。于是就有一个问题&#xff0c;如何分配任务使得花费时间最少。通俗来讲&#xff0c;就是n*n矩阵中&a…...

day5——冒泡排序,选择排序和插入排序的学习

选择排序冒泡排序插入排序 选择排序 选择排序的基本思路就是&#xff1a; 首先假定第一个的下表为所有元素中最小的一个&#xff0c; 然后用后面的每一个元素跟这个元素进行比较&#xff0c; 如果后面的元素比这个元素更小一点&#xff0c; 那么就将找到的最小的元素的下标和…...

Windows 数据类型 (Windows Data Types)

参考&#xff1a;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股了!

据现在组织&#xff0c;2月13日到17日共有5只新股申购&#xff0c;其间上证主板2只&#xff0c;深证主板1只&#xff0c;北交所2只。 2月14日发动打新的深证主板新股多利科技成立于2010年&#xff0c;是一家专心于轿车冲压零部件及相关模具的开发、出产与出售的企业。从2020年…...

设计模式(持续更新)

本文主要是记录java的设计模式在实际工作中的应用案例&#xff0c;或者是对设计模式的个人理解及备忘 一、单例模式Singleton 工作场景&#xff08;静态类&#xff09;&#xff1a; 在外部系统对接中&#xff0c;需要调用外部系统A的接口&#xff0c;但是接口是有身份校验的…...

Prometheus 告警规则

Prometheus 告警规则 Prometheus官方内置的第三方报警通知包括&#xff1a;邮件、 即时通讯软件&#xff08;如Slack、Hipchat&#xff09;、移动应用消息推送(如Pushover)和自动化运维工具&#xff08;例如&#xff1a;Pagerduty、Opsgenie、Victorops&#xff09; 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运行时路径的方法

之前项目中发现的问题&#xff0c;记录下解决方案1. 问题背景OVVRNTool项目中&#xff0c;底层图像基本操作功能由DLL库函数提供&#xff0c;上层基于DLL封装了两个应用CMD和GUI&#xff0c;然后通过Qt打包分发&#xff1b;发布是直接采用绿色免安装的方式打包&#xff0c;具体…...

“华为杯”研究生数学建模竞赛2006年-【华为杯】D题:学生面试中教师安排的优化与算法(附获奖论文)

赛题描述 高校自主招生是高考改革中的一项新生事物,现在仍处于探索阶段。某高校拟在全面衡量考生的高中学习成绩及综合表现后再采用专家面试的方式决定录取与否。该校在今年自主招生中,经过初选合格进入面试的考生有N人,拟聘请老师M人。每位学生要分别接受4位老师(简称该学…...

【JavaScript】复习 【对象参数】【函数参数】

js不会检查任何参数类型&#xff0c;任何参数都可以作为参数传递 1、对象参数 改变量随便改&#xff0c;改对象要看这个对象是不是有多个变量同时指向这个对象 const 用来定义常量&#xff0c;只能赋值一次。 变量------->对象------->属性 被const修饰的对象 …...

如何批量提取文件名到excel表格?

批量提取文件名到excel表格&#xff1f;关于这个问题相信很多人都遇到过&#xff0c;大多数人在第一次碰到的时候都不知道如何下手&#xff0c;大家都会立即在百度里面搜索相关方法教程&#xff0c;小编也试着搜索了一下&#xff0c;发现找到的很多方法都大同小异&#xff0c;需…...

CUDA线程层次一文搞懂|参加CUDA线上训练营

设备术语 Host&#xff1a;CPU 和 内存 (host memory)Device&#xff1a;GPU 和显存 (device memory) CUDA 线程层次 CUDA 线程层次分为&#xff1a; Thread 所有线程执行相同的核函数并行执行 Thread Block 执行在一个 Streaming Multiprocessor &#xff08;SM&#xff09…...

Linux文件默认权限:umask

umask就是指定目前用户在建立文件或目录时候的权限默认值 查看方式有两种&#xff1a;一种可以直接输入umask&#xff0c;就可以看到数字类型的权限设置值&#xff0c;一种则是加入umask后加入-S&#xff08;Symbolic&#xff09;选项&#xff0c;就会以符号类型的方式来显示出…...

SonicWall:请立即修复SMA 1000 漏洞

近日&#xff0c;网络安全供应商SonicWall发布了关于安全移动访问 (SMA) 1000设备的三个安全漏洞的紧急报告&#xff0c;其中包括一个高威胁性的身份验证绕过漏洞。SonicWall指出&#xff0c;攻击者可以利用这些漏洞绕过授权&#xff0c;并可能破坏易受攻击的设备。 从报告中可…...

java_网络服务相关_gateway_nacos_feign区别联系

1. spring-cloud-starter-gateway 作用&#xff1a;作为微服务架构的网关&#xff0c;统一入口&#xff0c;处理所有外部请求。 核心能力&#xff1a; 路由转发&#xff08;基于路径、服务名等&#xff09;过滤器&#xff08;鉴权、限流、日志、Header 处理&#xff09;支持负…...

Qt/C++开发监控GB28181系统/取流协议/同时支持udp/tcp被动/tcp主动

一、前言说明 在2011版本的gb28181协议中&#xff0c;拉取视频流只要求udp方式&#xff0c;从2016开始要求新增支持tcp被动和tcp主动两种方式&#xff0c;udp理论上会丢包的&#xff0c;所以实际使用过程可能会出现画面花屏的情况&#xff0c;而tcp肯定不丢包&#xff0c;起码…...

阿里云ACP云计算备考笔记 (5)——弹性伸缩

目录 第一章 概述 第二章 弹性伸缩简介 1、弹性伸缩 2、垂直伸缩 3、优势 4、应用场景 ① 无规律的业务量波动 ② 有规律的业务量波动 ③ 无明显业务量波动 ④ 混合型业务 ⑤ 消息通知 ⑥ 生命周期挂钩 ⑦ 自定义方式 ⑧ 滚的升级 5、使用限制 第三章 主要定义 …...

在rocky linux 9.5上在线安装 docker

前面是指南&#xff0c;后面是日志 sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo sudo dnf install docker-ce docker-ce-cli containerd.io -y docker version sudo systemctl start docker sudo systemctl status docker …...

Docker 运行 Kafka 带 SASL 认证教程

Docker 运行 Kafka 带 SASL 认证教程 Docker 运行 Kafka 带 SASL 认证教程一、说明二、环境准备三、编写 Docker Compose 和 jaas文件docker-compose.yml代码说明&#xff1a;server_jaas.conf 四、启动服务五、验证服务六、连接kafka服务七、总结 Docker 运行 Kafka 带 SASL 认…...

第25节 Node.js 断言测试

Node.js的assert模块主要用于编写程序的单元测试时使用&#xff0c;通过断言可以提早发现和排查出错误。 稳定性: 5 - 锁定 这个模块可用于应用的单元测试&#xff0c;通过 require(assert) 可以使用这个模块。 assert.fail(actual, expected, message, operator) 使用参数…...

python爬虫:Newspaper3k 的详细使用(好用的新闻网站文章抓取和解析的Python库)

更多内容请见: 爬虫和逆向教程-专栏介绍和目录 文章目录 一、Newspaper3k 概述1.1 Newspaper3k 介绍1.2 主要功能1.3 典型应用场景1.4 安装二、基本用法2.2 提取单篇文章的内容2.2 处理多篇文档三、高级选项3.1 自定义配置3.2 分析文章情感四、实战案例4.1 构建新闻摘要聚合器…...

uniapp中使用aixos 报错

问题&#xff1a; 在uniapp中使用aixos&#xff0c;运行后报如下错误&#xff1a; AxiosError: There is no suitable adapter to dispatch the request since : - adapter xhr is not supported by the environment - adapter http is not available in the build 解决方案&…...

什么?连接服务器也能可视化显示界面?:基于X11 Forwarding + CentOS + MobaXterm实战指南

文章目录 什么是X11?环境准备实战步骤1️⃣ 服务器端配置(CentOS)2️⃣ 客户端配置(MobaXterm)3️⃣ 验证X11 Forwarding4️⃣ 运行自定义GUI程序(Python示例)5️⃣ 成功效果![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/55aefaea8a9f477e86d065227851fe3d.pn…...

2025年渗透测试面试题总结-腾讯[实习]科恩实验室-安全工程师(题目+回答)

安全领域各种资源&#xff0c;学习文档&#xff0c;以及工具分享、前沿信息分享、POC、EXP分享。不定期分享各种好玩的项目及好用的工具&#xff0c;欢迎关注。 目录 腾讯[实习]科恩实验室-安全工程师 一、网络与协议 1. TCP三次握手 2. SYN扫描原理 3. HTTPS证书机制 二…...