A module in Node.js is a logical encapsulation of code in a single unit. It’s always a good programming practice to always segregate code in such a way that makes it more manageable and maintainable for future purposes. That’s where modules in Node.js comes in action.

Since each module is an independent entity with its own encapsulated functionality, it can be managed as a separate unit of work.

由于每个模块都是具有其自身封装功能的独立实体,因此可以将其作为单独的工作单元进行管理

In this tutorial, will learn-

  • What are modules in Node.js
  • Using modules in Node.js
  • Creating NPM modules
  • Extending modules
  • Publishing NPM Modules
  • Managing third-party packages with npm
  • What is the package.json file

What are modules in Node.js?

As stated earlier, modules in Node.js are a way of encapsulating code in a separate logical unit. There are many ready made modules available in the market which can be used within Node.js.

如前所述,Node.js中的模块是一种将代码封装在单独的逻辑单元中的方法。市场上有很多现成的模块可以在Node.js中使用。

Below are some of the popular modules which are used in a Node.js application

  1. Express framework – Express is a minimal and flexible Node.js web application framework that provides a robust set of features for the web and mobile applications.

    Express是一个最小且灵活的Node.js Web应用程序框架,为Web和移动应用程序提供了一组强大的功能

  2. Socket.io - Socket.IO enables real-time bidirectional event-based communication. This module is good for creation of chatting based applications.

    Socket.IO支持基于事件的实时双向通信。该模块非常适合创建基于聊天的应用程序

  3. Pug - Pug is a high-performance template engine and implemented with JavaScript for node and browsers.

    Pug是一种高性能的模板引擎,并使用JavaScript实现了针对node和浏览器的功能

  4. MongoDB - The MongoDB Node.js driver is the officially supported node.js driver for MongoDB.

    MongoDB Node.js驱动程序是MongoDB官方支持的node.js驱动程序。

  5. Restify - restify is a lightweight framework, similar to express for building REST APIs

    restify是一个轻量级框架,类似于用于构建REST API的表达

  6. Bluebird - Bluebird is a fully-featured promise library with a focus on innovative features and performance

Using modules in Node.js

In order to use modules in a Node.js application, they first need to be installed using the Node package manager.

为了在Node.js应用程序中使用模块,首先需要使用Node软件包管理器来安装它们。下面的命令行显示了如何安装“ express”模块。

The below command line shows how a module “express” can be installed.

npm install express

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-yJFd0tBH-1590234883918)(https://www.guru99.com/images/NodeJS/npm_install_express.png)]

  • The above command will download the necessary files which contain the “express modules” and take care of the installation as well

    上面的命令将下载包含“ express modules”的必要文件,并负责安装

  • Once the module has been installed, in order to use a module in a Node.js application, you need to use the ‘require’ keyword. This keyword is a way that Node.js uses to incorporate the functionality of a module in an application.

    安装模块后,为了在Node.js应用程序中使用模块,您需要使用’require’关键字。此关键字是Node.js用于在应用程序中合并模块功能的一种方式

    Let’s look at an example of how we can use the “require” keyword. The below “Guru99” code example shows how to use the require function

    让我们看一个示例,说明如何使用“ require”关键字。下面的“ Guru99”代码示例显示了如何使用require函数

    [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-YvOfDNcg-1590234883920)(https://www.guru99.com/images/NodeJS/010716_0523_NodejsModul1.png)]

    注意在写代码时var应改为const

    const express = require('express');
    const app = express();app.set('view engine','pug');
    app.get('/',function(req,res) {
    });
    const server = app.listen(3000,function() {
    });
    
1. In the first statement itself, we are using the "require" keyword to include the express module. The "express" module is an optimized JavaScript library for Node.js development. This is one of the most commonly used Node.js modules.
在第一个语句本身中,我们使用“ require”关键字来包含Express模块。“ express”模块是用于Node.js开发的优化的JavaScript库。这是最常用的Node.js模块之一2. After the module is included, in order to use the functionality within the module, an object needs to be created. Here an object of the express module is created.
包含模块后,为了使用模块内的功能,需要创建一个对象。此处创建了Express模块的对象。3. Once the module is included using the "require" command and an "object" is created, the required methods of the express module can be invoked. Here we are using the set command to set the view engine, which is used to set the templating engine used in Node.js.
一旦使用“ require”命令将模块包括在内并创建了“对象”,便可以调用快速模块的所需方法。在这里,我们使用set命令设置视图引擎,该视图引擎用于设置Node.js中使用的模板引擎Note:(Just for the reader's understanding; a templating engine is an approach for injecting values in an application by picking up data from data files. This concept is pretty famous in Angular JS wherein the curly braces {{ key }} is used to substitutes values in the web page. The word 'key' in the curly braces basically denotes the variable which will be substituted by a value when the page is displayed.)
注意:模板引擎是一种通过从数据文件中拾取数据来在应用程序中注入值的方法。这个概念在Angular JS中非常有名,其中花括号{{key}}用于替换网页中的值。大括号中的“键”一词基本上表示在显示页面时将由值替换的变量。)4. Here we are using the listen to method to make the application listen on a particular port number.
在这里,我们使用listen方法来使应用程序侦听特定的端口号Creating NPM modulesNode.js has the ability to create custom modules and allows you to include those custom modules in your Node.js application.
Node.js能够创建自定义模块,并允许您将这些自定义模块包括在Node.js应用程序中Let's look at a simple example of how we can create our own module and include that module in our main application file. Our module will just do a simple task of adding two numbers.
让我们看一个简单的示例,说明如何创建自己的模块并将该模块包含在主应用程序文件中。我们的模块将完成一个简单的添加两个数字的任务Let's follow the below steps to see how we can create modules and include them in our application.
让我们按照以下步骤查看如何创建模块并将其包含在我们的应用程序中

Step 1) Create a file called “Addition.js” and include the below code. This file will contain the logic for your module.

Below is the code which would go into this file;

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-mek4t6Tc-1590234883922)(https://www.guru99.com/images/NodeJS/010716_0523_NodejsModul2.png)]

// 上图代码为Node.js V8.4.0
// 以下代码为Node.js V12.16.3
module.exports.AddNumber = (a, b) => {return a + b;
};

Step 2) Create a file called “app.js,” which is your main application file and add the below code

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Gcc2tN2L-1590234883924)(https://www.guru99.com/images/NodeJS/010716_0523_NodejsModul3.png)]

// 上图代码为Node.js V8.4.0
// 以下代码为Node.js V12.16.3
const Addition = require('./Addition')
console.log(Addition.AddNumber(1, 2));
  1. We are using the “require” keyword to include the functionality in the Addition.js file.

  2. Since the functions in the Addition.js file are now accessible, we can now make a call to the AddNumber function. In the function, we are passing 2 numbers as parameters. We are then displaying the value in the console.

    [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-g31y6XUO-1590234883925)(https://www.guru99.com/images/NodeJS/010716_0523_NodejsModul4.png)]

Output:

  • When you run the app.js file, you will get an output of value 3 in the console log.
  • The result is because the AddNumber function in the Addition.js file was called successfully, and the returned value of 3 was displayed in the console.

Note: - We are not using the “Node package manager” as of yet to install our Addition.js module. This is because the module is already part of our project on the local machine. The Node package manager comes in the picture when you publish a module on the internet, which we see in the subsequent topic.

Extending modules

When creating modules, it is also possible to extend or inherit one module from another.

创建模块时,还可以扩展或继承另一个模块

In modern-day programming, it’s quite common to build a library of common modules and then extend the functionality of these common modules if required.

在现代编程中,通常会先建立一个通用模块库,然后根据需要扩展这些通用模块的功能

Let’s look at an example of how we can extend modules in Node.js.

让我们看一下如何在Node.js中扩展模块的示例

Step 1) Create the base module.

In our example, create a file called “Tutorial.js” and place the below code.

In this code, we are just creating a function which returns a string to the console. The string returned is “Guru99 Tutorial”.

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-nFZhF9QW-1590234883926)(https://www.guru99.com/images/NodeJS/010716_0523_NodejsModul5.png)]

module.exports.tutorial = () => {console.log('Guru99 Tutorial');
};

Step 2) Next, we will create our extended module. Create a new file called “NodeTutorial.js” and place the below code in the file.

const Tutor = require('./Tutorial');module.exports.NodeTutorial = () => {console.log('Node Tutorial');Tutor.tutorial();
};

Note, the following key points about the above code

  1. We are using the “require” function in the new module file itself. Since we are going to extend the existing module file “Tutorial.js”, we need to first include it before extending it.
  2. We then create a function called “Nodetutorial.” This function will do 2 things,
  • It will send a string “Node Tutorial” to the console.
  • It will send the string “Guru99 Tutorial” from the base module “Tutorial.js” to our extended module “NodeTutorial.js”.

Step 3) Create your main app.js file, which is your main application file and include the below code.

const localTutor = require('./NodeTutorial');localTutor.NodeTutorial();

Publishing NPM(Node Package Manager) Modules

One can publish their own module to their own Github repository.

By publishing your module to a central location, you are then not burdened with having to install yourself on every machine that requires it.

Instead, you can use the install command of npm and install your published npm module.

The following steps need to be followed to publish your npm module

Step 1) Create your repository on GitHub (an online code repository management tool). It can be used for hosting your code repositories.

在GitHub(在线代码存储库管理工具)上创建存储库。它可以用于托管您的代码存储库

Step 2) You need to tell your local npm installation on who you are. Which means that we need to tell npm who is the author of this module, what is the email id and any company URL, which is available which needs to be associated with this id. All of these details will be added to your npm module when it is published.

The below commands sets the name, email and URL of the author of the npm module.

npm set init.author.name “Unity.”

npm set init.author.email "guru99@gmail.com "

npm set init.author.url http://Guru99.com

Step 3) The next step is to login into npm using the credentials provided in the last step. To login, you need to use the below command

npm login

Step 4) Initialize your package – The next step is to initialize the package to create the package.json file. This can be done by issuing the below command

npm init

When you issue the above command, you will be prompted for some questions. The most important one is the version number for your module.

Step 5) Publish to GitHub – The next step is to publish your source files to GitHub. This can be done by running the below commands.

发布到GitHub –下一步是将源文件发布到GitHub。可以通过运行以下命令来完成

git add.
git commit -m "Initial release"
git tag v0.0.1 
git push origin master --tags

Step 6) Publish your module – The final bit is to publish your module into the npm registry. This is done via the below command.

发布模块–最后一点是将模块发布到npm注册表中。这是通过以下命令完成的

npm publish

Managing third party packages with npm

As we have seen, the “Node package manager” has the ability to manage modules, which are required by Node.js applications.

如我们所见,“ Node包管理器”具有管理Node.js应用程序所需的模块的能力

Let’s look at some of the functions available in the node package manager for managing modules

  1. Installing packages in global mode – Modules can be installed at the global level, which just basically means that these modules would be available for all Node.js projects on a local machine. The example below shows how to install the “express module” with the global option.

    以全局模式安装软件包–模块可以在全局级别安装,这基本上意味着这些模块可用于本地计算机上的所有Node.js项目。下面的示例显示了如何使用全局选项安装“ express模块”。

    npm install express –global

    The global option in the above statement is what allows the modules to be installed at a global level.

    上述语句中的global选项是允许在全局级别安装模块的选项

  2. Listing all of the global packages installed on a local machine. This can be done by executing the below command in the command prompt

    列出安装在本地计算机上的所有全局软件包。这可以通过在命令提示符下执行以下命令来完成

    npm list --global

    Below is the output which will be shown, if you have previously installed the “express module” on your system.

    如果您先前在系统上安装了“ express模块”,则将显示以下输出

    Here you can see the different modules installed on the local machine.

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-x8RW1PB5-1590234883927)(https://www.guru99.com/images/NodeJS/010716_0523_NodejsModul8.png)]

  1. Installing a specific version of a package – Sometimes there may be a requirement to install just the specific version of a package. Once you know package name and the relevant version that needs to be installed, you can use the npm install command to install that specific version.

The example below shows how to install the module called underscore with a specific version of 1.7.0

npm install underscore@1.7.0

  1. Updating a package version – Sometimes you may have an older version of a package in a system, and you may want to update to the latest one available in the market. To do this, one can use the npm update command. The example below shows how to update the underscore package to the latest version

npm update underscore

  1. Searching for a particular package – To search whether a particular version is available on the local system or not, you can use the search command of npm. The example below will check if the express module is installed on the local machine or not.

搜索特定的软件包–要搜索本地系统上是否有特定的版本,可以使用npm的search命令。下面的示例将检查Express模块是否已安装在本地计算机上

npm search express

  1. Uninstalling a package – The same in which you can install a package, you can also uninstall a package. The uninstallation of a package is done with the uninstallation command of npm. The example below shows how to uninstall the express module

npm uninstall express

What is the package.json file

The “package.json” file is used to hold the metadata about a particular project. This information provides the Node package manager the necessary information to understand how the project should be handled along with its dependencies.

“ package.json”文件用于保存有关特定项目的元数据。此信息为Node包管理器提供了必要的信息,以了解应如何处理项目及其依赖项

The package.json files contain information such as the project description, the version of the project in a particular distribution, license information, and configuration data.

package.json文件包含诸如项目描述,特定分发中的项目版本,许可证信息和配置数据之类的信息

The package.json file is normally located at the root directory of a Node.js project.

package.json文件通常位于Node.js项目的根目录下

Let’s take an example of how the structure of a module looks when it is installed via npm.

The below snapshot shows the file contents of the express module when it is included in your Node.js project. From the snapshot, you can see the package.json file in the express folder.

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-3QuMJowA-1590234883928)(https://www.guru99.com/images/NodeJS/010716_0523_NodejsModul9.png)]

If you open the package.json file, you will see a lot of information in the file.

Below is a snapshot of a portion of the file. The express@~4.13.1 mentions the version number of the express module being used.

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-et85BdCl-1590234883928)(https://www.guru99.com/images/NodeJS/010716_0523_NodejsModul10.png)]

Summary

  • A module in Node.js is a logical encapsulation of code in a single unit. Separation into modules makes code more manageable and maintainable for future purposes

    Node.js中的模块是代码在单个单元中的逻辑封装。分离成模块使代码更易于管理和维护,以备将来使用

  • There are many modules available in the market which can be used within Node.js such as express, underscore, MongoDB, etc.

  • The node package manager (npm) is used to download and install modules which can then be used in a Node.js application.

  • One can create custom NPM modules, extend these modules, and also publish these modules.

    可以创建自定义NPM模块,扩展这些模块,也可以发布这些模块

  • The Node package manager has a complete set of commands to manage the npm modules on the local system such as the installation, un-installation, searching, etc.

  • The package.json file is used to hold the entire metadata information for an npm module.

PM modules, extend these modules, and also publish these modules.

可以创建自定义NPM模块,扩展这些模块,也可以发布这些模块

  • The Node package manager has a complete set of commands to manage the npm modules on the local system such as the installation, un-installation, searching, etc.

  • The package.json file is used to hold the entire metadata information for an npm module.

查看全文
如若内容造成侵权/违法违规/事实不符,请联系编程学习网邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!

相关文章

  1. node.js+mongodb

    安装: Node.js : 0.10.32Express : 4.10.2MongoDB : 2.6.1sublime3过程中要用到的东西amaze ui前端框架,放在public文件夹下与其他并列vue和jquery:vue.js ,jquery-2.1.4.min.js,JSXTranformer.js放在javascripts里安装的包有:"async": "^1.5.0"…...

    2024/5/8 10:14:17
  2. 如何使用Node.js解析JSON?

    我应该如何使用Node.js解析JSON? 是否有一些模块可以安全地验证和解析JSON? #1楼我想提一下,全局JSON对象还有其他选择。 JSON.parse和JSON.stringify都是同步的,因此,如果要处理大对象,则可能需要检出一些异步JSON模块。 看看: https : //github.com/joyent/node/wik…...

    2024/5/8 12:52:42
  3. Fundebug后端Node.js插件更新至0.2.0,支持监控Express慢请求

    摘要: 性能问题也是BUG,也需要监控。Fundebug后端Node.js异常监控服务 Fundebug是专业的应用异常监控平台,我们Node.js插件fundebug-nodejs可以提供全方位的异常监控,支持Express、Koa以及Hapi框架。 从用户的角度理解,性能问题某种程度上也是BUG,它可能是数据库的索引问…...

    2024/4/15 3:55:27
  4. node打包工具--Pgk

    使用pkg打包Node.js应用的方法步骤 Node.js应用不需要经过编译过程,可以直接把源代码拷贝到部署机上执行,确实比C++、Java这类编译型应用部署方便。然而,Node.js应用执行需要有运行环境,意味着你需要先在部署机器上安装Node.js。虽说没有麻烦到哪里去,但毕竟多了一个步骤,…...

    2024/4/15 3:55:26
  5. 一次一个微优化,改进Node.js应用的吞吐量

    \本文要点\借助分组或批量写,尽量最小化系统调用数量。 \考虑应用中各种定时器的发布和清除开销。 \CPU性能分析器能提供有用的信息,但是不会告诉问题的原委。 \慎用ECMAScript高级特性,尤其是在未使用最新版JavaScript引擎或源码到源码的编译器时。 \控制QDF依赖树,并对依…...

    2024/4/18 17:39:38
  6. 初学node.js(二)npm、模块更新、异步回调

    继续学习node.js~ 表示在公司每天都能学到新的知识点,很happy了~Node.js - npmnpm 表示节点程序包管理器。npm 提供以下两个主要功能:Node.js包/模块的在线软件仓库 命令行实用程序安装包,作为Node.js版本管理和依赖包管理。Node.js v0.6.3版本后才开始捆绑 npm 安装。为了…...

    2024/4/15 3:55:24
  7. node.js连接mongodb

    学会简单的nodejs之后我们就可以开始试着学习连接数据库了,这里我向大家推荐mongodb(mongodb的下载与安装网上资料都有,我就不重复做工了,如果有什么问题的话也可以私信我)。 mongpdb的学习在这里推荐这个网站http://www.runoob.com/mongodb/mongodb-tutorial.html简单易懂…...

    2024/5/8 19:31:30
  8. Node.js简单爬虫开发过程

    背景:c#课上老师问我怎么没有课本,面对30多块的课本表示并不想买,于是各种搜索结果只在书问网看见有电子版,并且只能免费预览几十页。过程:1.本着能不花钱就不花钱的原则,提示我付费继续阅读后清除浏览器数据发现又可以继续看几十页,得出结果:禁用cookie即可无限预览。…...

    2024/4/19 5:42:10
  9. Node.js中package.json中库的版本号详解(^和~区别)

    Node.js中package.json中库的版本号详解(^和~区别)当我们查看package.json中已安装的库的时候,会发现他们的版本号之前都会加一个符号,有的是插入符号(^),有的是波浪符号(~)。那么他们到底有什么区别呢?先贴一个例子,对照例子来做解释:"dependencies": {&q…...

    2024/5/8 23:40:36
  10. Node.js项目的package.json配置文件中的devdependencies 和 dependencies的区别

    1、dependencies和devDependencies 具体代码如下"name": "webpack-react-express","version": "0.2.0","private": true,"dependencies": {"antd": "^2.13.11","babel-polyfill": …...

    2024/4/24 13:31:05
  11. 在 Node.js 应用中集成 Redis

    Node.js 在搭建快速轻量型的 HTTP 服务或 Web 应用有其独特的优势:快速而又友好的开发,单线程消息驱动带来的高并发高吞吐。随着 HTTP 服务或者 Web 应用访问量的加大,传统数据库的读写能力将逐渐成为系统的瓶颈点。为了突破关系型数据库最大读写上限,引入高速内存缓存将是…...

    2024/4/24 13:31:07
  12. 使用bluebird解决promise兼容性问题

    //引入promiseif(!Promise){ var Promise = require("bluebird"); // Configure Promise.config({ longStackTraces: true, warnings: true // note, run node with --trace-warnings to see full stack traces for warnings }) } 转载于:https…...

    2024/4/24 13:31:03
  13. 你不知道的Node.js性能优化,读了之后水平直线上升

    本文由云+社区发表“当我第一次知道要这篇文章的时候,其实我是拒绝的,因为我觉得,你不能叫我写马上就写,我要有干货才行,写一些老生常谈的然后加上好多特技,那个 Node.js 性能啊好像 Duang~ 的一下就上去了,那读者一定会骂我,Node.js 根本没有这样搞性能优化的,都是假…...

    2024/5/9 0:02:44
  14. Node.js方法错误自动重试的实现

    在使用Node.js实现爬虫、检测等功能时,经常会遇到大量网络请求的情况,这时很容易因为超时而使得请求失败。为令结果正确,我们一般会设置一定的失败重试次数,以避免因网络波动引起的失败。若多次尝试最终失败,才抛出错误。下面上一段代码:/*** 包裹方法,使其自动错误重试…...

    2024/4/24 13:31:01
  15. node.js中对 redis 的安装和基本操作

    一、win下安装redishttps://github.com/MicrosoftArchive/redis/releases下载Redis-x64-3.2.100.zip,然后解压,放到自定义目录。 然后打开命令行工具,进入到该目录下,运行安装redis服务。redis-server.exe --service-install redis.windows-service.conf --loglevel verbos…...

    2024/5/8 14:17:26
  16. Node.js ORM 框架 sequelize 实践

    最近在做团队的一个内部系统,这次使用的nodejs web框架是团队统一的hapi.js,而数据库依然是mysql,ORM 框架选用有着6000+ stars 的 sequelize.js,hapi-sequelize插件对sequelize做了很简单的封装,可以让我们很自如地在hapi中游走,比如配置和调用。初始化 sequelize// ser…...

    2024/5/8 20:06:44
  17. Node.js仅仅是个过渡方案?

    文章翻译自:http://www.philipotoole.com/is-node-js-just-a-stopgap/?utm_source=nodeweekly&utm_medium=emailNode.js总有些不太对劲的地方。我编写Node.js程序至今已经有一年时间,总体感觉编写Node.js程序是很有趣的,但我认为Node.js只是个过渡性方案,在需求出现而…...

    2024/5/8 23:45:59
  18. Node.js 101(3): generator

    原文地址——http://blog.chrisyip.im/nodejs-101-generator之前介绍了 Promiseand async,现在来说说 ECMAScript 6 新加入的 Generator。In computer science, a generator is a special routine that can be used to control the iteration behaviour of a loop. In fact, a…...

    2024/4/24 13:30:57
  19. 《Node.js设计模式》基于ES2015+的回调控制流

    本系列文章为《Node.js Design Patterns Second Edition》的原文翻译和读书笔记,在GitHub连载更新,同步翻译版链接。 欢迎关注我的专栏,之后的博文将在专栏同步: Encounter的掘金专栏 知乎专栏 Encounter的编程思考 segmentfault专栏 前端小站 Asynchronous Control Flow P…...

    2024/4/24 13:30:56
  20. Node.js 根本没有这样搞性能优化的?

    1、使用最新版本的 Node.js 仅仅是简单的升级 Node.js 版本就可以轻松地获得性能提升,因为几乎任何新版本的 Node.js 都会比老版本性能更好,为什么? Node.js 每个版本的性能提升主要来自于两个方面: V8 的版本更新; Node.js 内部代码的更新优化。 例如最新的 V8 7.1 中,就…...

    2024/4/20 12:41:50

最新文章

  1. 电-热耦合市场联合出清!考虑均衡约束的综合能源系统电-热分配方法程序代码!

    前言 随着现代城市面临环境问题,原来燃煤的水和空间供暖设备已逐渐被电锅炉和热泵等电气设备所取代。此外,集中生产热能并通过管网分配热能的区域供暖系统,由于其更高的效率,在冬季漫长寒冷的国家和地区越来越受欢迎。供暖设备的…...

    2024/5/9 3:02:37
  2. 梯度消失和梯度爆炸的一些处理方法

    在这里是记录一下梯度消失或梯度爆炸的一些处理技巧。全当学习总结了如有错误还请留言,在此感激不尽。 权重和梯度的更新公式如下: w w − η ⋅ ∇ w w w - \eta \cdot \nabla w ww−η⋅∇w 个人通俗的理解梯度消失就是网络模型在反向求导的时候出…...

    2024/5/7 10:36:02
  3. 【实战解析】YOLOv9全流程训练至优化终极指南

    【实战解析】YOLOv9全流程训练至优化终极指南 0.引言1.环境准备2.数据预处理(1)数据准备(2)按比例划分数据集(3)xml转txt脚本(4)配置文件 3.模型训练(1)单GPU…...

    2024/5/6 21:59:48
  4. 汽车疲劳测试试验平台技术要求(北重厂家)

    汽车疲劳测试试验平台技术要求通常包括以下几个方面: 车辆加载能力:测试平台需要具备足够的承载能力,能够同时测试多种车型和不同重量的车辆。 动力系统:测试平台需要具备稳定可靠的动力系统,能够提供足够的力和速度来…...

    2024/5/8 14:02:58
  5. linux系统编程 线程 p1

    线程 1.线程的概念2.线程的创建/终止/取消,栈的清理2.1线程创建2.2线程终止2.3 栈的清理 1.线程的概念 线程就是一个正在运行的函数。 posix线程是一套标准,而不是实现。 openmp线程。 线程标识:pthread_t (linux环境下是整形数&…...

    2024/5/8 16:28:01
  6. 【外汇早评】美通胀数据走低,美元调整

    原标题:【外汇早评】美通胀数据走低,美元调整昨日美国方面公布了新一期的核心PCE物价指数数据,同比增长1.6%,低于前值和预期值的1.7%,距离美联储的通胀目标2%继续走低,通胀压力较低,且此前美国一季度GDP初值中的消费部分下滑明显,因此市场对美联储后续更可能降息的政策…...

    2024/5/8 6:01:22
  7. 【原油贵金属周评】原油多头拥挤,价格调整

    原标题:【原油贵金属周评】原油多头拥挤,价格调整本周国际劳动节,我们喜迎四天假期,但是整个金融市场确实流动性充沛,大事频发,各个商品波动剧烈。美国方面,在本周四凌晨公布5月份的利率决议和新闻发布会,维持联邦基金利率在2.25%-2.50%不变,符合市场预期。同时美联储…...

    2024/5/7 9:45:25
  8. 【外汇周评】靓丽非农不及疲软通胀影响

    原标题:【外汇周评】靓丽非农不及疲软通胀影响在刚结束的周五,美国方面公布了新一期的非农就业数据,大幅好于前值和预期,新增就业重新回到20万以上。具体数据: 美国4月非农就业人口变动 26.3万人,预期 19万人,前值 19.6万人。 美国4月失业率 3.6%,预期 3.8%,前值 3…...

    2024/5/4 23:54:56
  9. 【原油贵金属早评】库存继续增加,油价收跌

    原标题:【原油贵金属早评】库存继续增加,油价收跌周三清晨公布美国当周API原油库存数据,上周原油库存增加281万桶至4.692亿桶,增幅超过预期的74.4万桶。且有消息人士称,沙特阿美据悉将于6月向亚洲炼油厂额外出售更多原油,印度炼油商预计将每日获得至多20万桶的额外原油供…...

    2024/5/7 14:25:14
  10. 【外汇早评】日本央行会议纪要不改日元强势

    原标题:【外汇早评】日本央行会议纪要不改日元强势近两日日元大幅走强与近期市场风险情绪上升,避险资金回流日元有关,也与前一段时间的美日贸易谈判给日本缓冲期,日本方面对汇率问题也避免继续贬值有关。虽然今日早间日本央行公布的利率会议纪要仍然是支持宽松政策,但这符…...

    2024/5/4 23:54:56
  11. 【原油贵金属早评】欧佩克稳定市场,填补伊朗问题的影响

    原标题:【原油贵金属早评】欧佩克稳定市场,填补伊朗问题的影响近日伊朗局势升温,导致市场担忧影响原油供给,油价试图反弹。此时OPEC表态稳定市场。据消息人士透露,沙特6月石油出口料将低于700万桶/日,沙特已经收到石油消费国提出的6月份扩大出口的“适度要求”,沙特将满…...

    2024/5/4 23:55:05
  12. 【外汇早评】美欲与伊朗重谈协议

    原标题:【外汇早评】美欲与伊朗重谈协议美国对伊朗的制裁遭到伊朗的抗议,昨日伊朗方面提出将部分退出伊核协议。而此行为又遭到欧洲方面对伊朗的谴责和警告,伊朗外长昨日回应称,欧洲国家履行它们的义务,伊核协议就能保证存续。据传闻伊朗的导弹已经对准了以色列和美国的航…...

    2024/5/4 23:54:56
  13. 【原油贵金属早评】波动率飙升,市场情绪动荡

    原标题:【原油贵金属早评】波动率飙升,市场情绪动荡因中美贸易谈判不安情绪影响,金融市场各资产品种出现明显的波动。随着美国与中方开启第十一轮谈判之际,美国按照既定计划向中国2000亿商品征收25%的关税,市场情绪有所平复,已经开始接受这一事实。虽然波动率-恐慌指数VI…...

    2024/5/7 11:36:39
  14. 【原油贵金属周评】伊朗局势升温,黄金多头跃跃欲试

    原标题:【原油贵金属周评】伊朗局势升温,黄金多头跃跃欲试美国和伊朗的局势继续升温,市场风险情绪上升,避险黄金有向上突破阻力的迹象。原油方面稍显平稳,近期美国和OPEC加大供给及市场需求回落的影响,伊朗局势并未推升油价走强。近期中美贸易谈判摩擦再度升级,美国对中…...

    2024/5/4 23:54:56
  15. 【原油贵金属早评】市场情绪继续恶化,黄金上破

    原标题:【原油贵金属早评】市场情绪继续恶化,黄金上破周初中国针对于美国加征关税的进行的反制措施引发市场情绪的大幅波动,人民币汇率出现大幅的贬值动能,金融市场受到非常明显的冲击。尤其是波动率起来之后,对于股市的表现尤其不安。隔夜美国股市出现明显的下行走势,这…...

    2024/5/6 1:40:42
  16. 【外汇早评】美伊僵持,风险情绪继续升温

    原标题:【外汇早评】美伊僵持,风险情绪继续升温昨日沙特两艘油轮再次发生爆炸事件,导致波斯湾局势进一步恶化,市场担忧美伊可能会出现摩擦生火,避险品种获得支撑,黄金和日元大幅走强。美指受中美贸易问题影响而在低位震荡。继5月12日,四艘商船在阿联酋领海附近的阿曼湾、…...

    2024/5/4 23:54:56
  17. 【原油贵金属早评】贸易冲突导致需求低迷,油价弱势

    原标题:【原油贵金属早评】贸易冲突导致需求低迷,油价弱势近日虽然伊朗局势升温,中东地区几起油船被袭击事件影响,但油价并未走高,而是出于调整结构中。由于市场预期局势失控的可能性较低,而中美贸易问题导致的全球经济衰退风险更大,需求会持续低迷,因此油价调整压力较…...

    2024/5/8 20:48:49
  18. 氧生福地 玩美北湖(上)——为时光守候两千年

    原标题:氧生福地 玩美北湖(上)——为时光守候两千年一次说走就走的旅行,只有一张高铁票的距离~ 所以,湖南郴州,我来了~ 从广州南站出发,一个半小时就到达郴州西站了。在动车上,同时改票的南风兄和我居然被分到了一个车厢,所以一路非常愉快地聊了过来。 挺好,最起…...

    2024/5/7 9:26:26
  19. 氧生福地 玩美北湖(中)——永春梯田里的美与鲜

    原标题:氧生福地 玩美北湖(中)——永春梯田里的美与鲜一觉醒来,因为大家太爱“美”照,在柳毅山庄去寻找龙女而错过了早餐时间。近十点,向导坏坏还是带着饥肠辘辘的我们去吃郴州最富有盛名的“鱼头粉”。说这是“十二分推荐”,到郴州必吃的美食之一。 哇塞!那个味美香甜…...

    2024/5/4 23:54:56
  20. 氧生福地 玩美北湖(下)——奔跑吧骚年!

    原标题:氧生福地 玩美北湖(下)——奔跑吧骚年!让我们红尘做伴 活得潇潇洒洒 策马奔腾共享人世繁华 对酒当歌唱出心中喜悦 轰轰烈烈把握青春年华 让我们红尘做伴 活得潇潇洒洒 策马奔腾共享人世繁华 对酒当歌唱出心中喜悦 轰轰烈烈把握青春年华 啊……啊……啊 两…...

    2024/5/8 19:33:07
  21. 扒开伪装医用面膜,翻六倍价格宰客,小姐姐注意了!

    原标题:扒开伪装医用面膜,翻六倍价格宰客,小姐姐注意了!扒开伪装医用面膜,翻六倍价格宰客!当行业里的某一品项火爆了,就会有很多商家蹭热度,装逼忽悠,最近火爆朋友圈的医用面膜,被沾上了污点,到底怎么回事呢? “比普通面膜安全、效果好!痘痘、痘印、敏感肌都能用…...

    2024/5/5 8:13:33
  22. 「发现」铁皮石斛仙草之神奇功效用于医用面膜

    原标题:「发现」铁皮石斛仙草之神奇功效用于医用面膜丽彦妆铁皮石斛医用面膜|石斛多糖无菌修护补水贴19大优势: 1、铁皮石斛:自唐宋以来,一直被列为皇室贡品,铁皮石斛生于海拔1600米的悬崖峭壁之上,繁殖力差,产量极低,所以古代仅供皇室、贵族享用 2、铁皮石斛自古民间…...

    2024/5/8 20:38:49
  23. 丽彦妆\医用面膜\冷敷贴轻奢医学护肤引导者

    原标题:丽彦妆\医用面膜\冷敷贴轻奢医学护肤引导者【公司简介】 广州华彬企业隶属香港华彬集团有限公司,专注美业21年,其旗下品牌: 「圣茵美」私密荷尔蒙抗衰,产后修复 「圣仪轩」私密荷尔蒙抗衰,产后修复 「花茵莳」私密荷尔蒙抗衰,产后修复 「丽彦妆」专注医学护…...

    2024/5/4 23:54:58
  24. 广州械字号面膜生产厂家OEM/ODM4项须知!

    原标题:广州械字号面膜生产厂家OEM/ODM4项须知!广州械字号面膜生产厂家OEM/ODM流程及注意事项解读: 械字号医用面膜,其实在我国并没有严格的定义,通常我们说的医美面膜指的应该是一种「医用敷料」,也就是说,医用面膜其实算作「医疗器械」的一种,又称「医用冷敷贴」。 …...

    2024/5/6 21:42:42
  25. 械字号医用眼膜缓解用眼过度到底有无作用?

    原标题:械字号医用眼膜缓解用眼过度到底有无作用?医用眼膜/械字号眼膜/医用冷敷眼贴 凝胶层为亲水高分子材料,含70%以上的水分。体表皮肤温度传导到本产品的凝胶层,热量被凝胶内水分子吸收,通过水分的蒸发带走大量的热量,可迅速地降低体表皮肤局部温度,减轻局部皮肤的灼…...

    2024/5/4 23:54:56
  26. 配置失败还原请勿关闭计算机,电脑开机屏幕上面显示,配置失败还原更改 请勿关闭计算机 开不了机 这个问题怎么办...

    解析如下:1、长按电脑电源键直至关机,然后再按一次电源健重启电脑,按F8健进入安全模式2、安全模式下进入Windows系统桌面后,按住“winR”打开运行窗口,输入“services.msc”打开服务设置3、在服务界面,选中…...

    2022/11/19 21:17:18
  27. 错误使用 reshape要执行 RESHAPE,请勿更改元素数目。

    %读入6幅图像(每一幅图像的大小是564*564) f1 imread(WashingtonDC_Band1_564.tif); subplot(3,2,1),imshow(f1); f2 imread(WashingtonDC_Band2_564.tif); subplot(3,2,2),imshow(f2); f3 imread(WashingtonDC_Band3_564.tif); subplot(3,2,3),imsho…...

    2022/11/19 21:17:16
  28. 配置 已完成 请勿关闭计算机,win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机...

    win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机”问题的解决方法在win7系统关机时如果有升级系统的或者其他需要会直接进入一个 等待界面,在等待界面中我们需要等待操作结束才能关机,虽然这比较麻烦,但是对系统进行配置和升级…...

    2022/11/19 21:17:15
  29. 台式电脑显示配置100%请勿关闭计算机,“准备配置windows 请勿关闭计算机”的解决方法...

    有不少用户在重装Win7系统或更新系统后会遇到“准备配置windows,请勿关闭计算机”的提示,要过很久才能进入系统,有的用户甚至几个小时也无法进入,下面就教大家这个问题的解决方法。第一种方法:我们首先在左下角的“开始…...

    2022/11/19 21:17:14
  30. win7 正在配置 请勿关闭计算机,怎么办Win7开机显示正在配置Windows Update请勿关机...

    置信有很多用户都跟小编一样遇到过这样的问题,电脑时发现开机屏幕显现“正在配置Windows Update,请勿关机”(如下图所示),而且还需求等大约5分钟才干进入系统。这是怎样回事呢?一切都是正常操作的,为什么开时机呈现“正…...

    2022/11/19 21:17:13
  31. 准备配置windows 请勿关闭计算机 蓝屏,Win7开机总是出现提示“配置Windows请勿关机”...

    Win7系统开机启动时总是出现“配置Windows请勿关机”的提示,没过几秒后电脑自动重启,每次开机都这样无法进入系统,此时碰到这种现象的用户就可以使用以下5种方法解决问题。方法一:开机按下F8,在出现的Windows高级启动选…...

    2022/11/19 21:17:12
  32. 准备windows请勿关闭计算机要多久,windows10系统提示正在准备windows请勿关闭计算机怎么办...

    有不少windows10系统用户反映说碰到这样一个情况,就是电脑提示正在准备windows请勿关闭计算机,碰到这样的问题该怎么解决呢,现在小编就给大家分享一下windows10系统提示正在准备windows请勿关闭计算机的具体第一种方法:1、2、依次…...

    2022/11/19 21:17:11
  33. 配置 已完成 请勿关闭计算机,win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机”的解决方法...

    今天和大家分享一下win7系统重装了Win7旗舰版系统后,每次关机的时候桌面上都会显示一个“配置Windows Update的界面,提示请勿关闭计算机”,每次停留好几分钟才能正常关机,导致什么情况引起的呢?出现配置Windows Update…...

    2022/11/19 21:17:10
  34. 电脑桌面一直是清理请关闭计算机,windows7一直卡在清理 请勿关闭计算机-win7清理请勿关机,win7配置更新35%不动...

    只能是等着,别无他法。说是卡着如果你看硬盘灯应该在读写。如果从 Win 10 无法正常回滚,只能是考虑备份数据后重装系统了。解决来方案一:管理员运行cmd:net stop WuAuServcd %windir%ren SoftwareDistribution SDoldnet start WuA…...

    2022/11/19 21:17:09
  35. 计算机配置更新不起,电脑提示“配置Windows Update请勿关闭计算机”怎么办?

    原标题:电脑提示“配置Windows Update请勿关闭计算机”怎么办?win7系统中在开机与关闭的时候总是显示“配置windows update请勿关闭计算机”相信有不少朋友都曾遇到过一次两次还能忍但经常遇到就叫人感到心烦了遇到这种问题怎么办呢?一般的方…...

    2022/11/19 21:17:08
  36. 计算机正在配置无法关机,关机提示 windows7 正在配置windows 请勿关闭计算机 ,然后等了一晚上也没有关掉。现在电脑无法正常关机...

    关机提示 windows7 正在配置windows 请勿关闭计算机 ,然后等了一晚上也没有关掉。现在电脑无法正常关机以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!关机提示 windows7 正在配…...

    2022/11/19 21:17:05
  37. 钉钉提示请勿通过开发者调试模式_钉钉请勿通过开发者调试模式是真的吗好不好用...

    钉钉请勿通过开发者调试模式是真的吗好不好用 更新时间:2020-04-20 22:24:19 浏览次数:729次 区域: 南阳 > 卧龙 列举网提醒您:为保障您的权益,请不要提前支付任何费用! 虚拟位置外设器!!轨迹模拟&虚拟位置外设神器 专业用于:钉钉,外勤365,红圈通,企业微信和…...

    2022/11/19 21:17:05
  38. 配置失败还原请勿关闭计算机怎么办,win7系统出现“配置windows update失败 还原更改 请勿关闭计算机”,长时间没反应,无法进入系统的解决方案...

    前几天班里有位学生电脑(windows 7系统)出问题了,具体表现是开机时一直停留在“配置windows update失败 还原更改 请勿关闭计算机”这个界面,长时间没反应,无法进入系统。这个问题原来帮其他同学也解决过,网上搜了不少资料&#x…...

    2022/11/19 21:17:04
  39. 一个电脑无法关闭计算机你应该怎么办,电脑显示“清理请勿关闭计算机”怎么办?...

    本文为你提供了3个有效解决电脑显示“清理请勿关闭计算机”问题的方法,并在最后教给你1种保护系统安全的好方法,一起来看看!电脑出现“清理请勿关闭计算机”在Windows 7(SP1)和Windows Server 2008 R2 SP1中,添加了1个新功能在“磁…...

    2022/11/19 21:17:03
  40. 请勿关闭计算机还原更改要多久,电脑显示:配置windows更新失败,正在还原更改,请勿关闭计算机怎么办...

    许多用户在长期不使用电脑的时候,开启电脑发现电脑显示:配置windows更新失败,正在还原更改,请勿关闭计算机。。.这要怎么办呢?下面小编就带着大家一起看看吧!如果能够正常进入系统,建议您暂时移…...

    2022/11/19 21:17:02
  41. 还原更改请勿关闭计算机 要多久,配置windows update失败 还原更改 请勿关闭计算机,电脑开机后一直显示以...

    配置windows update失败 还原更改 请勿关闭计算机,电脑开机后一直显示以以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!配置windows update失败 还原更改 请勿关闭计算机&#x…...

    2022/11/19 21:17:01
  42. 电脑配置中请勿关闭计算机怎么办,准备配置windows请勿关闭计算机一直显示怎么办【图解】...

    不知道大家有没有遇到过这样的一个问题,就是我们的win7系统在关机的时候,总是喜欢显示“准备配置windows,请勿关机”这样的一个页面,没有什么大碍,但是如果一直等着的话就要两个小时甚至更久都关不了机,非常…...

    2022/11/19 21:17:00
  43. 正在准备配置请勿关闭计算机,正在准备配置windows请勿关闭计算机时间长了解决教程...

    当电脑出现正在准备配置windows请勿关闭计算机时,一般是您正对windows进行升级,但是这个要是长时间没有反应,我们不能再傻等下去了。可能是电脑出了别的问题了,来看看教程的说法。正在准备配置windows请勿关闭计算机时间长了方法一…...

    2022/11/19 21:16:59
  44. 配置失败还原请勿关闭计算机,配置Windows Update失败,还原更改请勿关闭计算机...

    我们使用电脑的过程中有时会遇到这种情况,当我们打开电脑之后,发现一直停留在一个界面:“配置Windows Update失败,还原更改请勿关闭计算机”,等了许久还是无法进入系统。如果我们遇到此类问题应该如何解决呢&#xff0…...

    2022/11/19 21:16:58
  45. 如何在iPhone上关闭“请勿打扰”

    Apple’s “Do Not Disturb While Driving” is a potentially lifesaving iPhone feature, but it doesn’t always turn on automatically at the appropriate time. For example, you might be a passenger in a moving car, but your iPhone may think you’re the one dri…...

    2022/11/19 21:16:57