confirm content

main
rayc 2024-12-06 10:11:18 +08:00
parent 3daec70ef9
commit e7003e9eb8
20 changed files with 777 additions and 52 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

View File

@ -1,20 +1,30 @@
[
"file-explorer",
"global-search",
"switcher",
"graph",
"backlink",
"canvas",
"outgoing-link",
"tag-pane",
"page-preview",
"daily-notes",
"templates",
"note-composer",
"command-palette",
"editor-status",
"bookmarks",
"outline",
"word-count",
"file-recovery"
]
{
"file-explorer": true,
"global-search": true,
"switcher": true,
"graph": true,
"backlink": true,
"canvas": true,
"outgoing-link": true,
"tag-pane": true,
"properties": false,
"page-preview": true,
"daily-notes": true,
"templates": true,
"note-composer": true,
"command-palette": true,
"slash-command": false,
"editor-status": true,
"bookmarks": true,
"markdown-importer": false,
"zk-prefixer": false,
"random-note": false,
"outline": true,
"word-count": true,
"slides": false,
"audio-recorder": false,
"workspaces": false,
"file-recovery": true,
"publish": false,
"sync": false
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,10 @@
{
"id": "obsidian-style-settings",
"name": "Style Settings",
"version": "1.0.9",
"minAppVersion": "0.11.5",
"description": "Offers controls for adjusting theme, plugin, and snippet CSS variables.",
"author": "mgmeyers",
"authorUrl": "https://github.com/mgmeyers/obsidian-style-settings",
"isDesktopOnly": false
}

File diff suppressed because one or more lines are too long

View File

@ -4,11 +4,11 @@
"type": "split",
"children": [
{
"id": "78ae62375ca7584d",
"id": "db86daa196f7bea2",
"type": "tabs",
"children": [
{
"id": "849b0fcc9c548d22",
"id": "cad3fc05acadf4a9",
"type": "leaf",
"state": {
"type": "markdown",
@ -16,7 +16,9 @@
"file": "日志检索.md",
"mode": "source",
"source": false
}
},
"icon": "lucide-file",
"title": "日志检索"
}
}
]
@ -39,7 +41,9 @@
"type": "file-explorer",
"state": {
"sortOrder": "alphabetical"
}
},
"icon": "lucide-folder-closed",
"title": "文件列表"
}
},
{
@ -54,7 +58,9 @@
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical"
}
},
"icon": "lucide-search",
"title": "搜索"
}
},
{
@ -62,7 +68,9 @@
"type": "leaf",
"state": {
"type": "bookmarks",
"state": {}
"state": {},
"icon": "lucide-bookmark",
"title": "书签"
}
}
]
@ -85,7 +93,7 @@
"state": {
"type": "backlink",
"state": {
"file": "日志检索.md",
"file": "博客/docker 安装 wordpress.md",
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical",
@ -93,7 +101,9 @@
"searchQuery": "",
"backlinkCollapsed": false,
"unlinkedCollapsed": true
}
},
"icon": "links-coming-in",
"title": "docker 安装 wordpress 的反向链接列表"
}
},
{
@ -102,10 +112,12 @@
"state": {
"type": "outgoing-link",
"state": {
"file": "日志检索.md",
"file": "博客/docker 安装 wordpress.md",
"linksCollapsed": false,
"unlinkedCollapsed": true
}
},
"icon": "links-going-out",
"title": "docker 安装 wordpress 的出链列表"
}
},
{
@ -116,7 +128,9 @@
"state": {
"sortOrder": "frequency",
"useHierarchy": true
}
},
"icon": "lucide-tags",
"title": "标签"
}
},
{
@ -125,8 +139,10 @@
"state": {
"type": "outline",
"state": {
"file": "日志检索.md"
}
"file": "博客/docker 安装 wordpress.md"
},
"icon": "lucide-list",
"title": "docker 安装 wordpress 的大纲"
}
}
]
@ -146,6 +162,35 @@
"command-palette:打开命令面板": false
}
},
"active": "849b0fcc9c548d22",
"lastOpenFiles": []
"active": "cad3fc05acadf4a9",
"lastOpenFiles": [
"Android Hilt.md",
"web/lint/前端开发中的lint.md",
"每日日志/vue3 + vite 中import path.md",
"每日日志/vue3 + vite 不能使用 import.meta.md",
"每日日志/Vite + VUE3 + TS 配置ESLint + Prettier.md",
"每日日志/腾讯 COS + Spring Boot 上传下载.md",
"每日日志/腾讯 COS + CDN实现图床.md",
"Bug日志/后端 -- Bug记录.md",
"编程资源/编程资源.md",
"LeetCode 刷题笔记.md",
"Bug日志/Android 错误记录.md",
"语言/Rust/一些笔记.md",
"编程资源",
"语言/Rust/2024-06-06.md",
"语言/Rust/Rust学习笔记一.md",
"日志检索.md",
"Obsidian + PicGo + 腾讯云COS 图床配置.md",
"未分类日志.md",
"README.md",
"开发中/Vue3 + 腾讯COS文件上传.md",
"开发资源/SpotifyMusic.md",
"开发中/RayC后台开发日志.md",
"工作日志/服务器程序更新.md",
"工作日志/X6 修改.md",
"博客/Android/相机/Android Camera2 在预览时,录制视频.md",
"android/Android 开发辅助信息.md",
"Bug日志/Android - Bug记录.md",
"读书笔记"
]
}

View File

View File

@ -0,0 +1,6 @@
### Android 中 Handler 的message处理
Android 中的Handler的handleMessage中处理数据时如果收到message的频率比较高就容易出现新的消息通知时获取到的是旧数据这个时候可以把 handleMessage 中的处理逻辑使用协程,`切换到Dispatchers.IO` 中尽心处理如果过程有需要在主线程中执行的代码再切换到Dispatchers.Main中执行。
> Android 中的Handler 中需要使用的线程是有创建时传入的Looper决定的。
---

142
LeetCode 刷题笔记.md Normal file
View File

@ -0,0 +1,142 @@
- [3137. K 周期字符串需要的最少操作次数](https://leetcode.cn/problems/minimum-number-of-operations-to-make-word-k-periodic/description/?envType=daily-question&envId=2024-08-17)
- 按照 k 长度进行字符串分割
- 把分割的子串做为hashmap的key计算不同的key计数
- 用总的子串数 - 最多计数的子串数
### 411 周赛
- [100402. 统计满足 K 约束的子字符串数量 I - 力扣LeetCode](https://leetcode.cn/problems/count-substrings-that-satisfy-k-constraint-i/description/)
- 使用暴力dp
计算 i-j 的 01 的数量,通过计算 i-j 之前的子串数量,再求和。最后得到的答案
- 使用滑动窗口
```rust
impl Solution {
pub fn count_k_constraint_substrings(s: String, k: i32) -> i32 {
let mut ans: i32 = 0;
let mut left = 0;
let mut cnt = [0; 2];
let chars = s.chars().collect::<Vec<char>>();
for (right, ch) in chars.iter().enumerate() {
// 计算当前窗口的 '0' '1' 的数量
cnt[ch.to_digit(10).unwrap() as usize] += 1;
// 如果窗口内的 '0' '1' 数量不满足条件,则通过 left+=1移动窗口
while cnt[0] > k && cnt[1] > k {
cnt[chars[left].to_digit(10).unwrap() as usize] -= 1;
left += 1;
}
// 把窗口长度加到结果里面,窗口内的符合条件的子串,会被其他窗口添加进去
ans += (right - left + 1) as i32;
}
return ans;
}
}
```
## [3306. 元音辅音字符串计数 II - 力扣LeetCode](https://leetcode.cn/problems/count-of-substrings-containing-every-vowel-and-k-consonants-ii/description/)
```Rust
use std::collections::HashMap;
impl Solution {
pub fn count_of_substrings(word: String, k: i32) -> i64 {
let len = word.len();
let word_arr = word.chars().collect::<Vec<char>>();
let mut vowel_map: HashMap<char, i32> = HashMap::new();
let mut k_cnt = 0;
fn is_vowel(c: &char) -> bool {
"aeiou".contains(*c)
}
let mut last_next = len;
let mut cache = vec![0; len];
for i in (0..len).rev() {
cache[i] = last_next;
if !is_vowel(&word_arr[i]) {
last_next = i;
}
}
let mut left = 0;
let mut ans = 0;
for right in 0..len {
if is_vowel(&word_arr[right]) {
let e = vowel_map.entry(word_arr[right]).or_insert(0);
*e += 1;
} else {
k_cnt += 1;
}
let val = cache[right] - right;
while (left <= right && k_cnt > k) || (vowel_map.len() == 5 && k_cnt == k) {
if vowel_map.len() == 5 && k_cnt == k {
ans += val as i64;
}
let l_ch = &word_arr[left];
if is_vowel(l_ch) {
let e = vowel_map.entry(*l_ch).or_insert(0);
if *e == 1 { vowel_map.remove(&l_ch); } else { *e -= 1; }
} else {
k_cnt -= 1;
}
left += 1;
}
}
ans
}
}
```
第二种看的大佬的题解把计算k个辅音字母数改成至少 k 个辅音字母数最后可以通过fn(k) - f(k+1) 计算的到复合预期的子字符串的总数, 代码如下:
```Rust
use std::collections::HashMap;
impl Solution {
pub fn count_of_substrings(word: String, k: i32) -> i64 {
fn cal(word: &Vec<char>, k: i32) -> i64 {
let len = word.len();
let mut vowel_map: HashMap<&char, i32> = HashMap::new();
let mut k_cnt = 0;
fn is_vowel(c: &char) -> bool {
"aeiou".contains(*c)
}
let mut left = 0;
let mut ans = 0;
for (i, ch) in word.iter().enumerate() {
if is_vowel(ch) {
let e = vowel_map.entry(ch).or_insert(0);
*e += 1;
} else {
k_cnt += 1;
}
while vowel_map.len() == 5 && k_cnt >= k {
let l_ch = &word[left];
if is_vowel(&l_ch) {
let e = vowel_map.entry(l_ch).or_insert(0);
if *e == 1 { vowel_map.remove(&l_ch); } else { *e -= 1; }
} else {
k_cnt -= 1;
}
left += 1;
}
ans += left as i64;
}
ans
}
let char_arr = word.chars().collect::<Vec<char>>();
cal(&char_arr, k) - cal(&char_arr, k+1)
}
}
```

View File

@ -0,0 +1,6 @@
## 修改项目的包名
- 修改包名在Android Studio中把 目录显示中 `Tree Appearrance / Compact Middle Packages` 关闭掉 关闭可以更好的修改包名,更方便
- 修改配置文件:
- namespace: 这个决定了项目中的命名空间的读取
- applicationId: 这个是程序在被读取的时候的id
- fix 代码,修改代码之后 资源导入的 `R``ViewBinding` 等需要根据新的包名和namespace来进行修改AndroidManifest.xml 是根据 `namespace` 来识别文件位置的,比如 `Application``Activity` 等需要引入的数据

3
web/Vite 学习.md Normal file
View File

@ -0,0 +1,3 @@
- 预构建
- 把非ESM模式的代码。转换成ESM格式在浏览器通过`<script type="module"></script>` 的方式能正确加载
- 打包第三方库的代码将各个第三方库的分散文件合并到一起减少HTTP请求数量避免页面加载性能劣化

View File

@ -1,17 +0,0 @@
- 界面上方`title_bar` 移动到底部
- 需要修改 activity_main.xml在layout和layout-land
- 主题显示区域的 marginTop 修改为 marginBottom
- Menu也将 marginTop 修改为 marginBottom
- titleBar 修改 marginBottom
- 调整之后menu中唤起的 note_menu_popupwindow 和 measure_menu_popupwindow 需要把 `paddingTop` 修改为 `paddingBottom`
- titlebar小工具只显示 相机和电量
- 需要修改 `fragment_main_titlebar``fragment_main_titlebar_820` `820` 是用于横屏模式
- 把 `<include layout="@layout/other_param_h" />``other_param_h` 的根节点,设置为`visibility="gone"`
- 设置了上面的之后,相机图标会消失
- 需要把相机显示的两个控件的设置为 `layout_width="40.0.dip"`
- Menu + TitleBar 背景颜色修改
- 背景颜色直接修改Menu和TitleBar的背景颜色是分开的
- TGC 只留下TGC一个选项
- 在 `activity_auxiliaire_setting.xml``rg_shortcut_button` 中除了 `tgc` 之外全部都 `visibility="gone"`
- Menu图标修改
- 后期替换图片和xml文件

View File

@ -0,0 +1,59 @@
- `settings file:` `gradle``entry point`
- 对于单模块项目 `settings` 文件可选
- 多模块项目 `settings` 文件用来声明和控制 子项目
- 具体文件内容
```kotlin
rootProject.name = "root-project" // 定义项目名称
include("app") // 使用include引入subproject, 用来定义项目结构
include("feature")
plugins { //
id("java") version "" // 引入插件,可选;
}
```
- `build.gradle.kts` : 每一个 `gradle` 的构建至少包含一个build脚本文件
- `plugins` :构建需要的依赖,
- 插件通过扩展`Gradle`来配置或着设置构建需要的`task`, 还可以用来进行依赖管理插件还会在build.gradle.kts 中添加新的属性或者方法来增加配置下面的application就是`application`插件定义的一个
- `application`: 源码
- 依赖管理
- 依赖管理,用来声明和解析项目所需的外部资源(依赖项)。包括构建项目需要需要的jar、插件、库和源代码。
- `libs.versions.toml` 版本目录
- 所包含的部分
- `versions` 定义插件和库文件的 版本数字
- `libraries` 定义需要使用的依赖库
- `bundles`
- `plugin` 定义需要使用的插件
- 举例如下
```toml
[versions]
androidGradlePlugin = "7.4.1"
mockito = "2.16.0"
[libraries]
googleMaterial = { group = "com.google.android.material", name = "material", version = "1.1.0-alpha05" }
mockitoCore = { module = "org.mockito:mockito-core", version.ref = "mockito" }
[plugins]
androidApplication = { id = "com.android.application", version.ref = "androidGradlePlugin" }
```
- libs.versions.toml 文件放在gradle项目中的gradle目录下gradle 和 IDE都可以自动使用这个版本目录
- build中引入依赖
- 在使用了libs.versions.toml之后就可以使用libs.version.toml 中的定义的方式来引入依赖
- 示例:
```kotlin
plugins {
alias(libs.plugins.androidApplication)
}
dependencies {
// Dependency on a remote binary to compile and run the code
implementation(libs.googleMaterial)
// Dependency on a remote binary to compile and run the test code
testImplementation(libs.mockitoCore)
}
```
- Task
- Plugin
- 增量构建 + 缓存
- 增量构建: 如果两次相同的构建之间,没有修改项目中的内容,则不会发生新的构建,而是打印出一个 `UP-TO-DATE`
-

View File

@ -54,3 +54,14 @@
## 2024-04-26
- [[Obsidian + PicGo + 腾讯云COS 图床配置]]
75d75761da072293fca411ec93674099c4bd65e9
---
### 2024-11-27
> - 工作
> - 读书:
> - **<被讨厌的勇气>**:读完第二夜
> - 新开**<代码整洁之道>:** 读完序言
> - UI
> - 工具Inkscape logos by nick 的 Inkscape 看完Path Effects

View File

@ -0,0 +1,7 @@
## Web UI组件库
> - [Magic UI](https://magicui.design/)
> - [Aceternity UI](https://ui.aceternity.com/)
> - [Motion - A modern animation library for JavaScript and React](https://motion.dev/)
## Web 编辑器库
> - [lexical - npm](https://www.npmjs.com/package/lexical)

View File

@ -0,0 +1,35 @@
## 智能指针
> Box — Rust 中的一种智能指针,作用就是为一个 把一个 属性 包装成一个具有move语义的属性 (被包装的这个)
- Box 可以包装任何对象,并且被包装之后的的 引用是一个 具有 move语义的
- Box 包装的引用 boxed如果原本引用 a 是 实现了**Copy** 的,则可以继续使用,如果没有实现 Copy 特征则不能再使用因为原始引用的所有权移到了boxed中
- 在对Box解引用时过程和Box 创建过程相反,如果原始引用是一个没有实现 Copy 的,也需要注意引用的所有权转移
> Box 包装之后的内容一定保存到堆上了
> Box<T> 实现了 Deref AsRef Drop所以boxed 可以访问T 想像 T 自己一样
> Box 作为参数、Clone 特征、被引用都和一般的类型一样Clone需要考虑T 的Clone特征
> Box<Self>
> Arc — Rust 中的一种智能指针Arc 是共享所有权模型的智能指针,也就是多个变量可以同时拥有一个资源的所有权
> Arc 的 clone — 是基于引用计数的操作对被Arc 包装的引用的做引用计数所以Arc 的clone不用考虑原始类型
> Arc 不支持解引用、不能修改内部引用的值
---
## Rust 并发编程
- 异步编程的开启方式async 声明一个异步的函数或作用域使用await来执行 async 函数
- Rust 的异步运行时,
- 运行时的作用:
- 异步代码执行
- 代码暂停
- 状态的缓存
- 外部事件的监听注册
- 外部事件到来时,唤醒对应的任务,并恢复任务状态
- 多个任务之间的调度
- Rust 的异步运行时没有官方标准版tokio 的异步运行时基本是Rust的事实上的异步运行时库
---
## Rust 中的异常
`?` 操作符;异常处理的一个 防御式编程 语法糖; 对 Result 的结果做解包如果Result的结果是Err 就直接return 一个错误

View File