vscode Cannot edit in read-only editor 错误解决
原因
使用了
Run Code
插件,output是只读的
解决方法
将 run code设置为在Terminal中运行
1 | File -> Preferences -> Settings |
找到 run code in terminal
打上 √
或 在settings.json文件中,添加一行配置信息
1 | "code-runner.runInTerminal": true |
1 | sudo yum install yum-utils |
1 | sudo yum-builddep python |
源代码可以在 https://www.python.org/ftp/python/ 下载
1 | curl -O https://www.python.org/ftp/python/3.8.0/Python-3.8.0a1.tgz |
1 | tar xf Python-3.8.0a1.tgz |
设备 | 时间 | CPU | 分辨率 | 大小 | 密度 | @Nx | iOS系统 |
---|---|---|---|---|---|---|---|
iPhone | 2007 | armv6 | 320 x 480 | 3.5 | 165 | @1x | 1.0 - 3.1.3 |
iPhone 3G | 2008 | armv6 | 320 x 480 | 3.5 | 165 | @1x | 2.0 - 4.2.1 |
iPhone 3GS | 2009 | armv7 | 320 x 480 | 3.5 | 165 | @1x | 3.0 - 6.1.4 |
iPhone 4 (GSM) | 2010 | armv7 | 640 x 960 | 3.5 | 330 | @2x | 4.0 - 7.1.2 |
iPhone 4 (CDMA) | 2011 | armv7 | 640 x 960 | 3.5 | 330 | @2x | 4.2.4 - 7.1.2 |
iPhone 4S | 2011 | armv7 | 640 x 960 | 3.5 | 330 | @2x | 5.0 - 9.3.5 |
iPhone 5 | 2012 | armv7s | 640 x 1136 | 4 | 326 | @2x | 6.0 - 10.3.3 |
iPhone 5c | 2013 | armv7s | 640 x 1136 | 4 | 326 | @2x | 7.0 - 10.3.3 |
iPhone 5s | 2013 | arm64 | 640 x 1136 | 4 | 326 | @2x | 7.0 - |
iPhone 6 | 2014 | arm64 | 750 x 1334 | 4.7 | 326 | @2x | 8.0 - |
iPhone 6 Plus | 2014 | arm64 | 1242 x 2208 | 5.5 | 461 | @3x | 8.0 - |
iPhone 6s | 2015 | arm64 | 750 x 1334 | 4.7 | 326 | @2x | 9.0 - |
iPhone 6s Plus | 2015 | arm64 | 1242 x 2208 | 5.5 | 461 | @3x | 9.0 - |
iPhone SE | 2016 | arm64 | 640 x 1136 | 4 | 326 | @2x | 9.3 - |
iPhone 7 | 2016 | arm64 | 750 x 1334 | 4.7 | 326 | @2x | 10.0 - |
iPhone 7 Plus | 2016 | arm64 | 1242 x 2208 | 5.5 | 461 | @3x | 10.0 - |
iPhone 8 | 2017 | arm64 | 750 x 1334 | 4.7 | 326 | @2x | 11.0 - |
iPhone 8 Plus | 2017 | arm64 | 1242 x 2208 | 5.5 | 461 | @3x | 11.0 - |
iPhone X | 2017 | arm64 | 1125 x 2436 | 5.8 | 463 | @3x | 11.0 - |
iPhone XS | 2018 | arm64 | 1125 x 2436 | 5.8 | 463 | @3x | 12.0 - |
iPhone XS Max | 2018 | arm64 | 1242 x 2688 | 6.5 | 458 | @3x | 12.0 - |
iPhone XR | 2018 | arm64 | 828 x 1792 | 6.1 | 326 | @2x | 12.0 - |
iPhone 11 | 2019 | arm64 | 828 x 1792 | 6.1 | 326 | @2x | 13.0 - |
iPhone 11 Pro | 2019 | arm64 | 1125 x 2436 | 5.8 | 458 | @3x | 13.0 - |
iPhone 11 Pro Max | 2019 | arm64 | 1242 x 2688 | 6.5 | 458 | @3x | 13.0 - |
注:屏幕分辨率单位为英寸(inch),分辨率密度单位为ppi
整理总结工作中常用的git
命令, 今天是一个非常有用的命令 git diff
主要作用是用来比较差异,包括 commits
之间,commit
和 工作区间 差异
命令格式如下:
1 | git diff [<options>] [<commit>] [--] [<path>…] |
1 | git diff 不加参数 |
1 | git diff --cached |
1 | git diff HEAD |
1 | git diff commit-id |
1 | git diff --cached commit-id |
javascript dom 常用方法
方法名 | 描述 | 例子 |
---|---|---|
document.getElementById | 返回给定id属性值的元素节点相对应的对象 | |
document.getElementsByTagName | 返回给定name属性的元素节点对应的元素集合 | var hobbies = document.getElementsByName(“hobbies”); |
element.nextSibling | 返回该元素紧跟的一个节点 | |
nodeValue | 获取节点中的文本值 ,例如:跑步 | 跑步 |
数组常用方法:
方法 或者 属性 | 说明 | 例子 |
---|---|---|
arrayObject.length | 属性:数组长度 | |
arrayObject.push() | 向数组末尾添加一个或多个元素 | var arr = new Array(3) arr[0] = “George” arr[1] = “John” arr[2] = “Thomas” |
先看下面的脚本,预测下结果
1 | var flag = true; |
在 jslint中明确提示 new Boolean(true);do not use Boolean as a constructor. (W053)jshint(W053)
接下来的例子
1 | if(flag){ |
结果如下
1 | true is true |
修改脚本:
1 | var flag = true; |
结果竟然显示:
1 | Object Boolean is true |
众所周知,python中字典是无序的,那么该如何对字典排序呢?
例如下面的字典:
1 | numbers = {'second': 2,'first': 1, 'third': 3, 'Fourth': 4} |
我们可以通过list()函数打印value,1
2>>>list(numbers)
['second', 'first', 'third', 'Fourth']
备注:
python3.6.4 以上的版本,字典根据插入的顺序自动排序
可以使用python的内置函数sorted
来对字典排序,如下面的代码
1 | >>> sorted(numbers) |
结果有点差强人意,因为默认sorted
函数是根据字母的顺序升序排列的,这里的字典中 key 恰好是字母,所以才会显示这个结果。
用同样的方法,我们可以根据value来排序
1 | >>> sorted(numbers.values()) |
先看一个例子:
1 | var a; |
javascript中的数据类型包括undefined
,null
,boolean
,number
,string
,boolean
六种类型(ECMAScript 2015)
undefined 类型的意思是当前对象未定义,适用于下面几种情况
再看下面的例子
1 | //1. |
需要区别下面这个情况,不同浏览器提示信息可能会不同(Chrome和IE测试)
1 | console.log(b); |
下面三种判断方法:
1 | // 方式1 |