npm-run-all 使用实践
参考: npm-run-all
背景
在前端开发中,你是否存在以下烦恼:
- 写 package.json 的 scripts 命令时,命令太过冗长,例如编译命令
build
需要执行清理clean
, 编译cssbuild:css
, 编译jsbuild:js
, 编译htmlbuild:html
命令,则build
命令需要写成build: npm run clean && npm run build:css && npm run build:js && npm run build:html
,这个命令太过冗长,npm run
都是重复的,能不能写成build: clean build:css build:js build:html
,甚至能不能更简单地写成build: clean build:*
。 - 通常
build
的过程是先进行类型检查,后进行编译:build: npm run typecheck && vite build
,两者是串行的关系,能不能使两个命令并行执行以加快编译速度?
如果你也有类似烦恼,相信这篇文章对你有用。
安装
# npm 安装
$ npm install npm-run-all --save-dev
# yarn 安装
$ yarn add npm-run-all --dev
# pnpm 安装
$ pnpm add -D npm-run-all
使用
npm-run-all
包提供了3个命令:npm-run-all
, run-s
, run-p
。
最主要的命令是 npm-run-all
,我们可以使用该命令创建复杂的命令计划。run-s
和 run-p
是简写命令,run-s
用于串行任务,run-p
用于并行任务。
npm-run-all
创建一个文件夹,并通过 pnpm init
将该文件夹初始化为一个项目。在该项目下创建4个脚本文件:
- clean.sh:
echo "$(date): start clean"
sleep 1
echo "$(date): clean finished!"
- build-css.sh
echo "$(date): start build:css"
sleep 1
echo "$(date): build:css finished!"
- build-js.sh
echo "$(date): start build:js"
sleep 3
echo "$(date): build:js finished!"
- build-html.sh
echo "$(date): start build:html"
sleep 1
echo "$(date): build:html finished!"
串行执行多个命令
为 package.json 添加脚本命令:
{"scripts": {"clean": "./clean.sh","build:css": "./build-css.sh","build:html": "./build-html.sh","build:js": "./build-js.sh","build": "npm-run-all clean build:css build:js build:html"}
}
使用 npm-run-all 后 build 命令简化了很多,执行 pnpm build
结果为:
> t1@1.0.0 build /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> npm-run-all clean build:css build:js build:html> t1@1.0.0 clean /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> ./clean.sh2024年10月14日 星期一 17时35分17秒 CST: start clean
2024年10月14日 星期一 17时35分18秒 CST: clean finished!> t1@1.0.0 build:css /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> ./build-css.sh2024年10月14日 星期一 17时35分18秒 CST: start build:css
2024年10月14日 星期一 17时35分19秒 CST: build:css finished!> t1@1.0.0 build:js /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> ./build-js.sh2024年10月14日 星期一 17时35分19秒 CST: start build:js
2024年10月14日 星期一 17时35分22秒 CST: build:js finished!> t1@1.0.0 build:html /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> ./build-html.sh2024年10月14日 星期一 17时35分23秒 CST: start build:html
2024年10月14日 星期一 17时35分24秒 CST: build:html finished!
可以看到 clean
, build:css
, build:js
, build:html
串行执行了。
用通配符简化命令
将 build
命令修改为 npm-run-all clean build:*
,执行 pnpm build
结果为:
> t1@1.0.0 build /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> npm-run-all clean build:*> t1@1.0.0 clean /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> ./clean.sh2024年10月14日 星期一 17时39分45秒 CST: start clean
2024年10月14日 星期一 17时39分46秒 CST: clean finished!> t1@1.0.0 build:css /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> ./build-css.sh2024年10月14日 星期一 17时39分46秒 CST: start build:css
2024年10月14日 星期一 17时39分47秒 CST: build:css finished!> t1@1.0.0 build:html /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> ./build-html.sh2024年10月14日 星期一 17时39分48秒 CST: start build:html
2024年10月14日 星期一 17时39分49秒 CST: build:html finished!> t1@1.0.0 build:js /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> ./build-js.sh2024年10月14日 星期一 17时39分49秒 CST: start build:js
2024年10月14日 星期一 17时39分52秒 CST: build:js finished!
可以看到 clean
, build:css
, build:html
, build:js
串行执行了。执行 build:*
时,执行顺序按命令定义的先后顺序进行。
多个命令并行执行
将 build
命令修改为 npm-run-all --parallel clean build:*
,执行结果为:
pnpm build> t1@1.0.0 build /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> npm-run-all --parallel clean build:*> t1@1.0.0 build:css /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> ./build-css.sh> t1@1.0.0 clean /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> ./clean.sh> t1@1.0.0 build:html /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> ./build-html.sh> t1@1.0.0 build:js /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> ./build-js.sh2024年10月14日 星期一 17时49分47秒 CST: start build:css
2024年10月14日 星期一 17时49分47秒 CST: start build:html
2024年10月14日 星期一 17时49分47秒 CST: start clean
2024年10月14日 星期一 17时49分47秒 CST: start build:js
2024年10月14日 星期一 17时49分48秒 CST: build:html finished!
2024年10月14日 星期一 17时49分48秒 CST: build:css finished!
2024年10月14日 星期一 17时49分48秒 CST: clean finished!
2024年10月14日 星期一 17时49分50秒 CST: build:js finished!
可以看到4个命令已经并行执行了。上面 build
命令在 linux 可以写成 npm run clean & npm run build:css & npm run build:js & npm run build:html
,执行结果为:
> t1@1.0.0 build /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> npm run clean & npm run build:css & npm run build:js & npm run build:html> t1@1.0.0 clean
> ./clean.sh> t1@1.0.0 build:js
> ./build-js.sh> t1@1.0.0 build:html
> ./build-html.sh> t1@1.0.0 build:css
> ./build-css.sh2024年10月14日 星期一 19时21分14秒 CST: start build:css
2024年10月14日 星期一 19时21分14秒 CST: start build:js
2024年10月14日 星期一 19时21分14秒 CST: start build:html
2024年10月14日 星期一 19时21分14秒 CST: start clean
2024年10月14日 星期一 19时21分15秒 CST: build:html finished!
2024年10月14日 星期一 19时21分15秒 CST: build:css finished!
2024年10月14日 星期一 19时21分15秒 CST: clean finished!
2024年10月14日 星期一 19时21分17秒 CST: build:js finished!
也有并行执行的效果,不过问题在于 Windows 下的 cmd.exe 并不能识别 &
,跨平台存在问题。
另外,因为 &
表示命令后台运行,因此并不是在 build 执行完以后才退出命令行。因为最后一条命令 npm run build:html
不是后台执行,因此命令行退出时间取决于该命令的执行时间,该命令延时1s,而执行时间最长的 npm run build:js
延时3s,因此在命令行退出时,npm run build:js
并没有执行完毕,会导致在 pnpm build
命令结束2s后才在终端输出 2024年10月14日 星期一 19时21分17秒 CST: build:js finished!
的问题。
多命令并行时一个命令执行失败
并行执行时,如果某个命令执行的退出码不是0,则正在执行的命令将被杀死。例如,我们将 build-html.sh
修改为:
echo "$(date): start build:html"
sleep 2
exit 1
echo "$(date): build:html finished!"
则执行 pnpm build
的结果为:
> t1@1.0.0 build /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> npm-run-all --parallel clean build:*> t1@1.0.0 clean /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> ./clean.sh> t1@1.0.0 build:css /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> ./build-css.sh> t1@1.0.0 build:html /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> ./build-html.sh> t1@1.0.0 build:js /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> ./build-js.sh2024年10月14日 星期一 19时32分48秒 CST: start clean
2024年10月14日 星期一 19时32分48秒 CST: start build:css
2024年10月14日 星期一 19时32分48秒 CST: start build:html
2024年10月14日 星期一 19时32分48秒 CST: start build:js
2024年10月14日 星期一 19时32分49秒 CST: clean finished!
2024年10月14日 星期一 19时32分49秒 CST: build:css finished!ELIFECYCLE Command failed with exit code 1.ELIFECYCLE Command failed.
ERROR: "build:html" exited with 1.ELIFECYCLE Command failed with exit code 1.
可以看到,在 build:html
错误退出前执行完毕的 clean
, build:css
都输出完成信息,而执行时间比 build:html
长的 build:js
因为 build:html
的错误退出,导致无法继续执行,没有输出完成信息。
串行与并行混合执行
上面并行的例子中存在一个问题,因为 clean
和其他编译命令并行,可能导致刚编译好的文件被清理掉,我们要的结果是先执行 clean
命令,执行完成后再并行执行3个编译命令。可以将 build
命令修改为 npm-run-all --silent clean --parallel build:*
,执行结果为:
> t1@1.0.0 build /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> npm-run-all clean --silent --parallel build:*2024年10月14日 星期一 21时38分20秒 CST: start clean
2024年10月14日 星期一 21时38分21秒 CST: clean finished!
2024年10月14日 星期一 21时38分21秒 CST: start build:html
2024年10月14日 星期一 21时38分21秒 CST: start build:js
2024年10月14日 星期一 21时38分21秒 CST: start build:css
2024年10月14日 星期一 21时38分22秒 CST: build:html finished!
2024年10月14日 星期一 21时38分22秒 CST: build:css finished!
2024年10月14日 星期一 21时38分25秒 CST: build:js finished!
如果希望执行顺序为: 先执行 clean
, 再并行执行 build:css build:js
, 最后执行 build:html
,可以将 build
命令改为: npm-run-all --silent clean --parallel build:css build:js --sequential build:html
, 执行结果为:
> t1@1.0.0 build /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> npm-run-all --silent clean --parallel build:css build:js --sequential build:html2024年10月14日 星期一 21时42分49秒 CST: start clean
2024年10月14日 星期一 21时42分50秒 CST: clean finished!
2024年10月14日 星期一 21时42分50秒 CST: start build:js
2024年10月14日 星期一 21时42分50秒 CST: start build:css
2024年10月14日 星期一 21时42分51秒 CST: build:css finished!
2024年10月14日 星期一 21时42分53秒 CST: build:js finished!
2024年10月14日 星期一 21时42分54秒 CST: start build:html
2024年10月14日 星期一 21时42分55秒 CST: build:html finished!
--sequential
可以改为 --serial
。
例如: npm-run-all a b --parallel c d --sequential e f --parallel g h i
或 npm-run-all a b --parallel c d --serial e f --parallel g h i
的执行步骤为:
- 串行执行,先执行a,再执行b
- b 执行完后,并行执行 c 和 d
- c 和 d 都执行完后,串行执行 e 和 f
- f 执行完后,并行执行 g、h 和 i
通配符
之前我们看到 npm-run-all build:*
,其中 *
就是一个通配符,并且分隔符不一定是冒号,例如我们将 package.json 中的 scripts
改为:
{"scripts": {"clean": "./clean.sh","build_css": "./build-css.sh","build_html": "./build-html.sh","build_js": "./build-js.sh","build": "npm-run-all --silent build_*"}
}
执行 pnpm build
的结果为:
> t1@1.0.0 build /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> npm-run-all --silent build_*2024年10月14日 星期一 21时44分45秒 CST: start build:css
2024年10月14日 星期一 21时44分46秒 CST: build:css finished!
2024年10月14日 星期一 21时44分47秒 CST: start build:html
2024年10月14日 星期一 21时44分48秒 CST: build:html finished!
2024年10月14日 星期一 21时44分48秒 CST: start build:js
2024年10月14日 星期一 21时44分51秒 CST: build:js finished!
也是可以正常执行的。
甚至 *
也不一定在最后,例如 build
改为 npm-run-all --silent build_*s
,将只执行 build:css
和 build:js
,执行结果为:
> t1@1.0.0 build /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> npm-run-all --silent build_*s2024年10月14日 星期一 21时45分53秒 CST: start build:css
2024年10月14日 星期一 21时45分54秒 CST: build:css finished!
2024年10月14日 星期一 21时45分54秒 CST: start build:js
2024年10月14日 星期一 21时45分57秒 CST: build:js finished!
传入参数
新建两个脚本用于接收命令行参数:
- foo.sh:
echo "foo: [1]=$1, [2]=$2, [3]=$3, [4]=$4, [5]=$5, [6]=$6"
- bar.sh:
echo "bar: [1]=$1, [2]=$2, [3]=$3, [4]=$4, [5]=$5, [6]=$6"
为 scripts 添加如下内容:
{"scripts": {"test:foo": "./foo.sh","test:bar": "./bar.sh","test": "npm-run-all --parallel \"test:* 1 abc\"",}
}
则执行的结果为:
> t1@1.0.0 test /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> npm-run-all --parallel "test:* 1 abc"> t1@1.0.0 test:foo /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> ./foo.sh "1" "abc"> t1@1.0.0 test:bar /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> ./bar.sh "1" "abc"foo: [1]=1, [2]=abc, [3]=, [4]=, [5]=, [6]=
bar: [1]=1, [2]=abc, [3]=, [4]=, [5]=, [6]=
上述的 test
命令改为 "test": "npm-run-all --parallel \"test:foo 1 abc\" \"test:bar 1 abc\""
也是相同的效果。
参数占位符
如果我们希望在执行命令时,再通过命令行传入参数,可以使用参数占位符。下面的例子演示了参数占位符的使用:
{"test2": "npm-run-all \"test:foo {1}\" \"test:foo {1} {2}\" \"test:foo {@}\" \"test:foo {*}\" --"
}
注意,最后的 --
不可少,否则参数会被作为命令,例如没有 --
时执行 pnpm test2 a
,结果为:
> t1@1.0.0 test2 /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> npm-run-all "test:foo {1}" "test:foo {1} {2}" "test:foo {@}" "test:foo {*}" "a"ERROR: Task not found: "a"ELIFECYCLE Command failed with exit code 1.
可以看到 a 被当做了一个任务。
加上 --
后,执行 pnpm test2 1 aaa 1xy
的结果为:
> t1@1.0.0 test2 /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> npm-run-all "test:foo {1}" "test:foo {1} {2}" "test:foo {@}" "test:foo {*}" -- "1" "aaa" "1xy"> t1@1.0.0 test:foo /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> ./foo.sh "1"foo: [1]=1, [2]=, [3]=, [4]=, [5]=, [6]=> t1@1.0.0 test:foo /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> ./foo.sh "1" "aaa"foo: [1]=1, [2]=aaa, [3]=, [4]=, [5]=, [6]=> t1@1.0.0 test:foo /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> ./foo.sh "1" "aaa" "1xy"foo: [1]=1, [2]=aaa, [3]=1xy, [4]=, [5]=, [6]=> t1@1.0.0 test:foo /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> ./foo.sh "1 aaa 1xy"foo: [1]=1 aaa 1xy, [2]=, [3]=, [4]=, [5]=, [6]=
在例子中可以很清楚的看出不同占位符的区别:
{1}
,{2}
, … : 表示一个参数,{1}
表示第一个参数,{2}
表示第二个参数;{@}
: 表示所有参数;{*}
: 将所有参数合并为一个参数;
run-s / run-p
run-s
是 npm-run-all -s
或 npm-run-all --series
或 npm-run-all --sequential
的简写,表示串行执行命令。
run-p
是 npm-run-all -p
或 npm-run-all --parallel
的简写,表示并行执行命令。
scripts 中添加命令 "build-s": "run-s --silent build:*"
,执行结果为:
> t1@1.0.0 build-s /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> run-s --silent build:*2024年10月14日 星期一 21时24分26秒 CST: start build:css
2024年10月14日 星期一 21时24分27秒 CST: build:css finished!
2024年10月14日 星期一 21时24分27秒 CST: start build:html
2024年10月14日 星期一 21时24分28秒 CST: build:html finished!
2024年10月14日 星期一 21时24分29秒 CST: start build:js
2024年10月14日 星期一 21时24分32秒 CST: build:js finished!
可以看到3个build命令是串行的。这里使用了 --silent
参数,减少系统的日志输出。
添加命令 "build-p": "run-p --silent build:*"
,执行结果为:
> t1@1.0.0 build-p /Users/foolishflyfox/Code/Year2024/Mon10/day14/t1
> run-p --silent build:*2024年10月14日 星期一 21时26分48秒 CST: start build:html
2024年10月14日 星期一 21时26分48秒 CST: start build:js
2024年10月14日 星期一 21时26分48秒 CST: start build:css
2024年10月14日 星期一 21时26分49秒 CST: build:html finished!
2024年10月14日 星期一 21时26分49秒 CST: build:css finished!
2024年10月14日 星期一 21时26分51秒 CST: build:js finished!
可以看到3个命令是并行执行的。
相关文章:
npm-run-all 使用实践
参考: npm-run-all 背景 在前端开发中,你是否存在以下烦恼: 写 package.json 的 scripts 命令时,命令太过冗长,例如编译命令 build 需要执行清理 clean, 编译css build:css, 编译js build:js, 编译html build:html 命令,则 bui…...
【CCPC】The 2021 CCPC Guilin Onsite (XXII Open Cup, Grand Prix of EDG) K
Tax #图论 #最短路 #搜索 #暴力 题目描述 JB received his driver’s license recently. To celebrate this fact, JB decides to drive to other cities in Byteland. There are n n n cities and m m m bidirectional roads in Byteland, labeled by 1 , 2 , … , n 1,…...
selenium的实际使用
1.标签页的切换 #获取当前所有的窗口 curdriver.window_handles #根据窗口索引进行切换 driver.switch_to.window(cur[1]) from selenium import webdriverimport timedriver webdriver.Chrome()driver.get(http://www.baidu.com)time.sleep(1)eledriver.find_element_by…...

OpenShift 4 - 云原生备份容灾 - Velero 和 OADP 基础篇
《OpenShift 4.x HOL教程汇总》 说明: 本文主要说明能够云原生备份容灾的开源项目 Velero 及其红帽扩展项目 OADP 的概念和架构篇。操作篇见《OpenShift 4 - 使用 OADP 对容器应用进行备份和恢复(附视频) 》 Velero 和 OADP 包含的功能和模…...

javaWeb项目-Springboot+vue-校园论坛系统功能介绍
本项目源码(点击下方链接下载):java-springbootvue-xx学校校园论坛信息系统实现源码(项目源码-说明文档)资源-CSDN文库 项目关键技术 开发工具:IDEA 、Eclipse 编程语言: Java 数据库: MySQL5.7 框架:ssm、Springboot…...

centors7升级GLIBC2.18
错误来源:找不到GLIBC2.18,因为glibc的版本是2.17 网上大多教程方法,反正我是行不通: 方法1:更新源,然后使用yum安装更新 方法2:下载源码,configrue,make执行 wget h…...
基于深度学习的异常检测
基于深度学习的异常检测是一项重要的研究领域,主要用于识别数据中的异常样本或行为。异常检测广泛应用于多个领域,如网络安全、金融欺诈检测、工业设备预测性维护、医疗诊断等。传统的异常检测方法通常依赖于统计分析或规则,但随着数据复杂性…...
深入理解 SQL 中的高级数据处理特性:约束、索引和触发器
在 SQL(Structured Query Language)中,除了基本的查询、插入、更新和删除操作外,还有一些高级的数据处理特性,它们对于确保数据的完整性、提高查询性能以及实现自动化的数据处理起着至关重要的作用。这些特性包括约束、…...
IC验证面试中常问知识点总结(七)附带详细回答!!!
15、 TLM通信 15.1 实现两个组件之间的通信有哪几种方法?分别什么特点? 最简单的方法就是使用全局变量,在monitor里对此全局变量进行赋值,在scoreboard里监测此全局变量值的改变。这种方法简单、直接,不过要避免使用全局变量,滥用全局变量只会造成灾难性的后果。 稍微复…...

【前端】如何制作一个自己的网页(8)
以下内容接上文。 CSS的出现,使得网页的样式与内容分离开来。 HTML负责网页中有哪些内容,CSS负责以哪种样式来展现这些内容。因此,CSS必须和HTML协同工作,那么如何在HTML中引用CSS呢? CSS的引用方式有三种࿱…...
Java之模块化详解
Java模块化,作为Java 9引入的一项重大特性,通过Java Platform Module System (JPMS) 实现,为Java开发者提供了更高级别的封装和依赖管理机制。这一特性旨在解决Java应用的封装性、可维护性和性能问题,使得开发者能够构建更加结构化…...

HTB:Knife[WriteUP]
目录 连接至HTB服务器并启动靶机 1.How many TCP ports are open on Knife? 2.What version of PHP is running on the webserver? 并没有我们需要的信息,接着使用浏览器访问靶机80端口 尝试使用ffuf对靶机Web进行一下目录FUZZ 使用curl访问该文件获取HTTP头…...

MOE论文详解(4)-GLaM
2022年google在GShard之后发表另一篇跟MoE相关的paper, 论文名为GLaM (Generalist Language Model), 最大的GLaM模型有1.2 trillion参数, 比GPT-3大7倍, 但成本只有GPT-3的1/3, 同时效果也超过GPT-3. 以下是两者的对比: 跟之前模型对比如下, 跟GShard和Switch-C相比, GLaM是第一…...
LeetCode322:零钱兑换
题目链接:322. 零钱兑换 - 力扣(LeetCode) 代码如下 class Solution { public:int coinChange(vector<int>& coins, int amount) {vector<int> dp(amount 1, INT_MAX);dp[0] 0;for(int i 0; i < coins.size(); i){fo…...
速盾:高防 cdn 提供 cc 防护?
在当今网络环境中,网站面临着各种安全威胁,其中 CC(Challenge Collapsar)攻击是一种常见的分布式拒绝服务攻击方式。高防 CDN(Content Delivery Network,内容分发网络)作为一种有效的网络安全防…...
【大数据应用开发】2023年全国职业院校技能大赛赛题第10套
如有需要备赛资料和远程培训,可私博主,详细了解 目录 任务A:大数据平台搭建(容器环境)(15分) 任务B:离线数据处理(25分) 任务C:数据挖掘(10分) 任务D:数据采集与实时计算(20分) 任务E:数据可视化(15分) 任务F:综合分析(10分) 任务A:大数据平台搭…...

【源码部署】解决SpringBoot无法加载yml文件配置,总是使用8080端口方案
打开idea,file ->Project Structure 找到Modules ,在右侧找到resource目录,是否指定了resource,点击对应文件夹会有提示...

2010年国赛高教杯数学建模B题上海世博会影响力的定量评估解题全过程文档及程序
2010年国赛高教杯数学建模 B题 上海世博会影响力的定量评估 2010年上海世博会是首次在中国举办的世界博览会。从1851年伦敦的“万国工业博览会”开始,世博会正日益成为各国人民交流历史文化、展示科技成果、体现合作精神、展望未来发展等的重要舞台。请你们选择感兴…...
使用nginx配置静态页面展示
文章目录 前言正文安装nginx配置 前言 目前有一系列html文件,比如sphinx通过make html输出的文件,需要通过ip远程访问,这就需要ngnix 主要内容参考:https://blog.csdn.net/qq_32460819/article/details/121131062 主要针对在do…...
[IOI2018] werewolf 狼人(Kruskal重构树 + 主席树)
https://www.luogu.com.cn/problem/P4899 首先,我们肯定要建两棵Kruskal重构树的,然后判两棵子树是否有相同编号节点 这是个经典问题,我们首先可以拍成dfs序,然后映射过去,然后相当于是判断一个区间是否有 [ l , r …...

linux之kylin系统nginx的安装
一、nginx的作用 1.可做高性能的web服务器 直接处理静态资源(HTML/CSS/图片等),响应速度远超传统服务器类似apache支持高并发连接 2.反向代理服务器 隐藏后端服务器IP地址,提高安全性 3.负载均衡服务器 支持多种策略分发流量…...

中南大学无人机智能体的全面评估!BEDI:用于评估无人机上具身智能体的综合性基准测试
作者:Mingning Guo, Mengwei Wu, Jiarun He, Shaoxian Li, Haifeng Li, Chao Tao单位:中南大学地球科学与信息物理学院论文标题:BEDI: A Comprehensive Benchmark for Evaluating Embodied Agents on UAVs论文链接:https://arxiv.…...
在HarmonyOS ArkTS ArkUI-X 5.0及以上版本中,手势开发全攻略:
在 HarmonyOS 应用开发中,手势交互是连接用户与设备的核心纽带。ArkTS 框架提供了丰富的手势处理能力,既支持点击、长按、拖拽等基础单一手势的精细控制,也能通过多种绑定策略解决父子组件的手势竞争问题。本文将结合官方开发文档,…...

Maven 概述、安装、配置、仓库、私服详解
目录 1、Maven 概述 1.1 Maven 的定义 1.2 Maven 解决的问题 1.3 Maven 的核心特性与优势 2、Maven 安装 2.1 下载 Maven 2.2 安装配置 Maven 2.3 测试安装 2.4 修改 Maven 本地仓库的默认路径 3、Maven 配置 3.1 配置本地仓库 3.2 配置 JDK 3.3 IDEA 配置本地 Ma…...
基于Java Swing的电子通讯录设计与实现:附系统托盘功能代码详解
JAVASQL电子通讯录带系统托盘 一、系统概述 本电子通讯录系统采用Java Swing开发桌面应用,结合SQLite数据库实现联系人管理功能,并集成系统托盘功能提升用户体验。系统支持联系人的增删改查、分组管理、搜索过滤等功能,同时可以最小化到系统…...

网站指纹识别
网站指纹识别 网站的最基本组成:服务器(操作系统)、中间件(web容器)、脚本语言、数据厍 为什么要了解这些?举个例子:发现了一个文件读取漏洞,我们需要读/etc/passwd,如…...

【VLNs篇】07:NavRL—在动态环境中学习安全飞行
项目内容论文标题NavRL: 在动态环境中学习安全飞行 (NavRL: Learning Safe Flight in Dynamic Environments)核心问题解决无人机在包含静态和动态障碍物的复杂环境中进行安全、高效自主导航的挑战,克服传统方法和现有强化学习方法的局限性。核心算法基于近端策略优化…...

R语言速释制剂QBD解决方案之三
本文是《Quality by Design for ANDAs: An Example for Immediate-Release Dosage Forms》第一个处方的R语言解决方案。 第一个处方研究评估原料药粒径分布、MCC/Lactose比例、崩解剂用量对制剂CQAs的影响。 第二处方研究用于理解颗粒外加硬脂酸镁和滑石粉对片剂质量和可生产…...
Web中间件--tomcat学习
Web中间件–tomcat Java虚拟机详解 什么是JAVA虚拟机 Java虚拟机是一个抽象的计算机,它可以执行Java字节码。Java虚拟机是Java平台的一部分,Java平台由Java语言、Java API和Java虚拟机组成。Java虚拟机的主要作用是将Java字节码转换为机器代码&#x…...
Python Einops库:深度学习中的张量操作革命
Einops(爱因斯坦操作库)就像给张量操作戴上了一副"语义眼镜"——让你用人类能理解的方式告诉计算机如何操作多维数组。这个基于爱因斯坦求和约定的库,用类似自然语言的表达式替代了晦涩的API调用,彻底改变了深度学习工程…...