Chromium 中chrome.bookmarks扩展接口c++实现
一、扩展接口定义 chrome.bookmarks
使用 chrome.bookmarks
API 创建、整理以及以其他方式操纵书签。另请参阅覆盖网页(可用于创建自定义“书签管理器”页面)。
更多参考chrome.bookmarks | API | Chrome for Developers (google.cn)
扩展可以请从 chrome-extension-samples 安装 bookmarks API 示例 存储库
二、扩展接口c++定义
chrome\common\extensions\api\bookmarks.json
// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.[{"namespace": "bookmarks","description": "Use the <code>chrome.bookmarks</code> API to create, organize, and otherwise manipulate bookmarks. Also see <a href='override'>Override Pages</a>, which you can use to create a custom Bookmark Manager page.","properties": {"MAX_WRITE_OPERATIONS_PER_HOUR": {"value": 1000000,"deprecated": "Bookmark write operations are no longer limited by Chrome.","description": ""},"MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE": {"value": 1000000,"deprecated": "Bookmark write operations are no longer limited by Chrome.","description": ""}},"types": [{"id": "BookmarkTreeNodeUnmodifiable","type": "string","enum": ["managed"],"description": "Indicates the reason why this node is unmodifiable. The <var>managed</var> value indicates that this node was configured by the system administrator. Omitted if the node can be modified by the user and the extension (default)."},{"id": "BookmarkTreeNode","type": "object","description": "A node (either a bookmark or a folder) in the bookmark tree. Child nodes are ordered within their parent folder.","properties": {"id": {"type": "string","minimum": 0,"description": "The unique identifier for the node. IDs are unique within the current profile, and they remain valid even after the browser is restarted."},"parentId": {"type": "string","minimum": 0,"optional": true,"description": "The <code>id</code> of the parent folder. Omitted for the root node."},"index": {"type": "integer","optional": true,"description": "The 0-based position of this node within its parent folder."},"url": {"type": "string","optional": true,"description": "The URL navigated to when a user clicks the bookmark. Omitted for folders."},"title": {"type": "string","description": "The text displayed for the node."},"dateAdded": {"type": "number","optional": true,"description": "When this node was created, in milliseconds since the epoch (<code>new Date(dateAdded)</code>)."},"dateLastUsed": {"type": "number","optional": true,"description": "When this node was last opened, in milliseconds since the epoch. Not set for folders."},"dateGroupModified": {"type": "number","optional": true,"description": "When the contents of this folder last changed, in milliseconds since the epoch."},"unmodifiable": {"$ref": "BookmarkTreeNodeUnmodifiable","optional": true,"description": "Indicates the reason why this node is unmodifiable. The <var>managed</var> value indicates that this node was configured by the system administrator or by the custodian of a supervised user. Omitted if the node can be modified by the user and the extension (default)."},"children": {"type": "array","optional": true,"items": { "$ref": "BookmarkTreeNode" },"description": "An ordered list of children of this node."}}},{"id": "CreateDetails","description": "Object passed to the create() function.","inline_doc": true,"type": "object","properties": {"parentId": {"type": "string","serialized_type": "int64","optional": true,"description": "Defaults to the Other Bookmarks folder."},"index": {"type": "integer","minimum": 0,"optional": true},"title": {"type": "string","optional": true},"url": {"type": "string","optional": true}}}],"functions": [{"name": "get","type": "function","description": "Retrieves the specified BookmarkTreeNode(s).","parameters": [{"name": "idOrIdList","description": "A single string-valued id, or an array of string-valued ids","choices": [{"type": "string","serialized_type": "int64"},{"type": "array","items": {"type": "string","serialized_type": "int64"},"minItems": 1}]}],"returns_async": {"name": "callback","parameters": [{"name": "results","type": "array","items": { "$ref": "BookmarkTreeNode" }}]}},{"name": "getChildren","type": "function","description": "Retrieves the children of the specified BookmarkTreeNode id.","parameters": [{"type": "string","serialized_type": "int64","name": "id"}],"returns_async": {"name": "callback","parameters": [{"name": "results","type": "array","items": { "$ref": "BookmarkTreeNode"}}]}},{"name": "getRecent","type": "function","description": "Retrieves the recently added bookmarks.","parameters": [{"type": "integer","minimum": 1,"name": "numberOfItems","description": "The maximum number of items to return."}],"returns_async": {"name": "callback","parameters": [{"name": "results","type": "array","items": { "$ref": "BookmarkTreeNode" }}]}},{"name": "getTree","type": "function","description": "Retrieves the entire Bookmarks hierarchy.","parameters": [],"returns_async": {"name": "callback","parameters": [{"name": "results","type": "array","items": { "$ref": "BookmarkTreeNode" }}]}},{"name": "getSubTree","type": "function","description": "Retrieves part of the Bookmarks hierarchy, starting at the specified node.","parameters": [{"type": "string","serialized_type": "int64","name": "id","description": "The ID of the root of the subtree to retrieve."}],"returns_async": {"name": "callback","parameters": [{"name": "results","type": "array","items": { "$ref": "BookmarkTreeNode" }}]}},{"name": "search","type": "function","description": "Searches for BookmarkTreeNodes matching the given query. Queries specified with an object produce BookmarkTreeNodes matching all specified properties.","parameters": [{"name": "query","description": "Either a string of words and quoted phrases that are matched against bookmark URLs and titles, or an object. If an object, the properties <code>query</code>, <code>url</code>, and <code>title</code> may be specified and bookmarks matching all specified properties will be produced.","choices": [{"type": "string","description": "A string of words and quoted phrases that are matched against bookmark URLs and titles."},{"type": "object","description": "An object specifying properties and values to match when searching. Produces bookmarks matching all properties.","properties": {"query": {"type": "string","optional": true,"description": "A string of words and quoted phrases that are matched against bookmark URLs and titles."},"url": {"type": "string","optional": true,"description": "The URL of the bookmark; matches verbatim. Note that folders have no URL."},"title": {"type": "string","optional": true,"description": "The title of the bookmark; matches verbatim."}}}]}],"returns_async": {"name": "callback","parameters": [{"name": "results","type": "array","items": { "$ref": "BookmarkTreeNode" }}]}},{"name": "create","type": "function","description": "Creates a bookmark or folder under the specified parentId. If url is NULL or missing, it will be a folder.","parameters": [{"$ref": "CreateDetails","name": "bookmark"}],"returns_async": {"name": "callback","optional": true,"parameters": [{"name": "result","$ref": "BookmarkTreeNode"}]}},{"name": "move","type": "function","description": "Moves the specified BookmarkTreeNode to the provided location.","parameters": [{"type": "string","serialized_type": "int64","name": "id"},{"type": "object","name": "destination","properties": {"parentId": {"type": "string","optional": true},"index": {"type": "integer","minimum": 0,"optional": true}}}],"returns_async": {"name": "callback","optional": true,"parameters": [{"name": "result","$ref": "BookmarkTreeNode"}]}},{"name": "update","type": "function","description": "Updates the properties of a bookmark or folder. Specify only the properties that you want to change; unspecified properties will be left unchanged. <b>Note:</b> Currently, only 'title' and 'url' are supported.","parameters": [{"type": "string","serialized_type": "int64","name": "id"},{"type": "object","name": "changes","properties": {"title": {"type": "string","optional": true},"url": {"type": "string","optional": true}}}],"returns_async": {"name": "callback","optional": true,"parameters": [{"name": "result","$ref": "BookmarkTreeNode"}]}},{"name": "remove","type": "function","description": "Removes a bookmark or an empty bookmark folder.","parameters": [{"type": "string","serialized_type": "int64","name": "id"}],"returns_async": {"name": "callback","optional": true,"parameters": []}},{"name": "removeTree","type": "function","description": "Recursively removes a bookmark folder.","parameters": [{"type": "string","serialized_type": "int64","name": "id"}],"returns_async": {"name": "callback","optional": true,"parameters": []}}],"events": [{"name": "onCreated","type": "function","description": "Fired when a bookmark or folder is created.","parameters": [{"type": "string","name": "id"},{"$ref": "BookmarkTreeNode","name": "bookmark"}]},{"name": "onRemoved","type": "function","description": "Fired when a bookmark or folder is removed. When a folder is removed recursively, a single notification is fired for the folder, and none for its contents.","parameters": [{"type": "string","name": "id"},{"type": "object","name": "removeInfo","properties": {"parentId": { "type": "string" },"index": { "type": "integer" },"node": { "$ref": "BookmarkTreeNode" }}}]},{"name": "onChanged","type": "function","description": "Fired when a bookmark or folder changes. <b>Note:</b> Currently, only title and url changes trigger this.","parameters": [{"type": "string","name": "id"},{"type": "object","name": "changeInfo","properties": {"title": { "type": "string" },"url": {"type": "string","optional": true}}}]},{"name": "onMoved","type": "function","description": "Fired when a bookmark or folder is moved to a different parent folder.","parameters": [{"type": "string","name": "id"},{"type": "object","name": "moveInfo","properties": {"parentId": { "type": "string" },"index": { "type": "integer" },"oldParentId": { "type": "string" },"oldIndex": { "type": "integer" }}}]},{"name": "onChildrenReordered","type": "function","description": "Fired when the children of a folder have changed their order due to the order being sorted in the UI. This is not called as a result of a move().","parameters": [{"type": "string","name": "id"},{"type": "object","name": "reorderInfo","properties": {"childIds": {"type": "array","items": { "type": "string" }}}}]},{"name": "onImportBegan","type": "function","description": "Fired when a bookmark import session is begun. Expensive observers should ignore onCreated updates until onImportEnded is fired. Observers should still handle other notifications immediately.","parameters": []},{"name": "onImportEnded","type": "function","description": "Fired when a bookmark import session is ended.","parameters": []}]}
]
bookmarks.json生成对应文件:
out\Debug\gen\chrome\common\extensions\api\bookmarks.cc
out\Debug\gen\chrome\common\extensions\api\bookmarks.h
三、bookmarks函数实现:
chrome\browser\extensions\api\bookmarks\bookmarks_api.h
chrome\browser\extensions\api\bookmarks\bookmarks_api.cc
// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.#ifndef CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARKS_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARKS_API_H_#include <stdint.h>#include <memory>
#include <set>
#include <string>
#include <vector>#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/values.h"
#include "components/bookmarks/browser/base_bookmark_model_observer.h"
#include "components/bookmarks/browser/bookmark_node.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_function.h"
#include "ui/shell_dialogs/select_file_dialog.h"class Profile;namespace base {
class FilePath;
}namespace bookmarks {
class BookmarkModel;
class ManagedBookmarkService;
}namespace content {
class BrowserContext;
}namespace extensions {namespace api {
namespace bookmarks {
struct CreateDetails;
}
}// Observes BookmarkModel and then routes the notifications as events to
// the extension system.
class BookmarkEventRouter : public bookmarks::BookmarkModelObserver {public:explicit BookmarkEventRouter(Profile* profile);BookmarkEventRouter(const BookmarkEventRouter&) = delete;BookmarkEventRouter& operator=(const BookmarkEventRouter&) = delete;~BookmarkEventRouter() override;// bookmarks::BookmarkModelObserver:void BookmarkModelLoaded(bookmarks::BookmarkModel* model,bool ids_reassigned) override;void BookmarkModelBeingDeleted(bookmarks::BookmarkModel* model) override;void BookmarkNodeMoved(bookmarks::BookmarkModel* model,const bookmarks::BookmarkNode* old_parent,size_t old_index,const bookmarks::BookmarkNode* new_parent,size_t new_index) override;void BookmarkNodeAdded(bookmarks::BookmarkModel* model,const bookmarks::BookmarkNode* parent,size_t index,bool added_by_user) override;void BookmarkNodeRemoved(bookmarks::BookmarkModel* model,const bookmarks::BookmarkNode* parent,size_t old_index,const bookmarks::BookmarkNode* node,const std::set<GURL>& removed_urls) override;void BookmarkAllUserNodesRemoved(bookmarks::BookmarkModel* model,const std::set<GURL>& removed_urls) override;void BookmarkNodeChanged(bookmarks::BookmarkModel* model,const bookmarks::BookmarkNode* node) override;void BookmarkNodeFaviconChanged(bookmarks::BookmarkModel* model,const bookmarks::BookmarkNode* node) override;void BookmarkNodeChildrenReordered(bookmarks::BookmarkModel* model,const bookmarks::BookmarkNode* node) override;void ExtensiveBookmarkChangesBeginning(bookmarks::BookmarkModel* model) override;void ExtensiveBookmarkChangesEnded(bookmarks::BookmarkModel* model) override;private:// Helper to actually dispatch an event to extension listeners.void DispatchEvent(events::HistogramValue histogram_value,const std::string& event_name,base::Value::List event_args);raw_ptr<content::BrowserContext> browser_context_;raw_ptr<bookmarks::BookmarkModel> model_;raw_ptr<bookmarks::ManagedBookmarkService> managed_;
};class BookmarksAPI : public BrowserContextKeyedAPI,public EventRouter::Observer {public:explicit BookmarksAPI(content::BrowserContext* context);~BookmarksAPI() override;// KeyedService implementation.void Shutdown() override;// BrowserContextKeyedAPI implementation.static BrowserContextKeyedAPIFactory<BookmarksAPI>* GetFactoryInstance();// EventRouter::Observer implementation.void OnListenerAdded(const EventListenerInfo& details) override;private:friend class BrowserContextKeyedAPIFactory<BookmarksAPI>;raw_ptr<content::BrowserContext> browser_context_;// BrowserContextKeyedAPI implementation.static const char* service_name() {return "BookmarksAPI";}static const bool kServiceIsNULLWhileTesting = true;// Created lazily upon OnListenerAdded.std::unique_ptr<BookmarkEventRouter> bookmark_event_router_;
};class BookmarksFunction : public ExtensionFunction,public bookmarks::BaseBookmarkModelObserver {public:// ExtensionFunction:ResponseAction Run() override;protected:~BookmarksFunction() override {}// Run semantic equivalent called when the bookmarks are ready.// Overrides can return nullptr to further delay responding (a.k.a.// RespondLater()).virtual ResponseValue RunOnReady() = 0;// Helper to get the BookmarkModel.bookmarks::BookmarkModel* GetBookmarkModel();// Helper to get the ManagedBookmarkService.bookmarks::ManagedBookmarkService* GetManagedBookmarkService();// Helper to get the bookmark node from a given string id.// If the given id can't be parsed or doesn't refer to a valid node, sets// |error| and returns nullptr.const bookmarks::BookmarkNode* GetBookmarkNodeFromId(const std::string& id_string,std::string* error);// Helper to create a bookmark node from a CreateDetails object. If a node// can't be created based on the given details, sets |error| and returns// nullptr.const bookmarks::BookmarkNode* CreateBookmarkNode(bookmarks::BookmarkModel* model,const api::bookmarks::CreateDetails& details,std::string* error);// Helper that checks if bookmark editing is enabled.bool EditBookmarksEnabled();// Helper that checks if |node| can be modified. Returns false if |node|// is nullptr, or a managed node, or the root node. In these cases the node// can't be edited, can't have new child nodes appended, and its direct// children can't be moved or reordered.bool CanBeModified(const bookmarks::BookmarkNode* node, std::string* error);Profile* GetProfile();private:// bookmarks::BaseBookmarkModelObserver:void BookmarkModelChanged() override;void BookmarkModelLoaded(bookmarks::BookmarkModel* model,bool ids_reassigned) override;// ExtensionFunction:void OnResponded() override;
};class BookmarksGetFunction : public BookmarksFunction {public:DECLARE_EXTENSION_FUNCTION("bookmarks.get", BOOKMARKS_GET)protected:~BookmarksGetFunction() override {}// BookmarksFunction:ResponseValue RunOnReady() override;
};class BookmarksGetChildrenFunction : public BookmarksFunction {public:DECLARE_EXTENSION_FUNCTION("bookmarks.getChildren", BOOKMARKS_GETCHILDREN)protected:~BookmarksGetChildrenFunction() override {}// BookmarksFunction:ResponseValue RunOnReady() override;
};class BookmarksGetRecentFunction : public BookmarksFunction {public:DECLARE_EXTENSION_FUNCTION("bookmarks.getRecent", BOOKMARKS_GETRECENT)protected:~BookmarksGetRecentFunction() override {}// BookmarksFunction:ResponseValue RunOnReady() override;
};class BookmarksGetTreeFunction : public BookmarksFunction {public:DECLARE_EXTENSION_FUNCTION("bookmarks.getTree", BOOKMARKS_GETTREE)protected:~BookmarksGetTreeFunction() override {}// BookmarksFunction:ResponseValue RunOnReady() override;
};class BookmarksGetSubTreeFunction : public BookmarksFunction {public:DECLARE_EXTENSION_FUNCTION("bookmarks.getSubTree", BOOKMARKS_GETSUBTREE)protected:~BookmarksGetSubTreeFunction() override {}// BookmarksFunction:ResponseValue RunOnReady() override;
};class BookmarksSearchFunction : public BookmarksFunction {public:DECLARE_EXTENSION_FUNCTION("bookmarks.search", BOOKMARKS_SEARCH)protected:~BookmarksSearchFunction() override {}// BookmarksFunction:ResponseValue RunOnReady() override;
};class BookmarksRemoveFunctionBase : public BookmarksFunction {protected:~BookmarksRemoveFunctionBase() override {}virtual bool is_recursive() const = 0;// BookmarksFunction:ResponseValue RunOnReady() override;
};class BookmarksRemoveFunction : public BookmarksRemoveFunctionBase {public:DECLARE_EXTENSION_FUNCTION("bookmarks.remove", BOOKMARKS_REMOVE)protected:~BookmarksRemoveFunction() override {}// BookmarksRemoveFunctionBase:bool is_recursive() const override;
};class BookmarksRemoveTreeFunction : public BookmarksRemoveFunctionBase {public:DECLARE_EXTENSION_FUNCTION("bookmarks.removeTree", BOOKMARKS_REMOVETREE)protected:~BookmarksRemoveTreeFunction() override {}// BookmarksRemoveFunctionBase:bool is_recursive() const override;
};class BookmarksCreateFunction : public BookmarksFunction {public:DECLARE_EXTENSION_FUNCTION("bookmarks.create", BOOKMARKS_CREATE)protected:~BookmarksCreateFunction() override {}// BookmarksFunction:ResponseValue RunOnReady() override;
};class BookmarksMoveFunction : public BookmarksFunction {public:DECLARE_EXTENSION_FUNCTION("bookmarks.move", BOOKMARKS_MOVE)protected:~BookmarksMoveFunction() override {}// BookmarksFunction:ResponseValue RunOnReady() override;
};class BookmarksUpdateFunction : public BookmarksFunction {public:DECLARE_EXTENSION_FUNCTION("bookmarks.update", BOOKMARKS_UPDATE)protected:~BookmarksUpdateFunction() override {}// BookmarksFunction:ResponseValue RunOnReady() override;
};} // namespace extensions#endif // CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARKS_API_H_
总结:扩展通过chrome.bookmarks.get 等方法会进入此实现,需要拦截更改可以在此处修改。
相关文章:

Chromium 中chrome.bookmarks扩展接口c++实现
一、扩展接口定义 chrome.bookmarks 使用 chrome.bookmarks API 创建、整理以及以其他方式操纵书签。另请参阅覆盖网页(可用于创建自定义“书签管理器”页面)。 更多参考chrome.bookmarks | API | Chrome for Developers (google.cn) 扩展可以请从…...

编程思想:编程范式:响应式编程
文章目录 概述实现的设计模式举例总结概述 响应 响应一般指对于事件的响应,事件包括数据变化或其他事件 响应流程包括事件的发生,事件的传递,和事件的最终处理 事件在起点处发生,开始传递过程 传递过程,包括对事件的一系列处理,如事件封装的数据的类型转化,数据集合…...

Leetcode 颜色分类
这个算法采用了荷兰国旗问题(Dutch National Flag Problem)的解法思想,用三个指针将数组中的元素分为三个区域,并且对这些区域进行动态调整,达到排序的目的。 算法思想: 三个指针: low 指针表示…...

ssh连接阿里云长连接
如何让ssh保持连接? 有时候用ssh连接阿里云莫名奇妙断开了。怎么样才能保持连接呢? 修改系统的链接参数: (1)修改/etc/ssh/sshd_config文件,找到 ClientAliveInterval 0和ClientAliveCountMax 3并将注释符号&#x…...

栈的C实现
栈的C实现 栈简介栈的C实现1.栈结构体2.初始化栈3.栈的基本操作 栈简介 栈(Stack)是一种后进先出的数据结构,类似于一个垂直的容器。 栈的特点是后进先出,即最后入栈的元素最先出栈。栈可以用来解决递归问题、实现函数调用、以及…...

【MySQL】入门篇—数据库基础:关系数据库概念
一、背景与重要性 在当今数字化时代,数据的管理和存储变得尤为重要。无论是企业的客户信息、产品数据,还是社交媒体上的用户互动,数据都是推动业务和决策的核心。 关系数据库管理系统(RDBMS)是一种广泛使用的数据管理…...

不到千元的自动猫砂盆是智商税吗?这四大选购技巧不看就亏大了
虽然现在的人都说,猫砂盆等上班一天回来再清理也没有任何关系,但实际上在这一天里,猫咪的粪便已经在猫砂盆里滋生了很多无法察觉的细菌,久而久之就会影响猫咪的健康,导致尿闭,放了一天的便便臭味也让人无法…...

【图论】(二)图论基础与路径问题
图论基础与路径问题 图的构造邻接矩阵邻接表 所有可达路径邻接矩阵存储邻接表存储 字符串接龙有向图的完全可达性 图的构造 这里仅对图论路径问题中图的构造做整理总结归纳,具体详细相关概念请参考代码随想录上的整理总结: 图论理论基础深度优先搜索理…...

Git常用命令(持续更新中)
mkdir one 在当前目录下创建一个名为one的文件夹 cd one 进入one 文件夹 git init 初始化git 仓库 touch README.md 创建一个后缀为.md的新文件README.md git add README.md 将README.md添加到git暂存区 git add * . * 将所有文件添加到暂存区 git add "E:/t…...

什么是PLM系统?PLM系统对制造业起到哪些作用?三品PLM系统对汽车制造业意义
在当今竞争激烈的制造业环境中,企业面临着来自市场、技术、客户需求等多方面的挑战。为了应对这些挑战,许多制造企业纷纷引入产品生命周期管理PLM系统,以实现更高效、更灵活的产品全生命周期管理。PLM系统以其独特的优势,在优化产…...

Pr 视频效果:元数据和时间码刻录
视频效果/视频/元数据和时间码刻录 Video/Metadata & Timecode Burn-in 元数据和时间码刻录 Metadata & Timecode Burn-in效果是一种在视频画面上叠加显示剪辑元数据或时间码的工具。它允许在导出视频时,将需用的元数据信息直接刻录在画面上,方便…...

前端MD5加密
1.导入包 npm install --save ts-md5 2.使用方式 import { Md5 } from ts-md5;//md5加密后的密码 const md5PwdMd5.hashStr("123456").toUpperCase(); 3. Vue解析token中携带的数据 3.1 安装插件 npm install jwt-decode --save 3.2 引入 import {jwtDecode} fro…...

仿IOS桌面悬浮球(支持拖拽、自动吸附、自动改变透明度与点击、兼容PC端与移动端)
使用 pointerdown/pointermove/pointerup 实现仿IOS桌面悬浮球效果,支持拖拽、指定拖拽选对容器,指定拖拽安全区、自动吸附、自动改变透明度与点击,兼容PC端与移动端。 效果展示 https://code.juejin.cn/pen/7423757568268304421 代码实现 …...

智谱开放平台API调用解析
一、什么是智谱AI 智谱AI成立于2019年,由清华大学计算机系知识工程实验室的技术成果转化而来,是一家致力于人工智能技术研发和应用的公司。智谱致力于打造新一代认知智能大模型,专注于做大模型的中国创新。 二、智谱开放平台API调用 官方文…...

Linux中定时删除10天前的日志文件
例如:删除/data/log/目录下所有10天前的.log文件 find /data/log/ -type f -name "*.log" -mtime 10 -exec rm -f {} \;只查看要删除的文件有哪些,不真正删除文件 logfiles$(find /data/log/ -type f -name "*.log" -mtime 10) ec…...

贝壳Android面试题及参考答案
详细说Final关键字 在编程语言中,final关键字具有重要的作用。以下为你详细介绍final关键字: 一、final关键字的主要作用 修饰变量 当final修饰基本数据类型变量时,该变量的值一旦被初始化就不能再被改变。例如:final int num = 10;num = 20; // 这会导致编译错误当final修…...

基于vue的酒店预订管理系统(源码+定制+开发)
博主介绍: ✌我是阿龙,一名专注于Java技术领域的程序员,全网拥有10W粉丝。作为CSDN特邀作者、博客专家、新星计划导师,我在计算机毕业设计开发方面积累了丰富的经验。同时,我也是掘金、华为云、阿里云、InfoQ等平台…...

FreeRTOS——TCB任务控制块、任务句柄、任务栈详解
任务控制块结构体 任务控制块是 FreeRTOS 中用于描述和管理任务的数据结构,包含了任务的状态、优先级、堆栈等信息。 TCB_t的全称为Task Control Block,也就是任务控制块,这个结构体包含了一个任务所有的信息,它的定义以及相关变…...

【STM32单片机_(HAL库)】4-5-2【定时器TIM】【感应开关盖垃圾桶项目】HC-SR04超声波模块实验
1.硬件 STM32单片机最小系统HC-SR04超声波模块 2.软件 hcsr04驱动文件添加main.c程序 #include "sys.h" #include "delay.h" #include "led.h" #include "uart1.h" #include "hcsr04.h"int main(void) {HAL_Init(); …...

安全网络架构
网络安全解决方案是指通过一系列技术和措施来保护网络系统和数据的安全。它涉及多个方面,包括网络设备的防护、数据的加密和备份、安全策略的制定和执行等。以下是一些常见的网络安全解决方案: 防火墙:防火墙是一种硬件或软件设备,…...

【万字长文】Word2Vec计算详解(二)Skip-gram模型
【万字长文】Word2Vec计算详解(二)Skip-gram模型 写在前面 本篇介绍Word2Vec中的第二个模型Skip-gram模型 【万字长文】Word2Vec计算详解(一)CBOW模型 markdown行 9000 【万字长文】Word2Vec计算详解(二)S…...

随机掉落的项目足迹:解决TypeError: Cannot read properties of undefined (reading ‘push‘)报错
问题引入 下面是request.js中请求拦截器相关的代码 但是运行时却出现了报错 问题解决 useRouter() 是 Vue Router 提供的组合式 API,它只能在 Vue 组件的 setup() 函数中有效。如果在其他地方(例如 Axios 的拦截器中)调用它,可…...

ChatTTS 本地安装和测试
Ubuntu 22服务器,3.9/3.10都可以,但是 3.11不可以 sudo apt install python3.10 apt install python3.10 python3.10-dev #ubuntu 22 安装python3.10对应的pip3.10 # 下载 get-pip.py curl -sS https://bootstrap.pypa.io/get-pip.py -o get-pip.py # 使…...

[Leetcode] 560 Subarray Sum Equals K
题意:给定一个数组求连续的子数组的和为k的有几个 Input: nums [1,1,1], k 2 Output: 2 https://leetcode.com/problems/subarray-sum-equals-k/description/ 首先思考1.因为是subarray sum前缀和很容易想到,那问题就转化成preSum[i] preSum[j] - k…...

TCL Android面试题大全及参考答案
能谈谈Jetpack组件吗? Jetpack 是一套用于 Android 开发的工具和组件库,它可以帮助开发者更高效地构建高质量的 Android 应用。 一、主要组件分类 架构组件: ViewModel:负责存储和管理与界面相关的数据,当屏幕旋转或配置发生变化时,ViewModel 可以帮助保存数据,避免数据…...

JVM错误:OutOfMemoryError: GC overhead limit exceeded
OutOfMemoryError: GC overhead limit exceeded 在Window服务器上跑一个项目,无意中出现服务访问不了,查看日志文档,第一次遇到了这个异常信息。 1. 错误含义 OutOfMemoryError: GC overhead limit exceeded 是 JVM 中的一种错误ÿ…...

Unity网络开发 - C#开源网络通信库PESocket的使用
概述 在现代多人在线游戏中,稳定且高效的网络通信是确保游戏体验的关键。本文将探讨如何利用C#开源网络通信库PESocket来构建一个简单的Unity客户端与.NET控制台服务器之间的实时消息传递系统。通过本例,读者不仅能够了解PESocket的基本用法,…...

【完-网络安全】Shell与脚本
文章目录 1.CLI与GUI2.终端和Shell2.1 Shell 壳层2.2 终端2.3 终端和Shell区别3.标准流 4.PowerShell4.1 管理员与非管理员4.2 指令4.3 重定向4.4 管道 5.环境变量5.1 影响范围5.2环境变量的作用5.3 常见的环境变量 6.脚本 1.CLI与GUI CLI命令行界面(CLl,Command Line Interfa…...

磁盘标签和分区标签
在Windows中,我们为分区命名,那个名字就是「分区标签」。所以说“分区标签”是给分区的一个名字。 「磁盘标签」其实是我们经常说的「分区表」,比如MBR、GPT等等。而「分区标签」,虽然叫做“分区”标签,但它则是文件系…...

关于摩托车一键启动无钥匙进入、智能科技创新
摩托车一键启动无钥匙进入功能 一、工作原理 摩托车的一键启动无钥匙进入功能采用了世界最先进的RFID无线射频技术和最先进的车辆身份编码识别系统,率先应用小型化、小功率射频天线的开发方案,并成功融合了遥控系统和无钥匙系统,沿用了传统…...