From 2c72a5590b8e9fcd15de1f4953c6389f68f5aa90 Mon Sep 17 00:00:00 2001 From: SivanLaai Date: Sun, 8 Oct 2023 09:07:44 +0000 Subject: [PATCH] deploy: 32cbe1ac9c50c41b6d2ddfc7b9877da43e6d44f5 --- baidu_urls.txt | 3 + categories/index.html | 5 +- categories/index.xml | 2 +- .../index.html" | 13 +++++ .../index.xml" | 1 + .../page/1/index.html" | 1 + en/index.html | 2 +- en/offline/index.md | 9 +-- index.html | 4 +- index.json | 2 +- index.xml | 2 +- offline/index.md | 9 +-- page/2/index.html | 4 +- page/3/index.html | 4 +- page/4/index.html | 4 +- page/5/index.html | 6 +- page/6/index.html | 4 +- posts/index.html | 16 ++++-- posts/index.xml | 2 +- posts/learning/rl/q_learning/index.html | 21 +++++++ posts/learning/rl/q_learning/index.md | 19 +++++++ posts/learning/rl/rl_basic/index.html | 20 +++++++ posts/learning/rl/rl_basic/index.md | 55 +++++++++++++++++++ .../conquer_divide/index.html | 12 ++-- .../dynamic_programing/index.html | 10 ++-- .../greedy/index.html | 10 ++-- posts/page/2/index.html | 5 +- posts/projects/rime/info/index.html | 6 +- posts/projects/rime/info/index.md | 4 +- posts/projects/surrogacy-website/index.html | 18 ++++++ posts/projects/surrogacy-website/index.md | 38 +++++++++++++ posts/research/bacth_norm/index.html | 2 +- posts/research/desity_modeling/index.html | 6 +- posts/research/eplace/index.html | 24 ++++---- posts/research/eplace/index.md | 28 +++++----- posts/research/multiclass_svm/index.html | 2 +- posts/research/neural_network/index.html | 2 +- posts/research/softmax/index.html | 6 +- posts/technology/apache2_and_nginx/index.html | 6 +- posts/technology/apache2_and_nginx/index.md | 2 +- .../auto_deploy_with_obsidian/index.html | 2 +- posts/technology/docker/index.html | 14 +++-- posts/technology/docker/index.md | 8 +++ posts/technology/lattern/index.html | 2 +- posts/technology/nextcloud/index.html | 2 +- .../nvim_debug_mixed_cpp_python/index.html | 9 +-- .../nvim_debug_mixed_cpp_python/index.md | 8 +-- posts/technology/system/index.html | 2 +- posts/technology/vnc_server/index.html | 2 +- sitemap.xml | 2 +- zh-cn/sitemap.xml | 2 +- 51 files changed, 322 insertions(+), 120 deletions(-) create mode 100644 "categories/\345\274\272\345\214\226\345\255\246\344\271\240/index.html" create mode 100644 "categories/\345\274\272\345\214\226\345\255\246\344\271\240/index.xml" create mode 100644 "categories/\345\274\272\345\214\226\345\255\246\344\271\240/page/1/index.html" create mode 100644 posts/learning/rl/q_learning/index.html create mode 100644 posts/learning/rl/q_learning/index.md create mode 100644 posts/learning/rl/rl_basic/index.html create mode 100644 posts/learning/rl/rl_basic/index.md create mode 100644 posts/projects/surrogacy-website/index.html create mode 100644 posts/projects/surrogacy-website/index.md diff --git a/baidu_urls.txt b/baidu_urls.txt index bec0700..7fcc95b 100644 --- a/baidu_urls.txt +++ b/baidu_urls.txt @@ -1,3 +1,5 @@ +https://www.laais.cn/posts/learning/rl/q_learning/ +https://www.laais.cn/posts/learning/rl/rl_basic/ https://www.laais.cn/posts/technology/nvim_debug_mixed_cpp_python/ https://www.laais.cn/posts/technology/vnc_server/ https://www.laais.cn/posts/research/eplace/ @@ -31,4 +33,5 @@ https://www.laais.cn/posts/research/bacth_norm/ https://www.laais.cn/posts/research/neural_network/ https://www.laais.cn/posts/research/softmax/ https://www.laais.cn/offline/ +https://www.laais.cn/posts/projects/surrogacy-website/ https://www.laais.cn/posts/research/desity_modeling/ diff --git a/categories/index.html b/categories/index.html index 0abd68f..9000178 100644 --- a/categories/index.html +++ b/categories/index.html @@ -6,12 +6,13 @@ 取消

所有分类 -10

+11

diff --git a/categories/index.xml b/categories/index.xml index c00918d..6d19829 100644 --- a/categories/index.xml +++ b/categories/index.xml @@ -1 +1 @@ -Categories - 分类 - SivanLaai's Bloghttps://www.laais.cn/categories/Categories - 分类 - SivanLaai's BlogHugo -- gohugo.iozh-CNlyhhap@163.com (SivanLaai)lyhhap@163.com (SivanLaai)This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.Wed, 05 Apr 2023 19:08:19 +0800调试https://www.laais.cn/categories/%E8%B0%83%E8%AF%95/Wed, 05 Apr 2023 19:08:19 +0800SivanLaaihttps://www.laais.cn/categories/%E8%B0%83%E8%AF%95/笔记https://www.laais.cn/categories/%E7%AC%94%E8%AE%B0/Mon, 27 Mar 2023 16:33:04 +0800SivanLaaihttps://www.laais.cn/categories/%E7%AC%94%E8%AE%B0/索引https://www.laais.cn/categories/%E7%B4%A2%E5%BC%95/Sat, 10 Dec 2022 11:39:42 +0800SivanLaaihttps://www.laais.cn/categories/%E7%B4%A2%E5%BC%95/建站https://www.laais.cn/categories/%E5%BB%BA%E7%AB%99/Fri, 09 Dec 2022 15:41:53 +0800SivanLaaihttps://www.laais.cn/categories/%E5%BB%BA%E7%AB%99/教程https://www.laais.cn/categories/%E6%95%99%E7%A8%8B/Thu, 28 Jul 2022 11:46:36 +0000SivanLaaihttps://www.laais.cn/categories/%E6%95%99%E7%A8%8B/问题总结https://www.laais.cn/categories/%E9%97%AE%E9%A2%98%E6%80%BB%E7%BB%93/Thu, 19 May 2022 13:40:49 +0000SivanLaaihttps://www.laais.cn/categories/%E9%97%AE%E9%A2%98%E6%80%BB%E7%BB%93/项目https://www.laais.cn/categories/%E9%A1%B9%E7%9B%AE/Fri, 08 Apr 2022 16:14:01 +0000SivanLaaihttps://www.laais.cn/categories/%E9%A1%B9%E7%9B%AE/学习https://www.laais.cn/categories/%E5%AD%A6%E4%B9%A0/Wed, 02 Mar 2022 19:26:58 +0000SivanLaaihttps://www.laais.cn/categories/%E5%AD%A6%E4%B9%A0/rimehttps://www.laais.cn/categories/rime/Thu, 29 Jul 2021 14:10:34 +0000SivanLaaihttps://www.laais.cn/categories/rime/技术https://www.laais.cn/categories/%E6%8A%80%E6%9C%AF/Sun, 12 Jan 2020 20:20:00 +0000SivanLaaihttps://www.laais.cn/categories/%E6%8A%80%E6%9C%AF/ \ No newline at end of file +Categories - 分类 - SivanLaai's Bloghttps://www.laais.cn/categories/Categories - 分类 - SivanLaai's BlogHugo -- gohugo.iozh-CNlyhhap@163.com (SivanLaai)lyhhap@163.com (SivanLaai)This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.Thu, 28 Sep 2023 11:52:17 +0800强化学习https://www.laais.cn/categories/%E5%BC%BA%E5%8C%96%E5%AD%A6%E4%B9%A0/Thu, 28 Sep 2023 11:52:17 +0800SivanLaaihttps://www.laais.cn/categories/%E5%BC%BA%E5%8C%96%E5%AD%A6%E4%B9%A0/调试https://www.laais.cn/categories/%E8%B0%83%E8%AF%95/Wed, 05 Apr 2023 19:08:19 +0800SivanLaaihttps://www.laais.cn/categories/%E8%B0%83%E8%AF%95/笔记https://www.laais.cn/categories/%E7%AC%94%E8%AE%B0/Mon, 27 Mar 2023 16:33:04 +0800SivanLaaihttps://www.laais.cn/categories/%E7%AC%94%E8%AE%B0/索引https://www.laais.cn/categories/%E7%B4%A2%E5%BC%95/Sat, 10 Dec 2022 11:39:42 +0800SivanLaaihttps://www.laais.cn/categories/%E7%B4%A2%E5%BC%95/建站https://www.laais.cn/categories/%E5%BB%BA%E7%AB%99/Fri, 09 Dec 2022 15:41:53 +0800SivanLaaihttps://www.laais.cn/categories/%E5%BB%BA%E7%AB%99/教程https://www.laais.cn/categories/%E6%95%99%E7%A8%8B/Thu, 28 Jul 2022 11:46:36 +0000SivanLaaihttps://www.laais.cn/categories/%E6%95%99%E7%A8%8B/问题总结https://www.laais.cn/categories/%E9%97%AE%E9%A2%98%E6%80%BB%E7%BB%93/Thu, 19 May 2022 13:40:49 +0000SivanLaaihttps://www.laais.cn/categories/%E9%97%AE%E9%A2%98%E6%80%BB%E7%BB%93/项目https://www.laais.cn/categories/%E9%A1%B9%E7%9B%AE/Fri, 08 Apr 2022 16:14:01 +0000SivanLaaihttps://www.laais.cn/categories/%E9%A1%B9%E7%9B%AE/学习https://www.laais.cn/categories/%E5%AD%A6%E4%B9%A0/Wed, 02 Mar 2022 19:26:58 +0000SivanLaaihttps://www.laais.cn/categories/%E5%AD%A6%E4%B9%A0/rimehttps://www.laais.cn/categories/rime/Thu, 29 Jul 2021 14:10:34 +0000SivanLaaihttps://www.laais.cn/categories/rime/ \ No newline at end of file diff --git "a/categories/\345\274\272\345\214\226\345\255\246\344\271\240/index.html" "b/categories/\345\274\272\345\214\226\345\255\246\344\271\240/index.html" new file mode 100644 index 0000000..ecf447e --- /dev/null +++ "b/categories/\345\274\272\345\214\226\345\255\246\344\271\240/index.html" @@ -0,0 +1,13 @@ +强化学习 - 分类 - SivanLaai's Blog

+强化学习 2

2023

0%
\ No newline at end of file diff --git "a/categories/\345\274\272\345\214\226\345\255\246\344\271\240/index.xml" "b/categories/\345\274\272\345\214\226\345\255\246\344\271\240/index.xml" new file mode 100644 index 0000000..2afff8a --- /dev/null +++ "b/categories/\345\274\272\345\214\226\345\255\246\344\271\240/index.xml" @@ -0,0 +1 @@ +强化学习 - 分类 - SivanLaai's Bloghttps://www.laais.cn/categories/%E5%BC%BA%E5%8C%96%E5%AD%A6%E4%B9%A0/强化学习 - 分类 - SivanLaai's BlogHugo -- gohugo.iozh-CNlyhhap@163.com (SivanLaai)lyhhap@163.com (SivanLaai)This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.Thu, 28 Sep 2023 11:52:17 +0800Q学习算法https://www.laais.cn/posts/learning/rl/q_learning/Thu, 28 Sep 2023 11:52:17 +0800SivanLaaihttps://www.laais.cn/posts/learning/rl/q_learning/状态$s_1,s_2$,动作$a_1,a_2$ 当前步的实现:$$Q(s_1,a_2)=r+\gamma \max_{a^}(Q(s^,a^))简介https://www.laais.cn/posts/learning/rl/rl_basic/Thu, 28 Sep 2023 10:36:03 +0800SivanLaaihttps://www.laais.cn/posts/learning/rl/rl_basic/概念 原先的动作是没有标签的,强化学习可以对每一个动作进行打分,然后学习,不断的迭代完成算法的学习。 按环境分类 Model-Free RL(不理解所处环境) 环境给到 \ No newline at end of file diff --git "a/categories/\345\274\272\345\214\226\345\255\246\344\271\240/page/1/index.html" "b/categories/\345\274\272\345\214\226\345\255\246\344\271\240/page/1/index.html" new file mode 100644 index 0000000..eddf433 --- /dev/null +++ "b/categories/\345\274\272\345\214\226\345\255\246\344\271\240/page/1/index.html" @@ -0,0 +1 @@ +https://www.laais.cn/categories/%E5%BC%BA%E5%8C%96%E5%AD%A6%E4%B9%A0/ \ No newline at end of file diff --git a/en/index.html b/en/index.html index 53c123d..067993c 100644 --- a/en/index.html +++ b/en/index.html @@ -1,4 +1,4 @@ -SivanLaai's Blog

0%
\ No newline at end of file diff --git a/index.json b/index.json index 2c29ec5..17710a2 100644 --- a/index.json +++ b/index.json @@ -1 +1 @@ -[{"categories":["调试"],"content":"安装插件 前置需要安装NvChad ","date":"2023-04-05","objectID":"/posts/technology/nvim_debug_mixed_cpp_python/:1:0","tags":null,"title":"nvim下混合编译调试Dreamplace源码","uri":"/posts/technology/nvim_debug_mixed_cpp_python/"},{"categories":["调试"],"content":"引入插件 { lazy = false, \"rcarriga/nvim-dap-ui\", dependencies = { { \"mfussenegger/nvim-dap\", config = function() return require(\"custom.configs.dap.init\")  Annotations specify that at most 0 return value(s) are required, found 1 to 2 returned here instead. end, }, }, }, ","date":"2023-04-05","objectID":"/posts/technology/nvim_debug_mixed_cpp_python/:1:1","tags":null,"title":"nvim下混合编译调试Dreamplace源码","uri":"/posts/technology/nvim_debug_mixed_cpp_python/"},{"categories":["调试"],"content":"配置插件 C++调试配置 -- c++配置 -- file:dap/cppdbg.lua local dap = require(\"dap\") local function isempty(s) return s == nil or s == \"\" end dap.adapters.cppdbg = { id = 'cppdbg', type = 'executable', command = '~/.local/share/nvim/mason/bin/OpenDebugAD7', } dap.configurations.cpp = { { name = \"Launch file\", type = \"cppdbg\", request = \"launch\", program = function() return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') end, cwd = '${workspaceFolder}', stopAtEntry = true, }, { name = 'Attach to gdbserver :1234', type = 'cppdbg', request = 'launch', MIMode = 'gdb', miDebuggerServerAddress = 'localhost:1234', miDebuggerPath = '/usr/bin/gdb', cwd = '${workspaceFolder}', args = function() return {vim.fn.input('Parameters to executable: ', vim.fn.getcwd() .. '/', 'file')} end, program = function() return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') end, }, } 调试初始化 -- c++配置 -- file:dap/init.lua local dap, dapui = require(\"dap\"), require(\"dapui\") dapui.setup() dap.listeners.after.event_initialized[\"dapui_config\"] = function() dapui.open() end dap.listeners.before.event_terminated[\"dapui_config\"] = function() dapui.close() end dap.listeners.before.event_exited[\"dapui_config\"] = function() dapui.close() end require(\"custom.configs.dap.cppdbg\") 调试快捷键配置 M.Debug = { n = { [\"\u003cF5\u003e\"] = { ':lua require(\"dap\").continue()\u003cCR\u003e', \"debug: run/continue\" }, [\"\u003cF7\u003e\"] = { ':lua require(\"dap\").toggle_breakpoint()\u003cCR\u003e', \"debug: toggle breakpoint\" }, [\"\u003cF8\u003e\"] = { ':lua require(\"dap\").terminate() require(\"dapui\").close()\u003cCR\u003e', \"debug: stop\" }, [\"\u003cF9\u003e\"] = { ':lua require(\"dap\").step_into()\u003cCR\u003e', \"debug: step into\" }, [\"\u003cF10\u003e\"] = { ':lua require(\"dap\").step_out()\u003cCR\u003e', \"debug: step out\" }, [\"\u003cF11\u003e\"] = { ':lua require(\"dap\").step_over()\u003cCR\u003e', \"debug: step out\" }, [\"\u003cleader\u003edb\"]= { ':lua require(\"dap\").set_breakpoint(vim.fn.input(\"Breakpoint condition: \"))\u003cCR\u003e', \"debug: Set breakpoint with condition\" }, [\"\u003cleader\u003edc\"]= { ':lua require(\"dap\").run_to_cursor()\u003cCR\u003e', \"debug: run to cursor\" }, [\"\u003cleader\u003edl\"]= { ':lua require(\"dap\").run_last()\u003cCR\u003e', \"debug: run last\" }, [\"\u003cleader\u003edo\"]= { ':lua require(\"dap\").repl.open()\u003cCR\u003e', \"debug: open REPL\" }, }, } ","date":"2023-04-05","objectID":"/posts/technology/nvim_debug_mixed_cpp_python/:1:2","tags":null,"title":"nvim下混合编译调试Dreamplace源码","uri":"/posts/technology/nvim_debug_mixed_cpp_python/"},{"categories":["调试"],"content":"调试源码 ","date":"2023-04-05","objectID":"/posts/technology/nvim_debug_mixed_cpp_python/:2:0","tags":null,"title":"nvim下混合编译调试Dreamplace源码","uri":"/posts/technology/nvim_debug_mixed_cpp_python/"},{"categories":["调试"],"content":"启动GDBServer gdbserver localhost:1234 ~/anaconda3/bin/python unittest/ops/lpabs_wirelength_unittest.py ","date":"2023-04-05","objectID":"/posts/technology/nvim_debug_mixed_cpp_python/:2:1","tags":null,"title":"nvim下混合编译调试Dreamplace源码","uri":"/posts/technology/nvim_debug_mixed_cpp_python/"},{"categories":["调试"],"content":"Neovim连接GDBServer 按F5进入调试运行模式,选2回车 输入运行参数回车 输入对应的python路径回车 ","date":"2023-04-05","objectID":"/posts/technology/nvim_debug_mixed_cpp_python/:2:2","tags":null,"title":"nvim下混合编译调试Dreamplace源码","uri":"/posts/technology/nvim_debug_mixed_cpp_python/"},{"categories":["调试"],"content":"调试界面 显示如下则成功进入调试模式: ","date":"2023-04-05","objectID":"/posts/technology/nvim_debug_mixed_cpp_python/:2:3","tags":null,"title":"nvim下混合编译调试Dreamplace源码","uri":"/posts/technology/nvim_debug_mixed_cpp_python/"},{"categories":null,"content":"Step1 (安装GNOME桌面) sudo apt-get update sudo apt-get install gnome-session-flashback sudo apt-get install ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal -y ","date":"2023-03-28","objectID":"/posts/technology/vnc_server/:0:1","tags":null,"title":"Ubuntu安装VNCServer","uri":"/posts/technology/vnc_server/"},{"categories":null,"content":"Step2 sudo apt-get -y install xfonts-100dpi xfonts-100dpi-transcoded xfonts-75dpi xfonts-75dpi-transcoded xfonts-base ","date":"2023-03-28","objectID":"/posts/technology/vnc_server/:0:2","tags":null,"title":"Ubuntu安装VNCServer","uri":"/posts/technology/vnc_server/"},{"categories":null,"content":"Step3 sudo apt install tigervnc-standalone-server ","date":"2023-03-28","objectID":"/posts/technology/vnc_server/:0:3","tags":null,"title":"Ubuntu安装VNCServer","uri":"/posts/technology/vnc_server/"},{"categories":null,"content":"Step4:配置密码 vncpasswd ","date":"2023-03-28","objectID":"/posts/technology/vnc_server/:0:4","tags":null,"title":"Ubuntu安装VNCServer","uri":"/posts/technology/vnc_server/"},{"categories":null,"content":"Step5:配置XStartup vim ~/.vnc/xstartup 内容如下: #!/bin/sh # Start Gnome 3 Desktop [ -x /etc/vnc/xstartup ] \u0026\u0026 exec /etc/vnc/xstartup [ -r $HOME/.Xresources ] \u0026\u0026 xrdb $HOME/.Xresources vncconfig -iconic \u0026 dbus-launch --exit-with-session gnome-session \u0026 ","date":"2023-03-28","objectID":"/posts/technology/vnc_server/:0:5","tags":null,"title":"Ubuntu安装VNCServer","uri":"/posts/technology/vnc_server/"},{"categories":null,"content":"Step6:重启TigerVNC tightvncserver -kill :1 vncserver -depth 24 -name mydesktop -localhost no :1 ","date":"2023-03-28","objectID":"/posts/technology/vnc_server/:0:6","tags":null,"title":"Ubuntu安装VNCServer","uri":"/posts/technology/vnc_server/"},{"categories":["笔记"],"content":"基本概念 ","date":"2023-03-27","objectID":"/posts/research/eplace/:1:0","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"布局的定义 布局问题可以描述为一个超图问题,可以定义为如下: $$G = (V,E,R)$$ 其中$V$表示元器件(顶点)集合,$E$表示网表(超边)集合,$R$表示布局区域。在$V$中$V_m$表示可移动器件的集合,$V_f$表示固定块集合。令$n=|V_m|$表示可移动布局对象的个数。 一个合法的布局解决方案应该要满足下面三个要求: 在布局区域中使用足够的空闲位置容纳每个器件 每个元器件在水平方向上要和布局行的边界对齐 元器件和宏组件不能有重合 基于上述的合法性限制,布局的目标就是最小化网表的总$HPWL$,假定$\\mathbf{v}=(\\mathbf{x},\\mathbf{y})$表示一个布局的方案,其中$\\mathbf{x}={x_i|i \\in V_m}$表示所有元器件的水平坐标,$\\mathbf{y}={y_i|i \\in V_m}$表示元器件的垂直坐标,则对于每个网表$e(e \\in E)$,其半周线长的定义如下: $$HPWL_e(\\mathbf{v}) = \\max_{i,j \\in e}|x_i-x_j|+\\max_{i,j \\in e}|y_i-y_j| \\tag 1$$ 则总半周线长定义为: $$HPWL(\\mathbf{v}) = \\sum_{e \\in E} HPWL_e(\\mathbf{v})$$ 布局问题定义为如下: $$\\min_\\mathbf{v}HPWL(\\mathbf{v}),使得\\mathbf{v}是一个合法的布局方案 \\tag 2$$ ","date":"2023-03-27","objectID":"/posts/research/eplace/:1:1","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"全局布局的定义 把布局区域$R$按$m\\times m$划分成一个一个的格子(称作bin),这些格子的集合是B,其中$\\rho_b(\\mathbf{v})$表示每个b的密度,其定义如下: $$\\rho_b(\\mathbf{v}) = \\sum_{i \\in V} l_x(b,i)l_y(b,i) \\tag 3$$ 其中$l_x(b,i)$和$l_y(b,i)$分别表示元器件i和格子b之间的水平和垂直重合,全局布局的定义如下: $$\\min_\\mathbf{v}HPWL(\\mathbf{v})\\ s.t.\\rho_b(\\mathbf{v})\\leq \\rho_t, \\forall b \\in B \\tag 4$$ ","date":"2023-03-27","objectID":"/posts/research/eplace/:1:2","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"线长平滑化 每一个网表$e={(x_1,y_1),(x_2,y_2),\\cdots,(x_n,y_n)}$有n个引脚 ,对数和指数(LSE)在水平轴x方向的线长平滑公式如下: $$W_e(\\mathbf{v}) =\\gamma \\begin{pmatrix} ln\\sum_{i \\in e} exp(\\frac{x_i}{\\gamma})+ln\\sum_{i \\in e} exp(\\frac{-x_i}{\\gamma}) \\end{pmatrix} \\tag{5}$$ 其中${\\gamma}$是平滑参数,不能随意设置的足够小。 权重平均(WA)在水平轴x方向的线长平滑公式如下: $$W_e(\\mathbf{v}) = \\begin{pmatrix} \\frac{\\sum_{i \\in e} x_iexp(\\frac{x_i}{\\gamma})}{\\sum_{i \\in e} exp(\\frac{x_i}{\\gamma})}-\\frac{\\sum_{i \\in e} x_iexp(-\\frac{x_i}{\\gamma})}{\\sum_{i \\in e} exp(-\\frac{x_i}{\\gamma})} \\end{pmatrix} \\tag{6}$$ ","date":"2023-03-27","objectID":"/posts/research/eplace/:1:3","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"密度惩罚 在实际的布局当中,$|B|$个格子的密度都需要满足限制,我们把这些限制用一个惩罚项$N(\\mathbf{v})$来表示,当惩罚项$N(\\mathbf{v})=0$时所有的密度都满足,其定义如下: $$\\rho_b(\\mathbf{v})\\leq \\rho_t, \\forall b \\in B \\iff N(\\mathbf{v})=0 \\tag 7$$ 用二次惩罚项来表示如下: $$N(\\mathbf{v})=\\sum_{b \\in B }(\\widetilde \\rho_{b}(\\mathbf{v})- \\rho_t)^2 \\tag 8$$ 其中$\\widetilde \\rho_{b}$表示在Naylor et al. 2001中定义的铃状的平滑密度函数,密度惩罚$N(\\mathbf{v})$也用来表示系统的势能。 ","date":"2023-03-27","objectID":"/posts/research/eplace/:1:4","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"非线性布局优化方程 利用惩罚因子$\\lambda$目标函数$f(\\mathbf{v})$的定义: $$\\min_\\mathbf{v} f(\\mathbf{v}) = W(\\mathbf{v})+\\lambda N(\\mathbf{v}) \\tag 9$$ 也可以用拉格郎日乘子法写成下面的形式: $$\\min_\\mathbf{v} f(\\mathbf{v}) = W(\\mathbf{v})+\\sum_{b \\in B}\\lambda_b|\\widetilde \\rho_{b}(\\mathbf{v})- \\rho_t| \\tag{10}$$ 其中$\\lambda_b$表示每个格子b的密度限制参数乘子 ","date":"2023-03-27","objectID":"/posts/research/eplace/:1:5","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"静电系统建模(eDensity) 电势和电场分布由系统中的所有元素决定,在网表中的每个节点(元器件或者宏块)带正电苛的粒子i。粒子的带电量$q_i$表示为节点的面积$A_i$,根据洛仁力量定律(Lorentz force law)定义的电力$F_i=q_i \\xi_i$,会引起可移动的节点i的运动,$\\xi_i$表示节点i的布局电场。同样的$N_i=q_i \\psi_i$表示节点的势能,$\\psi_i$表示器件i的电势大小。根据库仑定律,器件i的电场和电势是系统中剩余器件共同作用的叠加。 整个布局的电苛密度分布表示为$\\rho(x,y)$,$\\xi_x(x,y)$表示水平电场的分布函数,表示$\\psi(x,y)$电势分布函数。 ","date":"2023-03-27","objectID":"/posts/research/eplace/:2:0","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"静电平衡系统建模 布局系统和静电系统的建模图: 根据建模规则,把均匀分布的全局布局约束同静电平衡的系统状态联系起来,电力会指引电苛(元器件)向着平衡状态的方向移动。根据高斯法则,电场等于电势的负梯度,如下定义: $$\\xi(x,y)=(\\xi_x,\\xi_y)=-\\nabla\\psi(x,y)= \\begin{pmatrix} -\\frac{\\partial \\psi(x,y)}{\\partial x},-\\frac{\\partial \\psi(x,y)}{\\partial y} \\end{pmatrix} \\tag{11}$$ 电苛的密度函数等于电场函数的散度 $$\\rho(x,y)=\\nabla \\cdot \\xi(x,y)=-\\nabla \\cdot \\nabla\\psi(x,y)=- \\begin{pmatrix} \\frac{\\partial ^2\\psi(x,y)}{\\partial x^2}+\\frac{\\partial ^2\\psi(x,y)}{\\partial y^2} \\end{pmatrix} \\tag{12}$$ 静电系统如果只有正电苛那么只会产生排斥力,相应的静电平衡状态会把所有的器件沿着边界进行分布,因为在边界上可以违反布局约束。因此需要从密度分布当中移除直流组件(即0频率组件)去产生负电苛,从而整个布局区域的密度函数整体变为0。 具体一点说,因为密度函数把所有的对象转化成了正电苛,因此就产生了一个正电苛密度分布。然后就是当直流电移除后,需要填充的区域的电量会比原来有直流电的时候的电量更小,因此就变成了负电苛。同时过于填充的区域依然是正电苛(但是电量比原来小了)。正电苛多的地方会向着负电苛区域移动,相互中和,从而达到一个静电平衡的状态。使得整个系统在布局区域内达到电苛密度为0并且电势也降到0。 这样就把布局的密度惩罚和梯度建模为了势能和电场。‘ ","date":"2023-03-27","objectID":"/posts/research/eplace/:2:1","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"密度惩罚和梯度 势能的总和等于新的元器件集合$V^{’}$中所有带电元素的势能之和,这些元素包含了来自$V$中的可移动节点、固定宏节点,也包含了下一步要讨论的填充节点和暗节点。 填充节点插入 上图中的黑色长方形表示宏元器件,红点表示标准元器件,蓝点表示填充节点,随着填充节点充斥在空白区域,有了更小的总线长,同时器件也挤压在了一起,相互离的更近。 $A_m$表示可移动节点的总面积,$A_{ws}$表示空白空间的总面积。如果目标密度是$\\rho_t \\geq \\frac{A_m}{A_{ws}}$,均匀密度分布会过度的把器件平铺,引起了不必要的线长增加。填充节点(filler cell)都是等尺寸(距形)的,可以移动和并且是断连(0引脚)。$A_{fc}$表示填充节点的总面积,定义如下: $$A_{fc} = \\rho_tA_{ws}-A_m \\tag{13}$$ 每个填充节点$i$的面积是$A_i$,这个是由可移动器件的面积分布所决定的。每个填充节点的尺寸是可移动器件的中间80%的平均尺寸。填充节点的插入会增加额外的密度力,这会使得元器件和他的连接器件之间的距离更小,同时也会满足密度约束。全局布局结束以后,所有的填充节点都会删除。 ","date":"2023-03-27","objectID":"/posts/research/eplace/:2:2","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"暗节点插入 用一个均匀的网格$R(m\\times m)$铺在所有的布局区域上,$R$里面不属于任何布局区域的所有空间都会被划分成一个包含很多长方形格子的集合,每一个格子就是一个暗节点, 对于暗节点的处理方式和固定器件的处理方式一致。$V_d$表示所有的暗节点集合,$A_d$表示所有的节点的总面积。当可移动节点到达布局的边界上时,可移动节点会因为受到暗节点的排斥力而停止。 ","date":"2023-03-27","objectID":"/posts/research/eplace/:2:3","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"密度缩放 填充节点插入后,目标密度就变成了$\\rho_t = \\frac{A_m+A_{fc}}{A_{ws}}$。为了去维持全局等效的密度分布,每一个固定节点或者暗节点$i$的面积$A_i$都需要通过$\\rho_t$进行缩放,否则密度力会变得比填充物的密度力更大,并把器件排斥开,固定结点周围的空白区域会被置空,也会增加下图所示的线长开销。 上图中(a)和(b)在没有密度缩放的情况下,在大组件上网格的密度会高于目标密度,从而密度力会把器件从大组件周围推开,从而引起了宏组件周围更多待填充的空白区域和线长开销。 ","date":"2023-03-27","objectID":"/posts/research/eplace/:2:4","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"势能计算 $V^{’}=V_m \\bigcup V_f \\bigcup V_{fc} \\bigcup V_d$表示系统中所有元素的集合,对于每一个节点$i \\in V^{’}$,$\\rho_i$、$\\xi_i$和$\\psi_i$分别表示该节点的电密度、电场和电势。给定一个可移动器件集合$V_m$和填充节点集合$V_{fc}$的布局方案$\\mathbf{v}$,其总的势能如下表示: $$N(\\mathbf{v})=\\frac{1}{2}\\sum_{i \\in V^{’} }N_i=\\frac{1}{2}\\sum_{i \\in V^{’} }q_i\\psi_i \\tag{14}$$ 因为系统的势能会等于所有的电苛的相互作用之和,所以每个单节点需要乘以$\\frac{1}{2}$,把重多网格密度约束问题转化成了一个0势能系统的单一势能约束$N(\\mathbf{v})=0$。通过引入惩罚因子$\\lambda$,一个不受约束的优化问题如下: $$\\min_\\mathbf{v} f = W(\\mathbf{v})+\\lambda N(\\mathbf{v}) \\tag{15}$$ 其中$W(\\mathbf{v})$是来自方程6,$f(\\mathbf{v})$表示的是最小化的代价函数。因为$W(\\mathbf{v})$和$N(\\mathbf{v})$都是平滑的,我们可以通过求微分得到如下的梯度向量$\\nabla f(\\mathbf{v})$: $$\\nabla f(\\mathbf{v}) = \\nabla W(\\mathbf{v})+\\lambda\\nabla N(\\mathbf{v})= \\begin{pmatrix} \\frac{\\partial W}{\\partial x_1},\\frac{\\partial W}{\\partial y_1},\\cdots \\end{pmatrix}^T - \\lambda(q_1{\\xi_1}_x,q_1{\\xi_1}_y,\\cdots)^T \\tag{16}$$ ","date":"2023-03-27","objectID":"/posts/research/eplace/:2:5","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"泊松方程和数值计算 根据在3里面定义的eDensity(电密度)公式,使用泊松方程去解决带电势和电场的电苛密度问题。诺伊曼边界条件(the Neumann boundary condition)是用来去合法化全局布局方案。泊松方程是可以数值求解的,其用到了谱方法,有着高精确度并且简单。因此,我们提出该技术在离散网格上局部平滑化电密度。 ","date":"2023-03-27","objectID":"/posts/research/eplace/:3:0","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"明确定义的泊松方程 根据高斯准则,电势分布$\\psi(x,y)$可以借助泊松方程使用电密度函数$\\rho(x,y)$来求解,方程如下所示: $$\\nabla \\cdot \\nabla\\psi(x,y)=-\\rho(x,y),(x,y) \\in R\\tag{17}$$ 令$\\mathbf{\\hat n}$是布局区域的外法向量,$\\partial R$是边界。当器件向布局区域的边界上移动时,为了阻止元器件向边界外移动,会停止或者减慢器件的继续向外运动。当器件到达密度函数值域的边界时电密度力会减少到0。因此借助诺伊曼边界条件,边界上就需要定义一个0梯度。 $$\\mathbf{\\hat n} \\cdot \\nabla\\psi(x,y)=0,(x,y) \\in \\partial R\\tag{18}$$ 此外,在整个布局区域R上电势函数$\\psi(x,y)$和密度函数$\\rho(x,y)$的积分都需要为0,如下所示 $$\\iint_{R} \\rho(x,y)=\\iint_R\\psi(x,y)=0\\tag{19}$$ 因此,所有来自电场和电势密度的不定积分所引入的常量因子都是0。方程19也保证了方程17中的偏微分方程有唯一解。克服了定义了在Eisenmann and Johannes [1998]中因定义不清晰的偏微分方程所引起的问题。 基于先前的定义和讨论,整个泊松方程的构建如下: $$\\begin{cases} \\nabla \\cdot \\nabla\\psi(x,y)=-\\rho(x,y) \\ \\mathbf{\\hat n} \\cdot \\nabla\\psi(x,y)=0,(x,y) \\in \\partial R \\ \\iint_{R} \\rho(x,y)=\\iint_R\\psi(x,y)=0 \\ \\end{cases} \\tag{20}$$ 不同于以往的基于偏微分方程的布局方法,该论文是基于一个完整的系统模型。密度惩罚是被正式的定义为系统势能。泊松方程是用来去求解电场,它和电量一起共同作用决定了密度梯度,该梯度遵从洛仁力量定律。通过设置电势的积分为0,该偏微分方程的唯一解得到了保证。计算简单且没有额外的线性项。 ","date":"2023-03-27","objectID":"/posts/research/eplace/:3:1","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"使用谱方法快速数值求解法 谱方法表示的是把某些偏微分求解看成是基函数(例如是正余弦波)的总和,并且在求和的时候选择系数去满足偏微分方程的边界条件。正弦函数是一个奇函数,同时也是一个周期函数。在每一个周期的边界上,函数值为0,这就很自然的满足了伊曼边界条件。因此我们使用正弦函数作为基函数去表示电场。 因为电密度和电势分别是电场的导数和积分,我们使用余弦函数作为基函数去表示电密度和电势。 基于这样一种在频域中的分解,使用谱方法可以求解泊松方程。通过使用离散余弦变换(DCT, discrete cosine transformation),把原始的密度函数$\\rho(x,y)$修改成一个奇且周期的函数形式$\\rho _{DCT}(x,y)$。所以新的函数可以分解成一组不同频率上的余弦波振荡,且可以通过DCT来构建。电场函数和电势函数则可以用相似的方法用离散正弦变换(DST)来构建。 对于密度函数具体的修改方式如下: 假定布局区域R被均匀的划分成一个个$m\\times m$的的小格子,因此密度口中函数$\\rho(x,y)$的定义域为$[0,m-1]\\times[0,m-1]$,把密度波映射到负半边则函数的定义域扩展到品了$[-m,m-1]\\times[-m,m-1]$,则密度函数变成了偶函数。然后周期是性的把函数的定义域扩展到$[-\\infty,+\\infty]\\times[-\\infty,+\\infty]$,基于上述的这两个修改,新的密度函数$\\rho_{DCT}(x,y)$可以使用DCT来表示。 假定$u$和$v$是0到m-1的整数下标,频率分量分别定义为$w_u=2\\pi \\frac{u}{m}$和$w_v=2\\pi \\frac{v}{m}$,同时我们使用$a_{u,v}$表示每个DCT基波函数的系数。由定义可知,所有的$m\\times m$系数可以由二维网格上的基波函数乘以密口度函数的积分得到,公式如下所示: $$a_{u,v}= \\frac 1m \\sum_{x=0}^{m-1}\\sum_{y=0}^{m-1}\\rho(x,y)\\cos(w_ux)\\cos(w_vy) \\tag{21}$$ 则所有的先验系数都可以通过快速傅立叶变换一次性求得。使用余弦系数,新的密度函数$\\rho_{DCT}(x,y)$可以通过余弦波的和如下表示: $$\\rho_{DCT}(x,y)= \\sum_{u=0}^{m-1}\\sum_{v=0}^{m-1}a_{u,v}\\cos(w_ux)\\cos(w_vy) \\tag{22}$$ 上述方程可以通过调用FFT库快速求解,基于通过方程17和19和在方程22上的余弦表达式,有了如下的势能函数$\\psi_{DCT}(x,y)$方程: $$\\psi_{DCT}(x,y)= \\sum_{u=0}^{m-1}\\sum_{v=0}^{m-1} \\frac {a_{u,v}}{w_u^2+w_v^2} \\cos(w_ux)\\cos(w_vy) \\tag{23}$$ 根据高斯法则,电场向量是方程11当中势能函数的负梯度,基于方程23定义的势能函数,可以用DCT和DST的形式得到电场的函数表达式$\\xi(x,y)=(\\xi_{X_{DSCT}},\\xi_{Y_{DCST}})$,如下所示: $$\\begin{cases} \\xi_{X_{DSCT}}= \\sum_u\\sum_v \\frac {a_{u,v}w_u}{w_u^2+w_v^2} \\sin(w_ux)\\cos(w_vy) \\ \\xi_{Y_{DCST}}= \\sum_u\\sum_v \\frac {a_{u,v}w_v}{w_u^2+w_v^2} \\cos(w_ux)\\sin(w_vy) \\end{cases} \\tag{24}$$ 其中水平分量$\\xi_{X_{DSCT}}$是由水平电场的正弦波所构建的,x值在周期结束的时候,也就是在到达布局的边界上的时候,其值为0。垂直分量$\\xi_{Y_{DCST}}$同理。这两个分量可以通过FFT库直接求解。 本方法中使用了DCT和DST谱方法去给偏微分方程求解,在这个方法里面密度惩罚建模为系统势能,密度梯度建模为电苛力。 ","date":"2023-03-27","objectID":"/posts/research/eplace/:3:2","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"行为和复杂度分析 下图表示了一个二维平面的离散密度的电场分布,随着迭代的进行密度的分布也会发生变化,电场的分布也会改变,因此电场会动态的指引器件向欠填充区域流动。从下图当中我们也发现到,在布局区域的边界上,电场变为0。这样的行为就满足了边界条件和全局布局的要求。下图当中的灰点是密度分布,红箭头是电场方向。 假定布局区域上总的有$n^{’}$个器件($n^{’}=|V_m|+|V_{fc}|$)和一个$m\\times m$的网格。本方法的总的复杂度主要来自两个方面, 一是密度计算,二是势能和电场的计算。 密度计算。每个迭代中,密度函数是由下面两步完成: (1)遍历B中所有的元素去清空器件密度和器件面积到0 (2)遍历所有的可移动器件和填充器件,对于有重叠的相应网格需要计算每个器件对于相应网格的面积贡献 第一步的时间复杂度是$O(m^2)$,第二步的复杂度是$O(n^{’})$,所以每个迭代产生密度分布的总时间复杂度为$O(m^2+n^{’})$。 势能电场计算。每个迭代会调用四次FFT库去解决方程21、23和24。每个2维的FFT库的复杂度为$O(m^2\\log m^2)=O(2m^2\\log m)=O(m^2\\log m)$,因此总的复杂度为$O(m^2\\log m)$ 一般来说,我们的数值方法每个布局迭代的时间复杂度为$O(n^{’}+m^2 \\log m)$。因为网格的数量规模通常和器件是同一个数级规模(可以确保离散后的准确性),所以有$O(n^{’})=O(m^2)$,并且总的时间复杂度为$O(m^2\\log m)$或$O(n^{’}\\log n^{’})$。填充器件的加入会增加一些计算时间,但是不会改变整体的计算量级。所有的填充器件和标准器件的平均尺寸一样大,如果效率低的话标准器件会被放大到网格的尺寸,使得填充物的总数量不会超过$O(m^2)$。而且因为填充器件的个数规模和可移动器件的规模是一样的,会有$n=O(n^{’})$,因此总的时间复杂度为$O(n\\log n)$,$n$为可移动器件的个数。 ","date":"2023-03-27","objectID":"/posts/research/eplace/:3:3","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"离散网格上的局部平滑 电密度的全局平滑可以通过方程11和方程12得到。因为每个单元网格的大小通常会比器件的尺寸要大,所以单元网格内部的局部运动是不能在密度函数上反应出来的,从而使平滑性变差。因此我们提出了一种局部平滑技术使得方程14中的密度函数可以反应出每个单元网格内部的任何细微的运动。如下图表示的是一个一维的例子,其中$w_i$表示的是器件的宽度,$w_b$表示的是单元格的宽度;然后,$c_i$表示的是器件中心的坐标,$c_b$单元格中心的坐标。 $l_x(i,b)$表示的是原始的器件和单元格在水平方向上的重叠,$\\hat l_x(i,b)$表示的是平滑后的水平方向上的重叠。则有如下: $$\\hat l_x(i,b)=\\begin{cases} (1.0-\\frac {c_i-c_b}{w_b})\\times w_i:c_i \\in [c_b-w_b,c_b+w_b]\\ 0:c_i \\in [-\\infty,c_b-w_b]\\cup[c_b+w_b,+\\infty] \\end{cases} \\tag{25}$$ 随着器件向右移动,器件对单元格$b’$的密度贡献线性减少,对单元格$b’’$贡献线性增加。当器件在两个单元格坐标$c_{b’}$和$c_{b’’}$的中间的时候,也就是$c_i$在$[c_{b’},c_{b’’}]$上的时候,器件$i$对于两个单元格的总贡献是不变的,且贡献为$w_i$。这种平滑的效果是等价于器件的拉伸和器件密度降低的组合,保持了目标代价函数的可解析。对于每一个器件$i$,局部平滑化进行如下操作: 如果$w_i\u003c w_b$,把器件的宽度从$w_i$拉长到$w_b$,并且把器件密度从1.0减少到$w_i/w_b$ 如果$w_i\\ge w_b$,保持原来的细胞宽度和密度 这种平滑技术在不同的粒度和器件尺寸上都是一样的,在每个迭代更新密度图的时候都会用到这种平滑技术。因为对于每个器件来说只有有限个邻近的单元格会被该器件影响到,所以其时间复杂度是恒定不变的,因此计算复杂度并未发生变化。 ","date":"2023-03-27","objectID":"/posts/research/eplace/:3:4","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"非线性优化 布局问题是NP完全问题。如方程9中所示,目标函数由一个凸线长函数和一个非凸密度函数组成,非凸函数加大了现代凸规划方法求解的难度。本部分先介绍先前非线性布局当中使用到的共轭梯度方法,讨论线搜索的效率瓶颈。这篇论文是首次在全局布局优化中使用Nesterov’s方法和Lipschitz常数预测。 ","date":"2023-03-27","objectID":"/posts/research/eplace/:4:0","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"共轭梯度法 下图为第k个迭代的时候的算法,其中第4行是线搜索算法,存在较多的问题。 ","date":"2023-03-27","objectID":"/posts/research/eplace/:4:1","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"使用Lipschitz常数预测的Nesterov’s方法 和CG法类似,但是Nesterov法只需要一阶导数和线性的内存开销。Nesterov法旨在解决Hilbert空间$H$里的凸规划问题。和大多数和凸规划方法不同,Nesterov法构建了一个不松弛的最小化的点序列${\\mathbf{u}_k}_0^\\infty$。算法2如下所示,表示了第k次迭代的处理算法,这次迭代主要聚焦在$\\min{f(\\mathbf{u})|\\mathbf{u} \\in H}$这个问题上,该问题有非空的最小值集合$U^*$。算法2如下所示: 上述算法中,$\\mathbf{u}$是凸规划问题的解,$\\mathbf{v}$是用来计算步长的参考解,$a$是优化参数,$\\alpha$是步长。迭代开始时($k=0$),该方法会初始化$\\mathbf{v}_0 \\in H,a_0=1,\\alpha_0=\\frac{||\\nabla f(\\mathbf{v}_0)-\\nabla f(\\mathbf{z})||}{||\\mathbf{v}_0-\\mathbf{z}||}$。其中$\\mathbf{z}$是$H$中的任意一个点且$\\mathbf{z}\\neq\\mathbf{v}_0$。Nesterov法的收敛率是$O(1/k^2)$,上述算法的第2行主要就是加速收敛,如果要达到预期的收敛率,则步长$\\alpha_k$在每一个迭代中都要满足下列方程: $$f(\\mathbf v_k)-f(\\mathbf v_k-\\alpha_k\\nabla f(\\mathbf v_k))\\geq0.5\\alpha_k||\\nabla f(\\mathbf v_k)||^2 \\tag{26}$$ Nesterov法的上界错误率方程27所示。 定理 5.1。假定$f(\\mathbf u)$是一个在$C^{1,1}(H)$和$U^* \\neq \\varnothing$上的凸函数,其中$C^{1,1}(H)$表示梯度函数$\\nabla f(\\mathbf u)$是Lipschitz连续的。现有$\\mathbf u\\in U^*$,并且$L$是梯度函数$\\nabla f(\\mathbf u)$的Lipschitz常数。则由上述算法2输出的$\\mathbf{u}_k$会存在以下公式: $$f(\\mathbf u_k)-f(\\mathbf u^*) \\geq \\frac{4L||\\mathbf v_0-\\mathbf u^*||^2}{(k+2)^2} \\tag{27}$$ 定义 5.2。给定一个函数$f \\in C^{1,1}(H)$,并且$L$是梯度函数$\\nabla f(\\mathbf u)$的Lipschitz常数,则对于任意的$\\mathbf u,\\mathbf v \\in H$有 $$||\\nabla f(\\mathbf u)-\\nabla f(\\mathbf v)||\\leq L||\\mathbf v-\\mathbf u||, \\tag{28}$$ 并且$\\nabla f(\\mathbf u)$是Lipschitz连续的。因为Nesterov法使用了二分查找法去计算最大步长所以,在每一个迭代中目标函数都需要评估$O(\\log L)$次,则时间复杂度增加到了$O(n\\log n\\log L)$。相反,我们使用步长预测去加速我们的布局算法。正如在论文Nesterov [1983]中讨论的,如果梯度函数的Lipschitz常数已知,我们可以设置步长为Lipschitz常数的倒数去满足方程26,不会引起任何开销。但是预测准确全局布局梯度函数的Lipschitz常数往往会比较困难,因为有如下原因: 因为密度函数的加入,使得目标函数非凸,因此定理5.1不满足。 因为要动态的调整平滑系数(方程6),线长函数会随着迭代而改变。 因为要在运行的时候做力平衡,所以在密度函数上方程15中的惩罚因子$\\lambda$会随着迭代而变化。 因为上述特性,全局布局函数是非凸且动态变化的,所以需要一个随着迭代去动态估计Lipschitz常数为$\\widetilde L$。基于方程28,分别设定函数$\\mathbf x$和$\\mathbf y$的值为当前参考值$\\mathbf y_k$和上一次迭代的参考值$\\mathbf y_{k-1}$,则$\\nabla f(\\mathbf y_k)$Lipschitz常数可以用如下公式逼近: $$\\widetilde L_k = \\frac {||\\nabla f(\\mathbf y_k)-\\nabla f(\\mathbf y_{k-1})||} {||\\mathbf y_k-\\mathbf y_{k-1}||} \\tag{29}$$ 则根据上述讨论可以知道步长为: $$\\alpha_k=\\frac{1}{\\widetilde L_k}$$ 上述的方法是高效的,因为: (1)都是已知的,没有额外的计算。 (2)相比较于随机的选择$\\mathbf x$和$\\mathbf y$,前后迭代的$\\mathbf y_k$和$\\mathbf y_{k-1}$的值比较接近,则$||\\mathbf y_k-\\mathbf y_{k-1}||$值相对较小,可以防止对Lipschitz常数的估计精度过低,并且防止过度估计步长$\\alpha_k$。 在实验当中也证实了,这种估计法有效的加速了计算过程。 ","date":"2023-03-27","objectID":"/posts/research/eplace/:4:2","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"预处理 预处理减少了问题的条件数,使得原本的问题更加适合数值求解法求解。传统的预处理方法是计算并且反转目标函数$f$的海森矩阵$H_f$。因为密度函数是非凸的所以在非线性布局上还没人使用预处理。预处理梯度向量$\\nabla f_{pre}=H^{-1}\\nabla f$可以平滑化数值优化,加速函数的收敛。 因为全局布局的目标函数是高度非线性并随迭代变化,再者问题的规模往往是百万级别,这就使得每次迭代的时候计算海深矩阵的代价就太高了,且不实际。为了可以在实际中计算海森矩阵,我们使用只使用海森矩阵对角项的雅格比预处理来近似求解,如下所示: $$\\mathbf H_{\\mathbf f_{\\mathbf x,\\mathbf x}}= \\begin{Bmatrix} \\frac {\\partial^2 f} {\\partial x^2_1} \u0026 \\frac {\\partial^2 f} {\\partial x_1\\partial x_2} \u0026\\cdots \u0026\\frac {\\partial^2 f} {\\partial x_1\\partial x_n} \\\\ \\frac {\\partial^2 f} {\\partial x_2\\partial x_1} \u0026 \\frac {\\partial^2 f} {\\partial x^2_2} \u0026\\cdots \u0026\\frac {\\partial^2 f} {\\partial x_2\\partial x_n} \\\\ \\vdots \u0026 \\vdots \u0026\\ddots \u0026\\vdots\\\\ \\frac {\\partial^2 f} {\\partial x_n\\partial x_1} \u0026 \\frac {\\partial^2 f} {\\partial x_n\\partial x_2} \u0026\\cdots \u0026\\frac {\\partial^2 f} {\\partial x^2_n} \\\\ \\end{Bmatrix} \\approx\\begin{Bmatrix} \\frac {\\partial^2 f} {\\partial x^2_1} \u0026 0 \u0026\\cdots \u00260 \\\\ 0 \u0026 \\frac {\\partial^2 f} {\\partial x^2_2} \u0026\\cdots \u00260 \\\\ \\vdots \u0026 \\vdots \u0026\\ddots \u0026\\vdots \\\\ 0 \u0026 0 \u0026\\cdots \u0026\\frac {\\partial^2 f} {\\partial x^2_n} \\\\ \\end{Bmatrix}=\\widetilde H_{\\mathbf f_{\\mathbf x,\\mathbf x}}\\tag{30}$$ 根据上述近似,同理可以计算$\\mathbf H_{\\mathbf f_{\\mathbf y,\\mathbf y}}$,因此可以计算出$\\mathbf H_{\\mathbf f}$。通过方程15则有$\\frac {\\partial^2 f(\\mathbf v)} {\\partial x^2_i}=\\frac {\\partial^2 W(\\mathbf v)} {\\partial x^2_i}+\\lambda\\frac {\\partial^2 N(\\mathbf v)} {\\partial x^2_i}$,我们可以精准的估计出$\\frac {\\partial^2 W(\\mathbf v)} {\\partial x^2_i}和\\frac {\\partial^2 N(\\mathbf v)} {\\partial x^2_i}$的值,保证预处理的可行性。方程6中对线长函数微分的代价会比较高,所以我们使用器件$i$的顶点度来计算,如下: $$\\frac {\\partial^2 W(\\mathbf v)} {\\partial x^2_i}=\\sum_{e\\in E_i}\\frac {\\partial^2 W_e(\\mathbf v)} {\\partial x^2_i}\\implies |E_i|,\\tag{31}$$ 其中$E_i$表示和器件i相关的网表子集。方程14中所表示的密度函数是非凸的,就使得传统的预处理方法不能够得到预期的性能。方程32使用了二阶微分: $$\\frac {\\partial^2 N(\\mathbf v)} {\\partial x^2_i}=q_i\\frac {\\partial^2 \\psi(\\mathbf v)} {\\partial x^2_i}=q_i\\frac {-\\partial \\xi_{i_x}(\\mathbf v)} {\\partial x_i}= q_i。\\tag{32}$$ 所以使用线性项$q_i$作为密度预处理,使用上述的近似来表示$\\widetilde H_{\\mathbf f_{\\mathbf x,\\mathbf x}}$会有如下方程: $$\\widetilde H_{\\mathbf f_{\\mathbf x,\\mathbf x}}=\\begin{Bmatrix} |E_1|+\\lambda q_1 \u0026 0 \u0026\\cdots \u00260 \\\\ 0 \u0026 |E_2|+\\lambda q_2 \u0026\\cdots \u00260 \\\\ \\vdots \u0026 \\vdots \u0026\\ddots \u0026\\vdots \\\\ 0 \u0026 0 \u0026\\cdots \u0026|E_n|+\\lambda q_n \\\\ \\end{Bmatrix} \\tag{33}$$ 因此可以计算出预处理的梯度为$\\nabla f_{pre}=\\widetilde {\\mathbf H}_{\\mathbf f}^{-1}\\nabla f$ ","date":"2023-03-27","objectID":"/posts/research/eplace/:4:3","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"全局布局算法 如下图8所示表示的是,ePlace的整个布局流程: 其中分为三个阶段: (1)初始布局 :使用B2B网络模型最小化二次项线长函数,得到初始布局的输出结果$\\mathbf v_{ip}$。 (2)全局布局:根据电势理论优化器件的位置 (3)细节布局:全局布局完成后,移除所有的填充器件,并使用FastDP进行合法化和离散优化。 从上面的讨论中我们知道,CG法和Nesterov法都是用来解决方程15中不受限的优化问题,为了去改善优化结果和收敛率,我们使用了一种自适应参数调整法。 ","date":"2023-03-27","objectID":"/posts/research/eplace/:5:0","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"自适应参数调整法 网格的尺寸 在整个全局布局阶段,网格的大小都是固定的。这是在粒度和效率之间的平衡。越大的尺寸往往代表的是高效低准确率,越小的尺寸则相反。比较大的尺寸也会带来一些额外的问题,更多的器件会有相同的密度力。这些器件糅合在一起,有相同的运动轨迹,也就是说这些器件会在相邻区域间发生密度震荡,阻止器件的扩散。 这篇论文中风格的尺寸大小是基于器件和填充器件的个数来计算,把网格的尺寸设定为$m=\\min(\\lceil \\log_2\\sqrt{n{’}} \\rceil, 1024)$,设定最大为1024的原因是出于效率考虑。 步长 在Nesterov法中根据方程29可以估计出步长为Lipschitz常数估计的倒数,即$\\alpha_k=\\frac{1}{\\widetilde L_k}$。在CG法中,步长由线搜索来决定的,在搜索间隔中,沿着共轭梯度的方向线搜索会找到局部最优,搜索的间隔$\\alpha_k^{\\max}$是动态的调整的。初始的间隔$\\alpha_0^{\\max}$和单元格的大小成线性关系$\\alpha_0^{\\max}=kw_b$,其中$w_b$是单元格宽度。实际设置$k=0.044$可以得到较好的布局质量,并且$\\alpha_k^{\\max}$需要基于当前最优步长$\\alpha_{k-1}$进行更新,如下所示: $$\\alpha_k^{\\max}=\\max(\\alpha_0^{\\max},2\\alpha_{k-1}),\\alpha_k^{\\min}=0.01\\alpha_k^{\\max} \\tag{34}$$ 通过方程34,如算法1的第4行所示,GSS可以计算出第k次迭代的步长$\\alpha_k$。线搜索会在间隔缩小到$\\alpha_k^{\\min}$时停止,所以得到的步长$\\alpha_k$不一定是局部最优。 惩罚因子 为了去平衡密度和线长的力,在方程35中设定惩罚因子的初始值为: $$\\lambda_0=\\frac {\\sum_{i \\in V_m^{’}}\\mid W_{x_i} \\mid+\\mid W_{y_i} \\mid} {\\sum_{i \\in V_m^{’}}q_i(\\mid \\xi_{x_i} \\mid+\\mid \\xi_{y_i} \\mid)} \\tag{35}$$ 其中$W_{x_i}=\\frac{\\partial W}{\\partial x_i},W_{y_i}=\\frac{\\partial W}{\\partial y_i}$,$\\xi_{x_i}$是节点i的水平电场,$\\xi_{y_i}$是节点i的垂直电场。 因为线长和密度都是随着迭代变化的,为了去适应这种实时的变化,惩罚因子也需要时间更新,我们通过如下的式子去更新因子: $$\\lambda_k=u_k\\lambda_{k-1}$$ 令$\\Delta HPWL_k=HPWL(\\mathbf v_k)-HPWL(\\mathbf v_{k-1})$,则$u_k$的定义如下: $$u_k=u_{0}^{-\\frac{\\Delta HPWL_k}{\\Delta HPWL_{ref}}+1.0}(u_0=1.1,\\Delta HPWL_{ref}=3.5\\times10^5) \\tag{36}$$ 如下图所示,不管是在CG法和Nesterov法上,随着迭代的进行因子的值在增加。 密度溢出 全局布局当重叠足够小的时候会结束,接下来就是要处理合法化和细节布局了。使用如下的密度溢出值$\\tau$,公式如下: $$\\tau=\\frac {\\sum_{b \\in B}\\max(\\rho_b^{’}-\\rho_t,0) A_{b}} {\\sum_{i \\in V_m}A_i} \\tag{37}$$ 其中,$A_{b}$是单元格面积,$A_{i}$是可移动器件面积。$\\rho_b^{’}$是只和可移动器件相关的单元格$b$的密度。当密度溢出的值$\\tau\\leq\\tau_{min}$时,全局布局停止。 线长系数 实验中显示,收敛结果和布局结果对于平滑参数$\\gamma$的变化比较敏感。为了在全局上让更多的的器件逃离高密度区域,本论文中的方法在迭代早期放松平滑参数。在后期阶段,当局部调整占主导的时候,参数值变小使得平滑的线长接近HPWL。 同时较小尺寸的单元格密度对于器件的运动会更加敏感,相反越的尺寸就越不敏感。因此设置平滑参数$\\gamma$为密度溢出和单元格宽度的函数。通过减少平滑参数的值,为了去减少剩余的重叠,只需要允许可以局部移动的HPWL不敏感的器件运动。我们所提到的这些HPWL不敏感的器件,指的是它们的运动不会改变器件相关网表的HPWL值,也可以理解成这些器件离网表的边界相对而言比较远。对于 迭代的后期,为了使得线长平滑的收敛,只允许在布局平面上有较小的扰动。所以,因为我们的目的是增加线长建模的准确性,对应的线长力会变得更强去只允许有小规模的运动,也就是较小的平面扰动。如下图所示,最终平滑的HPWL收敛到了HPWL: 在本论文的实验中显示,如下公式建模平滑系数会有比较好的布局结果,公式如下: $$\\gamma(\\tau)=8.0w_b\\times10^{k\\tau+b} \\tag{38}$$ 密度溢出通过在开始为100%,结束的时候为10%(终止条件),根据经验调整有$\\gamma(\\tau=1.0)=80w_b$,有$\\gamma(\\tau=0.1)=0.8w_b$,则可以计算出$k=\\frac{20}{9},b=-\\frac{11}{9}$。 ","date":"2023-03-27","objectID":"/posts/research/eplace/:5:1","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"全局布局 下图为ePlace全局布局算法的整体流程: 对算法的详细解释如下: 输入参数: $\\mathbf v_0=\\mathbf v_{ip}$表示的是初始布局中的输出结果,标准器件是放置在区域中间,填充器件是随机的分布在整个布局区域$R$上。 $m\\times m$网格拆分规模 最小的密度溢出$\\tau^{\\min}$ 最大的迭代次数为3000 第1行把布局区域R拆分成$m\\times m$的网格 第2行初始化密度惩罚因子 第3行初始化最大间隔(这个在调用CG算法的时候会用到,如果是Nesterov法的话不会用到) 第5行定义了目标函数$f_k$ 第6行计算线长梯度和密度分布 第7行使用FFT库去计算场和势能 第8行计算密度梯度 第9行计算目标函数的总梯度 第10行调用非线性方法(Nesterov法或者CG法)求解新的布局结果 第11行更新非线性方法需要的参数 第12行去判定是不是满足终止条件 最后返回全局布局的结果。 随着迭代的运行,标准器件会从过填充的区域分散到待填充的区域,密度力会把无连接的填充器件推向布局的边界。最后所有的标准器件会收敛到一个稳定状态,此时系统和势能和线长处于可以接受的状态。 ","date":"2023-03-27","objectID":"/posts/research/eplace/:5:2","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["索引"],"content":"教程 Hugo博客官方教程 Markdown 官方教程 ","date":"2022-12-10","objectID":"/posts/misc/collection/:1:0","tags":["收藏","传送门"],"title":"好物收藏","uri":"/posts/misc/collection/"},{"categories":["索引"],"content":"工具 图片上传 | PicX 图床神器 (xpoet.cn) ","date":"2022-12-10","objectID":"/posts/misc/collection/:2:0","tags":["收藏","传送门"],"title":"好物收藏","uri":"/posts/misc/collection/"},{"categories":["建站"],"content":" 本人原来使用的博客是vuepress + vdoing,后来在使用的过程中发现这个博客非常的笨重,没有多少的文章编译下来就需要一会时间。 以前使用过wordpress,这个用来建站是很不错的选择用来做博客的话需要有自己的服务器,并且对于Markdown文档的支持不是很好,现在的博客基本上是使用markdown来写,所以不考虑wordpress。 然后了解到Hugo的出现,看了他的优势,打包速度快,几乎不受文件多少的影响。为了更好专注在写文章,同时可以不用每次繁琐的命令行操作和发布,本教程实现了快捷键操作的一键发布。 文章内容所见即所得。写完文章后快捷键 Crtl + U快速发布文章,然后等待GitHub Action部署完成,刷新页面就可以看到新文章,如下为展示的效果: 快速开始 现在已经把整套流程打通了,直接参考下面的步骤,可以实现Obsidian写博客+自动发布和部署。 下载(Obsidian)并安装 下载安装Git-Bash 配置Git - 生成 SSH 公钥 (git-scm.com) 创建github新项目为:你的用户名.github.io,如SivanLaai.github.io,其中SivanLaai为我的用户名 克隆本项目并切换分支 git clone --recursive git@github.com:SivanLaai/blog.git 进入blog目录,修改git远程仓库为你的github静态博客项目地址 git remote set-url origin git@github.com:SivanLaai/SivanLaai.github.io.git (可选) - 添加Github项目环境变量WEB_SITE为你自己的域名如```www.sivanlaai.laais.cn 利用obsidian打开blog文件夹,开始写博客 快捷键 Crtl + U快速发布文章(利用Obsidian Shell Command插件实现快速发布) 打开你的网址,如sivanlaai.github.io 其他玩法 ","date":"2022-12-09","objectID":"/posts/technology/auto_deploy_with_obsidian/:0:0","tags":["博客搭建","自动部署","hugo"],"title":"Obsidian写hugo博客,github自动部署","uri":"/posts/technology/auto_deploy_with_obsidian/"},{"categories":["建站"],"content":"评论功能(可选) **建议新手根据自己的时间来衡量是否加入,不然折腾起来也挺费劲,容易遇到这种问题。确实有时间的可以尝试 本教程中使用的hugo主题是Loveit,同时加入了评论功能,使用的是Waline评论系统,比较推荐使用这个评论系统,支持自建后端也可以使用免费的后端云服务,有评论管理功能,安全,支持登录和匿名模式,爆吹。 对于Waline的详细使用请看官方教程,根据官方教程配置好Waline后端好,在config.yml里面如下: waline: serverUrl: \"WALINE_SERVER_URL\" 把WALINE_SERVER_URL替换成你的Waline服务地址就可以。 ","date":"2022-12-09","objectID":"/posts/technology/auto_deploy_with_obsidian/:1:0","tags":["博客搭建","自动部署","hugo"],"title":"Obsidian写hugo博客,github自动部署","uri":"/posts/technology/auto_deploy_with_obsidian/"},{"categories":["建站"],"content":"站点统计 针对原版的不算子的统计功能,感觉有点鸡肋,可以尝试加入了其他的站点统计功能 umami(开源比较推荐) 百度统计——一站式智能数据分析与应用平台 (baidu.com) ","date":"2022-12-09","objectID":"/posts/technology/auto_deploy_with_obsidian/:2:0","tags":["博客搭建","自动部署","hugo"],"title":"Obsidian写hugo博客,github自动部署","uri":"/posts/technology/auto_deploy_with_obsidian/"},{"categories":["建站"],"content":"自有主机,docker安装Umami网站统计和Waline评论系统 1.创建文件夹 mkdir website \u0026\u0026 cd website 创建如下文件运行docker-compose up -d version: \"3\" services: db: image: mysql restart: always environment: - MYSQL_ROOT_PASSWORD=PASSWORD - MYSQL_PASSWORD=PASSWORD - MYSQL_DATABASE=umami - MYSQL_USER=user command: --default-authentication-plugin=mysql_native_password --transaction-isolation=READ-COMMITTED --binlog-format=ROW #解决外部无法访问 volumes: - ./conf:/etc/mysql/conf.d - ./data:/var/lib/mysql network_mode: \"host\" unami: image: ghcr.io/umami-software/umami:mysql-latest network_mode: \"host\" environment: DATABASE_URL: mysql://user:PASSWORD@localhost:3306/umami DATABASE_TYPE: mysql HASH_SALT: replace-me-with-a-random-string restart: always waline: container_name: waline image: lizheming/waline:latest restart: always network_mode: \"host\" volumes: - ${PWD}/data:/app/data environment: TZ: 'Asia/Shanghai' MYSQL_HOST: localhost MYSQL_DB: waline MYSQL_USER: user MYSQL_PASSWORD: PASSWORD SITE_NAME: \"SivanLaai's Blog\" SITE_URL: 'http://www.laais.cn' SECURE_DOMAINS: 'www.laais.cn' AUTHOR_EMAIL: 'eamil@163.com' SMTP_PASS: SMTP_PASSWORD SMTP_USER: qqid@qq.com SMTP_SERVICE: QQ 3 初始化waline数据库 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; SET NAMES utf8mb4; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; # Dump of table wl_Comment # ------------------------------------------------------------ CREATE TABLE `wl_Comment` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `user_id` int(11) DEFAULT NULL, `comment` text, `insertedAt` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `ip` varchar(100) DEFAULT '', `link` varchar(255) DEFAULT NULL, `mail` varchar(255) DEFAULT NULL, `nick` varchar(255) DEFAULT NULL, `pid` int(11) DEFAULT NULL, `rid` int(11) DEFAULT NULL, `sticky` boolean DEFAULT NULL, `status` varchar(50) NOT NULL DEFAULT '', `like` int(11) DEFAULT NULL, `ua` text, `url` varchar(255) DEFAULT NULL, `createdAt` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `updatedAt` timestamp NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; # Dump of table wl_Counter # ------------------------------------------------------------ CREATE TABLE `wl_Counter` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `time` int(11) DEFAULT NULL, `reaction0` int(11) DEFAULT NULL, `reaction1` int(11) DEFAULT NULL, `reaction2` int(11) DEFAULT NULL, `reaction3` int(11) DEFAULT NULL, `reaction4` int(11) DEFAULT NULL, `reaction5` int(11) DEFAULT NULL, `reaction6` int(11) DEFAULT NULL, `reaction7` int(11) DEFAULT NULL, `reaction8` int(11) DEFAULT NULL, `url` varchar(255) NOT NULL DEFAULT '', `createdAt` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `updatedAt` timestamp NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; # Dump of table wl_Users # ------------------------------------------------------------ CREATE TABLE `wl_Users` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `display_name` varchar(255) NOT NULL DEFAULT '', `email` varchar(255) NOT NULL DEFAULT '', `password` varchar(255) NOT NULL DEFAULT '', `type` varchar(50) NOT NULL DEFAULT '', `label` varchar(255) DEFAULT NULL, `url` varchar(255) DEFAULT NULL, `avatar` varchar(255) DEFAULT NULL, `github` varchar(255) DEFAULT NULL, `twitter` varchar(255) DEFAULT NULL, `facebook` varchar(255) DEFAULT NULL, `google` varchar(255) DEFAULT NULL, `weibo` varchar(255) DEFAULT NULL, `qq` varchar(255) DEFAULT NULL, `2fa` varchar(32) DEFAULT NULL, `createdAt` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `updatedAt` timestamp NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!401","date":"2022-12-09","objectID":"/posts/technology/auto_deploy_with_obsidian/:2:1","tags":["博客搭建","自动部署","hugo"],"title":"Obsidian写hugo博客,github自动部署","uri":"/posts/technology/auto_deploy_with_obsidian/"},{"categories":["教程"],"content":"nextcloud网盘相关问题 ","date":"2022-07-28","objectID":"/posts/technology/nextcloud/:1:0","tags":["nextcloud","apache","aria2"],"title":"nextcloud配置","uri":"/posts/technology/nextcloud/"},{"categories":["教程"],"content":"网盘配置 (1)配置环境 Linux + Apache2 + Mysql + Php(LAMP) Example installation on Ubuntu 20.04 LTS — Nextcloud latest Administration Manual latest documentation 配置Linux + Nginx + Mysql + Php(LNMP)环境 sudo apt update \u0026\u0026 sudo apt upgrade sudo apt install mariadb-server nginx php-gd php-mysql php-fpm \\ php-curl php-mbstring php-intl php-gmp php-bcmath php-xml php-imagick php-zip (2)安装nextcloud Installation on Linux — Nextcloud latest Administration Manual latest documentation (3)Nginx配置解析php Nginx配置上传大小 # /etc/nginx/nginx.conf http { client_max_body_size 20480M; client_body_buffer_size 10M; } 修改配置 # /etc/nginx/conf.d/nextcloud.conf ## # You should look at the following URL's in order to grasp a solid understanding # of Nginx configuration files in order to fully unleash the power of Nginx. # https://www.nginx.com/resources/wiki/start/ # https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/ # https://wiki.debian.org/Nginx/DirectoryStructure # # In most cases, administrators will remove this file from sites-enabled/ and # leave it as reference inside of sites-available where it will continue to be # updated by the nginx packaging team. # # This file will automatically load configuration files provided by other # applications, such as Drupal or Wordpress. These applications will be made # available underneath a path with that package name, such as /drupal8. # # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples. ## # Default server configuration # upstream php-handler { #server 127.0.0.1:9000; server unix:/run/php/php8.1-fpm.sock; } server { listen 80; listen [::]:80; server_name nextcloud.laais.cn; # Path to the root of your installation root /var/www/nextcloud; # Enable gzip but do not remove ETag headers gzip on; gzip_vary on; gzip_comp_level 4; gzip_min_length 256; gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/wasm application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; # Pagespeed is not supported by Nextcloud, so if your server is built # with the `ngx_pagespeed` module, uncomment this line to disable it. #pagespeed off; # HTTP response headers borrowed from Nextcloud `.htaccess` add_header Referrer-Policy \"no-referrer\" always; add_header X-Content-Type-Options \"nosniff\" always; add_header X-Download-Options \"noopen\" always; add_header X-Frame-Options \"SAMEORIGIN\" always; add_header X-Permitted-Cross-Domain-Policies \"none\" always; add_header X-Robots-Tag \"none\" always; add_header X-XSS-Protection \"1; mode=block\" always; # Remove X-Powered-By, which is an information leak fastcgi_hide_header X-Powered-By; # Specify how to handle directories -- specifying `/index.php$request_uri` # here as the fallback means that Nginx always exhibits the desired behaviour # when a client requests a path that corresponds to a directory that exists # on the server. In particular, if that directory contains an index.php file, # that file is correctly served; if it doesn't, then the request is passed to # the front-end controller. This consistent behaviour means that we don't need # to specify custom rules for certain paths (e.g. images and other assets, # `/updater`, `/ocm-provider`, `/ocs-provider`), and thus # `try_files $uri $uri/ /index.php$request_uri` # always provides the desired behaviour. index index.php index.html /index.php$request_uri; # Rule borrowed from `.htaccess` to handle Microsoft DAV clients location = / { if ( $http_user_agent ~ ^DavClnt ) { return 302 /remote.php/webdav/$is_args$args; } } location = /robots.txt { allow all; log_not_found o","date":"2022-07-28","objectID":"/posts/technology/nextcloud/:1:1","tags":["nextcloud","apache","aria2"],"title":"nextcloud配置","uri":"/posts/technology/nextcloud/"},{"categories":["教程"],"content":"请更改权限为 0770 以避免其他用户查看目录 config.php . 'check_data_directory_permissions' =\u003e false, ... ","date":"2022-07-28","objectID":"/posts/technology/nextcloud/:1:2","tags":["nextcloud","apache","aria2"],"title":"nextcloud配置","uri":"/posts/technology/nextcloud/"},{"categories":["教程"],"content":"安装配置启动aria2 安装aria2 sudo apt install aria2 cd /etc/ \u0026\u0026 mkdir aria2 \u0026\u0026 cd aria2 \u0026\u0026 touch aria2c.conf \u0026\u0026 touch aria2.session 创建配置文件 #aria2c.conf ## 文件保存相关 ## # 文件保存目录 dir=/var/www/nextcloud/data/nextcloud/files/Video # 启用磁盘缓存, 0为禁用缓存, 需1.16以上版本, 默认:16M disk-cache=32M # 断点续传 continue=true # 文件预分配方式, 能有效降低磁盘碎片, 默认:prealloc # 预分配所需时间: none \u003c falloc ? trunc \u003c prealloc # falloc和trunc则需要文件系统和内核支持 # NTFS建议使用falloc, EXT3/4建议trunc, MAC 下需要注释此项 file-allocation=trunc ## 下载连接相关 ## # 最大同时下载任务数, 运行时可修改, 默认:5 #max-concurrent-downloads=10 # 同一服务器连接数, 添加时可指定, 默认:1 # 官方的aria2最高设置为16, 如果需要设置任意数值请重新编译aria2 max-connection-per-server=16 # 整体下载速度限制, 运行时可修改, 默认:0(不限制) #max-overall-download-limit=0 # 单个任务下载速度限制, 默认:0(不限制) #max-download-limit=0 # 整体上传速度限制, 运行时可修改, 默认:0(不限制) #max-overall-upload-limit=0 # 单个任务上传速度限制, 默认:0(不限制) #max-upload-limit=0 # 禁用IPv6, 默认:false # disable-ipv6=true # 最小文件分片大小, 添加时可指定, 取值范围1M -1024M, 默认:20M # 假定size=10M, 文件为20MiB 则使用两个来源下载; 文件为15MiB 则使用一个来源下载 min-split-size=10M # 单个任务最大线程数, 添加时可指定, 默认:5 # 建议同max-connection-per-server设置为相同值 split=16 ## 进度保存相关 ## # 从会话文件中读取下载任务 input-file=/etc/aria2/aria2.session # 在Aria2退出时保存错误的、未完成的下载任务到会话文件 save-session=/etc/aria2/aria2.session # 定时保存会话, 0为退出时才保存, 需1.16.1以上版本, 默认:0 save-session-interval=60 ## RPC相关设置 ## # 启用RPC, 默认:false enable-rpc=true # 允许所有来源, 默认:false rpc-allow-origin-all=true # 允许外部访问, 默认:false rpc-listen-all=true # RPC端口, 仅当默认端口被占用时修改 # rpc-listen-port=6800 # 设置的RPC授权令牌, v1.18.4新增功能, 取代 --rpc-user 和 --rpc-passwd 选项 rpc-secret=passwd #在访问的时候要使用到的密码 # 启动SSL #rpc-secure=true # 证书文件, 如果启用SSL则需要配置证书文件, 例如用https连接aria2 #rpc-certificate=/var/snap/nextcloud/current/certs/live/fullchain.pem #rpc-private-key=/var/snap/nextcloud/current/certs/live/privkey.pem ## BT/PT下载相关 ## # 当下载的是一个种子(以.torrent结尾)时, 自动开始BT任务, 默认:true follow-torrent=true # 客户端伪装, PT需要 peer-id-prefix=-TR2770- user-agent=Transmission/2.77 # 强制保存会话, 即使任务已经完成, 默认:false # 较新的版本开启后会在任务完成后依然保留.aria2文件 #force-save=false # 继续之前的BT任务时, 无需再次校验, 默认:false bt-seed-unverified=true # 保存磁力链接元数据为种子文件(.torrent文件), 默认:false # bt-save-metadata=true # 单个种子最大连接数, 默认:55 0表示不限制 bt-max-peers=0 # 最小做种时间, 单位:分 seed-time = 1 # 分离做种任务 bt-detach-seed-only=true on-download-complete=/home/filesscan.sh 启动aria2 nohup aria2c --conf-path=/etc/aria2/aria2.conf \u003e /home/linux/aria2.log 2\u003e\u00261 \u0026 配置aria2 自动更新bt tracker # startaria.sh while(true) do sudo kill -9 $(ps -ef|grep aria2|gawk '$0 !~/grep/ {print $2}' |tr -s '\\n' ' ') list=`wget -qO- https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_best.txt|awk NF|sed \":a;N;s/\\n/,/g;ta\"` echo $list if [ -z \"`grep \"bt-tracker\" /etc/aria2/aria2.conf`\" ]; then sudo sed -i '$a bt-tracker='${list} /etc/aria2/aria2.conf echo add...... else sudo sed -i \"s@bt-tracker.*@bt-tracker=$list@g\" /etc/aria2/aria2.conf echo update...... fi sudo aria2c --conf-path=/etc/aria2/aria2.conf sleep 24h #sleep 10 done 配置nextcloud启动脚本 # startserver.sh sudo service apache2 stop sudo service apache2 start sudo /etc/init.d/mysql start # 运行aria2脚本更新bt trackers sudo nohup bash startaria.sh \u003e /home/linux/log/aria2.log 2\u003e\u00261 \u0026 # 监控文件变化 while(true) do sudo -u www-data php /var/www/nextcloud/occ files:scan --all sleep 60 done # runserver.sh # 删除aria相关的程序 sudo kill -9 $(ps -ef|grep startserver|gawk '$0 !~/grep/ {print $2}' |tr -s '\\n' ' ') sudo kill -9 $(ps -ef|grep startaria|gawk '$0 !~/grep/ {print $2}' |tr -s '\\n' ' ') sudo kill -9 $(ps -ef|grep aria2|gawk '$0 !~/grep/ {print $2}' |tr -s '\\n' ' ') sudo nohup bash startserver.sh \u003e /home/linux/log/nextcloud.log 2\u003e\u00261 \u0026 配置aria2NG # 下载aria2ng cd /var/www/ wget https://github.com/mayswind/AriaNg/releases/download/1.2.3/AriaNg-1.2.3.zip mkdir ariang unzip AriaNg-1.2.3.zip 配置apache2网页 # 创建/etc/apache2/sites-available/ariang.conf Alias /ariang \"/var/www/ariang/\" \u003cDirectory /var/www/ariang/\"\u003e Require all granted AllowOverride All Options FollowSymLinks MultiViews \u003cIfModule mod_dav.c\u003e Dav off \u003c/IfModule\u003e \u003c/Directory\u003e # 访问http://host.example.com/ariang ","date":"2022-07-28","objectID":"/posts/technology/nextcloud/:1:3","tags":["nextcloud","apache","aria2"],"title":"nextcloud配置","uri":"/posts/technology/nextcloud/"},{"categories":["教程"],"content":"Nextcloud镜像安装 创建文件夹nextcloud mkdir nextcloud 创建文件docker-compose.yml --- version: '2' volumes: nextcloud: db: services: db: image: mariadb restart: always command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW volumes: - db:/var/lib/mysql environment: - MYSQL_ROOT_PASSWORD=root - MYSQL_PASSWORD=passwd - MYSQL_DATABASE=nextcloud - MYSQL_USER=nextcloud app: image: nextcloud restart: always ports: - 8080:80 links: - db volumes: - nextcloud:/var/www/html environment: - MYSQL_PASSWORD=passwd - MYSQL_DATABASE=nextcloud - MYSQL_USER=nextcloud - MYSQL_HOST=db 启动镜像 sudo docker-compose up -d 常见问题 ","date":"2022-07-28","objectID":"/posts/technology/nextcloud/:1:4","tags":["nextcloud","apache","aria2"],"title":"nextcloud配置","uri":"/posts/technology/nextcloud/"},{"categories":["教程"],"content":"apache2解析失败php 重新安装php sudo apt-get purge php8.* sudo apt install php ","date":"2022-07-28","objectID":"/posts/technology/nextcloud/:1:5","tags":["nextcloud","apache","aria2"],"title":"nextcloud配置","uri":"/posts/technology/nextcloud/"},{"categories":["教程"],"content":"apache2提示找不到apache.conf 重新安装apache2 sudo dpkg -P apache2 apt-get remove apache2 apt-get install apache2 ","date":"2022-07-28","objectID":"/posts/technology/nextcloud/:1:6","tags":["nextcloud","apache","aria2"],"title":"nextcloud配置","uri":"/posts/technology/nextcloud/"},{"categories":["问题总结"],"content":"wordpress permainlink 不生效 1.打开apache2默认配置文件 sudo vim /etc/apache2/sites-available/000-default.conf 2.修改内容为如下 LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so \u003cVirtualHost *:80\u003e # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName www.example.com ServerAdmin webmaster@localhost DocumentRoot /var/www/html \u003cDirectory /var/www/html\u003e AllowOverride All Require all granted \u003c/Directory\u003e # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with \"a2disconf\". #Include conf-available/serve-cgi-bin.conf \u003c/VirtualHost\u003e 3.在/wp-admin/options-permalink.php页面选择-\u003ePermalink structure -\u003e Post name保存生成.hatcess ","date":"2022-05-19","objectID":"/posts/technology/wordpress/:1:0","tags":["wordpress"],"title":"wordpress安装和问题","uri":"/posts/technology/wordpress/"},{"categories":["教程"],"content":"软件编译和安装 ","date":"2022-05-19","objectID":"/posts/technology/compile_and_install/:0:0","tags":["软件编译","软件安装"],"title":"软件编译和安装","uri":"/posts/technology/compile_and_install/"},{"categories":["教程"],"content":"qbittorrent编译安装 安装依赖 apt-get install build-essential pkg-config automake libtool git apt-get install libboost-dev libboost-system-dev libboost-chrono-dev libboost-random-dev libssl-dev libgeoip-dev 安装libtorrent git clone https://github.com/arvidn/libtorrent.git #之前系统版本可直接下载源码使用,18.04需修改include/libtorrent/export.hpp替换boost/config/为boost/config/detail/ #https://github.com/arvidn/libtorrent/releases/download/libtorrent-1_0_11/libtorrent-rasterbar-1.0.11.tar.gz cd libtorrent git checkout origin/RC_1_2 ./autotool.sh ./configure CXXFLAGS=-std=c++14 make clean \u0026\u0026 make -j$(nproc) make install 安装qbittorrent apt-get install qtbase5-dev qttools5-dev-tools libqt5svg5-dev zlib1g-dev wget https://github.com/qbittorrent/qBittorrent/archive/release-4.2.5 tar zxvf release-4.1.3.tar.gz cd qBittorrent-release-4.1.3/ ./configure --disable-gui make clean \u0026\u0026 make -j$(nproc) make install ","date":"2022-05-19","objectID":"/posts/technology/compile_and_install/:1:0","tags":["软件编译","软件安装"],"title":"软件编译和安装","uri":"/posts/technology/compile_and_install/"},{"categories":["教程"],"content":"LAMP php7.4安装 Ubuntu 18 安装 apt-get install software-properties-common 添加第三方源 add-apt-repository ppa:ondrej/php apt-get update 安装LAMP环境 sudo apt update sudo apt install apache2 mariadb-server libapache2-mod-php7.4 sudo apt install php7.4-gd php7.4-mysql php7.4-curl php7.4-mbstring php7.4-intl sudo apt install php7.4-gmp php7.4-bcmath php-imagick php7.4-xml php7.4-zip ","date":"2022-05-19","objectID":"/posts/technology/compile_and_install/:2:0","tags":["软件编译","软件安装"],"title":"软件编译和安装","uri":"/posts/technology/compile_and_install/"},{"categories":["教程"],"content":"LAMP php安装 Ubuntu 22 安装 apt-get install software-properties-common 添加第三方源 add-apt-repository ppa:ondrej/php apt-get update 安装LAMP环境 sudo apt update \u0026\u0026 sudo apt upgrade sudo apt install mariadb-server php-gd php-mysql php-fpm \\ php-curl php-mbstring php-intl php-gmp php-bcmath php-xml php-imagick php-zip ","date":"2022-05-19","objectID":"/posts/technology/compile_and_install/:3:0","tags":["软件编译","软件安装"],"title":"软件编译和安装","uri":"/posts/technology/compile_and_install/"},{"categories":["教程"],"content":"Neovim 安装 Ubuntu PPA安装 安装依赖软件 sudo apt-get install software-properties-common ## older ubuntu version sudo apt-get install python-software-properties 安装发布版本neovim sudo add-apt-repository ppa:neovim-ppa/stable sudo apt-get update sudo apt-get install neovim 编译安装 安装编译依赖 sudo apt-get install ninja-build gettext libtool libtool-bin autoconf automake cmake g++ pkg-config unzip curl doxygen 获取源代码 git clone https://github.com/neovim/neovim 编译安装neovim cd neovim make sudo make install 让neovim支持python和python3 sudo apt-get install python3 python3-pip python-pip -y pip install neovim pip3 install neovim ","date":"2022-05-19","objectID":"/posts/technology/compile_and_install/:4:0","tags":["软件编译","软件安装"],"title":"软件编译和安装","uri":"/posts/technology/compile_and_install/"},{"categories":["教程"],"content":"tmux 安装 Ubuntu 编译安装 获取源代码 wget https://github.com/tmux/tmux/releases/download/3.3-rc/tmux-3.3-rc.tar.gz 编译neovim tar -zxvf tmux-3.3-rc.tar.gz cd tmux-3.3-rc make sudo make install ","date":"2022-05-19","objectID":"/posts/technology/compile_and_install/:5:0","tags":["软件编译","软件安装"],"title":"软件编译和安装","uri":"/posts/technology/compile_and_install/"},{"categories":["教程"],"content":"transmission 安装 镜像安装 创建文件夹nextcloud mkdir transmission 创建文件docker-compose.yml --- version: \"2.1\" services: transmission: image: lscr.io/linuxserver/transmission container_name: transmission environment: - PUID=1000 - PGID=1000 - TZ=Europe/London - TRANSMISSION_WEB_HOME=/combustion-release/ #optional - USER=transmission #optional - PASS=passwd #optional #- WHITELIST=iplist #optional #- PEERPORT=peerport #optional #- HOST_WHITELIST=dnsnane list #optional volumes: - ./config:/config - ./downloads:/downloads - ./watch:/watch ports: - 9091:9091 - 51413:51413 - 51413:51413/udp restart: unless-stopped 启动镜像 sudo docker-compose up -d apt安装 安装 sudo apt update install transmission-daemon 修改配置文件 ... \"rpc-whitelist\": \"*\", \"rpc-whitelist-enabled\": true, ... web-ui安装 安装 wget https://github.com/ronggang/transmission-web-control/raw/master/release/install-tr-control-cn.sh bash install-tr-control-cn.sh ","date":"2022-05-19","objectID":"/posts/technology/compile_and_install/:6:0","tags":["软件编译","软件安装"],"title":"软件编译和安装","uri":"/posts/technology/compile_and_install/"},{"categories":["教程"],"content":"Selenium配置 [Webdriver驱动列表](Install browser drivers | Selenium) Windows 下载驱动 [Edge Webdriver](Microsoft Edge WebDriver - Microsoft Edge Developer) Chrome Webdriver 解压驱动到程序目录 mkdir selenium_test cd selenium_test 启动镜像 sudo docker-compose up -d ","date":"2022-05-19","objectID":"/posts/technology/compile_and_install/:7:0","tags":["软件编译","软件安装"],"title":"软件编译和安装","uri":"/posts/technology/compile_and_install/"},{"categories":["教程"],"content":"Jellyfin 安装 并启用硬件加速 apt安装 所有的Ubuntu发行版本 https://repo.jellyfin.org/releases/server/ubuntu/versions 查看当前的GPU设备 lspci -k | grep -A 2 -i \"VGA\" 禁用nouveau sudo vim /etc/modprobe.d/blacklist_nouveau.conf # 添加 blacklist nouveau options nouveau modeset=0 sudo reboot 搜索Nvidia显卡驱动 sudo ubuntu-drivers devices # 安装推荐的驱动 modalias : pci:v000010DEd00000FC2sv00001462sd0000275Cbc03sc00i00 vendor : NVIDIA Corporation model : GK107 [GeForce GT 630 OEM] driver : nvidia-driver-450-server - distro non-free #server版本的驱动 driver : nvidia-driver-470-server - distro non-free driver : nvidia-340 - distro non-free driver : nvidia-driver-418-server - distro non-free driver : nvidia-driver-470 - distro non-free recommended #gui版本的驱动 driver : nvidia-driver-390 - distro non-free driver : xserver-xorg-video-nouveau - distro free builtin 安装驱动 sudo apt install nvidia-driver-470-server #重启然后在jellyfin中设置Nvidia解码 镜像安装 创建文件夹jellyfin mkdir jellyfin 创建文件docker-compose.yml --- version: \"3.5\" services: jellyfin: image: nyanmisaka/jellyfin:latest container_name: jellyfin user: 1000:1000 network_mode: \"host\" volumes: - ./config:/config - ./cache:/cache - ./media:/media - /path/to/media2:/media2:ro restart: \"unless-stopped\" 启动镜像 sudo docker-compose up -d # 这种版本可能会导致apache2在转发端口的时候web存在不能访问服务器 ","date":"2022-05-19","objectID":"/posts/technology/compile_and_install/:8:0","tags":["软件编译","软件安装"],"title":"软件编译和安装","uri":"/posts/technology/compile_and_install/"},{"categories":["教程"],"content":"Nvidia驱动安装 Ubuntu 查看驱动 sudo dpkg --list | grep nvidia-* 卸载驱动 sudo /usr/bin/nvidia-uninstall sudo apt-get --purge remove nvidia-* sudo apt-get purge nvidia* sudo apt-get purge libnvidia* 检查驱动是否卸载 sudo dpkg --list | grep nvidia-* # 无任何输出 安装驱动 sudo ubuntu-drivers devices sudo apt install nvidia-driver-470-server ","date":"2022-05-19","objectID":"/posts/technology/compile_and_install/:9:0","tags":["软件编译","软件安装"],"title":"软件编译和安装","uri":"/posts/technology/compile_and_install/"},{"categories":["教程"],"content":"apache常见问题 ","date":"2022-05-03","objectID":"/posts/technology/apache2_and_nginx/:0:0","tags":["反向代理","网站证书"],"title":"web容器的使用和反向代理","uri":"/posts/technology/apache2_and_nginx/"},{"categories":["教程"],"content":"配置apache2文件简单服务器 打开配置文件 sudo vim /etc/apache2/sites-available/000-default.conf 修改内容为 Alias /e6ecni3_Sivan \"/var/www/html/\" \u003cDirectory /var/www/html/\"\u003e Require all granted AllowOverride All Options FollowSymLinks MultiViews \u003c/Directory\u003e 删除/var/www/html sudo rm -rf /var/www/html #软链html为你的共享文件目录 ","date":"2022-05-03","objectID":"/posts/technology/apache2_and_nginx/:0:1","tags":["反向代理","网站证书"],"title":"web容器的使用和反向代理","uri":"/posts/technology/apache2_and_nginx/"},{"categories":["教程"],"content":"访问apache2服务器默认指向index.php 删除浏览器的访问记录就可以 ","date":"2022-05-03","objectID":"/posts/technology/apache2_and_nginx/:0:2","tags":["反向代理","网站证书"],"title":"web容器的使用和反向代理","uri":"/posts/technology/apache2_and_nginx/"},{"categories":["教程"],"content":"在apache2中配置反向代理 反向代理服务器位于用户与目标服务器之间,但是对于用户而言,反向代理服务器就相当于目标服务器,即用户直接访问反向代理服务器就可以获得目标服务器的资源。同时,用户不需要知道目标服务器的地址,也无须在用户端作任何设定。反向代理服务器通常可用来作为Web加速,即使用反向代理作为Web服务器的前置机来降低网络和服务器的负载,提高访问效率。 其作用如下表示: 开启模块支持 sudo a2enmod rewrite sudo a2enmod lbmethod_byrequests sudo a2enmod proxy_balancer sudo a2enmod proxy_http sudo a2enmod proxy 添加反向代理设置 #sites-available/example.conf LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so \u003cVirtualHost *:80\u003e # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName www.example.com ServerAdmin sivan@localhost # Para qbittorrent RewriteEngine on RewriteRule ^/torrent$ \"/torrent/$1\" [R] ProxyPass /torrent/ http://127.0.0.1:8080/ ProxyPassReverse /torrent/ http://127.0.0.1:8080/ # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with \"a2disconf\". #Include conf-available/serve-cgi-bin.conf \u003c/VirtualHost\u003e # vim: syntax=apache ts=4 sw=4 sts=4 sr noet 启动服务 sudo a2ensite example.conf sudo service apache2 restart ","date":"2022-05-03","objectID":"/posts/technology/apache2_and_nginx/:0:3","tags":["反向代理","网站证书"],"title":"web容器的使用和反向代理","uri":"/posts/technology/apache2_and_nginx/"},{"categories":["教程"],"content":"apache 添加ssl证书并反向代理 开启ssl模块 sudo a2enmod ssl 配置证书site.conf LoadModule proxy_module modules/mod_proxy.so \u003cIfModule mod_ssl.c\u003e \u003cVirtualHost _default_:443\u003e ServerAdmin webmaster@localhost RewriteEngine on ProxyPass / http://127.0.0.1:8360/ ProxyPassReverse / http://127.0.0.1:8360/ ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined SSLEngine on SSLCertificateFile /etc/apache2/ssl/cloud.laais.cn.pem SSLCertificateKeyFile /etc/apache2/ssl/cloud.laais.cn.key SSLCertificateChainFile /etc/apache2/ssl/cloud.laais.cn.crt SSLCACertificatePath /etc/apache2/ssl SSLCACertificateFile /etc/apache2/ssl.crt/root_bundle.crt \u003c/VirtualHost\u003e \u003c/IfModule\u003e # vim: syntax=apache ts=4 sw=4 sts=4 sr noet ","date":"2022-05-03","objectID":"/posts/technology/apache2_and_nginx/:1:0","tags":["反向代理","网站证书"],"title":"web容器的使用和反向代理","uri":"/posts/technology/apache2_and_nginx/"},{"categories":["教程"],"content":"apache 配置websocket代理 LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so \u003cVirtualHost *:80\u003e ServerName www.hfsurrogacy.com ServerAdmin webmaster@hfsurrogacy.com DocumentRoot /var/www/html \u003cDirectory /var/www/html\u003e AllowOverride All Require all granted \u003c/Directory\u003e ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined \u003cLocationMatch \"/web\"\u003e ProxyPass http://127.0.0.1:10086/web upgrade=WebSocket ProxyAddHeaders Off ProxyPreserveHost On RequestHeader set Host %{HTTP_HOST}s RequestHeader set X-Forwarded-For %{REMOTE_ADDR}s \u003c/LocationMatch\u003e \u003c/VirtualHost\u003e ","date":"2022-05-03","objectID":"/posts/technology/apache2_and_nginx/:2:0","tags":["反向代理","网站证书"],"title":"web容器的使用和反向代理","uri":"/posts/technology/apache2_and_nginx/"},{"categories":["教程"],"content":"阿里云ssl证书安装错误 根据阿里云的教程在Apache服务器上安装SSL证书 (aliyun.com) 1.在服务器上更新证书apache2会报错 (1)错误1:AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globa 在apache.conf最后添加如下: ... # vim: syntax=apache ts=4 sw=4 sts=4 sr noet ServerName 127.0.0.1 (2)错误2:Action 'start' failed. 看日志提示SSL Library Error: error:0A0000B1:SSL routines::no certificate assigned 解决方案 下载这两处的文件然后把其他文件里面的pem文件更新到site.conf中 Nginx常见问题 ","date":"2022-05-03","objectID":"/posts/technology/apache2_and_nginx/:3:0","tags":["反向代理","网站证书"],"title":"web容器的使用和反向代理","uri":"/posts/technology/apache2_and_nginx/"},{"categories":["教程"],"content":"配置nginx反向代理和重定向 打开配置文件 sudo vim /etc/nginx/conf.d/jellyfin.conf 添加如下内容(访问http://host/video/.html 可反向代理重定向到http://host:8096/.html): set $jellyfin 127.0.0.1; location /video { # Proxy main Jellyfin traffic rewrite ^/video/(.*)$ /$1 break; proxy_pass http://$jellyfin:8096; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Protocol $scheme; proxy_set_header X-Forwarded-Host $http_host; # Disable buffering when the nginx proxy gets very resource heavy upon streaming proxy_buffering off; } # location block for /web - This is purely for aesthetics so /web/#!/ works instead of having to go to /web/index.html/#!/ location = /video/web/ { # Proxy main Jellyfin traffic proxy_pass http://$jellyfin:8096/web/index.html; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Protocol $scheme; proxy_set_header X-Forwarded-Host $http_host; } ","date":"2022-05-03","objectID":"/posts/technology/apache2_and_nginx/:3:1","tags":["反向代理","网站证书"],"title":"web容器的使用和反向代理","uri":"/posts/technology/apache2_and_nginx/"},{"categories":["教程"],"content":"配置wordpress支持 打开配置文件 sudo vim /etc/nginx/sites-available/default 添加如下内容(支持.htaccess和php): server { listen 80 default_server; listen [::]:80 default_server; # SSL configuration # # listen 443 ssl default_server; # listen [::]:443 ssl default_server; # # Note: You should disable gzip for SSL traffic. # See: https://bugs.debian.org/773332 # # Read up on ssl_ciphers to ensure a secure configuration. # See: https://bugs.debian.org/765782 # # Self signed certs generated by the ssl-cert package # Don't use them in a production server! # # include snippets/snakeoil.conf; root /var/www/html; # Add index.php to the list if you are using PHP index index.php index.html index.htm index.nginx-debian.html; server_name _; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; # support .htaccess if (-f $request_filename/index.html){ rewrite (.*) $1/index.html break; } if (-f $request_filename/index.php){ rewrite (.*) $1/index.php; } if (!-f $request_filename){ rewrite (.*) /index.php; } } location /login { proxy_redirect off; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection \"upgrade\"; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; set $is_v2ray 0; if ($http_upgrade = \"websocket\") { set $is_v2ray 1; } if ($is_v2ray = 1) { # 仅当请求为 WebSocket 时才反代到 V2Ray proxy_pass http://127.0.0.1:10086; } if ($is_v2ray = 0) { # 否则显示正常网页 rewrite ^/(.*)$ /mask-page last; } } # pass PHP scripts to FastCGI server # location ~ \\.php$ { include snippets/fastcgi-php.conf; # With php-fpm (or other unix sockets): fastcgi_pass unix:/run/php/php7.4-fpm.sock; } } ","date":"2022-05-03","objectID":"/posts/technology/apache2_and_nginx/:3:2","tags":["反向代理","网站证书"],"title":"web容器的使用和反向代理","uri":"/posts/technology/apache2_and_nginx/"},{"categories":["项目"],"content":"添加功能: ","date":"2022-04-08","objectID":"/posts/projects/vim/:1:0","tags":["vim","tmux"],"title":"Vim/Neovim-Tmux 一键安装轻量级工作站","uri":"/posts/projects/vim/"},{"categories":["项目"],"content":"1.文件管理:插件NerdTree 打开文件管理:Crtl + N 退出文件管理:Crtl + C ","date":"2022-04-08","objectID":"/posts/projects/vim/:1:1","tags":["vim","tmux"],"title":"Vim/Neovim-Tmux 一键安装轻量级工作站","uri":"/posts/projects/vim/"},{"categories":["项目"],"content":"2.跳转功能:Ctags\\pygments\\gtags 跳转到定义:Crtl + ] 后退:Crtl + T Ctrl+\\ c Find functions calling this function Ctrl+\\ d Find functions called by this function Ctrl+\\ e Find this egrep pattern Ctrl+\\ f Find this file Ctrl+\\ g Find this definition Ctrl+\\ i Find files #including this file Ctrl+\\ s Find this C symbol Ctrl+\\ t Find this text string ","date":"2022-04-08","objectID":"/posts/projects/vim/:1:2","tags":["vim","tmux"],"title":"Vim/Neovim-Tmux 一键安装轻量级工作站","uri":"/posts/projects/vim/"},{"categories":["项目"],"content":"3.任意跳转功能,主要是和前一个功能进行补充;JumpAny 跳转到定义:cursor移动到关键词 , + j ","date":"2022-04-08","objectID":"/posts/projects/vim/:1:3","tags":["vim","tmux"],"title":"Vim/Neovim-Tmux 一键安装轻量级工作站","uri":"/posts/projects/vim/"},{"categories":["项目"],"content":"4.搜索功能:LeaderF 打开搜索:, + f 结果上翻:Crtl + k 结果下翻:Crtl + j 打开:Enter 帮助:Tab ","date":"2022-04-08","objectID":"/posts/projects/vim/:1:4","tags":["vim","tmux"],"title":"Vim/Neovim-Tmux 一键安装轻量级工作站","uri":"/posts/projects/vim/"},{"categories":["项目"],"content":"5.代码补全:Coc.nvim 打开搜索:在对应的关键词后面按tab会提示 结果下翻:提示后按Tab可以顺序下翻,或者用Crtl + n 结果上翻:提示后Crtl + p 选择:Enter ","date":"2022-04-08","objectID":"/posts/projects/vim/:1:5","tags":["vim","tmux"],"title":"Vim/Neovim-Tmux 一键安装轻量级工作站","uri":"/posts/projects/vim/"},{"categories":["项目"],"content":"6.代码错误修正:Coc.nvim ","date":"2022-04-08","objectID":"/posts/projects/vim/:1:6","tags":["vim","tmux"],"title":"Vim/Neovim-Tmux 一键安装轻量级工作站","uri":"/posts/projects/vim/"},{"categories":["项目"],"content":"7.单终端编译和写代码,不用Crtl-z切后台编译,直接借助tmux和vimux插件实现在一个界面写代码和编译 创建tmux:tmux session -t mytmux 分屏tmux:打开vim后输入, + v + p,输入相关的运行命令便可打开命令行 运行上一次的命令:需要先运行在, + v + p,然后在, + v + l便可以运行最后一次的命令 切换tmux:按Crtl + b 再按 hjkl 任意,例如向下切换则Crtl + b,然后按j,便可向下切换tmux ","date":"2022-04-08","objectID":"/posts/projects/vim/:1:7","tags":["vim","tmux"],"title":"Vim/Neovim-Tmux 一键安装轻量级工作站","uri":"/posts/projects/vim/"},{"categories":["项目"],"content":"8.更加强大的终端zsh和on-my-zsh管理,支持主题和插件 ","date":"2022-04-08","objectID":"/posts/projects/vim/:1:8","tags":["vim","tmux"],"title":"Vim/Neovim-Tmux 一键安装轻量级工作站","uri":"/posts/projects/vim/"},{"categories":["项目"],"content":"9.vim支持Latex保存自动编译,编译实时显示(Windows Vim Latex Live Preview) 编译latex:,lc 查看latex:,lv 删除latex相关缓存文件:,lr ","date":"2022-04-08","objectID":"/posts/projects/vim/:1:9","tags":["vim","tmux"],"title":"Vim/Neovim-Tmux 一键安装轻量级工作站","uri":"/posts/projects/vim/"},{"categories":["项目"],"content":"效果预览 Vim or Neovim ","date":"2022-04-08","objectID":"/posts/projects/vim/:2:0","tags":["vim","tmux"],"title":"Vim/Neovim-Tmux 一键安装轻量级工作站","uri":"/posts/projects/vim/"},{"categories":["项目"],"content":"Ubuntu安装方式 # 可在内部选择对应的版本 git clone https://github.com/SivanLaai/vimrc.git cd vimrc ./install.sh #TODO: 安装完成记得进入vim更新插件 vim-gui ","date":"2022-04-08","objectID":"/posts/projects/vim/:3:0","tags":["vim","tmux"],"title":"Vim/Neovim-Tmux 一键安装轻量级工作站","uri":"/posts/projects/vim/"},{"categories":["项目"],"content":"windows 1.下载安装vim-gui gVim 下载python编译版本gvim Neovim 下载python编译版本neovim 配置路径D:\\Program Files\\Neovim\\bin为系统环境变量 2.安装对应版本的Python GVim查看对应版本的Python 查看相关版本的python下载安装: 下载Python 3.安装字体 下载字体 DejaVu Sans Mono for Powerline 4.安装universal-ctags/pygments 和 gtags (1)universal-ctags 下载universal-ctags 将ctags拷贝到安装路径,如D:\\Program Files\\ctags 配置路径D:\\Program Files\\ctags为系统环境变量 (2)pygments(主要作用是配合ctags来查找引用) pip install pygments (3)gtags 下载gtags 将gtags拷贝到安装路径,如D:\\Program Files\\gtags 配置路径D:\\Program Files\\gtags为系统环境变量 5.安装ripgrep 下载ripgrep 将ripgrep程序拷贝到安装路径,如D:\\Program Files\\ripgrep 配置路径D:\\Program Files\\ripgrep为系统环境变量 6.安装Latex 下载miktex 安装mitex并更新 7.安装Okular 下载Okular 将Okular程序安装到路径,如D:\\Program Files\\Okular 配置路径D:\\Program Files\\Okular为系统环境变量 8.安装MSYS2 下载MSYS2 将MSYS2程序安装到路径,如D:\\Program Files\\MSYS2 配置路径D:\\Program Files\\MSYS2\\usr\\bin为系统环境变量 配置路径D:\\Program Files\\MSYS2\\clang4\\bin为系统环境变量 安装clang64 # 更新软件库 pacman -Syu # 更新核心软件 pacman -Su # 安装Clang64编译环境 pacman -S --needed base-devel mingw-w64-clang-x86_64-toolchain 下载git 将git程序安装到路径,如D:\\Program Files\\git 配置路径D:\\Program Files\\git\\bin为系统环境变量 git中文显示错误修正 git config --global core.quotepath false 想卸载某个包的话 pacman -Rs mingw-w64-clang-x86_64-toolchain 9.配置vim-format依赖 #C++ 通过Clang64已经成功支持 #Python pip install --upgrade autopep8 #html\\css\\js npm install -g js-beautify 10.复制配置文件 gVim cp -rf gvim/_vimrc $vim/_vimrc cp -rf gvim/autoload vimfile - NeoVim-qt cp -rf neovim-qt/* ~/AppData/Local/nvim # Solarized Dark 主题复制 cp -rf gvim/colors vimfile 11.配置vim-gui :PlugInstall #待安装完成 ","date":"2022-04-08","objectID":"/posts/projects/vim/:4:0","tags":["vim","tmux"],"title":"Vim/Neovim-Tmux 一键安装轻量级工作站","uri":"/posts/projects/vim/"},{"categories":["项目"],"content":"Xshell 护眼主题 Eyes Protection ","date":"2022-04-08","objectID":"/posts/projects/vim/:5:0","tags":["vim","tmux"],"title":"Vim/Neovim-Tmux 一键安装轻量级工作站","uri":"/posts/projects/vim/"},{"categories":["项目"],"content":"安装方式 在Xshell 配色方案里导入 本项目中的xcs文件 ","date":"2022-04-08","objectID":"/posts/projects/vim/:5:1","tags":["vim","tmux"],"title":"Vim/Neovim-Tmux 一键安装轻量级工作站","uri":"/posts/projects/vim/"},{"categories":["项目"],"content":"界面预览 Solarized Dark Solarized Light ","date":"2022-04-08","objectID":"/posts/projects/vim/:5:2","tags":["vim","tmux"],"title":"Vim/Neovim-Tmux 一键安装轻量级工作站","uri":"/posts/projects/vim/"},{"categories":["教程"],"content":"docker教程 ","date":"2022-04-02","objectID":"/posts/technology/docker/:0:0","tags":["docker"],"title":"docker教程","uri":"/posts/technology/docker/"},{"categories":["教程"],"content":"docker安装 卸载老版本docker sudo apt-get remove docker docker-engine docker.io containerd runc 设置apt仓库 1.更新apt包索引并且安装相关依赖允许apt使用https更新 sudo apt-get update sudo apt-get install \\ ca-certificates \\ curl \\ gnupg \\ lsb-release 2.增加Docker官方GPG Key curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg 3.设置apt docker稳定仓库设置 echo \\ \"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \\ $(lsb_release -cs) stable\" | sudo tee /etc/apt/sources.list.d/docker.list \u003e /dev/null 安装Docker引擎 1.更新apt包索引并且安装Docker引擎 sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io 2.验证docker是否成功安装 sudo docker run hello-world 3.设置apt docker稳定仓库设置 echo \\ \"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \\ $(lsb_release -cs) stable\" | sudo tee /etc/apt/sources.list.d/docker.list \u003e /dev/null 参考文档 Install Docker Engine on Ubuntu | Docker Documentation ","date":"2022-04-02","objectID":"/posts/technology/docker/:1:0","tags":["docker"],"title":"docker教程","uri":"/posts/technology/docker/"},{"categories":["教程"],"content":"Docker Compose安装 ","date":"2022-04-02","objectID":"/posts/technology/docker/:2:0","tags":["docker"],"title":"docker教程","uri":"/posts/technology/docker/"},{"categories":["教程"],"content":"Linux 安装Docker Compose 1.下载docker compose可执行文件 sudo curl -L \"https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)\" -o /usr/local/bin/docker-compose 2.设置可执行权限 sudo chmod +x /usr/local/bin/docker-compose ","date":"2022-04-02","objectID":"/posts/technology/docker/:2:1","tags":["docker"],"title":"docker教程","uri":"/posts/technology/docker/"},{"categories":["教程"],"content":"qBittorrent Docker运行 ","date":"2022-04-02","objectID":"/posts/technology/docker/:3:0","tags":["docker"],"title":"docker教程","uri":"/posts/technology/docker/"},{"categories":["教程"],"content":"Docker Compose 配置qBittorrent 新建项目 1.进入home目录,新建项目qBittorrent cd ~ mkdir qBittorrent cd qBittorrent 2.进入项目文件目录,新建配置文件docker-compose.yml,配置下载端口,qBittorrent相关目录 version: \"3\" services: qbittorrent: image: emmercm/qbittorrent:latest restart: unless-stopped ports: - 8080:8080 - 5463:5463/tcp - 5463:5463/udp volumes: - ./config:/config - ./data:/data - ./downloads:/downloads - ./incomplete:/incomplete 运行项目 1.下载并创建镜像 docker-compose up 2.运行镜像 docker-compose start ","date":"2022-04-02","objectID":"/posts/technology/docker/:3:1","tags":["docker"],"title":"docker教程","uri":"/posts/technology/docker/"},{"categories":["学习"],"content":"2021秋作业2-动态规划 ","date":"2022-03-02","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/:0:0","tags":["算法学习","卜东坡-算法设计与分析","动态规划"],"title":"卜东坡算法-2021秋作业2-动态规划","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/"},{"categories":["学习"],"content":"1. Money robbing A robber is planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security system connected and it will automatically contact the police if two adjacent houses were broken into on the same night. Given a list of non-negative integers representing the amount of money of each house, determine the maximum amount of money you can rob tonight without alerting the police. What if all houses are arranged in a circle? 解法: class Solution { public: int robMaxMoney(vector\u003cint\u003e\u0026 a) { int start = 0; int end = a.size() - 1; vector\u003cint\u003e dp(end, 0); //初始化dp全部为0,dp表示前i+1个房子抢劫的最大金钱数 dp[0] = a[0]; dp[1] = max(a[0], a[1]); for (int i = 2; i \u003c= end; ++i) { dp[i] = max(dp[i - 1], dp[i - 2] + a[i]); } return dp[end]; } }; ","date":"2022-03-02","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/:1:0","tags":["算法学习","卜东坡-算法设计与分析","动态规划"],"title":"卜东坡算法-2021秋作业2-动态规划","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/"},{"categories":["学习"],"content":"2. Largest Divisible Subset Given a set of distinct positive integers, find the largest subset such that every pair (Si , Sj ) of elements in this subset satisfies: Si%Sj = 0 or Sj%Si = 0. Please return the largest size of the subset. Note: Si%Sj = 0 means that Si is divisible by Sj . 解法: class Solution { public: int getLargestDivisibleSum(vector\u003cint\u003e\u0026 nums) { quickSort(nums); //先使用快速排序对数组从小到大进行排序 int size = nums.size(); vector\u003cint\u003e dp(size, 1); //初始化dp全部为1,dp表示前i个数元素最多的可整除子集长度 for (int i = 2; i \u003c= size; ++i) { for (int j = 1; j \u003c i; ++j) { if (nums[i] % nums[j] == 0) { dp[i] = max(dp[i], dp[j] + 1); } } } } }; ","date":"2022-03-02","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/:2:0","tags":["算法学习","卜东坡-算法设计与分析","动态规划"],"title":"卜东坡算法-2021秋作业2-动态规划","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/"},{"categories":["学习"],"content":"3. Unique Binary Search Trees Given n, how many structurally unique BST’s (binary search trees) that store values 1…n? Explanation: Given n = 3, there are a total of 5 unique BST’s: class Solution { public: int getBSTSum(const int\u0026 n) { vector\u003cint\u003e dp(n, 0); dp[0] = dp[1] = 1; for (int i=2; i \u003c= n; ++i) { for (int j=0; j \u003c i; ++j) { dp[i] += dp[j] * dp[i - j - 1]; } } } }; ","date":"2022-03-02","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/:3:0","tags":["算法学习","卜东坡-算法设计与分析","动态规划"],"title":"卜东坡算法-2021秋作业2-动态规划","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/"},{"categories":["学习"],"content":"4. Word Break Given a string S and a dictionary of words, determine if the string S can be segmented into a space-separated sequence of one or more dictionary words. Note: Each word in the dictionary may be reused multiple times in the segmentation. You can return TRUE if the string S is empty. class Solution { public: bool wordBreak(string s, vector\u003cstring\u003e\u0026 wordDict) { int n = s.size(); vector\u003cbool\u003e dp(n, false); dp[0] = true; for (int i = 1; i \u003c= n; ++i) { for (auto str: wordDict) { int str_len = str.size(); if (i \u003e= str_len) { dp[i] = (dp[i - str_len] // 表示前 i - str_len个字符是否由wordDict单词组成 \u0026\u0026 s.substr(i - str_len, str_len) == str) // i - str_len到i是否组成一个单词 || dp[i]; // dp[i]表示前s的前i个字符是否由wordDict的单词组成,只要找到一个dp[i]满足,则dp[i]就是 } } } return dp[n]; } }; ","date":"2022-03-02","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/:4:0","tags":["算法学习","卜东坡-算法设计与分析","动态规划"],"title":"卜东坡算法-2021秋作业2-动态规划","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/"},{"categories":["学习"],"content":"5. Distinct Sequences Given two strings S and T, return the number of distinct subsequences of S which equals T. A string’s subsequence is a new string formed from the original string by deleting some (can be none) of the characters without disturbing the remaining characters’ relative positions. (i.e., ”ACE” is a subsequence of ”ABCDE” while ”AEC” is not). Example 1: Input: s = \"rabbbit\", t = \"rabbit\" Output: 3 Explanation: As shown below, there are 3 ways you can generate \"rabbit\" from S. rabbbit rabbbit rabbbit Example 2: Input: s = \"babgbag\", t = \"bag\" Output: 5 Explanation: As shown below, there are 5 ways you can generate \"bag\" from S. babgbag babgbag babgbag babgbag babgbag class Solution { public: int numDistinct(string s, string t) { int n = s.size(); int m = t.size(); vector\u003cvector\u003cint\u003e\u003e dp(n + 1, vector\u003cint\u003e(m + 1, 0)); for (int i=0; i\u003c=n; ++i) dp[i][0] = 1; for (int i = 1; i \u003c= n; ++i) { for (int j = 1; j \u003c= m; ++j) { if (s[i] == t[j]) { dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j];// 两种情况之和 } else { dp[i][j] = dp[i - 1][j];// 如果当前字符不相等,则说明s的前i个字符和t的前j个字符的字集个数会 等于 s的前i-1个字符和t的前j个字符的个数 } } } return dp[n][m]; } }; ","date":"2022-03-02","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/:5:0","tags":["算法学习","卜东坡-算法设计与分析","动态规划"],"title":"卜东坡算法-2021秋作业2-动态规划","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/"},{"categories":["学习"],"content":"6. Triangle Description Given a triangle array, return the minimum path sum from top to bottom. For each step, you may move to an adjacent number of the row below. More formally, if you are on index i on the current row, you may move to either index i or index i +1on the next row. Input Line1: The height of the triangle, and 1 \u003c= triangle.height \u003c= 2001\u003c=triangl**e.heigh**t\u003c=200. Line2: All the elements in the triangle, and split by some spaces(for each element,-10^4\u003c= triangle[i][j] \u003c=10^4). We are sure that the number of the elements satisfy: Output Print the minimum path sum from top to bottom. Sample Input 1 4 2 3 4 6 5 7 4 1 8 3 Sample Output 1 11 Sample Input 2 1 -10 Sample Output 2 -10 Hint Input: 4 2 3 4 6 5 7 4 1 8 3 Output: 11 Explanation: The triangle looks like: 2 34 657 4183 The minimum path sum from top to bottom is 2 + 3 + 5 + 1 = 11 (bolded above) class Solution { public: int miniPathSum(const vector\u003cvector\u003cint\u003e\u003e\u0026 triangles) { int n = triangles.size(); vector\u003cint\u003e dp(n + 1, 0); for (int i=n; i\u003e=1; --i) { for (int j=1; j\u003c=i; ++j) { dp[j - 1] = min(dp[j - 1], dp[j]) + triangles[i][j]; } } return dp[0]; } }; ","date":"2022-03-02","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/:6:0","tags":["算法学习","卜东坡-算法设计与分析","动态规划"],"title":"卜东坡算法-2021秋作业2-动态规划","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/"},{"categories":["学习"],"content":"7. Maximum Alternating Subsequence Sum Description The alternating sum of a 0-indexed array is defined as the sum of the elements at even indices minus the sum of the elements at odd indices. For example, the alternating sum of [4,2,5,3] is (4 + 5) - (2 + 3) = 4. Given an array nums, return the maximum alternating sum of any subsequence of nums (after reindexing the elements of the subsequence). A subsequence of an array is a new array generated from the original array by deleting some elements (possibly none) without changing the remaining elements’ relative order.For example, [2,7,4] is a subsequence of [4,2,3,7,2,1,4] (the underlined elements), while [2,4,2] is not. Input Anarray. 1 \u003c= nums.length \u003c= 10^51\u003c=num**s.lengt**h\u003c=105 1 \u003c= nums[i] \u003c= 10^51\u003c=num**s[i]\u003c=105 Output Maximum alternating sum. Sample Input 1 5 6 7 8 Sample Output 1 8 Explanation: It is optimal to choose the subsequence [8] with alternating sum 8. Sample Input 2 6 2 1 2 4 5 Sample Output 2 10 Explanation: It is optimal to choose the subsequence [6,1,5] with alternating sum (6 + 5) - 1 = 10. Sample Input 3 4 2 5 3 Sample Output 3 7 Explanation: It is optimal to choose the subsequence [4,2,5] with alternating sum (4 + 5) - 2 = 7. class Solution { public: int maxAlternatingSum(const vector\u003cint\u003e\u0026 nums) { int n = nums.size(); vector\u003cvector\u003cint\u003e\u003e dp(n + 1, 0); // dp[i][0] 表示前i个数组成的子序列末位为偶数的最大交替和,dp[i][1]表示子序列末位为奇数的最大交替和。 dp[1][1] = nums[0]; // 前i个数末位为奇数的时候最大和 for (int i=1; i\u003c=n; ++i) { dp[i][0] = max(dp[i-1][0], dp[i-1][1] - nums[i-1]); dp[i][1] = max(dp[i-1][1], dp[i-1][0] + nums[i-1]); // 前i个数交替和最大末位是奇数的情况,所以要考虑前i-1个数分别为奇和偶的情况。 } return max(dp[n][0], dp[n][1]); } }; ","date":"2022-03-02","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/:7:0","tags":["算法学习","卜东坡-算法设计与分析","动态规划"],"title":"卜东坡算法-2021秋作业2-动态规划","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/"},{"categories":["学习"],"content":"2021秋作业2-动态规划 ","date":"2022-03-02","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/:0:0","tags":["算法学习","卜东坡-算法设计与分析","贪心"],"title":"卜东坡算法-2021秋作业3-贪心","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/"},{"categories":["学习"],"content":"1. Money robbing A robber is planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security system connected and it will automatically contact the police if two adjacent houses were broken into on the same night. Given a list of non-negative integers representing the amount of money of each house, determine the maximum amount of money you can rob tonight without alerting the police. What if all houses are arranged in a circle? 解法: class Solution { public: int robMaxMoney(vector\u003cint\u003e\u0026 a) { int start = 0; int end = a.size() - 1; vector\u003cint\u003e dp(end, 0); //初始化dp全部为0,dp表示前i+1个房子抢劫的最大金钱数 dp[0] = a[0]; dp[1] = max(a[0], a[1]); for (int i = 2; i \u003c= end; ++i) { dp[i] = max(dp[i - 1], dp[i - 2] + a[i]); } return dp[end]; } }; ","date":"2022-03-02","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/:1:0","tags":["算法学习","卜东坡-算法设计与分析","贪心"],"title":"卜东坡算法-2021秋作业3-贪心","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/"},{"categories":["学习"],"content":"2. Largest Divisible Subset Given a set of distinct positive integers, find the largest subset such that every pair (Si , Sj ) of elements in this subset satisfies: Si%Sj = 0 or Sj%Si = 0. Please return the largest size of the subset. Note: Si%Sj = 0 means that Si is divisible by Sj . 解法: class Solution { public: int getLargestDivisibleSum(vector\u003cint\u003e\u0026 nums) { quickSort(nums); //先使用快速排序对数组从小到大进行排序 int size = nums.size(); vector\u003cint\u003e dp(size, 1); //初始化dp全部为1,dp表示前i个数元素最多的可整除子集长度 for (int i = 2; i \u003c= size; ++i) { for (int j = 1; j \u003c i; ++j) { if (nums[i] % nums[j] == 0) { dp[i] = max(dp[i], dp[j] + 1); } } } } }; ","date":"2022-03-02","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/:2:0","tags":["算法学习","卜东坡-算法设计与分析","贪心"],"title":"卜东坡算法-2021秋作业3-贪心","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/"},{"categories":["学习"],"content":"3. Unique Binary Search Trees Given n, how many structurally unique BST’s (binary search trees) that store values 1…n? Explanation: Given n = 3, there are a total of 5 unique BST’s: class Solution { public: int getBSTSum(const int\u0026 n) { vector\u003cint\u003e dp(n, 0); dp[0] = dp[1] = 1; for (int i=2; i \u003c= n; ++i) { for (int j=0; j \u003c i; ++j) { dp[i] += dp[j] * dp[i - j - 1]; } } } }; ","date":"2022-03-02","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/:3:0","tags":["算法学习","卜东坡-算法设计与分析","贪心"],"title":"卜东坡算法-2021秋作业3-贪心","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/"},{"categories":["学习"],"content":"4. Word Break Given a string S and a dictionary of words, determine if the string S can be segmented into a space-separated sequence of one or more dictionary words. Note: Each word in the dictionary may be reused multiple times in the segmentation. You can return TRUE if the string S is empty. class Solution { public: bool wordBreak(string s, vector\u003cstring\u003e\u0026 wordDict) { int n = s.size(); vector\u003cbool\u003e dp(n, false); dp[0] = true; for (int i = 1; i \u003c= n; ++i) { for (auto str: wordDict) { int str_len = str.size(); if (i \u003e= str_len) { dp[i] = (dp[i - str_len] // 表示前 i - str_len个字符是否由wordDict单词组成 \u0026\u0026 s.substr(i - str_len, str_len) == str) // i - str_len到i是否组成一个单词 || dp[i]; // dp[i]表示前s的前i个字符是否由wordDict的单词组成,只要找到一个dp[i]满足,则dp[i]就是 } } } return dp[n]; } }; ","date":"2022-03-02","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/:4:0","tags":["算法学习","卜东坡-算法设计与分析","贪心"],"title":"卜东坡算法-2021秋作业3-贪心","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/"},{"categories":["学习"],"content":"5. Distinct Sequences Given two strings S and T, return the number of distinct subsequences of S which equals T. A string’s subsequence is a new string formed from the original string by deleting some (can be none) of the characters without disturbing the remaining characters’ relative positions. (i.e., ”ACE” is a subsequence of ”ABCDE” while ”AEC” is not). Example 1: Input: s = \"rabbbit\", t = \"rabbit\" Output: 3 Explanation: As shown below, there are 3 ways you can generate \"rabbit\" from S. rabbbit rabbbit rabbbit Example 2: Input: s = \"babgbag\", t = \"bag\" Output: 5 Explanation: As shown below, there are 5 ways you can generate \"bag\" from S. babgbag babgbag babgbag babgbag babgbag class Solution { public: int numDistinct(string s, string t) { int n = s.size(); int m = t.size(); vector\u003cvector\u003cint\u003e\u003e dp(n + 1, vector\u003cint\u003e(m + 1, 0)); for (int i=0; i\u003c=n; ++i) dp[i][0] = 1; for (int i = 1; i \u003c= n; ++i) { for (int j = 1; j \u003c= m; ++j) { if (s[i] == t[j]) { dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j];// 两种情况之和 } else { dp[i][j] = dp[i - 1][j];// 如果当前字符不相等,则说明s的前i个字符和t的前j个字符的字集个数会 等于 s的前i-1个字符和t的前j个字符的个数 } } } return dp[n][m]; } }; ","date":"2022-03-02","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/:5:0","tags":["算法学习","卜东坡-算法设计与分析","贪心"],"title":"卜东坡算法-2021秋作业3-贪心","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/"},{"categories":["学习"],"content":"6. Triangle Description Given a triangle array, return the minimum path sum from top to bottom. For each step, you may move to an adjacent number of the row below. More formally, if you are on index i on the current row, you may move to either index i or index i +1on the next row. Input Line1: The height of the triangle, and 1 \u003c= triangle.height \u003c= 2001\u003c=triangl**e.heigh**t\u003c=200. Line2: All the elements in the triangle, and split by some spaces(for each element,-10^4\u003c= triangle[i][j] \u003c=10^4). We are sure that the number of the elements satisfy: Output Print the minimum path sum from top to bottom. Sample Input 1 4 2 3 4 6 5 7 4 1 8 3 Sample Output 1 11 Sample Input 2 1 -10 Sample Output 2 -10 Hint Input: 4 2 3 4 6 5 7 4 1 8 3 Output: 11 Explanation: The triangle looks like: 2 34 657 4183 The minimum path sum from top to bottom is 2 + 3 + 5 + 1 = 11 (bolded above) class Solution { public: int miniPathSum(const vector\u003cvector\u003cint\u003e\u003e\u0026 triangles) { int n = triangles.size(); vector\u003cint\u003e dp(n + 1, 0); for (int i=n; i\u003e=1; --i) { for (int j=1; j\u003c=i; ++j) { dp[j - 1] = min(dp[j - 1], dp[j]) + triangles[i][j]; } } return dp[0]; } }; ","date":"2022-03-02","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/:6:0","tags":["算法学习","卜东坡-算法设计与分析","贪心"],"title":"卜东坡算法-2021秋作业3-贪心","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/"},{"categories":["学习"],"content":"7. Maximum Alternating Subsequence Sum Description The alternating sum of a 0-indexed array is defined as the sum of the elements at even indices minus the sum of the elements at odd indices. For example, the alternating sum of [4,2,5,3] is (4 + 5) - (2 + 3) = 4. Given an array nums, return the maximum alternating sum of any subsequence of nums (after reindexing the elements of the subsequence). A subsequence of an array is a new array generated from the original array by deleting some elements (possibly none) without changing the remaining elements’ relative order.For example, [2,7,4] is a subsequence of [4,2,3,7,2,1,4] (the underlined elements), while [2,4,2] is not. Input Anarray. 1 \u003c= nums.length \u003c= 10^51\u003c=num**s.lengt**h\u003c=105 1 \u003c= nums[i] \u003c= 10^51\u003c=num**s[i]\u003c=105 Output Maximum alternating sum. Sample Input 1 5 6 7 8 Sample Output 1 8 Explanation: It is optimal to choose the subsequence [8] with alternating sum 8. Sample Input 2 6 2 1 2 4 5 Sample Output 2 10 Explanation: It is optimal to choose the subsequence [6,1,5] with alternating sum (6 + 5) - 1 = 10. Sample Input 3 4 2 5 3 Sample Output 3 7 Explanation: It is optimal to choose the subsequence [4,2,5] with alternating sum (4 + 5) - 2 = 7. class Solution { public: int maxAlternatingSum(const vector\u003cint\u003e\u0026 nums) { int n = nums.size(); vector\u003cvector\u003cint\u003e\u003e dp(n + 1, 0); // dp[i][0] 表示前i个数组成的子序列末位为偶数的最大交替和,dp[i][1]表示子序列末位为奇数的最大交替和。 dp[1][1] = nums[0]; // 前i个数末位为奇数的时候最大和 for (int i=1; i\u003c=n; ++i) { dp[i][0] = max(dp[i-1][0], dp[i-1][1] - nums[i-1]); dp[i][1] = max(dp[i-1][1], dp[i-1][0] + nums[i-1]); // 前i个数交替和最大末位是奇数的情况,所以要考虑前i-1个数分别为奇和偶的情况。 } return max(dp[n][0], dp[n][1]); } }; ","date":"2022-03-02","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/:7:0","tags":["算法学习","卜东坡-算法设计与分析","贪心"],"title":"卜东坡算法-2021秋作业3-贪心","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/"},{"categories":["教程"],"content":"mysql数据库 ","date":"2022-02-25","objectID":"/posts/technology/mysql/:1:0","tags":["mysql","数据库"],"title":"数据库配置","uri":"/posts/technology/mysql/"},{"categories":["教程"],"content":"mysql忘记密码 (1)修改配置文件免密 sudo vim /etc/mysql/my.cnf [mysqld] skip-grant-tables (2)重启mysql sudo service mysql restart (3)修改初始密码 mysql -u root use mysql; update user set password=password(\"test@123\") where user=\"root\"; ","date":"2022-02-25","objectID":"/posts/technology/mysql/:1:1","tags":["mysql","数据库"],"title":"数据库配置","uri":"/posts/technology/mysql/"},{"categories":["教程"],"content":"mysql root帐号不能登录 (1)修改配置文件免密 看mysql忘记密码的第一步 (2)更新ip访问权限 flush privileges; alter user 'root'@'localhost' identified by 'test@123'; flush privileges; commit; ","date":"2022-02-25","objectID":"/posts/technology/mysql/:1:2","tags":["mysql","数据库"],"title":"数据库配置","uri":"/posts/technology/mysql/"},{"categories":["教程"],"content":"mysql 创建数据库 CREATE DATABASE IF NOT EXISTS nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; ","date":"2022-02-25","objectID":"/posts/technology/mysql/:1:3","tags":["mysql","数据库"],"title":"数据库配置","uri":"/posts/technology/mysql/"},{"categories":["教程"],"content":"mysql 创建用户开启外网权限 打开配置文件 sudo vim /etc/mysql/my.cnf 修改绑定ip [mysqld] bind-address=0.0.0.0 具体命令 CREATE USER 'username'@'%' IDENTIFIED BY 'password'; # 所有的数据库都可以在外网访问 GRANT ALL PRIVILEGES ON *.* TO 'username'@'%'; FLUSH PRIVILEGES; ","date":"2022-02-25","objectID":"/posts/technology/mysql/:1:4","tags":["mysql","数据库"],"title":"数据库配置","uri":"/posts/technology/mysql/"},{"categories":["学习"],"content":"2021秋作业1-分治 ","date":"2021-12-17","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/:0:0","tags":["算法学习","卜东坡-算法设计与分析","分治"],"title":"卜东坡算法-2021秋作业1-分治","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/"},{"categories":["学习"],"content":"1. 找出整数数组中第K大的数 215.Kth Largest Element in an Array (Medium) Given an integer array nums and an integer k, please return the k-th largest element in the array. Your algorithm’s runtime complexity must be in the order of O(n), prove the correctnes-sand analyze the complexity.(k is much smaller than n, n is the length of the array.) Example 1: Input: nums = [3,2,1,5,6,4], k = 2 Output: 5 Example 2: Input: nums = [3,2,3,1,2,4,5,5,6], k = 4 Output: 4 Constraints: 1 \u003c= k \u003c= nums.length \u003c= 104 -104 \u003c= nums[i] \u003c= 104 Solution: class Solution { public: int findKthLargest(vector\u003cint\u003e\u0026 nums, int k) { int idx = 0; vector\u003cint\u003e numL; vector\u003cint\u003e numR; for (int i = idx + 1; i \u003c nums.size(); i++) { if (nums[i] \u003e nums[idx]) { numR.push_back(nums[i]); } else { numL.push_back(nums[i]); } } if (numR.size() == k - 1) { return nums[idx]; } else if (numR.size() \u003e k - 1) { return findKthLargest(numR, k); } else { return findKthLargest(numL, k - numR.size() - 1); } } }; (Page55)Complexity: 如果子实例处在$[n(\\frac 34) ^{j + 1} + 1, n(\\frac 34) ^{j}]$则说明 算法运行在第$j$期,$X$表示算法整体的元素比较次数,$X_j$表示运行过程处于第j期时的比较次数,则有: ​ $$X = X_0 + X_1 + X_2 + \\dots$$ 选择中间区域的概率为$\\frac 12$,选择一个中间区域的元素作为中心元后,实例规模减少$\\frac 1 4$,因为每一期递归调用期望是两次,则在第$j$期的时候算法期望比较次数为$2n(\\frac{3}{4})^j$,则整体的期望比较次数为: ​ $$E(X)=E[X_0 +X_1+X_2+\\dots] \\leq \\sum_j 2cn (\\frac 34)^j \\leq 8cn$$ 则时间复杂度为$O(n)$。 ","date":"2021-12-17","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/:1:0","tags":["算法学习","卜东坡-算法设计与分析","分治"],"title":"卜东坡算法-2021秋作业1-分治","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/"},{"categories":["学习"],"content":"2. 二叉树邻域最小值 Consider an $n$-node complete binary tree $T$, where $n = 2^d − 1$ for some $d$. Each node $v$ of $T$ is labeled with a real number $x_v$. You may assume that the real numbers labeling the nodes are all distinct. A node $v$ of $T$ is a local minimum if the label $x_v$ is less than the label $x_w$ for all nodes $w$ that are joined to v by an edge. You are given such a complete binary tree T, but the labeling is only specified in the following: implicit way: for each node v, you can determine the value xv by probing the node v. Show how to find a local minimum of T using only O(logn) probes to the nodes of T. 解法: ","date":"2021-12-17","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/:2:0","tags":["算法学习","卜东坡-算法设计与分析","分治"],"title":"卜东坡算法-2021秋作业1-分治","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/"},{"categories":["学习"],"content":"3. 数组子数组最大和 1800.Maximum Ascending Subarray Sum (Easy) Given an integer array, one or more consecutive integers in the array form a sub-array. Find the maximum value of the sum of all subarrays. Please give an algorithm with O(nlogn) complexity class Solution { public: int findLargestSubArraySum(vector\u003cint\u003e\u0026 nums, int start, int end) { if (start == end) { return nums[start]; } else if (start \u003e end) { return -1; } int mid = (start + end) / 2; int subStart = mid; int subSum = nums[mid]; while (subStart \u003e start \u0026\u0026 nums[subStart] - 1 == nums[subStart - 1]) { subStart--; subSum += nums[subStart]; } int subEnd = mid; while (subEnd \u003c end \u0026\u0026 nums[subEnd] + 1 == nums[subEnd + 1]) { subEnd++; subSum += nums[subEnd]; } int subLSum = findLargestSubArraySum(nums, start, subStart - 1); int subRSum = findLargestSubArraySum(nums, subEnd + 1, end); return max(max(subSum, subLSum), subRSum); } }; ","date":"2021-12-17","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/:3:0","tags":["算法学习","卜东坡-算法设计与分析","分治"],"title":"卜东坡算法-2021秋作业1-分治","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/"},{"categories":["学习"],"content":"4. 查找有序数组指定元素的区间 34.find-first-and-last-position-of-element-in-sorted-array (Medium) Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value. If target is not found in the array, return [-1, -1]. You must write an algorithm with O(log n) runtime complexity. Example 1: Input: nums = [5,7,7,8,8,10], target = 8 Output: [3,4] Example 2: Input: nums = [5,7,7,8,8,10], target = 6 Output: [-1,-1] Example 3: Input: nums = [], target = 0 Output: [-1,-1] class Solution { public: vector\u003cint\u003e searchRange(vector\u003cint\u003e\u0026 nums, int target) { int l = findFisrt(nums, target); int h = findFisrt(nums, target + 1); if (l == nums.size() || nums[l] != target) { return vector\u003cint\u003e {-1, -1}; } return vector\u003cint\u003e {l, h - 1}; } int findFisrt(vector\u003cint\u003e\u0026 nums, int target) { int l = 0; int h = nums.size(); while (l \u003c h) { int mid = (l + h) / 2; if (nums[mid] \u003e= target) { h = mid; } else { l = mid + 1; } } return l; } }; ","date":"2021-12-17","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/:4:0","tags":["算法学习","卜东坡-算法设计与分析","分治"],"title":"卜东坡算法-2021秋作业1-分治","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/"},{"categories":["学习"],"content":"5. 求N多边形可以被切割成多少个三角形 Given a convex polygon with n vertices, we can divide it into several separated pieces, such that every piece is a triangle. When n = 4, there are two different ways to divide the polygon; When n = 5, there are five different ways. Give an algorithm that decides how many ways we can divide a convex polygon with n vertices into triangles. ","date":"2021-12-17","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/:5:0","tags":["算法学习","卜东坡-算法设计与分析","分治"],"title":"卜东坡算法-2021秋作业1-分治","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/"},{"categories":["学习"],"content":"6. 归并K个长度为N的有序链表 Given an array of k linked-lists lists, each linked-list is sorted in ascending order. Given an O(knlogk) algorithm to merge all the linked-lists into one sorted linked-list. (Note that the length of a linked-lists is n) class Solution { public: ListNode* mergeKLists(vector\u003cListNode*\u003e\u0026 lists) { return helpMergeKLists(lists, 0, lists.size() - 1); } ListNode* mergeTwoLists(ListNode* l1, ListNode* l2) { ListNode* head = new ListNode(-1); ListNode* p = head; while (l1 != NULL || l2 != NULL) { if (l1 == NULL \u0026\u0026 l2 != NULL) { p-\u003enext = l2; l2 = l2-\u003enext; } if (l1 != NULL \u0026\u0026 l2 == NULL) { p-\u003enext = l1; l1 = l1-\u003enext; } if (l1 != NULL \u0026\u0026 l2 != NULL) { p-\u003enext = l1-\u003eval \u003e l2-\u003eval ? l2 : l1; l1-\u003eval \u003e l2-\u003eval ? l2 = l2-\u003enext : l1 = l1-\u003enext; } p = p-\u003enext; } return head-\u003enext; } ListNode* helpMergeKLists(vector\u003cListNode*\u003e\u0026 lists, const int\u0026 start, const int\u0026 end) { if (start \u003e end) { return NULL; } else if (start == end) { return lists[start]; } int mid = (start + end) / 2; ListNode* l1 = helpMergeKLists(lists, start, mid); ListNode* l2 = helpMergeKLists(lists, mid + 1, end); return mergeTwoLists(l1, l2); } }; ","date":"2021-12-17","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/:6:0","tags":["算法学习","卜东坡-算法设计与分析","分治"],"title":"卜东坡算法-2021秋作业1-分治","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/"},{"categories":["学习"],"content":"7.Fast Mod Exponentiation Description Bob has encountered a difficult problem, and hope you design an algorithm to calculate pow(a,b) mod 1337, where a is a positive integer, b is a very large positive integer and will be given in the form of an array. For example, pow(2,3) mod 1337 is 8. 1 \\le a \\le 2^{31} - 1,1≤a≤231−1, 1 \\le b.length \\le 2000,1≤b.lengt**h≤2000, 0 \\le b[i] \\le 90≤b[i]≤9 bb doesn’t contain leading zeros. Please give an algorithm with O(\\log n)O(logn) complexity. Input Line 1: integers Line 2: an array Output One integer Sample Input 1 2 [3] Sample Output 1 8 Sample Input 2 4 [3,5] Sample Output 2 709 Sample Input 3 222222222 [4,0,0] Sample Output 3 1171 #include \u003cstdio.h\u003e #define MOD_VALUE 1337 int size = 0; int start = 0; int count = 0; int array[2000]; void arrayHalfDivide() { array[size - 1] = array[size - 1] / 2; int i = size - 2; while (i \u003e= start) { int curr = array[i] * 5; array[i] = curr / 10; array[i + 1] += curr % 10; --i; } if (array[start] == 0 \u0026\u0026 count \u003e 1) { count--; start++; } } int clacFastModExponentation(int base) { if (count == 1 \u0026\u0026 array[size - 1] == 0) { return 1; } if (count == 1 \u0026\u0026 array[size - 1] == 1) { return base % MOD_VALUE; } int sumMod = 1; if (array[size - 1] % 2 != 0) { array[size - 1] = array[size - 1] - 1; sumMod *= (base % MOD_VALUE); } arrayHalfDivide(); int currMod = clacFastModExponentation(base) % MOD_VALUE; sumMod *= (currMod * currMod) % MOD_VALUE; return sumMod % MOD_VALUE; } int main() { int base; scanf(\"%d\", \u0026base); char ch; while ((ch = getchar()) \u0026\u0026 ch != ']') { if (ch \u003e= '0' \u0026\u0026 ch \u003c= '9') { array[size++] = ch - '0'; count++; } } printf(\"%d\\n\", clacFastModExponentation(base)); return 0; } ","date":"2021-12-17","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/:7:0","tags":["算法学习","卜东坡-算法设计与分析","分治"],"title":"卜东坡算法-2021秋作业1-分治","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/"},{"categories":["问题总结"],"content":"1.ModuleNotFoundError: No module named ‘_lzma’ ","date":"2021-10-05","objectID":"/posts/technology/pytorch/:1:0","tags":["pytorch"],"title":"pytorch使用问题","uri":"/posts/technology/pytorch/"},{"categories":["问题总结"],"content":"Ubuntu (1)安装依赖 apt-get install liblzma-dev -y pip install backports.lzma (2)打开lzma.py vim ~/a/b/python3.7/lzma.py (3)修改代码 #修改前 from _lzma import * from _lzma import _encode_filter_properties, _decode_filter_properties #修改后 try: from _lzma import * from _lzma import _encode_filter_properties, _decode_filter_properties except ImportError: from backports.lzma import * from backports.lzma import _encode_filter_properties, _decode_filter_properties ","date":"2021-10-05","objectID":"/posts/technology/pytorch/:1:1","tags":["pytorch"],"title":"pytorch使用问题","uri":"/posts/technology/pytorch/"},{"categories":["教程"],"content":"安装Latex ","date":"2021-10-05","objectID":"/posts/technology/latex/:1:0","tags":["latex"],"title":"安装latex","uri":"/posts/technology/latex/"},{"categories":["教程"],"content":"Windows WSL (1)安装WSL 配置WSL wsl --install 安装WSL-Ubuntu 18.04 wsl --install -d Ubuntu-18.04 #等待安装完成 启动Ubuntu wsl bash (2)安装TexLive 在线安装 sudo apt install texlive-full 装载Tex的ISO镜像安装 sudo mkdir /mnt/img sudo mount -t drvfs G: /mnt/img sudo mnt/img/install-tl (3)配置环境变量使得powershell上可以直接使用 sudo /usr/local/texlive/2020/bin/x86_64-linux/tlmgr path add (4)配置WSL使用windows字体 sudo apt install fontconfig 创建/etc/fonts/local.conf \u003c?xml version=\"1.0\"?\u003e \u003c!DOCTYPE fontconfig SYSTEM \"fonts.dtd\"\u003e \u003cfontconfig\u003e \u003cdir\u003e/mnt/c/Windows/Fonts\u003c/dir\u003e \u003c/fontconfig\u003e ","date":"2021-10-05","objectID":"/posts/technology/latex/:1:1","tags":["latex"],"title":"安装latex","uri":"/posts/technology/latex/"},{"categories":["教程"],"content":"Mongodb安装 (1)导入公匙 wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add - (2)创建mongodb列表文件 echo \"deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/5.0 multiverse\" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list (3)重新加载包数据 sudo apt-get update (4)重新加载包数据 sudo apt-get install -y mongodb-org=5.0.2 mongodb-org-database=5.0.2 mongodb-org-server=5.0.2 mongodb-org-shell=5.0.2 mongodb-org-mongos=5.0.2 mongodb-org-tools=5.0.2 (5)服务启动 sudo systemctl start mongod Mongodb配置修改 (1)打开配置 sudo vim /etc/mongod.conf (2)修改配置 # mongod.conf # for documentation of all options, see: # http://docs.mongodb.org/manual/reference/configuration-options/ # Where and how to store data. storage: dbPath: /var/lib/mongodb journal: enabled: true # engine: # wiredTiger: # where to write logging data. systemLog: destination: file logAppend: true path: /var/log/mongodb/mongod.log # network interfaces net: port: 10095 bindIp: 0.0.0.0 # how the process runs processManagement: timeZoneInfo: /usr/share/zoneinfo # 登录是否需要密码 #security: # authorization: enabled #operationProfiling: #replication: #sharding: ## Enterprise-Only Options: Mongodb添加用户 (1)连接Mongodb mongo mongodb://127.0.0.1:10095 (2)创建普通用户 use Production db.createUser( { user: \"production\", pwd: \"production@123\", // passwordPrompt() Or \"\u003ccleartext password\u003e\" roles: [ \"readWrite\", \"dbAdmin\" ] } ) (3)创建超级用户 use admin db.createUser( { user: \"mongoAdmin\", pwd: passwordPrompt(), // passwordPrompt() Or \"\u003ccleartext password\u003e\" roles: [ \"readWriteAnyDatabase\", \"userAdminAnyDatabase\", \"dbAdminAnyDatabase\"] } ) (4)登录 db.auth(\"production\") Mongodb更新用户权限 (1)连接Mongodb mongo mongodb://127.0.0.1:10095 (2)更新用户权限 use Production # 更新用户权限 db.updateUser(\"production\",{roles : [{\"role\" : \"readWriteAnyDatabase\",\"db\" : \"Stock\"},{\"role\" : \"dbAdminAnyDatabase\",\"db\" : \"Stock\"}]}) readWriteAnyDatabase ","date":"2021-09-16","objectID":"/posts/technology/mongodb/:0:0","tags":["MongoDB"],"title":"Mongodb总结","uri":"/posts/technology/mongodb/"},{"categories":["问题总结"],"content":"7.apt重新配置 (1)修复Python 当前的系统python如果有错误了,也需要一起修复,这个版本的python不能随便的更改,需要从一个正常的linux系统下把python复制出来。 # 版本正常的python3.6 mkdir python3.6 cd python3.6 mkdir python3.6-lib mkdir python3-lib mkdir x86_64-linux-gnu cp -rf /usr/bin/python3.6* ~/python3.6 cp -rf /usr/lib/python3.6/* ~/python3.6/python3.6-lib cp -rf /usr/lib/python3/* ~/python3.6/python3-lib cp -rf /usr/lib/x86_64-linux-gnu/*apt* ~/x86_64-linux-gnu/ cd .. tar zcvf python3.6.tar.gz python3.6 scp python3.6.tar.gz user@localhost:~ # 待修复的linux主机 tar zxvf python3.6.tar.gz cd python3.6 sudo cp -rf python3.6 /usr/bin sudo cp -rf python3.6m /usr/bin sudo cp -rf python3.6-lib/* /usr/lib/python3.6 sudo cp -rf python3-lib/* /usr/lib/python3 (2)修复动态库 dpkg -l apt 其中版本是2.0.2ubuntu0.2,下载对应的安装包并安装: # 安装apt wget http://mirrors.edge.kernel.org/ubuntu/pool/main/a/apt/apt_2.0.2ubuntu0.2_amd64.deb sudo dpkg -i apt_2.0.2ubuntu0.2_amd64.deb # 有时候提示缺少libapt-pkg6.0.so # 安装apt-pkg依赖 wget http://mirrors.edge.kernel.org/ubuntu/pool/main/a/apt/libapt-pkg6.0_2.0.2ubuntu0.2_amd64.deb sudo dpkg -i libapt-pkg6.0_2.0.2ubuntu0.2_amd64.deb (3)测试apt sudo apt update ","date":"2021-09-16","objectID":"/posts/technology/apt/:1:0","tags":["踩坑"],"title":"apt重新安装配置","uri":"/posts/technology/apt/"},{"categories":["问题总结"],"content":"Python 相关问题 ","date":"2021-09-16","objectID":"/posts/technology/python/:1:0","tags":["踩坑","python"],"title":"python总结","uri":"/posts/technology/python/"},{"categories":["问题总结"],"content":"Python ImportError: No module named _bz2 sudo apt-get install libbz2-dev #重新编译Python ","date":"2021-09-16","objectID":"/posts/technology/python/:1:1","tags":["踩坑","python"],"title":"python总结","uri":"/posts/technology/python/"},{"categories":["问题总结"],"content":"ImportError: Missing optional dependency ‘openpyxl’ pip install openpyxl #重新编译Python ","date":"2021-09-16","objectID":"/posts/technology/python/:1:2","tags":["踩坑","python"],"title":"python总结","uri":"/posts/technology/python/"},{"categories":["问题总结"],"content":"重置linux的python unset PYTHONHOME unset PYTHONPATH ","date":"2021-09-16","objectID":"/posts/technology/python/:1:3","tags":["踩坑","python"],"title":"python总结","uri":"/posts/technology/python/"},{"categories":["问题总结"],"content":"安装pip 下载get-pip.py wget https://bootstrap.pypa.io/get-pip.py 安装pip python get-pip.py ","date":"2021-09-16","objectID":"/posts/technology/python/:1:4","tags":["踩坑","python"],"title":"python总结","uri":"/posts/technology/python/"},{"categories":["教程"],"content":"Linux ","date":"2021-09-16","objectID":"/posts/technology/system/:0:0","tags":["linux","windows"],"title":"系统配置和问题","uri":"/posts/technology/system/"},{"categories":["教程"],"content":"/usr/bin/dpkg returned an error code (1) ","date":"2021-09-16","objectID":"/posts/technology/system/:1:0","tags":["linux","windows"],"title":"系统配置和问题","uri":"/posts/technology/system/"},{"categories":["教程"],"content":"解决dpkg错误 cd /var/lib/dpkg sudo mv info info.baksudo mkdir info ","date":"2021-09-16","objectID":"/posts/technology/system/:1:1","tags":["linux","windows"],"title":"系统配置和问题","uri":"/posts/technology/system/"},{"categories":["教程"],"content":"添加用户名和添加sudo ","date":"2021-09-16","objectID":"/posts/technology/system/:2:0","tags":["linux","windows"],"title":"系统配置和问题","uri":"/posts/technology/system/"},{"categories":["教程"],"content":"添加用户名 sudo useradd -m -d /data/username -s /bin/zsh username ","date":"2021-09-16","objectID":"/posts/technology/system/:2:1","tags":["linux","windows"],"title":"系统配置和问题","uri":"/posts/technology/system/"},{"categories":["教程"],"content":"修改密码 sudo passwd username ","date":"2021-09-16","objectID":"/posts/technology/system/:2:2","tags":["linux","windows"],"title":"系统配置和问题","uri":"/posts/technology/system/"},{"categories":["教程"],"content":"添加sudoers vi /etc/sudoers #添加用户 username ALL=(ALL:ALL) ALL ","date":"2021-09-16","objectID":"/posts/technology/system/:2:3","tags":["linux","windows"],"title":"系统配置和问题","uri":"/posts/technology/system/"},{"categories":["教程"],"content":"Ubuntu安装Linux开发包 sudo apt-get install build-essential ","date":"2021-09-16","objectID":"/posts/technology/system/:3:0","tags":["linux","windows"],"title":"系统配置和问题","uri":"/posts/technology/system/"},{"categories":["教程"],"content":"根据关键字把进程杀掉 kill -9 $(ps -ef|grep keyword|gawk '$0 !~/grep/ {print $2}' |tr -s '\\n' ' ') ","date":"2021-09-16","objectID":"/posts/technology/system/:4:0","tags":["linux","windows"],"title":"系统配置和问题","uri":"/posts/technology/system/"},{"categories":["教程"],"content":"linux永久挂载硬盘 查看当前的硬盘状态,可以知道硬盘的分区 sudo fdisk -l 修改配置 sudo vim /etc/fstab # 添加如下信息挂载硬盘 /dev/sdb1 /mnt/data ntfs-3g defaults 0 0 挂载硬盘 mkdir -p /mnt/data sudo mount -a ","date":"2021-09-16","objectID":"/posts/technology/system/:5:0","tags":["linux","windows"],"title":"系统配置和问题","uri":"/posts/technology/system/"},{"categories":["教程"],"content":"linux开机自启动并服务化 ","date":"2021-09-16","objectID":"/posts/technology/system/:6:0","tags":["linux","windows"],"title":"系统配置和问题","uri":"/posts/technology/system/"},{"categories":["教程"],"content":"Ubuntu 开机启动 系统服务化(以qbittorrent服务化为例) 不要在后面添加#的注释,不然会导致未知错误 配置文件/lib/systemd/system/qbittorrent.service [Unit] Description=qbittorrent-nox service #服务描述 Documentation=man:qbittorrent-nox(1) [Service] User=username #用户 Group=usergroup #用户组 UMask=0000 #权限777 Type=simple #ExecStartPre=-cd /home/\u003cspan class=\"hljs-built_in\"\u003etest\u003c/span\u003e/ #启动前执行 #WorkingDirectory=/home/\u003cspan class=\"hljs-built_in\"\u003etest\u003c/span\u003e/ #工作目录 ExecStart=/usr/bin/qbittorrent-nox #启动时执行 ExecReload=/bin/kill -SIGHUP $MAINPID #重启时执行 ExecStop=/bin/kill -SIGINT $MAINPID #停止时执行 [Install] WantedBy=default.target 服务常用命令集合 # 开机启动 systemctl enable qbittorrent # 关闭开机启动 systemctl disable qbittorrent # 启动服务 systemctl start qbittorrent # 停止服务 systemctl stop qbittorrent # 重启服务 systemctl restart qbittorrent # 查看服务状态 systemctl status qbittorrent systemctl is-active sshd.service # 结束服务进程(服务无法停止时) systemctl kill qbittorrent 用户服务化(以v2ray服务化为例,不需要sudo也可以启动,在某个用户登录的时候启动) 不要在后面添加#的注释,不然会导致未知错误 配置文件~/.config/systemd/user/v2ray.service``` [Unit] Description=keep v2ray's servie alive [Service] Type=simple Restart=always WorkingDirectory=~/v2ray/ ExecStart=bash v2ray.sh SystemCallArchitectures=native MemoryDenyWriteExecute=true NoNewPrivileges=true [Install] WantedBy=default.target 启动服务在原来的基础上加--user ```bash # 开机启动 systemctl --user enable --now v2ray # 关闭开机启动 systemctl --user disable --now v2ray ","date":"2021-09-16","objectID":"/posts/technology/system/:6:1","tags":["linux","windows"],"title":"系统配置和问题","uri":"/posts/technology/system/"},{"categories":["教程"],"content":"linux安装常见中文字体 ","date":"2021-09-16","objectID":"/posts/technology/system/:7:0","tags":["linux","windows"],"title":"系统配置和问题","uri":"/posts/technology/system/"},{"categories":["教程"],"content":"Ubuntu 打包Windows字体 mkdir -p winfonts cp -rf C:/Windows/Fonts winfonts 压缩winfonts为winfonts.zip 上传到linux scp winfonts.zip username@host:~ 安装字体 unzip -n -d /usr/share/fonts winfonts.zip sudo mkfontscale sudo mkfontdir sudo fc-cache -f -v 检查中文字体 fc-list :lang=zh Windows ","date":"2021-09-16","objectID":"/posts/technology/system/:7:1","tags":["linux","windows"],"title":"系统配置和问题","uri":"/posts/technology/system/"},{"categories":["教程"],"content":"给Neovim添加右键文件夹、文件以及右键空白区域三种菜单 右键文件夹 添加如下值 计算机\\HKEY_CLASSES_ROOT\\Directory\\shell\\使用Neovim打开 添加Icon 在使用Neovim打开空白处添加字符串项Icon设置值为\"D:\\Program Files\\Neovim\\bin\\gnvim.exe\" 添加打开命令 在使用Neovim打开添加子项command,设置值为\"D:\\Program Files\\Neovim\\bin\\gnvim.exe\" -qwindowgeometry 1310x650+20+20 \"%1\" 右键文件 添加如下值 计算机\\HKEY_CLASSES_ROOT\\*\\shell\\使用Neovim打开 添加Icon 在使用Neovim打开空白处添加字符串项Icon设置值为\"D:\\Program Files\\Neovim\\bin\\gnvim.exe\" 添加打开命令 在使用Neovim打开添加子项command,设置值为\"D:\\Program Files\\Neovim\\bin\\gnvim.exe\" -qwindowgeometry 1310x650+20+20 \"%1\" 右键文件 添加如下值 计算机\\HKEY_CLASSES_ROOT\\Directory\\Background\\shell\\使用Neovim打开 添加Icon 在使用Neovim打开空白处添加字符串项Icon设置值为\"D:\\Program Files\\Neovim\\bin\\gnvim.exe\" 添加打开命令 在使用Neovim打开添加子项command,设置值为\"D:\\Program Files\\Neovim\\bin\\gnvim.exe\" 参考文档 使用注册表编辑win10鼠标右键菜单,详细解释(右键文件夹、文件以及右键空白区域下三种情况)_鸾镜朱颜暗换的博客-CSDN博客_桌面右键菜单注册表 contextmenu - How add context menu item to Windows Explorer for folders - Stack Overflow ","date":"2021-09-16","objectID":"/posts/technology/system/:8:0","tags":["linux","windows"],"title":"系统配置和问题","uri":"/posts/technology/system/"},{"categories":["项目"],"content":"1.安装selenium ","date":"2021-08-30","objectID":"/posts/projects/resume_parser/:1:0","tags":["简历解析"],"title":"简历解析软件安装","uri":"/posts/projects/resume_parser/"},{"categories":["项目"],"content":"chrome安装 sudo apt-get install libxss1 libappindicator1 libindicator7 wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb sudo dpkg -i ./google-chrome*.deb sudo apt-get install -f ","date":"2021-08-30","objectID":"/posts/projects/resume_parser/:1:1","tags":["简历解析"],"title":"简历解析软件安装","uri":"/posts/projects/resume_parser/"},{"categories":["项目"],"content":"配置chromedriver (1)下载驱动 去官网下载:http://chromedriver.storage.googleapis.com/index.html 点击 (2)安装驱动 复制到对应的目录运行 ","date":"2021-08-30","objectID":"/posts/projects/resume_parser/:1:2","tags":["简历解析"],"title":"简历解析软件安装","uri":"/posts/projects/resume_parser/"},{"categories":["项目"],"content":"配置selenium pip install selenium ","date":"2021-08-30","objectID":"/posts/projects/resume_parser/:1:3","tags":["简历解析"],"title":"简历解析软件安装","uri":"/posts/projects/resume_parser/"},{"categories":["项目"],"content":"2.安装uwsgi ","date":"2021-08-30","objectID":"/posts/projects/resume_parser/:2:0","tags":["简历解析"],"title":"简历解析软件安装","uri":"/posts/projects/resume_parser/"},{"categories":["项目"],"content":"配置文件uwsgi.ini #uwsgi.ini [uwsgi] http = 0.0.0.0:8010 chdir = /home/jianli/resume_service/services pythonpath = /home/jianli/venv/bin/python wsgi-file = resume_parser.py buffer-size = 40960 callable = app processes = 1 stats = 127.0.0.1:9191 ","date":"2021-08-30","objectID":"/posts/projects/resume_parser/:2:1","tags":["简历解析"],"title":"简历解析软件安装","uri":"/posts/projects/resume_parser/"},{"categories":["项目"],"content":"安装和运行uwsgi pip install uwsgi uwsgi uwsgi.ini ","date":"2021-08-30","objectID":"/posts/projects/resume_parser/:2:2","tags":["简历解析"],"title":"简历解析软件安装","uri":"/posts/projects/resume_parser/"},{"categories":["项目"],"content":"3.安装supervisor ","date":"2021-08-30","objectID":"/posts/projects/resume_parser/:3:0","tags":["简历解析"],"title":"简历解析软件安装","uri":"/posts/projects/resume_parser/"},{"categories":["项目"],"content":"配置supervisor http://supervisord.org/installing.html pip install supervisor echo_supervisord_conf \u003e supervisord.conf supervisord -c supervisor.conf ","date":"2021-08-30","objectID":"/posts/projects/resume_parser/:3:1","tags":["简历解析"],"title":"简历解析软件安装","uri":"/posts/projects/resume_parser/"},{"categories":["项目"],"content":"启动停止supervisor supervisorctl update 重新加载配置 supervisorctl reload 重新启动所有程序 supervisorctl status 查看状态 ","date":"2021-08-30","objectID":"/posts/projects/resume_parser/:3:2","tags":["简历解析"],"title":"简历解析软件安装","uri":"/posts/projects/resume_parser/"},{"categories":["项目"],"content":"supervisor问题 1.supervisorctl出现http://localhost:9001 refused connection 设置serverurl: [supervisorctl] serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket ;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket ;username=chris ; should be same as http_username if set ;password=123 ; should be same as http_password if set ;prompt=mysupervisor ; cmd line prompt (default \"supervisor\") ;history_file=~/.sc_history ; use readline history if availabl 2.supervisord配置uwsgi后,调用接口会启动新的服务 重新设置uwsgi如下: [uwsgi] http = 0.0.0.0:8010 virtualenv = /home/jianli/venv wsgi-file = /home/jianli/resume_service/services/resume_parser.py buffer-size = 40960 callable = app processes = 1 thread = 1 ","date":"2021-08-30","objectID":"/posts/projects/resume_parser/:3:3","tags":["简历解析"],"title":"简历解析软件安装","uri":"/posts/projects/resume_parser/"},{"categories":["项目"],"content":"4.安装libreoffice ","date":"2021-08-30","objectID":"/posts/projects/resume_parser/:4:0","tags":["简历解析"],"title":"简历解析软件安装","uri":"/posts/projects/resume_parser/"},{"categories":["项目"],"content":"下载安装 wget https://mirrors.cloud.tencent.com/libreoffice/libreoffice/stable/7.1.5/deb/x86_64/LibreOffice_7.1.5_Linux_x86-64_deb.tar.gz (安装说明)[https://zh-cn.libreoffice.org/get-help/install-howto/] ","date":"2021-08-30","objectID":"/posts/projects/resume_parser/:4:1","tags":["简历解析"],"title":"简历解析软件安装","uri":"/posts/projects/resume_parser/"},{"categories":["项目"],"content":"字体安装 wget https://mirrors.tuna.tsinghua.edu.cn/adobe-fonts/source-han-serif/SubsetOTF/SourceHanSerifCN.zip wget https://mirrors.tuna.tsinghua.edu.cn/adobe-fonts/source-han-sans/SubsetOTF/CN/SourceHanSansCN-Bold.otf wget https://mirrors.tuna.tsinghua.edu.cn/adobe-fonts/source-han-sans/SubsetOTF/CN/SourceHanSansCN-ExtraLight.otf wget https://mirrors.tuna.tsinghua.edu.cn/adobe-fonts/source-han-sans/SubsetOTF/CN/SourceHanSansCN-Heavy.otf wget https://mirrors.tuna.tsinghua.edu.cn/adobe-fonts/source-han-sans/SubsetOTF/CN/SourceHanSansCN-Light.otf wget https://mirrors.tuna.tsinghua.edu.cn/adobe-fonts/source-han-sans/SubsetOTF/CN/SourceHanSansCN-Medium.otf wget https://mirrors.tuna.tsinghua.edu.cn/adobe-fonts/source-han-sans/SubsetOTF/CN/SourceHanSansCN-Normal.otf wget https://mirrors.tuna.tsinghua.edu.cn/adobe-fonts/source-han-sans/SubsetOTF/CN/SourceHanSansCN-Regular.otf unzip SourceHanSerifCN.zip mv SourceHanSerifCN SourceHan mv *.otf SourceHan sudo mv SourceHan /usr/share/fonts mkfontscale fc-cache -fv # 如果提示 fc-cache: command not found # 在Ubuntu下运行如下命令 # sudo apt-get install fontconfig # 在cent os下运行如下命令 # yum install fontconfig ","date":"2021-08-30","objectID":"/posts/projects/resume_parser/:4:2","tags":["简历解析"],"title":"简历解析软件安装","uri":"/posts/projects/resume_parser/"},{"categories":["教程"],"content":"Ubuntu UFW 配置 (1)查看ufw信息 sudo ufw status (2)激活ufw sudo ufw enable (3)阻止/允许IP # 允许IP sudo ufw allow from 203.0.113.101 # 阻止IP sudo ufw deny from 203.0.113.100 (3)阻止/允许port # 允许外部访问端口8080 sudo ufw allow 8080 # 允许某ip访问端口8080 sudo ufw allow from 203.0.113.101 to any port 8080 # 阻止外部访问端口8080 sudo ufw disable 8080 # 阻止某ip访问端口8080 sudo ufw deny from 203.0.113.101 to any port 8080 (4)阻止/允许ssh # 允许 sudo ufw allow OpenSSH # 阻止 sudo ufw disable OpenSSH (5)查看支持的APP,并阻止/允许 sudo ufw app list | grep Nginx #Output Nginx Full Nginx HTTP Nginx HTTPS 删除NginxFull #允许 sudo ufw allow \"Nginx Full\" #阻止 sudo ufw deny \"Nginx Full\" (6)删除规则 先查看规则 sudo ufw status 选择对应的规则删除,例如第二个规则 sudo ufw delete 2 直接根据规则来删除 sudo ufw allow from 203.0.113.101 to any port 8080 sudo ufw delete allow from 203.0.113.101 to any port 8080 ","date":"2021-08-30","objectID":"/posts/technology/ufw_config/:0:1","tags":["ufw","firewall"],"title":"配置ufw","uri":"/posts/technology/ufw_config/"},{"categories":null,"content":"📚Blog Hi,你好这是我的个人网站。 ","date":"2021-07-29","objectID":"/about/:1:0","tags":null,"title":"关于","uri":"/about/"},{"categories":["项目"],"content":"更新历史 2021-08-01 1.修复九宫拼音不支持简拼的情况,如输入xqw不显示结果。 2.四叶草拼音去除25258个重复的词组,只保留最高频次的词组 ./Clover四叶草拼音/clover.phrase.dict.yaml:成事在人 cheng shi zai ren 22846 ./Clover四叶草拼音/THUOCL_chengyu.dict.yaml:成事在人 cheng shi zai ren 21 如上所示,成事在人,在两个字典中都有频次,只保留clover.phrase.dict.yaml中22846频次的词组 3.更新四叶草拼音拼音错误,例如反弹拼音为fandan,错误修复来源@wisim,感谢@spphinslove的反馈 4.四叶草拼音-汉字帧-拼音错误修改,把帧错误拼音zheng相关的词组全部修改为帧zhen 修改费时费力,不易,请大家多多支持,点击支持。 2021-07-29 1.添加九宫格支持隐藏 2.添加常用功能说明 2021-06-27 1.更新同文3.2.0支持 2.修复小鹤双拼简繁转换问题 3.自然码支持简繁转换问题 注:简繁转换属于opencc的内容,和同文没有关系,odc2文件是opencc的生成结果。 2021-06-23 1.增加自然码双拼,没有辅助码 2021-06-03 1.修正郑码字典显示错误https://github.com/SivanLaai/rime_pure/issues/25 2.默认所有方案不显示字符和表情包 2021-02-07 1.增加qq五笔 2.增加笔画输入@HarryWang29 3.增加九宫格双拼 2020-12-17 1.修正拼音自定义添加造词的功能 2020-12-5(更新,增加徐码、郑码,支持拼音和五笔反查,增加全键盘的符号键盘) 1.优化小鹤双拼方案,双拼支持拼音“`”反查小鹤双拼编码 2.增加徐码 3.徐码支持五笔“`”反查编码 4.徐码支持拼音“`”反查编码 5.增加郑码 6.郑码支持拼音“`”反查编码 7.手机同文,全键盘的符号键盘,调整回车键大小,调整符号键大小,更符合手机端操作 2020-10-31 1.新增双拼输入方案支持-小鹤双拼 2.所有输入方案配置支持繁简转换、中英转换、字符输入、emoji表情、全半角转换 3.调整键盘布局,超大空格,减少误触 4.增加同文优化版皮肤 2020-10-27 1.新增讯飞皮肤 2.更新部分细节 3.增加小鹤九宫双拼 2020-10-25 1.去除了明月拼音,添加了以搜狗为基础的输入方案——🍀️四叶草简体拼音 2.以🍀️四叶草简体拼音为基础,添加了四叶草九宫输入方案,方便在手机端可以使用 3.同文手机端添加了两款机械键盘主题,cherry机械键盘/罗技 4.四叶草拼音输入法在手机端支持简繁转有一些问题,原因是没有正确配置opencc,修改后手机端支持简繁转换 5.极品五笔方案增加支持字符(输入平方可以选择²),emoji表情,繁简转换 6.支持五笔反查 ","date":"2021-07-29","objectID":"/posts/projects/rime/update_history/:1:0","tags":["rime"],"title":"Rime更新历史","uri":"/posts/projects/rime/update_history/"},{"categories":["rime","项目"],"content":"不看下面的繁索的安装直接去发布页面下载已编译版本 最新发布页面 ","date":"2021-07-29","objectID":"/posts/projects/rime/installation/:1:0","tags":["rime"],"title":"Rime安装说明","uri":"/posts/projects/rime/installation/"},{"categories":["rime","项目"],"content":"小狼毫(PC端) 0.备份小狼毫输入法安装目录的data文件夹,备份~\\AppData\\Rime文件夹,下载小狼毫安装包:https://rime.im/ 1.文件夹weasel\\data内所有文件复制到小狼毫输入法data目录覆盖 2.文件夹weasel\\Rime内所有文件复制到~\\AppData\\Rime目录覆盖 3.文件夹schemes\\基础文件内所有文件复制到~\\AppData\\Rime目录覆盖 4.方案安装(可选) 4.1 拼音方案安装 文件夹schemes\\Clover四叶草拼音内所有文件复制到~\\AppData\\Rime目录覆盖 4.2 五笔方案安装(五笔反查依赖拼音词库,需先安装4.1拼音方案) 文件夹schemes\\极点五笔内所有文件复制到~\\AppData\\Rime目录覆盖 4.3 双拼方案安装(双拼反查依赖拼音词库,需先安装4.1拼音方案) 文件夹schemes\\小鹤双拼内所有文件复制到~\\AppData\\Rime目录覆盖 4.4 郑码方案安装(反查依赖拼音词库,需先安装4.1拼音方案) 文件夹schemes\\郑码内所有文件复制到~\\AppData\\Rime目录覆盖 4.5 徐码方案安装(反查依赖拼音和五笔词库,需先安装4.1拼音方案和4.2五笔方案) 文件夹schemes\\徐码内所有文件复制到~\\AppData\\Rime目录覆盖 4.6 QQ五笔方案安装(反查依赖拼音词库,需先安装4.1拼音方案) 文件夹schemes\\QQ五笔内所有文件复制到~\\AppData\\Rime目录覆盖 4.7 自然码双拼方案安装(依赖拼音词库,需先安装4.1拼音方案) 文件夹schemes\\自然码双拼内所有文件复制到~\\AppData\\Rime目录覆盖 4.8 四叶草地球拼音方案安装(依赖拼音词库,需先安装4.1拼音方案) 文件夹schemes\\四叶草地球拼音内所有文件复制到~\\AppData\\Rime目录覆盖 5.重新部署 ","date":"2021-07-29","objectID":"/posts/projects/rime/installation/:2:0","tags":["rime"],"title":"Rime安装说明","uri":"/posts/projects/rime/installation/"},{"categories":["rime","项目"],"content":"同文(安卓端) 0.备份sdcard\\rime文件夹,下载同文apk:https://github.com/osfans/trime/releases 1.文件夹trime\\rime内所有文件复制到sdcard\\rime目录覆盖 2.文件夹schemes\\基础文件内所有文件复制到sdcard\\rime目录覆盖 3.方案安装(可选) 3.1 拼音方案安装 文件夹schemes\\Clover四叶草拼音内所有文件复制到sdcard\\rime目录覆盖 3.2 九宫拼音方案安装(依赖词库,必须先安装3.1,九宫不能显示,检查第一步是否正确安装) 文件夹schemes\\Clover四叶草九宫拼音内所有文件复制到sdcard\\rime目录覆盖 3.3 五笔方案安装(五笔反查依赖拼音词库,需先安装3.1拼音方案) 文件夹schemes\\极点五笔内所有文件复制到sdcard\\rime目录覆盖 3.4 双拼方案安装(双拼反查依赖拼音词库,需先安装3.1拼音方案) 文件夹schemes\\小鹤双拼内所有文件复制到sdcard\\rime目录覆盖 3.5 郑码方案安装(反查依赖拼音词库,需先安装3.1拼音方案) 文件夹schemes\\郑码内所有文件复制到sdcard\\rime目录覆盖 3.6 徐码方案安装(反查依赖拼音和五笔词库,需先安装3.1拼音方案和3.3五笔方案) 文件夹schemes\\徐码内所有文件复制到sdcard\\rime目录覆盖 3.7 QQ五笔方案安装(反查依赖拼音词库,需先安装3.1拼音方案) 文件夹schemes\\QQ五笔内所有文件复制到sdcard\\rime目录覆盖 3.8 自然码双拼方案安装(依赖拼音词库,需先安装3.1拼音方案) 文件夹schemes\\自然码双拼内所有文件复制到sdcard\\rime目录覆盖 3.9 四叶草地球拼音方案安装(依赖拼音词库,需先安装3.1拼音方案) 文件夹schemes\\四叶草地球拼音内所有文件复制到sdcard\\rime目录覆盖 4.重新部署 ","date":"2021-07-29","objectID":"/posts/projects/rime/installation/:3:0","tags":["rime"],"title":"Rime安装说明","uri":"/posts/projects/rime/installation/"},{"categories":["项目"],"content":"【rime 小狼毫\\trime 同文】手机/PC一站式配置【简约皮肤\\拼音搜狗词库\\原创trime同文 四叶草九宫格拼音\\四叶草拼音\\小鹤双拼\\极品五笔\\QQ五笔\\徐码\\郑码】 ","date":"2021-07-29","objectID":"/posts/projects/rime/info/:1:0","tags":["rime","输入法"],"title":"Rime输入法介绍","uri":"/posts/projects/rime/info/"},{"categories":["项目"],"content":"说明 rime是一款支持多平台的开源输入法,开源所以不需要担心自己的输入数据被输入法所搜集。虽然优点这么多,但是要使得输入法好用起来门槛比较高了,主要是在词库配置优化,依赖的东西多而且复杂。本项目的目的在于安卓手机端和Win pc端都可以从本项目一站配置好rime输入法,达到省心好用的程度。鉴于PC端已经有很多大神有现成的设置,所以花的时间较少,主要是整理收集。 发现手机端的优化一直没有做的较好的优化,本次主要的工作量是在手机端,所以从资源收集、皮肤设计、全键盘按钮设计和九宫格按键设计的每一个过程很耗费时间,有很多细节需要调整不断的修改文件和部署,有些地方不是清楚配置的地方还需要去看源码,经过一周的优化和设置,手机端已经使用起来很顺畅了。 目前在手机端配置了基于四叶草拼音的九宫格输入法,为了表示对原作者的劳动致敬,遂命名为四叶草九宫方案,感觉已经和之前使用的百度或者讯飞输入法感觉相当。 enjoy it! 好用的话就点个赞。感谢你的使用,因为本人同时在安卓和windows端使用,所以会一直更新。 ","date":"2021-07-29","objectID":"/posts/projects/rime/info/:2:0","tags":["rime","输入法"],"title":"Rime输入法介绍","uri":"/posts/projects/rime/info/"},{"categories":["项目"],"content":"QQ群 ","date":"2021-07-29","objectID":"/posts/projects/rime/info/:3:0","tags":["rime","输入法"],"title":"Rime输入法介绍","uri":"/posts/projects/rime/info/"},{"categories":["项目"],"content":"包含输入方案 - 🍀️四叶草拼音九宫格(不再使用原来的词库,原来的词库有很多问题,现在只是保留名字。) - 四叶草地球拼音 - 极点五笔 - 小鹤双拼 - 🍀️四叶草简体拼音 - 大写数字 - 自然双拼 - QQ86五笔(提取自qq五笔输入法,词库较为合理,推荐使用也是本人在使用的方案) - 徐码 - 郑码 ","date":"2021-07-29","objectID":"/posts/projects/rime/info/:4:0","tags":["rime","输入法"],"title":"Rime输入法介绍","uri":"/posts/projects/rime/info/"},{"categories":["项目"],"content":"实用功能: ","date":"2021-07-29","objectID":"/posts/projects/rime/info/:5:0","tags":["rime","输入法"],"title":"Rime输入法介绍","uri":"/posts/projects/rime/info/"},{"categories":["项目"],"content":"同文端 隐藏输入法:全键盘状态下按键G向下滑,九宫格状态下按分词键向下滑 编辑功能:全键盘状态下长按G,九宫格状态下按编辑键,可实现复制粘贴拷贝等功能 清空文本:删除键向左滑会清空当前编辑文本 切换主题:全键盘状态进入设置切换,九宫格长按带❖的按键切换主题 切换输入法:长按带✎的按键切换输入方案 设置:全键盘状态下按?123键下滑,九宫格状态下按带设置符号⚙的按键,既可进入设置页面 表情\\符号功能板:全键盘状态下长按?123键,九宫格状态下按符键 剪切板:全键盘状态下长按V键,九宫格状态下长按符键 ","date":"2021-07-29","objectID":"/posts/projects/rime/info/:5:1","tags":["rime","输入法"],"title":"Rime输入法介绍","uri":"/posts/projects/rime/info/"},{"categories":["项目"],"content":"预览: ","date":"2021-07-29","objectID":"/posts/projects/rime/info/:6:0","tags":["rime","输入法"],"title":"Rime输入法介绍","uri":"/posts/projects/rime/info/"},{"categories":["项目"],"content":"同文输入法(安卓端) 表情\\剪切板\\符号功能板 历史记录栏 剪切板 表情包 🍀️四叶草九宫输入方案 手机端支持简繁转换 部分皮肤预览 同文风优化版[配色:SivanLaai,键盘布局:SivanLaai] 讯飞默认皮肤[配色:SivanLaai,键盘布局:SivanLaai] cherry机械键盘【小先生】 极致简约[配色:SivanLaai,键盘布局:SivanLaai] 五笔字根【佚名】 炫彩[键盘布局:SivanLaai] ","date":"2021-07-29","objectID":"/posts/projects/rime/info/:6:1","tags":["rime","输入法"],"title":"Rime输入法介绍","uri":"/posts/projects/rime/info/"},{"categories":["项目"],"content":"小狼毫输入法(PC端) 简约现代蓝[配色:XNOM] 绿野仙踪绿[配色:佛振] Aqua[配色:佛振] 安卓[配色:Patricivs] 暗堂[配色:佛振] 孤寺[配色佛振] ","date":"2021-07-29","objectID":"/posts/projects/rime/info/:6:2","tags":["rime","输入法"],"title":"Rime输入法介绍","uri":"/posts/projects/rime/info/"},{"categories":["项目"],"content":"安装方法 查看安装方法 ","date":"2021-07-29","objectID":"/posts/projects/rime/info/:7:0","tags":["rime","输入法"],"title":"Rime输入法介绍","uri":"/posts/projects/rime/info/"},{"categories":["项目"],"content":"更新历史 2022-12-30 - 1.移除九宫模式下ascii模式的切换 - 2.优化九宫数字键盘布局 ![](https://cdn.staticaly.com/gh/SivanLaai/image-store-rep@master/note/ 20221230200634.png) 2022-11-4 - 1.优化四叶草拼音的基础词库为华宇输入法词库@warm-ice0x00(不再使用原来的词库,原来的词库有很多问题。) 2022-3-19 - 1.调整剪切板功能快捷方式 - 2.qq86五笔用户词添加不成功修复 2021-10-26 - 1.修复3.2.3所引入的键盘显示问题 - 2.调整键盘的符号页面,详情查看同文功能页面 - 3.调整数字页面为更加符合操作的九宫格数字页面 - 4.输入键盘快速跳转符号剪切栏 2021-10-20 - 1.四叶草拼音的权重调整为最大概率保留,同时是以词组进行切割的,例如弹出如果是分词的话就是tanchu,不会再出现danchu的拼音,如果弹出不是一个完整的分词那拼音可能是按单个字保留拼音的最大概率。主要改动在src/GenerateCloverData.py。 - 2.四叶草简体支持符号输入优化,/fh可以查看当前的符号,/jq可以查看所有的节气 - 3.四叶草简体支持笔画反查(`后输入hspnz分别表示一丨丿丶乙) 2021-10-17 - 1.修复同文端繁简转换opencc资源文件为最新的ocd2,小狼毫端暂时不支持ocd2。 2021-10-14 - 1.同步更新同文官方支持的剪切板功能,可以查看剪切板和最近表情包历史,使用更为灵活的符号菜单。 2021-09-01 - 1.前前后后、零零碎碎一共花了十来天地时间完成基于四叶草词库的地球拼音输入方案。 2021-08-30 - 1.四叶草支持多音字,最大程序的避免拼音错误,同时是以词组来分词的所以,不至于对所有的词组进行挨个多音字支持,而是优先词组。 例如弹出分词后还是弹出,所以只有tan chu的拼音,如果分词为弹\\出的话,则拼音会有tan chu 和 dan chu - 2.四叶草保留最大概率拼音词组,例如是不其中不为多音字,不的拼音有bu和fou,基于四叶草统计概率,bu的拼音概率更高,如果不是在词组的情况下,单字以bu为优先。 2021-08-18 - 1.写爬虫exact-pinyin-mark抓取百度汉语字典35W个组词数据用来精准匹配clover拼音数据。 - 2.使用luna拼音修复clover拼音数据。 - 3.使用phrase-pinyin-data修复clover拼音数据。 - 4.具有更高的基础词库,对于常见的拼音数据具有更高的识别率 2021-08-11 - 1.修复大字典中的的拼音错误。 - 2.基于python-pinyin对所有四叶草字典进行多音字修复,同时单字也支持多音字输入 ``` 例如朝拼chao zhao zhu输入 词频调整chao保留最高,依次递减10倍 例如chao为123,zhao为12,zhu为1 ``` 2021-08-01 - 1.修复九宫拼音不支持简拼的情况,如输入xqw不显示结果。 - 2.四叶草拼音去除25258个重复的词组,只保留最高频次的词组 ``` ./Clover四叶草拼音/clover.phrase.dict.yaml:成事在人 cheng shi zai ren 22846 ./Clover四叶草拼音/THUOCL_chengyu.dict.yaml:成事在人 cheng shi zai ren 21 如上所示,成事在人,在两个字典中都有频次,只保留clover.phrase.dict.yaml中22846频次的词组 ``` - 3.更新四叶草拼音错误,例如反弹拼音为fandan,错误修复来源@wisim,感谢@spphinslove的反馈 - 4.四叶草拼音-汉字帧-拼音错误修改,把帧错误拼音zheng相关的词组全部修改为帧zhen - 修改费时费力,不易,请大家多多支持,点击支持。 2021-07-29 - 1.添加九宫格支持隐藏 - 2.添加常用功能说明 2021-06-27 - 1.更新同文3.2.0支持 - 2.修复小鹤双拼简繁转换问题 - 3.自然码支持简繁转换问题 以往全部历史 ","date":"2021-07-29","objectID":"/posts/projects/rime/info/:8:0","tags":["rime","输入法"],"title":"Rime输入法介绍","uri":"/posts/projects/rime/info/"},{"categories":["项目"],"content":"相关资源 - 小狼毫输入法:https://github.com/rime/weasel - 同文输入法:https://github.com/osfans/trime - 简繁转换opencc:https://github.com/BYVoid/OpenCC - 拼音爬虫exact-pinyin-mark:https://github.com/SivanLaai/exact-pinyin-mark - 部分配色均整理自互联网,配色包含作者信息。 ","date":"2021-07-29","objectID":"/posts/projects/rime/info/:9:0","tags":["rime","输入法"],"title":"Rime输入法介绍","uri":"/posts/projects/rime/info/"},{"categories":["项目"],"content":"感谢 - 感谢@lotem - 感谢trime作者@osfans - 感谢四叶草拼音作者@fkxxyz - 感谢极品五笔作者@KyleBing - 感谢qq五笔@qq五笔 - 感谢opencc作者@BYVoid - 感谢@小鹤双拼 - 感谢@郑码 - 感谢@徐码 - 没有以上资源和各位的辛苦付出,也就没有这个项目 ","date":"2021-07-29","objectID":"/posts/projects/rime/info/:10:0","tags":["rime","输入法"],"title":"Rime输入法介绍","uri":"/posts/projects/rime/info/"},{"categories":["项目"],"content":"💖支持这个项目 如果你正在使用这个项目并感觉良好,或只是想要支持我继续开发,你可以通过如下任意 方式支持我: Star 并 分享这个项目 🚀 通过以下二维码 一次性捐款。 一杯咖啡。🍵 谢谢! ❤️ | 微信 | 支付宝 | | :—: | :—: | | | | ","date":"2021-07-29","objectID":"/posts/projects/rime/info/:11:0","tags":["rime","输入法"],"title":"Rime输入法介绍","uri":"/posts/projects/rime/info/"},{"categories":["项目"],"content":"许可证 MIT Copyright (c) 2020-present SivanLaai ","date":"2021-07-29","objectID":"/posts/projects/rime/info/:12:0","tags":["rime","输入法"],"title":"Rime输入法介绍","uri":"/posts/projects/rime/info/"},{"categories":["技术"],"content":"2020 年的第一篇博文竟然是讲虚拟砖混结构建筑物逾越技术的,感觉有点微妙。 年终总结啊,在写了在写了,明年就发。 因为嫌麻烦,我这几年基本用的都是现成的代理服务(俗称机场)。这样虽然不用担心自己机器 IP 被墙、速度方面基本有保障、节点也多,不过俗话说不要把鸡蛋放在一个篮子里,自建一个代理服务器备用还是很有必要的。 这几年翻墙技术似乎也发展了不少(是吗?),这次我选择的方法是 V2Ray + WebSocket + TLS + CloudFlare 中转:速度不重要,隐蔽性、抗干扰性第一。这么几层裹上去,除非真的掐网线搞大局域网,不然应该还是能撑个一段时间。 正文开始前先提个醒,本文不是小白教程,就是随手记录一下,所以我会假定你有一定的基础知识与操作经验。 ","date":"2020-01-12","objectID":"/posts/technology/lattern/:0:0","tags":["V2Ray"],"title":"搭建备用梯子:V2Ray + WebSocket + TLS + CloudFlare","uri":"/posts/technology/lattern/"},{"categories":["技术"],"content":"1. 安装 V2Ray 除非你是真的小白零经验,或者「能用就好」主义的忠实信奉者,不然我是不推荐你一上来就直接使用网上那些「一键脚本」的。 就算一键脚本再怎么优秀再怎么便利,至少也应该亲自手动操作一次,了解一下大致的流程。如果我想要做某件事,应该进行哪些操作,脚本会替我完成哪些操作,这些自动化操作是不是符合自己的预期(尤其是脚本是其他人写好的情况下),最起码这些东西得心里有数。 脚本写出来就是帮我们自动完成一些繁琐的操作的,其存在当然有意义,不然每台机器上都手动操作一遍过去,不得累死?用肯定是要用,我所不赞成的只是在不了解这个脚本的情况下瞎用。 线上服务器搭建 LNMP 环境时我也经常用 OneinStack 这样的一键包,很方便。而且它的源码我也都看过,很清楚它能干嘛、会干嘛。也知道它自带的 vhost.sh 虚拟主机管理脚本虽然看起来挺友好,但其修改出来的东西经常惨不忍睹,所以服务器上 Nginx 的配置我从来不用它,都是自己管理的。 总的来说就是可以用傻瓜式脚本,但咱也不能真成傻瓜了,对吧。 好了不说废话,来安装 V2Ray。 安装方法有很多,这里就直接用官方提供的脚本: bash \u003c(curl -L -s https://install.direct/go.sh) 脚本会自动安装这些东西: /usr/bin/v2ray/v2ray V2Ray 程序 /usr/bin/v2ray/v2ctl V2Ray 工具 /etc/v2ray/config.json 配置文件 /usr/bin/v2ray/geoip.dat IP 数据文件 /usr/bin/v2ray/geosite.dat 域名数据文件 /etc/systemd/system/v2ray.service Systemd Service /etc/init.d/v2ray SysV 启动脚本 ","date":"2020-01-12","objectID":"/posts/technology/lattern/:1:0","tags":["V2Ray"],"title":"搭建备用梯子:V2Ray + WebSocket + TLS + CloudFlare","uri":"/posts/technology/lattern/"},{"categories":["技术"],"content":"2. 配置 V2Ray 服务端 虽然严格来说 V2Ray 并不分客户端和服务端……反正就是那个意思啦。 编辑配置文件 /etc/v2ray/config.json: { \"inbounds\": [{ \"port\": 10086, // 因为还要用 Nginx 反代,这里直接监听本地就行 \"listen\": \"127.0.0.1\", \"protocol\": \"vmess\", \"settings\": { \"clients\": [ { // 用户 UUID,自己随机弄一个 \"id\": \"23ad6b10-8d1a-40f7-8ad0-e3e35cd38297\", \"level\": 1, \"alterId\": 64 } ] }, \"streamSettings\": { // 指定底层传输方式为 WebSocket \"network\": \"ws\", \"wsSettings\": { // 在哪个路径上提供 WS 服务,可自定义 \"path\": \"/whatever\" } } }], \"outbounds\": [{ \"protocol\": \"freedom\", \"settings\": {} },{ \"protocol\": \"blackhole\", \"settings\": {}, \"tag\": \"blocked\" }], \"routing\": { \"rules\": [ { // 默认规则,禁止访问服务器内网 \"type\": \"field\", \"ip\": [\"geoip:private\"], \"outboundTag\": \"blocked\" } ] } } 上述配置是直接基于默认配置修改的,V2Ray 的配置很灵活,还有很多可以完善的地方。不过配置调优并不是本文的重点,所以这里按下不表,有兴趣可以自行阅读官方文档。 ","date":"2020-01-12","objectID":"/posts/technology/lattern/:2:0","tags":["V2Ray"],"title":"搭建备用梯子:V2Ray + WebSocket + TLS + CloudFlare","uri":"/posts/technology/lattern/"},{"categories":["技术"],"content":"3. 运行 V2Ray 配置完了,运行一下: systemctl start v2ray 如果你的服务器不用 Systemd: service v2ray start # 要么 /etc/init.d/v2ray start # 或者手动运行 /usr/bin/v2ray/v2ray -config /etc/v2ray/config.json 测试一下有没有跑起来: curl -i http://127.0.0.1:10086/whatever HTTP/1.1 400 Bad Request Content-Type: text/plain; charset=utf-8 Sec-Websocket-Version: 13 X-Content-Type-Options: nosniff Date: Sun, 12 Jan 2020 11:45:14 GMT Content-Length: 12 Bad Request 注意 curl 访问的端口和路径要和上面 V2Ray 中配置的一致,出现 400 Bad Request 就对了。 ","date":"2020-01-12","objectID":"/posts/technology/lattern/:3:0","tags":["V2Ray"],"title":"搭建备用梯子:V2Ray + WebSocket + TLS + CloudFlare","uri":"/posts/technology/lattern/"},{"categories":["技术"],"content":"4. 配置 Nginx 毕竟要隐蔽嘛,最好是选一个已经上线的正常网站,悄咪咪地把其中一个路径反代到我们的 V2Ray 上。 网上不少 V2Ray + WebSocket + TLS 的教程里,Web 服务器 + SSL 证书的配置都是重头戏。可如果你平时就有在捣鼓网站的话,这些实在是都不算啥……所以我这里也就一笔带过了。 以 Nginx 为例,找个合适的 server {} 块添加以下内容(这重定向语法够蛋疼的): location /whatever { proxy_redirect off; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection \"upgrade\"; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; set $is_v2ray 0; if ($http_upgrade = \"websocket\") { set $is_v2ray 1; } if ($is_v2ray = 1) { # 仅当请求为 WebSocket 时才反代到 V2Ray proxy_pass http://127.0.0.1:10086; } if ($is_v2ray = 0) { # 否则显示正常网页 rewrite ^/(.*)$ /mask-page last; } } 注意 location 的路径要和上面 V2Ray 里配置的一样。 最后完整的 Nginx 配置大概类似这样: server { listen 443 ssl http2; server_name example.com; index index.html index.htm index.php; root /data/wwwroot/example; ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; ssl_session_cache shared:SSL:10m; ssl_session_timeout 10m; ssl_protocols TLSv1.2 TLSv1.3; ssl_prefer_server_ciphers on; ssl_ciphers EECDH+AESGCM:EDH+AESGCM; location ~ [^/]\\.php(/|$) { fastcgi_pass unix:/dev/shm/php-cgi.sock; fastcgi_index index.php; include fastcgi.conf; } location /whatever { # ... } } 表面看上去像个正常 PHP 网站,/whatever 里才是大有乾坤。 再把路径和网站内容搞得唬人一点,我寻思隐蔽性方面应该是没问题的。 ","date":"2020-01-12","objectID":"/posts/technology/lattern/:4:0","tags":["V2Ray"],"title":"搭建备用梯子:V2Ray + WebSocket + TLS + CloudFlare","uri":"/posts/technology/lattern/"},{"categories":["技术"],"content":"5. 配置 CloudFlare 呃,这个就不用讲什么了吧。还不说声多谢 CloudFlare 哥? CDN 配置完了再用 curl 测试一下: curl -i https://example.com/whatever HTTP/2 400 date: Sun, 12 Jan 2020 08:44:07 GMT content-type: text/plain; charset=utf-8 content-length: 12 sec-websocket-version: 13 x-content-type-options: nosniff cf-cache-status: DYNAMIC expect-ct: max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\" server: cloudflare Bad Request 同样也是出现 400 Bad Request 就对了。 如果你像我上面一样在 Nginx 中配置了 $http_upgrade = \"websocket\" 的判断的话,这里返回的会是用于伪装的那个页面(而且 Nginx 的 $http_upgrade 变量不知道是按什么赋值的,直接 curl --header \"Upgrade: websocket\" 的话还不认,怪得很)。可以使用 wscat 来测试: wscat -c wss://example.com/whatever Connected (press CTRL+C to quit) ","date":"2020-01-12","objectID":"/posts/technology/lattern/:5:0","tags":["V2Ray"],"title":"搭建备用梯子:V2Ray + WebSocket + TLS + CloudFlare","uri":"/posts/technology/lattern/"},{"categories":["技术"],"content":"6. 配置 V2Ray 客户端 客户端配置文件大概改成这样: { \"log\": { \"loglevel\": \"warning\" }, \"inbounds\": [{ // 本地代理配置 \"port\": 1080, \"listen\": \"127.0.0.1\", \"protocol\": \"socks\", \"settings\": { \"auth\": \"noauth\", \"udp\": false, \"ip\": \"127.0.0.1\" } }], \"outbounds\": [{ \"protocol\": \"vmess\", \"settings\": { \"vnext\": [ { // 套过 CloudFlare 的网址 \"address\": \"example.com\", \"port\": 443, \"users\": [ { // id 和 alterId 必须和服务端上配置的一样 \"id\": \"23ad6b10-8d1a-40f7-8ad0-e3e35cd38297\", \"alterId\": 64 } ] } ] }, \"streamSettings\": { // 传输协议为 WebSocket \"network\": \"ws\", // 底层传输安全为 TLS \"security\": \"tls\", \"wsSettings\": { // 路径要和上面设置的一样 \"path\": \"/whatever\" } } }], \"policy\": { \"levels\": { \"0\": {\"uplinkOnly\": 0} } } } 上述客户端配置同样也是简化的,路由、DNS 什么的都没设置。 当然,我估计桌面用户基本上用的都是各种图形客户端,不然可不是折腾自己嘛。以 Windows 上的 v2rayN 客户端为例,你可以这样添加服务器: 不出意外就可以正常使用了。 ","date":"2020-01-12","objectID":"/posts/technology/lattern/:6:0","tags":["V2Ray"],"title":"搭建备用梯子:V2Ray + WebSocket + TLS + CloudFlare","uri":"/posts/technology/lattern/"},{"categories":["技术"],"content":"常见问题 ","date":"2020-01-12","objectID":"/posts/technology/lattern/:7:0","tags":["V2Ray"],"title":"搭建备用梯子:V2Ray + WebSocket + TLS + CloudFlare","uri":"/posts/technology/lattern/"},{"categories":["技术"],"content":"TUN模式,开启热点连接暴增 开启热点分享功能,此时系统网络设置中会生成一个网卡 开启 TUN 模式 进入系统网络设置,在 Clash 网卡右键选择属性,选择共享标签页 勾选“允许其他网络用户通过此计算机的 Internet 连接来连接” 在“家庭网络连接”选择框中选择第 1 步生成的网卡 networdk-adaptor.jpg 参考链接: WebSocket+TLS+Web · V2Ray 配置指南|V2Ray 白话文教程 配置文件 · Project V 官方网站 使用Cloudflare中转V2Ray流量 · 233boy/v2ray Wiki CFW TUN 模式 移动热点冲突 - Leey’s ","date":"2020-01-12","objectID":"/posts/technology/lattern/:7:1","tags":["V2Ray"],"title":"搭建备用梯子:V2Ray + WebSocket + TLS + CloudFlare","uri":"/posts/technology/lattern/"},{"categories":["笔记"],"content":"多分类支持向量机可以用来处理多分类问题,其分类函数可以给每一个类得到一个分数值,从而从数值上了解哪个类别的分数高低,其损失函数也是通过某个特定的阈值来优化从而使得模型在正确类别上得到一个比其他类别更高的分数值。 loss函数(设定有C个类别) $$s = [s_1, s_2, …, s_C] = f(x_i, W) = [f(x_i, W)1, f(x_i, W)2, … ,f(x_i, W)C]$$ $$L_i = \\sum{j\\neq y_i} \\max(0, s_j - s{y_i} + \\Delta)$$ $$L = \\frac{1}{N} \\sum_i L_i + \\lambda R(W)$$ $$L = \\frac{1}{N} \\sum_i \\sum{j\\neq y_i} \\left[ \\max(0, f(x_i; W)j - f(x_i; W){y_i} + \\Delta) \\right] + \\lambda \\sum_k\\sum_l W_{k,l}^2$$ 梯度下降 $$s = W^Tx_i$$ $$j==yi时:\\frac{dL_i}{dW_{y_i}} = -\\sum_{j\\neq y_i}\\mathbb{I}(W^T_jx_i - W^T_{y_i}x_i + \\Delta\u003e0)$$ $$j!=i时:\\frac{dL_i}{dW_yi} = \\mathbb{I}(W^T_jx_i - W^T_{y_i}x_i + \\Delta\u003e0)$$ $$\\frac{dL}{dW} = \\frac{1}{N}\\sum^N_{i=1}\\frac{dL_i}{dW} + 2\\lambda W$$ $$执行 W = W - \\alpha \\frac{dL}{dW},在根据W求s,然后求loss,最后优化得到较理想的W值$$ ","date":"2018-06-28","objectID":"/posts/research/multiclass_svm/:0:0","tags":["分类"],"title":"多分类支持向量机","uri":"/posts/research/multiclass_svm/"},{"categories":["笔记"],"content":"bacth normlization中的前向传播 input:X_{ij}(本层所有的样本矩阵为X维度为mxD,m为样本数,D为神经元的个数,其中X_{ij}为X中的某一个样本) $$其中样本矩阵X = \\begin{bmatrix} X_{11}\u0026 X_{12} \u0026 … \u0026X_{1D} \\\\ X_{21}\u0026 X_{22} \u0026 … \u0026X_{2D} \\\\ .\u0026 . \u0026 …\u0026. \\\\ .\u0026 .\u0026 … \u0026 .\\\\ X_{m1}\u0026 X_{m2} \u0026 … \u0026X_{mD} \\end{bmatrix},X_{i} = \\begin{bmatrix} X_{i1}\u0026 X_{i2} \u0026 … \u0026X_{iD} \\\\ \\end{bmatrix},第j列为X_{\\cdot j} = \\begin{bmatrix} X_{1j}\\\\ X_{2j}\\\\ .\\\\ .\\\\ X_{mj} \\end{bmatrix}$$ $$ output格式为: Yi = BN(X_{ij}, \\gamma, \\beta)\\\\ 其中输出矩阵Y = \\begin{bmatrix} Y_{11}\u0026 Y_{12} \u0026 … \u0026Y_{1D} \\\\ Y_{21}\u0026 Y_{22} \u0026 … \u0026Y_{2D} \\\\ .\u0026 . \u0026 …\u0026. \\\\ .\u0026 .\u0026 … \u0026 .\\\\ Y_{m1}\u0026 Y_{m2} \u0026 … \u0026Y_{mD} \\end{bmatrix},m为样本数,D为输入维度数$$ 前向传播过程如下 $$\\mu_{j} = E(X) = \\frac{1}{m}\\sum_{i=1}^{m}X_{i},则\\mu_{j} 的维度为(1,D)\\\\ \\sigma_{j}^{2} = Var(X) = \\frac{1}{m}\\sum_{i=1}^{m}(X_{i}-\\mu_{j})^{2},则\\sigma_{j}^{2}的维度为(1,D)\\\\ 对第i个样本的估计\\hat{X_{ij}} = \\frac{X_{ij} - \\mu_{j}}{\\sqrt{\\sigma_{j}^{2} + \\varepsilon }},则\\hat{X_{i}}维度为(1,D)\\\\ 对m个样本估计\\hat{X} = \\frac{X - \\mu_{j}}{\\sqrt{\\sigma_{j}^{2} + \\varepsilon }},则\\hat{X}维度为(m,D)\\\\ 第i个样本的输出Y_{i} = \\gamma \\times \\hat{X_{i}} + \\beta,其中\\gamma维度为(1,D),\\beta维度为(1,D),则Y_{i}维度为(1,D)\\\\ 则m个样本的输出Y = \\gamma \\times \\hat{X} + \\beta,其中\\gamma维度为(1,D),\\beta维度为(1,D),则Y维度为(m,D)$$ ","date":"2018-04-28","objectID":"/posts/research/bacth_norm/:1:0","tags":["神经网络"],"title":"批量标准化","uri":"/posts/research/bacth_norm/"},{"categories":["笔记"],"content":"bacth normlization中的反向传播 $$假设上层梯度为\\frac{dL}{dY},本层输入为X,过程如下:\\\\ 从X中选中第j列,令x = \\begin{bmatrix} X_{1j}\\\\ X_{2j}\\\\ .\\\\ .\\\\ X_{mj} \\end{bmatrix}\\\\$$ (1)求dbeta $$我们先求d\\beta_{j} = \\sum_{i=1}^{m}\\frac{dL}{dY_{ij}} \\cdot \\frac{dY_{ij}}{d\\beta_{j}}, 由Y_{i} = \\gamma \\times \\hat{X_{i}} + \\beta可知Y_{ij} = \\gamma_{j} \\times \\hat{X_{ij}} + \\beta_{j},\\frac{dY_{ij}}{d\\beta_{j}}=1\\\\ 所以d\\beta_{j} = \\sum_{i=1}^{m}\\frac{dL}{dY_{ij}},则对整个矩阵操作d\\beta = \\sum_{i=1}^{m}\\frac{dL}{dY_{i}} = \\begin{bmatrix} d\\beta_{1}\u0026 d\\beta_{2} \u0026 … \u0026d\\beta_{D} \\\\ \\end{bmatrix}$$ (2)求dgamma $$ d\\gamma_{j} = \\sum_{i=1}^{m}\\frac{dL}{dY_{ij}} \\cdot \\frac{dY_{ij}}{d\\gamma_{j}}\\\\ 由Y_{i} = \\gamma \\times \\hat{X_{i}} + \\beta可知Y_{ij} = \\gamma_{j} \\times \\hat{X_{ij}} + \\beta_{j},\\frac{dY_{ij}}{d\\gamma_{j}}=\\hat{X_{ij}}\\\\ 所以d\\gamma_{j} = \\sum_{i=1}^{m}\\frac{dL}{dY_{ij}} \\cdot \\hat{X_{ij}}\\\\ 对整个矩阵进行操作d\\gamma = \\sum_{i=1}^{m}\\frac{dL}{dY_{i}} \\cdot \\hat{X_{i}} = \\begin{bmatrix} d\\gamma_{1}\u0026 d\\gamma_{2} \u0026 … \u0026d\\gamma_{D} \\end{bmatrix}$$ (3)求dX 最后我们还要对X进行求导,首先我们先看下面的链式路径: $$对第i行第j列进行反向传播:\\frac{dL}{dX_{ij}} = \\sum_{k=1}^{m}\\frac{dL}{d\\hat{X_{kj}}} \\cdot\\frac{d\\hat{X_{kj}}}{dX_{ij}} = \\sum_{k=1}^{m} \\sum_{l=1}^{m}(\\frac{dL}{d\\hat{Y_{lj}}} \\cdot \\frac{dY_{lj}}{d\\hat{X_{kj}}})\\cdot\\frac{d\\hat{X_{kj}}}{dX_{ij}}\\\\ 由Y_{i} = \\gamma \\times \\hat{X_{i}} + \\beta可知Y_{lj} = \\gamma_{j} \\times \\hat{X_{lj}} + \\beta_{j},则\\frac{dY_{lj}}{d\\hat{X_{kj}}}=\\gamma_{j}(当l=k时),\\frac{dY_{lj}}{d\\hat{X_{kj}}}=0(当l≠k时)\\\\ 则\\frac{dL}{dX_{ij}} = \\sum_{k=1}^{m}\\frac{dL}{dY_{kj}} \\cdot \\frac{dY_{kj}}{d\\hat{X_{kj}}} \\cdot\\frac{d\\hat{X_{kj}}}{dX_{ij}} = \\sum_{k=1}^{m}\\gamma_{j} \\cdot \\frac{dL}{dY_{kj}} \\cdot\\frac{d\\hat{X_{kj}}}{dX_{ij}} \\\\ 由\\hat{X_{ij}} = \\frac{X_{ij} - \\mu_{j}}{\\sqrt{\\sigma_{j}^{2} + \\varepsilon }},\\mu_{j} = \\frac{1}{m}\\sum_{k=1}^{m}X_{kj}, \\sigma_{j}^{2} = \\frac{1}{m}\\sum_{k=1}^{m}(X_{kj}-\\mu_{j})^{2}和上图可知我们求\\frac{d\\hat{X_{ij}}}{dX_{ij}}的话有三条路径:\\\\ 第一条路径为:\\frac{d\\hat{X_{kj}}}{dX_{ij}} = \\left \\lceil k==i \\right \\rfloor \\cdot \\frac{1}{\\sqrt{\\sigma_{j}^{2} + \\varepsilon }}\\\\ 第二条路径为:\\frac{d\\hat{X_{kj}}}{dX_{ij}} = \\frac{d\\hat{X_{kj}}}{d\\mu_{j}} \\cdot \\frac{d\\mu_{j}}{dX_{ij}},\\frac{d\\hat{X_{kj}}}{d\\mu_{j}} = -\\frac{1}{\\sqrt{\\sigma_{j}^{2} + \\varepsilon }},\\frac{d\\mu_{j}}{dX_{ij}} = \\frac{1}{m}\\\\ 则\\frac{d\\hat{X_{kj}}}{dX_{ij}} = -\\frac{1}{m\\sqrt{\\sigma_{j}^{2} + \\varepsilon }}\\\\ 第三条路径为:\\frac{d\\hat{X_{kj}}}{dX_{ij}} = \\frac{d\\hat{X_{kj}}}{d\\sigma_{j}^{2}} \\cdot \\frac{d\\sigma_{j}^{2}}{dX_{ij}},\\\\ \\frac{d\\hat{X_{kj}}}{d\\sigma_{j}^{2}} = -\\frac{X_{kj} - \\mu_{j}}{2(\\sigma_{j}^{2} + \\varepsilon)^{\\frac{3}{2}}},\\\\ 求解\\frac{d\\sigma_{j}^{2}}{dX_{ij}}有两个路径: 路径1:\\frac{d\\sigma_{j}^{2}}{dX_{ij}} = \\frac{2}{m}(X_{ij} - \\mu_{j}),路径2:\\frac{d\\sigma_{j}^{2}}{dX_{ij}} = \\frac{d\\sigma_{j}^{2}}{d\\mu_{j}} \\cdot \\frac{d\\mu_{j}}{dX_{ij}} = - \\frac{2}{m}(X_{ij} - \\mu_{j}) \\cdot \\frac{1}{m}\\\\ 则\\frac{d\\sigma_{j}^{2}}{dX_{ij}} = \\frac{d\\sigma_{j}^{2}}{dX_{ij}} + \\frac{d\\sigma_{j}^{2}}{d\\mu_{j}} \\cdot \\frac{d\\mu_{j}}{dX_{ij}} = \\frac{2}{m}(X_{ij} - \\mu_{j}) + (- \\frac{2}{m}(X_{ij} - \\mu_{j}) \\cdot \\frac{1}{m}) = \\frac{2}{m^{2}}(X_{ij} - \\mu_{j})(m - 1)\\\\ 则\\frac{d\\hat{X_{kj}}}{dX_{ij}} = \\frac{d\\hat{X_{kj}}}{d\\sigma_{j}^{2}} \\cdot \\frac{d\\sigma_{j}^{2}}{dX_{ij}} = -\\frac{X_{kj} - \\mu_{j}}{2(\\sigma_{j}^{2} + \\varepsilon)^{\\frac{3}{2}}} \\cdot \\frac{2}{m^{2}}(X_{ij} - \\mu_{j})(m - 1) = \\frac{(X_{kj} - \\mu_{j}) \\cdot(X_{ij} - \\mu_{j}) \\cdot(1 - m)}{m^{2}\\cdot (\\sigma_{j}^{2} + \\varepsilon)^{\\frac{3}{2}}}\\\\ 综合上述三条路径可求得\\frac{dL}{dX_{ij}} = \\sum_{k=1}^{m}\\gamma\\cdot\\frac{dL}{dY_{kj}}\\cdot\\frac{d\\hat{X_{kj}}}{dX_{ij}} + \\sum_{k=1}^{m}\\gamma\\cdot\\frac{dL}{dY_{kj}}\\cdot\\frac{d\\hat{X_{kj}}}{d\\mu_{j}} \\cdot \\frac{d\\mu_{j}}{dX_{ij}} +\\sum_{k=1}^{m}\\gamma\\cdot\\frac{dL}{dY_{kj}}\\cdot \\frac{d\\hat{X_{kj}}}{d\\sigma_{j}^{2}} \\cdot \\frac{d\\sigma_{j}^{2}}{dX_{ij}}\\\\ = \\gamma\\cdot\\frac{dL}{dY_{ij}}\\cdot\\frac{1}{\\sqrt{\\sigma_{j}^{2} + \\varepsilon }} + \\sum_{k=1}^{m}\\gamma\\cdot\\frac{dL}{dY_{kj}}\\cdot\\frac{-1}{m\\sqrt{\\sigma_{j}^{2} + \\varepsilon }} +\\sum_{k=1}^{m}\\gam","date":"2018-04-28","objectID":"/posts/research/bacth_norm/:2:0","tags":["神经网络"],"title":"批量标准化","uri":"/posts/research/bacth_norm/"},{"categories":["笔记"],"content":" 再学完斯坦福大学的计算机视觉的课后,总结一下自己对全连接神经网络的理解,方便在以后自己可以查阅和复习。首先简单的复习一下神经网络的概念,神经网络有输入层、隐藏层和输出层三种层,其中隐藏层可能会有多层,一个神经网络有多少层要看有多少个隐藏层加上输出层就为该神经网络的层数。神经网络的来源源于生物体的大脑的神经元的触发机制,但是我们要区分神经网络和真实生物体的差别。神经网络不是生物体神经元的真实映射。本篇文章以cs231n中的作业二中的神经网络作为背景进行讲述。 ","date":"2018-04-22","objectID":"/posts/research/neural_network/:0:0","tags":["神经网络"],"title":"全连接神经网络","uri":"/posts/research/neural_network/"},{"categories":["笔记"],"content":"1.神经网络中的基本结构 如上图所示,神经网络有输入层、隐藏层和输出层组成,这个神经网络一共有两层,一个隐藏层和一个输出层,输入层不算层数。输入层有输入维度为3,第一层有四个神经元,输出层有两个神经元。在某些结构中,我们的神经网络结构会更加,隐藏层可能会不只一个,而且每一层的神经元个数也会不唯一。其中每一个神经元有一个输入和一个输出,如下为一个神经元的内部详解: 一个神经元其实有两个处理,首先是对前面的输入做一个线性求和$$Z = \\sum_{i=1}^{N} wi \\cdot xi +b$$ 然后在有一个激活函数f在对z做处理得到这个神经元的输出 $$f(\\sum_{i=1}^{N} wi \\cdot xi +b)$$ 讲完了基本的神经网络结构后,我们现在以cs231n中作业2中的全连接神经网络架构做一个讲述,他的架构为{affine - [batch norm] - relu - [dropout]} x (L - 1) - affine - softmax也就是说前面的L-1层的每一层,先做一个affine,然后batch norm 在接着激活函数用relu处理一下输出,最后做一个dropout,到最后一层就在一个affine后进入一个softmax层得到神经网络的最终输出。 ","date":"2018-04-22","objectID":"/posts/research/neural_network/:1:0","tags":["神经网络"],"title":"全连接神经网络","uri":"/posts/research/neural_network/"},{"categories":["笔记"],"content":"2.前向传播 前向传播是从输入层开始把每一层的输出递交给下一层直至最后一层将结果输出的过程,在cs231n中前面的L-1层的前向过程如下: affine层对输入做一个线性组合输出affOut: $$affOut = \\sum_{i=1}^{N} wi \\cdot xi +b$$ batch norm层: 得到输出batchOUt relu层: 得到输出reluOut dropout层: 得到输出dropOut 然后在第L层也就是最后一层先进入一个affine层,然后把结果进入一个softmax层得到各个类别的分类概率。 在对每个样本softmax进行求loss得到最后的softmax loss,在加上正则化后为 $$L=\\frac{1}{N}\\sum_{i=1}^{N}Li(W) + \\lambda \\cdot \\sum_{l} \\sum_{i}\\sum_{j}W_{ij}^{l}$$ #代码解释 affOut,affCache = affine_forward(inputX, W, b) batchOut,batchCache = batchnorm_forward(affOut, gamma, beta, self.bn_params[i]) reluOut,reluCache = relu_forward(batchOut) dropOut,dropCache = dropout_forward(reluOut, self.dropout_param) ","date":"2018-04-22","objectID":"/posts/research/neural_network/:2:0","tags":["神经网络"],"title":"全连接神经网络","uri":"/posts/research/neural_network/"},{"categories":["笔记"],"content":"3.反向传播 反向传播其实就是链式求导的一个应用,求loss函数对最后一层输入的求导为: $$dZL = \\frac{dL}{dZ} = \\frac{1}{N}\\sum_{N}^{i=1}\\frac{dLi}{dZi}$$ 到dropOut层反向传播(该层输入 reluOut, 输出 dropOut(当为L-1层的时候dropOut=ZL)): $$\\frac{dL}{dreluOut} = \\frac{dL}{ddropOut} \\cdot \\frac{ddropOut}{dreluOut}$$ 到relu层反向传播(该层输入 dbatchOut 输出 reluOut): $$\\frac{dL}{dbatchOut} = \\frac{dL}{dreluOut} \\cdot \\frac{dreluOut}{dbatchOut}$$ 到batchout层(该层输入 affOut, 输出 batchOut): $$\\frac{dL}{daffOut} = \\frac{dL}{dbatchOut} \\cdot \\frac{dbatchOut}{daffOut}$$ $$d\\gamma = \\frac{dL}{d\\gamma} = \\frac{dL}{dbatchOut} \\cdot \\frac{dbatchOut}{daffOut}$$ $$d\\beta = \\frac{dL}{d\\beta} = \\frac{dL}{dbatchOut} \\cdot \\frac{dbatchOut}{daffOut}$$ 到affine层(该层输入 X, 输出 affOut): $$dX = \\frac{dL}{dX} = \\frac{dL}{daffOut} \\cdot \\frac{daffOut}{dX}$$ $$dW = \\frac{dL}{dW} = \\frac{dL}{daffOut} \\cdot \\frac{daffOut}{dW}$$ $$db = \\frac{dL}{db} = \\frac{dL}{daffOut} \\cdot \\frac{daffOut}{db}$$ ","date":"2018-04-22","objectID":"/posts/research/neural_network/:3:0","tags":["神经网络"],"title":"全连接神经网络","uri":"/posts/research/neural_network/"},{"categories":["笔记"],"content":"4.权重初始化 继续拿这个神经网络来说明,在第一层和第二层中我们都需要对权重进行初始化,每一层的w的维度初始化为本层的输入个数和本层的神经元个数,例如上图中第一层w的维度为3x4的矩阵,b的维度为1x4,第二层权重w的维度为4x2,b的维度为1x2。batchnorm层中beta和gamma的维度都为1xD(D为该层神经元的个数)。 一般w为从高斯分布中均值为0进行初始化,b初始化为0矩阵,beta初始化为0,gamma初始化为1 ","date":"2018-04-22","objectID":"/posts/research/neural_network/:4:0","tags":["神经网络"],"title":"全连接神经网络","uri":"/posts/research/neural_network/"},{"categories":["笔记"],"content":"5.神经网络中的梯度下降 对每一层: $$\\gamma = \\gamma - \\alpha \\cdot d\\gamma$$ $$\\beta = \\beta - \\alpha \\cdot d\\beta$$ $$W = W - \\alpha \\cdot dW$$ $$b = b - \\alpha \\cdot db$$ 然后前向传播求出loss,当loss足够小或者迭代次数足够多的时候停止梯度下降,此时参数即为近似最优解 ","date":"2018-04-22","objectID":"/posts/research/neural_network/:5:0","tags":["神经网络"],"title":"全连接神经网络","uri":"/posts/research/neural_network/"},{"categories":["笔记"],"content":"softmax函数简介: softmax函数是用来处理多分类的一种软性分类器,它输出的是每个类别的概率值。数据集特征矩阵为X其维度为D+1 x N(其中D+1为原本样本的特征维度数D加上bias的维度后的维度数,所以为D+1,N为样本数),标注矩阵为Y,维度为C x N(其中C为类别数,N为样本数)。 当我们给softmax输入一个样本Xi其输出格式为softmax(Xi) = [s1,s2,……,sC],其中s1对应类别1的概率值,s2对应类别2的概率值,依次类推到sC。softmax的过程如下: 然后来衡量第i个样本的loss公式如下: (其中yi表示第i个样本对应的类别) 所以N个样本的loss为: 加上正则化后为: 由如下Z和W与X的关系: 则可以把loss函数化成全部关于w的函数为: 现在我们来求softmax的导数,现在我们先对一个样本的导数进行求解,先把Li化简为如下形式: 则当对Wyi求导的时候(j==yi): 当对Wj求导的时候(j!=yi) 则如上操作可以求出单个loss的梯度如下(其中设yi=2): 现在我们需要把所有的梯度求出来并做一个平均就得到了loss的平均梯度: 加上正则化后的loss函数: 然后在足够的迭代次数中用梯度更新W(其中α为学习率): 直到在达到足够的迭代次数或者loss足够小的时候则停止更新 此时得到的W则为我们在这个softmax中所得到的W,然后在测试集中测试所有样本可得到样本的预测类别。 ","date":"2018-04-20","objectID":"/posts/research/softmax/:1:0","tags":["Softmax"],"title":"Softmax 梯度下降优化","uri":"/posts/research/softmax/"},{"categories":null,"content":"FixIt 主题的离线缓存页面","date":"0001-01-01","objectID":"/offline/","tags":null,"title":"","uri":"/offline/"},{"categories":null,"content":"密度函数平滑技术 当前的密度模型主要分为两类:(1)局部平滑和(2)全局平滑 ","date":"0001-01-01","objectID":"/posts/research/desity_modeling/:1:0","tags":null,"title":"","uri":"/posts/research/desity_modeling/"},{"categories":null,"content":"局部平滑 局部平滑函数用一个钟形的二次函数来替代原来的线性密度函数,只包含了局部的信息,可能会要消耗更多的迭代次数才能收敛。 ","date":"0001-01-01","objectID":"/posts/research/desity_modeling/:1:1","tags":null,"title":"","uri":"/posts/research/desity_modeling/"},{"categories":null,"content":"全局平滑 使用椭圆PDE去做平滑,现代非线性布局当中是主流的应用。全局信息的纳允许大规模的器件运动。在文献《T. F. Chan, J. Cong, J. R. Shinnerl, K. Sze, and M. Xie. mPL6: Enhanced Multilevel Mixed-Size Placement. In ISPD , pages 212–214, 2006.》中使用Helmholtz 方程来求密度如下: $$\\nabla\\psi(x,y)-\\epsilon\\psi(x,y)=\\rho(x,y),(x,y)\\in R$$ 其中$\\psi$表示平滑后的密度分布,当线性因子$\\epsilon \\gt 0$,有唯一解。 ","date":"0001-01-01","objectID":"/posts/research/desity_modeling/:1:2","tags":null,"title":"","uri":"/posts/research/desity_modeling/"}] \ No newline at end of file +[{"categories":["强化学习"],"content":" 状态$s_1,s_2$,动作$a_1,a_2$ 当前步的实现:$$Q(s_1,a_2)=r+\\gamma \\max_{a^}(Q(s^,a^))$$,其中$r$表示的是采取动作$a_2$到达状态$s^$的奖励,所以当前步的现实是包含了对于下一步采取动作$a^$的奖励估计,也包含了到达当前状态的奖励$r$。 当前步的估计:$$Q(s_1,a_2)$$ 当前状态的估计和现实之前的误差为:$$r+\\gamma \\max_{a^}(Q(s^,a^))-Q(s_1,a_2)$$ 其中$\\gamma$表示对未来奖励衰减参数,则更新对于$Q(s_1,a_2)$的估计:$$Q(s_1,a_2)=Q(s_1,a_2)+\\alpha (r+\\gamma \\max_{a^}(Q(s^,a^`))-Q(s_1,a_2))$$ 其中$\\alpha$表示误差学习参数 用$Q(S_1)$来简化表示从状态$S_1$出发的现实奖励,有以下推论:$$Q(S_1)=r_2+\\gamma Q(S_2)=r_2+\\gamma(r_3+\\gamma Q(S_3))$$ 则有:$$Q(S_1)=r_2+\\gamma r_3+\\gamma^2 r_4+\\gamma^3 r_5+\\dots$$,则比较远的步骤能否学习和$\\gamma$有关,$\\gamma=1$则全部都能看到,为0则全部都看不到,正常情况在0到1之间。 ","date":"2023-09-28","objectID":"/posts/learning/rl/q_learning/:0:0","tags":null,"title":"Q学习算法","uri":"/posts/learning/rl/q_learning/"},{"categories":["强化学习"],"content":"概念 原先的动作是没有标签的,强化学习可以对每一个动作进行打分,然后学习,不断的迭代完成算法的学习。 ","date":"2023-09-28","objectID":"/posts/learning/rl/rl_basic/:0:0","tags":null,"title":"简介","uri":"/posts/learning/rl/rl_basic/"},{"categories":["强化学习"],"content":"按环境分类 ","date":"2023-09-28","objectID":"/posts/learning/rl/rl_basic/:1:0","tags":null,"title":"简介","uri":"/posts/learning/rl/rl_basic/"},{"categories":["强化学习"],"content":"Model-Free RL(不理解所处环境) 环境给到什么就是什么,不理解环境是什么,这里的model表示的是环境,做出的动作完全独立于当前环境,反馈也只有在做出动作后才知道。 Q Learning Sarsa Policy Gradients ","date":"2023-09-28","objectID":"/posts/learning/rl/rl_basic/:1:1","tags":null,"title":"简介","uri":"/posts/learning/rl/rl_basic/"},{"categories":["强化学习"],"content":"Model-Based RL(理解所处环境) 模型会对真实世界进行建模,通过过往的经验先理解真实世界是怎么样的,然后建立模拟反馈,让模拟世界尽量接近于真实的世界,可以作出最好的动作。 ","date":"2023-09-28","objectID":"/posts/learning/rl/rl_basic/:1:2","tags":null,"title":"简介","uri":"/posts/learning/rl/rl_basic/"},{"categories":["强化学习"],"content":"按Policy和Value分类 ","date":"2023-09-28","objectID":"/posts/learning/rl/rl_basic/:2:0","tags":null,"title":"简介","uri":"/posts/learning/rl/rl_basic/"},{"categories":["强化学习"],"content":"基于概念分类(Policy-Based RL) 根据当前的动作计算出下一步所有可能的动作的概率,下一步的每个动作都有可能选中。(可以处理连续的情况,输出一个概率分布) Q Learning ","date":"2023-09-28","objectID":"/posts/learning/rl/rl_basic/:2:1","tags":null,"title":"简介","uri":"/posts/learning/rl/rl_basic/"},{"categories":["强化学习"],"content":"基于价值分类(Value-Based RL) 根据当前的动作计算出下一步所有可能的动作的值,选择价值最高的动作。(离散的,不能处理连续的情况) Sarsa Policy Gradients ","date":"2023-09-28","objectID":"/posts/learning/rl/rl_basic/:2:2","tags":null,"title":"简介","uri":"/posts/learning/rl/rl_basic/"},{"categories":["强化学习"],"content":"基于概念和价值结合 Actor-Critic Actor做出动作,Critic对动作进行打分 ","date":"2023-09-28","objectID":"/posts/learning/rl/rl_basic/:2:3","tags":null,"title":"简介","uri":"/posts/learning/rl/rl_basic/"},{"categories":["强化学习"],"content":"按回合/单步分类 ","date":"2023-09-28","objectID":"/posts/learning/rl/rl_basic/:3:0","tags":null,"title":"简介","uri":"/posts/learning/rl/rl_basic/"},{"categories":["强化学习"],"content":"回合更新(蒙特卡罗更新) 等所有的步骤完成以后才更新 Policy Gradients Monte-Carlo Learning ","date":"2023-09-28","objectID":"/posts/learning/rl/rl_basic/:3:1","tags":null,"title":"简介","uri":"/posts/learning/rl/rl_basic/"},{"categories":["强化学习"],"content":"单步更新(蒙特卡罗更新) 等当前循环中的每个单步完成以后都可以进行更新 改进版Policy Gradients Sarsa Q Learning ","date":"2023-09-28","objectID":"/posts/learning/rl/rl_basic/:3:2","tags":null,"title":"简介","uri":"/posts/learning/rl/rl_basic/"},{"categories":["强化学习"],"content":"按在线/离线分类 ","date":"2023-09-28","objectID":"/posts/learning/rl/rl_basic/:4:0","tags":null,"title":"简介","uri":"/posts/learning/rl/rl_basic/"},{"categories":["强化学习"],"content":"在线学习 只能是本人玩然后本人进行学习 Sarsa Sarsa() ","date":"2023-09-28","objectID":"/posts/learning/rl/rl_basic/:4:1","tags":null,"title":"简介","uri":"/posts/learning/rl/rl_basic/"},{"categories":["强化学习"],"content":"离线学习 可以学习别人怎么玩,看着别人怎么玩进行学习,边玩边学习,可以先记下来别人怎么玩,然后在过后在自己学习,学习和作动作可以分开执行 Q Learning Deep Q Network ","date":"2023-09-28","objectID":"/posts/learning/rl/rl_basic/:4:2","tags":null,"title":"简介","uri":"/posts/learning/rl/rl_basic/"},{"categories":["调试"],"content":"安装插件 前置需要安装NvChad ","date":"2023-04-05","objectID":"/posts/technology/nvim_debug_mixed_cpp_python/:1:0","tags":null,"title":"nvim下混合编译调试Dreamplace源码","uri":"/posts/technology/nvim_debug_mixed_cpp_python/"},{"categories":["调试"],"content":"引入插件 { lazy = false, \"rcarriga/nvim-dap-ui\", dependencies = { { \"mfussenegger/nvim-dap\", config = function() return require(\"custom.configs.dap.init\")  Annotations specify that at most 0 return value(s) are required, found 1 to 2 returned here instead. end, }, }, }, ","date":"2023-04-05","objectID":"/posts/technology/nvim_debug_mixed_cpp_python/:1:1","tags":null,"title":"nvim下混合编译调试Dreamplace源码","uri":"/posts/technology/nvim_debug_mixed_cpp_python/"},{"categories":["调试"],"content":"配置插件 C++调试配置 -- c++配置 -- file:dap/cppdbg.lua local dap = require(\"dap\") local function isempty(s) return s == nil or s == \"\" end dap.adapters.cppdbg = { id = 'cppdbg', type = 'executable', command = '~/.local/share/nvim/mason/bin/OpenDebugAD7', } dap.configurations.cpp = { { name = \"Launch file\", type = \"cppdbg\", request = \"launch\", program = function() return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') end, cwd = '${workspaceFolder}', stopAtEntry = true, }, { name = 'Attach to gdbserver :1234', type = 'cppdbg', request = 'launch', MIMode = 'gdb', miDebuggerServerAddress = 'localhost:1234', miDebuggerPath = '/usr/bin/gdb', cwd = '${workspaceFolder}', args = function() return {vim.fn.input('Parameters to executable: ', vim.fn.getcwd() .. '/', 'file')} end, program = function() return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') end, }, } 调试初始化 -- c++配置 -- file:dap/init.lua local dap, dapui = require(\"dap\"), require(\"dapui\") dapui.setup() dap.listeners.after.event_initialized[\"dapui_config\"] = function() dapui.open() end dap.listeners.before.event_terminated[\"dapui_config\"] = function() dapui.close() end dap.listeners.before.event_exited[\"dapui_config\"] = function() dapui.close() end require(\"custom.configs.dap.cppdbg\") 调试快捷键配置 M.Debug = { n = { [\"\u003cF5\u003e\"] = { ':lua require(\"dap\").continue()\u003cCR\u003e', \"debug: run/continue\" }, [\"\u003cF7\u003e\"] = { ':lua require(\"dap\").toggle_breakpoint()\u003cCR\u003e', \"debug: toggle breakpoint\" }, [\"\u003cF8\u003e\"] = { ':lua require(\"dap\").terminate() require(\"dapui\").close()\u003cCR\u003e', \"debug: stop\" }, [\"\u003cF9\u003e\"] = { ':lua require(\"dap\").step_into()\u003cCR\u003e', \"debug: step into\" }, [\"\u003cF10\u003e\"] = { ':lua require(\"dap\").step_out()\u003cCR\u003e', \"debug: step out\" }, [\"\u003cF11\u003e\"] = { ':lua require(\"dap\").step_over()\u003cCR\u003e', \"debug: step out\" }, [\"\u003cleader\u003edb\"]= { ':lua require(\"dap\").set_breakpoint(vim.fn.input(\"Breakpoint condition: \"))\u003cCR\u003e', \"debug: Set breakpoint with condition\" }, [\"\u003cleader\u003edc\"]= { ':lua require(\"dap\").run_to_cursor()\u003cCR\u003e', \"debug: run to cursor\" }, [\"\u003cleader\u003edl\"]= { ':lua require(\"dap\").run_last()\u003cCR\u003e', \"debug: run last\" }, [\"\u003cleader\u003edo\"]= { ':lua require(\"dap\").repl.open()\u003cCR\u003e', \"debug: open REPL\" }, }, } ","date":"2023-04-05","objectID":"/posts/technology/nvim_debug_mixed_cpp_python/:1:2","tags":null,"title":"nvim下混合编译调试Dreamplace源码","uri":"/posts/technology/nvim_debug_mixed_cpp_python/"},{"categories":["调试"],"content":"调试源码 ","date":"2023-04-05","objectID":"/posts/technology/nvim_debug_mixed_cpp_python/:2:0","tags":null,"title":"nvim下混合编译调试Dreamplace源码","uri":"/posts/technology/nvim_debug_mixed_cpp_python/"},{"categories":["调试"],"content":"启动GDBServer gdbserver localhost:1234 ~/anaconda3/bin/python unittest/ops/lpabs_wirelength_unittest.py ","date":"2023-04-05","objectID":"/posts/technology/nvim_debug_mixed_cpp_python/:2:1","tags":null,"title":"nvim下混合编译调试Dreamplace源码","uri":"/posts/technology/nvim_debug_mixed_cpp_python/"},{"categories":["调试"],"content":"Neovim连接GDBServer 按F5进入调试运行模式,选2回车 输入运行参数回车 输入对应的python路径回车 ","date":"2023-04-05","objectID":"/posts/technology/nvim_debug_mixed_cpp_python/:2:2","tags":null,"title":"nvim下混合编译调试Dreamplace源码","uri":"/posts/technology/nvim_debug_mixed_cpp_python/"},{"categories":["调试"],"content":"调试界面 显示如下则成功进入调试模式: ","date":"2023-04-05","objectID":"/posts/technology/nvim_debug_mixed_cpp_python/:2:3","tags":null,"title":"nvim下混合编译调试Dreamplace源码","uri":"/posts/technology/nvim_debug_mixed_cpp_python/"},{"categories":null,"content":"Step1 (安装GNOME桌面) sudo apt-get update sudo apt-get install gnome-session-flashback sudo apt-get install ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal -y ","date":"2023-03-28","objectID":"/posts/technology/vnc_server/:0:1","tags":null,"title":"Ubuntu安装VNCServer","uri":"/posts/technology/vnc_server/"},{"categories":null,"content":"Step2 sudo apt-get -y install xfonts-100dpi xfonts-100dpi-transcoded xfonts-75dpi xfonts-75dpi-transcoded xfonts-base ","date":"2023-03-28","objectID":"/posts/technology/vnc_server/:0:2","tags":null,"title":"Ubuntu安装VNCServer","uri":"/posts/technology/vnc_server/"},{"categories":null,"content":"Step3 sudo apt install tigervnc-standalone-server ","date":"2023-03-28","objectID":"/posts/technology/vnc_server/:0:3","tags":null,"title":"Ubuntu安装VNCServer","uri":"/posts/technology/vnc_server/"},{"categories":null,"content":"Step4:配置密码 vncpasswd ","date":"2023-03-28","objectID":"/posts/technology/vnc_server/:0:4","tags":null,"title":"Ubuntu安装VNCServer","uri":"/posts/technology/vnc_server/"},{"categories":null,"content":"Step5:配置XStartup vim ~/.vnc/xstartup 内容如下: #!/bin/sh # Start Gnome 3 Desktop [ -x /etc/vnc/xstartup ] \u0026\u0026 exec /etc/vnc/xstartup [ -r $HOME/.Xresources ] \u0026\u0026 xrdb $HOME/.Xresources vncconfig -iconic \u0026 dbus-launch --exit-with-session gnome-session \u0026 ","date":"2023-03-28","objectID":"/posts/technology/vnc_server/:0:5","tags":null,"title":"Ubuntu安装VNCServer","uri":"/posts/technology/vnc_server/"},{"categories":null,"content":"Step6:重启TigerVNC tightvncserver -kill :1 vncserver -depth 24 -name mydesktop -localhost no :1 ","date":"2023-03-28","objectID":"/posts/technology/vnc_server/:0:6","tags":null,"title":"Ubuntu安装VNCServer","uri":"/posts/technology/vnc_server/"},{"categories":["笔记"],"content":"基本概念 ","date":"2023-03-27","objectID":"/posts/research/eplace/:1:0","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"布局的定义 布局问题可以描述为一个超图问题,可以定义为如下: $$G = (V,E,R)$$ 其中$V$表示元器件(顶点)集合,$E$表示网表(超边)集合,$R$表示布局区域。在$V$中$V_m$表示可移动器件的集合,$V_f$表示固定块集合。令$n=|V_m|$表示可移动布局对象的个数。 一个合法的布局解决方案应该要满足下面三个要求: 在布局区域中使用足够的空闲位置容纳每个器件 每个元器件在水平方向上要和布局行的边界对齐 元器件和宏组件不能有重合 基于上述的合法性限制,布局的目标就是最小化网表的总$HPWL$,假定$\\mathbf{v}=(\\mathbf{x},\\mathbf{y})$表示一个布局的方案,其中$\\mathbf{x}={x_i|i \\in V_m}$表示所有元器件的水平坐标,$\\mathbf{y}={y_i|i \\in V_m}$表示元器件的垂直坐标,则对于每个网表$e(e \\in E)$,其半周线长的定义如下: $$HPWL_e(\\mathbf{v}) = \\max_{i,j \\in e}|x_i-x_j|+\\max_{i,j \\in e}|y_i-y_j| \\tag 1$$ 则总半周线长定义为: $$HPWL(\\mathbf{v}) = \\sum_{e \\in E} HPWL_e(\\mathbf{v})$$ 布局问题定义为如下: $$\\min_\\mathbf{v}HPWL(\\mathbf{v}),使得\\mathbf{v}是一个合法的布局方案 \\tag 2$$ ","date":"2023-03-27","objectID":"/posts/research/eplace/:1:1","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"全局布局的定义 把布局区域$R$按$m\\times m$划分成一个一个的格子(称作bin),这些格子的集合是B,其中$\\rho_b(\\mathbf{v})$表示每个b的密度,其定义如下: $$\\rho_b(\\mathbf{v}) = \\sum_{i \\in V} l_x(b,i)l_y(b,i) \\tag 3$$ 其中$l_x(b,i)$和$l_y(b,i)$分别表示元器件i和格子b之间的水平和垂直重合,全局布局的定义如下: $$\\min_\\mathbf{v}HPWL(\\mathbf{v})\\ s.t.\\rho_b(\\mathbf{v})\\leq \\rho_t, \\forall b \\in B \\tag 4$$ ","date":"2023-03-27","objectID":"/posts/research/eplace/:1:2","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"线长平滑化 每一个网表$e={(x_1,y_1),(x_2,y_2),\\cdots,(x_n,y_n)}$有n个引脚 ,对数和指数(LSE)在水平轴x方向的线长平滑公式如下: $$W_e(\\mathbf{v}) =\\gamma \\begin{pmatrix} ln\\sum_{i \\in e} exp(\\frac{x_i}{\\gamma})+ln\\sum_{i \\in e} exp(\\frac{-x_i}{\\gamma}) \\end{pmatrix} \\tag{5}$$ 其中${\\gamma}$是平滑参数,不能随意设置的足够小。 权重平均(WA)在水平轴x方向的线长平滑公式如下: $$W_e(\\mathbf{v}) = \\begin{pmatrix} \\frac{\\sum_{i \\in e} x_iexp(\\frac{x_i}{\\gamma})}{\\sum_{i \\in e} exp(\\frac{x_i}{\\gamma})}-\\frac{\\sum_{i \\in e} x_iexp(-\\frac{x_i}{\\gamma})}{\\sum_{i \\in e} exp(-\\frac{x_i}{\\gamma})} \\end{pmatrix} \\tag{6}$$ ","date":"2023-03-27","objectID":"/posts/research/eplace/:1:3","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"密度惩罚 在实际的布局当中,$|B|$个格子的密度都需要满足限制,我们把这些限制用一个惩罚项$N(\\mathbf{v})$来表示,当惩罚项$N(\\mathbf{v})=0$时所有的密度都满足,其定义如下: $$\\rho_b(\\mathbf{v})\\leq \\rho_t, \\forall b \\in B \\iff N(\\mathbf{v})=0 \\tag 7$$ 用二次惩罚项来表示如下: $$N(\\mathbf{v})=\\sum_{b \\in B }(\\widetilde \\rho_{b}(\\mathbf{v})- \\rho_t)^2 \\tag 8$$ 其中$\\widetilde \\rho_{b}$表示在Naylor et al. 2001中定义的铃状的平滑密度函数,密度惩罚$N(\\mathbf{v})$也用来表示系统的势能。 ","date":"2023-03-27","objectID":"/posts/research/eplace/:1:4","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"非线性布局优化方程 利用惩罚因子$\\lambda$目标函数$f(\\mathbf{v})$的定义: $$\\min_\\mathbf{v} f(\\mathbf{v}) = W(\\mathbf{v})+\\lambda N(\\mathbf{v}) \\tag 9$$ 也可以用拉格郎日乘子法写成下面的形式: $$\\min_\\mathbf{v} f(\\mathbf{v}) = W(\\mathbf{v})+\\sum_{b \\in B}\\lambda_b|\\widetilde \\rho_{b}(\\mathbf{v})- \\rho_t| \\tag{10}$$ 其中$\\lambda_b$表示每个格子b的密度限制参数乘子 ","date":"2023-03-27","objectID":"/posts/research/eplace/:1:5","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"静电系统建模(eDensity) 电势和电场分布由系统中的所有元素决定,在网表中的每个节点(元器件或者宏块)带正电苛的粒子i。粒子的带电量$q_i$表示为节点的面积$A_i$,根据洛仁力量定律(Lorentz force law)定义的电力$F_i=q_i \\xi_i$,会引起可移动的节点i的运动,$\\xi_i$表示节点i的布局电场。同样的$N_i=q_i \\psi_i$表示节点的势能,$\\psi_i$表示器件i的电势大小。根据库仑定律,器件i的电场和电势是系统中剩余器件共同作用的叠加。 整个布局的电苛密度分布表示为$\\rho(x,y)$,$\\xi_x(x,y)$表示水平电场的分布函数,表示$\\psi(x,y)$电势分布函数。 ","date":"2023-03-27","objectID":"/posts/research/eplace/:2:0","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"静电平衡系统建模 布局系统和静电系统的建模图: 根据建模规则,把均匀分布的全局布局约束同静电平衡的系统状态联系起来,电力会指引电苛(元器件)向着平衡状态的方向移动。根据高斯法则,电场等于电势的负梯度,如下定义: $$\\xi(x,y)=(\\xi_x,\\xi_y)=-\\nabla\\psi(x,y)= \\begin{pmatrix} -\\frac{\\partial \\psi(x,y)}{\\partial x},-\\frac{\\partial \\psi(x,y)}{\\partial y} \\end{pmatrix} \\tag{11}$$ 电苛的密度函数等于电场函数的散度 $$\\rho(x,y)=\\nabla \\cdot \\xi(x,y)=-\\nabla \\cdot \\nabla\\psi(x,y)=- \\begin{pmatrix} \\frac{\\partial ^2\\psi(x,y)}{\\partial x^2}+\\frac{\\partial ^2\\psi(x,y)}{\\partial y^2} \\end{pmatrix} \\tag{12}$$ 静电系统如果只有正电苛那么只会产生排斥力,相应的静电平衡状态会把所有的器件沿着边界进行分布,因为在边界上可以违反布局约束。因此需要从密度分布当中移除直流组件(即0频率组件)去产生负电苛,从而整个布局区域的密度函数整体变为0。 具体一点说,因为密度函数把所有的对象转化成了正电苛,因此就产生了一个正电苛密度分布。然后就是当直流电移除后,需要填充的区域的电量会比原来有直流电的时候的电量更小,因此就变成了负电苛。同时过于填充的区域依然是正电苛(但是电量比原来小了)。正电苛多的地方会向着负电苛区域移动,相互中和,从而达到一个静电平衡的状态。使得整个系统在布局区域内达到电苛密度为0并且电势也降到0。 这样就把布局的密度惩罚和梯度建模为了势能和电场。‘ ","date":"2023-03-27","objectID":"/posts/research/eplace/:2:1","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"密度惩罚和梯度 势能的总和等于新的元器件集合$V^{’}$中所有带电元素的势能之和,这些元素包含了来自$V$中的可移动节点、固定宏节点,也包含了下一步要讨论的填充节点和暗节点。 填充节点插入 上图中的黑色长方形表示宏元器件,红点表示标准元器件,蓝点表示填充节点,随着填充节点充斥在空白区域,有了更小的总线长,同时器件也挤压在了一起,相互离的更近。 $A_m$表示可移动节点的总面积,$A_{ws}$表示空白空间的总面积。如果目标密度是$\\rho_t \\geq \\frac{A_m}{A_{ws}}$,均匀密度分布会过度的把器件平铺,引起了不必要的线长增加。填充节点(filler cell)都是等尺寸(距形)的,可以移动和并且是断连(0引脚)。$A_{fc}$表示填充节点的总面积,定义如下: $$A_{fc} = \\rho_tA_{ws}-A_m \\tag{13}$$ 每个填充节点$i$的面积是$A_i$,这个是由可移动器件的面积分布所决定的。每个填充节点的尺寸是可移动器件的中间80%的平均尺寸。填充节点的插入会增加额外的密度力,这会使得元器件和他的连接器件之间的距离更小,同时也会满足密度约束。全局布局结束以后,所有的填充节点都会删除。 ","date":"2023-03-27","objectID":"/posts/research/eplace/:2:2","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"暗节点插入 用一个均匀的网格$R(m\\times m)$铺在所有的布局区域上,$R$里面不属于任何布局区域的所有空间都会被划分成一个包含很多长方形格子的集合,每一个格子就是一个暗节点, 对于暗节点的处理方式和固定器件的处理方式一致。$V_d$表示所有的暗节点集合,$A_d$表示所有的节点的总面积。当可移动节点到达布局的边界上时,可移动节点会因为受到暗节点的排斥力而停止。 ","date":"2023-03-27","objectID":"/posts/research/eplace/:2:3","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"密度缩放 填充节点插入后,目标密度就变成了$\\rho_t = \\frac{A_m+A_{fc}}{A_{ws}}$。为了去维持全局等效的密度分布,每一个固定节点或者暗节点$i$的面积$A_i$都需要通过$\\rho_t$进行缩放,否则密度力会变得比填充物的密度力更大,并把器件排斥开,固定结点周围的空白区域会被置空,也会增加下图所示的线长开销。 上图中(a)和(b)在没有密度缩放的情况下,在大组件上网格的密度会高于目标密度,从而密度力会把器件从大组件周围推开,从而引起了宏组件周围更多待填充的空白区域和线长开销。 ","date":"2023-03-27","objectID":"/posts/research/eplace/:2:4","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"势能计算 $V^{’}=V_m \\bigcup V_f \\bigcup V_{fc} \\bigcup V_d$表示系统中所有元素的集合,对于每一个节点$i \\in V^{’}$,$\\rho_i$、$\\xi_i$和$\\psi_i$分别表示该节点的电密度、电场和电势。给定一个可移动器件集合$V_m$和填充节点集合$V_{fc}$的布局方案$\\mathbf{v}$,其总的势能如下表示: $$N(\\mathbf{v})=\\frac{1}{2}\\sum_{i \\in V^{’} }N_i=\\frac{1}{2}\\sum_{i \\in V^{’} }q_i\\psi_i \\tag{14}$$ 因为系统的势能会等于所有的电苛的相互作用之和,所以每个单节点需要乘以$\\frac{1}{2}$,把重多网格密度约束问题转化成了一个0势能系统的单一势能约束$N(\\mathbf{v})=0$。通过引入惩罚因子$\\lambda$,一个不受约束的优化问题如下: $$\\min_\\mathbf{v} f = W(\\mathbf{v})+\\lambda N(\\mathbf{v}) \\tag{15}$$ 其中$W(\\mathbf{v})$是来自方程6,$f(\\mathbf{v})$表示的是最小化的代价函数。因为$W(\\mathbf{v})$和$N(\\mathbf{v})$都是平滑的,我们可以通过求微分得到如下的梯度向量$\\nabla f(\\mathbf{v})$: $$\\nabla f(\\mathbf{v}) = \\nabla W(\\mathbf{v})+\\lambda\\nabla N(\\mathbf{v})= \\begin{pmatrix} \\frac{\\partial W}{\\partial x_1},\\frac{\\partial W}{\\partial y_1},\\cdots \\end{pmatrix}^T - \\lambda(q_1{\\xi_1}_x,q_1{\\xi_1}_y,\\cdots)^T \\tag{16}$$ ","date":"2023-03-27","objectID":"/posts/research/eplace/:2:5","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"泊松方程和数值计算 根据在3里面定义的eDensity(电密度)公式,使用泊松方程去解决带电势和电场的电苛密度问题。诺伊曼边界条件(the Neumann boundary condition)是用来去合法化全局布局方案。泊松方程是可以数值求解的,其用到了谱方法,有着高精确度并且简单。因此,我们提出该技术在离散网格上局部平滑化电密度。 ","date":"2023-03-27","objectID":"/posts/research/eplace/:3:0","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"明确定义的泊松方程 根据高斯准则,电势分布$\\psi(x,y)$可以借助泊松方程使用电密度函数$\\rho(x,y)$来求解,方程如下所示: $$\\nabla \\cdot \\nabla\\psi(x,y)=-\\rho(x,y),(x,y) \\in R\\tag{17}$$ 令$\\mathbf{\\hat n}$是布局区域的外法向量,$\\partial R$是边界。当器件向布局区域的边界上移动时,为了阻止元器件向边界外移动,会停止或者减慢器件的继续向外运动。当器件到达密度函数值域的边界时电密度力会减少到0。因此借助诺伊曼边界条件,边界上就需要定义一个0梯度。 $$\\mathbf{\\hat n} \\cdot \\nabla\\psi(x,y)=0,(x,y) \\in \\partial R\\tag{18}$$ 此外,在整个布局区域R上电势函数$\\psi(x,y)$和密度函数$\\rho(x,y)$的积分都需要为0,如下所示 $$\\iint_{R} \\rho(x,y)=\\iint_R\\psi(x,y)=0\\tag{19}$$ 因此,所有来自电场和电势密度的不定积分所引入的常量因子都是0。方程19也保证了方程17中的偏微分方程有唯一解。克服了定义了在Eisenmann and Johannes [1998]中因定义不清晰的偏微分方程所引起的问题。 基于先前的定义和讨论,整个泊松方程的构建如下: $$\\begin{cases} \\nabla \\cdot \\nabla\\psi(x,y)=-\\rho(x,y) \\ \\mathbf{\\hat n} \\cdot \\nabla\\psi(x,y)=0,(x,y) \\in \\partial R \\ \\iint_{R} \\rho(x,y)=\\iint_R\\psi(x,y)=0 \\ \\end{cases} \\tag{20}$$ 不同于以往的基于偏微分方程的布局方法,该论文是基于一个完整的系统模型。密度惩罚是被正式的定义为系统势能。泊松方程是用来去求解电场,它和电量一起共同作用决定了密度梯度,该梯度遵从洛仁力量定律。通过设置电势的积分为0,该偏微分方程的唯一解得到了保证。计算简单且没有额外的线性项。 ","date":"2023-03-27","objectID":"/posts/research/eplace/:3:1","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"使用谱方法快速数值求解法 谱方法表示的是把某些偏微分求解看成是基函数(例如是正余弦波)的总和,并且在求和的时候选择系数去满足偏微分方程的边界条件。正弦函数是一个奇函数,同时也是一个周期函数。在每一个周期的边界上,函数值为0,这就很自然的满足了伊曼边界条件。因此我们使用正弦函数作为基函数去表示电场。 因为电密度和电势分别是电场的导数和积分,我们使用余弦函数作为基函数去表示电密度和电势。 基于这样一种在频域中的分解,使用谱方法可以求解泊松方程。通过使用离散余弦变换(DCT, discrete cosine transformation),把原始的密度函数$\\rho(x,y)$修改成一个奇且周期的函数形式$\\rho _{DCT}(x,y)$。所以新的函数可以分解成一组不同频率上的余弦波振荡,且可以通过DCT来构建。电场函数和电势函数则可以用相似的方法用离散正弦变换(DST)来构建。 对于密度函数具体的修改方式如下: 假定布局区域R被均匀的划分成一个个$m\\times m$的的小格子,因此密度口中函数$\\rho(x,y)$的定义域为$[0,m-1]\\times[0,m-1]$,把密度波映射到负半边则函数的定义域扩展到品了$[-m,m-1]\\times[-m,m-1]$,则密度函数变成了偶函数。然后周期是性的把函数的定义域扩展到$[-\\infty,+\\infty]\\times[-\\infty,+\\infty]$,基于上述的这两个修改,新的密度函数$\\rho_{DCT}(x,y)$可以使用DCT来表示。 假定$u$和$v$是0到m-1的整数下标,频率分量分别定义为$w_u=2\\pi \\frac{u}{m}$和$w_v=2\\pi \\frac{v}{m}$,同时我们使用$a_{u,v}$表示每个DCT基波函数的系数。由定义可知,所有的$m\\times m$系数可以由二维网格上的基波函数乘以密口度函数的积分得到,公式如下所示: $$a_{u,v}= \\frac 1m \\sum_{x=0}^{m-1}\\sum_{y=0}^{m-1}\\rho(x,y)\\cos(w_ux)\\cos(w_vy) \\tag{21}$$ 则所有的先验系数都可以通过快速傅立叶变换一次性求得。使用余弦系数,新的密度函数$\\rho_{DCT}(x,y)$可以通过余弦波的和如下表示: $$\\rho_{DCT}(x,y)= \\sum_{u=0}^{m-1}\\sum_{v=0}^{m-1}a_{u,v}\\cos(w_ux)\\cos(w_vy) \\tag{22}$$ 上述方程可以通过调用FFT库快速求解,基于通过方程17和19和在方程22上的余弦表达式,有了如下的势能函数$\\psi_{DCT}(x,y)$方程: $$\\psi_{DCT}(x,y)= \\sum_{u=0}^{m-1}\\sum_{v=0}^{m-1} \\frac {a_{u,v}}{w_u^2+w_v^2} \\cos(w_ux)\\cos(w_vy) \\tag{23}$$ 根据高斯法则,电场向量是方程11当中势能函数的负梯度,基于方程23定义的势能函数,可以用DCT和DST的形式得到电场的函数表达式$\\xi(x,y)=(\\xi_{X_{DSCT}},\\xi_{Y_{DCST}})$,如下所示: $$\\begin{cases} \\xi_{X_{DSCT}}= \\sum_u\\sum_v \\frac {a_{u,v}w_u}{w_u^2+w_v^2} \\sin(w_ux)\\cos(w_vy) \\ \\xi_{Y_{DCST}}= \\sum_u\\sum_v \\frac {a_{u,v}w_v}{w_u^2+w_v^2} \\cos(w_ux)\\sin(w_vy) \\end{cases} \\tag{24}$$ 其中水平分量$\\xi_{X_{DSCT}}$是由水平电场的正弦波所构建的,x值在周期结束的时候,也就是在到达布局的边界上的时候,其值为0。垂直分量$\\xi_{Y_{DCST}}$同理。这两个分量可以通过FFT库直接求解。 本方法中使用了DCT和DST谱方法去给偏微分方程求解,在这个方法里面密度惩罚建模为系统势能,密度梯度建模为电苛力。 ","date":"2023-03-27","objectID":"/posts/research/eplace/:3:2","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"行为和复杂度分析 下图表示了一个二维平面的离散密度的电场分布,随着迭代的进行密度的分布也会发生变化,电场的分布也会改变,因此电场会动态的指引器件向欠填充区域流动。从下图当中我们也发现到,在布局区域的边界上,电场变为0。这样的行为就满足了边界条件和全局布局的要求。下图当中的灰点是密度分布,红箭头是电场方向。 假定布局区域上总的有$n^{’}$个器件($n^{’}=|V_m|+|V_{fc}|$)和一个$m\\times m$的网格。本方法的总的复杂度主要来自两个方面, 一是密度计算,二是势能和电场的计算。 密度计算。每个迭代中,密度函数是由下面两步完成: (1)遍历B中所有的元素去清空器件密度和器件面积到0 (2)遍历所有的可移动器件和填充器件,对于有重叠的相应网格需要计算每个器件对于相应网格的面积贡献 第一步的时间复杂度是$O(m^2)$,第二步的复杂度是$O(n^{’})$,所以每个迭代产生密度分布的总时间复杂度为$O(m^2+n^{’})$。 势能电场计算。每个迭代会调用四次FFT库去解决方程21、23和24。每个2维的FFT库的复杂度为$O(m^2\\log m^2)=O(2m^2\\log m)=O(m^2\\log m)$,因此总的复杂度为$O(m^2\\log m)$ 一般来说,我们的数值方法每个布局迭代的时间复杂度为$O(n^{’}+m^2 \\log m)$。因为网格的数量规模通常和器件是同一个数级规模(可以确保离散后的准确性),所以有$O(n^{’})=O(m^2)$,并且总的时间复杂度为$O(m^2\\log m)$或$O(n^{’}\\log n^{’})$。填充器件的加入会增加一些计算时间,但是不会改变整体的计算量级。所有的填充器件和标准器件的平均尺寸一样大,如果效率低的话标准器件会被放大到网格的尺寸,使得填充物的总数量不会超过$O(m^2)$。而且因为填充器件的个数规模和可移动器件的规模是一样的,会有$n=O(n^{’})$,因此总的时间复杂度为$O(n\\log n)$,$n$为可移动器件的个数。 ","date":"2023-03-27","objectID":"/posts/research/eplace/:3:3","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"离散网格上的局部平滑 电密度的全局平滑可以通过方程11和方程12得到。因为每个单元网格的大小通常会比器件的尺寸要大,所以单元网格内部的局部运动是不能在密度函数上反应出来的,从而使平滑性变差。因此我们提出了一种局部平滑技术使得方程14中的密度函数可以反应出每个单元网格内部的任何细微的运动。如下图表示的是一个一维的例子,其中$w_i$表示的是器件的宽度,$w_b$表示的是单元格的宽度;然后,$c_i$表示的是器件中心的坐标,$c_b$单元格中心的坐标。 $l_x(i,b)$表示的是原始的器件和单元格在水平方向上的重叠,$\\hat l_x(i,b)$表示的是平滑后的水平方向上的重叠。则有如下: $$\\hat l_x(i,b)=\\begin{cases} (1.0-\\frac {c_i-c_b}{w_b})\\times w_i:c_i \\in [c_b-w_b,c_b+w_b]\\ 0:c_i \\in [-\\infty,c_b-w_b]\\cup[c_b+w_b,+\\infty] \\end{cases} \\tag{25}$$ 随着器件向右移动,器件对单元格$b’$的密度贡献线性减少,对单元格$b’’$贡献线性增加。当器件在两个单元格坐标$c_{b’}$和$c_{b’’}$的中间的时候,也就是$c_i$在$[c_{b’},c_{b’’}]$上的时候,器件$i$对于两个单元格的总贡献是不变的,且贡献为$w_i$。这种平滑的效果是等价于器件的拉伸和器件密度降低的组合,保持了目标代价函数的可解析。对于每一个器件$i$,局部平滑化进行如下操作: 如果$w_i\u003c w_b$,把器件的宽度从$w_i$拉长到$w_b$,并且把器件密度从1.0减少到$w_i/w_b$ 如果$w_i\\ge w_b$,保持原来的细胞宽度和密度 这种平滑技术在不同的粒度和器件尺寸上都是一样的,在每个迭代更新密度图的时候都会用到这种平滑技术。因为对于每个器件来说只有有限个邻近的单元格会被该器件影响到,所以其时间复杂度是恒定不变的,因此计算复杂度并未发生变化。 ","date":"2023-03-27","objectID":"/posts/research/eplace/:3:4","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"非线性优化 布局问题是NP完全问题。如方程9中所示,目标函数由一个凸线长函数和一个非凸密度函数组成,非凸函数加大了现代凸规划方法求解的难度。本部分先介绍先前非线性布局当中使用到的共轭梯度方法,讨论线搜索的效率瓶颈。这篇论文是首次在全局布局优化中使用Nesterov’s方法和Lipschitz常数预测。 ","date":"2023-03-27","objectID":"/posts/research/eplace/:4:0","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"共轭梯度法 下图为第k个迭代的时候的算法,其中第4行是线搜索算法,存在较多的问题。 ","date":"2023-03-27","objectID":"/posts/research/eplace/:4:1","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"使用Lipschitz常数预测的Nesterov’s方法 和CG法类似,但是Nesterov法只需要一阶导数和线性的内存开销。Nesterov法旨在解决Hilbert空间$H$里的凸规划问题。和大多数和凸规划方法不同,Nesterov法构建了一个不松弛的最小化的点序列${\\mathbf{u}_k}_0^\\infty$。算法2如下所示,表示了第k次迭代的处理算法,这次迭代主要聚焦在$\\min{f(\\mathbf{u})|\\mathbf{u} \\in H}$这个问题上,该问题有非空的最小值集合$U^*$。算法2如下所示: 上述算法中,$\\mathbf{u}$是凸规划问题的解,$\\mathbf{v}$是用来计算步长的参考解,$a$是优化参数,$\\alpha$是步长。迭代开始时($k=0$),该方法会初始化$\\mathbf{v}_0 \\in H,a_0=1,\\alpha_0=\\frac{||\\nabla f(\\mathbf{v}_0)-\\nabla f(\\mathbf{z})||}{||\\mathbf{v}_0-\\mathbf{z}||}$。其中$\\mathbf{z}$是$H$中的任意一个点且$\\mathbf{z}\\neq\\mathbf{v}_0$。Nesterov法的收敛率是$O(1/k^2)$,上述算法的第2行主要就是加速收敛,如果要达到预期的收敛率,则步长$\\alpha_k$在每一个迭代中都要满足下列方程: $$f(\\mathbf v_k)-f(\\mathbf v_k-\\alpha_k\\nabla f(\\mathbf v_k))\\geq0.5\\alpha_k||\\nabla f(\\mathbf v_k)||^2 \\tag{26}$$ Nesterov法的上界错误率方程27所示。 定理 5.1。假定$f(\\mathbf u)$是一个在$C^{1,1}(H)$和$U^* \\neq \\varnothing$上的凸函数,其中$C^{1,1}(H)$表示梯度函数$\\nabla f(\\mathbf u)$是Lipschitz连续的。现有$\\mathbf u\\in U^*$,并且$L$是梯度函数$\\nabla f(\\mathbf u)$的Lipschitz常数。则由上述算法2输出的$\\mathbf{u}_k$会存在以下公式: $$f(\\mathbf u_k)-f(\\mathbf u^*) \\geq \\frac{4L||\\mathbf v_0-\\mathbf u^*||^2}{(k+2)^2} \\tag{27}$$ 定义 5.2。给定一个函数$f \\in C^{1,1}(H)$,并且$L$是梯度函数$\\nabla f(\\mathbf u)$的Lipschitz常数,则对于任意的$\\mathbf u,\\mathbf v \\in H$有 $$||\\nabla f(\\mathbf u)-\\nabla f(\\mathbf v)||\\leq L||\\mathbf v-\\mathbf u||, \\tag{28}$$ 并且$\\nabla f(\\mathbf u)$是Lipschitz连续的。因为Nesterov法使用了二分查找法去计算最大步长所以,在每一个迭代中目标函数都需要评估$O(\\log L)$次,则时间复杂度增加到了$O(n\\log n\\log L)$。相反,我们使用步长预测去加速我们的布局算法。正如在论文Nesterov [1983]中讨论的,如果梯度函数的Lipschitz常数已知,我们可以设置步长为Lipschitz常数的倒数去满足方程26,不会引起任何开销。但是预测准确全局布局梯度函数的Lipschitz常数往往会比较困难,因为有如下原因: 因为密度函数的加入,使得目标函数非凸,因此定理5.1不满足。 因为要动态的调整平滑系数(方程6),线长函数会随着迭代而改变。 因为要在运行的时候做力平衡,所以在密度函数上方程15中的惩罚因子$\\lambda$会随着迭代而变化。 因为上述特性,全局布局函数是非凸且动态变化的,所以需要一个随着迭代去动态估计Lipschitz常数为$\\widetilde L$。基于方程28,分别设定函数$\\mathbf x$和$\\mathbf y$的值为当前参考值$\\mathbf y_k$和上一次迭代的参考值$\\mathbf y_{k-1}$,则$\\nabla f(\\mathbf y_k)$Lipschitz常数可以用如下公式逼近: $$\\widetilde L_k = \\frac {||\\nabla f(\\mathbf y_k)-\\nabla f(\\mathbf y_{k-1})||} {||\\mathbf y_k-\\mathbf y_{k-1}||} \\tag{29}$$ 则根据上述讨论可以知道步长为: $$\\alpha_k=\\frac{1}{\\widetilde L_k}$$ 上述的方法是高效的,因为: (1)都是已知的,没有额外的计算。 (2)相比较于随机的选择$\\mathbf x$和$\\mathbf y$,前后迭代的$\\mathbf y_k$和$\\mathbf y_{k-1}$的值比较接近,则$||\\mathbf y_k-\\mathbf y_{k-1}||$值相对较小,可以防止对Lipschitz常数的估计精度过低,并且防止过度估计步长$\\alpha_k$。 在实验当中也证实了,这种估计法有效的加速了计算过程。 ","date":"2023-03-27","objectID":"/posts/research/eplace/:4:2","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"预处理 预处理减少了问题的条件数,使得原本的问题更加适合数值求解法求解。传统的预处理方法是计算并且反转目标函数$f$的海森矩阵$H_f$。因为密度函数是非凸的所以在非线性布局上还没人使用预处理。预处理梯度向量$\\nabla f_{pre}=H^{-1}\\nabla f$可以平滑化数值优化,加速函数的收敛。 因为全局布局的目标函数是高度非线性并随迭代变化,再者问题的规模往往是百万级别,这就使得每次迭代的时候计算海深矩阵的代价就太高了,且不实际。为了可以在实际中计算海森矩阵,我们使用只使用海森矩阵对角项的雅格比预处理来近似求解,如下所示: $$\\mathbf H_{\\mathbf f_{\\mathbf x,\\mathbf x}}= \\begin{Bmatrix} \\frac {\\partial^2 f} {\\partial x^2_1} \u0026 \\frac {\\partial^2 f} {\\partial x_1\\partial x_2} \u0026\\cdots \u0026\\frac {\\partial^2 f} {\\partial x_1\\partial x_n} \\\\ \\frac {\\partial^2 f} {\\partial x_2\\partial x_1} \u0026 \\frac {\\partial^2 f} {\\partial x^2_2} \u0026\\cdots \u0026\\frac {\\partial^2 f} {\\partial x_2\\partial x_n} \\\\ \\vdots \u0026 \\vdots \u0026\\ddots \u0026\\vdots\\\\ \\frac {\\partial^2 f} {\\partial x_n\\partial x_1} \u0026 \\frac {\\partial^2 f} {\\partial x_n\\partial x_2} \u0026\\cdots \u0026\\frac {\\partial^2 f} {\\partial x^2_n} \\\\ \\end{Bmatrix} \\approx\\begin{Bmatrix} \\frac {\\partial^2 f} {\\partial x^2_1} \u0026 0 \u0026\\cdots \u00260 \\\\ 0 \u0026 \\frac {\\partial^2 f} {\\partial x^2_2} \u0026\\cdots \u00260 \\\\ \\vdots \u0026 \\vdots \u0026\\ddots \u0026\\vdots \\\\ 0 \u0026 0 \u0026\\cdots \u0026\\frac {\\partial^2 f} {\\partial x^2_n} \\\\ \\end{Bmatrix}=\\widetilde H_{\\mathbf f_{\\mathbf x,\\mathbf x}}\\tag{30}$$ 根据上述近似,同理可以计算$\\mathbf H_{\\mathbf f_{\\mathbf y,\\mathbf y}}$,因此可以计算出$\\mathbf H_{\\mathbf f}$。通过方程15则有$\\frac {\\partial^2 f(\\mathbf v)} {\\partial x^2_i}=\\frac {\\partial^2 W(\\mathbf v)} {\\partial x^2_i}+\\lambda\\frac {\\partial^2 N(\\mathbf v)} {\\partial x^2_i}$,我们可以精准的估计出$\\frac {\\partial^2 W(\\mathbf v)} {\\partial x^2_i}和\\frac {\\partial^2 N(\\mathbf v)} {\\partial x^2_i}$的值,保证预处理的可行性。方程6中对线长函数微分的代价会比较高,所以我们使用器件$i$的顶点度来计算,如下: $$\\frac {\\partial^2 W(\\mathbf v)} {\\partial x^2_i}=\\sum_{e\\in E_i}\\frac {\\partial^2 W_e(\\mathbf v)} {\\partial x^2_i}\\implies |E_i|,\\tag{31}$$ 其中$E_i$表示和器件i相关的网表子集。方程14中所表示的密度函数是非凸的,就使得传统的预处理方法不能够得到预期的性能。方程32使用了二阶微分: $$\\frac {\\partial^2 N(\\mathbf v)} {\\partial x^2_i}=q_i\\frac {\\partial^2 \\psi(\\mathbf v)} {\\partial x^2_i}=q_i\\frac {-\\partial \\xi_{i_x}(\\mathbf v)} {\\partial x_i}= q_i。\\tag{32}$$ 所以使用线性项$q_i$作为密度预处理,使用上述的近似来表示$\\widetilde H_{\\mathbf f_{\\mathbf x,\\mathbf x}}$会有如下方程: $$\\widetilde H_{\\mathbf f_{\\mathbf x,\\mathbf x}}=\\begin{Bmatrix} |E_1|+\\lambda q_1 \u0026 0 \u0026\\cdots \u00260 \\\\ 0 \u0026 |E_2|+\\lambda q_2 \u0026\\cdots \u00260 \\\\ \\vdots \u0026 \\vdots \u0026\\ddots \u0026\\vdots \\\\ 0 \u0026 0 \u0026\\cdots \u0026|E_n|+\\lambda q_n \\\\ \\end{Bmatrix} \\tag{33}$$ 因此可以计算出预处理的梯度为$\\nabla f_{pre}=\\widetilde {\\mathbf H}_{\\mathbf f}^{-1}\\nabla f$ ","date":"2023-03-27","objectID":"/posts/research/eplace/:4:3","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"全局布局算法 如下图8所示表示的是,ePlace的整个布局流程: 其中分为三个阶段: (1)初始布局 :使用B2B网络模型最小化二次项线长函数,得到初始布局的输出结果$\\mathbf v_{ip}$。 (2)全局布局:根据电势理论优化器件的位置 (3)细节布局:全局布局完成后,移除所有的填充器件,并使用FastDP进行合法化和离散优化。 从上面的讨论中我们知道,CG法和Nesterov法都是用来解决方程15中不受限的优化问题,为了去改善优化结果和收敛率,我们使用了一种自适应参数调整法。 ","date":"2023-03-27","objectID":"/posts/research/eplace/:5:0","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"自适应参数调整法 网格的尺寸 在整个全局布局阶段,网格的大小都是固定的。这是在粒度和效率之间的平衡。越大的尺寸往往代表的是高效低准确率,越小的尺寸则相反。比较大的尺寸也会带来一些额外的问题,更多的器件会有相同的密度力。这些器件糅合在一起,有相同的运动轨迹,也就是说这些器件会在相邻区域间发生密度震荡,阻止器件的扩散。 这篇论文中风格的尺寸大小是基于器件和填充器件的个数来计算,把网格的尺寸设定为$m=\\min(\\lceil \\log_2\\sqrt{n{’}} \\rceil, 1024)$,设定最大为1024的原因是出于效率考虑。 步长 在Nesterov法中根据方程29可以估计出步长为Lipschitz常数估计的倒数,即$\\alpha_k=\\frac{1}{\\widetilde L_k}$。在CG法中,步长由线搜索来决定的,在搜索间隔中,沿着共轭梯度的方向线搜索会找到局部最优,搜索的间隔$\\alpha_k^{\\max}$是动态的调整的。初始的间隔$\\alpha_0^{\\max}$和单元格的大小成线性关系$\\alpha_0^{\\max}=kw_b$,其中$w_b$是单元格宽度。实际设置$k=0.044$可以得到较好的布局质量,并且$\\alpha_k^{\\max}$需要基于当前最优步长$\\alpha_{k-1}$进行更新,如下所示: $$\\alpha_k^{\\max}=\\max(\\alpha_0^{\\max},2\\alpha_{k-1}),\\alpha_k^{\\min}=0.01\\alpha_k^{\\max} \\tag{34}$$ 通过方程34,如算法1的第4行所示,GSS可以计算出第k次迭代的步长$\\alpha_k$。线搜索会在间隔缩小到$\\alpha_k^{\\min}$时停止,所以得到的步长$\\alpha_k$不一定是局部最优。 惩罚因子 为了去平衡密度和线长的力,在方程35中设定惩罚因子的初始值为: $$\\lambda_0=\\frac {\\sum_{i \\in V_m^{’}}\\mid W_{x_i} \\mid+\\mid W_{y_i} \\mid} {\\sum_{i \\in V_m^{’}}q_i(\\mid \\xi_{x_i} \\mid+\\mid \\xi_{y_i} \\mid)} \\tag{35}$$ 其中$W_{x_i}=\\frac{\\partial W}{\\partial x_i},W_{y_i}=\\frac{\\partial W}{\\partial y_i}$,$\\xi_{x_i}$是节点i的水平电场,$\\xi_{y_i}$是节点i的垂直电场。 因为线长和密度都是随着迭代变化的,为了去适应这种实时的变化,惩罚因子也需要时间更新,我们通过如下的式子去更新因子: $$\\lambda_k=u_k\\lambda_{k-1}$$ 令$\\Delta HPWL_k=HPWL(\\mathbf v_k)-HPWL(\\mathbf v_{k-1})$,则$u_k$的定义如下: $$u_k=u_{0}^{-\\frac{\\Delta HPWL_k}{\\Delta HPWL_{ref}}+1.0}(u_0=1.1,\\Delta HPWL_{ref}=3.5\\times10^5) \\tag{36}$$ 如下图所示,不管是在CG法和Nesterov法上,随着迭代的进行因子的值在增加。 密度溢出 全局布局当重叠足够小的时候会结束,接下来就是要处理合法化和细节布局了。使用如下的密度溢出值$\\tau$,公式如下: $$\\tau=\\frac {\\sum_{b \\in B}\\max(\\rho_b^{’}-\\rho_t,0) A_{b}} {\\sum_{i \\in V_m}A_i} \\tag{37}$$ 其中,$A_{b}$是单元格面积,$A_{i}$是可移动器件面积。$\\rho_b^{’}$是只和可移动器件相关的单元格$b$的密度。当密度溢出的值$\\tau\\leq\\tau_{min}$时,全局布局停止。 线长系数 实验中显示,收敛结果和布局结果对于平滑参数$\\gamma$的变化比较敏感。为了在全局上让更多的的器件逃离高密度区域,本论文中的方法在迭代早期放松平滑参数。在后期阶段,当局部调整占主导的时候,参数值变小使得平滑的线长接近HPWL。 同时较小尺寸的单元格密度对于器件的运动会更加敏感,相反越的尺寸就越不敏感。因此设置平滑参数$\\gamma$为密度溢出和单元格宽度的函数。通过减少平滑参数的值,为了去减少剩余的重叠,只需要允许可以局部移动的HPWL不敏感的器件运动。我们所提到的这些HPWL不敏感的器件,指的是它们的运动不会改变器件相关网表的HPWL值,也可以理解成这些器件离网表的边界相对而言比较远。对于 迭代的后期,为了使得线长平滑的收敛,只允许在布局平面上有较小的扰动。所以,因为我们的目的是增加线长建模的准确性,对应的线长力会变得更强去只允许有小规模的运动,也就是较小的平面扰动。如下图所示,最终平滑的HPWL收敛到了HPWL: 在本论文的实验中显示,如下公式建模平滑系数会有比较好的布局结果,公式如下: $$\\gamma(\\tau)=8.0w_b\\times10^{k\\tau+b} \\tag{38}$$ 密度溢出通过在开始为100%,结束的时候为10%(终止条件),根据经验调整有$\\gamma(\\tau=1.0)=80w_b$,有$\\gamma(\\tau=0.1)=0.8w_b$,则可以计算出$k=\\frac{20}{9},b=-\\frac{11}{9}$。 ","date":"2023-03-27","objectID":"/posts/research/eplace/:5:1","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["笔记"],"content":"全局布局 下图为ePlace全局布局算法的整体流程: 对算法的详细解释如下: 输入参数: $\\mathbf v_0=\\mathbf v_{ip}$表示的是初始布局中的输出结果,标准器件是放置在区域中间,填充器件是随机的分布在整个布局区域$R$上。 $m\\times m$网格拆分规模 最小的密度溢出$\\tau^{\\min}$ 最大的迭代次数为3000 第1行把布局区域R拆分成$m\\times m$的网格 第2行初始化密度惩罚因子 第3行初始化最大间隔(这个在调用CG算法的时候会用到,如果是Nesterov法的话不会用到) 第5行定义了目标函数$f_k$ 第6行计算线长梯度和密度分布 第7行使用FFT库去计算场和势能 第8行计算密度梯度 第9行计算目标函数的总梯度 第10行调用非线性方法(Nesterov法或者CG法)求解新的布局结果 第11行更新非线性方法需要的参数 第12行去判定是不是满足终止条件 最后返回全局布局的结果。 随着迭代的运行,标准器件会从过填充的区域分散到待填充的区域,密度力会把无连接的填充器件推向布局的边界。最后所有的标准器件会收敛到一个稳定状态,此时系统和势能和线长处于可以接受的状态。 ","date":"2023-03-27","objectID":"/posts/research/eplace/:5:2","tags":["电势"],"title":"基于电势的解析布局","uri":"/posts/research/eplace/"},{"categories":["索引"],"content":"教程 Hugo博客官方教程 Markdown 官方教程 ","date":"2022-12-10","objectID":"/posts/misc/collection/:1:0","tags":["收藏","传送门"],"title":"好物收藏","uri":"/posts/misc/collection/"},{"categories":["索引"],"content":"工具 图片上传 | PicX 图床神器 (xpoet.cn) ","date":"2022-12-10","objectID":"/posts/misc/collection/:2:0","tags":["收藏","传送门"],"title":"好物收藏","uri":"/posts/misc/collection/"},{"categories":["建站"],"content":" 本人原来使用的博客是vuepress + vdoing,后来在使用的过程中发现这个博客非常的笨重,没有多少的文章编译下来就需要一会时间。 以前使用过wordpress,这个用来建站是很不错的选择用来做博客的话需要有自己的服务器,并且对于Markdown文档的支持不是很好,现在的博客基本上是使用markdown来写,所以不考虑wordpress。 然后了解到Hugo的出现,看了他的优势,打包速度快,几乎不受文件多少的影响。为了更好专注在写文章,同时可以不用每次繁琐的命令行操作和发布,本教程实现了快捷键操作的一键发布。 文章内容所见即所得。写完文章后快捷键 Crtl + U快速发布文章,然后等待GitHub Action部署完成,刷新页面就可以看到新文章,如下为展示的效果: 快速开始 现在已经把整套流程打通了,直接参考下面的步骤,可以实现Obsidian写博客+自动发布和部署。 下载(Obsidian)并安装 下载安装Git-Bash 配置Git - 生成 SSH 公钥 (git-scm.com) 创建github新项目为:你的用户名.github.io,如SivanLaai.github.io,其中SivanLaai为我的用户名 克隆本项目并切换分支 git clone --recursive git@github.com:SivanLaai/blog.git 进入blog目录,修改git远程仓库为你的github静态博客项目地址 git remote set-url origin git@github.com:SivanLaai/SivanLaai.github.io.git (可选) - 添加Github项目环境变量WEB_SITE为你自己的域名如```www.sivanlaai.laais.cn 利用obsidian打开blog文件夹,开始写博客 快捷键 Crtl + U快速发布文章(利用Obsidian Shell Command插件实现快速发布) 打开你的网址,如sivanlaai.github.io 其他玩法 ","date":"2022-12-09","objectID":"/posts/technology/auto_deploy_with_obsidian/:0:0","tags":["博客搭建","自动部署","hugo"],"title":"Obsidian写hugo博客,github自动部署","uri":"/posts/technology/auto_deploy_with_obsidian/"},{"categories":["建站"],"content":"评论功能(可选) **建议新手根据自己的时间来衡量是否加入,不然折腾起来也挺费劲,容易遇到这种问题。确实有时间的可以尝试 本教程中使用的hugo主题是Loveit,同时加入了评论功能,使用的是Waline评论系统,比较推荐使用这个评论系统,支持自建后端也可以使用免费的后端云服务,有评论管理功能,安全,支持登录和匿名模式,爆吹。 对于Waline的详细使用请看官方教程,根据官方教程配置好Waline后端好,在config.yml里面如下: waline: serverUrl: \"WALINE_SERVER_URL\" 把WALINE_SERVER_URL替换成你的Waline服务地址就可以。 ","date":"2022-12-09","objectID":"/posts/technology/auto_deploy_with_obsidian/:1:0","tags":["博客搭建","自动部署","hugo"],"title":"Obsidian写hugo博客,github自动部署","uri":"/posts/technology/auto_deploy_with_obsidian/"},{"categories":["建站"],"content":"站点统计 针对原版的不算子的统计功能,感觉有点鸡肋,可以尝试加入了其他的站点统计功能 umami(开源比较推荐) 百度统计——一站式智能数据分析与应用平台 (baidu.com) ","date":"2022-12-09","objectID":"/posts/technology/auto_deploy_with_obsidian/:2:0","tags":["博客搭建","自动部署","hugo"],"title":"Obsidian写hugo博客,github自动部署","uri":"/posts/technology/auto_deploy_with_obsidian/"},{"categories":["建站"],"content":"自有主机,docker安装Umami网站统计和Waline评论系统 1.创建文件夹 mkdir website \u0026\u0026 cd website 创建如下文件运行docker-compose up -d version: \"3\" services: db: image: mysql restart: always environment: - MYSQL_ROOT_PASSWORD=PASSWORD - MYSQL_PASSWORD=PASSWORD - MYSQL_DATABASE=umami - MYSQL_USER=user command: --default-authentication-plugin=mysql_native_password --transaction-isolation=READ-COMMITTED --binlog-format=ROW #解决外部无法访问 volumes: - ./conf:/etc/mysql/conf.d - ./data:/var/lib/mysql network_mode: \"host\" unami: image: ghcr.io/umami-software/umami:mysql-latest network_mode: \"host\" environment: DATABASE_URL: mysql://user:PASSWORD@localhost:3306/umami DATABASE_TYPE: mysql HASH_SALT: replace-me-with-a-random-string restart: always waline: container_name: waline image: lizheming/waline:latest restart: always network_mode: \"host\" volumes: - ${PWD}/data:/app/data environment: TZ: 'Asia/Shanghai' MYSQL_HOST: localhost MYSQL_DB: waline MYSQL_USER: user MYSQL_PASSWORD: PASSWORD SITE_NAME: \"SivanLaai's Blog\" SITE_URL: 'http://www.laais.cn' SECURE_DOMAINS: 'www.laais.cn' AUTHOR_EMAIL: 'eamil@163.com' SMTP_PASS: SMTP_PASSWORD SMTP_USER: qqid@qq.com SMTP_SERVICE: QQ 3 初始化waline数据库 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; SET NAMES utf8mb4; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; # Dump of table wl_Comment # ------------------------------------------------------------ CREATE TABLE `wl_Comment` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `user_id` int(11) DEFAULT NULL, `comment` text, `insertedAt` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `ip` varchar(100) DEFAULT '', `link` varchar(255) DEFAULT NULL, `mail` varchar(255) DEFAULT NULL, `nick` varchar(255) DEFAULT NULL, `pid` int(11) DEFAULT NULL, `rid` int(11) DEFAULT NULL, `sticky` boolean DEFAULT NULL, `status` varchar(50) NOT NULL DEFAULT '', `like` int(11) DEFAULT NULL, `ua` text, `url` varchar(255) DEFAULT NULL, `createdAt` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `updatedAt` timestamp NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; # Dump of table wl_Counter # ------------------------------------------------------------ CREATE TABLE `wl_Counter` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `time` int(11) DEFAULT NULL, `reaction0` int(11) DEFAULT NULL, `reaction1` int(11) DEFAULT NULL, `reaction2` int(11) DEFAULT NULL, `reaction3` int(11) DEFAULT NULL, `reaction4` int(11) DEFAULT NULL, `reaction5` int(11) DEFAULT NULL, `reaction6` int(11) DEFAULT NULL, `reaction7` int(11) DEFAULT NULL, `reaction8` int(11) DEFAULT NULL, `url` varchar(255) NOT NULL DEFAULT '', `createdAt` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `updatedAt` timestamp NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; # Dump of table wl_Users # ------------------------------------------------------------ CREATE TABLE `wl_Users` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `display_name` varchar(255) NOT NULL DEFAULT '', `email` varchar(255) NOT NULL DEFAULT '', `password` varchar(255) NOT NULL DEFAULT '', `type` varchar(50) NOT NULL DEFAULT '', `label` varchar(255) DEFAULT NULL, `url` varchar(255) DEFAULT NULL, `avatar` varchar(255) DEFAULT NULL, `github` varchar(255) DEFAULT NULL, `twitter` varchar(255) DEFAULT NULL, `facebook` varchar(255) DEFAULT NULL, `google` varchar(255) DEFAULT NULL, `weibo` varchar(255) DEFAULT NULL, `qq` varchar(255) DEFAULT NULL, `2fa` varchar(32) DEFAULT NULL, `createdAt` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `updatedAt` timestamp NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!401","date":"2022-12-09","objectID":"/posts/technology/auto_deploy_with_obsidian/:2:1","tags":["博客搭建","自动部署","hugo"],"title":"Obsidian写hugo博客,github自动部署","uri":"/posts/technology/auto_deploy_with_obsidian/"},{"categories":["教程"],"content":"nextcloud网盘相关问题 ","date":"2022-07-28","objectID":"/posts/technology/nextcloud/:1:0","tags":["nextcloud","apache","aria2"],"title":"nextcloud配置","uri":"/posts/technology/nextcloud/"},{"categories":["教程"],"content":"网盘配置 (1)配置环境 Linux + Apache2 + Mysql + Php(LAMP) Example installation on Ubuntu 20.04 LTS — Nextcloud latest Administration Manual latest documentation 配置Linux + Nginx + Mysql + Php(LNMP)环境 sudo apt update \u0026\u0026 sudo apt upgrade sudo apt install mariadb-server nginx php-gd php-mysql php-fpm \\ php-curl php-mbstring php-intl php-gmp php-bcmath php-xml php-imagick php-zip (2)安装nextcloud Installation on Linux — Nextcloud latest Administration Manual latest documentation (3)Nginx配置解析php Nginx配置上传大小 # /etc/nginx/nginx.conf http { client_max_body_size 20480M; client_body_buffer_size 10M; } 修改配置 # /etc/nginx/conf.d/nextcloud.conf ## # You should look at the following URL's in order to grasp a solid understanding # of Nginx configuration files in order to fully unleash the power of Nginx. # https://www.nginx.com/resources/wiki/start/ # https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/ # https://wiki.debian.org/Nginx/DirectoryStructure # # In most cases, administrators will remove this file from sites-enabled/ and # leave it as reference inside of sites-available where it will continue to be # updated by the nginx packaging team. # # This file will automatically load configuration files provided by other # applications, such as Drupal or Wordpress. These applications will be made # available underneath a path with that package name, such as /drupal8. # # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples. ## # Default server configuration # upstream php-handler { #server 127.0.0.1:9000; server unix:/run/php/php8.1-fpm.sock; } server { listen 80; listen [::]:80; server_name nextcloud.laais.cn; # Path to the root of your installation root /var/www/nextcloud; # Enable gzip but do not remove ETag headers gzip on; gzip_vary on; gzip_comp_level 4; gzip_min_length 256; gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/wasm application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; # Pagespeed is not supported by Nextcloud, so if your server is built # with the `ngx_pagespeed` module, uncomment this line to disable it. #pagespeed off; # HTTP response headers borrowed from Nextcloud `.htaccess` add_header Referrer-Policy \"no-referrer\" always; add_header X-Content-Type-Options \"nosniff\" always; add_header X-Download-Options \"noopen\" always; add_header X-Frame-Options \"SAMEORIGIN\" always; add_header X-Permitted-Cross-Domain-Policies \"none\" always; add_header X-Robots-Tag \"none\" always; add_header X-XSS-Protection \"1; mode=block\" always; # Remove X-Powered-By, which is an information leak fastcgi_hide_header X-Powered-By; # Specify how to handle directories -- specifying `/index.php$request_uri` # here as the fallback means that Nginx always exhibits the desired behaviour # when a client requests a path that corresponds to a directory that exists # on the server. In particular, if that directory contains an index.php file, # that file is correctly served; if it doesn't, then the request is passed to # the front-end controller. This consistent behaviour means that we don't need # to specify custom rules for certain paths (e.g. images and other assets, # `/updater`, `/ocm-provider`, `/ocs-provider`), and thus # `try_files $uri $uri/ /index.php$request_uri` # always provides the desired behaviour. index index.php index.html /index.php$request_uri; # Rule borrowed from `.htaccess` to handle Microsoft DAV clients location = / { if ( $http_user_agent ~ ^DavClnt ) { return 302 /remote.php/webdav/$is_args$args; } } location = /robots.txt { allow all; log_not_found o","date":"2022-07-28","objectID":"/posts/technology/nextcloud/:1:1","tags":["nextcloud","apache","aria2"],"title":"nextcloud配置","uri":"/posts/technology/nextcloud/"},{"categories":["教程"],"content":"请更改权限为 0770 以避免其他用户查看目录 config.php . 'check_data_directory_permissions' =\u003e false, ... ","date":"2022-07-28","objectID":"/posts/technology/nextcloud/:1:2","tags":["nextcloud","apache","aria2"],"title":"nextcloud配置","uri":"/posts/technology/nextcloud/"},{"categories":["教程"],"content":"安装配置启动aria2 安装aria2 sudo apt install aria2 cd /etc/ \u0026\u0026 mkdir aria2 \u0026\u0026 cd aria2 \u0026\u0026 touch aria2c.conf \u0026\u0026 touch aria2.session 创建配置文件 #aria2c.conf ## 文件保存相关 ## # 文件保存目录 dir=/var/www/nextcloud/data/nextcloud/files/Video # 启用磁盘缓存, 0为禁用缓存, 需1.16以上版本, 默认:16M disk-cache=32M # 断点续传 continue=true # 文件预分配方式, 能有效降低磁盘碎片, 默认:prealloc # 预分配所需时间: none \u003c falloc ? trunc \u003c prealloc # falloc和trunc则需要文件系统和内核支持 # NTFS建议使用falloc, EXT3/4建议trunc, MAC 下需要注释此项 file-allocation=trunc ## 下载连接相关 ## # 最大同时下载任务数, 运行时可修改, 默认:5 #max-concurrent-downloads=10 # 同一服务器连接数, 添加时可指定, 默认:1 # 官方的aria2最高设置为16, 如果需要设置任意数值请重新编译aria2 max-connection-per-server=16 # 整体下载速度限制, 运行时可修改, 默认:0(不限制) #max-overall-download-limit=0 # 单个任务下载速度限制, 默认:0(不限制) #max-download-limit=0 # 整体上传速度限制, 运行时可修改, 默认:0(不限制) #max-overall-upload-limit=0 # 单个任务上传速度限制, 默认:0(不限制) #max-upload-limit=0 # 禁用IPv6, 默认:false # disable-ipv6=true # 最小文件分片大小, 添加时可指定, 取值范围1M -1024M, 默认:20M # 假定size=10M, 文件为20MiB 则使用两个来源下载; 文件为15MiB 则使用一个来源下载 min-split-size=10M # 单个任务最大线程数, 添加时可指定, 默认:5 # 建议同max-connection-per-server设置为相同值 split=16 ## 进度保存相关 ## # 从会话文件中读取下载任务 input-file=/etc/aria2/aria2.session # 在Aria2退出时保存错误的、未完成的下载任务到会话文件 save-session=/etc/aria2/aria2.session # 定时保存会话, 0为退出时才保存, 需1.16.1以上版本, 默认:0 save-session-interval=60 ## RPC相关设置 ## # 启用RPC, 默认:false enable-rpc=true # 允许所有来源, 默认:false rpc-allow-origin-all=true # 允许外部访问, 默认:false rpc-listen-all=true # RPC端口, 仅当默认端口被占用时修改 # rpc-listen-port=6800 # 设置的RPC授权令牌, v1.18.4新增功能, 取代 --rpc-user 和 --rpc-passwd 选项 rpc-secret=passwd #在访问的时候要使用到的密码 # 启动SSL #rpc-secure=true # 证书文件, 如果启用SSL则需要配置证书文件, 例如用https连接aria2 #rpc-certificate=/var/snap/nextcloud/current/certs/live/fullchain.pem #rpc-private-key=/var/snap/nextcloud/current/certs/live/privkey.pem ## BT/PT下载相关 ## # 当下载的是一个种子(以.torrent结尾)时, 自动开始BT任务, 默认:true follow-torrent=true # 客户端伪装, PT需要 peer-id-prefix=-TR2770- user-agent=Transmission/2.77 # 强制保存会话, 即使任务已经完成, 默认:false # 较新的版本开启后会在任务完成后依然保留.aria2文件 #force-save=false # 继续之前的BT任务时, 无需再次校验, 默认:false bt-seed-unverified=true # 保存磁力链接元数据为种子文件(.torrent文件), 默认:false # bt-save-metadata=true # 单个种子最大连接数, 默认:55 0表示不限制 bt-max-peers=0 # 最小做种时间, 单位:分 seed-time = 1 # 分离做种任务 bt-detach-seed-only=true on-download-complete=/home/filesscan.sh 启动aria2 nohup aria2c --conf-path=/etc/aria2/aria2.conf \u003e /home/linux/aria2.log 2\u003e\u00261 \u0026 配置aria2 自动更新bt tracker # startaria.sh while(true) do sudo kill -9 $(ps -ef|grep aria2|gawk '$0 !~/grep/ {print $2}' |tr -s '\\n' ' ') list=`wget -qO- https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_best.txt|awk NF|sed \":a;N;s/\\n/,/g;ta\"` echo $list if [ -z \"`grep \"bt-tracker\" /etc/aria2/aria2.conf`\" ]; then sudo sed -i '$a bt-tracker='${list} /etc/aria2/aria2.conf echo add...... else sudo sed -i \"s@bt-tracker.*@bt-tracker=$list@g\" /etc/aria2/aria2.conf echo update...... fi sudo aria2c --conf-path=/etc/aria2/aria2.conf sleep 24h #sleep 10 done 配置nextcloud启动脚本 # startserver.sh sudo service apache2 stop sudo service apache2 start sudo /etc/init.d/mysql start # 运行aria2脚本更新bt trackers sudo nohup bash startaria.sh \u003e /home/linux/log/aria2.log 2\u003e\u00261 \u0026 # 监控文件变化 while(true) do sudo -u www-data php /var/www/nextcloud/occ files:scan --all sleep 60 done # runserver.sh # 删除aria相关的程序 sudo kill -9 $(ps -ef|grep startserver|gawk '$0 !~/grep/ {print $2}' |tr -s '\\n' ' ') sudo kill -9 $(ps -ef|grep startaria|gawk '$0 !~/grep/ {print $2}' |tr -s '\\n' ' ') sudo kill -9 $(ps -ef|grep aria2|gawk '$0 !~/grep/ {print $2}' |tr -s '\\n' ' ') sudo nohup bash startserver.sh \u003e /home/linux/log/nextcloud.log 2\u003e\u00261 \u0026 配置aria2NG # 下载aria2ng cd /var/www/ wget https://github.com/mayswind/AriaNg/releases/download/1.2.3/AriaNg-1.2.3.zip mkdir ariang unzip AriaNg-1.2.3.zip 配置apache2网页 # 创建/etc/apache2/sites-available/ariang.conf Alias /ariang \"/var/www/ariang/\" \u003cDirectory /var/www/ariang/\"\u003e Require all granted AllowOverride All Options FollowSymLinks MultiViews \u003cIfModule mod_dav.c\u003e Dav off \u003c/IfModule\u003e \u003c/Directory\u003e # 访问http://host.example.com/ariang ","date":"2022-07-28","objectID":"/posts/technology/nextcloud/:1:3","tags":["nextcloud","apache","aria2"],"title":"nextcloud配置","uri":"/posts/technology/nextcloud/"},{"categories":["教程"],"content":"Nextcloud镜像安装 创建文件夹nextcloud mkdir nextcloud 创建文件docker-compose.yml --- version: '2' volumes: nextcloud: db: services: db: image: mariadb restart: always command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW volumes: - db:/var/lib/mysql environment: - MYSQL_ROOT_PASSWORD=root - MYSQL_PASSWORD=passwd - MYSQL_DATABASE=nextcloud - MYSQL_USER=nextcloud app: image: nextcloud restart: always ports: - 8080:80 links: - db volumes: - nextcloud:/var/www/html environment: - MYSQL_PASSWORD=passwd - MYSQL_DATABASE=nextcloud - MYSQL_USER=nextcloud - MYSQL_HOST=db 启动镜像 sudo docker-compose up -d 常见问题 ","date":"2022-07-28","objectID":"/posts/technology/nextcloud/:1:4","tags":["nextcloud","apache","aria2"],"title":"nextcloud配置","uri":"/posts/technology/nextcloud/"},{"categories":["教程"],"content":"apache2解析失败php 重新安装php sudo apt-get purge php8.* sudo apt install php ","date":"2022-07-28","objectID":"/posts/technology/nextcloud/:1:5","tags":["nextcloud","apache","aria2"],"title":"nextcloud配置","uri":"/posts/technology/nextcloud/"},{"categories":["教程"],"content":"apache2提示找不到apache.conf 重新安装apache2 sudo dpkg -P apache2 apt-get remove apache2 apt-get install apache2 ","date":"2022-07-28","objectID":"/posts/technology/nextcloud/:1:6","tags":["nextcloud","apache","aria2"],"title":"nextcloud配置","uri":"/posts/technology/nextcloud/"},{"categories":["问题总结"],"content":"wordpress permainlink 不生效 1.打开apache2默认配置文件 sudo vim /etc/apache2/sites-available/000-default.conf 2.修改内容为如下 LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so \u003cVirtualHost *:80\u003e # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName www.example.com ServerAdmin webmaster@localhost DocumentRoot /var/www/html \u003cDirectory /var/www/html\u003e AllowOverride All Require all granted \u003c/Directory\u003e # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with \"a2disconf\". #Include conf-available/serve-cgi-bin.conf \u003c/VirtualHost\u003e 3.在/wp-admin/options-permalink.php页面选择-\u003ePermalink structure -\u003e Post name保存生成.hatcess ","date":"2022-05-19","objectID":"/posts/technology/wordpress/:1:0","tags":["wordpress"],"title":"wordpress安装和问题","uri":"/posts/technology/wordpress/"},{"categories":["教程"],"content":"软件编译和安装 ","date":"2022-05-19","objectID":"/posts/technology/compile_and_install/:0:0","tags":["软件编译","软件安装"],"title":"软件编译和安装","uri":"/posts/technology/compile_and_install/"},{"categories":["教程"],"content":"qbittorrent编译安装 安装依赖 apt-get install build-essential pkg-config automake libtool git apt-get install libboost-dev libboost-system-dev libboost-chrono-dev libboost-random-dev libssl-dev libgeoip-dev 安装libtorrent git clone https://github.com/arvidn/libtorrent.git #之前系统版本可直接下载源码使用,18.04需修改include/libtorrent/export.hpp替换boost/config/为boost/config/detail/ #https://github.com/arvidn/libtorrent/releases/download/libtorrent-1_0_11/libtorrent-rasterbar-1.0.11.tar.gz cd libtorrent git checkout origin/RC_1_2 ./autotool.sh ./configure CXXFLAGS=-std=c++14 make clean \u0026\u0026 make -j$(nproc) make install 安装qbittorrent apt-get install qtbase5-dev qttools5-dev-tools libqt5svg5-dev zlib1g-dev wget https://github.com/qbittorrent/qBittorrent/archive/release-4.2.5 tar zxvf release-4.1.3.tar.gz cd qBittorrent-release-4.1.3/ ./configure --disable-gui make clean \u0026\u0026 make -j$(nproc) make install ","date":"2022-05-19","objectID":"/posts/technology/compile_and_install/:1:0","tags":["软件编译","软件安装"],"title":"软件编译和安装","uri":"/posts/technology/compile_and_install/"},{"categories":["教程"],"content":"LAMP php7.4安装 Ubuntu 18 安装 apt-get install software-properties-common 添加第三方源 add-apt-repository ppa:ondrej/php apt-get update 安装LAMP环境 sudo apt update sudo apt install apache2 mariadb-server libapache2-mod-php7.4 sudo apt install php7.4-gd php7.4-mysql php7.4-curl php7.4-mbstring php7.4-intl sudo apt install php7.4-gmp php7.4-bcmath php-imagick php7.4-xml php7.4-zip ","date":"2022-05-19","objectID":"/posts/technology/compile_and_install/:2:0","tags":["软件编译","软件安装"],"title":"软件编译和安装","uri":"/posts/technology/compile_and_install/"},{"categories":["教程"],"content":"LAMP php安装 Ubuntu 22 安装 apt-get install software-properties-common 添加第三方源 add-apt-repository ppa:ondrej/php apt-get update 安装LAMP环境 sudo apt update \u0026\u0026 sudo apt upgrade sudo apt install mariadb-server php-gd php-mysql php-fpm \\ php-curl php-mbstring php-intl php-gmp php-bcmath php-xml php-imagick php-zip ","date":"2022-05-19","objectID":"/posts/technology/compile_and_install/:3:0","tags":["软件编译","软件安装"],"title":"软件编译和安装","uri":"/posts/technology/compile_and_install/"},{"categories":["教程"],"content":"Neovim 安装 Ubuntu PPA安装 安装依赖软件 sudo apt-get install software-properties-common ## older ubuntu version sudo apt-get install python-software-properties 安装发布版本neovim sudo add-apt-repository ppa:neovim-ppa/stable sudo apt-get update sudo apt-get install neovim 编译安装 安装编译依赖 sudo apt-get install ninja-build gettext libtool libtool-bin autoconf automake cmake g++ pkg-config unzip curl doxygen 获取源代码 git clone https://github.com/neovim/neovim 编译安装neovim cd neovim make sudo make install 让neovim支持python和python3 sudo apt-get install python3 python3-pip python-pip -y pip install neovim pip3 install neovim ","date":"2022-05-19","objectID":"/posts/technology/compile_and_install/:4:0","tags":["软件编译","软件安装"],"title":"软件编译和安装","uri":"/posts/technology/compile_and_install/"},{"categories":["教程"],"content":"tmux 安装 Ubuntu 编译安装 获取源代码 wget https://github.com/tmux/tmux/releases/download/3.3-rc/tmux-3.3-rc.tar.gz 编译neovim tar -zxvf tmux-3.3-rc.tar.gz cd tmux-3.3-rc make sudo make install ","date":"2022-05-19","objectID":"/posts/technology/compile_and_install/:5:0","tags":["软件编译","软件安装"],"title":"软件编译和安装","uri":"/posts/technology/compile_and_install/"},{"categories":["教程"],"content":"transmission 安装 镜像安装 创建文件夹nextcloud mkdir transmission 创建文件docker-compose.yml --- version: \"2.1\" services: transmission: image: lscr.io/linuxserver/transmission container_name: transmission environment: - PUID=1000 - PGID=1000 - TZ=Europe/London - TRANSMISSION_WEB_HOME=/combustion-release/ #optional - USER=transmission #optional - PASS=passwd #optional #- WHITELIST=iplist #optional #- PEERPORT=peerport #optional #- HOST_WHITELIST=dnsnane list #optional volumes: - ./config:/config - ./downloads:/downloads - ./watch:/watch ports: - 9091:9091 - 51413:51413 - 51413:51413/udp restart: unless-stopped 启动镜像 sudo docker-compose up -d apt安装 安装 sudo apt update install transmission-daemon 修改配置文件 ... \"rpc-whitelist\": \"*\", \"rpc-whitelist-enabled\": true, ... web-ui安装 安装 wget https://github.com/ronggang/transmission-web-control/raw/master/release/install-tr-control-cn.sh bash install-tr-control-cn.sh ","date":"2022-05-19","objectID":"/posts/technology/compile_and_install/:6:0","tags":["软件编译","软件安装"],"title":"软件编译和安装","uri":"/posts/technology/compile_and_install/"},{"categories":["教程"],"content":"Selenium配置 [Webdriver驱动列表](Install browser drivers | Selenium) Windows 下载驱动 [Edge Webdriver](Microsoft Edge WebDriver - Microsoft Edge Developer) Chrome Webdriver 解压驱动到程序目录 mkdir selenium_test cd selenium_test 启动镜像 sudo docker-compose up -d ","date":"2022-05-19","objectID":"/posts/technology/compile_and_install/:7:0","tags":["软件编译","软件安装"],"title":"软件编译和安装","uri":"/posts/technology/compile_and_install/"},{"categories":["教程"],"content":"Jellyfin 安装 并启用硬件加速 apt安装 所有的Ubuntu发行版本 https://repo.jellyfin.org/releases/server/ubuntu/versions 查看当前的GPU设备 lspci -k | grep -A 2 -i \"VGA\" 禁用nouveau sudo vim /etc/modprobe.d/blacklist_nouveau.conf # 添加 blacklist nouveau options nouveau modeset=0 sudo reboot 搜索Nvidia显卡驱动 sudo ubuntu-drivers devices # 安装推荐的驱动 modalias : pci:v000010DEd00000FC2sv00001462sd0000275Cbc03sc00i00 vendor : NVIDIA Corporation model : GK107 [GeForce GT 630 OEM] driver : nvidia-driver-450-server - distro non-free #server版本的驱动 driver : nvidia-driver-470-server - distro non-free driver : nvidia-340 - distro non-free driver : nvidia-driver-418-server - distro non-free driver : nvidia-driver-470 - distro non-free recommended #gui版本的驱动 driver : nvidia-driver-390 - distro non-free driver : xserver-xorg-video-nouveau - distro free builtin 安装驱动 sudo apt install nvidia-driver-470-server #重启然后在jellyfin中设置Nvidia解码 镜像安装 创建文件夹jellyfin mkdir jellyfin 创建文件docker-compose.yml --- version: \"3.5\" services: jellyfin: image: nyanmisaka/jellyfin:latest container_name: jellyfin user: 1000:1000 network_mode: \"host\" volumes: - ./config:/config - ./cache:/cache - ./media:/media - /path/to/media2:/media2:ro restart: \"unless-stopped\" 启动镜像 sudo docker-compose up -d # 这种版本可能会导致apache2在转发端口的时候web存在不能访问服务器 ","date":"2022-05-19","objectID":"/posts/technology/compile_and_install/:8:0","tags":["软件编译","软件安装"],"title":"软件编译和安装","uri":"/posts/technology/compile_and_install/"},{"categories":["教程"],"content":"Nvidia驱动安装 Ubuntu 查看驱动 sudo dpkg --list | grep nvidia-* 卸载驱动 sudo /usr/bin/nvidia-uninstall sudo apt-get --purge remove nvidia-* sudo apt-get purge nvidia* sudo apt-get purge libnvidia* 检查驱动是否卸载 sudo dpkg --list | grep nvidia-* # 无任何输出 安装驱动 sudo ubuntu-drivers devices sudo apt install nvidia-driver-470-server ","date":"2022-05-19","objectID":"/posts/technology/compile_and_install/:9:0","tags":["软件编译","软件安装"],"title":"软件编译和安装","uri":"/posts/technology/compile_and_install/"},{"categories":["教程"],"content":"apache常见问题 ","date":"2022-05-03","objectID":"/posts/technology/apache2_and_nginx/:0:0","tags":["反向代理","网站证书"],"title":"web容器的使用和反向代理","uri":"/posts/technology/apache2_and_nginx/"},{"categories":["教程"],"content":"配置apache2文件简单服务器 打开配置文件 sudo vim /etc/apache2/sites-available/000-default.conf 修改内容为 Alias /e6ecni3_Sivan \"/var/www/html/\" \u003cDirectory /var/www/html/\"\u003e Require all granted AllowOverride All Options FollowSymLinks MultiViews \u003c/Directory\u003e 删除/var/www/html sudo rm -rf /var/www/html #软链html为你的共享文件目录 ","date":"2022-05-03","objectID":"/posts/technology/apache2_and_nginx/:0:1","tags":["反向代理","网站证书"],"title":"web容器的使用和反向代理","uri":"/posts/technology/apache2_and_nginx/"},{"categories":["教程"],"content":"访问apache2服务器默认指向index.php 删除浏览器的访问记录就可以 ","date":"2022-05-03","objectID":"/posts/technology/apache2_and_nginx/:0:2","tags":["反向代理","网站证书"],"title":"web容器的使用和反向代理","uri":"/posts/technology/apache2_and_nginx/"},{"categories":["教程"],"content":"在apache2中配置反向代理 反向代理服务器位于用户与目标服务器之间,但是对于用户而言,反向代理服务器就相当于目标服务器,即用户直接访问反向代理服务器就可以获得目标服务器的资源。同时,用户不需要知道目标服务器的地址,也无须在用户端作任何设定。反向代理服务器通常可用来作为Web加速,即使用反向代理作为Web服务器的前置机来降低网络和服务器的负载,提高访问效率。 其作用如下表示: 开启模块支持 sudo a2enmod rewrite sudo a2enmod lbmethod_byrequests sudo a2enmod proxy_balancer sudo a2enmod proxy_http sudo a2enmod proxy 添加反向代理设置 #sites-available/example.conf LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so \u003cVirtualHost *:80\u003e # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName www.example.com ServerAdmin sivan@localhost # Para qbittorrent RewriteEngine on RewriteRule ^/torrent$ \"/torrent/$1\" [R] ProxyPass /torrent/ http://127.0.0.1:8080/ ProxyPassReverse /torrent/ http://127.0.0.1:8080/ # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with \"a2disconf\". #Include conf-available/serve-cgi-bin.conf \u003c/VirtualHost\u003e # vim: syntax=apache ts=4 sw=4 sts=4 sr noet 启动服务 sudo a2ensite example.conf sudo service apache2 restart ","date":"2022-05-03","objectID":"/posts/technology/apache2_and_nginx/:0:3","tags":["反向代理","网站证书"],"title":"web容器的使用和反向代理","uri":"/posts/technology/apache2_and_nginx/"},{"categories":["教程"],"content":"apache 添加ssl证书并反向代理 开启ssl模块 sudo a2enmod ssl 配置证书site.conf LoadModule proxy_module modules/mod_proxy.so \u003cIfModule mod_ssl.c\u003e \u003cVirtualHost _default_:443\u003e ServerAdmin webmaster@localhost RewriteEngine on ProxyPass / http://127.0.0.1:8360/ ProxyPassReverse / http://127.0.0.1:8360/ ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined SSLEngine on SSLCertificateFile /etc/apache2/ssl/cloud.laais.cn.pem SSLCertificateKeyFile /etc/apache2/ssl/cloud.laais.cn.key SSLCertificateChainFile /etc/apache2/ssl/cloud.laais.cn.crt SSLCACertificatePath /etc/apache2/ssl SSLCACertificateFile /etc/apache2/ssl.crt/root_bundle.crt \u003c/VirtualHost\u003e \u003c/IfModule\u003e # vim: syntax=apache ts=4 sw=4 sts=4 sr noet ","date":"2022-05-03","objectID":"/posts/technology/apache2_and_nginx/:1:0","tags":["反向代理","网站证书"],"title":"web容器的使用和反向代理","uri":"/posts/technology/apache2_and_nginx/"},{"categories":["教程"],"content":"apache 配置websocket代理 LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so \u003cVirtualHost *:80\u003e ServerName www.hfsurrogacy.com ServerAdmin webmaster@hfsurrogacy.com DocumentRoot /var/www/html \u003cDirectory /var/www/html\u003e AllowOverride All Require all granted \u003c/Directory\u003e ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined \u003cLocationMatch \"/web\"\u003e ProxyPass http://127.0.0.1:10086/web upgrade=WebSocket ProxyAddHeaders Off ProxyPreserveHost On RequestHeader set Host %{HTTP_HOST}s RequestHeader set X-Forwarded-For %{REMOTE_ADDR}s \u003c/LocationMatch\u003e \u003c/VirtualHost\u003e ","date":"2022-05-03","objectID":"/posts/technology/apache2_and_nginx/:2:0","tags":["反向代理","网站证书"],"title":"web容器的使用和反向代理","uri":"/posts/technology/apache2_and_nginx/"},{"categories":["教程"],"content":"阿里云ssl证书安装错误 根据阿里云的教程在Apache服务器上安装SSL证书 (aliyun.com) 1.在服务器上更新证书apache2会报错 (1)错误1:AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globa 在apache.conf最后添加如下: ... # vim: syntax=apache ts=4 sw=4 sts=4 sr noet ServerName 127.0.0.1 (2)错误2:Action 'start' failed. 看日志提示SSL Library Error: error:0A0000B1:SSL routines::no certificate assigned 解决方案 下载这两处的文件然后把其他文件里面的pem文件更新到site.conf中 Nginx常见问题 ","date":"2022-05-03","objectID":"/posts/technology/apache2_and_nginx/:3:0","tags":["反向代理","网站证书"],"title":"web容器的使用和反向代理","uri":"/posts/technology/apache2_and_nginx/"},{"categories":["教程"],"content":"配置nginx反向代理和重定向 打开配置文件 sudo vim /etc/nginx/conf.d/jellyfin.conf 添加如下内容(访问http://host/video/.html 可反向代理重定向到http://host:8096/.html): set $jellyfin 127.0.0.1; location /video { # Proxy main Jellyfin traffic rewrite ^/video/(.*)$ /$1 break; proxy_pass http://$jellyfin:8096; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Protocol $scheme; proxy_set_header X-Forwarded-Host $http_host; # Disable buffering when the nginx proxy gets very resource heavy upon streaming proxy_buffering off; } # location block for /web - This is purely for aesthetics so /web/#!/ works instead of having to go to /web/index.html/#!/ location = /video/web/ { # Proxy main Jellyfin traffic proxy_pass http://$jellyfin:8096/web/index.html; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Protocol $scheme; proxy_set_header X-Forwarded-Host $http_host; } ","date":"2022-05-03","objectID":"/posts/technology/apache2_and_nginx/:3:1","tags":["反向代理","网站证书"],"title":"web容器的使用和反向代理","uri":"/posts/technology/apache2_and_nginx/"},{"categories":["教程"],"content":"配置wordpress支持 打开配置文件 sudo vim /etc/nginx/sites-available/default 添加如下内容(支持.htaccess和php): server { listen 80 default_server; listen [::]:80 default_server; # SSL configuration # # listen 443 ssl default_server; # listen [::]:443 ssl default_server; # # Note: You should disable gzip for SSL traffic. # See: https://bugs.debian.org/773332 # # Read up on ssl_ciphers to ensure a secure configuration. # See: https://bugs.debian.org/765782 # # Self signed certs generated by the ssl-cert package # Don't use them in a production server! # # include snippets/snakeoil.conf; root /var/www/html; # Add index.php to the list if you are using PHP index index.php index.html index.htm index.nginx-debian.html; server_name _; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; # support .htaccess if (-f $request_filename/index.html){ rewrite (.*) $1/index.html break; } if (-f $request_filename/index.php){ rewrite (.*) $1/index.php; } if (!-f $request_filename){ rewrite (.*) /index.php; } } location /login { proxy_redirect off; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection \"upgrade\"; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; set $is_v2ray 0; if ($http_upgrade = \"websocket\") { set $is_v2ray 1; } if ($is_v2ray = 1) { # 仅当请求为 WebSocket 时才反代到 V2Ray proxy_pass http://127.0.0.1:10086; } if ($is_v2ray = 0) { # 否则显示正常网页 rewrite ^/(.*)$ /mask-page last; } } # pass PHP scripts to FastCGI server # location ~ \\.php$ { include snippets/fastcgi-php.conf; # With php-fpm (or other unix sockets): fastcgi_pass unix:/run/php/php7.4-fpm.sock; } } ","date":"2022-05-03","objectID":"/posts/technology/apache2_and_nginx/:3:2","tags":["反向代理","网站证书"],"title":"web容器的使用和反向代理","uri":"/posts/technology/apache2_and_nginx/"},{"categories":["项目"],"content":"添加功能: ","date":"2022-04-08","objectID":"/posts/projects/vim/:1:0","tags":["vim","tmux"],"title":"Vim/Neovim-Tmux 一键安装轻量级工作站","uri":"/posts/projects/vim/"},{"categories":["项目"],"content":"1.文件管理:插件NerdTree 打开文件管理:Crtl + N 退出文件管理:Crtl + C ","date":"2022-04-08","objectID":"/posts/projects/vim/:1:1","tags":["vim","tmux"],"title":"Vim/Neovim-Tmux 一键安装轻量级工作站","uri":"/posts/projects/vim/"},{"categories":["项目"],"content":"2.跳转功能:Ctags\\pygments\\gtags 跳转到定义:Crtl + ] 后退:Crtl + T Ctrl+\\ c Find functions calling this function Ctrl+\\ d Find functions called by this function Ctrl+\\ e Find this egrep pattern Ctrl+\\ f Find this file Ctrl+\\ g Find this definition Ctrl+\\ i Find files #including this file Ctrl+\\ s Find this C symbol Ctrl+\\ t Find this text string ","date":"2022-04-08","objectID":"/posts/projects/vim/:1:2","tags":["vim","tmux"],"title":"Vim/Neovim-Tmux 一键安装轻量级工作站","uri":"/posts/projects/vim/"},{"categories":["项目"],"content":"3.任意跳转功能,主要是和前一个功能进行补充;JumpAny 跳转到定义:cursor移动到关键词 , + j ","date":"2022-04-08","objectID":"/posts/projects/vim/:1:3","tags":["vim","tmux"],"title":"Vim/Neovim-Tmux 一键安装轻量级工作站","uri":"/posts/projects/vim/"},{"categories":["项目"],"content":"4.搜索功能:LeaderF 打开搜索:, + f 结果上翻:Crtl + k 结果下翻:Crtl + j 打开:Enter 帮助:Tab ","date":"2022-04-08","objectID":"/posts/projects/vim/:1:4","tags":["vim","tmux"],"title":"Vim/Neovim-Tmux 一键安装轻量级工作站","uri":"/posts/projects/vim/"},{"categories":["项目"],"content":"5.代码补全:Coc.nvim 打开搜索:在对应的关键词后面按tab会提示 结果下翻:提示后按Tab可以顺序下翻,或者用Crtl + n 结果上翻:提示后Crtl + p 选择:Enter ","date":"2022-04-08","objectID":"/posts/projects/vim/:1:5","tags":["vim","tmux"],"title":"Vim/Neovim-Tmux 一键安装轻量级工作站","uri":"/posts/projects/vim/"},{"categories":["项目"],"content":"6.代码错误修正:Coc.nvim ","date":"2022-04-08","objectID":"/posts/projects/vim/:1:6","tags":["vim","tmux"],"title":"Vim/Neovim-Tmux 一键安装轻量级工作站","uri":"/posts/projects/vim/"},{"categories":["项目"],"content":"7.单终端编译和写代码,不用Crtl-z切后台编译,直接借助tmux和vimux插件实现在一个界面写代码和编译 创建tmux:tmux session -t mytmux 分屏tmux:打开vim后输入, + v + p,输入相关的运行命令便可打开命令行 运行上一次的命令:需要先运行在, + v + p,然后在, + v + l便可以运行最后一次的命令 切换tmux:按Crtl + b 再按 hjkl 任意,例如向下切换则Crtl + b,然后按j,便可向下切换tmux ","date":"2022-04-08","objectID":"/posts/projects/vim/:1:7","tags":["vim","tmux"],"title":"Vim/Neovim-Tmux 一键安装轻量级工作站","uri":"/posts/projects/vim/"},{"categories":["项目"],"content":"8.更加强大的终端zsh和on-my-zsh管理,支持主题和插件 ","date":"2022-04-08","objectID":"/posts/projects/vim/:1:8","tags":["vim","tmux"],"title":"Vim/Neovim-Tmux 一键安装轻量级工作站","uri":"/posts/projects/vim/"},{"categories":["项目"],"content":"9.vim支持Latex保存自动编译,编译实时显示(Windows Vim Latex Live Preview) 编译latex:,lc 查看latex:,lv 删除latex相关缓存文件:,lr ","date":"2022-04-08","objectID":"/posts/projects/vim/:1:9","tags":["vim","tmux"],"title":"Vim/Neovim-Tmux 一键安装轻量级工作站","uri":"/posts/projects/vim/"},{"categories":["项目"],"content":"效果预览 Vim or Neovim ","date":"2022-04-08","objectID":"/posts/projects/vim/:2:0","tags":["vim","tmux"],"title":"Vim/Neovim-Tmux 一键安装轻量级工作站","uri":"/posts/projects/vim/"},{"categories":["项目"],"content":"Ubuntu安装方式 # 可在内部选择对应的版本 git clone https://github.com/SivanLaai/vimrc.git cd vimrc ./install.sh #TODO: 安装完成记得进入vim更新插件 vim-gui ","date":"2022-04-08","objectID":"/posts/projects/vim/:3:0","tags":["vim","tmux"],"title":"Vim/Neovim-Tmux 一键安装轻量级工作站","uri":"/posts/projects/vim/"},{"categories":["项目"],"content":"windows 1.下载安装vim-gui gVim 下载python编译版本gvim Neovim 下载python编译版本neovim 配置路径D:\\Program Files\\Neovim\\bin为系统环境变量 2.安装对应版本的Python GVim查看对应版本的Python 查看相关版本的python下载安装: 下载Python 3.安装字体 下载字体 DejaVu Sans Mono for Powerline 4.安装universal-ctags/pygments 和 gtags (1)universal-ctags 下载universal-ctags 将ctags拷贝到安装路径,如D:\\Program Files\\ctags 配置路径D:\\Program Files\\ctags为系统环境变量 (2)pygments(主要作用是配合ctags来查找引用) pip install pygments (3)gtags 下载gtags 将gtags拷贝到安装路径,如D:\\Program Files\\gtags 配置路径D:\\Program Files\\gtags为系统环境变量 5.安装ripgrep 下载ripgrep 将ripgrep程序拷贝到安装路径,如D:\\Program Files\\ripgrep 配置路径D:\\Program Files\\ripgrep为系统环境变量 6.安装Latex 下载miktex 安装mitex并更新 7.安装Okular 下载Okular 将Okular程序安装到路径,如D:\\Program Files\\Okular 配置路径D:\\Program Files\\Okular为系统环境变量 8.安装MSYS2 下载MSYS2 将MSYS2程序安装到路径,如D:\\Program Files\\MSYS2 配置路径D:\\Program Files\\MSYS2\\usr\\bin为系统环境变量 配置路径D:\\Program Files\\MSYS2\\clang4\\bin为系统环境变量 安装clang64 # 更新软件库 pacman -Syu # 更新核心软件 pacman -Su # 安装Clang64编译环境 pacman -S --needed base-devel mingw-w64-clang-x86_64-toolchain 下载git 将git程序安装到路径,如D:\\Program Files\\git 配置路径D:\\Program Files\\git\\bin为系统环境变量 git中文显示错误修正 git config --global core.quotepath false 想卸载某个包的话 pacman -Rs mingw-w64-clang-x86_64-toolchain 9.配置vim-format依赖 #C++ 通过Clang64已经成功支持 #Python pip install --upgrade autopep8 #html\\css\\js npm install -g js-beautify 10.复制配置文件 gVim cp -rf gvim/_vimrc $vim/_vimrc cp -rf gvim/autoload vimfile - NeoVim-qt cp -rf neovim-qt/* ~/AppData/Local/nvim # Solarized Dark 主题复制 cp -rf gvim/colors vimfile 11.配置vim-gui :PlugInstall #待安装完成 ","date":"2022-04-08","objectID":"/posts/projects/vim/:4:0","tags":["vim","tmux"],"title":"Vim/Neovim-Tmux 一键安装轻量级工作站","uri":"/posts/projects/vim/"},{"categories":["项目"],"content":"Xshell 护眼主题 Eyes Protection ","date":"2022-04-08","objectID":"/posts/projects/vim/:5:0","tags":["vim","tmux"],"title":"Vim/Neovim-Tmux 一键安装轻量级工作站","uri":"/posts/projects/vim/"},{"categories":["项目"],"content":"安装方式 在Xshell 配色方案里导入 本项目中的xcs文件 ","date":"2022-04-08","objectID":"/posts/projects/vim/:5:1","tags":["vim","tmux"],"title":"Vim/Neovim-Tmux 一键安装轻量级工作站","uri":"/posts/projects/vim/"},{"categories":["项目"],"content":"界面预览 Solarized Dark Solarized Light ","date":"2022-04-08","objectID":"/posts/projects/vim/:5:2","tags":["vim","tmux"],"title":"Vim/Neovim-Tmux 一键安装轻量级工作站","uri":"/posts/projects/vim/"},{"categories":["教程"],"content":"docker教程 ","date":"2022-04-02","objectID":"/posts/technology/docker/:0:0","tags":["docker"],"title":"docker教程","uri":"/posts/technology/docker/"},{"categories":["教程"],"content":"docker安装 卸载老版本docker sudo apt-get remove docker docker-engine docker.io containerd runc 设置apt仓库 1.更新apt包索引并且安装相关依赖允许apt使用https更新 sudo apt-get update sudo apt-get install \\ ca-certificates \\ curl \\ gnupg \\ lsb-release 2.增加Docker官方GPG Key curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg 3.设置apt docker稳定仓库设置 echo \\ \"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \\ $(lsb_release -cs) stable\" | sudo tee /etc/apt/sources.list.d/docker.list \u003e /dev/null 安装Docker引擎 1.更新apt包索引并且安装Docker引擎 sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io 2.验证docker是否成功安装 sudo docker run hello-world 3.设置apt docker稳定仓库设置 echo \\ \"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \\ $(lsb_release -cs) stable\" | sudo tee /etc/apt/sources.list.d/docker.list \u003e /dev/null 参考文档 Install Docker Engine on Ubuntu | Docker Documentation ","date":"2022-04-02","objectID":"/posts/technology/docker/:1:0","tags":["docker"],"title":"docker教程","uri":"/posts/technology/docker/"},{"categories":["教程"],"content":"Docker Compose安装 ","date":"2022-04-02","objectID":"/posts/technology/docker/:2:0","tags":["docker"],"title":"docker教程","uri":"/posts/technology/docker/"},{"categories":["教程"],"content":"Linux 安装Docker Compose 1.下载docker compose可执行文件 sudo curl -L \"https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)\" -o /usr/local/bin/docker-compose 2.设置可执行权限 sudo chmod +x /usr/local/bin/docker-compose ","date":"2022-04-02","objectID":"/posts/technology/docker/:2:1","tags":["docker"],"title":"docker教程","uri":"/posts/technology/docker/"},{"categories":["教程"],"content":"Docker 权限问题 ","date":"2022-04-02","objectID":"/posts/technology/docker/:3:0","tags":["docker"],"title":"docker教程","uri":"/posts/technology/docker/"},{"categories":["教程"],"content":"添加当前用户到Docker用户组 sudo groupadd docker #添加docker用户组,这个用户组应该是已存在了` sudo gpasswd -a $USER docker #将当前用户加入到docker用户组中` newgrp docker #更新用户组docker` ","date":"2022-04-02","objectID":"/posts/technology/docker/:3:1","tags":["docker"],"title":"docker教程","uri":"/posts/technology/docker/"},{"categories":["教程"],"content":"qBittorrent Docker运行 ","date":"2022-04-02","objectID":"/posts/technology/docker/:4:0","tags":["docker"],"title":"docker教程","uri":"/posts/technology/docker/"},{"categories":["教程"],"content":"Docker Compose 配置qBittorrent 新建项目 1.进入home目录,新建项目qBittorrent cd ~ mkdir qBittorrent cd qBittorrent 2.进入项目文件目录,新建配置文件docker-compose.yml,配置下载端口,qBittorrent相关目录 version: \"3\" services: qbittorrent: image: emmercm/qbittorrent:latest restart: unless-stopped ports: - 8080:8080 - 5463:5463/tcp - 5463:5463/udp volumes: - ./config:/config - ./data:/data - ./downloads:/downloads - ./incomplete:/incomplete 运行项目 1.下载并创建镜像 docker-compose up 2.运行镜像 docker-compose start ","date":"2022-04-02","objectID":"/posts/technology/docker/:4:1","tags":["docker"],"title":"docker教程","uri":"/posts/technology/docker/"},{"categories":["学习"],"content":"2021秋作业2-动态规划 ","date":"2022-03-02","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/:0:0","tags":["算法学习","卜东坡-算法设计与分析","动态规划"],"title":"卜东坡算法-2021秋作业2-动态规划","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/"},{"categories":["学习"],"content":"1. Money robbing A robber is planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security system connected and it will automatically contact the police if two adjacent houses were broken into on the same night. Given a list of non-negative integers representing the amount of money of each house, determine the maximum amount of money you can rob tonight without alerting the police. What if all houses are arranged in a circle? 解法: class Solution { public: int robMaxMoney(vector\u003cint\u003e\u0026 a) { int start = 0; int end = a.size() - 1; vector\u003cint\u003e dp(end, 0); //初始化dp全部为0,dp表示前i+1个房子抢劫的最大金钱数 dp[0] = a[0]; dp[1] = max(a[0], a[1]); for (int i = 2; i \u003c= end; ++i) { dp[i] = max(dp[i - 1], dp[i - 2] + a[i]); } return dp[end]; } }; ","date":"2022-03-02","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/:1:0","tags":["算法学习","卜东坡-算法设计与分析","动态规划"],"title":"卜东坡算法-2021秋作业2-动态规划","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/"},{"categories":["学习"],"content":"2. Largest Divisible Subset Given a set of distinct positive integers, find the largest subset such that every pair (Si , Sj ) of elements in this subset satisfies: Si%Sj = 0 or Sj%Si = 0. Please return the largest size of the subset. Note: Si%Sj = 0 means that Si is divisible by Sj . 解法: class Solution { public: int getLargestDivisibleSum(vector\u003cint\u003e\u0026 nums) { quickSort(nums); //先使用快速排序对数组从小到大进行排序 int size = nums.size(); vector\u003cint\u003e dp(size, 1); //初始化dp全部为1,dp表示前i个数元素最多的可整除子集长度 for (int i = 2; i \u003c= size; ++i) { for (int j = 1; j \u003c i; ++j) { if (nums[i] % nums[j] == 0) { dp[i] = max(dp[i], dp[j] + 1); } } } } }; ","date":"2022-03-02","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/:2:0","tags":["算法学习","卜东坡-算法设计与分析","动态规划"],"title":"卜东坡算法-2021秋作业2-动态规划","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/"},{"categories":["学习"],"content":"3. Unique Binary Search Trees Given n, how many structurally unique BST’s (binary search trees) that store values 1…n? Explanation: Given n = 3, there are a total of 5 unique BST’s: class Solution { public: int getBSTSum(const int\u0026 n) { vector\u003cint\u003e dp(n, 0); dp[0] = dp[1] = 1; for (int i=2; i \u003c= n; ++i) { for (int j=0; j \u003c i; ++j) { dp[i] += dp[j] * dp[i - j - 1]; } } } }; ","date":"2022-03-02","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/:3:0","tags":["算法学习","卜东坡-算法设计与分析","动态规划"],"title":"卜东坡算法-2021秋作业2-动态规划","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/"},{"categories":["学习"],"content":"4. Word Break Given a string S and a dictionary of words, determine if the string S can be segmented into a space-separated sequence of one or more dictionary words. Note: Each word in the dictionary may be reused multiple times in the segmentation. You can return TRUE if the string S is empty. class Solution { public: bool wordBreak(string s, vector\u003cstring\u003e\u0026 wordDict) { int n = s.size(); vector\u003cbool\u003e dp(n, false); dp[0] = true; for (int i = 1; i \u003c= n; ++i) { for (auto str: wordDict) { int str_len = str.size(); if (i \u003e= str_len) { dp[i] = (dp[i - str_len] // 表示前 i - str_len个字符是否由wordDict单词组成 \u0026\u0026 s.substr(i - str_len, str_len) == str) // i - str_len到i是否组成一个单词 || dp[i]; // dp[i]表示前s的前i个字符是否由wordDict的单词组成,只要找到一个dp[i]满足,则dp[i]就是 } } } return dp[n]; } }; ","date":"2022-03-02","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/:4:0","tags":["算法学习","卜东坡-算法设计与分析","动态规划"],"title":"卜东坡算法-2021秋作业2-动态规划","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/"},{"categories":["学习"],"content":"5. Distinct Sequences Given two strings S and T, return the number of distinct subsequences of S which equals T. A string’s subsequence is a new string formed from the original string by deleting some (can be none) of the characters without disturbing the remaining characters’ relative positions. (i.e., ”ACE” is a subsequence of ”ABCDE” while ”AEC” is not). Example 1: Input: s = \"rabbbit\", t = \"rabbit\" Output: 3 Explanation: As shown below, there are 3 ways you can generate \"rabbit\" from S. rabbbit rabbbit rabbbit Example 2: Input: s = \"babgbag\", t = \"bag\" Output: 5 Explanation: As shown below, there are 5 ways you can generate \"bag\" from S. babgbag babgbag babgbag babgbag babgbag class Solution { public: int numDistinct(string s, string t) { int n = s.size(); int m = t.size(); vector\u003cvector\u003cint\u003e\u003e dp(n + 1, vector\u003cint\u003e(m + 1, 0)); for (int i=0; i\u003c=n; ++i) dp[i][0] = 1; for (int i = 1; i \u003c= n; ++i) { for (int j = 1; j \u003c= m; ++j) { if (s[i] == t[j]) { dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j];// 两种情况之和 } else { dp[i][j] = dp[i - 1][j];// 如果当前字符不相等,则说明s的前i个字符和t的前j个字符的字集个数会 等于 s的前i-1个字符和t的前j个字符的个数 } } } return dp[n][m]; } }; ","date":"2022-03-02","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/:5:0","tags":["算法学习","卜东坡-算法设计与分析","动态规划"],"title":"卜东坡算法-2021秋作业2-动态规划","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/"},{"categories":["学习"],"content":"6. Triangle Description Given a triangle array, return the minimum path sum from top to bottom. For each step, you may move to an adjacent number of the row below. More formally, if you are on index i on the current row, you may move to either index i or index i +1on the next row. Input Line1: The height of the triangle, and 1 \u003c= triangle.height \u003c= 2001\u003c=triangl**e.heigh**t\u003c=200. Line2: All the elements in the triangle, and split by some spaces(for each element,-10^4\u003c= triangle[i][j] \u003c=10^4). We are sure that the number of the elements satisfy: Output Print the minimum path sum from top to bottom. Sample Input 1 4 2 3 4 6 5 7 4 1 8 3 Sample Output 1 11 Sample Input 2 1 -10 Sample Output 2 -10 Hint Input: 4 2 3 4 6 5 7 4 1 8 3 Output: 11 Explanation: The triangle looks like: 2 34 657 4183 The minimum path sum from top to bottom is 2 + 3 + 5 + 1 = 11 (bolded above) class Solution { public: int miniPathSum(const vector\u003cvector\u003cint\u003e\u003e\u0026 triangles) { int n = triangles.size(); vector\u003cint\u003e dp(n + 1, 0); for (int i=n; i\u003e=1; --i) { for (int j=1; j\u003c=i; ++j) { dp[j - 1] = min(dp[j - 1], dp[j]) + triangles[i][j]; } } return dp[0]; } }; ","date":"2022-03-02","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/:6:0","tags":["算法学习","卜东坡-算法设计与分析","动态规划"],"title":"卜东坡算法-2021秋作业2-动态规划","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/"},{"categories":["学习"],"content":"7. Maximum Alternating Subsequence Sum Description The alternating sum of a 0-indexed array is defined as the sum of the elements at even indices minus the sum of the elements at odd indices. For example, the alternating sum of [4,2,5,3] is (4 + 5) - (2 + 3) = 4. Given an array nums, return the maximum alternating sum of any subsequence of nums (after reindexing the elements of the subsequence). A subsequence of an array is a new array generated from the original array by deleting some elements (possibly none) without changing the remaining elements’ relative order.For example, [2,7,4] is a subsequence of [4,2,3,7,2,1,4] (the underlined elements), while [2,4,2] is not. Input Anarray. 1 \u003c= nums.length \u003c= 10^51\u003c=num**s.lengt**h\u003c=105 1 \u003c= nums[i] \u003c= 10^51\u003c=num**s[i]\u003c=105 Output Maximum alternating sum. Sample Input 1 5 6 7 8 Sample Output 1 8 Explanation: It is optimal to choose the subsequence [8] with alternating sum 8. Sample Input 2 6 2 1 2 4 5 Sample Output 2 10 Explanation: It is optimal to choose the subsequence [6,1,5] with alternating sum (6 + 5) - 1 = 10. Sample Input 3 4 2 5 3 Sample Output 3 7 Explanation: It is optimal to choose the subsequence [4,2,5] with alternating sum (4 + 5) - 2 = 7. class Solution { public: int maxAlternatingSum(const vector\u003cint\u003e\u0026 nums) { int n = nums.size(); vector\u003cvector\u003cint\u003e\u003e dp(n + 1, 0); // dp[i][0] 表示前i个数组成的子序列末位为偶数的最大交替和,dp[i][1]表示子序列末位为奇数的最大交替和。 dp[1][1] = nums[0]; // 前i个数末位为奇数的时候最大和 for (int i=1; i\u003c=n; ++i) { dp[i][0] = max(dp[i-1][0], dp[i-1][1] - nums[i-1]); dp[i][1] = max(dp[i-1][1], dp[i-1][0] + nums[i-1]); // 前i个数交替和最大末位是奇数的情况,所以要考虑前i-1个数分别为奇和偶的情况。 } return max(dp[n][0], dp[n][1]); } }; ","date":"2022-03-02","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/:7:0","tags":["算法学习","卜东坡-算法设计与分析","动态规划"],"title":"卜东坡算法-2021秋作业2-动态规划","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/"},{"categories":["学习"],"content":"2021秋作业2-动态规划 ","date":"2022-03-02","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/:0:0","tags":["算法学习","卜东坡-算法设计与分析","贪心"],"title":"卜东坡算法-2021秋作业3-贪心","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/"},{"categories":["学习"],"content":"1. Money robbing A robber is planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security system connected and it will automatically contact the police if two adjacent houses were broken into on the same night. Given a list of non-negative integers representing the amount of money of each house, determine the maximum amount of money you can rob tonight without alerting the police. What if all houses are arranged in a circle? 解法: class Solution { public: int robMaxMoney(vector\u003cint\u003e\u0026 a) { int start = 0; int end = a.size() - 1; vector\u003cint\u003e dp(end, 0); //初始化dp全部为0,dp表示前i+1个房子抢劫的最大金钱数 dp[0] = a[0]; dp[1] = max(a[0], a[1]); for (int i = 2; i \u003c= end; ++i) { dp[i] = max(dp[i - 1], dp[i - 2] + a[i]); } return dp[end]; } }; ","date":"2022-03-02","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/:1:0","tags":["算法学习","卜东坡-算法设计与分析","贪心"],"title":"卜东坡算法-2021秋作业3-贪心","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/"},{"categories":["学习"],"content":"2. Largest Divisible Subset Given a set of distinct positive integers, find the largest subset such that every pair (Si , Sj ) of elements in this subset satisfies: Si%Sj = 0 or Sj%Si = 0. Please return the largest size of the subset. Note: Si%Sj = 0 means that Si is divisible by Sj . 解法: class Solution { public: int getLargestDivisibleSum(vector\u003cint\u003e\u0026 nums) { quickSort(nums); //先使用快速排序对数组从小到大进行排序 int size = nums.size(); vector\u003cint\u003e dp(size, 1); //初始化dp全部为1,dp表示前i个数元素最多的可整除子集长度 for (int i = 2; i \u003c= size; ++i) { for (int j = 1; j \u003c i; ++j) { if (nums[i] % nums[j] == 0) { dp[i] = max(dp[i], dp[j] + 1); } } } } }; ","date":"2022-03-02","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/:2:0","tags":["算法学习","卜东坡-算法设计与分析","贪心"],"title":"卜东坡算法-2021秋作业3-贪心","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/"},{"categories":["学习"],"content":"3. Unique Binary Search Trees Given n, how many structurally unique BST’s (binary search trees) that store values 1…n? Explanation: Given n = 3, there are a total of 5 unique BST’s: class Solution { public: int getBSTSum(const int\u0026 n) { vector\u003cint\u003e dp(n, 0); dp[0] = dp[1] = 1; for (int i=2; i \u003c= n; ++i) { for (int j=0; j \u003c i; ++j) { dp[i] += dp[j] * dp[i - j - 1]; } } } }; ","date":"2022-03-02","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/:3:0","tags":["算法学习","卜东坡-算法设计与分析","贪心"],"title":"卜东坡算法-2021秋作业3-贪心","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/"},{"categories":["学习"],"content":"4. Word Break Given a string S and a dictionary of words, determine if the string S can be segmented into a space-separated sequence of one or more dictionary words. Note: Each word in the dictionary may be reused multiple times in the segmentation. You can return TRUE if the string S is empty. class Solution { public: bool wordBreak(string s, vector\u003cstring\u003e\u0026 wordDict) { int n = s.size(); vector\u003cbool\u003e dp(n, false); dp[0] = true; for (int i = 1; i \u003c= n; ++i) { for (auto str: wordDict) { int str_len = str.size(); if (i \u003e= str_len) { dp[i] = (dp[i - str_len] // 表示前 i - str_len个字符是否由wordDict单词组成 \u0026\u0026 s.substr(i - str_len, str_len) == str) // i - str_len到i是否组成一个单词 || dp[i]; // dp[i]表示前s的前i个字符是否由wordDict的单词组成,只要找到一个dp[i]满足,则dp[i]就是 } } } return dp[n]; } }; ","date":"2022-03-02","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/:4:0","tags":["算法学习","卜东坡-算法设计与分析","贪心"],"title":"卜东坡算法-2021秋作业3-贪心","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/"},{"categories":["学习"],"content":"5. Distinct Sequences Given two strings S and T, return the number of distinct subsequences of S which equals T. A string’s subsequence is a new string formed from the original string by deleting some (can be none) of the characters without disturbing the remaining characters’ relative positions. (i.e., ”ACE” is a subsequence of ”ABCDE” while ”AEC” is not). Example 1: Input: s = \"rabbbit\", t = \"rabbit\" Output: 3 Explanation: As shown below, there are 3 ways you can generate \"rabbit\" from S. rabbbit rabbbit rabbbit Example 2: Input: s = \"babgbag\", t = \"bag\" Output: 5 Explanation: As shown below, there are 5 ways you can generate \"bag\" from S. babgbag babgbag babgbag babgbag babgbag class Solution { public: int numDistinct(string s, string t) { int n = s.size(); int m = t.size(); vector\u003cvector\u003cint\u003e\u003e dp(n + 1, vector\u003cint\u003e(m + 1, 0)); for (int i=0; i\u003c=n; ++i) dp[i][0] = 1; for (int i = 1; i \u003c= n; ++i) { for (int j = 1; j \u003c= m; ++j) { if (s[i] == t[j]) { dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j];// 两种情况之和 } else { dp[i][j] = dp[i - 1][j];// 如果当前字符不相等,则说明s的前i个字符和t的前j个字符的字集个数会 等于 s的前i-1个字符和t的前j个字符的个数 } } } return dp[n][m]; } }; ","date":"2022-03-02","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/:5:0","tags":["算法学习","卜东坡-算法设计与分析","贪心"],"title":"卜东坡算法-2021秋作业3-贪心","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/"},{"categories":["学习"],"content":"6. Triangle Description Given a triangle array, return the minimum path sum from top to bottom. For each step, you may move to an adjacent number of the row below. More formally, if you are on index i on the current row, you may move to either index i or index i +1on the next row. Input Line1: The height of the triangle, and 1 \u003c= triangle.height \u003c= 2001\u003c=triangl**e.heigh**t\u003c=200. Line2: All the elements in the triangle, and split by some spaces(for each element,-10^4\u003c= triangle[i][j] \u003c=10^4). We are sure that the number of the elements satisfy: Output Print the minimum path sum from top to bottom. Sample Input 1 4 2 3 4 6 5 7 4 1 8 3 Sample Output 1 11 Sample Input 2 1 -10 Sample Output 2 -10 Hint Input: 4 2 3 4 6 5 7 4 1 8 3 Output: 11 Explanation: The triangle looks like: 2 34 657 4183 The minimum path sum from top to bottom is 2 + 3 + 5 + 1 = 11 (bolded above) class Solution { public: int miniPathSum(const vector\u003cvector\u003cint\u003e\u003e\u0026 triangles) { int n = triangles.size(); vector\u003cint\u003e dp(n + 1, 0); for (int i=n; i\u003e=1; --i) { for (int j=1; j\u003c=i; ++j) { dp[j - 1] = min(dp[j - 1], dp[j]) + triangles[i][j]; } } return dp[0]; } }; ","date":"2022-03-02","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/:6:0","tags":["算法学习","卜东坡-算法设计与分析","贪心"],"title":"卜东坡算法-2021秋作业3-贪心","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/"},{"categories":["学习"],"content":"7. Maximum Alternating Subsequence Sum Description The alternating sum of a 0-indexed array is defined as the sum of the elements at even indices minus the sum of the elements at odd indices. For example, the alternating sum of [4,2,5,3] is (4 + 5) - (2 + 3) = 4. Given an array nums, return the maximum alternating sum of any subsequence of nums (after reindexing the elements of the subsequence). A subsequence of an array is a new array generated from the original array by deleting some elements (possibly none) without changing the remaining elements’ relative order.For example, [2,7,4] is a subsequence of [4,2,3,7,2,1,4] (the underlined elements), while [2,4,2] is not. Input Anarray. 1 \u003c= nums.length \u003c= 10^51\u003c=num**s.lengt**h\u003c=105 1 \u003c= nums[i] \u003c= 10^51\u003c=num**s[i]\u003c=105 Output Maximum alternating sum. Sample Input 1 5 6 7 8 Sample Output 1 8 Explanation: It is optimal to choose the subsequence [8] with alternating sum 8. Sample Input 2 6 2 1 2 4 5 Sample Output 2 10 Explanation: It is optimal to choose the subsequence [6,1,5] with alternating sum (6 + 5) - 1 = 10. Sample Input 3 4 2 5 3 Sample Output 3 7 Explanation: It is optimal to choose the subsequence [4,2,5] with alternating sum (4 + 5) - 2 = 7. class Solution { public: int maxAlternatingSum(const vector\u003cint\u003e\u0026 nums) { int n = nums.size(); vector\u003cvector\u003cint\u003e\u003e dp(n + 1, 0); // dp[i][0] 表示前i个数组成的子序列末位为偶数的最大交替和,dp[i][1]表示子序列末位为奇数的最大交替和。 dp[1][1] = nums[0]; // 前i个数末位为奇数的时候最大和 for (int i=1; i\u003c=n; ++i) { dp[i][0] = max(dp[i-1][0], dp[i-1][1] - nums[i-1]); dp[i][1] = max(dp[i-1][1], dp[i-1][0] + nums[i-1]); // 前i个数交替和最大末位是奇数的情况,所以要考虑前i-1个数分别为奇和偶的情况。 } return max(dp[n][0], dp[n][1]); } }; ","date":"2022-03-02","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/:7:0","tags":["算法学习","卜东坡-算法设计与分析","贪心"],"title":"卜东坡算法-2021秋作业3-贪心","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/"},{"categories":["教程"],"content":"mysql数据库 ","date":"2022-02-25","objectID":"/posts/technology/mysql/:1:0","tags":["mysql","数据库"],"title":"数据库配置","uri":"/posts/technology/mysql/"},{"categories":["教程"],"content":"mysql忘记密码 (1)修改配置文件免密 sudo vim /etc/mysql/my.cnf [mysqld] skip-grant-tables (2)重启mysql sudo service mysql restart (3)修改初始密码 mysql -u root use mysql; update user set password=password(\"test@123\") where user=\"root\"; ","date":"2022-02-25","objectID":"/posts/technology/mysql/:1:1","tags":["mysql","数据库"],"title":"数据库配置","uri":"/posts/technology/mysql/"},{"categories":["教程"],"content":"mysql root帐号不能登录 (1)修改配置文件免密 看mysql忘记密码的第一步 (2)更新ip访问权限 flush privileges; alter user 'root'@'localhost' identified by 'test@123'; flush privileges; commit; ","date":"2022-02-25","objectID":"/posts/technology/mysql/:1:2","tags":["mysql","数据库"],"title":"数据库配置","uri":"/posts/technology/mysql/"},{"categories":["教程"],"content":"mysql 创建数据库 CREATE DATABASE IF NOT EXISTS nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; ","date":"2022-02-25","objectID":"/posts/technology/mysql/:1:3","tags":["mysql","数据库"],"title":"数据库配置","uri":"/posts/technology/mysql/"},{"categories":["教程"],"content":"mysql 创建用户开启外网权限 打开配置文件 sudo vim /etc/mysql/my.cnf 修改绑定ip [mysqld] bind-address=0.0.0.0 具体命令 CREATE USER 'username'@'%' IDENTIFIED BY 'password'; # 所有的数据库都可以在外网访问 GRANT ALL PRIVILEGES ON *.* TO 'username'@'%'; FLUSH PRIVILEGES; ","date":"2022-02-25","objectID":"/posts/technology/mysql/:1:4","tags":["mysql","数据库"],"title":"数据库配置","uri":"/posts/technology/mysql/"},{"categories":["学习"],"content":"2021秋作业1-分治 ","date":"2021-12-17","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/:0:0","tags":["算法学习","卜东坡-算法设计与分析","分治"],"title":"卜东坡算法-2021秋作业1-分治","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/"},{"categories":["学习"],"content":"1. 找出整数数组中第K大的数 215.Kth Largest Element in an Array (Medium) Given an integer array nums and an integer k, please return the k-th largest element in the array. Your algorithm’s runtime complexity must be in the order of O(n), prove the correctnes-sand analyze the complexity.(k is much smaller than n, n is the length of the array.) Example 1: Input: nums = [3,2,1,5,6,4], k = 2 Output: 5 Example 2: Input: nums = [3,2,3,1,2,4,5,5,6], k = 4 Output: 4 Constraints: 1 \u003c= k \u003c= nums.length \u003c= 104 -104 \u003c= nums[i] \u003c= 104 Solution: class Solution { public: int findKthLargest(vector\u003cint\u003e\u0026 nums, int k) { int idx = 0; vector\u003cint\u003e numL; vector\u003cint\u003e numR; for (int i = idx + 1; i \u003c nums.size(); i++) { if (nums[i] \u003e nums[idx]) { numR.push_back(nums[i]); } else { numL.push_back(nums[i]); } } if (numR.size() == k - 1) { return nums[idx]; } else if (numR.size() \u003e k - 1) { return findKthLargest(numR, k); } else { return findKthLargest(numL, k - numR.size() - 1); } } }; (Page55)Complexity: 如果子实例处在$[n(\\frac 34) ^{j + 1} + 1, n(\\frac 34) ^{j}]$则说明 算法运行在第$j$期,$X$表示算法整体的元素比较次数,$X_j$表示运行过程处于第j期时的比较次数,则有: ​ $$X = X_0 + X_1 + X_2 + \\dots$$ 选择中间区域的概率为$\\frac 12$,选择一个中间区域的元素作为中心元后,实例规模减少$\\frac 1 4$,因为每一期递归调用期望是两次,则在第$j$期的时候算法期望比较次数为$2n(\\frac{3}{4})^j$,则整体的期望比较次数为: ​ $$E(X)=E[X_0 +X_1+X_2+\\dots] \\leq \\sum_j 2cn (\\frac 34)^j \\leq 8cn$$ 则时间复杂度为$O(n)$。 ","date":"2021-12-17","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/:1:0","tags":["算法学习","卜东坡-算法设计与分析","分治"],"title":"卜东坡算法-2021秋作业1-分治","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/"},{"categories":["学习"],"content":"2. 二叉树邻域最小值 Consider an $n$-node complete binary tree $T$, where $n = 2^d − 1$ for some $d$. Each node $v$ of $T$ is labeled with a real number $x_v$. You may assume that the real numbers labeling the nodes are all distinct. A node $v$ of $T$ is a local minimum if the label $x_v$ is less than the label $x_w$ for all nodes $w$ that are joined to v by an edge. You are given such a complete binary tree T, but the labeling is only specified in the following: implicit way: for each node v, you can determine the value xv by probing the node v. Show how to find a local minimum of T using only O(logn) probes to the nodes of T. 解法: ","date":"2021-12-17","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/:2:0","tags":["算法学习","卜东坡-算法设计与分析","分治"],"title":"卜东坡算法-2021秋作业1-分治","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/"},{"categories":["学习"],"content":"3. 数组子数组最大和 1800.Maximum Ascending Subarray Sum (Easy) Given an integer array, one or more consecutive integers in the array form a sub-array. Find the maximum value of the sum of all subarrays. Please give an algorithm with O(nlogn) complexity class Solution { public: int findLargestSubArraySum(vector\u003cint\u003e\u0026 nums, int start, int end) { if (start == end) { return nums[start]; } else if (start \u003e end) { return -1; } int mid = (start + end) / 2; int subStart = mid; int subSum = nums[mid]; while (subStart \u003e start \u0026\u0026 nums[subStart] - 1 == nums[subStart - 1]) { subStart--; subSum += nums[subStart]; } int subEnd = mid; while (subEnd \u003c end \u0026\u0026 nums[subEnd] + 1 == nums[subEnd + 1]) { subEnd++; subSum += nums[subEnd]; } int subLSum = findLargestSubArraySum(nums, start, subStart - 1); int subRSum = findLargestSubArraySum(nums, subEnd + 1, end); return max(max(subSum, subLSum), subRSum); } }; ","date":"2021-12-17","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/:3:0","tags":["算法学习","卜东坡-算法设计与分析","分治"],"title":"卜东坡算法-2021秋作业1-分治","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/"},{"categories":["学习"],"content":"4. 查找有序数组指定元素的区间 34.find-first-and-last-position-of-element-in-sorted-array (Medium) Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value. If target is not found in the array, return [-1, -1]. You must write an algorithm with O(log n) runtime complexity. Example 1: Input: nums = [5,7,7,8,8,10], target = 8 Output: [3,4] Example 2: Input: nums = [5,7,7,8,8,10], target = 6 Output: [-1,-1] Example 3: Input: nums = [], target = 0 Output: [-1,-1] class Solution { public: vector\u003cint\u003e searchRange(vector\u003cint\u003e\u0026 nums, int target) { int l = findFisrt(nums, target); int h = findFisrt(nums, target + 1); if (l == nums.size() || nums[l] != target) { return vector\u003cint\u003e {-1, -1}; } return vector\u003cint\u003e {l, h - 1}; } int findFisrt(vector\u003cint\u003e\u0026 nums, int target) { int l = 0; int h = nums.size(); while (l \u003c h) { int mid = (l + h) / 2; if (nums[mid] \u003e= target) { h = mid; } else { l = mid + 1; } } return l; } }; ","date":"2021-12-17","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/:4:0","tags":["算法学习","卜东坡-算法设计与分析","分治"],"title":"卜东坡算法-2021秋作业1-分治","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/"},{"categories":["学习"],"content":"5. 求N多边形可以被切割成多少个三角形 Given a convex polygon with n vertices, we can divide it into several separated pieces, such that every piece is a triangle. When n = 4, there are two different ways to divide the polygon; When n = 5, there are five different ways. Give an algorithm that decides how many ways we can divide a convex polygon with n vertices into triangles. ","date":"2021-12-17","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/:5:0","tags":["算法学习","卜东坡-算法设计与分析","分治"],"title":"卜东坡算法-2021秋作业1-分治","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/"},{"categories":["学习"],"content":"6. 归并K个长度为N的有序链表 Given an array of k linked-lists lists, each linked-list is sorted in ascending order. Given an O(knlogk) algorithm to merge all the linked-lists into one sorted linked-list. (Note that the length of a linked-lists is n) class Solution { public: ListNode* mergeKLists(vector\u003cListNode*\u003e\u0026 lists) { return helpMergeKLists(lists, 0, lists.size() - 1); } ListNode* mergeTwoLists(ListNode* l1, ListNode* l2) { ListNode* head = new ListNode(-1); ListNode* p = head; while (l1 != NULL || l2 != NULL) { if (l1 == NULL \u0026\u0026 l2 != NULL) { p-\u003enext = l2; l2 = l2-\u003enext; } if (l1 != NULL \u0026\u0026 l2 == NULL) { p-\u003enext = l1; l1 = l1-\u003enext; } if (l1 != NULL \u0026\u0026 l2 != NULL) { p-\u003enext = l1-\u003eval \u003e l2-\u003eval ? l2 : l1; l1-\u003eval \u003e l2-\u003eval ? l2 = l2-\u003enext : l1 = l1-\u003enext; } p = p-\u003enext; } return head-\u003enext; } ListNode* helpMergeKLists(vector\u003cListNode*\u003e\u0026 lists, const int\u0026 start, const int\u0026 end) { if (start \u003e end) { return NULL; } else if (start == end) { return lists[start]; } int mid = (start + end) / 2; ListNode* l1 = helpMergeKLists(lists, start, mid); ListNode* l2 = helpMergeKLists(lists, mid + 1, end); return mergeTwoLists(l1, l2); } }; ","date":"2021-12-17","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/:6:0","tags":["算法学习","卜东坡-算法设计与分析","分治"],"title":"卜东坡算法-2021秋作业1-分治","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/"},{"categories":["学习"],"content":"7.Fast Mod Exponentiation Description Bob has encountered a difficult problem, and hope you design an algorithm to calculate pow(a,b) mod 1337, where a is a positive integer, b is a very large positive integer and will be given in the form of an array. For example, pow(2,3) mod 1337 is 8. 1 \\le a \\le 2^{31} - 1,1≤a≤231−1, 1 \\le b.length \\le 2000,1≤b.lengt**h≤2000, 0 \\le b[i] \\le 90≤b[i]≤9 bb doesn’t contain leading zeros. Please give an algorithm with O(\\log n)O(logn) complexity. Input Line 1: integers Line 2: an array Output One integer Sample Input 1 2 [3] Sample Output 1 8 Sample Input 2 4 [3,5] Sample Output 2 709 Sample Input 3 222222222 [4,0,0] Sample Output 3 1171 #include \u003cstdio.h\u003e #define MOD_VALUE 1337 int size = 0; int start = 0; int count = 0; int array[2000]; void arrayHalfDivide() { array[size - 1] = array[size - 1] / 2; int i = size - 2; while (i \u003e= start) { int curr = array[i] * 5; array[i] = curr / 10; array[i + 1] += curr % 10; --i; } if (array[start] == 0 \u0026\u0026 count \u003e 1) { count--; start++; } } int clacFastModExponentation(int base) { if (count == 1 \u0026\u0026 array[size - 1] == 0) { return 1; } if (count == 1 \u0026\u0026 array[size - 1] == 1) { return base % MOD_VALUE; } int sumMod = 1; if (array[size - 1] % 2 != 0) { array[size - 1] = array[size - 1] - 1; sumMod *= (base % MOD_VALUE); } arrayHalfDivide(); int currMod = clacFastModExponentation(base) % MOD_VALUE; sumMod *= (currMod * currMod) % MOD_VALUE; return sumMod % MOD_VALUE; } int main() { int base; scanf(\"%d\", \u0026base); char ch; while ((ch = getchar()) \u0026\u0026 ch != ']') { if (ch \u003e= '0' \u0026\u0026 ch \u003c= '9') { array[size++] = ch - '0'; count++; } } printf(\"%d\\n\", clacFastModExponentation(base)); return 0; } ","date":"2021-12-17","objectID":"/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/:7:0","tags":["算法学习","卜东坡-算法设计与分析","分治"],"title":"卜东坡算法-2021秋作业1-分治","uri":"/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/"},{"categories":["问题总结"],"content":"1.ModuleNotFoundError: No module named ‘_lzma’ ","date":"2021-10-05","objectID":"/posts/technology/pytorch/:1:0","tags":["pytorch"],"title":"pytorch使用问题","uri":"/posts/technology/pytorch/"},{"categories":["问题总结"],"content":"Ubuntu (1)安装依赖 apt-get install liblzma-dev -y pip install backports.lzma (2)打开lzma.py vim ~/a/b/python3.7/lzma.py (3)修改代码 #修改前 from _lzma import * from _lzma import _encode_filter_properties, _decode_filter_properties #修改后 try: from _lzma import * from _lzma import _encode_filter_properties, _decode_filter_properties except ImportError: from backports.lzma import * from backports.lzma import _encode_filter_properties, _decode_filter_properties ","date":"2021-10-05","objectID":"/posts/technology/pytorch/:1:1","tags":["pytorch"],"title":"pytorch使用问题","uri":"/posts/technology/pytorch/"},{"categories":["教程"],"content":"安装Latex ","date":"2021-10-05","objectID":"/posts/technology/latex/:1:0","tags":["latex"],"title":"安装latex","uri":"/posts/technology/latex/"},{"categories":["教程"],"content":"Windows WSL (1)安装WSL 配置WSL wsl --install 安装WSL-Ubuntu 18.04 wsl --install -d Ubuntu-18.04 #等待安装完成 启动Ubuntu wsl bash (2)安装TexLive 在线安装 sudo apt install texlive-full 装载Tex的ISO镜像安装 sudo mkdir /mnt/img sudo mount -t drvfs G: /mnt/img sudo mnt/img/install-tl (3)配置环境变量使得powershell上可以直接使用 sudo /usr/local/texlive/2020/bin/x86_64-linux/tlmgr path add (4)配置WSL使用windows字体 sudo apt install fontconfig 创建/etc/fonts/local.conf \u003c?xml version=\"1.0\"?\u003e \u003c!DOCTYPE fontconfig SYSTEM \"fonts.dtd\"\u003e \u003cfontconfig\u003e \u003cdir\u003e/mnt/c/Windows/Fonts\u003c/dir\u003e \u003c/fontconfig\u003e ","date":"2021-10-05","objectID":"/posts/technology/latex/:1:1","tags":["latex"],"title":"安装latex","uri":"/posts/technology/latex/"},{"categories":["教程"],"content":"Mongodb安装 (1)导入公匙 wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add - (2)创建mongodb列表文件 echo \"deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/5.0 multiverse\" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list (3)重新加载包数据 sudo apt-get update (4)重新加载包数据 sudo apt-get install -y mongodb-org=5.0.2 mongodb-org-database=5.0.2 mongodb-org-server=5.0.2 mongodb-org-shell=5.0.2 mongodb-org-mongos=5.0.2 mongodb-org-tools=5.0.2 (5)服务启动 sudo systemctl start mongod Mongodb配置修改 (1)打开配置 sudo vim /etc/mongod.conf (2)修改配置 # mongod.conf # for documentation of all options, see: # http://docs.mongodb.org/manual/reference/configuration-options/ # Where and how to store data. storage: dbPath: /var/lib/mongodb journal: enabled: true # engine: # wiredTiger: # where to write logging data. systemLog: destination: file logAppend: true path: /var/log/mongodb/mongod.log # network interfaces net: port: 10095 bindIp: 0.0.0.0 # how the process runs processManagement: timeZoneInfo: /usr/share/zoneinfo # 登录是否需要密码 #security: # authorization: enabled #operationProfiling: #replication: #sharding: ## Enterprise-Only Options: Mongodb添加用户 (1)连接Mongodb mongo mongodb://127.0.0.1:10095 (2)创建普通用户 use Production db.createUser( { user: \"production\", pwd: \"production@123\", // passwordPrompt() Or \"\u003ccleartext password\u003e\" roles: [ \"readWrite\", \"dbAdmin\" ] } ) (3)创建超级用户 use admin db.createUser( { user: \"mongoAdmin\", pwd: passwordPrompt(), // passwordPrompt() Or \"\u003ccleartext password\u003e\" roles: [ \"readWriteAnyDatabase\", \"userAdminAnyDatabase\", \"dbAdminAnyDatabase\"] } ) (4)登录 db.auth(\"production\") Mongodb更新用户权限 (1)连接Mongodb mongo mongodb://127.0.0.1:10095 (2)更新用户权限 use Production # 更新用户权限 db.updateUser(\"production\",{roles : [{\"role\" : \"readWriteAnyDatabase\",\"db\" : \"Stock\"},{\"role\" : \"dbAdminAnyDatabase\",\"db\" : \"Stock\"}]}) readWriteAnyDatabase ","date":"2021-09-16","objectID":"/posts/technology/mongodb/:0:0","tags":["MongoDB"],"title":"Mongodb总结","uri":"/posts/technology/mongodb/"},{"categories":["问题总结"],"content":"7.apt重新配置 (1)修复Python 当前的系统python如果有错误了,也需要一起修复,这个版本的python不能随便的更改,需要从一个正常的linux系统下把python复制出来。 # 版本正常的python3.6 mkdir python3.6 cd python3.6 mkdir python3.6-lib mkdir python3-lib mkdir x86_64-linux-gnu cp -rf /usr/bin/python3.6* ~/python3.6 cp -rf /usr/lib/python3.6/* ~/python3.6/python3.6-lib cp -rf /usr/lib/python3/* ~/python3.6/python3-lib cp -rf /usr/lib/x86_64-linux-gnu/*apt* ~/x86_64-linux-gnu/ cd .. tar zcvf python3.6.tar.gz python3.6 scp python3.6.tar.gz user@localhost:~ # 待修复的linux主机 tar zxvf python3.6.tar.gz cd python3.6 sudo cp -rf python3.6 /usr/bin sudo cp -rf python3.6m /usr/bin sudo cp -rf python3.6-lib/* /usr/lib/python3.6 sudo cp -rf python3-lib/* /usr/lib/python3 (2)修复动态库 dpkg -l apt 其中版本是2.0.2ubuntu0.2,下载对应的安装包并安装: # 安装apt wget http://mirrors.edge.kernel.org/ubuntu/pool/main/a/apt/apt_2.0.2ubuntu0.2_amd64.deb sudo dpkg -i apt_2.0.2ubuntu0.2_amd64.deb # 有时候提示缺少libapt-pkg6.0.so # 安装apt-pkg依赖 wget http://mirrors.edge.kernel.org/ubuntu/pool/main/a/apt/libapt-pkg6.0_2.0.2ubuntu0.2_amd64.deb sudo dpkg -i libapt-pkg6.0_2.0.2ubuntu0.2_amd64.deb (3)测试apt sudo apt update ","date":"2021-09-16","objectID":"/posts/technology/apt/:1:0","tags":["踩坑"],"title":"apt重新安装配置","uri":"/posts/technology/apt/"},{"categories":["问题总结"],"content":"Python 相关问题 ","date":"2021-09-16","objectID":"/posts/technology/python/:1:0","tags":["踩坑","python"],"title":"python总结","uri":"/posts/technology/python/"},{"categories":["问题总结"],"content":"Python ImportError: No module named _bz2 sudo apt-get install libbz2-dev #重新编译Python ","date":"2021-09-16","objectID":"/posts/technology/python/:1:1","tags":["踩坑","python"],"title":"python总结","uri":"/posts/technology/python/"},{"categories":["问题总结"],"content":"ImportError: Missing optional dependency ‘openpyxl’ pip install openpyxl #重新编译Python ","date":"2021-09-16","objectID":"/posts/technology/python/:1:2","tags":["踩坑","python"],"title":"python总结","uri":"/posts/technology/python/"},{"categories":["问题总结"],"content":"重置linux的python unset PYTHONHOME unset PYTHONPATH ","date":"2021-09-16","objectID":"/posts/technology/python/:1:3","tags":["踩坑","python"],"title":"python总结","uri":"/posts/technology/python/"},{"categories":["问题总结"],"content":"安装pip 下载get-pip.py wget https://bootstrap.pypa.io/get-pip.py 安装pip python get-pip.py ","date":"2021-09-16","objectID":"/posts/technology/python/:1:4","tags":["踩坑","python"],"title":"python总结","uri":"/posts/technology/python/"},{"categories":["教程"],"content":"Linux ","date":"2021-09-16","objectID":"/posts/technology/system/:0:0","tags":["linux","windows"],"title":"系统配置和问题","uri":"/posts/technology/system/"},{"categories":["教程"],"content":"/usr/bin/dpkg returned an error code (1) ","date":"2021-09-16","objectID":"/posts/technology/system/:1:0","tags":["linux","windows"],"title":"系统配置和问题","uri":"/posts/technology/system/"},{"categories":["教程"],"content":"解决dpkg错误 cd /var/lib/dpkg sudo mv info info.baksudo mkdir info ","date":"2021-09-16","objectID":"/posts/technology/system/:1:1","tags":["linux","windows"],"title":"系统配置和问题","uri":"/posts/technology/system/"},{"categories":["教程"],"content":"添加用户名和添加sudo ","date":"2021-09-16","objectID":"/posts/technology/system/:2:0","tags":["linux","windows"],"title":"系统配置和问题","uri":"/posts/technology/system/"},{"categories":["教程"],"content":"添加用户名 sudo useradd -m -d /data/username -s /bin/zsh username ","date":"2021-09-16","objectID":"/posts/technology/system/:2:1","tags":["linux","windows"],"title":"系统配置和问题","uri":"/posts/technology/system/"},{"categories":["教程"],"content":"修改密码 sudo passwd username ","date":"2021-09-16","objectID":"/posts/technology/system/:2:2","tags":["linux","windows"],"title":"系统配置和问题","uri":"/posts/technology/system/"},{"categories":["教程"],"content":"添加sudoers vi /etc/sudoers #添加用户 username ALL=(ALL:ALL) ALL ","date":"2021-09-16","objectID":"/posts/technology/system/:2:3","tags":["linux","windows"],"title":"系统配置和问题","uri":"/posts/technology/system/"},{"categories":["教程"],"content":"Ubuntu安装Linux开发包 sudo apt-get install build-essential ","date":"2021-09-16","objectID":"/posts/technology/system/:3:0","tags":["linux","windows"],"title":"系统配置和问题","uri":"/posts/technology/system/"},{"categories":["教程"],"content":"根据关键字把进程杀掉 kill -9 $(ps -ef|grep keyword|gawk '$0 !~/grep/ {print $2}' |tr -s '\\n' ' ') ","date":"2021-09-16","objectID":"/posts/technology/system/:4:0","tags":["linux","windows"],"title":"系统配置和问题","uri":"/posts/technology/system/"},{"categories":["教程"],"content":"linux永久挂载硬盘 查看当前的硬盘状态,可以知道硬盘的分区 sudo fdisk -l 修改配置 sudo vim /etc/fstab # 添加如下信息挂载硬盘 /dev/sdb1 /mnt/data ntfs-3g defaults 0 0 挂载硬盘 mkdir -p /mnt/data sudo mount -a ","date":"2021-09-16","objectID":"/posts/technology/system/:5:0","tags":["linux","windows"],"title":"系统配置和问题","uri":"/posts/technology/system/"},{"categories":["教程"],"content":"linux开机自启动并服务化 ","date":"2021-09-16","objectID":"/posts/technology/system/:6:0","tags":["linux","windows"],"title":"系统配置和问题","uri":"/posts/technology/system/"},{"categories":["教程"],"content":"Ubuntu 开机启动 系统服务化(以qbittorrent服务化为例) 不要在后面添加#的注释,不然会导致未知错误 配置文件/lib/systemd/system/qbittorrent.service [Unit] Description=qbittorrent-nox service #服务描述 Documentation=man:qbittorrent-nox(1) [Service] User=username #用户 Group=usergroup #用户组 UMask=0000 #权限777 Type=simple #ExecStartPre=-cd /home/\u003cspan class=\"hljs-built_in\"\u003etest\u003c/span\u003e/ #启动前执行 #WorkingDirectory=/home/\u003cspan class=\"hljs-built_in\"\u003etest\u003c/span\u003e/ #工作目录 ExecStart=/usr/bin/qbittorrent-nox #启动时执行 ExecReload=/bin/kill -SIGHUP $MAINPID #重启时执行 ExecStop=/bin/kill -SIGINT $MAINPID #停止时执行 [Install] WantedBy=default.target 服务常用命令集合 # 开机启动 systemctl enable qbittorrent # 关闭开机启动 systemctl disable qbittorrent # 启动服务 systemctl start qbittorrent # 停止服务 systemctl stop qbittorrent # 重启服务 systemctl restart qbittorrent # 查看服务状态 systemctl status qbittorrent systemctl is-active sshd.service # 结束服务进程(服务无法停止时) systemctl kill qbittorrent 用户服务化(以v2ray服务化为例,不需要sudo也可以启动,在某个用户登录的时候启动) 不要在后面添加#的注释,不然会导致未知错误 配置文件~/.config/systemd/user/v2ray.service``` [Unit] Description=keep v2ray's servie alive [Service] Type=simple Restart=always WorkingDirectory=~/v2ray/ ExecStart=bash v2ray.sh SystemCallArchitectures=native MemoryDenyWriteExecute=true NoNewPrivileges=true [Install] WantedBy=default.target 启动服务在原来的基础上加--user ```bash # 开机启动 systemctl --user enable --now v2ray # 关闭开机启动 systemctl --user disable --now v2ray ","date":"2021-09-16","objectID":"/posts/technology/system/:6:1","tags":["linux","windows"],"title":"系统配置和问题","uri":"/posts/technology/system/"},{"categories":["教程"],"content":"linux安装常见中文字体 ","date":"2021-09-16","objectID":"/posts/technology/system/:7:0","tags":["linux","windows"],"title":"系统配置和问题","uri":"/posts/technology/system/"},{"categories":["教程"],"content":"Ubuntu 打包Windows字体 mkdir -p winfonts cp -rf C:/Windows/Fonts winfonts 压缩winfonts为winfonts.zip 上传到linux scp winfonts.zip username@host:~ 安装字体 unzip -n -d /usr/share/fonts winfonts.zip sudo mkfontscale sudo mkfontdir sudo fc-cache -f -v 检查中文字体 fc-list :lang=zh Windows ","date":"2021-09-16","objectID":"/posts/technology/system/:7:1","tags":["linux","windows"],"title":"系统配置和问题","uri":"/posts/technology/system/"},{"categories":["教程"],"content":"给Neovim添加右键文件夹、文件以及右键空白区域三种菜单 右键文件夹 添加如下值 计算机\\HKEY_CLASSES_ROOT\\Directory\\shell\\使用Neovim打开 添加Icon 在使用Neovim打开空白处添加字符串项Icon设置值为\"D:\\Program Files\\Neovim\\bin\\gnvim.exe\" 添加打开命令 在使用Neovim打开添加子项command,设置值为\"D:\\Program Files\\Neovim\\bin\\gnvim.exe\" -qwindowgeometry 1310x650+20+20 \"%1\" 右键文件 添加如下值 计算机\\HKEY_CLASSES_ROOT\\*\\shell\\使用Neovim打开 添加Icon 在使用Neovim打开空白处添加字符串项Icon设置值为\"D:\\Program Files\\Neovim\\bin\\gnvim.exe\" 添加打开命令 在使用Neovim打开添加子项command,设置值为\"D:\\Program Files\\Neovim\\bin\\gnvim.exe\" -qwindowgeometry 1310x650+20+20 \"%1\" 右键文件 添加如下值 计算机\\HKEY_CLASSES_ROOT\\Directory\\Background\\shell\\使用Neovim打开 添加Icon 在使用Neovim打开空白处添加字符串项Icon设置值为\"D:\\Program Files\\Neovim\\bin\\gnvim.exe\" 添加打开命令 在使用Neovim打开添加子项command,设置值为\"D:\\Program Files\\Neovim\\bin\\gnvim.exe\" 参考文档 使用注册表编辑win10鼠标右键菜单,详细解释(右键文件夹、文件以及右键空白区域下三种情况)_鸾镜朱颜暗换的博客-CSDN博客_桌面右键菜单注册表 contextmenu - How add context menu item to Windows Explorer for folders - Stack Overflow ","date":"2021-09-16","objectID":"/posts/technology/system/:8:0","tags":["linux","windows"],"title":"系统配置和问题","uri":"/posts/technology/system/"},{"categories":["项目"],"content":"1.安装selenium ","date":"2021-08-30","objectID":"/posts/projects/resume_parser/:1:0","tags":["简历解析"],"title":"简历解析软件安装","uri":"/posts/projects/resume_parser/"},{"categories":["项目"],"content":"chrome安装 sudo apt-get install libxss1 libappindicator1 libindicator7 wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb sudo dpkg -i ./google-chrome*.deb sudo apt-get install -f ","date":"2021-08-30","objectID":"/posts/projects/resume_parser/:1:1","tags":["简历解析"],"title":"简历解析软件安装","uri":"/posts/projects/resume_parser/"},{"categories":["项目"],"content":"配置chromedriver (1)下载驱动 去官网下载:http://chromedriver.storage.googleapis.com/index.html 点击 (2)安装驱动 复制到对应的目录运行 ","date":"2021-08-30","objectID":"/posts/projects/resume_parser/:1:2","tags":["简历解析"],"title":"简历解析软件安装","uri":"/posts/projects/resume_parser/"},{"categories":["项目"],"content":"配置selenium pip install selenium ","date":"2021-08-30","objectID":"/posts/projects/resume_parser/:1:3","tags":["简历解析"],"title":"简历解析软件安装","uri":"/posts/projects/resume_parser/"},{"categories":["项目"],"content":"2.安装uwsgi ","date":"2021-08-30","objectID":"/posts/projects/resume_parser/:2:0","tags":["简历解析"],"title":"简历解析软件安装","uri":"/posts/projects/resume_parser/"},{"categories":["项目"],"content":"配置文件uwsgi.ini #uwsgi.ini [uwsgi] http = 0.0.0.0:8010 chdir = /home/jianli/resume_service/services pythonpath = /home/jianli/venv/bin/python wsgi-file = resume_parser.py buffer-size = 40960 callable = app processes = 1 stats = 127.0.0.1:9191 ","date":"2021-08-30","objectID":"/posts/projects/resume_parser/:2:1","tags":["简历解析"],"title":"简历解析软件安装","uri":"/posts/projects/resume_parser/"},{"categories":["项目"],"content":"安装和运行uwsgi pip install uwsgi uwsgi uwsgi.ini ","date":"2021-08-30","objectID":"/posts/projects/resume_parser/:2:2","tags":["简历解析"],"title":"简历解析软件安装","uri":"/posts/projects/resume_parser/"},{"categories":["项目"],"content":"3.安装supervisor ","date":"2021-08-30","objectID":"/posts/projects/resume_parser/:3:0","tags":["简历解析"],"title":"简历解析软件安装","uri":"/posts/projects/resume_parser/"},{"categories":["项目"],"content":"配置supervisor http://supervisord.org/installing.html pip install supervisor echo_supervisord_conf \u003e supervisord.conf supervisord -c supervisor.conf ","date":"2021-08-30","objectID":"/posts/projects/resume_parser/:3:1","tags":["简历解析"],"title":"简历解析软件安装","uri":"/posts/projects/resume_parser/"},{"categories":["项目"],"content":"启动停止supervisor supervisorctl update 重新加载配置 supervisorctl reload 重新启动所有程序 supervisorctl status 查看状态 ","date":"2021-08-30","objectID":"/posts/projects/resume_parser/:3:2","tags":["简历解析"],"title":"简历解析软件安装","uri":"/posts/projects/resume_parser/"},{"categories":["项目"],"content":"supervisor问题 1.supervisorctl出现http://localhost:9001 refused connection 设置serverurl: [supervisorctl] serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket ;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket ;username=chris ; should be same as http_username if set ;password=123 ; should be same as http_password if set ;prompt=mysupervisor ; cmd line prompt (default \"supervisor\") ;history_file=~/.sc_history ; use readline history if availabl 2.supervisord配置uwsgi后,调用接口会启动新的服务 重新设置uwsgi如下: [uwsgi] http = 0.0.0.0:8010 virtualenv = /home/jianli/venv wsgi-file = /home/jianli/resume_service/services/resume_parser.py buffer-size = 40960 callable = app processes = 1 thread = 1 ","date":"2021-08-30","objectID":"/posts/projects/resume_parser/:3:3","tags":["简历解析"],"title":"简历解析软件安装","uri":"/posts/projects/resume_parser/"},{"categories":["项目"],"content":"4.安装libreoffice ","date":"2021-08-30","objectID":"/posts/projects/resume_parser/:4:0","tags":["简历解析"],"title":"简历解析软件安装","uri":"/posts/projects/resume_parser/"},{"categories":["项目"],"content":"下载安装 wget https://mirrors.cloud.tencent.com/libreoffice/libreoffice/stable/7.1.5/deb/x86_64/LibreOffice_7.1.5_Linux_x86-64_deb.tar.gz (安装说明)[https://zh-cn.libreoffice.org/get-help/install-howto/] ","date":"2021-08-30","objectID":"/posts/projects/resume_parser/:4:1","tags":["简历解析"],"title":"简历解析软件安装","uri":"/posts/projects/resume_parser/"},{"categories":["项目"],"content":"字体安装 wget https://mirrors.tuna.tsinghua.edu.cn/adobe-fonts/source-han-serif/SubsetOTF/SourceHanSerifCN.zip wget https://mirrors.tuna.tsinghua.edu.cn/adobe-fonts/source-han-sans/SubsetOTF/CN/SourceHanSansCN-Bold.otf wget https://mirrors.tuna.tsinghua.edu.cn/adobe-fonts/source-han-sans/SubsetOTF/CN/SourceHanSansCN-ExtraLight.otf wget https://mirrors.tuna.tsinghua.edu.cn/adobe-fonts/source-han-sans/SubsetOTF/CN/SourceHanSansCN-Heavy.otf wget https://mirrors.tuna.tsinghua.edu.cn/adobe-fonts/source-han-sans/SubsetOTF/CN/SourceHanSansCN-Light.otf wget https://mirrors.tuna.tsinghua.edu.cn/adobe-fonts/source-han-sans/SubsetOTF/CN/SourceHanSansCN-Medium.otf wget https://mirrors.tuna.tsinghua.edu.cn/adobe-fonts/source-han-sans/SubsetOTF/CN/SourceHanSansCN-Normal.otf wget https://mirrors.tuna.tsinghua.edu.cn/adobe-fonts/source-han-sans/SubsetOTF/CN/SourceHanSansCN-Regular.otf unzip SourceHanSerifCN.zip mv SourceHanSerifCN SourceHan mv *.otf SourceHan sudo mv SourceHan /usr/share/fonts mkfontscale fc-cache -fv # 如果提示 fc-cache: command not found # 在Ubuntu下运行如下命令 # sudo apt-get install fontconfig # 在cent os下运行如下命令 # yum install fontconfig ","date":"2021-08-30","objectID":"/posts/projects/resume_parser/:4:2","tags":["简历解析"],"title":"简历解析软件安装","uri":"/posts/projects/resume_parser/"},{"categories":["教程"],"content":"Ubuntu UFW 配置 (1)查看ufw信息 sudo ufw status (2)激活ufw sudo ufw enable (3)阻止/允许IP # 允许IP sudo ufw allow from 203.0.113.101 # 阻止IP sudo ufw deny from 203.0.113.100 (3)阻止/允许port # 允许外部访问端口8080 sudo ufw allow 8080 # 允许某ip访问端口8080 sudo ufw allow from 203.0.113.101 to any port 8080 # 阻止外部访问端口8080 sudo ufw disable 8080 # 阻止某ip访问端口8080 sudo ufw deny from 203.0.113.101 to any port 8080 (4)阻止/允许ssh # 允许 sudo ufw allow OpenSSH # 阻止 sudo ufw disable OpenSSH (5)查看支持的APP,并阻止/允许 sudo ufw app list | grep Nginx #Output Nginx Full Nginx HTTP Nginx HTTPS 删除NginxFull #允许 sudo ufw allow \"Nginx Full\" #阻止 sudo ufw deny \"Nginx Full\" (6)删除规则 先查看规则 sudo ufw status 选择对应的规则删除,例如第二个规则 sudo ufw delete 2 直接根据规则来删除 sudo ufw allow from 203.0.113.101 to any port 8080 sudo ufw delete allow from 203.0.113.101 to any port 8080 ","date":"2021-08-30","objectID":"/posts/technology/ufw_config/:0:1","tags":["ufw","firewall"],"title":"配置ufw","uri":"/posts/technology/ufw_config/"},{"categories":null,"content":"📚Blog Hi,你好这是我的个人网站。 ","date":"2021-07-29","objectID":"/about/:1:0","tags":null,"title":"关于","uri":"/about/"},{"categories":["项目"],"content":"更新历史 2021-08-01 1.修复九宫拼音不支持简拼的情况,如输入xqw不显示结果。 2.四叶草拼音去除25258个重复的词组,只保留最高频次的词组 ./Clover四叶草拼音/clover.phrase.dict.yaml:成事在人 cheng shi zai ren 22846 ./Clover四叶草拼音/THUOCL_chengyu.dict.yaml:成事在人 cheng shi zai ren 21 如上所示,成事在人,在两个字典中都有频次,只保留clover.phrase.dict.yaml中22846频次的词组 3.更新四叶草拼音拼音错误,例如反弹拼音为fandan,错误修复来源@wisim,感谢@spphinslove的反馈 4.四叶草拼音-汉字帧-拼音错误修改,把帧错误拼音zheng相关的词组全部修改为帧zhen 修改费时费力,不易,请大家多多支持,点击支持。 2021-07-29 1.添加九宫格支持隐藏 2.添加常用功能说明 2021-06-27 1.更新同文3.2.0支持 2.修复小鹤双拼简繁转换问题 3.自然码支持简繁转换问题 注:简繁转换属于opencc的内容,和同文没有关系,odc2文件是opencc的生成结果。 2021-06-23 1.增加自然码双拼,没有辅助码 2021-06-03 1.修正郑码字典显示错误https://github.com/SivanLaai/rime_pure/issues/25 2.默认所有方案不显示字符和表情包 2021-02-07 1.增加qq五笔 2.增加笔画输入@HarryWang29 3.增加九宫格双拼 2020-12-17 1.修正拼音自定义添加造词的功能 2020-12-5(更新,增加徐码、郑码,支持拼音和五笔反查,增加全键盘的符号键盘) 1.优化小鹤双拼方案,双拼支持拼音“`”反查小鹤双拼编码 2.增加徐码 3.徐码支持五笔“`”反查编码 4.徐码支持拼音“`”反查编码 5.增加郑码 6.郑码支持拼音“`”反查编码 7.手机同文,全键盘的符号键盘,调整回车键大小,调整符号键大小,更符合手机端操作 2020-10-31 1.新增双拼输入方案支持-小鹤双拼 2.所有输入方案配置支持繁简转换、中英转换、字符输入、emoji表情、全半角转换 3.调整键盘布局,超大空格,减少误触 4.增加同文优化版皮肤 2020-10-27 1.新增讯飞皮肤 2.更新部分细节 3.增加小鹤九宫双拼 2020-10-25 1.去除了明月拼音,添加了以搜狗为基础的输入方案——🍀️四叶草简体拼音 2.以🍀️四叶草简体拼音为基础,添加了四叶草九宫输入方案,方便在手机端可以使用 3.同文手机端添加了两款机械键盘主题,cherry机械键盘/罗技 4.四叶草拼音输入法在手机端支持简繁转有一些问题,原因是没有正确配置opencc,修改后手机端支持简繁转换 5.极品五笔方案增加支持字符(输入平方可以选择²),emoji表情,繁简转换 6.支持五笔反查 ","date":"2021-07-29","objectID":"/posts/projects/rime/update_history/:1:0","tags":["rime"],"title":"Rime更新历史","uri":"/posts/projects/rime/update_history/"},{"categories":["rime","项目"],"content":"不看下面的繁索的安装直接去发布页面下载已编译版本 最新发布页面 ","date":"2021-07-29","objectID":"/posts/projects/rime/installation/:1:0","tags":["rime"],"title":"Rime安装说明","uri":"/posts/projects/rime/installation/"},{"categories":["rime","项目"],"content":"小狼毫(PC端) 0.备份小狼毫输入法安装目录的data文件夹,备份~\\AppData\\Rime文件夹,下载小狼毫安装包:https://rime.im/ 1.文件夹weasel\\data内所有文件复制到小狼毫输入法data目录覆盖 2.文件夹weasel\\Rime内所有文件复制到~\\AppData\\Rime目录覆盖 3.文件夹schemes\\基础文件内所有文件复制到~\\AppData\\Rime目录覆盖 4.方案安装(可选) 4.1 拼音方案安装 文件夹schemes\\Clover四叶草拼音内所有文件复制到~\\AppData\\Rime目录覆盖 4.2 五笔方案安装(五笔反查依赖拼音词库,需先安装4.1拼音方案) 文件夹schemes\\极点五笔内所有文件复制到~\\AppData\\Rime目录覆盖 4.3 双拼方案安装(双拼反查依赖拼音词库,需先安装4.1拼音方案) 文件夹schemes\\小鹤双拼内所有文件复制到~\\AppData\\Rime目录覆盖 4.4 郑码方案安装(反查依赖拼音词库,需先安装4.1拼音方案) 文件夹schemes\\郑码内所有文件复制到~\\AppData\\Rime目录覆盖 4.5 徐码方案安装(反查依赖拼音和五笔词库,需先安装4.1拼音方案和4.2五笔方案) 文件夹schemes\\徐码内所有文件复制到~\\AppData\\Rime目录覆盖 4.6 QQ五笔方案安装(反查依赖拼音词库,需先安装4.1拼音方案) 文件夹schemes\\QQ五笔内所有文件复制到~\\AppData\\Rime目录覆盖 4.7 自然码双拼方案安装(依赖拼音词库,需先安装4.1拼音方案) 文件夹schemes\\自然码双拼内所有文件复制到~\\AppData\\Rime目录覆盖 4.8 四叶草地球拼音方案安装(依赖拼音词库,需先安装4.1拼音方案) 文件夹schemes\\四叶草地球拼音内所有文件复制到~\\AppData\\Rime目录覆盖 5.重新部署 ","date":"2021-07-29","objectID":"/posts/projects/rime/installation/:2:0","tags":["rime"],"title":"Rime安装说明","uri":"/posts/projects/rime/installation/"},{"categories":["rime","项目"],"content":"同文(安卓端) 0.备份sdcard\\rime文件夹,下载同文apk:https://github.com/osfans/trime/releases 1.文件夹trime\\rime内所有文件复制到sdcard\\rime目录覆盖 2.文件夹schemes\\基础文件内所有文件复制到sdcard\\rime目录覆盖 3.方案安装(可选) 3.1 拼音方案安装 文件夹schemes\\Clover四叶草拼音内所有文件复制到sdcard\\rime目录覆盖 3.2 九宫拼音方案安装(依赖词库,必须先安装3.1,九宫不能显示,检查第一步是否正确安装) 文件夹schemes\\Clover四叶草九宫拼音内所有文件复制到sdcard\\rime目录覆盖 3.3 五笔方案安装(五笔反查依赖拼音词库,需先安装3.1拼音方案) 文件夹schemes\\极点五笔内所有文件复制到sdcard\\rime目录覆盖 3.4 双拼方案安装(双拼反查依赖拼音词库,需先安装3.1拼音方案) 文件夹schemes\\小鹤双拼内所有文件复制到sdcard\\rime目录覆盖 3.5 郑码方案安装(反查依赖拼音词库,需先安装3.1拼音方案) 文件夹schemes\\郑码内所有文件复制到sdcard\\rime目录覆盖 3.6 徐码方案安装(反查依赖拼音和五笔词库,需先安装3.1拼音方案和3.3五笔方案) 文件夹schemes\\徐码内所有文件复制到sdcard\\rime目录覆盖 3.7 QQ五笔方案安装(反查依赖拼音词库,需先安装3.1拼音方案) 文件夹schemes\\QQ五笔内所有文件复制到sdcard\\rime目录覆盖 3.8 自然码双拼方案安装(依赖拼音词库,需先安装3.1拼音方案) 文件夹schemes\\自然码双拼内所有文件复制到sdcard\\rime目录覆盖 3.9 四叶草地球拼音方案安装(依赖拼音词库,需先安装3.1拼音方案) 文件夹schemes\\四叶草地球拼音内所有文件复制到sdcard\\rime目录覆盖 4.重新部署 ","date":"2021-07-29","objectID":"/posts/projects/rime/installation/:3:0","tags":["rime"],"title":"Rime安装说明","uri":"/posts/projects/rime/installation/"},{"categories":["项目"],"content":"【rime 小狼毫\\trime 同文】手机/PC一站式配置【简约皮肤\\拼音搜狗词库\\原创trime同文 四叶草九宫格拼音\\四叶草拼音\\小鹤双拼\\极品五笔\\QQ五笔\\徐码\\郑码】 ","date":"2021-07-29","objectID":"/posts/projects/rime/info/:1:0","tags":["rime","输入法"],"title":"Rime输入法介绍","uri":"/posts/projects/rime/info/"},{"categories":["项目"],"content":"说明 rime是一款支持多平台的开源输入法,开源所以不需要担心自己的输入数据被输入法所搜集。虽然优点这么多,但是要使得输入法好用起来门槛比较高了,主要是在词库配置优化,依赖的东西多而且复杂。本项目的目的在于安卓手机端和Win pc端都可以从本项目一站配置好rime输入法,达到省心好用的程度。鉴于PC端已经有很多大神有现成的设置,所以花的时间较少,主要是整理收集。 发现手机端的优化一直没有做的较好的优化,本次主要的工作量是在手机端,所以从资源收集、皮肤设计、全键盘按钮设计和九宫格按键设计的每一个过程很耗费时间,有很多细节需要调整不断的修改文件和部署,有些地方不是清楚配置的地方还需要去看源码,经过一周的优化和设置,手机端已经使用起来很顺畅了。 目前在手机端配置了基于四叶草拼音的九宫格输入法,为了表示对原作者的劳动致敬,遂命名为四叶草九宫方案,感觉已经和之前使用的百度或者讯飞输入法感觉相当。 enjoy it! 好用的话就点个赞。感谢你的使用,因为本人同时在安卓和windows端使用,所以会一直更新。 ","date":"2021-07-29","objectID":"/posts/projects/rime/info/:2:0","tags":["rime","输入法"],"title":"Rime输入法介绍","uri":"/posts/projects/rime/info/"},{"categories":["项目"],"content":"QQ群 ","date":"2021-07-29","objectID":"/posts/projects/rime/info/:3:0","tags":["rime","输入法"],"title":"Rime输入法介绍","uri":"/posts/projects/rime/info/"},{"categories":["项目"],"content":"包含输入方案 - 🍀️四叶草拼音九宫格(不再使用原来的词库,原来的词库有很多问题,现在只是保留名字。) - 四叶草地球拼音 - 极点五笔 - 小鹤双拼 - 🍀️四叶草简体拼音 - 大写数字 - 自然双拼 - QQ86五笔(提取自qq五笔输入法,词库较为合理,推荐使用也是本人在使用的方案) - 徐码 - 郑码 ","date":"2021-07-29","objectID":"/posts/projects/rime/info/:4:0","tags":["rime","输入法"],"title":"Rime输入法介绍","uri":"/posts/projects/rime/info/"},{"categories":["项目"],"content":"实用功能: ","date":"2021-07-29","objectID":"/posts/projects/rime/info/:5:0","tags":["rime","输入法"],"title":"Rime输入法介绍","uri":"/posts/projects/rime/info/"},{"categories":["项目"],"content":"同文端 隐藏输入法:全键盘状态下按键G向下滑,九宫格状态下按分词键向下滑 编辑功能:全键盘状态下长按G,九宫格状态下按编辑键,可实现复制粘贴拷贝等功能 清空文本:删除键向左滑会清空当前编辑文本 切换主题:全键盘状态进入设置切换,九宫格长按带❖的按键切换主题 切换输入法:长按带✎的按键切换输入方案 设置:全键盘状态下按?123键下滑,九宫格状态下按带设置符号⚙的按键,既可进入设置页面 表情\\符号功能板:全键盘状态下长按?123键,九宫格状态下按符键 剪切板:全键盘状态下长按V键,九宫格状态下长按符键 ","date":"2021-07-29","objectID":"/posts/projects/rime/info/:5:1","tags":["rime","输入法"],"title":"Rime输入法介绍","uri":"/posts/projects/rime/info/"},{"categories":["项目"],"content":"预览: ","date":"2021-07-29","objectID":"/posts/projects/rime/info/:6:0","tags":["rime","输入法"],"title":"Rime输入法介绍","uri":"/posts/projects/rime/info/"},{"categories":["项目"],"content":"同文输入法(安卓端) 表情\\剪切板\\符号功能板 历史记录栏 剪切板 表情包 🍀️四叶草九宫输入方案 手机端支持简繁转换 部分皮肤预览 同文风优化版[配色:SivanLaai,键盘布局:SivanLaai] 讯飞默认皮肤[配色:SivanLaai,键盘布局:SivanLaai] cherry机械键盘【小先生】 极致简约[配色:SivanLaai,键盘布局:SivanLaai] 五笔字根【佚名】 炫彩[键盘布局:SivanLaai] ","date":"2021-07-29","objectID":"/posts/projects/rime/info/:6:1","tags":["rime","输入法"],"title":"Rime输入法介绍","uri":"/posts/projects/rime/info/"},{"categories":["项目"],"content":"小狼毫输入法(PC端) 简约现代蓝[配色:XNOM] 绿野仙踪绿[配色:佛振] Aqua[配色:佛振] 安卓[配色:Patricivs] 暗堂[配色:佛振] 孤寺[配色佛振] ","date":"2021-07-29","objectID":"/posts/projects/rime/info/:6:2","tags":["rime","输入法"],"title":"Rime输入法介绍","uri":"/posts/projects/rime/info/"},{"categories":["项目"],"content":"安装方法 查看安装方法 ","date":"2021-07-29","objectID":"/posts/projects/rime/info/:7:0","tags":["rime","输入法"],"title":"Rime输入法介绍","uri":"/posts/projects/rime/info/"},{"categories":["项目"],"content":"更新历史 2022-12-30 - 1.移除九宫模式下ascii模式的切换 - 2.优化九宫数字键盘布局 ![](https://cdn.statically.io/gh/SivanLaai/image-store-rep@master/note/ 20221230200634.png) 2022-11-4 - 1.优化四叶草拼音的基础词库为华宇输入法词库@warm-ice0x00(不再使用原来的词库,原来的词库有很多问题。) 2022-3-19 - 1.调整剪切板功能快捷方式 - 2.qq86五笔用户词添加不成功修复 2021-10-26 - 1.修复3.2.3所引入的键盘显示问题 - 2.调整键盘的符号页面,详情查看同文功能页面 - 3.调整数字页面为更加符合操作的九宫格数字页面 - 4.输入键盘快速跳转符号剪切栏 2021-10-20 - 1.四叶草拼音的权重调整为最大概率保留,同时是以词组进行切割的,例如弹出如果是分词的话就是tanchu,不会再出现danchu的拼音,如果弹出不是一个完整的分词那拼音可能是按单个字保留拼音的最大概率。主要改动在src/GenerateCloverData.py。 - 2.四叶草简体支持符号输入优化,/fh可以查看当前的符号,/jq可以查看所有的节气 - 3.四叶草简体支持笔画反查(`后输入hspnz分别表示一丨丿丶乙) 2021-10-17 - 1.修复同文端繁简转换opencc资源文件为最新的ocd2,小狼毫端暂时不支持ocd2。 2021-10-14 - 1.同步更新同文官方支持的剪切板功能,可以查看剪切板和最近表情包历史,使用更为灵活的符号菜单。 2021-09-01 - 1.前前后后、零零碎碎一共花了十来天地时间完成基于四叶草词库的地球拼音输入方案。 2021-08-30 - 1.四叶草支持多音字,最大程序的避免拼音错误,同时是以词组来分词的所以,不至于对所有的词组进行挨个多音字支持,而是优先词组。 例如弹出分词后还是弹出,所以只有tan chu的拼音,如果分词为弹\\出的话,则拼音会有tan chu 和 dan chu - 2.四叶草保留最大概率拼音词组,例如是不其中不为多音字,不的拼音有bu和fou,基于四叶草统计概率,bu的拼音概率更高,如果不是在词组的情况下,单字以bu为优先。 2021-08-18 - 1.写爬虫exact-pinyin-mark抓取百度汉语字典35W个组词数据用来精准匹配clover拼音数据。 - 2.使用luna拼音修复clover拼音数据。 - 3.使用phrase-pinyin-data修复clover拼音数据。 - 4.具有更高的基础词库,对于常见的拼音数据具有更高的识别率 2021-08-11 - 1.修复大字典中的的拼音错误。 - 2.基于python-pinyin对所有四叶草字典进行多音字修复,同时单字也支持多音字输入 ``` 例如朝拼chao zhao zhu输入 词频调整chao保留最高,依次递减10倍 例如chao为123,zhao为12,zhu为1 ``` 2021-08-01 - 1.修复九宫拼音不支持简拼的情况,如输入xqw不显示结果。 - 2.四叶草拼音去除25258个重复的词组,只保留最高频次的词组 ``` ./Clover四叶草拼音/clover.phrase.dict.yaml:成事在人 cheng shi zai ren 22846 ./Clover四叶草拼音/THUOCL_chengyu.dict.yaml:成事在人 cheng shi zai ren 21 如上所示,成事在人,在两个字典中都有频次,只保留clover.phrase.dict.yaml中22846频次的词组 ``` - 3.更新四叶草拼音错误,例如反弹拼音为fandan,错误修复来源@wisim,感谢@spphinslove的反馈 - 4.四叶草拼音-汉字帧-拼音错误修改,把帧错误拼音zheng相关的词组全部修改为帧zhen - 修改费时费力,不易,请大家多多支持,点击支持。 2021-07-29 - 1.添加九宫格支持隐藏 - 2.添加常用功能说明 2021-06-27 - 1.更新同文3.2.0支持 - 2.修复小鹤双拼简繁转换问题 - 3.自然码支持简繁转换问题 以往全部历史 ","date":"2021-07-29","objectID":"/posts/projects/rime/info/:8:0","tags":["rime","输入法"],"title":"Rime输入法介绍","uri":"/posts/projects/rime/info/"},{"categories":["项目"],"content":"相关资源 - 小狼毫输入法:https://github.com/rime/weasel - 同文输入法:https://github.com/osfans/trime - 简繁转换opencc:https://github.com/BYVoid/OpenCC - 拼音爬虫exact-pinyin-mark:https://github.com/SivanLaai/exact-pinyin-mark - 部分配色均整理自互联网,配色包含作者信息。 ","date":"2021-07-29","objectID":"/posts/projects/rime/info/:9:0","tags":["rime","输入法"],"title":"Rime输入法介绍","uri":"/posts/projects/rime/info/"},{"categories":["项目"],"content":"感谢 - 感谢@lotem - 感谢trime作者@osfans - 感谢四叶草拼音作者@fkxxyz - 感谢极品五笔作者@KyleBing - 感谢qq五笔@qq五笔 - 感谢opencc作者@BYVoid - 感谢@小鹤双拼 - 感谢@郑码 - 感谢@徐码 - 没有以上资源和各位的辛苦付出,也就没有这个项目 ","date":"2021-07-29","objectID":"/posts/projects/rime/info/:10:0","tags":["rime","输入法"],"title":"Rime输入法介绍","uri":"/posts/projects/rime/info/"},{"categories":["项目"],"content":"💖支持这个项目 如果你正在使用这个项目并感觉良好,或只是想要支持我继续开发,你可以通过如下任意 方式支持我: Star 并 分享这个项目 🚀 通过以下二维码 一次性捐款。 一杯咖啡。🍵 谢谢! ❤️ | 微信 | 支付宝 | | :—: | :—: | | | | ","date":"2021-07-29","objectID":"/posts/projects/rime/info/:11:0","tags":["rime","输入法"],"title":"Rime输入法介绍","uri":"/posts/projects/rime/info/"},{"categories":["项目"],"content":"许可证 MIT Copyright (c) 2020-present SivanLaai ","date":"2021-07-29","objectID":"/posts/projects/rime/info/:12:0","tags":["rime","输入法"],"title":"Rime输入法介绍","uri":"/posts/projects/rime/info/"},{"categories":["技术"],"content":"2020 年的第一篇博文竟然是讲虚拟砖混结构建筑物逾越技术的,感觉有点微妙。 年终总结啊,在写了在写了,明年就发。 因为嫌麻烦,我这几年基本用的都是现成的代理服务(俗称机场)。这样虽然不用担心自己机器 IP 被墙、速度方面基本有保障、节点也多,不过俗话说不要把鸡蛋放在一个篮子里,自建一个代理服务器备用还是很有必要的。 这几年翻墙技术似乎也发展了不少(是吗?),这次我选择的方法是 V2Ray + WebSocket + TLS + CloudFlare 中转:速度不重要,隐蔽性、抗干扰性第一。这么几层裹上去,除非真的掐网线搞大局域网,不然应该还是能撑个一段时间。 正文开始前先提个醒,本文不是小白教程,就是随手记录一下,所以我会假定你有一定的基础知识与操作经验。 ","date":"2020-01-12","objectID":"/posts/technology/lattern/:0:0","tags":["V2Ray"],"title":"搭建备用梯子:V2Ray + WebSocket + TLS + CloudFlare","uri":"/posts/technology/lattern/"},{"categories":["技术"],"content":"1. 安装 V2Ray 除非你是真的小白零经验,或者「能用就好」主义的忠实信奉者,不然我是不推荐你一上来就直接使用网上那些「一键脚本」的。 就算一键脚本再怎么优秀再怎么便利,至少也应该亲自手动操作一次,了解一下大致的流程。如果我想要做某件事,应该进行哪些操作,脚本会替我完成哪些操作,这些自动化操作是不是符合自己的预期(尤其是脚本是其他人写好的情况下),最起码这些东西得心里有数。 脚本写出来就是帮我们自动完成一些繁琐的操作的,其存在当然有意义,不然每台机器上都手动操作一遍过去,不得累死?用肯定是要用,我所不赞成的只是在不了解这个脚本的情况下瞎用。 线上服务器搭建 LNMP 环境时我也经常用 OneinStack 这样的一键包,很方便。而且它的源码我也都看过,很清楚它能干嘛、会干嘛。也知道它自带的 vhost.sh 虚拟主机管理脚本虽然看起来挺友好,但其修改出来的东西经常惨不忍睹,所以服务器上 Nginx 的配置我从来不用它,都是自己管理的。 总的来说就是可以用傻瓜式脚本,但咱也不能真成傻瓜了,对吧。 好了不说废话,来安装 V2Ray。 安装方法有很多,这里就直接用官方提供的脚本: bash \u003c(curl -L -s https://install.direct/go.sh) 脚本会自动安装这些东西: /usr/bin/v2ray/v2ray V2Ray 程序 /usr/bin/v2ray/v2ctl V2Ray 工具 /etc/v2ray/config.json 配置文件 /usr/bin/v2ray/geoip.dat IP 数据文件 /usr/bin/v2ray/geosite.dat 域名数据文件 /etc/systemd/system/v2ray.service Systemd Service /etc/init.d/v2ray SysV 启动脚本 ","date":"2020-01-12","objectID":"/posts/technology/lattern/:1:0","tags":["V2Ray"],"title":"搭建备用梯子:V2Ray + WebSocket + TLS + CloudFlare","uri":"/posts/technology/lattern/"},{"categories":["技术"],"content":"2. 配置 V2Ray 服务端 虽然严格来说 V2Ray 并不分客户端和服务端……反正就是那个意思啦。 编辑配置文件 /etc/v2ray/config.json: { \"inbounds\": [{ \"port\": 10086, // 因为还要用 Nginx 反代,这里直接监听本地就行 \"listen\": \"127.0.0.1\", \"protocol\": \"vmess\", \"settings\": { \"clients\": [ { // 用户 UUID,自己随机弄一个 \"id\": \"23ad6b10-8d1a-40f7-8ad0-e3e35cd38297\", \"level\": 1, \"alterId\": 64 } ] }, \"streamSettings\": { // 指定底层传输方式为 WebSocket \"network\": \"ws\", \"wsSettings\": { // 在哪个路径上提供 WS 服务,可自定义 \"path\": \"/whatever\" } } }], \"outbounds\": [{ \"protocol\": \"freedom\", \"settings\": {} },{ \"protocol\": \"blackhole\", \"settings\": {}, \"tag\": \"blocked\" }], \"routing\": { \"rules\": [ { // 默认规则,禁止访问服务器内网 \"type\": \"field\", \"ip\": [\"geoip:private\"], \"outboundTag\": \"blocked\" } ] } } 上述配置是直接基于默认配置修改的,V2Ray 的配置很灵活,还有很多可以完善的地方。不过配置调优并不是本文的重点,所以这里按下不表,有兴趣可以自行阅读官方文档。 ","date":"2020-01-12","objectID":"/posts/technology/lattern/:2:0","tags":["V2Ray"],"title":"搭建备用梯子:V2Ray + WebSocket + TLS + CloudFlare","uri":"/posts/technology/lattern/"},{"categories":["技术"],"content":"3. 运行 V2Ray 配置完了,运行一下: systemctl start v2ray 如果你的服务器不用 Systemd: service v2ray start # 要么 /etc/init.d/v2ray start # 或者手动运行 /usr/bin/v2ray/v2ray -config /etc/v2ray/config.json 测试一下有没有跑起来: curl -i http://127.0.0.1:10086/whatever HTTP/1.1 400 Bad Request Content-Type: text/plain; charset=utf-8 Sec-Websocket-Version: 13 X-Content-Type-Options: nosniff Date: Sun, 12 Jan 2020 11:45:14 GMT Content-Length: 12 Bad Request 注意 curl 访问的端口和路径要和上面 V2Ray 中配置的一致,出现 400 Bad Request 就对了。 ","date":"2020-01-12","objectID":"/posts/technology/lattern/:3:0","tags":["V2Ray"],"title":"搭建备用梯子:V2Ray + WebSocket + TLS + CloudFlare","uri":"/posts/technology/lattern/"},{"categories":["技术"],"content":"4. 配置 Nginx 毕竟要隐蔽嘛,最好是选一个已经上线的正常网站,悄咪咪地把其中一个路径反代到我们的 V2Ray 上。 网上不少 V2Ray + WebSocket + TLS 的教程里,Web 服务器 + SSL 证书的配置都是重头戏。可如果你平时就有在捣鼓网站的话,这些实在是都不算啥……所以我这里也就一笔带过了。 以 Nginx 为例,找个合适的 server {} 块添加以下内容(这重定向语法够蛋疼的): location /whatever { proxy_redirect off; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection \"upgrade\"; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; set $is_v2ray 0; if ($http_upgrade = \"websocket\") { set $is_v2ray 1; } if ($is_v2ray = 1) { # 仅当请求为 WebSocket 时才反代到 V2Ray proxy_pass http://127.0.0.1:10086; } if ($is_v2ray = 0) { # 否则显示正常网页 rewrite ^/(.*)$ /mask-page last; } } 注意 location 的路径要和上面 V2Ray 里配置的一样。 最后完整的 Nginx 配置大概类似这样: server { listen 443 ssl http2; server_name example.com; index index.html index.htm index.php; root /data/wwwroot/example; ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; ssl_session_cache shared:SSL:10m; ssl_session_timeout 10m; ssl_protocols TLSv1.2 TLSv1.3; ssl_prefer_server_ciphers on; ssl_ciphers EECDH+AESGCM:EDH+AESGCM; location ~ [^/]\\.php(/|$) { fastcgi_pass unix:/dev/shm/php-cgi.sock; fastcgi_index index.php; include fastcgi.conf; } location /whatever { # ... } } 表面看上去像个正常 PHP 网站,/whatever 里才是大有乾坤。 再把路径和网站内容搞得唬人一点,我寻思隐蔽性方面应该是没问题的。 ","date":"2020-01-12","objectID":"/posts/technology/lattern/:4:0","tags":["V2Ray"],"title":"搭建备用梯子:V2Ray + WebSocket + TLS + CloudFlare","uri":"/posts/technology/lattern/"},{"categories":["技术"],"content":"5. 配置 CloudFlare 呃,这个就不用讲什么了吧。还不说声多谢 CloudFlare 哥? CDN 配置完了再用 curl 测试一下: curl -i https://example.com/whatever HTTP/2 400 date: Sun, 12 Jan 2020 08:44:07 GMT content-type: text/plain; charset=utf-8 content-length: 12 sec-websocket-version: 13 x-content-type-options: nosniff cf-cache-status: DYNAMIC expect-ct: max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\" server: cloudflare Bad Request 同样也是出现 400 Bad Request 就对了。 如果你像我上面一样在 Nginx 中配置了 $http_upgrade = \"websocket\" 的判断的话,这里返回的会是用于伪装的那个页面(而且 Nginx 的 $http_upgrade 变量不知道是按什么赋值的,直接 curl --header \"Upgrade: websocket\" 的话还不认,怪得很)。可以使用 wscat 来测试: wscat -c wss://example.com/whatever Connected (press CTRL+C to quit) ","date":"2020-01-12","objectID":"/posts/technology/lattern/:5:0","tags":["V2Ray"],"title":"搭建备用梯子:V2Ray + WebSocket + TLS + CloudFlare","uri":"/posts/technology/lattern/"},{"categories":["技术"],"content":"6. 配置 V2Ray 客户端 客户端配置文件大概改成这样: { \"log\": { \"loglevel\": \"warning\" }, \"inbounds\": [{ // 本地代理配置 \"port\": 1080, \"listen\": \"127.0.0.1\", \"protocol\": \"socks\", \"settings\": { \"auth\": \"noauth\", \"udp\": false, \"ip\": \"127.0.0.1\" } }], \"outbounds\": [{ \"protocol\": \"vmess\", \"settings\": { \"vnext\": [ { // 套过 CloudFlare 的网址 \"address\": \"example.com\", \"port\": 443, \"users\": [ { // id 和 alterId 必须和服务端上配置的一样 \"id\": \"23ad6b10-8d1a-40f7-8ad0-e3e35cd38297\", \"alterId\": 64 } ] } ] }, \"streamSettings\": { // 传输协议为 WebSocket \"network\": \"ws\", // 底层传输安全为 TLS \"security\": \"tls\", \"wsSettings\": { // 路径要和上面设置的一样 \"path\": \"/whatever\" } } }], \"policy\": { \"levels\": { \"0\": {\"uplinkOnly\": 0} } } } 上述客户端配置同样也是简化的,路由、DNS 什么的都没设置。 当然,我估计桌面用户基本上用的都是各种图形客户端,不然可不是折腾自己嘛。以 Windows 上的 v2rayN 客户端为例,你可以这样添加服务器: 不出意外就可以正常使用了。 ","date":"2020-01-12","objectID":"/posts/technology/lattern/:6:0","tags":["V2Ray"],"title":"搭建备用梯子:V2Ray + WebSocket + TLS + CloudFlare","uri":"/posts/technology/lattern/"},{"categories":["技术"],"content":"常见问题 ","date":"2020-01-12","objectID":"/posts/technology/lattern/:7:0","tags":["V2Ray"],"title":"搭建备用梯子:V2Ray + WebSocket + TLS + CloudFlare","uri":"/posts/technology/lattern/"},{"categories":["技术"],"content":"TUN模式,开启热点连接暴增 开启热点分享功能,此时系统网络设置中会生成一个网卡 开启 TUN 模式 进入系统网络设置,在 Clash 网卡右键选择属性,选择共享标签页 勾选“允许其他网络用户通过此计算机的 Internet 连接来连接” 在“家庭网络连接”选择框中选择第 1 步生成的网卡 networdk-adaptor.jpg 参考链接: WebSocket+TLS+Web · V2Ray 配置指南|V2Ray 白话文教程 配置文件 · Project V 官方网站 使用Cloudflare中转V2Ray流量 · 233boy/v2ray Wiki CFW TUN 模式 移动热点冲突 - Leey’s ","date":"2020-01-12","objectID":"/posts/technology/lattern/:7:1","tags":["V2Ray"],"title":"搭建备用梯子:V2Ray + WebSocket + TLS + CloudFlare","uri":"/posts/technology/lattern/"},{"categories":["笔记"],"content":"多分类支持向量机可以用来处理多分类问题,其分类函数可以给每一个类得到一个分数值,从而从数值上了解哪个类别的分数高低,其损失函数也是通过某个特定的阈值来优化从而使得模型在正确类别上得到一个比其他类别更高的分数值。 loss函数(设定有C个类别) $$s = [s_1, s_2, …, s_C] = f(x_i, W) = [f(x_i, W)1, f(x_i, W)2, … ,f(x_i, W)C]$$ $$L_i = \\sum{j\\neq y_i} \\max(0, s_j - s{y_i} + \\Delta)$$ $$L = \\frac{1}{N} \\sum_i L_i + \\lambda R(W)$$ $$L = \\frac{1}{N} \\sum_i \\sum{j\\neq y_i} \\left[ \\max(0, f(x_i; W)j - f(x_i; W){y_i} + \\Delta) \\right] + \\lambda \\sum_k\\sum_l W_{k,l}^2$$ 梯度下降 $$s = W^Tx_i$$ $$j==yi时:\\frac{dL_i}{dW_{y_i}} = -\\sum_{j\\neq y_i}\\mathbb{I}(W^T_jx_i - W^T_{y_i}x_i + \\Delta\u003e0)$$ $$j!=i时:\\frac{dL_i}{dW_yi} = \\mathbb{I}(W^T_jx_i - W^T_{y_i}x_i + \\Delta\u003e0)$$ $$\\frac{dL}{dW} = \\frac{1}{N}\\sum^N_{i=1}\\frac{dL_i}{dW} + 2\\lambda W$$ $$执行 W = W - \\alpha \\frac{dL}{dW},在根据W求s,然后求loss,最后优化得到较理想的W值$$ ","date":"2018-06-28","objectID":"/posts/research/multiclass_svm/:0:0","tags":["分类"],"title":"多分类支持向量机","uri":"/posts/research/multiclass_svm/"},{"categories":["笔记"],"content":"bacth normlization中的前向传播 input:X_{ij}(本层所有的样本矩阵为X维度为mxD,m为样本数,D为神经元的个数,其中X_{ij}为X中的某一个样本) $$其中样本矩阵X = \\begin{bmatrix} X_{11}\u0026 X_{12} \u0026 … \u0026X_{1D} \\\\ X_{21}\u0026 X_{22} \u0026 … \u0026X_{2D} \\\\ .\u0026 . \u0026 …\u0026. \\\\ .\u0026 .\u0026 … \u0026 .\\\\ X_{m1}\u0026 X_{m2} \u0026 … \u0026X_{mD} \\end{bmatrix},X_{i} = \\begin{bmatrix} X_{i1}\u0026 X_{i2} \u0026 … \u0026X_{iD} \\\\ \\end{bmatrix},第j列为X_{\\cdot j} = \\begin{bmatrix} X_{1j}\\\\ X_{2j}\\\\ .\\\\ .\\\\ X_{mj} \\end{bmatrix}$$ $$ output格式为: Yi = BN(X_{ij}, \\gamma, \\beta)\\\\ 其中输出矩阵Y = \\begin{bmatrix} Y_{11}\u0026 Y_{12} \u0026 … \u0026Y_{1D} \\\\ Y_{21}\u0026 Y_{22} \u0026 … \u0026Y_{2D} \\\\ .\u0026 . \u0026 …\u0026. \\\\ .\u0026 .\u0026 … \u0026 .\\\\ Y_{m1}\u0026 Y_{m2} \u0026 … \u0026Y_{mD} \\end{bmatrix},m为样本数,D为输入维度数$$ 前向传播过程如下 $$\\mu_{j} = E(X) = \\frac{1}{m}\\sum_{i=1}^{m}X_{i},则\\mu_{j} 的维度为(1,D)\\\\ \\sigma_{j}^{2} = Var(X) = \\frac{1}{m}\\sum_{i=1}^{m}(X_{i}-\\mu_{j})^{2},则\\sigma_{j}^{2}的维度为(1,D)\\\\ 对第i个样本的估计\\hat{X_{ij}} = \\frac{X_{ij} - \\mu_{j}}{\\sqrt{\\sigma_{j}^{2} + \\varepsilon }},则\\hat{X_{i}}维度为(1,D)\\\\ 对m个样本估计\\hat{X} = \\frac{X - \\mu_{j}}{\\sqrt{\\sigma_{j}^{2} + \\varepsilon }},则\\hat{X}维度为(m,D)\\\\ 第i个样本的输出Y_{i} = \\gamma \\times \\hat{X_{i}} + \\beta,其中\\gamma维度为(1,D),\\beta维度为(1,D),则Y_{i}维度为(1,D)\\\\ 则m个样本的输出Y = \\gamma \\times \\hat{X} + \\beta,其中\\gamma维度为(1,D),\\beta维度为(1,D),则Y维度为(m,D)$$ ","date":"2018-04-28","objectID":"/posts/research/bacth_norm/:1:0","tags":["神经网络"],"title":"批量标准化","uri":"/posts/research/bacth_norm/"},{"categories":["笔记"],"content":"bacth normlization中的反向传播 $$假设上层梯度为\\frac{dL}{dY},本层输入为X,过程如下:\\\\ 从X中选中第j列,令x = \\begin{bmatrix} X_{1j}\\\\ X_{2j}\\\\ .\\\\ .\\\\ X_{mj} \\end{bmatrix}\\\\$$ (1)求dbeta $$我们先求d\\beta_{j} = \\sum_{i=1}^{m}\\frac{dL}{dY_{ij}} \\cdot \\frac{dY_{ij}}{d\\beta_{j}}, 由Y_{i} = \\gamma \\times \\hat{X_{i}} + \\beta可知Y_{ij} = \\gamma_{j} \\times \\hat{X_{ij}} + \\beta_{j},\\frac{dY_{ij}}{d\\beta_{j}}=1\\\\ 所以d\\beta_{j} = \\sum_{i=1}^{m}\\frac{dL}{dY_{ij}},则对整个矩阵操作d\\beta = \\sum_{i=1}^{m}\\frac{dL}{dY_{i}} = \\begin{bmatrix} d\\beta_{1}\u0026 d\\beta_{2} \u0026 … \u0026d\\beta_{D} \\\\ \\end{bmatrix}$$ (2)求dgamma $$ d\\gamma_{j} = \\sum_{i=1}^{m}\\frac{dL}{dY_{ij}} \\cdot \\frac{dY_{ij}}{d\\gamma_{j}}\\\\ 由Y_{i} = \\gamma \\times \\hat{X_{i}} + \\beta可知Y_{ij} = \\gamma_{j} \\times \\hat{X_{ij}} + \\beta_{j},\\frac{dY_{ij}}{d\\gamma_{j}}=\\hat{X_{ij}}\\\\ 所以d\\gamma_{j} = \\sum_{i=1}^{m}\\frac{dL}{dY_{ij}} \\cdot \\hat{X_{ij}}\\\\ 对整个矩阵进行操作d\\gamma = \\sum_{i=1}^{m}\\frac{dL}{dY_{i}} \\cdot \\hat{X_{i}} = \\begin{bmatrix} d\\gamma_{1}\u0026 d\\gamma_{2} \u0026 … \u0026d\\gamma_{D} \\end{bmatrix}$$ (3)求dX 最后我们还要对X进行求导,首先我们先看下面的链式路径: $$对第i行第j列进行反向传播:\\frac{dL}{dX_{ij}} = \\sum_{k=1}^{m}\\frac{dL}{d\\hat{X_{kj}}} \\cdot\\frac{d\\hat{X_{kj}}}{dX_{ij}} = \\sum_{k=1}^{m} \\sum_{l=1}^{m}(\\frac{dL}{d\\hat{Y_{lj}}} \\cdot \\frac{dY_{lj}}{d\\hat{X_{kj}}})\\cdot\\frac{d\\hat{X_{kj}}}{dX_{ij}}\\\\ 由Y_{i} = \\gamma \\times \\hat{X_{i}} + \\beta可知Y_{lj} = \\gamma_{j} \\times \\hat{X_{lj}} + \\beta_{j},则\\frac{dY_{lj}}{d\\hat{X_{kj}}}=\\gamma_{j}(当l=k时),\\frac{dY_{lj}}{d\\hat{X_{kj}}}=0(当l≠k时)\\\\ 则\\frac{dL}{dX_{ij}} = \\sum_{k=1}^{m}\\frac{dL}{dY_{kj}} \\cdot \\frac{dY_{kj}}{d\\hat{X_{kj}}} \\cdot\\frac{d\\hat{X_{kj}}}{dX_{ij}} = \\sum_{k=1}^{m}\\gamma_{j} \\cdot \\frac{dL}{dY_{kj}} \\cdot\\frac{d\\hat{X_{kj}}}{dX_{ij}} \\\\ 由\\hat{X_{ij}} = \\frac{X_{ij} - \\mu_{j}}{\\sqrt{\\sigma_{j}^{2} + \\varepsilon }},\\mu_{j} = \\frac{1}{m}\\sum_{k=1}^{m}X_{kj}, \\sigma_{j}^{2} = \\frac{1}{m}\\sum_{k=1}^{m}(X_{kj}-\\mu_{j})^{2}和上图可知我们求\\frac{d\\hat{X_{ij}}}{dX_{ij}}的话有三条路径:\\\\ 第一条路径为:\\frac{d\\hat{X_{kj}}}{dX_{ij}} = \\left \\lceil k==i \\right \\rfloor \\cdot \\frac{1}{\\sqrt{\\sigma_{j}^{2} + \\varepsilon }}\\\\ 第二条路径为:\\frac{d\\hat{X_{kj}}}{dX_{ij}} = \\frac{d\\hat{X_{kj}}}{d\\mu_{j}} \\cdot \\frac{d\\mu_{j}}{dX_{ij}},\\frac{d\\hat{X_{kj}}}{d\\mu_{j}} = -\\frac{1}{\\sqrt{\\sigma_{j}^{2} + \\varepsilon }},\\frac{d\\mu_{j}}{dX_{ij}} = \\frac{1}{m}\\\\ 则\\frac{d\\hat{X_{kj}}}{dX_{ij}} = -\\frac{1}{m\\sqrt{\\sigma_{j}^{2} + \\varepsilon }}\\\\ 第三条路径为:\\frac{d\\hat{X_{kj}}}{dX_{ij}} = \\frac{d\\hat{X_{kj}}}{d\\sigma_{j}^{2}} \\cdot \\frac{d\\sigma_{j}^{2}}{dX_{ij}},\\\\ \\frac{d\\hat{X_{kj}}}{d\\sigma_{j}^{2}} = -\\frac{X_{kj} - \\mu_{j}}{2(\\sigma_{j}^{2} + \\varepsilon)^{\\frac{3}{2}}},\\\\ 求解\\frac{d\\sigma_{j}^{2}}{dX_{ij}}有两个路径: 路径1:\\frac{d\\sigma_{j}^{2}}{dX_{ij}} = \\frac{2}{m}(X_{ij} - \\mu_{j}),路径2:\\frac{d\\sigma_{j}^{2}}{dX_{ij}} = \\frac{d\\sigma_{j}^{2}}{d\\mu_{j}} \\cdot \\frac{d\\mu_{j}}{dX_{ij}} = - \\frac{2}{m}(X_{ij} - \\mu_{j}) \\cdot \\frac{1}{m}\\\\ 则\\frac{d\\sigma_{j}^{2}}{dX_{ij}} = \\frac{d\\sigma_{j}^{2}}{dX_{ij}} + \\frac{d\\sigma_{j}^{2}}{d\\mu_{j}} \\cdot \\frac{d\\mu_{j}}{dX_{ij}} = \\frac{2}{m}(X_{ij} - \\mu_{j}) + (- \\frac{2}{m}(X_{ij} - \\mu_{j}) \\cdot \\frac{1}{m}) = \\frac{2}{m^{2}}(X_{ij} - \\mu_{j})(m - 1)\\\\ 则\\frac{d\\hat{X_{kj}}}{dX_{ij}} = \\frac{d\\hat{X_{kj}}}{d\\sigma_{j}^{2}} \\cdot \\frac{d\\sigma_{j}^{2}}{dX_{ij}} = -\\frac{X_{kj} - \\mu_{j}}{2(\\sigma_{j}^{2} + \\varepsilon)^{\\frac{3}{2}}} \\cdot \\frac{2}{m^{2}}(X_{ij} - \\mu_{j})(m - 1) = \\frac{(X_{kj} - \\mu_{j}) \\cdot(X_{ij} - \\mu_{j}) \\cdot(1 - m)}{m^{2}\\cdot (\\sigma_{j}^{2} + \\varepsilon)^{\\frac{3}{2}}}\\\\ 综合上述三条路径可求得\\frac{dL}{dX_{ij}} = \\sum_{k=1}^{m}\\gamma\\cdot\\frac{dL}{dY_{kj}}\\cdot\\frac{d\\hat{X_{kj}}}{dX_{ij}} + \\sum_{k=1}^{m}\\gamma\\cdot\\frac{dL}{dY_{kj}}\\cdot\\frac{d\\hat{X_{kj}}}{d\\mu_{j}} \\cdot \\frac{d\\mu_{j}}{dX_{ij}} +\\sum_{k=1}^{m}\\gamma\\cdot\\frac{dL}{dY_{kj}}\\cdot \\frac{d\\hat{X_{kj}}}{d\\sigma_{j}^{2}} \\cdot \\frac{d\\sigma_{j}^{2}}{dX_{ij}}\\\\ = \\gamma\\cdot\\frac{dL}{dY_{ij}}\\cdot\\frac{1}{\\sqrt{\\sigma_{j}^{2} + \\varepsilon }} + \\sum_{k=1}^{m}\\gamma\\cdot\\frac{dL}{dY_{kj}}\\cdot\\frac{-1}{m\\sqrt{\\sigma_{j}^{2} + \\varepsilon }} +\\sum_{k=1}^{m}\\gam","date":"2018-04-28","objectID":"/posts/research/bacth_norm/:2:0","tags":["神经网络"],"title":"批量标准化","uri":"/posts/research/bacth_norm/"},{"categories":["笔记"],"content":" 再学完斯坦福大学的计算机视觉的课后,总结一下自己对全连接神经网络的理解,方便在以后自己可以查阅和复习。首先简单的复习一下神经网络的概念,神经网络有输入层、隐藏层和输出层三种层,其中隐藏层可能会有多层,一个神经网络有多少层要看有多少个隐藏层加上输出层就为该神经网络的层数。神经网络的来源源于生物体的大脑的神经元的触发机制,但是我们要区分神经网络和真实生物体的差别。神经网络不是生物体神经元的真实映射。本篇文章以cs231n中的作业二中的神经网络作为背景进行讲述。 ","date":"2018-04-22","objectID":"/posts/research/neural_network/:0:0","tags":["神经网络"],"title":"全连接神经网络","uri":"/posts/research/neural_network/"},{"categories":["笔记"],"content":"1.神经网络中的基本结构 如上图所示,神经网络有输入层、隐藏层和输出层组成,这个神经网络一共有两层,一个隐藏层和一个输出层,输入层不算层数。输入层有输入维度为3,第一层有四个神经元,输出层有两个神经元。在某些结构中,我们的神经网络结构会更加,隐藏层可能会不只一个,而且每一层的神经元个数也会不唯一。其中每一个神经元有一个输入和一个输出,如下为一个神经元的内部详解: 一个神经元其实有两个处理,首先是对前面的输入做一个线性求和$$Z = \\sum_{i=1}^{N} wi \\cdot xi +b$$ 然后在有一个激活函数f在对z做处理得到这个神经元的输出 $$f(\\sum_{i=1}^{N} wi \\cdot xi +b)$$ 讲完了基本的神经网络结构后,我们现在以cs231n中作业2中的全连接神经网络架构做一个讲述,他的架构为{affine - [batch norm] - relu - [dropout]} x (L - 1) - affine - softmax也就是说前面的L-1层的每一层,先做一个affine,然后batch norm 在接着激活函数用relu处理一下输出,最后做一个dropout,到最后一层就在一个affine后进入一个softmax层得到神经网络的最终输出。 ","date":"2018-04-22","objectID":"/posts/research/neural_network/:1:0","tags":["神经网络"],"title":"全连接神经网络","uri":"/posts/research/neural_network/"},{"categories":["笔记"],"content":"2.前向传播 前向传播是从输入层开始把每一层的输出递交给下一层直至最后一层将结果输出的过程,在cs231n中前面的L-1层的前向过程如下: affine层对输入做一个线性组合输出affOut: $$affOut = \\sum_{i=1}^{N} wi \\cdot xi +b$$ batch norm层: 得到输出batchOUt relu层: 得到输出reluOut dropout层: 得到输出dropOut 然后在第L层也就是最后一层先进入一个affine层,然后把结果进入一个softmax层得到各个类别的分类概率。 在对每个样本softmax进行求loss得到最后的softmax loss,在加上正则化后为 $$L=\\frac{1}{N}\\sum_{i=1}^{N}Li(W) + \\lambda \\cdot \\sum_{l} \\sum_{i}\\sum_{j}W_{ij}^{l}$$ #代码解释 affOut,affCache = affine_forward(inputX, W, b) batchOut,batchCache = batchnorm_forward(affOut, gamma, beta, self.bn_params[i]) reluOut,reluCache = relu_forward(batchOut) dropOut,dropCache = dropout_forward(reluOut, self.dropout_param) ","date":"2018-04-22","objectID":"/posts/research/neural_network/:2:0","tags":["神经网络"],"title":"全连接神经网络","uri":"/posts/research/neural_network/"},{"categories":["笔记"],"content":"3.反向传播 反向传播其实就是链式求导的一个应用,求loss函数对最后一层输入的求导为: $$dZL = \\frac{dL}{dZ} = \\frac{1}{N}\\sum_{N}^{i=1}\\frac{dLi}{dZi}$$ 到dropOut层反向传播(该层输入 reluOut, 输出 dropOut(当为L-1层的时候dropOut=ZL)): $$\\frac{dL}{dreluOut} = \\frac{dL}{ddropOut} \\cdot \\frac{ddropOut}{dreluOut}$$ 到relu层反向传播(该层输入 dbatchOut 输出 reluOut): $$\\frac{dL}{dbatchOut} = \\frac{dL}{dreluOut} \\cdot \\frac{dreluOut}{dbatchOut}$$ 到batchout层(该层输入 affOut, 输出 batchOut): $$\\frac{dL}{daffOut} = \\frac{dL}{dbatchOut} \\cdot \\frac{dbatchOut}{daffOut}$$ $$d\\gamma = \\frac{dL}{d\\gamma} = \\frac{dL}{dbatchOut} \\cdot \\frac{dbatchOut}{daffOut}$$ $$d\\beta = \\frac{dL}{d\\beta} = \\frac{dL}{dbatchOut} \\cdot \\frac{dbatchOut}{daffOut}$$ 到affine层(该层输入 X, 输出 affOut): $$dX = \\frac{dL}{dX} = \\frac{dL}{daffOut} \\cdot \\frac{daffOut}{dX}$$ $$dW = \\frac{dL}{dW} = \\frac{dL}{daffOut} \\cdot \\frac{daffOut}{dW}$$ $$db = \\frac{dL}{db} = \\frac{dL}{daffOut} \\cdot \\frac{daffOut}{db}$$ ","date":"2018-04-22","objectID":"/posts/research/neural_network/:3:0","tags":["神经网络"],"title":"全连接神经网络","uri":"/posts/research/neural_network/"},{"categories":["笔记"],"content":"4.权重初始化 继续拿这个神经网络来说明,在第一层和第二层中我们都需要对权重进行初始化,每一层的w的维度初始化为本层的输入个数和本层的神经元个数,例如上图中第一层w的维度为3x4的矩阵,b的维度为1x4,第二层权重w的维度为4x2,b的维度为1x2。batchnorm层中beta和gamma的维度都为1xD(D为该层神经元的个数)。 一般w为从高斯分布中均值为0进行初始化,b初始化为0矩阵,beta初始化为0,gamma初始化为1 ","date":"2018-04-22","objectID":"/posts/research/neural_network/:4:0","tags":["神经网络"],"title":"全连接神经网络","uri":"/posts/research/neural_network/"},{"categories":["笔记"],"content":"5.神经网络中的梯度下降 对每一层: $$\\gamma = \\gamma - \\alpha \\cdot d\\gamma$$ $$\\beta = \\beta - \\alpha \\cdot d\\beta$$ $$W = W - \\alpha \\cdot dW$$ $$b = b - \\alpha \\cdot db$$ 然后前向传播求出loss,当loss足够小或者迭代次数足够多的时候停止梯度下降,此时参数即为近似最优解 ","date":"2018-04-22","objectID":"/posts/research/neural_network/:5:0","tags":["神经网络"],"title":"全连接神经网络","uri":"/posts/research/neural_network/"},{"categories":["笔记"],"content":"softmax函数简介: softmax函数是用来处理多分类的一种软性分类器,它输出的是每个类别的概率值。数据集特征矩阵为X其维度为D+1 x N(其中D+1为原本样本的特征维度数D加上bias的维度后的维度数,所以为D+1,N为样本数),标注矩阵为Y,维度为C x N(其中C为类别数,N为样本数)。 当我们给softmax输入一个样本Xi其输出格式为softmax(Xi) = [s1,s2,……,sC],其中s1对应类别1的概率值,s2对应类别2的概率值,依次类推到sC。softmax的过程如下: 然后来衡量第i个样本的loss公式如下: (其中yi表示第i个样本对应的类别) 所以N个样本的loss为: 加上正则化后为: 由如下Z和W与X的关系: 则可以把loss函数化成全部关于w的函数为: 现在我们来求softmax的导数,现在我们先对一个样本的导数进行求解,先把Li化简为如下形式: 则当对Wyi求导的时候(j==yi): 当对Wj求导的时候(j!=yi) 则如上操作可以求出单个loss的梯度如下(其中设yi=2): 现在我们需要把所有的梯度求出来并做一个平均就得到了loss的平均梯度: 加上正则化后的loss函数: 然后在足够的迭代次数中用梯度更新W(其中α为学习率): 直到在达到足够的迭代次数或者loss足够小的时候则停止更新 此时得到的W则为我们在这个softmax中所得到的W,然后在测试集中测试所有样本可得到样本的预测类别。 ","date":"2018-04-20","objectID":"/posts/research/softmax/:1:0","tags":["Softmax"],"title":"Softmax 梯度下降优化","uri":"/posts/research/softmax/"},{"categories":null,"content":"FixIt 主题的离线缓存页面","date":"0001-01-01","objectID":"/offline/","tags":null,"title":"","uri":"/offline/"},{"categories":null,"content":"源码 网站源码文件夹:source 数据库初始脚本文件:init_sql.sql 备份网站 打开网站Dashboard | HostGator Billing/Support System 登录密码进入cPanel-\u003eFiles-\u003eFile Manager 点选主目录选中public_html 右键点击compress根据提示进行备份 鼠标选中生成的文件,点击右键然后下载到本地备份即可 数据库备份 打开网站Dashboard | HostGator Billing/Support System 登录密码进入cPanel-\u003eDATABASES-\u003ephpMyAdmin 按如下操作即可把文件备份到本地 ","date":"0001-01-01","objectID":"/posts/projects/surrogacy-website/:0:0","tags":null,"title":"","uri":"/posts/projects/surrogacy-website/"},{"categories":null,"content":"密度函数平滑技术 当前的密度模型主要分为两类:(1)局部平滑和(2)全局平滑 ","date":"0001-01-01","objectID":"/posts/research/desity_modeling/:1:0","tags":null,"title":"","uri":"/posts/research/desity_modeling/"},{"categories":null,"content":"局部平滑 局部平滑函数用一个钟形的二次函数来替代原来的线性密度函数,只包含了局部的信息,可能会要消耗更多的迭代次数才能收敛。 ","date":"0001-01-01","objectID":"/posts/research/desity_modeling/:1:1","tags":null,"title":"","uri":"/posts/research/desity_modeling/"},{"categories":null,"content":"全局平滑 使用椭圆PDE去做平滑,现代非线性布局当中是主流的应用。全局信息的纳允许大规模的器件运动。在文献《T. F. Chan, J. Cong, J. R. Shinnerl, K. Sze, and M. Xie. mPL6: Enhanced Multilevel Mixed-Size Placement. In ISPD , pages 212–214, 2006.》中使用Helmholtz 方程来求密度如下: $$\\nabla\\psi(x,y)-\\epsilon\\psi(x,y)=\\rho(x,y),(x,y)\\in R$$ 其中$\\psi$表示平滑后的密度分布,当线性因子$\\epsilon \\gt 0$,有唯一解。 ","date":"0001-01-01","objectID":"/posts/research/desity_modeling/:1:2","tags":null,"title":"","uri":"/posts/research/desity_modeling/"}] \ No newline at end of file diff --git a/index.xml b/index.xml index 7c8dedf..0b827ad 100644 --- a/index.xml +++ b/index.xml @@ -1 +1 @@ -SivanLaai's Bloghttps://www.laais.cn/SivanLaai's blog, Where to learning, recording and being better.Hugo -- gohugo.iozh-CNlyhhap@163.com (SivanLaai)lyhhap@163.com (SivanLaai)This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.Wed, 05 Apr 2023 19:08:19 +0800nvim下混合编译调试Dreamplace源码https://www.laais.cn/posts/technology/nvim_debug_mixed_cpp_python/Wed, 05 Apr 2023 19:08:19 +0800SivanLaaihttps://www.laais.cn/posts/technology/nvim_debug_mixed_cpp_python/Ubuntu安装VNCServerhttps://www.laais.cn/posts/technology/vnc_server/Tue, 28 Mar 2023 13:48:48 +0800SivanLaaihttps://www.laais.cn/posts/technology/vnc_server/Step1 (安装GNOME桌面) 1 2 3 sudo apt-get update sudo apt-get install gnome-session-flashback sudo apt-get install ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal -y Step2 1 sudo apt-get -y install xfonts-100dpi xfonts-100dpi-transcoded xfonts-75dpi xfonts-75dpi-transcoded xfonts-base Step3 1 sudo apt install tigervnc-standalone-server Step4:配置密码 1 vncpasswd Step5:配置X基于电势的解析布局https://www.laais.cn/posts/research/eplace/Mon, 27 Mar 2023 16:33:04 +0800SivanLaaihttps://www.laais.cn/posts/research/eplace/基本概念 布局的定义 布局问题可以描述为一个超图问题,可以定义为如下: $$G = (V,E,R)$$ 其中$V$表示元器件(顶点)集合,$E$表示网表(超边)集合,$R$好物收藏https://www.laais.cn/posts/misc/collection/Sat, 10 Dec 2022 11:39:42 +0800SivanLaaihttps://www.laais.cn/posts/misc/collection/教程 Hugo博客官方教程 Markdown 官方教程 工具 图片上传 | PicX 图床神器 (xpoet.cn)Obsidian写hugo博客,github自动部署https://www.laais.cn/posts/technology/auto_deploy_with_obsidian/Fri, 09 Dec 2022 15:41:53 +0800SivanLaaihttps://www.laais.cn/posts/technology/auto_deploy_with_obsidian/本人原来使用的博客是vuepress + vdoing,后来在使用的过程中发现这个博客非常的笨重,没有多少的文章编译下来就需要一会时间。 以前使用nextcloud配置https://www.laais.cn/posts/technology/nextcloud/Thu, 28 Jul 2022 11:46:36 +0000SivanLaaihttps://www.laais.cn/posts/technology/nextcloud/nextcloud网盘相关问题 网盘配置 (1)配置环境 Linux + Apache2 + Mysql + Php(LAMP) Example installation on Ubuntu 20.04 LTS — Nextcloud latest Administration Manual latest documentation 配置Linux + Nginx + Mysql + Php(LNMP)环境 1wordpress安装和问题https://www.laais.cn/posts/technology/wordpress/Thu, 19 May 2022 13:40:49 +0000SivanLaaihttps://www.laais.cn/posts/technology/wordpress/wordpress permainlink 不生效 1.打开apache2默认配置文件 1 sudo vim /etc/apache2/sites-available/000-default.conf 2.修改内容为如下 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35软件编译和安装https://www.laais.cn/posts/technology/compile_and_install/Thu, 19 May 2022 13:40:49 +0000SivanLaaihttps://www.laais.cn/posts/technology/compile_and_install/软件编译和安装 qbittorrent编译安装 安装依赖 1 2 apt-get install build-essential pkg-config automake libtool git apt-get install libboost-dev libboost-system-dev libboost-chrono-dev libboost-random-dev libssl-dev libgeoip-dev 安装libtorrent 1 2 3 4 5 6 7 8 9 git clone https://github.com/arvidn/libtorrent.git #之前web容器的使用和反向代理https://www.laais.cn/posts/technology/apache2_and_nginx/Tue, 03 May 2022 10:47:44 +0000SivanLaaihttps://www.laais.cn/posts/technology/apache2_and_nginx/Vim/Neovim-Tmux 一键安装轻量级工作站https://www.laais.cn/posts/projects/vim/Fri, 08 Apr 2022 16:14:01 +0000SivanLaaihttps://www.laais.cn/posts/projects/vim/添加功能: 1.文件管理:插件NerdTree 打开文件管理:Crtl + N 退出文件管理:Crtl + C 2.跳转功能:Ctags\pygments\ \ No newline at end of file +SivanLaai's Bloghttps://www.laais.cn/SivanLaai's blog, Where to learning, recording and being better.Hugo -- gohugo.iozh-CNlyhhap@163.com (SivanLaai)lyhhap@163.com (SivanLaai)This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.Thu, 28 Sep 2023 11:52:17 +0800Q学习算法https://www.laais.cn/posts/learning/rl/q_learning/Thu, 28 Sep 2023 11:52:17 +0800SivanLaaihttps://www.laais.cn/posts/learning/rl/q_learning/状态$s_1,s_2$,动作$a_1,a_2$ 当前步的实现:$$Q(s_1,a_2)=r+\gamma \max_{a^}(Q(s^,a^))简介https://www.laais.cn/posts/learning/rl/rl_basic/Thu, 28 Sep 2023 10:36:03 +0800SivanLaaihttps://www.laais.cn/posts/learning/rl/rl_basic/概念 原先的动作是没有标签的,强化学习可以对每一个动作进行打分,然后学习,不断的迭代完成算法的学习。 按环境分类 Model-Free RL(不理解所处环境) 环境给到nvim下混合编译调试Dreamplace源码https://www.laais.cn/posts/technology/nvim_debug_mixed_cpp_python/Wed, 05 Apr 2023 19:08:19 +0800SivanLaaihttps://www.laais.cn/posts/technology/nvim_debug_mixed_cpp_python/Ubuntu安装VNCServerhttps://www.laais.cn/posts/technology/vnc_server/Tue, 28 Mar 2023 13:48:48 +0800SivanLaaihttps://www.laais.cn/posts/technology/vnc_server/Step1 (安装GNOME桌面) 1 2 3 sudo apt-get update sudo apt-get install gnome-session-flashback sudo apt-get install ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal -y Step2 1 sudo apt-get -y install xfonts-100dpi xfonts-100dpi-transcoded xfonts-75dpi xfonts-75dpi-transcoded xfonts-base Step3 1 sudo apt install tigervnc-standalone-server Step4:配置密码 1 vncpasswd Step5:配置X基于电势的解析布局https://www.laais.cn/posts/research/eplace/Mon, 27 Mar 2023 16:33:04 +0800SivanLaaihttps://www.laais.cn/posts/research/eplace/基本概念 布局的定义 布局问题可以描述为一个超图问题,可以定义为如下: $$G = (V,E,R)$$ 其中$V$表示元器件(顶点)集合,$E$表示网表(超边)集合,$R$好物收藏https://www.laais.cn/posts/misc/collection/Sat, 10 Dec 2022 11:39:42 +0800SivanLaaihttps://www.laais.cn/posts/misc/collection/教程 Hugo博客官方教程 Markdown 官方教程 工具 图片上传 | PicX 图床神器 (xpoet.cn)Obsidian写hugo博客,github自动部署https://www.laais.cn/posts/technology/auto_deploy_with_obsidian/Fri, 09 Dec 2022 15:41:53 +0800SivanLaaihttps://www.laais.cn/posts/technology/auto_deploy_with_obsidian/本人原来使用的博客是vuepress + vdoing,后来在使用的过程中发现这个博客非常的笨重,没有多少的文章编译下来就需要一会时间。 以前使用nextcloud配置https://www.laais.cn/posts/technology/nextcloud/Thu, 28 Jul 2022 11:46:36 +0000SivanLaaihttps://www.laais.cn/posts/technology/nextcloud/nextcloud网盘相关问题 网盘配置 (1)配置环境 Linux + Apache2 + Mysql + Php(LAMP) Example installation on Ubuntu 20.04 LTS — Nextcloud latest Administration Manual latest documentation 配置Linux + Nginx + Mysql + Php(LNMP)环境 1wordpress安装和问题https://www.laais.cn/posts/technology/wordpress/Thu, 19 May 2022 13:40:49 +0000SivanLaaihttps://www.laais.cn/posts/technology/wordpress/wordpress permainlink 不生效 1.打开apache2默认配置文件 1 sudo vim /etc/apache2/sites-available/000-default.conf 2.修改内容为如下 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35软件编译和安装https://www.laais.cn/posts/technology/compile_and_install/Thu, 19 May 2022 13:40:49 +0000SivanLaaihttps://www.laais.cn/posts/technology/compile_and_install/软件编译和安装 qbittorrent编译安装 安装依赖 1 2 apt-get install build-essential pkg-config automake libtool git apt-get install libboost-dev libboost-system-dev libboost-chrono-dev libboost-random-dev libssl-dev libgeoip-dev 安装libtorrent 1 2 3 4 5 6 7 8 9 git clone https://github.com/arvidn/libtorrent.git #之前 \ No newline at end of file diff --git a/offline/index.md b/offline/index.md index fbc8518..d3bdc08 100644 --- a/offline/index.md +++ b/offline/index.md @@ -1,13 +1,6 @@ # ---- -type: "offline" -description: "FixIt 主题的离线缓存页面" -keywords: - - PWA - - offline - - 离线 ---- + --- diff --git a/page/2/index.html b/page/2/index.html index a6d4ebf..fb75d2e 100644 --- a/page/2/index.html +++ b/page/2/index.html @@ -1,4 +1,4 @@ -SivanLaai's Blog
0%
\ No newline at end of file diff --git a/page/3/index.html b/page/3/index.html index e84c1cf..d4773eb 100644 --- a/page/3/index.html +++ b/page/3/index.html @@ -1,4 +1,4 @@ -SivanLaai's Blog
0%
\ No newline at end of file diff --git a/page/4/index.html b/page/4/index.html index 226aa44..ab3f030 100644 --- a/page/4/index.html +++ b/page/4/index.html @@ -1,4 +1,4 @@ -SivanLaai's Blog
0%
\ No newline at end of file diff --git a/page/5/index.html b/page/5/index.html index fdced6c..1dd439b 100644 --- a/page/5/index.html +++ b/page/5/index.html @@ -1,4 +1,4 @@ -SivanLaai's Blog
0%
\ No newline at end of file diff --git a/page/6/index.html b/page/6/index.html index e5bcb98..cd33ce2 100644 --- a/page/6/index.html +++ b/page/6/index.html @@ -1,4 +1,4 @@ -SivanLaai's Blog
0%
\ No newline at end of file diff --git a/posts/index.html b/posts/index.html index 0f5816d..10bf7a8 100644 --- a/posts/index.html +++ b/posts/index.html @@ -6,7 +6,17 @@
取消

所有📚 -32

总计约 44.50K 字

2023

最近更新

+更新于 10-08

2023

2022

0%
\ No newline at end of file diff --git a/posts/index.xml b/posts/index.xml index 2d9b520..1505b61 100644 --- a/posts/index.xml +++ b/posts/index.xml @@ -1 +1 @@ -所有📚 - SivanLaai's Bloghttps://www.laais.cn/posts/所有📚 | SivanLaai's BlogHugo -- gohugo.iozh-CNlyhhap@163.com (SivanLaai)lyhhap@163.com (SivanLaai)This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.nvim下混合编译调试Dreamplace源码https://www.laais.cn/posts/technology/nvim_debug_mixed_cpp_python/Wed, 05 Apr 2023 19:08:19 +0800SivanLaaihttps://www.laais.cn/posts/technology/nvim_debug_mixed_cpp_python/Ubuntu安装VNCServerhttps://www.laais.cn/posts/technology/vnc_server/Tue, 28 Mar 2023 13:48:48 +0800SivanLaaihttps://www.laais.cn/posts/technology/vnc_server/Step1 (安装GNOME桌面) 1 2 3 sudo apt-get update sudo apt-get install gnome-session-flashback sudo apt-get install ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal -y Step2 1 sudo apt-get -y install xfonts-100dpi xfonts-100dpi-transcoded xfonts-75dpi xfonts-75dpi-transcoded xfonts-base Step3 1 sudo apt install tigervnc-standalone-server Step4:配置密码 1 vncpasswd Step5:配置X基于电势的解析布局https://www.laais.cn/posts/research/eplace/Mon, 27 Mar 2023 16:33:04 +0800SivanLaaihttps://www.laais.cn/posts/research/eplace/基本概念 布局的定义 布局问题可以描述为一个超图问题,可以定义为如下: $$G = (V,E,R)$$ 其中$V$表示元器件(顶点)集合,$E$表示网表(超边)集合,$R$好物收藏https://www.laais.cn/posts/misc/collection/Sat, 10 Dec 2022 11:39:42 +0800SivanLaaihttps://www.laais.cn/posts/misc/collection/教程 Hugo博客官方教程 Markdown 官方教程 工具 图片上传 | PicX 图床神器 (xpoet.cn)Obsidian写hugo博客,github自动部署https://www.laais.cn/posts/technology/auto_deploy_with_obsidian/Fri, 09 Dec 2022 15:41:53 +0800SivanLaaihttps://www.laais.cn/posts/technology/auto_deploy_with_obsidian/本人原来使用的博客是vuepress + vdoing,后来在使用的过程中发现这个博客非常的笨重,没有多少的文章编译下来就需要一会时间。 以前使用nextcloud配置https://www.laais.cn/posts/technology/nextcloud/Thu, 28 Jul 2022 11:46:36 +0000SivanLaaihttps://www.laais.cn/posts/technology/nextcloud/nextcloud网盘相关问题 网盘配置 (1)配置环境 Linux + Apache2 + Mysql + Php(LAMP) Example installation on Ubuntu 20.04 LTS — Nextcloud latest Administration Manual latest documentation 配置Linux + Nginx + Mysql + Php(LNMP)环境 1wordpress安装和问题https://www.laais.cn/posts/technology/wordpress/Thu, 19 May 2022 13:40:49 +0000SivanLaaihttps://www.laais.cn/posts/technology/wordpress/wordpress permainlink 不生效 1.打开apache2默认配置文件 1 sudo vim /etc/apache2/sites-available/000-default.conf 2.修改内容为如下 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35软件编译和安装https://www.laais.cn/posts/technology/compile_and_install/Thu, 19 May 2022 13:40:49 +0000SivanLaaihttps://www.laais.cn/posts/technology/compile_and_install/软件编译和安装 qbittorrent编译安装 安装依赖 1 2 apt-get install build-essential pkg-config automake libtool git apt-get install libboost-dev libboost-system-dev libboost-chrono-dev libboost-random-dev libssl-dev libgeoip-dev 安装libtorrent 1 2 3 4 5 6 7 8 9 git clone https://github.com/arvidn/libtorrent.git #之前web容器的使用和反向代理https://www.laais.cn/posts/technology/apache2_and_nginx/Tue, 03 May 2022 10:47:44 +0000SivanLaaihttps://www.laais.cn/posts/technology/apache2_and_nginx/Vim/Neovim-Tmux 一键安装轻量级工作站https://www.laais.cn/posts/projects/vim/Fri, 08 Apr 2022 16:14:01 +0000SivanLaaihttps://www.laais.cn/posts/projects/vim/添加功能: 1.文件管理:插件NerdTree 打开文件管理:Crtl + N 退出文件管理:Crtl + C 2.跳转功能:Ctags\pygments\ \ No newline at end of file +所有📚 - SivanLaai's Bloghttps://www.laais.cn/posts/所有📚 | SivanLaai's BlogHugo -- gohugo.iozh-CNlyhhap@163.com (SivanLaai)lyhhap@163.com (SivanLaai)This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.<link>https://www.laais.cn/posts/projects/surrogacy-website/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><author>SivanLaai</author><guid>https://www.laais.cn/posts/projects/surrogacy-website/</guid><description>源码 网站源码文件夹:source 数据库初始脚本文件:init_sql.sql 备份网站 打开网站Dashboard | HostGator Billing/Support System 登录密码进入cPane</description></item><item><title>Rime输入法介绍https://www.laais.cn/posts/projects/rime/info/Thu, 29 Jul 2021 13:42:07 +0000SivanLaaihttps://www.laais.cn/posts/projects/rime/info/【rime 小狼毫\trime 同文】手机/PC一站式配置【简约皮肤\拼音搜狗词库\原创trime同文 四叶草九宫格拼音\四叶草拼音\小鹤双拼\极docker教程https://www.laais.cn/posts/technology/docker/Sat, 02 Apr 2022 19:07:09 +0000SivanLaaihttps://www.laais.cn/posts/technology/docker/docker教程 docker安装 卸载老版本docker 1 sudo apt-get remove docker docker-engine docker.io containerd runc 设置apt仓库 1.更新apt包索引并且安装相关依赖允许apt使用htweb容器的使用和反向代理https://www.laais.cn/posts/technology/apache2_and_nginx/Tue, 03 May 2022 10:47:44 +0000SivanLaaihttps://www.laais.cn/posts/technology/apache2_and_nginx/基于电势的解析布局https://www.laais.cn/posts/research/eplace/Mon, 27 Mar 2023 16:33:04 +0800SivanLaaihttps://www.laais.cn/posts/research/eplace/基本概念 布局的定义 布局问题可以描述为一个超图问题,可以定义为如下: $$G = (V,E,R)$$ 其中$V$表示元器件(顶点)集合,$E$表示网表(超边)集合,$R$nvim下混合编译调试Dreamplace源码https://www.laais.cn/posts/technology/nvim_debug_mixed_cpp_python/Wed, 05 Apr 2023 19:08:19 +0800SivanLaaihttps://www.laais.cn/posts/technology/nvim_debug_mixed_cpp_python/简介https://www.laais.cn/posts/learning/rl/rl_basic/Thu, 28 Sep 2023 10:36:03 +0800SivanLaaihttps://www.laais.cn/posts/learning/rl/rl_basic/概念 原先的动作是没有标签的,强化学习可以对每一个动作进行打分,然后学习,不断的迭代完成算法的学习。 按环境分类 Model-Free RL(不理解所处环境) 环境给到Q学习算法https://www.laais.cn/posts/learning/rl/q_learning/Thu, 28 Sep 2023 11:52:17 +0800SivanLaaihttps://www.laais.cn/posts/learning/rl/q_learning/状态$s_1,s_2$,动作$a_1,a_2$ 当前步的实现:$$Q(s_1,a_2)=r+\gamma \max_{a^}(Q(s^,a^))Q学习算法https://www.laais.cn/posts/learning/rl/q_learning/Thu, 28 Sep 2023 11:52:17 +0800SivanLaaihttps://www.laais.cn/posts/learning/rl/q_learning/状态$s_1,s_2$,动作$a_1,a_2$ 当前步的实现:$$Q(s_1,a_2)=r+\gamma \max_{a^}(Q(s^,a^))简介https://www.laais.cn/posts/learning/rl/rl_basic/Thu, 28 Sep 2023 10:36:03 +0800SivanLaaihttps://www.laais.cn/posts/learning/rl/rl_basic/概念 原先的动作是没有标签的,强化学习可以对每一个动作进行打分,然后学习,不断的迭代完成算法的学习。 按环境分类 Model-Free RL(不理解所处环境) 环境给到nvim下混合编译调试Dreamplace源码https://www.laais.cn/posts/technology/nvim_debug_mixed_cpp_python/Wed, 05 Apr 2023 19:08:19 +0800SivanLaaihttps://www.laais.cn/posts/technology/nvim_debug_mixed_cpp_python/Ubuntu安装VNCServerhttps://www.laais.cn/posts/technology/vnc_server/Tue, 28 Mar 2023 13:48:48 +0800SivanLaaihttps://www.laais.cn/posts/technology/vnc_server/Step1 (安装GNOME桌面) 1 2 3 sudo apt-get update sudo apt-get install gnome-session-flashback sudo apt-get install ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal -y Step2 1 sudo apt-get -y install xfonts-100dpi xfonts-100dpi-transcoded xfonts-75dpi xfonts-75dpi-transcoded xfonts-base Step3 1 sudo apt install tigervnc-standalone-server Step4:配置密码 1 vncpasswd Step5:配置X基于电势的解析布局https://www.laais.cn/posts/research/eplace/Mon, 27 Mar 2023 16:33:04 +0800SivanLaaihttps://www.laais.cn/posts/research/eplace/基本概念 布局的定义 布局问题可以描述为一个超图问题,可以定义为如下: $$G = (V,E,R)$$ 其中$V$表示元器件(顶点)集合,$E$表示网表(超边)集合,$R$好物收藏https://www.laais.cn/posts/misc/collection/Sat, 10 Dec 2022 11:39:42 +0800SivanLaaihttps://www.laais.cn/posts/misc/collection/教程 Hugo博客官方教程 Markdown 官方教程 工具 图片上传 | PicX 图床神器 (xpoet.cn)Obsidian写hugo博客,github自动部署https://www.laais.cn/posts/technology/auto_deploy_with_obsidian/Fri, 09 Dec 2022 15:41:53 +0800SivanLaaihttps://www.laais.cn/posts/technology/auto_deploy_with_obsidian/本人原来使用的博客是vuepress + vdoing,后来在使用的过程中发现这个博客非常的笨重,没有多少的文章编译下来就需要一会时间。 以前使用nextcloud配置https://www.laais.cn/posts/technology/nextcloud/Thu, 28 Jul 2022 11:46:36 +0000SivanLaaihttps://www.laais.cn/posts/technology/nextcloud/nextcloud网盘相关问题 网盘配置 (1)配置环境 Linux + Apache2 + Mysql + Php(LAMP) Example installation on Ubuntu 20.04 LTS — Nextcloud latest Administration Manual latest documentation 配置Linux + Nginx + Mysql + Php(LNMP)环境 1wordpress安装和问题https://www.laais.cn/posts/technology/wordpress/Thu, 19 May 2022 13:40:49 +0000SivanLaaihttps://www.laais.cn/posts/technology/wordpress/wordpress permainlink 不生效 1.打开apache2默认配置文件 1 sudo vim /etc/apache2/sites-available/000-default.conf 2.修改内容为如下 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35软件编译和安装https://www.laais.cn/posts/technology/compile_and_install/Thu, 19 May 2022 13:40:49 +0000SivanLaaihttps://www.laais.cn/posts/technology/compile_and_install/软件编译和安装 qbittorrent编译安装 安装依赖 1 2 apt-get install build-essential pkg-config automake libtool git apt-get install libboost-dev libboost-system-dev libboost-chrono-dev libboost-random-dev libssl-dev libgeoip-dev 安装libtorrent 1 2 3 4 5 6 7 8 9 git clone https://github.com/arvidn/libtorrent.git #之前 \ No newline at end of file diff --git a/posts/learning/rl/q_learning/index.html b/posts/learning/rl/q_learning/index.html new file mode 100644 index 0000000..e823403 --- /dev/null +++ b/posts/learning/rl/q_learning/index.html @@ -0,0 +1,21 @@ +Q学习算法 - SivanLaai's Blog

Q学习算法

image.png

状态$s_1,s_2$,动作$a_1,a_2$ +当前步的实现:$$Q(s_1,a_2)=r+\gamma \max_{a^}(Q(s^,a^))$$,其中$r$表示的是采取动作$a_2$到达状态$s^$的奖励,所以当前步的现实是包含了对于下一步采取动作$a^$的奖励估计,也包含了到达当前状态的奖励$r$。 当前步的估计:$$Q(s_1,a_2)$$ 当前状态的估计和现实之前的误差为:$$r+\gamma \max_{a^}(Q(s^,a^))-Q(s_1,a_2)$$ +其中$\gamma$表示对未来奖励衰减参数,则更新对于$Q(s_1,a_2)$的估计:$$Q(s_1,a_2)=Q(s_1,a_2)+\alpha (r+\gamma \max_{a^}(Q(s^,a^`))-Q(s_1,a_2))$$ +其中$\alpha$表示误差学习参数

用$Q(S_1)$来简化表示从状态$S_1$出发的现实奖励,有以下推论:$$Q(S_1)=r_2+\gamma Q(S_2)=r_2+\gamma(r_3+\gamma Q(S_3))$$ +则有:$$Q(S_1)=r_2+\gamma r_3+\gamma^2 r_4+\gamma^3 r_5+\dots$$,则比较远的步骤能否学习和$\gamma$有关,$\gamma=1$则全部都能看到,为0则全部都看不到,正常情况在0到1之间。

0%
\ No newline at end of file diff --git a/posts/learning/rl/q_learning/index.md b/posts/learning/rl/q_learning/index.md new file mode 100644 index 0000000..c3d6437 --- /dev/null +++ b/posts/learning/rl/q_learning/index.md @@ -0,0 +1,19 @@ +# Q学习算法 + +![image.png](https://cdn.statically.io/gh/SivanLaai/image-store-rep@master/note/20230928170535.png) + +状态$s_1,s_2$,动作$a_1,a_2$ +当前步的实现:$$Q(s_1,a_2)=r+\gamma \max_{a^`}(Q(s^`,a^`))$$,其中$r$表示的是采取动作$a_2$到达状态$s^`$的奖励,所以当前步的现实是包含了对于下一步采取动作$a^`$的奖励估计,也包含了到达当前状态的奖励$r$。 +当前步的估计:$$Q(s_1,a_2)$$ +当前状态的估计和现实之前的误差为:$$r+\gamma \max_{a^`}(Q(s^`,a^`))-Q(s_1,a_2)$$ +其中$\gamma$表示对未来奖励衰减参数,则更新对于$Q(s_1,a_2)$的估计:$$Q(s_1,a_2)=Q(s_1,a_2)+\alpha (r+\gamma \max_{a^`}(Q(s^`,a^`))-Q(s_1,a_2))$$ +其中$\alpha$表示误差学习参数 + +用$Q(S_1)$来简化表示从状态$S_1$出发的现实奖励,有以下推论:$$Q(S_1)=r_2+\gamma Q(S_2)=r_2+\gamma(r_3+\gamma Q(S_3))$$ +则有:$$Q(S_1)=r_2+\gamma r_3+\gamma^2 r_4+\gamma^3 r_5+\dots$$,则比较远的步骤能否学习和$\gamma$有关,$\gamma=1$则全部都能看到,为0则全部都看不到,正常情况在0到1之间。 + +--- + +> 作者: [SivanLaai](https://www.laais.cn) +> URL: https://www.laais.cn/posts/learning/rl/q_learning/ + diff --git a/posts/learning/rl/rl_basic/index.html b/posts/learning/rl/rl_basic/index.html new file mode 100644 index 0000000..c9fb713 --- /dev/null +++ b/posts/learning/rl/rl_basic/index.html @@ -0,0 +1,20 @@ +简介 - SivanLaai's Blog

简介

概念

原先的动作是没有标签的,强化学习可以对每一个动作进行打分,然后学习,不断的迭代完成算法的学习。

按环境分类

Model-Free RL(不理解所处环境)

环境给到什么就是什么,不理解环境是什么,这里的model表示的是环境,做出的动作完全独立于当前环境,反馈也只有在做出动作后才知道。

  • Q Learning
  • Sarsa
  • Policy Gradients

Model-Based RL(理解所处环境)

模型会对真实世界进行建模,通过过往的经验先理解真实世界是怎么样的,然后建立模拟反馈,让模拟世界尽量接近于真实的世界,可以作出最好的动作。

按Policy和Value分类

基于概念分类(Policy-Based RL)

根据当前的动作计算出下一步所有可能的动作的概率,下一步的每个动作都有可能选中。(可以处理连续的情况,输出一个概率分布)

  • Q Learning

基于价值分类(Value-Based RL)

根据当前的动作计算出下一步所有可能的动作的值,选择价值最高的动作。(离散的,不能处理连续的情况)

  • Sarsa
  • Policy Gradients

基于概念和价值结合

  • Actor-Critic +Actor做出动作,Critic对动作进行打分

按回合/单步分类

回合更新(蒙特卡罗更新)

等所有的步骤完成以后才更新

  • Policy Gradients
  • Monte-Carlo Learning

单步更新(蒙特卡罗更新)

等当前循环中的每个单步完成以后都可以进行更新

  • 改进版Policy Gradients
  • Sarsa
  • Q Learning

按在线/离线分类

在线学习

只能是本人玩然后本人进行学习

  • Sarsa
  • Sarsa()

离线学习

可以学习别人怎么玩,看着别人怎么玩进行学习,边玩边学习,可以先记下来别人怎么玩,然后在过后在自己学习,学习和作动作可以分开执行

  • Q Learning
  • Deep Q Network
0%
\ No newline at end of file diff --git a/posts/learning/rl/rl_basic/index.md b/posts/learning/rl/rl_basic/index.md new file mode 100644 index 0000000..4ced6bb --- /dev/null +++ b/posts/learning/rl/rl_basic/index.md @@ -0,0 +1,55 @@ +# 简介 + +# 概念 +原先的动作是没有标签的,强化学习可以对每一个动作进行打分,然后学习,不断的迭代完成算法的学习。 +## 按环境分类 +### Model-Free RL(不理解所处环境) +环境给到什么就是什么,不理解环境是什么,这里的model表示的是环境,做出的动作完全独立于当前环境,反馈也只有在做出动作后才知道。 +- Q Learning +- Sarsa +- Policy Gradients +### Model-Based RL(理解所处环境) +模型会对真实世界进行建模,通过过往的经验先理解真实世界是怎么样的,然后建立模拟反馈,让模拟世界尽量接近于真实的世界,可以作出最好的动作。 + +## 按Policy和Value分类 + +### 基于概念分类(Policy-Based RL) +根据当前的动作计算出下一步所有可能的动作的概率,下一步的每个动作都有可能选中。(可以处理连续的情况,输出一个概率分布) +- Q Learning +### 基于价值分类(Value-Based RL) +根据当前的动作计算出下一步所有可能的动作的值,选择价值最高的动作。(离散的,不能处理连续的情况) +- Sarsa +- Policy Gradients +### 基于概念和价值结合 +- Actor-Critic +Actor做出动作,Critic对动作进行打分 + +## 按回合/单步分类 + +### 回合更新(蒙特卡罗更新) +等所有的步骤完成以后才更新 +- Policy Gradients +- Monte-Carlo Learning +### 单步更新(蒙特卡罗更新) +等当前循环中的每个单步完成以后都可以进行更新 +- 改进版Policy Gradients +- Sarsa +- Q Learning + +## 按在线/离线分类 +### 在线学习 +只能是本人玩然后本人进行学习 +- Sarsa +- Sarsa() +### 离线学习 +可以学习别人怎么玩,看着别人怎么玩进行学习,边玩边学习,可以先记下来别人怎么玩,然后在过后在自己学习,学习和作动作可以分开执行 +- Q Learning +- Deep Q Network + + + +--- + +> 作者: [SivanLaai](https://www.laais.cn) +> URL: https://www.laais.cn/posts/learning/rl/rl_basic/ + diff --git a/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/index.html b/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/index.html index df46f75..d44459b 100644 --- a/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/index.html +++ b/posts/learning/ucas_pu_2021_algorithm_assignment/conquer_divide/index.html @@ -96,22 +96,22 @@ if (start == end) { return nums[start]; } else if (start > end) { - return -1; + return -1; } - int mid = (start + end) / 2; + int mid = (start + end) / 2; int subStart = mid; int subSum = nums[mid]; - while (subStart > start && nums[subStart] - 1 == nums[subStart - 1]) { + while (subStart > start && nums[subStart] - 1 == nums[subStart - 1]) { subStart--; subSum += nums[subStart]; } int subEnd = mid; - while (subEnd < end && nums[subEnd] + 1 == nums[subEnd + 1]) { + while (subEnd < end && nums[subEnd] + 1 == nums[subEnd + 1]) { subEnd++; subSum += nums[subEnd]; } - int subLSum = findLargestSubArraySum(nums, start, subStart - 1); - int subRSum = findLargestSubArraySum(nums, subEnd + 1, end); + int subLSum = findLargestSubArraySum(nums, start, subStart - 1); + int subRSum = findLargestSubArraySum(nums, subEnd + 1, end); return max(max(subSum, subLSum), subRSum); } }; diff --git a/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/index.html b/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/index.html index 4a94a23..537c95f 100644 --- a/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/index.html +++ b/posts/learning/ucas_pu_2021_algorithm_assignment/dynamic_programing/index.html @@ -82,11 +82,11 @@
class Solution {
 public:
     int getBSTSum(const int& n) {
-        vector<int> dp(n, 0);
-        dp[0] = dp[1] = 1;
-        for (int i=2; i <= n; ++i) {
-            for (int j=0; j < i; ++j) {
-                dp[i] += dp[j] * dp[i - j - 1];
+        vector<int> dp(n, 0);
+        dp[0] = dp[1] = 1;
+        for (int i=2; i <= n; ++i) {
+            for (int j=0; j < i; ++j) {
+                dp[i] += dp[j] * dp[i - j - 1];
             }
         }
     }
diff --git a/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/index.html b/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/index.html
index e720ebc..221f6b0 100644
--- a/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/index.html
+++ b/posts/learning/ucas_pu_2021_algorithm_assignment/greedy/index.html
@@ -82,11 +82,11 @@
 
class Solution {
 public:
     int getBSTSum(const int& n) {
-        vector<int> dp(n, 0);
-        dp[0] = dp[1] = 1;
-        for (int i=2; i <= n; ++i) {
-            for (int j=0; j < i; ++j) {
-                dp[i] += dp[j] * dp[i - j - 1];
+        vector<int> dp(n, 0);
+        dp[0] = dp[1] = 1;
+        for (int i=2; i <= n; ++i) {
+            for (int j=0; j < i; ++j) {
+                dp[i] += dp[j] * dp[i - j - 1];
             }
         }
     }
diff --git a/posts/page/2/index.html b/posts/page/2/index.html
index 550e321..0bcec5a 100644
--- a/posts/page/2/index.html
+++ b/posts/page/2/index.html
@@ -6,7 +6,9 @@
 
 
取消

所有📚 -32

总计约 44.50K 字

2021

2021

0001

+01-01
01-01
0%
\ No newline at end of file diff --git a/posts/projects/rime/info/index.html b/posts/projects/rime/info/index.html index 250a40c..0ca5320 100644 --- a/posts/projects/rime/info/index.html +++ b/posts/projects/rime/info/index.html @@ -1,4 +1,4 @@ -Rime输入法介绍 - SivanLaai's Blog