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(); …...

安全网络架构
网络安全解决方案是指通过一系列技术和措施来保护网络系统和数据的安全。它涉及多个方面,包括网络设备的防护、数据的加密和备份、安全策略的制定和执行等。以下是一些常见的网络安全解决方案: 防火墙:防火墙是一种硬件或软件设备,…...
[特殊字符] 智能合约中的数据是如何在区块链中保持一致的?
🧠 智能合约中的数据是如何在区块链中保持一致的? 为什么所有区块链节点都能得出相同结果?合约调用这么复杂,状态真能保持一致吗?本篇带你从底层视角理解“状态一致性”的真相。 一、智能合约的数据存储在哪里…...
【杂谈】-递归进化:人工智能的自我改进与监管挑战
递归进化:人工智能的自我改进与监管挑战 文章目录 递归进化:人工智能的自我改进与监管挑战1、自我改进型人工智能的崛起2、人工智能如何挑战人类监管?3、确保人工智能受控的策略4、人类在人工智能发展中的角色5、平衡自主性与控制力6、总结与…...

Flask RESTful 示例
目录 1. 环境准备2. 安装依赖3. 修改main.py4. 运行应用5. API使用示例获取所有任务获取单个任务创建新任务更新任务删除任务 中文乱码问题: 下面创建一个简单的Flask RESTful API示例。首先,我们需要创建环境,安装必要的依赖,然后…...
rknn优化教程(二)
文章目录 1. 前述2. 三方库的封装2.1 xrepo中的库2.2 xrepo之外的库2.2.1 opencv2.2.2 rknnrt2.2.3 spdlog 3. rknn_engine库 1. 前述 OK,开始写第二篇的内容了。这篇博客主要能写一下: 如何给一些三方库按照xmake方式进行封装,供调用如何按…...

Mybatis逆向工程,动态创建实体类、条件扩展类、Mapper接口、Mapper.xml映射文件
今天呢,博主的学习进度也是步入了Java Mybatis 框架,目前正在逐步杨帆旗航。 那么接下来就给大家出一期有关 Mybatis 逆向工程的教学,希望能对大家有所帮助,也特别欢迎大家指点不足之处,小生很乐意接受正确的建议&…...

CMake基础:构建流程详解
目录 1.CMake构建过程的基本流程 2.CMake构建的具体步骤 2.1.创建构建目录 2.2.使用 CMake 生成构建文件 2.3.编译和构建 2.4.清理构建文件 2.5.重新配置和构建 3.跨平台构建示例 4.工具链与交叉编译 5.CMake构建后的项目结构解析 5.1.CMake构建后的目录结构 5.2.构…...
服务器硬防的应用场景都有哪些?
服务器硬防是指一种通过硬件设备层面的安全措施来防御服务器系统受到网络攻击的方式,避免服务器受到各种恶意攻击和网络威胁,那么,服务器硬防通常都会应用在哪些场景当中呢? 硬防服务器中一般会配备入侵检测系统和预防系统&#x…...
spring:实例工厂方法获取bean
spring处理使用静态工厂方法获取bean实例,也可以通过实例工厂方法获取bean实例。 实例工厂方法步骤如下: 定义实例工厂类(Java代码),定义实例工厂(xml),定义调用实例工厂ÿ…...
Mysql8 忘记密码重置,以及问题解决
1.使用免密登录 找到配置MySQL文件,我的文件路径是/etc/mysql/my.cnf,有的人的是/etc/mysql/mysql.cnf 在里最后加入 skip-grant-tables重启MySQL服务 service mysql restartShutting down MySQL… SUCCESS! Starting MySQL… SUCCESS! 重启成功 2.登…...

DingDing机器人群消息推送
文章目录 1 新建机器人2 API文档说明3 代码编写 1 新建机器人 点击群设置 下滑到群管理的机器人,点击进入 添加机器人 选择自定义Webhook服务 点击添加 设置安全设置,详见说明文档 成功后,记录Webhook 2 API文档说明 点击设置说明 查看自…...