├── .gitignore ├── Makefile ├── README.md ├── README_current.json ├── book.json ├── book_current.json ├── node_modules └── src ├── README.md ├── SUMMARY.md ├── appendix ├── README.md └── reference.md ├── assets ├── favicon.ico └── img │ ├── auto_driving_skill_tree.png │ ├── computer_vision_skill_tree.png │ ├── emoji_cheat_sheet.png │ ├── font_awesome_cheat_sheet.png │ ├── go_cheat_sheet_1.jpg │ ├── go_cheat_sheet_2.jpg │ ├── go_cheat_sheet_3.jpg │ ├── go_cheat_sheet_4.jpg │ ├── go_cheat_sheet_5.jpg │ ├── go_cheat_sheet_6.jpg │ ├── html5_cheat_sheet.png │ ├── jacksontian_frontend_skill_map.png │ ├── kotlin_cheat_sheet.png │ ├── machine_learn_skill_tree.png │ ├── python_cheat_sheet.png │ ├── python_for_data_science_pandas_cheat_sheet.jpg │ ├── python_for_data_science_pandas_cheat_sheet.png │ ├── react_cheat_sheet.jpg │ ├── vi_cheat_sheet.png │ ├── xcode_shortcut_cheat_sheet.png │ └── zzhouz_frond_end_skill_map.png ├── computer_program ├── README.md ├── cmd_shell_terminal.md ├── compile_and_link.md ├── help_show_detail.md ├── i18n_l10n.md ├── knowledge_skill_map.md ├── long_term_support.md └── next_generation.md ├── hardware_embedded └── README.md ├── upper_software ├── README.md ├── awesome_xxx.md ├── cheat_sheet_handout.md ├── config_file_xxxfile.md ├── database │ ├── README.md │ └── schema.md ├── debounce.md └── package_manage_tool.md └── various_language ├── README.md ├── async_wait.md ├── getter_setter.md ├── logging.md ├── print.md └── python ├── README.md └── adapter.md /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | output/ 3 | debug/ 4 | 5 | *.zip 6 | 7 | .DS_Store 8 | 9 | !src/**/output -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | include ../../common/honkit_makefile.mk -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 计算机编程通用逻辑知识概念 2 | 3 | * 最新版本:`v3.2.2` 4 | * 更新时间:`20250605` 5 | 6 | ## 简介 7 | 8 | 计算机和编程等领域内存在很多跨语言,跨领域的通用知识,现整理出来,供参考。 9 | 10 | ## 源码+浏览+下载 11 | 12 | 本书的各种源码、在线浏览地址、多种格式文件下载如下: 13 | 14 | ### HonKit源码 15 | 16 | * [crifan/program_common_logic: 计算机编程通用逻辑知识概念](https://github.com/crifan/program_common_logic) 17 | 18 | #### 如何使用此HonKit源码去生成发布为电子书 19 | 20 | 详见:[crifan/honkit_template: demo how to use crifan honkit template and demo](https://github.com/crifan/honkit_template) 21 | 22 | ### 在线浏览 23 | 24 | * [计算机编程通用逻辑知识概念 book.crifan.org](https://book.crifan.org/books/program_common_logic/website/) 25 | * [计算机编程通用逻辑知识概念 crifan.github.io](https://crifan.github.io/program_common_logic/website/) 26 | 27 | ### 离线下载阅读 28 | 29 | * [计算机编程通用逻辑知识概念 PDF](https://book.crifan.org/books/program_common_logic/pdf/program_common_logic.pdf) 30 | * [计算机编程通用逻辑知识概念 ePub](https://book.crifan.org/books/program_common_logic/epub/program_common_logic.epub) 31 | * [计算机编程通用逻辑知识概念 Mobi](https://book.crifan.org/books/program_common_logic/mobi/program_common_logic.mobi) 32 | 33 | ## 版权和用途说明 34 | 35 | 此电子书教程的全部内容,如无特别说明,均为本人原创。其中部分内容参考自网络,均已备注了出处。如发现有侵权,请通过邮箱联系我 `admin 艾特 crifan.com`,我会尽快删除。谢谢合作。 36 | 37 | 各种技术类教程,仅作为学习和研究使用。请勿用于任何非法用途。如有非法用途,均与本人无关。 38 | 39 | ## 鸣谢 40 | 41 | 感谢我的老婆**陈雪**的包容理解和悉心照料,才使得我`crifan`有更多精力去专注技术专研和整理归纳出这些电子书和技术教程,特此鸣谢。 42 | 43 | ## 其他 44 | 45 | ### 作者的其他电子书 46 | 47 | 本人`crifan`还写了其他`150+`本电子书教程,感兴趣可移步至: 48 | 49 | [crifan/crifan_ebook_readme: Crifan的电子书的使用说明](https://github.com/crifan/crifan_ebook_readme) 50 | 51 | ### 关于作者 52 | 53 | 关于作者更多介绍,详见: 54 | 55 | [关于CrifanLi李茂 – 在路上](https://www.crifan.org/about/) 56 | -------------------------------------------------------------------------------- /README_current.json: -------------------------------------------------------------------------------- 1 | { 2 | "latestVersion": "v3.2.2", 3 | "lastUpdate": "20250605", 4 | "gitRepoName": "program_common_logic", 5 | "bookName": "计算机编程通用逻辑知识概念", 6 | "bookDescription": "计算机和编程等领域内存在很多跨语言,跨领域的通用知识,现整理出来,供参考。" 7 | } -------------------------------------------------------------------------------- /book.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "计算机编程通用逻辑知识概念", 3 | "description": "计算机和编程等领域内存在很多跨语言,跨领域的通用知识,现整理出来,供参考。", 4 | "pluginsConfig": { 5 | "github-buttons": { 6 | "buttons": [ 7 | { 8 | "repo": "program_common_logic", 9 | "user": "crifan", 10 | "type": "star", 11 | "count": true, 12 | "size": "small" 13 | }, 14 | { 15 | "user": "crifan", 16 | "type": "follow", 17 | "width": "120", 18 | "count": false, 19 | "size": "small" 20 | } 21 | ] 22 | }, 23 | "sitemap-general": { 24 | "prefix": "https://book.crifan.org/books/program_common_logic/website/" 25 | }, 26 | "toolbar-button": { 27 | "url": "https://book.crifan.org/books/program_common_logic/pdf/program_common_logic.pdf", 28 | "icon": "fa-file-pdf-o", 29 | "label": "下载PDF" 30 | }, 31 | "theme-default": { 32 | "showLevel": true 33 | }, 34 | "disqus": { 35 | "shortName": "crifan" 36 | }, 37 | "prism": { 38 | "css": [ 39 | "prism-themes/themes/prism-atom-dark.css" 40 | ] 41 | }, 42 | "sharing": { 43 | "douban": false, 44 | "facebook": true, 45 | "google": false, 46 | "hatenaBookmark": false, 47 | "instapaper": false, 48 | "line": false, 49 | "linkedin": false, 50 | "messenger": false, 51 | "pocket": false, 52 | "qq": true, 53 | "qzone": false, 54 | "stumbleupon": false, 55 | "twitter": true, 56 | "viber": false, 57 | "vk": false, 58 | "weibo": true, 59 | "whatsapp": false, 60 | "all": [ 61 | "douban", 62 | "facebook", 63 | "google", 64 | "instapaper", 65 | "line", 66 | "linkedin", 67 | "messenger", 68 | "pocket", 69 | "qq", 70 | "qzone", 71 | "stumbleupon", 72 | "twitter", 73 | "viber", 74 | "vk", 75 | "weibo", 76 | "whatsapp" 77 | ] 78 | }, 79 | "tbfed-pagefooter": { 80 | "copyright": "crifan.org,使用署名4.0国际(CC BY 4.0)协议发布", 81 | "modify_label": "最后更新:", 82 | "modify_format": "YYYY-MM-DD HH:mm:ss" 83 | }, 84 | "donate": { 85 | "wechat": "https://www.crifan.org/files/res/crifan_com/crifan_wechat_pay.jpg", 86 | "alipay": "https://www.crifan.org/files/res/crifan_com/crifan_alipay_pay.jpg", 87 | "title": "", 88 | "button": "打赏", 89 | "alipayText": "支付宝打赏给Crifan", 90 | "wechatText": "微信打赏给Crifan" 91 | } 92 | }, 93 | "author": "Crifan Li ", 94 | "language": "zh-hans", 95 | "root": "./src", 96 | "links": { 97 | "sidebar": { 98 | "主页": "http://www.crifan.org" 99 | } 100 | }, 101 | "plugins": [ 102 | "theme-comscore", 103 | "anchors", 104 | "expandable-menu", 105 | "-lunr", 106 | "-search", 107 | "search-plus", 108 | "disqus", 109 | "-highlight", 110 | "prism", 111 | "prism-themes", 112 | "github-buttons", 113 | "-splitter", 114 | "splitter-nosessionbutcookie", 115 | "-sharing", 116 | "sharing-plus", 117 | "tbfed-pagefooter", 118 | "donate", 119 | "sitemap-general", 120 | "copy-code-button", 121 | "blockquote-callout", 122 | "toolbar-button" 123 | ] 124 | } -------------------------------------------------------------------------------- /book_current.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "计算机编程通用逻辑知识概念", 3 | "description": "计算机和编程等领域内存在很多跨语言,跨领域的通用知识,现整理出来,供参考。", 4 | "pluginsConfig": { 5 | "github-buttons": { 6 | "buttons": [ 7 | { 8 | "repo": "program_common_logic" 9 | } 10 | ] 11 | }, 12 | "sitemap-general": { 13 | "prefix": "https://book.crifan.org/books/program_common_logic/website/" 14 | }, 15 | "toolbar-button": { 16 | "url": "https://book.crifan.org/books/program_common_logic/pdf/program_common_logic.pdf" 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /node_modules: -------------------------------------------------------------------------------- 1 | ../../generated/honkit/node_modules -------------------------------------------------------------------------------- /src/README.md: -------------------------------------------------------------------------------- 1 | # 计算机编程通用逻辑知识概念 2 | 3 | * 最新版本:`v3.2.2` 4 | * 更新时间:`20250605` 5 | 6 | ## 简介 7 | 8 | 计算机和编程等领域内存在很多跨语言,跨领域的通用知识,现整理出来,供参考。 9 | 10 | ## 源码+浏览+下载 11 | 12 | 本书的各种源码、在线浏览地址、多种格式文件下载如下: 13 | 14 | ### HonKit源码 15 | 16 | * [crifan/program_common_logic: 计算机编程通用逻辑知识概念](https://github.com/crifan/program_common_logic) 17 | 18 | #### 如何使用此HonKit源码去生成发布为电子书 19 | 20 | 详见:[crifan/honkit_template: demo how to use crifan honkit template and demo](https://github.com/crifan/honkit_template) 21 | 22 | ### 在线浏览 23 | 24 | * [计算机编程通用逻辑知识概念 book.crifan.org](https://book.crifan.org/books/program_common_logic/website/) 25 | * [计算机编程通用逻辑知识概念 crifan.github.io](https://crifan.github.io/program_common_logic/website/) 26 | 27 | ### 离线下载阅读 28 | 29 | * [计算机编程通用逻辑知识概念 PDF](https://book.crifan.org/books/program_common_logic/pdf/program_common_logic.pdf) 30 | * [计算机编程通用逻辑知识概念 ePub](https://book.crifan.org/books/program_common_logic/epub/program_common_logic.epub) 31 | * [计算机编程通用逻辑知识概念 Mobi](https://book.crifan.org/books/program_common_logic/mobi/program_common_logic.mobi) 32 | 33 | ## 版权和用途说明 34 | 35 | 此电子书教程的全部内容,如无特别说明,均为本人原创。其中部分内容参考自网络,均已备注了出处。如发现有侵权,请通过邮箱联系我 `admin 艾特 crifan.com`,我会尽快删除。谢谢合作。 36 | 37 | 各种技术类教程,仅作为学习和研究使用。请勿用于任何非法用途。如有非法用途,均与本人无关。 38 | 39 | ## 鸣谢 40 | 41 | 感谢我的老婆**陈雪**的包容理解和悉心照料,才使得我`crifan`有更多精力去专注技术专研和整理归纳出这些电子书和技术教程,特此鸣谢。 42 | 43 | ## 其他 44 | 45 | ### 作者的其他电子书 46 | 47 | 本人`crifan`还写了其他`150+`本电子书教程,感兴趣可移步至: 48 | 49 | [crifan/crifan_ebook_readme: Crifan的电子书的使用说明](https://github.com/crifan/crifan_ebook_readme) 50 | 51 | ### 关于作者 52 | 53 | 关于作者更多介绍,详见: 54 | 55 | [关于CrifanLi李茂 – 在路上](https://www.crifan.org/about/) 56 | -------------------------------------------------------------------------------- /src/SUMMARY.md: -------------------------------------------------------------------------------- 1 | # 计算机编程通用逻辑知识概念 2 | 3 | * [前言](README.md) 4 | * [计算机编程领域](computer_program/README.md) 5 | * [长期支持版本](computer_program/long_term_support.md) 6 | * [命令行终端](computer_program/cmd_shell_terminal.md) 7 | * [Help查看帮助信息](computer_program/help_show_detail.md) 8 | * [Next Generation](computer_program/next_generation.md) 9 | * [i18n和l10n](computer_program/i18n_l10n.md) 10 | * [知识技能图谱](computer_program/knowledge_skill_map.md) 11 | * [编译和链接](computer_program/compile_and_link.md) 12 | * [硬件和嵌入式领域](hardware_embedded/README.md) 13 | * [上层软件领域](upper_software/README.md) 14 | * [debounce防抖动](upper_software/debounce.md) 15 | * [库/包的依赖管理工具](upper_software/package_manage_tool.md) 16 | * [配置文件名为xxxfile](upper_software/config_file_xxxfile.md) 17 | * [Cheat Sheet和Handout](upper_software/cheat_sheet_handout.md) 18 | * [awesome xxx](upper_software/awesome_xxx.md) 19 | * [上层软件 - 数据库](upper_software/database/README.md) 20 | * [schema模式](upper_software/database/schema.md) 21 | * [各种编程语言领域](various_language/README.md) 22 | * [print打印](various_language/print.md) 23 | * [log日志](various_language/logging.md) 24 | * [async和wait](various_language/async_wait.md) 25 | * [getter和setter](various_language/getter_setter.md) 26 | * [编程语言 - Python](various_language/python/README.md) 27 | * [adapter适配器](various_language/python/adapter.md) 28 | * [附录](appendix/README.md) 29 | * [参考资料](appendix/reference.md) 30 | -------------------------------------------------------------------------------- /src/appendix/README.md: -------------------------------------------------------------------------------- 1 | # 附录 2 | 下面列出相关参考资料。 3 | 4 | -------------------------------------------------------------------------------- /src/appendix/reference.md: -------------------------------------------------------------------------------- 1 | # 参考资料 2 | 3 | * [学习 shell 有什么好书推荐? - 知乎](https://www.zhihu.com/question/19745611) 4 | * [Cheat sheet - Wikipedia, the free encyclopedia](https://en.wikipedia.org/wiki/Cheat_sheet) 5 | * [销售易的CRM PaaS平台开发手册](https://crm.xiaoshouyi.com/doc/document/docs/productDoc/v1710/developerGuide/H5/developerGuide/index.html#t=developerGuide%2FbusinessLogic%2FbusinessLogic.htm) 6 | * [log4go - GoDoc](https://godoc.org/github.com/alecthomas/log4go#Level) 7 | * [Python - PostgreSQL wiki](https://wiki.postgresql.org/wiki/Python) 8 | * [MongoDB Drivers — MongoDB Ecosystem](https://docs.mongodb.com/ecosystem/drivers/) 9 | * [最好用的前端开发工具之构建篇:Gulp_HTML5|CSS3_UDN技术社区](http://udn.yyuap.com/forum.php?mod=viewthread&tid=112791) 10 | * [StuQ - 一个新的学习方式,提升你的IT职业技能](http://www.stuq.org) 11 | * [[已解决]Flask中输出log日志到文件且自定义输出格式](http://www.crifan.com/flask_output_log_to_file_and_designate_format) 12 | * [python 日志模块 logging 详解 - leejun2005的个人页面](https://my.oschina.net/leejun2005/blog/126713) 13 | * [开发者AI职业指南:CSDN《AI技术人才成长路线图V1.0》重磅发布](https://mp.weixin.qq.com/s?__biz=MzI0ODcxODk5OA==&mid=2247492580&idx=2&sn=9b8439cc41c09d01a75d2efe716a44a5&chksm=e99ed01ddee9590b77453f84449ca61afce465724c53e9149e4d8ca1f98c47567a96874b8219&mpshare=1&scene=1&srcid=0117GgasNlh0xyCzkj9SBlvF#rd) 14 | -------------------------------------------------------------------------------- /src/assets/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crifan/program_common_logic/735bbf03683eab6134e69fd94b578224eeddbc46/src/assets/favicon.ico -------------------------------------------------------------------------------- /src/assets/img/auto_driving_skill_tree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crifan/program_common_logic/735bbf03683eab6134e69fd94b578224eeddbc46/src/assets/img/auto_driving_skill_tree.png -------------------------------------------------------------------------------- /src/assets/img/computer_vision_skill_tree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crifan/program_common_logic/735bbf03683eab6134e69fd94b578224eeddbc46/src/assets/img/computer_vision_skill_tree.png -------------------------------------------------------------------------------- /src/assets/img/emoji_cheat_sheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crifan/program_common_logic/735bbf03683eab6134e69fd94b578224eeddbc46/src/assets/img/emoji_cheat_sheet.png -------------------------------------------------------------------------------- /src/assets/img/font_awesome_cheat_sheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crifan/program_common_logic/735bbf03683eab6134e69fd94b578224eeddbc46/src/assets/img/font_awesome_cheat_sheet.png -------------------------------------------------------------------------------- /src/assets/img/go_cheat_sheet_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crifan/program_common_logic/735bbf03683eab6134e69fd94b578224eeddbc46/src/assets/img/go_cheat_sheet_1.jpg -------------------------------------------------------------------------------- /src/assets/img/go_cheat_sheet_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crifan/program_common_logic/735bbf03683eab6134e69fd94b578224eeddbc46/src/assets/img/go_cheat_sheet_2.jpg -------------------------------------------------------------------------------- /src/assets/img/go_cheat_sheet_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crifan/program_common_logic/735bbf03683eab6134e69fd94b578224eeddbc46/src/assets/img/go_cheat_sheet_3.jpg -------------------------------------------------------------------------------- /src/assets/img/go_cheat_sheet_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crifan/program_common_logic/735bbf03683eab6134e69fd94b578224eeddbc46/src/assets/img/go_cheat_sheet_4.jpg -------------------------------------------------------------------------------- /src/assets/img/go_cheat_sheet_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crifan/program_common_logic/735bbf03683eab6134e69fd94b578224eeddbc46/src/assets/img/go_cheat_sheet_5.jpg -------------------------------------------------------------------------------- /src/assets/img/go_cheat_sheet_6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crifan/program_common_logic/735bbf03683eab6134e69fd94b578224eeddbc46/src/assets/img/go_cheat_sheet_6.jpg -------------------------------------------------------------------------------- /src/assets/img/html5_cheat_sheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crifan/program_common_logic/735bbf03683eab6134e69fd94b578224eeddbc46/src/assets/img/html5_cheat_sheet.png -------------------------------------------------------------------------------- /src/assets/img/jacksontian_frontend_skill_map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crifan/program_common_logic/735bbf03683eab6134e69fd94b578224eeddbc46/src/assets/img/jacksontian_frontend_skill_map.png -------------------------------------------------------------------------------- /src/assets/img/kotlin_cheat_sheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crifan/program_common_logic/735bbf03683eab6134e69fd94b578224eeddbc46/src/assets/img/kotlin_cheat_sheet.png -------------------------------------------------------------------------------- /src/assets/img/machine_learn_skill_tree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crifan/program_common_logic/735bbf03683eab6134e69fd94b578224eeddbc46/src/assets/img/machine_learn_skill_tree.png -------------------------------------------------------------------------------- /src/assets/img/python_cheat_sheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crifan/program_common_logic/735bbf03683eab6134e69fd94b578224eeddbc46/src/assets/img/python_cheat_sheet.png -------------------------------------------------------------------------------- /src/assets/img/python_for_data_science_pandas_cheat_sheet.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crifan/program_common_logic/735bbf03683eab6134e69fd94b578224eeddbc46/src/assets/img/python_for_data_science_pandas_cheat_sheet.jpg -------------------------------------------------------------------------------- /src/assets/img/python_for_data_science_pandas_cheat_sheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crifan/program_common_logic/735bbf03683eab6134e69fd94b578224eeddbc46/src/assets/img/python_for_data_science_pandas_cheat_sheet.png -------------------------------------------------------------------------------- /src/assets/img/react_cheat_sheet.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crifan/program_common_logic/735bbf03683eab6134e69fd94b578224eeddbc46/src/assets/img/react_cheat_sheet.jpg -------------------------------------------------------------------------------- /src/assets/img/vi_cheat_sheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crifan/program_common_logic/735bbf03683eab6134e69fd94b578224eeddbc46/src/assets/img/vi_cheat_sheet.png -------------------------------------------------------------------------------- /src/assets/img/xcode_shortcut_cheat_sheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crifan/program_common_logic/735bbf03683eab6134e69fd94b578224eeddbc46/src/assets/img/xcode_shortcut_cheat_sheet.png -------------------------------------------------------------------------------- /src/assets/img/zzhouz_frond_end_skill_map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crifan/program_common_logic/735bbf03683eab6134e69fd94b578224eeddbc46/src/assets/img/zzhouz_frond_end_skill_map.png -------------------------------------------------------------------------------- /src/computer_program/README.md: -------------------------------------------------------------------------------- 1 | # 计算机编程领域 2 | 3 | 此处介绍计算机编程领域内的一些通用知识、逻辑和概念。 -------------------------------------------------------------------------------- /src/computer_program/cmd_shell_terminal.md: -------------------------------------------------------------------------------- 1 | # 命令行终端 2 | 3 | 计算机领域内,常常会提及到**终端**,也叫做`命令行`,往往指的是: 4 | * `Windows中的cmd` 5 | * `Linux中的shell` 6 | * `Mac中的terminal` 7 | 8 | 然后还有很多第三方的扩展、工具或插件,用于增强或替换系统自带的终端,比如: 9 | * `Windows`的`Power Shell` 10 | * `Linux`/`Mac`的`zsh` 11 | * `Mac`的`iTerm` 12 | 13 | ## 终端能用来做什么 14 | 15 | 答 运行各种脚本和命令,完成各种任务 16 | 17 | 而对于linux的`shell`来说,功能强大到都算作一门单独的语言: `shell脚本语言` 18 | 19 | 可以利用不同的语法和函数,编写复杂逻辑的代码,实现特定的功能 20 | 21 | 比如小功能: 22 | 23 | 自己的批量重命名的shell脚本 24 | 25 | TODO: 把脚本找到 贴出来 26 | 27 | 比如,其他人用shell去给OpenWrt的极路由去写应用: 28 | 29 | [开发极路由云插件 - OpenWrt.io](https://openwrt.io/docs/create-gee-app/) 30 | 31 | 比如: 32 | 33 | 在linux mac win 下运行我的python脚本BlogsToWordpress 34 | 35 | 用vi在无图形界面的centos中编辑文本文件 36 | 37 | ## 各种终端的用法 心得 38 | 39 | 下面来介绍各种不同的终端的各种用法和心得。 40 | 41 | ### `Windows`中的终端 42 | 43 | #### `Windows`自带的`cmd` 44 | 45 | TODO: 把之前那个cmd心得的帖子整理过来 46 | 47 | #### `Windows`中的`Hyper Terminal` 48 | 嵌入式中都有和终端有关的工具使用 49 | 50 | 嵌入式开发期间,会遇到把开发版中运行程序的输出打印显示出来,以及输入和命令执行,也需要用到终端。 51 | 52 | 有时候Windows自带的terminal也够用,但是Win7中有个更好用一点的:Hyper Terminal 53 | 54 | 详见:[【整理】如何在Win7中安装使用超级终端Hyper Terminal – 在路上](https://www.crifan.com/order_how_to_install_in_win7_using_hyperterminal_hyper_terminal/) 55 | 56 | 57 | ### `Mac`的中的终端 58 | 59 | #### `Mac`中自带的`terminal` 60 | 61 | #### `Mac`中的`iTerm2` 62 | TODO: 整理mac的iterm2的好用之处 63 | 64 | ### `Linux`的`shell` 65 | 66 | linux shell编程 67 | 68 | #### shell入门 69 | 1. 快速有个了解和概念: 70 | * [Shell脚本编程30分钟入门](https://github.com/qinjx/30min_guides/blob/master/shell.md) 71 | 2. 完整和深入的学习 72 | * [Shell 教程 | 菜鸟教程](http://www.runoob.com/linux/linux-shell.html) 73 | * [Linux Shell脚本教程:30分钟玩转Shell脚本编程_Shell中文网](http://c.biancheng.net/cpp/shell/) 74 | 3. 其它还可以的资料 75 | * [LINUX与UNIX Shell编程指南](http://download.csdn.net/detail/senjixu/7219573) 76 | * [Shell编程基础 - Ubuntu中文](https://wiki.ubuntu.org.cn/Shell编程基础) 77 | * [详细介绍Linux shell脚本基础学习(一) - 雪洁 - 博客园](http://www.cnblogs.com/xuejie/archive/2013/01/31/2886552.html) 78 | 4. 英文不错的话,直接看英文 79 | * 比较系统的英文教程 80 | * [Advanced Bash-Scripting Guide](http://tldp.org/LDP/abs/html/) 81 | * [BashGuide - Greg's Wiki](http://mywiki.wooledge.org/BashGuide/) 82 | * 其它更加全面的,更加系统的书籍 83 | * [《UNIX Shells by Example Fourth Edition》]() 84 | * chm版本下载:[Prentice.Hall-Unix.Shells.By.Example,4th.Edition.chm_微盘下载](http://vdisk.weibo.com/s/D6fFxgI4Qswx) 85 | * [Linux Command Line and Shell Scripting Bible第三版](http://docs.linuxtone.org/ebooks/Shell/Wiley.Linux.Command.Line.and.Shell.Scripting.Bible.May.2008.pdf) 86 | 5. 对于Shell有了基本的了解和实践之后,再去看 87 | * [Shell脚本编程的常识](http://mprc.pku.edu.cn/mentors/training/TrainingCourses/material/ShellProgramming.HTM) 88 | * 这些往往是经常用到,但是各种网络上的材料都语焉不详的东西,个人认为比较有用) 89 | 90 | ### 支持多平台的`SecureCRT` 91 | 92 | 当然,远程操作(CentOS等)Linux类系统,也是通过终端类等工具去操作的 93 | 94 | 比如常用的SecureCRT 95 | 96 | TODO:把 97 | [【crifan推荐】支持多种协议的串口开发工具:SecureCRT](https://www.crifan.com/files/doc/docbook/rec_soft_securecrt/release/html/rec_soft_securecrt.html) 98 | 99 | [【crifan推荐】极佳的串口开发工具:SecureCRT – 在路上](https://www.crifan.com/crifan_recommand_development_serial_tool_securecrt/) 100 | 101 | 整理过来。 102 | 103 | ### 其他环境中的终端 104 | 105 | #### IDE工具中集成的终端 106 | 其他第三方工具,尤其是IDE,为了方便开发同时集成了终端 107 | 108 | 比如 VSCode PyCharm 109 | 110 | 详见 TODO: ide总结的帖子 111 | 112 | #### `Android`的app去模拟终端 113 | 114 | [【已解决】android中的shell命令行工具 – 在路上](https://www.crifan.com/find_android_shell_like_terminal_tool/) 115 | 116 | 以便于我们在手机中通过终端去操作系统的资源,实现各种复杂的功能 117 | 118 | -------------------------------------------------------------------------------- /src/computer_program/compile_and_link.md: -------------------------------------------------------------------------------- 1 | # 编译和链接 2 | 3 | 此处介绍编译和链接方面的通用的知识、概念和逻辑。 4 | 5 | 之前接触过嵌入式和Linux,断断续续接触过很多编译和链接的东西,主要是命令行界面中用`makefile`、`gcc`等各种工具去做编译和链接的工作。 6 | 7 | 后来又接触过移动端开发,包括`Xcode`等IDE集成开发环境 8 | 9 | > [!TIP|title:编辑器和IDE] 10 | > 11 | > 详见: 12 | > [编辑器和IDE总结](https://book.crifan.org/books/editor_ide_summary/website/) 13 | 14 | 发现其实IDE背后都是利用了编译和链接方面的通用知识。 15 | 16 | 对此编译和链接方面的通用的知识、逻辑、概念,去尝试总结,以供参考。 17 | 18 | ## Xcode中底层是用swiftc去编译swift代码 19 | 20 | 之前在: 21 | 22 | [已解决]Xcode项目编译出错:Command failed due to signal: Segmentation fault: 11 23 | 24 | 期间,通过错误的log中的: 25 | 26 | ```bash 27 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -incremental -module-name XxxApp -Onone -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.3.sdk -target i386-apple-ios9.0 -g -module-cache-path /Users/crifan/Library/Developer/Xcode/DerivedData/ModuleCache -Xfrontend -serialize-debugging-options -enable-testing -I /Users/crifan/Library/Developer/Xcode/DerivedData/XxxApp-fxzzwvtqreanqsgzqmztnatyyjjd/Build/Products/Debug-iphonesimulator -F /Users/crifan/Library/Developer/Xcode/DerivedData/XxxApp-fxzzwvtqreanqsgzqmztnatyyjjd/Build/Products/Debug-iphonesimulator -F /Users/crifan/dev/dev_root/daryun/Projects/Xxx/Zzz/Sourcecode/XxxAppiOS/Carthage/Build/iOS -c -j4 /Users/crifan/dev/dev_root/daryun/Projects/Xxx/Zzz/Sourcecode/XxxAppiOS/XxxApp/CrifanLibHttp.swift 28 | ... 29 | /Users/crifan/dev/dev_root/daryun/Projects/Xxx/Zzz/Sourcecode/XxxAppiOS/XxxApp/CrifanLibDemo.swift /Users/crifan/dev/dev_root/daryun/Projects/Xxx/Zzz/Sourcecode/XxxAppiOS/XxxApp/AddTaskViewController.swift -output-file-map /Users/crifan/Library/Developer/Xcode/DerivedData/XxxApp-fxzzwvtqreanqsgzqmztnatyyjjd/Build/Intermediates/XxxApp.build/Debug-iphonesimulator/XxxApp.build/Objects-normal/i386/XxxApp-OutputFileMap.json -parseable-output -serialize-diagnostics -emit-dependencies -emit-module -emit-module-path /Users/crifan/Library/Developer/Xcode/DerivedData/XxxApp-fxzzwvtqreanqsgzqmztnatyyjjd/Build/Intermediates/XxxApp.build/Debug-iphonesimulator/XxxApp.build/Objects-normal/i386/XxxApp.swiftmodule -Xcc -I/Users/crifan/Library/Developer/Xcode/DerivedData/XxxApp-fxzzwvtqreanqsgzqmztnatyyjjd/Build/Intermediates/XxxApp.build/Debug-iphonesimulator/XxxApp.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/crifan/Library/Developer/Xcode/DerivedData/XxxApp-fxzzwvtqreanqsgzqmztnatyyjjd/Build/Intermediates/XxxApp.build/Debug-iphonesimulator/XxxApp.build/XxxApp-generated-files.hmap -Xcc -I/Users/crifan/Library/Developer/Xcode/DerivedData/XxxApp-fxzzwvtqreanqsgzqmztnatyyjjd/Build/Intermediates/XxxApp.build/Debug-iphonesimulator/XxxApp.build/XxxApp-own-target-headers.hmap 30 | ... 31 | -Xcc -I/Users/crifan/Library/Developer/Xcode/DerivedData/XxxApp-fxzzwvtqreanqsgzqmztnatyyjjd/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/crifan/Library/Developer/Xcode/DerivedData/XxxApp-fxzzwvtqreanqsgzqmztnatyyjjd/Build/Intermediates/XxxApp.build/Debug-iphonesimulator/XxxApp.build/DerivedSources/i386 -Xcc -I/Users/crifan/Library/Developer/Xcode/DerivedData/XxxApp-fxzzwvtqreanqsgzqmztnatyyjjd/Build/Intermediates/XxxApp.build/Debug-iphonesimulator/XxxApp.build/DerivedSources -Xcc -DDEBUG=1 -emit-objc-header -emit-objc-header-path /Users/crifan/Library/Developer/Xcode/DerivedData/XxxApp-fxzzwvtqreanqsgzqmztnatyyjjd/Build/Intermediates/XxxApp.build/Debug-iphonesimulator/XxxApp.build/Objects-normal/i386/XxxApp-Swift.h -import-objc-header /Users/crifan/dev/dev_root/daryun/Projects/Xxx/Zzz/Sourcecode/XxxAppiOS/XxxApp/XxxApp-Bridging-Header.h -Xcc -working-directory/Users/crifan/dev/dev_root/daryun/Projects/Xxx/Zzz/Sourcecode/XxxAppiOS 32 | ``` 33 | 34 | 而知道: 35 | 36 | 用的swiftc这个编译器,传递的参数是: 37 | 38 | * 要编译的是:各个swift文件 39 | * 输出是:XxxApp 40 | * 期间利用到的各种: 41 | * SDK库是:`-sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.3.sdk` 42 | * include的头文件的路径是:`-I xxx` 43 | 44 | 等等 45 | 46 | 即: 47 | 48 | 对于Xcode这个IDE,你点击了编译按钮后,内部的实际过程是: 49 | 50 | 调用swiftc这个编辑器去swift代码,期间涉及到 51 | 52 | * 引用哪些库 53 | * 设置哪些编译参数 54 | * 引用include哪些头文件: xxx.h 55 | * 包含哪些路径 56 | * 去哪些路径中寻找头文件:-I xxx 57 | * 去哪些路径中寻找所要包含的库文件:-L xxx 58 | * 设置哪些环境变量 59 | * 供后续过程去调用 60 | 61 | -> 而这些都是编译和链接方面的通用知识。 62 | 63 | -> 而其他的IDE的功能的内部过程大同小异,只不过用了不同的编译器,链接参数不同而已。 64 | 65 | -> 而编译链接方面的知识,越是接近于底层开发,越是接触的多,理解的深入,比如嵌入式开发,Linux开发等等 66 | 67 | -> 而对于编译和链接这方面的知识,如果之前折腾过嵌入式,Linux开发等方面的内容,则更能深切的体会到各种编译器、等内容。 68 | 69 | ## Xcode中通过设置头文件搜索路径而解决了头文件引用找不到的问题 70 | 71 | 比如: 72 | 73 | [【已解决】Xcode9代码出错:Realm/Realm.h file not found with angled include use quotes instead](http://www.crifan.com/xcode_9_ream_h_file_not_found_with_angled_include_use_quotes_instead) 74 | 75 | 期间,对于错误提示: 76 | 77 | ` file not found with angled include use quotes instead` 78 | 79 | 如果对于编译链接知识不了解的话,则很容易被误导,而去一个个的修改(对应的几十个)swift文件,把: 80 | 81 | `` 82 | 83 | 改为: 84 | 85 | `Realm/Realm.h` 86 | 87 | 但是却没能从根本上解决问题。实际上是,搜索头文件的路径却少了,需要去设置: 88 | 89 | `Headers Search Paths` 90 | 91 | 把Realm的头文件的路径,添加进去,即可真正彻底解决头文件找不到的问题。 92 | 93 | ## Xcode中如何引入已改名的和已改变链接方式的库 94 | 之前在: 95 | 96 | [【已解决】Xcode9.2编译出错:ld library not found for -lMobClickLibrary](http://www.crifan.com/xcode_9_link_fail_ld_library_not_found_for_i_mobclicklibrary) 97 | 98 | 就遇到: 99 | 100 | 一个第三方库:友盟统计 101 | 102 | * 之前是3.6.6的的静态库:libMobClickLibrary.a 103 | * 现在版本升级为4.0.1,且功能拆分为2个库文件了,且是动态库: 104 | * 统计功能的Analytics:UMMobClick.framework 105 | * 社交功能的Social 106 | 107 | 所以,搞清楚这点后,才知道去把Xcode中的: 108 | `Build Settings-》Linking-〉Other Linker Flags` 109 | 中的: 110 | `-l"MobClickLibrary"` 111 | 改为: 112 | `-framework "UMMobClick"` 113 | 表示: 114 | 引入新的`UMMobClick`的`framework`动态库,解决: 115 | `ld library not found for -lMobClickLibrary` 116 | 的问题。 117 | 118 | ## 苹果的swiftc编译器和`-j4`多线程编译 119 | 120 | 之前在: 121 | 122 | [已解决]Xcode项目编译出错:Command failed due to signal: Segmentation fault: 11 123 | 124 | 期间,看到错误的log中的: 125 | 126 | ```bash 127 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -incremental -module-name XxxApp -Onone -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.3.sdk -target i386-apple-ios9.0 -g -module-cache-path /Users/crifan/Library/Developer/Xcode/DerivedData/ModuleCache -Xfrontend -serialize-debugging-options -enable-testing -I /Users/crifan/Library/Developer/Xcode/DerivedData/XxxApp-fxzzwvtqreanqsgzqmztnatyyjjd/Build/Products/Debug-iphonesimulator -F /Users/crifan/Library/Developer/Xcode/DerivedData/XxxApp-fxzzwvtqreanqsgzqmztnatyyjjd/Build/Products/Debug-iphonesimulator -F /Users/crifan/dev/dev_root/daryun/Projects/Xxx/Zzz/Sourcecode/XxxAppiOS/Carthage/Build/iOS -c -j4 /Users/crifan/dev/dev_root/daryun/Projects/Xxx/Zzz/Sourcecode/XxxAppiOS/XxxApp/CrifanLibHttp.swift 128 | ``` 129 | 130 | 其中有`-j4`,猜测估计是类似于之前Linux中`makefile`中的`make`的`-j4`,估计是**4个线程**去并行执行的效果。 131 | 132 | 所以先去看看对应的编译器 133 | `/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc` 134 | 135 | 结果是: 136 | 137 | ```bash 138 | ➜ crifanLib git:(master) swiftc --version 139 | Apple Swift version 4.0.3 (swiftlang-900.0.74.1 clang-900.0.39.2) 140 | Target: x86_64-apple-macosx10.9 141 | ``` 142 | 143 | 果然是苹果的Swift语言的编译器。然后再去: 144 | 145 | ```bash 146 | ➜ crifanLib git:(master) which swiftc 147 | /usr/bin/swiftc 148 | ``` 149 | 150 | 可以看到,此处swiftc编译器是放在常见的`/usr/bin`目录下面的 151 | 152 | 再去通过: 153 | 154 | ```bash 155 | ➜ crifanLib git:(master) swiftc --help 156 | ... 157 | -I Add directory to the import search path 158 | -j Number of commands to execute in parallel 159 | -L Add directory to library link search path 160 | -l Specifies a library which should be linked against 161 | ... 162 | -Xcc Pass to the C/C++/Objective-C compiler 163 | -Xlinker Specifies an option which should be passed to the linker 164 | ``` 165 | 166 | 中的: 167 | ` -j Number of commands to execute in parallel` 168 | 169 | 可以看到: 170 | `-jN`表示用多少个命令并行执行 171 | 172 | -> 和Make中的-j是类似的效果。 173 | 174 | -> 另外,此处也说明了对于Xcode这个IDE,内部编译代码,链接库等操作,底层对应的逻辑,都是**编译链接**方面的知识,都是通用的。 175 | 176 | -> 只不过用了不同的编译器,链接参数而异。 177 | 178 | -> 而对于编译和链接这方面的知识,如果之前折腾过嵌入式,Linux开发等方面的内容,则更能深切的体会到各种编译器、库函数、参数、头文件、包含路径、环境变量等内容。 179 | 180 | 181 | 182 | -------------------------------------------------------------------------------- /src/computer_program/help_show_detail.md: -------------------------------------------------------------------------------- 1 | # Help查看帮助信息 2 | 3 | 用help查看帮助信息 4 | 5 | 用help获取主命令和子命令的帮助信息 6 | 7 | 想要搞懂命令的基本语法,可以用: 8 | 9 | `some_command --help` 10 | 11 | 或: 12 | 13 | `some_command help` 14 | 15 | 甚至是命令下面的字参数,子命令的更详细的语法,可以用: 16 | 17 | `some_command help sub_command` 18 | 19 | 往往可以输出对应的命令的帮助信息 20 | 21 | 举例: 22 | 23 | ## 嵌入式的uboot的语法 24 | [U-Boot: Quick reference - CompuLab Wiki](https://compulab.co.il/workspace/mediawiki/index.php5/U-Boot_quick_reference) 25 | > help - print online help 26 | 27 | -> help xxx 28 | 29 | 可以输出子命令的具体的详细的语法 30 | 31 | xxx是uboot的子命令,比如ls,cp,md等等 32 | 33 | ## iOS中包管理器Carthage的语法 34 | 35 | [Carthage/Artifacts.md at master · Carthage/Carthage](https://github.com/Carthage/Carthage/blob/master/Documentation/Artifacts.md#cartfile) 36 | 37 | [Carthage/Carthage: A simple, decentralized dependency manager for Cocoa](https://github.com/Carthage/Carthage#installing-carthage) 38 | 39 | ```bash 40 | licrifandeMacBook-Pro:Zzz crifan$ carthage help 41 | Available commands: 42 | 43 | archive Archives built frameworks into a zip that Carthage can use 44 | bootstrap Check out and build the project's dependencies 45 | build Build the project's dependencies 46 | checkout Check out the project's dependencies 47 | copy-frameworks In a Run Script build phase, copies each framework specified by a SCRIPT_INPUT_FILE environment variable into the built app bundle 48 | fetch Clones or fetches a Git repository ahead of time 49 | help Display general or command-specific help 50 | outdated Check for compatible updates to the project's dependencies 51 | update Update and rebuild the project's dependencies 52 | version Display the current version of Carthage 53 | 54 | licrifandeMacBook-Pro:Zzz crifan$ carthage help build 55 | Build the project's dependencies 56 | 57 | [--configuration (string)] 58 | the Xcode configuration to build 59 | 60 | [--platform (platform)] 61 | the platforms to build for (one of ‘all’, ‘Mac’, ‘iOS’, ‘watchOS’, 'tvOS', or comma-separated values of the formers except for ‘all’) 62 | 63 | [--derived-data (string)] 64 | path to the custom derived data folder 65 | 66 | [--no-skip-current] 67 | don't skip building the Carthage project (in addition to its dependencies) 68 | 69 | [--color (color)] 70 | whether to apply color and terminal formatting (one of ‘auto’, ‘always’, or ‘never’) 71 | 72 | [--verbose] 73 | print xcodebuild output inline 74 | 75 | [--project-directory (string)] 76 | the directory containing the Carthage project 77 | 78 | [[]] 79 | the dependency names to build 80 | ``` 81 | 82 | ## 苹果的Swift编译器`swiftc` 83 | 之前在: 84 | 85 | [已解决]Xcode项目编译出错:Command failed due to signal: Segmentation fault: 11 86 | 87 | 期间,注意到点苹果的swift语言的编译器swiftc,对应help结果是: 88 | 89 | ```bash 90 | ➜ crifanLib git:(master) swiftc --help 91 | OVERVIEW: Swift compiler 92 | 93 | USAGE: swiftc [options] 94 | 95 | MODES: 96 | -dump-ast Parse and type-check input file(s) and dump AST(s) 97 | -dump-parse Parse input file(s) and dump AST(s) 98 | -dump-scope-maps 99 | Parse and type-check input file(s) and dump the scope map(s) 100 | -dump-type-refinement-contexts 101 | Type-check input file(s) and dump type refinement contexts(s) 102 | -emit-assembly Emit assembly file(s) (-S) 103 | -emit-bc Emit LLVM BC file(s) 104 | ... 105 | -parse Parse input file(s) 106 | -print-ast Parse and type-check input file(s) and pretty print AST(s) 107 | -typecheck Parse and type-check input file(s) 108 | 109 | OPTIONS: 110 | -api-diff-data-file 111 | API migration data is from 112 | -application-extension Restrict code to those available for App Extensions 113 | -assert-config Specify the assert_configuration replacement. Possible values are Debug, Release, Unchecked, DisableReplacement. 114 | ... 115 | -whole-module-optimization 116 | Optimize input files together instead of individually 117 | -Xcc Pass to the C/C++/Objective-C compiler 118 | -Xlinker Specifies an option which should be passed to the linker 119 | ``` 120 | 121 | ## sftp命令不了解,用help去查看有哪些命令 122 | 123 | 之前: 124 | 125 | [【已解决】命令行中ftp操作上传到远程服务器crifan.com](http://www.crifan.comterminal_use_ftp_upload_file_to_remote_server_crifan_com) 126 | 127 | 期间,对于sftp的命令有哪些不是很了解,所以可以通过help去查看: 128 | 129 | ```bash 130 | sftp> help 131 | Available commands: 132 | bye Quit sftp 133 | cd path Change remote directory to 'path' 134 | chgrp grp path Change group of file 'path' to 'grp' 135 | chmod mode path Change permissions of file 'path' to 'mode' 136 | chown own path Change owner of file 'path' to 'own' 137 | df [-hi] [path] Display statistics for current directory or 138 | filesystem containing 'path' 139 | exit Quit sftp 140 | get [-afPpRr] remote [local] Download file 141 | reget [-fPpRr] remote [local] Resume download file 142 | reput [-fPpRr] [local] remote Resume upload file 143 | help Display this help text 144 | lcd path Change local directory to 'path' 145 | lls [ls-options [path]] Display local directory listing 146 | lmkdir path Create local directory 147 | ln [-s] oldpath newpath Link remote file (-s for symlink) 148 | lpwd Print local working directory 149 | ls [-1afhlnrSt] [path] Display remote directory listing 150 | lumask umask Set local umask to 'umask' 151 | mkdir path Create remote directory 152 | progress Toggle display of progress meter 153 | put [-afPpRr] local [remote] Upload file 154 | pwd Display remote working directory 155 | quit Quit sftp 156 | rename oldpath newpath Rename remote file 157 | rm path Delete remote file 158 | rmdir path Remove remote directory 159 | symlink oldpath newpath Symlink remote file 160 | version Show SFTP version 161 | !command Execute 'command' in local shell 162 | ! Escape to local shell 163 | ? Synonym for help 164 | sftp> 165 | ``` 166 | 167 | -------------------------------------------------------------------------------- /src/computer_program/i18n_l10n.md: -------------------------------------------------------------------------------- 1 | # i18n和l10n 2 | 在开发软件、APP时,往往会涉及到除了支持中文之外,还要支持其他国家的语言,比如英语、法语、德语等等,专业叫法叫做:**多国语言**(版本)或者**国际化** 3 | 4 | 而在谈论多国语言、国际化时,常常会遇到这个词:`i18n` 5 | 6 | 其实`i18n`==`internationalization` == `国际化` == `多国语言` 7 | 8 | -> 之所以这么叫是由于`internationalization`单词太长,把中间的**18**个字母`internationalizatio`省略掉,简写为了`i18n` 9 | 10 | 和`i18n`的类似的含义的类似叫法还有:`l10n`== `localization`== `本地化` 11 | 12 | 举例: 13 | 14 | 之前见过的: 15 | [python-babel/flask-babel: i18n and l10n support for Flask based on Babel and pytz](https://github.com/python-babel/flask-babel) 16 | -------------------------------------------------------------------------------- /src/computer_program/knowledge_skill_map.md: -------------------------------------------------------------------------------- 1 | # 知识技能图谱 2 | 3 | 在学习不同领域的技术时,往往会发现,不同领域所需要学习的内容和方向差距还是很大的,感觉算是**隔行如隔山**,换个技术领域和方向,很多名词甚至都没听说过。 4 | 5 | 另外,在某个领域有了深入专研之后,往往可以总结出很多该领域相关的技术和名词,整理出成系统的内容,往往就叫做该领域的**技术图谱**,**知识图谱**,**技能树**,**技术成长路线图**。 6 | 7 | ## TeamStuQ/skill-map: 程序员技能图谱 8 | 这个**[TeamStuQ/skill-map: 程序员技能图谱](https://github.com/TeamStuQ/skill-map)**中已经整理了**几十个领域**的技能图谱了,此处就不再做重复劳动,请移步去看即可。 9 | 10 | 此处把其他一些人制作的的图谱整理如下,供参考: 11 | 12 | ## 前端开发 知识图谱 13 | [QzhouZ/Front-End-Study: 前端开发基础知识学习](https://github.com/QzhouZ/Front-End-Study) 14 | 15 | ![QzhouZ的前端开发知识图谱](../assets/img/zzhouz_frond_end_skill_map.png) 16 | 17 | 18 | [JacksonTian/fks: 前端技能汇总 Frontend Knowledge Structure]https://github.com/JacksonTian/fks 19 | 20 | ![JacksonTian的前端技能汇总](../assets/img/jacksontian_frontend_skill_map.png) 21 | 22 | 23 | ## 机器学习算法工程师 24 | 25 | ![机器学习算法工程师技能树](../assets/img/machine_learn_skill_tree.png) 26 | 27 | ## 计算机视觉工程师 28 | 29 | ![计算机视觉工程师技能树](../assets/img/computer_vision_skill_tree.png) 30 | 31 | ## 自动驾驶工程师 32 | 33 | ![自动驾驶工程师技能树](../assets/img/auto_driving_skill_tree.png) -------------------------------------------------------------------------------- /src/computer_program/long_term_support.md: -------------------------------------------------------------------------------- 1 | # 长期支持版本LTS 2 | 3 | `LTS`=`Long Term Support`=`长期支持` 4 | 5 | 背景 6 | 7 | 在软件领域内,很多的软件,发布的版本,随着时间的流逝,很多软件会发生很多可能,其中很大的可能是,过了一段,或许可以称为足够长的时间后,该版本的软件,已经不被原先的发布商所支持了。导致依赖于此版本的软件的其他软件,变得不可用了。这种现象,尤其是在大的软件和系统中比较常见。 8 | 9 | 解决办法 10 | 11 | 对此,大的软件发布商为了告诉其他人说,我发布的某某版本的某个软件,会长期支持,不会中断,保持一定成程度的稳定,可以被信任,则此版本的软件,往往就叫做LTS,长期支持版本。 12 | 13 | 比如: 14 | 15 | ## Ubuntu的LTS版本 16 | Ubuntu就发布过很多个LTS的版本,比如`Ubuntu 12.04 LTS` 17 | 18 | 详见:[LTS - Ubuntu Wiki](https://wiki.ubuntu.com/LTS) 19 | 20 | ## Node.js的LTS版本 21 | Node.js的也有[LTS版本](https://i5ting.github.io/nodejs-fullstack/#5) 22 | 23 | -------------------------------------------------------------------------------- /src/computer_program/next_generation.md: -------------------------------------------------------------------------------- 1 | # Next Generation 2 | 3 | 有些软件,代码,功能,在开发了新一代,下一代,功能更好更强的版本后,有的会以`Next Generation`去命令。 4 | 5 | 比如之前的: 6 | 7 | ## 嵌入式的交叉编译的工具`crosstool-ng` 8 | [crosstool](http://www.kegel.com/crosstool/) 的下一代,新一代版本,叫做:[crosstool-ng](http://crosstool-ng.github.io/) 9 | 10 | ## 用于科学上网的shadowsocks的Mac版本`Shadowsocks-NG` 11 | 12 | 之前叫做[ShadowsocksX](https://github.com/shadowsocks/shadowsocks-iOS),其新版本,下一代,叫做[Shadowsocks-NG](https://github.com/shadowsocks/ShadowsocksX-NG) 13 | -------------------------------------------------------------------------------- /src/hardware_embedded/README.md: -------------------------------------------------------------------------------- 1 | # 硬件和嵌入式领域 2 | 3 | 对于硬件和嵌入式领域内的一些通用知识、概念和逻辑,已整理出独立教程,详见: 4 | 5 | [硬件和嵌入式通用逻辑知识概念](http://book.crifan.com/books/common_logic_hardware_embedded/website) 6 | -------------------------------------------------------------------------------- /src/upper_software/README.md: -------------------------------------------------------------------------------- 1 | # 上层软件领域 2 | 3 | 此处介绍上层软件领域内的通用知识、概念和逻辑。 -------------------------------------------------------------------------------- /src/upper_software/awesome_xxx.md: -------------------------------------------------------------------------------- 1 | # awsome xxx 2 | 对于很多技术,都有热心人去整理很多相关的优秀的资源,供开发者学习和使用,然后叫做`awsome xxx` 3 | 4 | -> 换句话说:如果想要快速找到某个技术的优秀资源汇总,可以去google中搜`awesome xxx`,往往可以快速方便的找到你要的。 5 | 6 | ## awsome Python 7 | * [vinta/awesome-python: A curated list of awesome Python frameworks, libraries, software and resources](https://github.com/vinta/awesome-python) 8 | * [jobbole/awesome-python-cn: Python资源大全中文版,包括:Web框架、网络爬虫、模板引擎、数据库、数据可视化、图片处理等,由伯乐在线持续更新](https://github.com/jobbole/awesome-python-cn) 9 | 10 | ### awsome Django 11 | * [haiiiiiyun/awesome-django-cn: Django 优秀资源大全](https://github.com/haiiiiiyun/awesome-django-cn) 12 | 13 | ## awesome iOS 14 | * [vsouza/awesome-ios: A curated list of awesome iOS ecosystem, including Objective-C and Swift Projects](https://github.com/vsouza/awesome-ios) 15 | 16 | ### awesome Swift 17 | * [matteocrippa/awesome-swift: A collaborative list of awesome Swift libraries and resources. Feel free to contribute!](https://github.com/matteocrippa/awesome-swift) 18 | * [Wolg/awesome-swift: A curated list of awesome Swift frameworks, libraries and software](https://github.com/Wolg/awesome-swift) 19 | 20 | ## Javascript 21 | 22 | ### awesome ReactJS 23 | * [enaqx/awesome-react: A collection of awesome things regarding React ecosystem](https://github.com/enaqx/awesome-react) 24 | * [brillout/awesome-react-components: Catalog of React Components & Libraries](https://github.com/brillout/awesome-react-components) 25 | -------------------------------------------------------------------------------- /src/upper_software/cheat_sheet_handout.md: -------------------------------------------------------------------------------- 1 | # `Cheat Sheet`和`Handout` 2 | 3 | ## `Cheat sheet`的含义 4 | 软件领域内的 5 | 6 | Cheat sheet和handout的解释 7 | 8 | -》Cheat,中文含义为:作弊,Sheet:中文含义为:表格,表单,小纸片 9 | 10 | -》cheat sheet,中文含义为:(用于作弊)小抄 11 | 12 | -》放在软件行业内,意思是: 13 | 14 | 就像考试作弊一样,把大量的内容,精简的,有机的排列在一张纸,一张图上 15 | 16 | 特点: 17 | * 化繁为简 18 | 19 | 用途: 20 | * 方便随时参考和查阅 21 | * 尤其常见于,把各种软件,工具等的快捷键,主要功能等,总结后列在一张图片内,多数以图文并茂的表格,图表,图片等形式展现 22 | 23 | 概述: 24 | * 某某(语言,工具等)的Cheat sheet == 某某(语言,工具等)快速查阅的图表型的手册 25 | 26 | ## `handout`的含义 27 | 另外的`handout`,中文本意:讲义;宣传册子,宣传品 28 | 29 | -》往往有时候也可以认为: 30 | 31 | `cheat sheet` == `handout` 32 | 33 | Cheat sheet和handout的举例: 34 | 35 | ## `Cheat sheet`举例 36 | 37 | ### vi的cheat sheet 38 | [VI Editor / Linux Terminal Cheat Sheet (PDF) – Smashing Magazine](https://www.smashingmagazine.com/2010/05/vi-editor-linux-terminal-cheat-sheet-pdf/) 39 | 40 | -》 41 | 42 | [VI-Help-Sheet-01-large2.jpg](https://media-mediatemple.netdna-ssl.com/wp-content/uploads/2010/05/VI-Help-Sheet-01-large2.jpg) 43 | 44 | ![vi的cheat sheet](../assets/img/vi_cheat_sheet.png) 45 | 46 | ### Xcode的快捷键的cheat sheet 47 | 48 | `http://www.crifan.com/xcode_common_used_keyboard_shortcut` 49 | 50 | 中的: 51 | 52 | ![Xcode快捷键cheat sheet](../assets/img/xcode_shortcut_cheat_sheet.png) 53 | 54 | ### python的cheat sheet 55 | 56 | [python-cheat-sheet-v1.pdf](http://web.stanford.edu/class/physics91SI/handouts/python-cheat-sheet-v1.pdf) 57 | 58 | 59 | [Python_qr.pdf](http://www.astro.up.pt/~sousasag/Python_For_Astronomers/Python_qr.pdf) 60 | 61 | [python:cours:mementopython3-english.pdf](https://perso.limsi.fr/pointal/_media/python:cours:mementopython3-english.pdf) 62 | 63 | [Keep This Python Cheat Sheet on Hand When Learning to Code](http://lifehacker.com/keep-this-python-cheat-sheet-on-hand-when-learning-to-c-1655521825) 64 | 65 | ![Python的cheat sheet](../assets/img/python_cheat_sheet.png) 66 | 67 | ### go语言的cheat sheet 68 | 69 | [go-lang-cheat-sheet](https://github.com/a8m/go-lang-cheat-sheet/blob/master/golang_refcard.pdf) 70 | 71 | ![Go的cheat sheet - 1](../assets/img/go_cheat_sheet_1.jpg) 72 | ![Go的cheat sheet - 2](../assets/img/go_cheat_sheet_2.jpg) 73 | ![Go的cheat sheet - 3](../assets/img/go_cheat_sheet_3.jpg) 74 | ![Go的cheat sheet - 4](../assets/img/go_cheat_sheet_4.jpg) 75 | ![Go的cheat sheet - 5](../assets/img/go_cheat_sheet_5.jpg) 76 | ![Go的cheat sheet - 6](../assets/img/go_cheat_sheet_6.jpg) 77 | 78 | ### HTML的cheat sheet 79 | 80 | [htmlcheatsheet.pdf](http://web.stanford.edu/group/csp/cs21/htmlcheatsheet.pdf) 81 | 82 | [HTML Cheat Sheet - A Simple Guide to HTML](http://www.simplehtmlguide.com/cheatsheet.php) 83 | 84 | [HTML5 Cheat Sheet - WebsiteSetup.org](http://makeawebsitehub.com/the-html-5-mega-cheat-sheet/) 85 | 86 | [HTML5 Cheat Sheet - WebsiteSetup.org](http://websitesetup.org/html5-cheat-sheet/) 87 | 88 | ![HTML5的cheat sheet](../assets/img/html5_cheat_sheet.png) 89 | 90 | ### Font Awesome 的Cheatsheet 91 | 92 | React Native折腾期间,需要利用到对应字体:[‎fortawesome.github.io/Font-Awesome/icons/](http://fortawesome.github.io/Font-Awesome/icons/) 93 | 94 | -》 95 | 96 | [Font Awesome Cheatsheet](http://fontawesome.io/cheatsheet/) 97 | 98 | 就列出了所有的字体图标 99 | 100 | ![Font Awesome的Cheat sheet](../assets/img/font_awesome_cheat_sheet.png) 101 | 102 | ### React 的cheat sheet 103 | 104 | [React Cheat Sheet](https://ihatetomatoes.net/wp-content/uploads/2017/01/react-cheat-sheet-v1.pdf) 105 | 106 | ![React的Cheat Sheet](../assets/img/react_cheat_sheet.jpg) 107 | 108 | ### Emoji的cheat sheet 109 | 110 | [Emoji cheat sheet for GitHub, Basecamp and other services](https://www.webpagefx.com/tools/emoji-cheat-sheet/) 111 | 112 | ![Emoji的Cheat Sheet](../assets/img/emoji_cheat_sheet.png) 113 | 114 | ### Python的Pandas的cheatsheet 115 | 116 | [Pandas Cheat Sheet for Data Science in Python (article) - DataCamp](https://www.datacamp.com/community/blog/python-pandas-cheat-sheet) 117 | 118 | -》 119 | 120 | [PandasPythonForDataScience.pdf](https://s3.amazonaws.com/assets.datacamp.com/blog_assets/PandasPythonForDataScience.pdf) 121 | 122 | ![Python的Pandas的cheat sheet](../assets/img/python_for_data_science_pandas_cheat_sheet.jpg) 123 | 124 | ### Kotlin的cheatsheet 125 | 126 | [Kotlin 作为 Android 开发语言相比传统 Java 有什么优势? - 知乎](https://www.zhihu.com/question/37288009) 127 | 128 | [Kotlin Programming Language Cheat Sheet Part 1](https://gist.github.com/dodyg/5823184) 129 | 130 | [Kotlin Programming Language Cheat Sheet Part 2](https://gist.github.com/dodyg/5616605) 131 | 132 | ![Kotlin的cheat sheet](../assets/img/kotlin_cheat_sheet.png) 133 | 134 | 135 | -------------------------------------------------------------------------------- /src/upper_software/config_file_xxxfile.md: -------------------------------------------------------------------------------- 1 | # 配置文件名为xxxfile 2 | 有很多技术、工具和框架,去给自己的配置文件命名的时候,用:`xxxfile[.yyy]` 3 | 4 | 比如: 5 | 6 | ## 前端开发 7 | * `grunt`:`Gruntfile.js` 8 | * `gulp`:`guplfile.js` 9 | 10 | ## iOS开发 11 | * `Carthage`:`Cartfile` 12 | * `Cocoapods`:`Podfile` 13 | -------------------------------------------------------------------------------- /src/upper_software/database/README.md: -------------------------------------------------------------------------------- 1 | # 上层软件 - 数据库 2 | 3 | 此处介绍上层软件领域内和**数据库**相关的通用知识、概念和逻辑。 -------------------------------------------------------------------------------- /src/upper_software/database/schema.md: -------------------------------------------------------------------------------- 1 | # schema模式 2 | 3 | 之前在数据库领域内就看到和提到了schema 4 | 5 | [MongoDB vs. Redis Comparison](https://db-engines.com/en/system/MongoDB;Redis) 6 | [architecture - When to Redis? When to MongoDB? - Stack Overflow](https://stackoverflow.com/questions/5400163/when-to-redis-when-to-mongodb) 7 | 8 | 想要去搞清楚,什么是schema 9 | 10 | 什么是schema 11 | 12 | [在数据库中,schema、catalog分别指的是什么? - 知乎](https://www.zhihu.com/question/20355738) 13 | > 对于mysql,schema和database可以理解为等价的. 14 | > 15 | > As defined in the MySQL Glossary: 16 | > In MySQL, physically, a schema is synonymous with a database. You can substitute the keyword SCHEMA instead of DATABASE in MySQL SQL syntax, for example using CREATE SCHEMA instead of CREATE DATABASE. 17 | > 18 | > Some other database products draw a distinction. For example, in the Oracle Database product, a schema represents only a part of a database: the tables and other objects owned by a single user. 19 | > 20 | > schema就是数据库对象的集合,这个集合包含了各种对象如:表、视图、存储过程、索引等。 21 | > 22 | > 如果把database看作是一个仓库,仓库很多房间(schema),一个schema代表一个房间,table可以看作是每个房间中的储物柜,user是每个schema的主人,有操作数据库中每个房间的权利,就是说每个数据库映射user有每个schema(房间)的钥匙。 23 | > 24 | > schema是对一个数据库的结构描述。在一个关系型数据库里面,schema定义了表、每个表的字段,还有表和字段之间的关系。 25 | catalog是由一个数据库实例的元数据组成的,包括基本表,同义词,索引,用户等等。” 26 | 27 | [Difference Between Schema / Database in MySQL - Stack Overflow](https://stackoverflow.com/questions/11618277/difference-between-schema-database-in-mysql) 28 | > Depends on the database server. MySQL doesn't care, its basically the same thing. 29 | Oracle, DB2, and other enterprise level database solutions make a distinction. Usually a schema is a collection of tables and a Database is a collection of schemas. 30 | 31 | [Schema(数据库中的Schema)_百度百科](https://baike.baidu.com/item/Schema/15286221) 32 | > A schema is a collection of database objects (used by a user.). 33 | > schema objects are the logical structures that directly refer to the database’s data. 34 | > A user is a name defined in the database that can connect to and access objects. 35 | > schemas and users help database administrators manage database security.” 36 | 37 | [数据库中Schema(模式)概念的理解](https://www.biaodianfu.com/database-schema.html) 38 | > 在学习数据库时,会遇到一个让人迷糊的Schema的概念。实际上,schema就是数据库对象的集合,这个集合包含了各种对象如:表、视图、存储过程、索引等。 39 | > 40 | > 如果把database看作是一个仓库,仓库很多房间(schema),一个schema代表一个房间,table可以看作是每个房间中的储物柜,user是每个schema的主人,有操作数据库中每个房间的权利,就是说每个数据库映射的user有每个schema(房间)的钥匙。 41 | > 42 | > 默认情况下一个用户对应一个集合,用户的schema名等于用户名,并作为该用户缺省schema。所以schema集合看上去像用户名。访问一个表时,如果没有指明该表属于哪个schema,系统会自动加上缺省的schema。一个对象的完整名称为schema.object,而不属user.object。 43 | > 44 | > 在MySQL中创建一个Schema和创建一个Database的效果好像是一样的,但是在SQL Server和Oracle数据库中效果又是不同的。 45 | 46 | -------------------------------------------------------------------------------- /src/upper_software/debounce.md: -------------------------------------------------------------------------------- 1 | # debounce防抖动 2 | 3 | debounce的英文是**防反跳**,也叫**防止误动作**、**防抖动** 4 | 5 | 典型的用途有,键盘按键的去抖动,防抖动 6 | 7 | 类似的写前端页面时常会遇到类似的场景: 8 | 9 | 用户输入要搜索的文字而触发搜索,调用后台接口去返回数据,然后前端页面列表刷新显示 10 | 11 | 但是如果每次输入一个字符后就立刻触发后台搜索,则往往在一次性输入多个字符串时会导致中间的无效搜索,也会导致性能浪费和界面卡顿。 12 | 13 | 解决办法是: 14 | 15 | 当用户输入一个字符时,延迟触发搜索,比如延迟500ms: 16 | * 在500ms内,如果用户没有在继续输入,再去调用接口返回搜索结果 17 | * 在500ms内,如果用户又继续输入其他字符了,则重新触发,重新计算,再延迟500ms判断是否输入 18 | 19 | 由此可以实现: 20 | 21 | 不论用户是一次性只输入单个字符串,还是一段时间内连续输入多个字符串,最终都只是触发一次搜索,返回结果,刷新页面,使得用户体验很好。 22 | 23 | 对于上述逻辑,可以自己写代码实现: 24 | 25 | 在获得用户输入的事件时,设置一个定时器,计算倒计时。 26 | 27 | 也可以利用: 28 | 29 | 这个概念本身叫做debounce 30 | 31 | 有第三方库帮忙实现这个debounce的效果,比如lodash的debounce 32 | 33 | 比如之前写的:ReactJS中实现,延迟搜索的效果的代码: 34 | 35 | ```js 36 | import { h, Component } from 'preact'; 37 | import style from './style.less'; 38 | import PropTypes from 'prop-types'; 39 | 40 | import _ from "lodash"; 41 | 42 | export default class Search extends Component { 43 | state = { 44 | value : null 45 | } 46 | 47 | constructor(props) { 48 | super(props); 49 | 50 | this.onInput = this.onInput.bind(this); 51 | this.onClick = this.onClick.bind(this); 52 | } 53 | 54 | componentWillMount() { 55 | this.delayedOnInput = _.debounce(this.props.onInputChange, this.props.debounceTimeout); 56 | } 57 | 58 | onInput(e){ 59 | this.setState({value : e.target.value}); 60 | 61 | e.persist(); 62 | this.delayedOnInput(this.state.value); 63 | } 64 | 65 | onClick(e){ 66 | if (this.props.onClick) { 67 | this.props.onClick(e); 68 | } 69 | } 70 | 71 | render () { 72 | return ( 73 |
74 | 86 |
87 | ); 88 | } 89 | 90 | } 91 | 92 | Search.PropTypes = { 93 | debounceTimeout : PropTypes.number, 94 | placeholder : PropTypes.string, 95 | onInputChange : PropTypes.func.isRequired, 96 | onClick : PropTypes.func 97 | }; 98 | 99 | Search.defaultProps = { 100 | debounceTimeout : 500, 101 | placeholder : "请输入" 102 | }; 103 | ``` 104 | 105 | -------------------------------------------------------------------------------- /src/upper_software/package_manage_tool.md: -------------------------------------------------------------------------------- 1 | # 库/包的依赖管理工具 2 | 3 | 在开发期间,往往需要使用别人的第三方的代码和功能。 4 | 5 | 而安装第三方库文件,理论上可以自己下载源码,自己编译得到自己要的库 6 | 7 | 但是后续的库的升级、管理依赖、维护都是个比较麻烦的事情。 8 | 9 | 所以出现了包管理工具,便于第三方库的安装和升级: 10 | 11 | 即:不同语言和环境,有不同的第三方的软件/库/包的管理工具,管理不同的版本,不同的依赖。 12 | 13 | 下面就来总结一下。 14 | 15 | ## Python 16 | 17 | ### pip 18 | 19 | ## Javascript 20 | 21 | ### npm 22 | 23 | ### yarn 24 | 25 | ## iOS 26 | 27 | ### Cocoapods 28 | 29 | ### Carthage 30 | 31 | -------------------------------------------------------------------------------- /src/various_language/README.md: -------------------------------------------------------------------------------- 1 | # 各种编程语言领域 2 | 3 | 此处介绍各种计算机编程语言方面的通用逻辑、知识和概念。 -------------------------------------------------------------------------------- /src/various_language/async_wait.md: -------------------------------------------------------------------------------- 1 | # async和wait 2 | 3 | ## Javascript中的async wait 4 | 5 | JS的ES6/ES7?中有async wait 6 | 7 | ## Python 3.3中也有async wait 8 | 9 | 待整理: 10 | [使用 WebSocket 和 Python 编写日志查看器 | 张吉的博客](http://shzhangji.com/cnblogs/2017/07/16/log-tailer-with-websocket-and-python/) 11 | -------------------------------------------------------------------------------- /src/various_language/getter_setter.md: -------------------------------------------------------------------------------- 1 | # 类的属性的`getter`和`setter` 2 | 3 | 之前接触计算机语言,比如`C`、`C++`等,都没有`getter`和`setter`的 4 | 5 | 后来接触到了一些语言: 6 | * `C#` 7 | * `Swift` 8 | * `Python` 9 | 10 | 其**对象**==**类**==**Class**中都有了**属性Property**的: 11 | * `getter`:读取属性的值 12 | * `setter`:设置(写入)属性的值 13 | 14 | 比如: 15 | 16 | ## Python 17 | Python的[python - 新手学习Flask引用flask-login后登入错误原因不清 - SegmentFault](https://segmentfault.com/q/1010000002881544) 18 | 中的: 19 | ```python 20 | class Admin(UserMixin, db.Model): 21 | __tablename__ = 'admin' 22 | id = db.Column(db.Integer, primary_key=True) 23 | username = db.Column(db.String(64), unique=True) 24 | password_hash = db.Column(db.String(128), unique=False) 25 | 26 | @property 27 | def password(self): 28 | raise AttributeError('不能直接获取明文密码!') 29 | 30 | @password.setter 31 | def password(self, password): 32 | self.password_hash = generate_password_hash(password) 33 | ``` 34 | -------------------------------------------------------------------------------- /src/various_language/logging.md: -------------------------------------------------------------------------------- 1 | # log日志 2 | 3 | 在写代码开发期间,往往会涉及到打印Log日志。 4 | 5 | 在此总结log相关的内容。 6 | 7 | `日志` == `log` == `Logger` == `logging` 8 | 9 | 用来打印日志输出信息用于调试。 10 | 11 | ## log的等级 12 | log日志有一些常见的登记,最基本的几种有: 13 | * `info`: 用于输出一些阶段性的告知用户的信息,比如用户已成功登录之类的 14 | * `debug`: 用于调试目的,而输出一些信息,比如打印某些变量的值 15 | * `warn`/`warning`: 用于输出一些不正常的情况,需要引起用户注意了,比如app检测存储空间快满了 16 | * `error`: 显示一些错误级别的信息,往往意味着程序也要终止运行了。需要用户处理错误,或者退出程序之类的 17 | 18 | 其他不是很常见的几种: 19 | * `finest`/`fine`:表示程序正常级别输出的信息 20 | * `trace`: 类似于debug,用于输出一些追踪调试信息 21 | * `verbose`:事无巨细的,最详尽的信息 22 | * `severe`:严重的问题,类似于error 23 | * `critical`:关键的问题,类似于severe 24 | 25 | ## log相关的库 26 | 27 | ### log4xxx系列 28 | 有个通用的log的库:log4xxx 29 | 30 | 针对于不同语言的log4xxx分别是: 31 | 32 | * Java语言:Log4j 33 | * [log4j](https://logging.apache.org/log4j/1.2/) 34 | * 新版本:[Log4j – Log4j 2 Guide - Apache Log4j 2](http://logging.apache.org/log4j/2.x/) 35 | * C语言:log4c 36 | * [log4c](http://log4c.sourceforge.net) 37 | * Go语言:log4go 38 | * [alecthomas/log4go: Logging package similar to log4j for the Go programming language](https://github.com/alecthomas/log4go) 39 | * 微软的.NET框架(C#等语言):[log4net](https://logging.apache.org/log4net/) 40 | * [Open Source Logging Tools in C#](https://csharp-source.net/open-source/logging) 41 | * Delphi语言:Log4Delphi 42 | * [Welcome to Log4Delphi](http://log4delphi.sourceforge.net) 43 | * C++: [log4cpp](http://log4cpp.sourceforge.net/) 44 | * 其他相关: 45 | * [log4cplus](https://sourceforge.net/projects/log4cplus/) 46 | * [log4cxx](https://logging.apache.org/log4cxx/) 47 | 48 | ### Python 49 | Python的log库:自带的库[logging](https://docs.python.org/2/library/logging.html) 50 | 51 | 自己也整理和封装成基本的函数: 52 | 53 | ```python 54 | def loggingInit(filename = None, 55 | fileLogLevel = logging.DEBUG, 56 | fileLogFormat = '%(asctime)s LINE %(lineno)-4d %(levelname)-7s %(message)s', 57 | fileLogDateFormat = '%Y/%m/%d %I:%M:%S', 58 | enableConsole = True, 59 | consoleLogLevel = logging.INFO, 60 | consoleLogFormat = "%(asctime)s LINE %(lineno)-4d %(levelname)-7s %(message)s", 61 | consoleLogDateFormat = '%Y/%m/%d %I:%M:%S', 62 | ): 63 | """ 64 | init logging for both log to file and console 65 | :param logFilename: input log file name 66 | if not passed, use current script filename 67 | :return: none 68 | """ 69 | logFilename = "" 70 | if filename: 71 | logFilename = filename 72 | else: 73 | logFilename = getInputFileBasenameNoSuffix() + ".log" 74 | 75 | logging.basicConfig( 76 | level = fileLogLevel, 77 | format = fileLogFormat, 78 | datefmt = fileLogDateFormat, 79 | filename = logFilename, 80 | filemode = 'w') 81 | if enableConsole : 82 | # define a Handler which writes INFO messages or higher to the sys.stderr 83 | console = logging.StreamHandler() 84 | console.setLevel(consoleLogLevel) 85 | # set a format which is simpler for console use 86 | formatter = logging.Formatter(fmt=consoleLogFormat, datefmt=consoleLogDateFormat) 87 | # tell the handler to use this format 88 | console.setFormatter(formatter) 89 | logging.getLogger('').addHandler(console) 90 | ``` 91 | 92 | 详见: 93 | `https://github.com/crifan/crifanLib/blob/master/python/crifanLib.py` 94 | 95 | #### Flask 96 | 97 | Python的Flask中也可以打印log 98 | 99 | 对应的代码: 100 | `config.py` 101 | ```python 102 | ############################################################ 103 | # File Log 104 | ############################################################ 105 | LOG_FILE_FILENAME = "logs/sipevents.log" 106 | 107 | LOG_FILE_FORMAT = "[%(asctime)s %(levelname)s %(filename)s:%(lineno)d %(funcName)s] %(message)s" 108 | ``` 109 | 110 | `__init__.py` 111 | ```python 112 | import logging 113 | from logging.handlers import RotatingFileHandler 114 | 115 | fileHandler = RotatingFileHandler( 116 | app.config['LOG_FILE_FILENAME'], 117 | maxBytes = 2*1024*1024, 118 | backupCount = 3, 119 | encoding = "UTF-8") 120 | fileHandler.setLevel(logging.DEBUG) 121 | 122 | fileLogFormatterStr = app.config["LOG_FILE_FORMAT"] 123 | fileLogFormatter = logging.Formatter(fileLogFormatterStr) 124 | fileHandler.setFormatter(fileLogFormatter) 125 | app.logger.addHandler(fileHandler) 126 | ``` 127 | 128 | `run.py` 129 | ```python 130 | from sipevents import app 131 | 132 | if __name__ == '__main__': 133 | app.run(debug=True) 134 | ``` 135 | 136 | 输出log的效果是: 137 | ```bash 138 | [2016-09-02 16:59:25,938 DEBUG views.py:804 creat_event] requestMethod=GET 139 | ``` 140 | 141 | 对应参数的解释是: 142 | 143 | | 参数 | 输出效果 | 144 | | -- | ----- | 145 | | %(asctime)s | 2016-09-02 16:59:25,938 | 146 | | %(levelname)s | DEBUG | 147 | | %(filename)s | views.py | 148 | | %(lineno)d | 804 | 149 | | %(funcName)s | creat_event | 150 | | %(message)s | requestMethod=GET | 151 | 152 | 153 | 更加完整的参数解释是: 154 | 155 | | 参数 | 含义解释 | 156 | | -- | ------ | 157 | | %(name)s | Logger的名字 | 158 | |%(levelno)s | 数字形式的日志级别| 159 | | %(levelname)s | 文本形式的日志级别 | 160 | | %(pathname)s | 调用日志输出函数的模块的完整路径名,可能没有 | 161 | | %(filename)s | 调用日志输出函数的模块的文件名 | 162 | | %(module)s | 调用日志输出函数的模块名 | 163 | | %(funcName)s | 调用日志输出函数的函数名 | 164 | | %(lineno)d | 调用日志输出函数的语句所在的代码行 | 165 | | %(created)f | 当前时间,用UNIX标准的表示时间的浮点数表示 | 166 | | %(relativeCreated)d | 输出日志信息时的,自Logger创建以来的毫秒数 | 167 | | %(asctime)s | 字符串形式的当前时间。默认格式是"2003-07-08 16:49:45,896"。逗号后面的是毫秒 | 168 | | %(thread)d | 线程ID。可能没有 | 169 | | %(threadName)s| 线程名。可能没有| 170 | | %(process)d | 进程ID。可能没有 | 171 | | %(message)s | 用户输出的消息 | 172 | 173 | ### Swift 174 | 175 | iOS的swift中也遇到过log库:[XCGLogger](https://github.com/DaveWoodCom/XCGLogger) 176 | 177 | 其中的log的定义是: 178 | ```swift 179 | /// Enum defining our log levels 180 | public enum Level : Int, Comparable, CustomStringConvertible { 181 | case verbose 182 | case debug 183 | case info 184 | case warning 185 | case error 186 | case severe 187 | case none 188 | 189 | ... 190 | public var description: String { get } 191 | public static let all: [XCGLogger.XCGLogger.Level] 192 | } 193 | ``` 194 | 195 | 和基本的封装 196 | 197 | ```swift 198 | import XCGLogger 199 | 200 | func initLog() { 201 | gLog = XCGLogger.default//XCGLogger.defaultInstance() 202 | 203 | //var logLevel:XCGLogger.LogLevel = XCGLogger.LogLevel.debug 204 | 205 | var logLevel:XCGLogger.Level = XCGLogger.Level.debug 206 | if LogLevelIsVerbose { 207 | logLevel = XCGLogger.Level.verbose 208 | } 209 | 210 | var fileLogLevel:XCGLogger.Level = XCGLogger.Level.debug 211 | if FileLogLevelIsVerbose { 212 | fileLogLevel = XCGLogger.Level.verbose 213 | } 214 | 215 | gLog.setup( 216 | level: logLevel, 217 | showThreadName: true, 218 | showLevel: true, 219 | showFileNames: true, 220 | showLineNumbers: true, 221 | writeToFile: LogFile, 222 | fileLevel: fileLogLevel) 223 | } 224 | ``` 225 | 226 | 之后即可正常log了: 227 | 228 | ```swift 229 | gLog.info("UIScreen.mainScreen().bounds=\(UIScreen.main.bounds)") 230 | gLog.debug("forgetPasswordVC:\(forgetPasswordVC)”) 231 | gLog.warning("jpush set alias \(alias) failed") 232 | gLog.error("上传附件失败: \(encodingError)”) 233 | ``` 234 | 235 | 236 | -------------------------------------------------------------------------------- /src/various_language/print.md: -------------------------------------------------------------------------------- 1 | # print打印 2 | 3 | 在用不同语言开发时,往往会遇到,用print类的函数去打印log输出信息,用于调试。 4 | 5 | * 嵌入式中常见的C等语言的打印都是printf 6 | * 写Linux驱动时,Linux内核中的打印是printk 7 | 8 | TODO: 9 | 1.把 10 | [2.2.1. 通用函数:print - - 计算机编程语言基础知识](https://www.crifan.com/files/doc/docbook/programming_language_basic/release/webhelp/common_func_print.html)合并进来 11 | 12 | -------------------------------------------------------------------------------- /src/various_language/python/README.md: -------------------------------------------------------------------------------- 1 | # 编程语言 - Python 2 | 3 | 此处介绍各种计算机编程语言中涉及`Python`方面的通用逻辑、知识和概念。 -------------------------------------------------------------------------------- /src/various_language/python/adapter.md: -------------------------------------------------------------------------------- 1 | # adapter适配器 2 | 3 | Python开发期间,在使用第三方数据库等场景时,常会遇到`apater`这个概念。 4 | 5 | `driver驱动器` ≈ `adapter适配器` ≈ `binding粘合剂` ≈ `wrapper封装` 6 | 7 | adapter/driver/binding/wrapper,指的是: 8 | 9 | 把一个别的功能,封装后,提供操作该功能的接口 10 | 11 | 起到了,作为粘合剂,把其他的库和你写的代码粘合起来效果 12 | 13 | 14 | TODO: 15 | 16 | 1.把 17 | 18 | [【软件开发基础知识】binding和wrapper – 在路上](https://www.crifan.com/software_development_basic_binding_and_wrapper/) 19 | 20 | 合并进来。 21 | 22 | ## Python 23 | 24 | ### Python的QT的driver 25 | 26 | QT的库,对于Python语言来说,也有对应的driver 27 | 28 | ### Python的PostgreSQL的driver 29 | 30 | postgre的数据库,也有对应的driver 31 | 32 | ### Python的MongoDB的driver 33 | 34 | mongoDB也是有Python的driver 35 | 36 | --------------------------------------------------------------------------------