开源基于Rust编写的Web服务器

基于 RUST 的 WEB 资源服务器

Github 地址

LTPP-GIT 地址

官方文档

该项目于 2024 年 5 月 1 日开始开发

预期功能

功能支持情况当前情况
多线程支持
服务支持配置化
防盗链支持
gzip 支持
反向代理支持
自定义状态码对应资源文件
日志支持
负载均衡支持
域名绑定解析支持
资源解析
history 模式支持
自定义响应头

目前进度

  • 自定义响应头
  • 多线程支持
  • 配置化
  • 日志输出
  • 资源解析
  • history 模式支持
  • 域名绑定支持
  • 一个端口对应多域名支持
  • 反向代理支持
  • 负载均衡支持
  • 防盗链支持
  • gzip 支持

错误页

  • root_path 下名称为 对应状态码.html,例如 404 对应页面 404.html

JSON 示例

首次运行会自动生成 config.json 配置文件,填写好后重新运行即可

以上配置将当前目录作为访问地址的根目录,
监听了 8081 端口,绑定 IP域名127.0.0.1localhost 用来处理请求,
当访问为空则重写路径到当前目录的 index.html(适用于 Vue 等打包后的资源),
日志保存在当前目录 logs

配置中的 listen_ip 为服务端 IPbind_server_name 下的 key 为域名或者 IP, 一般 listen_ip127.0.0.1
如果 bind_server_name 配置了 localhost 域名,那么可以使用 localhost 访问,
但是不支持 127.0.0.1,如需支持 127.0.0.1,在 bind_server_name 中添加即可
如果本地做了映射,需要同时添加映射的域名和 127.0.0.1

反向代理

  • 系统会检测 proxy 数组里每个元素是否是合法 URL,如果是合法 URL 那么系统会加入到反向代理的列表,如果最终反向代理列表为空则会加载静态资源
  • 反向代理会映射请求路径和请求参数,如果配置文件 proxy 中的元素加了路径,系统会忽略
  • 反向代理时,会随机从反向代理列表中获取一个代理地址 PROXY_URL ,系统会截取 PROXY_URL 字段除了 path 部分的 url,实际 path 来自请求时的 path,参数会进行拼接,如果 PROXY_URL 参数和请求参数冲突,请求参数会追加在 PROXY_URL 参数后面

负载均衡

  • 反向代理时,会随机从反向代理列表中获取一个代理地址 PROXY_URL

GZIP

  • 请求头 Accept-Encoding 需要包含 gzip 并且响应头 Content-Encoding 需要包含 gzip
  • 配置 gzip_level 用于设置压缩率,范围从 1 - 9,越大压缩的越小,耗时也会更久,建议 4/5 即可

异常

  • 如果出现页面/请求加载异常的情况,需要增加 buffer_size 数值

防盗链

  • hotlink_protection 使用正则进行匹配(系统内部会额外处理…/防盗链情况)

运行效果

配置文件示例

{"server": [{"listen_ip": "0.0.0.0","listen_port": 80,"bind_server_name": {"127.0.0.1": {"root_path": "./","buffer_size": 10240,"gzip_level": 1,"log_dir_path": "./logs","empty_path_try_files_path": "./index.html","response_header_list": ["Server: RUST-WEB-SERVER","Access-Control-Allow-Credentials: true","Access-Control-Allow-Headers: *","Access-Control-Allow-Methods: *","Access-Control-Allow-Origin: *","Git: https://git.ltpp.vip/root/RUST-WEB-SERVE.git","Content-Type: text/html","Content-Encoding: gzip"],"proxy": [],"proxy_timeout_seconds": 10,"hotlink_protection": []},"localhost": {"root_path": "./","buffer_size": 10240,"gzip_level": 1,"log_dir_path": "./logs","empty_path_try_files_path": "./index.html","response_header_list": ["Server: RUST-WEB-SERVER","Access-Control-Allow-Credentials: true","Access-Control-Allow-Headers: *","Access-Control-Allow-Methods: *","Access-Control-Allow-Origin: *","Git: https://git.ltpp.vip/root/RUST-WEB-SERVE.git","Content-Type: application/json","Content-Encoding: gzip"],"proxy": ["https://api.ltpp.vip","https://api.ltpp.vip/Version/getVersion","https://api.ltpp.vip/Version/getVersion?origin=proxy1"],"proxy_timeout_seconds": 10,"hotlink_protection": []}}},{"listen_ip": "0.0.0.0","listen_port": 81,"bind_server_name": {"127.0.0.1": {"root_path": "./","buffer_size": 10240,"gzip_level": 1,"log_dir_path": "./logs","empty_path_try_files_path": "./index.html","response_header_list": ["Access-Control-Allow-Origin: *","Access-Control-Allow-Methods: *","Access-Control-Allow-Headers: *","Access-Control-Allow-Credentials: true","Server: RUST-WEB-SERVER","Git: https://git.ltpp.vip/root/RUST-WEB-SERVE.git","Content-Type: application/json","Content-Encoding: gzip"],"proxy": ["https://api.ltpp.vip/Version/getVersion?origin=proxy1"],"proxy_timeout_seconds": 10,"hotlink_protection": ["origin=1$"]}}}]
}

运行效果

在这里插入图片描述
在这里插入图片描述

日志

支持配置,日期和完整请求记录

[2024-05-28 23:40:07]
Binding => 127.0.0.1:80
Server {root_path: "./",buffer_size: 10240,gzip_level: 1,log_dir_path: "./logs",empty_path_try_files_path: "./index.html",response_header_list: ["Server: RUST-WEB-SERVER","Access-Control-Allow-Credentials: true","Access-Control-Allow-Headers: *","Access-Control-Allow-Methods: *","Access-Control-Allow-Origin: *","Git: https://git.ltpp.vip/root/RUST-WEB-SERVE.git","Content-Type: text/html","Content-Encoding: gzip",],proxy: [],proxy_timeout_seconds: 10,hotlink_protection: [],
}
Binding => localhost:80
Server {root_path: "./",buffer_size: 10240,gzip_level: 1,log_dir_path: "./logs",empty_path_try_files_path: "./index.html",response_header_list: ["Server: RUST-WEB-SERVER","Access-Control-Allow-Credentials: true","Access-Control-Allow-Headers: *","Access-Control-Allow-Methods: *","Access-Control-Allow-Origin: *","Git: https://git.ltpp.vip/root/RUST-WEB-SERVE.git","Content-Type: application/json","Content-Encoding: gzip",],proxy: ["https://api.ltpp.vip","https://api.ltpp.vip/Version/getVersion","https://api.ltpp.vip/Version/getVersion?origin=proxy1",],proxy_timeout_seconds: 10,hotlink_protection: [],
}[2024-05-28 23:40:07]
Binding => 127.0.0.1:80
Server {root_path: "./",buffer_size: 10240,gzip_level: 1,log_dir_path: "./logs",empty_path_try_files_path: "./index.html",response_header_list: ["Server: RUST-WEB-SERVER","Access-Control-Allow-Credentials: true","Access-Control-Allow-Headers: *","Access-Control-Allow-Methods: *","Access-Control-Allow-Origin: *","Git: https://git.ltpp.vip/root/RUST-WEB-SERVE.git","Content-Type: text/html","Content-Encoding: gzip",],proxy: [],proxy_timeout_seconds: 10,hotlink_protection: [],
}
Binding => localhost:80
Server {root_path: "./",buffer_size: 10240,gzip_level: 1,log_dir_path: "./logs",empty_path_try_files_path: "./index.html",response_header_list: ["Server: RUST-WEB-SERVER","Access-Control-Allow-Credentials: true","Access-Control-Allow-Headers: *","Access-Control-Allow-Methods: *","Access-Control-Allow-Origin: *","Git: https://git.ltpp.vip/root/RUST-WEB-SERVE.git","Content-Type: application/json","Content-Encoding: gzip",],proxy: ["https://api.ltpp.vip","https://api.ltpp.vip/Version/getVersion","https://api.ltpp.vip/Version/getVersion?origin=proxy1",],proxy_timeout_seconds: 10,hotlink_protection: [],
}[2024-05-28 23:40:07]
Binding => 127.0.0.1:81
Server {root_path: "./",buffer_size: 10240,gzip_level: 1,log_dir_path: "./logs",empty_path_try_files_path: "./index.html",response_header_list: ["Access-Control-Allow-Origin: *","Access-Control-Allow-Methods: *","Access-Control-Allow-Headers: *","Access-Control-Allow-Credentials: true","Server: RUST-WEB-SERVER","Git: https://git.ltpp.vip/root/RUST-WEB-SERVE.git","Content-Type: application/json","Content-Encoding: gzip",],proxy: ["https://api.ltpp.vip/Version/getVersion?origin=proxy1",],proxy_timeout_seconds: 10,hotlink_protection: ["origin=1$",],
}[2024-05-28 23:40:07]
Listening => 0.0.0.0:80[2024-05-28 23:40:07]
Binding => 127.0.0.1:80[2024-05-28 23:40:07]
Binding => localhost:80[2024-05-28 23:40:07]
Binding => 127.0.0.1:80[2024-05-28 23:40:07]
Listening => 0.0.0.0:81[2024-05-28 23:40:07]
Binding => 127.0.0.1:81[2024-05-28 23:40:07]
Binding => localhost:81[2024-05-28 23:40:07]
Binding => 127.0.0.1:81[2024-05-28 23:40:10]
HttpRequest {path: "/_static/out/browser/serviceWorker.js",method: "GET",query: [],headers: {"accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6","accept": "*/*","service-worker": "script","sec-fetch-dest": "serviceworker","sec-fetch-mode": "same-origin","referer": "http://127.0.0.1/_static/out/browser/serviceWorker.js","accept-encoding": "gzip, deflate, br, zstd","cache-control": "max-age=0","host": "127.0.0.1","user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0","cookie": "SameSite=Lax; Hm_lvt_9793f42b498361373512340937deb2a0=1689155374; _ga=GA1.1.39230079.1707025003; _ga_69MPZE94D5=GS1.1.1707025002.1.1.1707026740.0.0.0; pma_lang=zh_CN; pma_theme=bootstrap; pmaUser-1=5RJrrwsVlvqY7uteEWcRoXI%2BvTKWWpA23SKZpX9BCDRw8Q17ueAcTXRd8Po%3D","sec-fetch-site": "same-origin","connection": "keep-alive",},body: {"sec-fetch-site": ["same-origin",],"accept-encoding": ["gzip, deflate, br, zstd",],"accept": ["*/*",],"user-agent": ["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0",],"connection": ["keep-alive",],"cache-control": ["max-age=0",],"cookie": ["SameSite=Lax; Hm_lvt_9793f42b498361373512340937deb2a0=1689155374; _ga=GA1.1.39230079.1707025003; _ga_69MPZE94D5=GS1.1.1707025002.1.1.1707026740.0.0.0; pma_lang=zh_CN; pma_theme=bootstrap; pmaUser-1=5RJrrwsVlvqY7uteEWcRoXI%2BvTKWWpA23SKZpX9BCDRw8Q17ueAcTXRd8Po%3D",],"accept-language": ["zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",],"sec-fetch-mode": ["same-origin",],"host": ["127.0.0.1",],"referer": ["http://127.0.0.1/_static/out/browser/serviceWorker.js",],"sec-fetch-dest": ["serviceworker",],"service-worker": ["script",],},
}[2024-05-28 23:40:10]
Resource load fail => ./_static/out/browser/serviceWorker.js[2024-05-28 23:40:21]
HttpRequest {path: "/Version/getVersion",method: "GET",query: [("origin","proxy1",),],headers: {"sec-ch-ua-mobile": "?0","connection": "keep-alive","sec-ch-ua": "\"Microsoft Edge\";v=\"125\", \"Chromium\";v=\"125\", \"Not.A/Brand\";v=\"24\"","user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0","sec-fetch-site": "none","sec-fetch-user": "?1","accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6","sec-fetch-dest": "document","host": "127.0.0.1:81","accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7","accept-encoding": "gzip, deflate, br, zstd","upgrade-insecure-requests": "1","sec-fetch-mode": "navigate","cookie": "SameSite=Lax; Hm_lvt_9793f42b498361373512340937deb2a0=1689155374; _ga=GA1.1.39230079.1707025003; _ga_69MPZE94D5=GS1.1.1707025002.1.1.1707026740.0.0.0; pma_lang=zh_CN; pma_theme=bootstrap; pmaUser-1=5RJrrwsVlvqY7uteEWcRoXI%2BvTKWWpA23SKZpX9BCDRw8Q17ueAcTXRd8Po%3D","sec-ch-ua-platform": "\"Windows\"",},body: {"sec-fetch-user": ["?1",],"accept-language": ["zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",],"sec-fetch-site": ["none",],"accept": ["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",],"sec-ch-ua-platform": ["\"Windows\"",],"accept-encoding": ["gzip, deflate, br, zstd",],"host": ["127.0.0.1:81",],"sec-fetch-mode": ["navigate",],"upgrade-insecure-requests": ["1",],"sec-fetch-dest": ["document",],"sec-ch-ua-mobile": ["?0",],"cookie": ["SameSite=Lax; Hm_lvt_9793f42b498361373512340937deb2a0=1689155374; _ga=GA1.1.39230079.1707025003; _ga_69MPZE94D5=GS1.1.1707025002.1.1.1707026740.0.0.0; pma_lang=zh_CN; pma_theme=bootstrap; pmaUser-1=5RJrrwsVlvqY7uteEWcRoXI%2BvTKWWpA23SKZpX9BCDRw8Q17ueAcTXRd8Po%3D",],"sec-ch-ua": ["\"Microsoft Edge\";v=\"125\", \"Chromium\";v=\"125\", \"Not.A/Brand\";v=\"24\"",],"connection": ["keep-alive",],"user-agent": ["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0",],},
}[2024-05-28 23:40:21]
Proxy url info => https://api.ltpp.vip:443/Version/getVersion?origin=proxy1&origin=proxy1[2024-05-28 23:40:22]
Request response info:
HTTP/1.1 200 OK
content-length: 90
access-control-allow-methods: GET, POST, PATCH
access-control-allow-headers: Authorization,Requestid,Key,Content-Type,If-Match,If-Modified-Since,If-None-Match,If-Unmodified-Since,X-CSRF-TOKEN,X-Requested-With
git: https://git.ltpp.vip/root/RUST-WEB-SERVE.git
access-control-allow-origin: *
content-encoding: gzip
access-control-allow-credentials: true
content-type: application/json
server: nginx
connection: keep-alive
date: Tue, 28 May 2024 15:40:21 GMT
strict-transport-security: max-age=88888888
access-control-max-age: 88888888{"code":1,"version":"2.8.0","ltpp_win_download_url":"","ltpp_mac_download_url":"","ltpp_apk_download_url":""}[2024-05-28 23:40:24]
HttpRequest {path: "/Version/getVersion",method: "GET",query: [("origin","proxy1",),],headers: {"connection": "keep-alive","accept-encoding": "gzip, deflate, br, zstd","cache-control": "max-age=0","sec-fetch-mode": "navigate","sec-ch-ua-platform": "\"Windows\"","sec-fetch-site": "none","host": "localhost","accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7","accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6","sec-ch-ua-mobile": "?0","sec-fetch-user": "?1","sec-fetch-dest": "document","user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0","upgrade-insecure-requests": "1","cookie": "SameSite=Lax; NMTID=00O6oBSFUZ8KxSqKEY4tcbYD677Qa8AAAGKxntltw; pma_lang=zh_CN; pma_theme=bootstrap; pmaUser-1=c3t%2FwkS4xVdqQ2GLp7IkQdf9cc4d3ClA8ae5euc5DJ4EKvgSZv6qnjCaabI%3D","sec-ch-ua": "\"Microsoft Edge\";v=\"125\", \"Chromium\";v=\"125\", \"Not.A/Brand\";v=\"24\"",},body: {"sec-ch-ua-platform": ["\"Windows\"",],"sec-ch-ua": ["\"Microsoft Edge\";v=\"125\", \"Chromium\";v=\"125\", \"Not.A/Brand\";v=\"24\"",],"upgrade-insecure-requests": ["1",],"user-agent": ["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0",],"cookie": ["SameSite=Lax; NMTID=00O6oBSFUZ8KxSqKEY4tcbYD677Qa8AAAGKxntltw; pma_lang=zh_CN; pma_theme=bootstrap; pmaUser-1=c3t%2FwkS4xVdqQ2GLp7IkQdf9cc4d3ClA8ae5euc5DJ4EKvgSZv6qnjCaabI%3D",],"accept": ["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",],"cache-control": ["max-age=0",],"host": ["localhost",],"sec-fetch-user": ["?1",],"sec-fetch-dest": ["document",],"accept-language": ["zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",],"connection": ["keep-alive",],"sec-fetch-mode": ["navigate",],"sec-ch-ua-mobile": ["?0",],"accept-encoding": ["gzip, deflate, br, zstd",],"sec-fetch-site": ["none",],},
}[2024-05-28 23:40:24]
Proxy url info => https://api.ltpp.vip:443/Version/getVersion?origin=proxy1[2024-05-28 23:40:24]
Request response info:
HTTP/1.1 200 OK
content-length: 90
strict-transport-security: max-age=88888888
access-control-max-age: 88888888
access-control-allow-headers: Authorization,Requestid,Key,Content-Type,If-Match,If-Modified-Since,If-None-Match,If-Unmodified-Since,X-CSRF-TOKEN,X-Requested-With
content-type: application/json
access-control-allow-origin: *
access-control-allow-methods: GET, POST, PATCH
git: https://git.ltpp.vip/root/RUST-WEB-SERVE.git
date: Tue, 28 May 2024 15:40:23 GMT
server: nginx
connection: keep-alive
content-encoding: gzip
access-control-allow-credentials: true{"code":1,"version":"2.8.0","ltpp_win_download_url":"","ltpp_mac_download_url":"","ltpp_apk_download_url":""}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/bicheng/23045.shtml

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

相关文章

easyexcel模板填充列表

引入依赖 <dependency><groupId>com.alibaba</groupId><artifactId>easyexcel</artifactId><version>2.2.6</version></dependency>编写模板 编写代码 public class FillData {private String name;private Double number;pu…

如何解决 Zabbix模板同步超时:解决运维技术领域的BugFailed to sync Zabbix template due to timeout

如何解决 Zabbix模板同步超时&#xff1a;解决运维技术领域的BugFailed to sync Zabbix template due to timeout 原创作者&#xff1a; 猫头虎 作者微信号&#xff1a; Libin9iOak 作者公众号&#xff1a; 猫头虎技术团队 更新日期&#xff1a; 2024年6月6日 博主猫头虎…

003 Spring注解

文章目录 PathVariable和RequestParamPathVariable 示例RequestParam 示例 GetMapping、PostMapping、PutMapping、DeleteMapping1. GetMapping2. PostMapping3. PutMapping4. DeleteMapping总结 Autowired和ResourceAutowired使用场景如何使用注意事项 Resource1. Resource的作…

毛坏房无从下手,不知道怎么装

毛胚房装修步骤      1验房,      2,借钱      3,出设计图施工图      4,决定找公司还是自装      5,拆除墙体      6,安装中央空调或风管机      7,改水电      8,做地暖      9封阳台      10,做防水      11,铺瓷砖      1…

LabVIEW源程序安全性保护综合方案

LabVIEW源程序安全性保护综合方案 一、硬件加密保护方案 选择和安装硬件设备 选择加密狗和TPM设备&#xff1a;选择Sentinel HASP加密狗和支持TPM&#xff08;可信平台模块&#xff09;的计算机主板。 安装驱动和开发工具&#xff1a;安装Sentinel HASP加密狗的驱动程序和开发…

Java物业管理系统+数据库应用程序开发[JavaSE+JDBC+idea控制台+MySQL]

背景&#xff1a; 使用JavaSEJDBCMySQL技术实现一个物业管理系统&#xff0c;具体要求如下 物业管理系统需求&#xff1a; 需求分析 1.1用户需求分析 在进入系统之前&#xff0c;要进行身份确认&#xff0c;只有用户名和用户密码都相符的用户方可进入本系统&#xff0c;为…

SASAM软件架构静态分析法-系统架构师(六)

1、体系结构权衡分析法&#xff08;Architecture Tradeoff Analysis Method ATAM&#xff09;包含四个主要活动领域&#xff0c;分别是 场景和需求的收集、体系结构视图和场景的实现、&#xff08;&#xff09;、折中。基于场景的架构分析方法&#xff08;Scenarios-based Arch…

读写csv文件的C++实现

系列文章目录 提示:这里可以添加系列文章的所有文章的目录,目录需要自己手动添加 TODO:写完再整理 文章目录 系列文章目录前言读写csv文件的C++实现前言 认知有限,望大家多多包涵,有什么问题也希望能够与大家多交流,共同成长! 本文先对读写csv文件的C++实现做个简单的…

大归纳!!教你使用<string.h>的字符函数与字符串函数!!☑

这篇博客为你归纳了所有的字符函数和最常用的字符串函数&#xff0c;以及对应的模拟实现&#xff01;&#xff01;你可以直接循着目录跳到你需要的段落哦&#xff01;&#xff01;&#x1f60d; 目录 字符函数 字符分类 字符判断函数 islower——判断小写字母 isupper——…

JVM学习-Jprofiler

JProfiler 基本概述 特点 使用方便&#xff0c;界面操作友好对被分析的应用影响小(提供模板)CPU&#xff0c;Tread&#xff0c;Memory分析功能尤其强大支持对jdbc,noSql,jsp,servlet,socket进行分析支持多种模式(离线、在线)的分析支持监控本地、远程JVM跨平台&#xff0c;拥…

纯血鸿蒙开发教程:如何实现运动饮食卡片效果

开发背景 人们对健康的要求越来越高&#xff0c;从单纯的健康饮食到健康运动&#xff0c;再到两者的结合。但是&#xff0c;饮食和运动之间的平衡一般人很难掌握&#xff0c;而我们这款 APP 将饮食、运动、以及自身身体状况&#xff08;如体脂、体重、内脂等&#xff09;有机结…

力扣1838.最高频的元素的频数

力扣1838.最高频的元素的频数 首先排序 然后右指针遍历补成的数 每次加**差值(num[i] - num[i-1]) * 位数(i - j) class Solution {public:int maxFrequency(vector<int>& nums, int k) {int res1,n nums.size();sort(nums.begin(),nums.end());long long ans0;fo…

编程互动遥控机器狗电子方案定制

东莞酷得智能科技方案公司&#xff0c;专注于电子玩具行业MCU单片机电子方案定制开发服务。酷得开发的电子方案中&#xff0c;涵盖了益智、娱乐、运动等多个领域&#xff0c;满足了不同年龄段孩子们的需求。这些玩具不仅能帮助孩子们度过愉快的时光&#xff0c;还能在游戏中学习…

linux上VirtualBox使用

前言 最近想把唯一的windows系统装成linux&#xff0c; 但是确实存在一些特殊软件无法舍弃&#xff0c;所有装完linux需要用虚拟机装个windows 上来使用特定的一些软件&#xff08;不想用wine了&#xff09;。 还有对一些特定usb设备的透传&#xff0c;这样才能保证在虚拟机中…

【Linux】Linux工具——gdb

1. gdb 概述 GDB是GNU开源组织发布的一个强大的UNIX下的程序调试工具。或许&#xff0c;各位比较喜欢那种图形界面方式的&#xff0c;像VC、BCB等IDE的调试&#xff0c;但如果你是在 UNIX平台下做软件&#xff0c;你会发现GDB这个调试工具有比VC、BCB的图形化调试器更强大的功能…

和平饭店短视频:成都科成博通文化传媒公司

和平饭店短视频&#xff1a;历史的沉淀与现代的演绎 随着短视频平台的兴起&#xff0c;越来越多的人开始通过镜头记录生活、分享故事。在众多短视频中&#xff0c;以“和平饭店”为主题的短视频独树一帜&#xff0c;以其独特的魅力吸引了大量观众的目光。成都科成博通文化传媒…

Oracle NUMTOYMINTERVAL函数的使用

Oracle NUMTOYMINTERVAL函数的使用 NUMTOYMINTERVAL是Oracle数据库中的一个函数&#xff0c;用于将给定的数字转换为INTERVAL YEAR TO MONTH类型的值。该函数在处理日期和时间计算时非常有用&#xff0c;特别是当你需要将年或月的数量转换为时间间隔时。 以下是关于NUMTOYMIN…

【常见报错】影刀小窗口消失-作者:【小可耐教你学影刀RPA】

现象描述&#xff1a; 影刀能够正常登录并运行&#xff0c;但是从常规模式切换到调度模式后能出现启动页&#xff0c;然后程序就退出了&#xff0c;查看影刀日志和事件查看器中的日志都没有任何异常消息 问题原因&#xff1a; 正常切换调度后会在窗口右下角出现一个机器人的小…

QT+FFmpeg+Windows开发环境搭建(加薪点)

01、Windows 环境搭建 FFMPEG官网:http://ffmpeg.org/ 02、下载4.2.1版本源码 源码:https://ffmpeg.org/releases/ffmpeg-4.2.1.tar.bz2 03、下载4.2.1编译好的文件 下载已经编译好的FFMPEG)(迅雷下载很快) 网址:https://ffmpeg.zeranoe.com/builds/ 32位下载地址:(迅雷…

特征工程及python实现

一、特征构建 概述 从原始数据中构建新的特征&#xff0c;一般需要根据业务分析&#xff0c;生成能更好体现业务特性的新特征&#xff0c;这些新特征要与目标关系紧密&#xff0c;能提升模型表现或更好地解释模型。 方法 时间周期&#xff1a;不同的时间切片长度&#xff0…