Flutter 安装配置

安装 下载SDK: Windows SDK:Stable 1.17.3 macOS SDK:Stable 1.17.3 Linux SDK:Stable 1.17.3 其它版本列表:SDK 版本列表[2] 将文件解压到目标路径, 比如: cd ~/flutter unzip ~/Downloads/flutter_macos_1.17.3-stable.zip 也可以从Github上获取源代码: git clone https://github.com/flutter/flutter.git 配置 flutter 的 PATH 环境变量: export PATH="$PATH:~/flutter/flutter/bin" ~/flutter/flutter/bin 需要替换成你设置的目录。 如果bash 使用的是 zsh,需要把这行代码写入到 ~/.zsh_rc 文件,如果是bash,则需要写入 ~/.bash_profile ,文件更新后需要执行 source ~/.zsh_rc flutter 命令行工具会下载不同平台的开发二进制文件,如果需要一个封闭式的构建环境,或在网络可用性不稳定的情况下使用等情况,你可能需要通过下面这个命令预先下载 iOS 和 Android 的开发二进制文件: flutter precache flutter doctor 命令 运行flutter doctor命令可以查看当前环境是否需要安装其他的依赖,输出结果如下: ➜ ~ flutter doctor Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, v1.17.1, on Mac OS X 10.15.5 19F96, locale zh-Hans-CN) [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3) [✓] Xcode - develop for iOS and macOS (Xcode 11.4.1) [✓] Android Studio (version 4.0) [!] IntelliJ IDEA Ultimate Edition (version 2020.1.1) ✗ Flutter plugin not installed; this adds Flutter specific functionality. ✗ Dart plugin not installed; this adds Dart specific functionality. [✓] VS Code (version 1.45.1) [✓] Connected device (1 available) ! Doctor found issues in 1 category. 从上述结果可以看出,IntelliJ IDEA Ultimate Edition 没有安装flutter plugin 和 dart plugin 没有安装。 ...

2020-06-06 · 3 min · 534 words

Facilitating Technical Writing Courses

Google 技术写作课程搬运,原文地址:https://developers.google.com/tech-writing/overview?hl=zh-cn Facilitating Technical Writing Courses This section provides resources for anyone facilitating or considering facilitating technical writing courses. The following table contains links to all relevant material for facilitators: for facilitators for students Course Facilitator’s Guide slide deck log pre-class in-class Technical Writing One Facilitator’s Guide[1] slide deck[2] log[3] pre-class[4] in-class[5] Technical Writing Two Facilitator’s Guide[6] slide deck[7] log[8] pre-class[9] in-class[10] If you’d like to facilitate a particular course, please start by reading the course’s Facilitator’s Guide. ...

2020-03-01 · 13 min · 2750 words

Technical Writing Courses

Google 技术写作课程搬运,原文地址:https://developers.google.com/tech-writing/overview?hl=zh-cn Technical Writing Courses Every engineer is also a writer. This collection of courses and learning resources aims to improve your technical documentation. Learn how to plan and author technical documents. You can also learn about the role of technical writers at Google. Overview of technical writing courses The following table summarizes the technical writing courses: Take this course… Title Focus Pre-Class In-Class first Technical Writing One the critical basics of technical writing 2 hours 2 to 2.5 hours second Technical Writing Two intermediate topics in technical writing 1 hour 2 to 2.5 hours The pre-class components introduce topics; the in-class components help students integrate those topics. That said, the pre-class lessons on their own still provide a valuable educational experience. ...

2020-03-01 · 93 min · 19657 words

学习单元测试,告别祈祷式编程

[TOC] 祈祷式编程 祈祷式编程 如果代码中包含以下代码 或者上线后进行这种活动 那么这种编程方式就是祈祷式编程。 用流程图表示基本就是这个样子。 祈祷式编程有什么危害呢? 累,每次写完代码还需要再祈祷 不受控,代码运行结果主要看运气,大仙忙的时候可能保佑不了 解决这个问题有好多种方法,单元测试是其中之一。 单元测试 什么是单元测试 单元测试是由开发人员编写的,用于对软件基本单元进行测试的可执行的程序。 单元(unit)是一个应用程序中最小的课测试部分。(比如一个函数,一个类 google 把测试分成小型测试、中型测试和大型测试。单元测试基本和小型测试的作用类似,但是通常也会使用mock或者stub 的方式模拟外部服务。 理想情况下,单元测试应该是相互独立、可自动化运行的。 目的: 通常用单元测试来验证代码逻辑是否符合预期。完整可靠的单元测试是代码的安全网,可以在代码修改或重构时验证业务逻辑是否正确,提前发现代码错误,减少调试时间。设计良好的单元测试某些情况下可以比文档更能反应出代码的功能和作用。 单元测试这么多优点为什么有人不喜欢写单元测试呢? 单元测试太费时间了,对于编写单元测试不熟练的新手来说,编写单元测试可能比写代码的还费时间 单元测试运行时间太长(这通常是单元测试设计不合理或者代码可测试性较差造成的 祖传代码,看都看不懂怎么写单元测试(这个确实优点棘手。。可以考虑先给新代码加单元测试 不会写单元测试 这篇文章主要关注第四个问题,如何写单元测试。 单元测试的结构 首先看一下单元测试的结构,一个完整的单元测试主要包括Arrange-Act-Assert(3A) 三部分。 Arrange–准备数据 Act–运行代码 Assert–判断结果是否符合预期 比如我们要给下面这段代码(golang)加单元测试: func Add(x, y int) int { return x + y } 单元测试代码如下: import "testing" func TestAdd(t *testing.T) { // arrange 准备数据 x, y := 1, 2 // act 运行 got := Add(x, y) //assert 断言 if got != 3 { t.Errorf("Add() = %v, want %v", got, 3) } } 如何编写好的单元测试 什么样的单元测试才是好的单元测试呢? ...

2019-10-07 · 3 min · 625 words

如何通过MD5反查身份证号?

题目:设计一个身份证查询系统,将身份证号md5 之后存储,输入md5值查询对应的身份证号。 要求:成本低,查询速度快 设计思路: 将所有可能的身份证号做一个简单的统计计算数据量 根据数据量选择存储方式 查询 身份证生成规则: 身份号码是特征组合码,由前十七位数字本体码和最后一位数字校验码组成。排列顺序从左至右依次为六位数字地址码,八位数字出生日期码,三位数字顺序码和一位数字校验码。 地址码: 表示编码对象常住户口所在县(市、旗、区)的行政区划代码。对于新生儿,该地址码为户口登记地行政区划代码。需要没说明的是,随着行政区划的调整,同一个地方进行户口登记的可能存在地址码不一致的情况。行政区划代码按GB/T2260的规定执行。 出生日期码:表示编码对象出生的年、月、日,年、月、日代码之间不用分隔符,格式为YYYYMMDD,如19880328。按GB/T 7408的规定执行。原15位身份证号码中出生日期码还有对百岁老人特定的标识,其中999、998、997、996分配给百岁老人。 顺序码: 表示在同一地址码所标识的区域范围内,对同年、同月、同日出生的人编定的顺序号,顺序码的奇数分配给男性,偶数分配给女性。 校验码: 根据本体码,通过采用ISO 7064:1983,MOD 11-2校验码系统计算出校验码。算法可参考下文。前面有提到数字校验码,我们知道校验码也有X的,实质上为罗马字符X,相当于10. 校验码算法 将本体码各位数字乘以对应加权因子并求和,除以11得到余数,根据余数通过校验码对照表查得校验码。 加权因子表: +-----------------------------------------------------------+ |位置序号|1 |2 |3 |4 |5 |6 |7 |8 |9 |10|11|12|13|14|15|16|17| +-----------------------------------------------------------+ |加权因子|7 |9 |10|5 |8 |4 |2 |1 |6 |3 |7 |9 |10|5 |8 |4 |2 | +-----------------------------------------------------------+ 校验码表: +----------------------------------------------------+ | 余数 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | +----------------------------------------------------+ | 校验码| 1 | 0 | X | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | +----------------------------------------------------+ 算法举例: 本体码为11010519491231002 ...

2019-08-18 · 1 min · 199 words

每周分享第4期

Docker 终端UI: https://github.com/jesseduffield/lazydocker 宝数据库内核月报:http://mysql.taobao.org/monthly/ 比较深入的数据库源码分析 手机号码归属地查询:https://apis-mp.gusibi.mobi/mobile/location?mobile=18512345678 使用serverless部署,无需服务器。源码地址:https://github.com/gusibi/oneplus/tree/master/mobile-attribution 手绘风格CSS:https://www.getpapercss.com/ Image-to-Image Demo: https://affinelayer.com/pixsrv/ 学霸用左边,学渣用右边:https://www.plainlanguage.gov/guidelines/words/use-simple-words-phrases/ 美国政府的一个网页,有几百条单词建议,指导你怎么写出简单的文章,不要用复杂的单词。 比如说,“a和b可以同时使用,也可以单独使用”,不要用 a and/or b,而要用 a or b or both。 微软上线了一套 Python 教程《Develop with Python on Windows》 微软上线了一套 Python 教程《Develop with Python on Windows》。 百度网盘下载器:https://github.com/b3log/baidu-netdisk-downloaderx 一款图形界面的百度网盘不限速下载器,支持 Windows、Linux 和 Mac。 参考链接 [1] 《Develop with Python on Windows》: https://docs.microsoft.com/zh-cn/windows/python/ 最后,感谢女朋友支持和包容,比❤️ 也可以在公号输入以下关键字获取历史文章:公号&小程序 | 设计模式 | 并发&协程 内推时间

2019-08-04 · 1 min · 56 words

每周分享第3期-史上最全的编程学习资料合集

【资料】史上最全的编程学习资料合集(持续更新) 【资料】一周 GitHub 开源项目推荐:阿里、腾讯、陌陌、bilibili…… 【资料】常用的 Go 框架、库和软件中文收录大全 【教程】高性能 Go 代码工坊(英文) 【文章】我用了10年 从深圳流水线厂妹做到纽约高薪程序员 【文章】2009年最热门的 iPhone 应用程序(英文) 苹果公司的应用商店即将满十周年,本文回顾了2009年最热门的付费应用和免费应用 【语言】v语言-语法综合了python和go 【工具】weixin python sdk 支持小程序云开发 【工具】网站收录了估值达到 10 亿美元的创业公司,实时更新 【工具】简洁的 Mac 图床客户端 uPic References [1] 【资料】史上最全的编程学习资料合集(持续更新): https://github.com/toutiaoio/weekly.manong.io [2] 【资料】常用的 Go 框架、库和软件中文收录大全: https://juejin.im/post/5d14a319e51d4577407b1d77 [3] 【教程】高性能 Go 代码工坊: https://dave.cheney.net/high-performance-go-workshop/gopherchina-2019.html [4] 【文章】2009年最热门的 iPhone 应用程序: https://www.fastcompany.com/90356079/whatever-happened-to-the-hottest-iphone-apps-of-2009 [5] 【语言】v语言-语法综合了python和go: https://github.com/vlang/v [6] 【工具】weixin python sdk 支持小程序云开发: https://github.com/gusibi/python-weixin [7] 【工具】网站收录了估值达到 10 亿美元的创业公司,实时更新: https://dujiaoshou.io/ [8] 【工具】简洁的 Mac 图床客户端 uPic: https://github.com/gee1k/uPic 最后,感谢女朋友支持和包容,比❤️ 也可以在公号输入以下关键字获取历史文章:公号&小程序 | 设计模式 | 并发&协程 内推时间

2019-06-29 · 1 min · 74 words

每周分享第2期-宇宙模拟器

1 宇宙模拟器 :http://spaceengine.org 2 APIJSON:https://github.com/APIJSON/APIJSON APIJSON是一种为API而生的 JSON网络传输协议 以及 基于这套协议实现的ORM库。 后端接口和文档自动化,前端(客户端) 定制返回JSON的数据和结构 3 【文章】小火箭对SpaceX星链计划低轨巨型星座的分析:https://mp.weixin.qq.com/s/NNmI_cqwo4ba0ViJ9O7f3Q 这篇对SpaceX 星链计划 可行性进行了详细的分析,共11575字,101图。预计阅读时间:1小时15分钟 4 微软与 Google 共同开设的量子算法课程:https://brilliant.org/courses/quantum-computing/ 通过浏览器模拟的量子计算环境,学习量子算法 5 一个VPS搜索工具: https://anothervps.com/vps/ 可怜我linode 都用不了了 6 一些有趣的网站: https://www.ctolib.com Github开源项目收集网站 http://www.nicetool.net 实用工具比较多 http://www.mvyxws.com/ 以视频方式分享医学知识的网站 https://www.tikitiki.cn 自由的音乐,能够试听并下载全网音乐 https://showmore.com/zh/ 在线录制屏幕的工具 https://weibomiaopai.com 视频下载 7 PySnooper:https://github.com/cool-RR/PySnooper python DeBug工具 8 pyecharts:https://github.com/pyecharts/pyecharts Echarts 是一个由百度开源的数据可视化,pycharts 是Echarts 的python版。 9 LeetCodeAnimation:https://github.com/MisterBooo/LeetCodeAnimation 用动画的形式呈现解LeetCode题目的思路 10 ColorUI:https://www.color-ui.com/ 鲜亮的高饱和色彩,专注视觉的小程序组件库 iPhone X怎么强制关机? iPhone X强制关机有三步: 按下音量+键然后松开; 按下音量-键然后松开; 之后按住侧边按钮(即电源键)直到iPhone X黑屏。 升级了iOS13,打电话的时候就停留在了通话界面,再也退不出去了。。只能用强制关机的方式。 才知道是这么个方式 最后,感谢女朋友支持和包容,比❤️ 也可以在公号输入以下关键字获取历史文章:公号&小程序 | 设计模式 | 并发&协程 ...

2019-06-22 · 1 min · 73 words

Redis 选择hash还是string 存储数据?

在stackoverflow 看到一个问题,Redis strings vs Redis hashes to represent JSON: efficiency?内容如下: I want to store a JSON payload into redis. There’s really 2 ways I can do this: One using a simple string keys and values. key:user, value:payload (the entire JSON blob which can be 100-200 KB) SET user:1 payload Using hashes HSET user:1 username “someone” HSET user:1 location “NY” HSET user:1 bio “STRING WITH OVER 100 lines” Keep in mind that if I use a hash, the value length isn’t predictable. They’re not all short such as the bio example above. Which is more memory efficient? Using string keys and values, or using a hash? ...

2019-06-22 · 3 min · 457 words

markdown中code生成图片的实现

前几天写了《markdown 生成头条文章的一个思路》,周末就试了试。 先回顾一下思路,大致流程如下: 这里的三个关键点是: 提取code 把code 转换为html 把html 生成图片 code 替换成图片 第一个很简单,只有用正则表达式就可以解决: _fenced_code_block_re = re.compile(r''' (?:\n+|\A\n?) ^```\s*?([\w+-]+)?\s*?\n # opening fence, $1 = optional lang (.*?) # $2 = code block content ^```[ \t]*\n # closing fence ''', re.M | re.X | re.S) 这个正则来自 python-markdown2: https://github.com/trentm/python-markdown2 这个正则只匹配了 ``` 样式的代码,对于前边有四个空格的并没有做处理(也不想做处理,还是严格一点好)。 第二个也不麻烦,只需要把提取出的code 放到html 中,下面是一个html模板: <html> <head> <link rel="stylesheet" href="http://media.gusibi.mobi/highlight/static/styles/atom-one-dark.css"> <script src="http://media.gusibi.mobi/highlight/static/highlight.site.pack.js"></script> <script>hljs.initHighlightingOnLoad();</script> </head> <body style="width: 640px;"> <pre> <code class="{{.Language}}">{{.Code}}</code> </pre> </body> </html>` 这里有一个点是渲染html 页面的时候, 由于加载html 页面的工具都是get请求,这里我们需要先把code 数据保存起来。所以请求code 的html 页面分成了两步。 ...

2019-06-15 · 2 min · 260 words