凭海临风的IT江湖

  • 首页

  • 关于

  • 标签

  • 分类

  • 归档

  • 站点地图

  • 公益 404

  • 时间轴

  • 搜索

vscode Cannot edit in read-only editor

发表于 2019-12-12 | 更新于 2022-08-18 | 分类于 python , IDEs
本文字数: 205 | 阅读时长 ≈ 1 分钟

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

Install python3.8 on Centos6.5

发表于 2019-12-03 | 更新于 2022-08-18 | 分类于 linux
本文字数: 695 | 阅读时长 ≈ 1 分钟

1. 安装必要的工具

1
sudo yum install yum-utils

2. 使用 yum-builddep 命令 设置 python 编译环境,下载缺少的依赖

1
sudo yum-builddep python

3. 下载 python3 的源代码

源代码可以在 https://www.python.org/ftp/python/ 下载

1
curl -O https://www.python.org/ftp/python/3.8.0/Python-3.8.0a1.tgz

4. 对源代码进行解压并编译安装

1
2
3
4
tar xf Python-3.8.0a1.tgz
cd Python-3.8.0a1
./configure
sudo make && make install
阅读全文 »

ios devices list

发表于 2019-12-02 | 更新于 2022-08-18 | 分类于 ios
本文字数: 2k | 阅读时长 ≈ 2 分钟

ios 设备一览表

iPhone

设备 时间 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 diff usage

发表于 2019-11-21 | 更新于 2022-08-18 | 分类于 版本管理
本文字数: 799 | 阅读时长 ≈ 1 分钟

Git 中 diff 命令使用

整理总结工作中常用的git 命令, 今天是一个非常有用的命令 git diff

主要作用是用来比较差异,包括 commits之间,commit 和 工作区间 差异

命令格式如下:

1
2
3
4
5
git diff [<options>] [<commit>] [--] [<path>…​]
git diff [<options>] --cached [<commit>] [--] [<path>…​]
git diff [<options>] <commit> <commit> [--] [<path>…​]
git diff [<options>] <blob> <blob>
git diff [<options>] --no-index [--] <path> <path>

1. 比较工作区与暂存区

1
git diff 不加参数

2. 比较暂存区与 本地 最新版本 (最后一次commit)

1
git diff --cached

3. 比较工作区与最新本地版本库

1
git diff HEAD

4. 比较工作区与commit-id的差异

1
git diff commit-id

5. 比较暂存区与指定commit-id的差异

1
git diff --cached commit-id
阅读全文 »

javascript get checkbox checked value

发表于 2019-09-28 | 更新于 2022-08-18 | 分类于 javascript
本文字数: 2.3k | 阅读时长 ≈ 2 分钟

javascript如何获取checkbox被选中的值

预备知识

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”
阅读全文 »

javascript中Boolean_Object与Boolean_Primitives

发表于 2019-09-20 | 更新于 2022-08-18 | 分类于 javascript
本文字数: 1.5k | 阅读时长 ≈ 1 分钟

先看下面的脚本,预测下结果

1
2
3
4
5
6
var flag = true;
console.log(typeof(flag));//boolean
var fa = Boolean(true);
console.log(typeof(fa));//boolean
var ff = new Boolean(true);
console.log(typeof(ff)); //Object

在 jslint中明确提示 new Boolean(true);do not use Boolean as a constructor. (W053)jshint(W053)

接下来的例子

1
2
3
4
5
6
7
8
9
if(flag){
console.log("true is true");
}
if(fa){
console.log("Boolean is true");
}
if(ff){
console.log("Object Boolean is true");
}

结果如下

1
2
3
true is true
Boolean is true
Object Boolean is true

修改脚本:

1
2
3
4
5
6
var flag = true;
console.log(typeof(false));//boolean
var fa = Boolean(false);
console.log(typeof(fa));//boolean
var ff = new Boolean(false);
console.log(typeof(ff)); //Object

结果竟然显示:

1
Object Boolean is true
阅读全文 »

how to add 163 music to hexo

发表于 2019-09-06 | 更新于 2022-08-18 | 分类于 搭建博客
本文字数: 495 | 阅读时长 ≈ 1 分钟

如何给hexo添加网易音乐

先看看效果

博客添加网易音乐.png

1.访问网易云首页,选择你喜欢的音乐,点击生成外链,我不希望音乐一直播放,如果来访的朋友想听,点击下播放就好。

这里我选择二十岁的某一天

阅读全文 »

how to Sort Python Dictionaries by Key or Value

发表于 2019-07-28 | 更新于 2022-08-18 | 分类于 python
本文字数: 2.2k | 阅读时长 ≈ 2 分钟

众所周知,python中字典是无序的,那么该如何对字典排序呢?

例如下面的字典:

1
numbers = {'second': 2,'first': 1,  'third': 3, 'Fourth': 4}

我们可以通过list()函数打印value,

1
2
>>>list(numbers)
['second', 'first', 'third', 'Fourth']

备注:

python3.6.4 以上的版本,字典根据插入的顺序自动排序

如何根据key 对字典排序

可以使用python的内置函数sorted 来对字典排序,如下面的代码

1
2
>>> sorted(numbers)
['Fourth', 'first', 'second', 'third']

结果有点差强人意,因为默认sorted函数是根据字母的顺序升序排列的,这里的字典中 key 恰好是字母,所以才会显示这个结果。

根据value对字典排序

用同样的方法,我们可以根据value来排序

1
2
>>> sorted(numbers.values())
[1, 2, 3, 4]
阅读全文 »

javascript-undefined-description

发表于 2019-06-11 | 更新于 2022-08-18 | 分类于 javascript
本文字数: 821 | 阅读时长 ≈ 1 分钟

Javascript 基础拾遗之undefined

先看一个例子:

1
2
3
var a;
console.log(a);//undefined
console.log(typeof(a)); //undefined

javascript中的数据类型包括undefined,null,boolean,number,string,boolean六种类型(ECMAScript 2015)

undefined 小结

undefined 类型的意思是当前对象未定义,适用于下面几种情况

  1. 变量声明,但未赋值
  2. 对象没有赋值的属性,该属性的值为undefined
  3. 调用函数参数,但是未提供参数,该参数的值为undefined
  4. 函数没有返回值时,默认返回undefined

再看下面的例子

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//1.
var i;
console.log(i);
//2.
var o = new Object();
console.log(o.p);
//3.
function test(a){
console.log(typeof a); // undefined
return a;
}
test();
//4.
myfunc()
function myfunc(){
//console.log("my function.");
}
console.log(myfunc());

需要区别下面这个情况,不同浏览器提示信息可能会不同(Chrome和IE测试)

1
2
console.log(b);
// Uncaught ReferenceError: b is not defined

如何判断为空

下面三种判断方法:

1
2
3
4
5
6
// 方式1
if(typeof age === 'undefined')
// 方式2
if(age === undefined)
// 方式3
if(varName) //万能判断,包括boolean

参考文档

火狐JavaScript教程

stackoverflow如何检查undefined

Build path entry is missing /src/test/java missing问题解决

发表于 2019-06-03 | 更新于 2022-08-18 | 分类于 javaweb
本文字数: 162 | 阅读时长 ≈ 1 分钟

[问题描述]

通过maven构建webapp,发现缺少java和test目录

[解决方案]

project –right click –build path– config build path – libraries – double click “JRE System Library”–choose “workspace default JRE” OK

如下图所示

1…111213…15
Jeff Sui

Jeff Sui

146 日志
35 分类
166 标签
RSS
GitHub E-Mail
  • 20201
  • 2to31
  • Boolean1
  • Centos2
  • Exception1
  • GIL1
  • GitGutter1
  • Tkinter1
  • TypeScript2
  • XML2
  • __all__1
  • _thread1
  • app1
  • argparse2
  • array1
  • atexit1
  • bisect1
  • calendar1
  • centos1
  • checkbox1
  • cmath1
  • cmd1
  • code1
  • collections.abc1
  • concurrent1
  • context-manager-types1
  • cookies1
  • copy1
  • coroutines1
  • csv1
  • cygwin1
  • dataclasses1
  • dbm1
  • dict1
  • dictionary1
  • difflib1
  • dis1
  • django4
  • docker3
  • doctest1
  • dom1
  • eclipse1
  • enum1
  • es61
  • esp323
  • esptool1
  • ffmpeg1
  • filecmp1
  • fileinput1
  • fractions1
  • functools1
  • futures1
  • gc1
  • generator1
  • git4
  • gitcafe1
  • github1
  • glob1
  • heapq1
  • hexo2
  • html.parser1
  • http2
  • http.server1
  • ios1
  • iterator1
  • itertools1
  • java3
  • javascript6
  • javaweb2
  • jdk1
  • jira1
  • json1
  • juypter1
  • keyword1
  • linecache1
  • linux2
  • lite-server1
  • m3u81
  • maven4
  • micorpython1
  • micropython2
  • minidom1
  • modulefinder1
  • mongodb1
  • mybatis1
  • mysql1
  • nbextension1
  • nginx1
  • nodejs1
  • oop1
  • operator1
  • os1
  • os.path1
  • others1
  • photo1
  • pickle1
  • pprint1
  • pwd1
  • python94
  • python31
  • queue1
  • re1
  • readline1
  • registry2
  • registry-ui2
  • reprlib1
  • sax1
  • sched1
  • select1
  • selectors1
  • selenium3
  • shutil1
  • socket1
  • sort1
  • spring1
  • sqlite32
  • ssm1
  • standar_library1
  • standard_library78
  • statistics1
  • string1
  • sublime1
  • tempfile1
  • this1
  • thread1
  • timeit1
  • turtle2
  • types1
  • uPycraft1
  • unittest1
  • urllib.robotparser1
  • uuid1
  • uv1
  • venv1
  • vscode1
  • weakref1
  • web test2
  • webbrowser1
  • webrepl1
  • windows3
  • xml2
  • 二维码1
  • 办公1
  • 博客3
  • 坑1
  • 字典1
  • 异步1
  • 循环1
  • 感悟1
  • 持续集成1
  • 搭建1
  • 搭建博客1
  • 文章1
  • 杂记3
  • 版本管理2
  • 短网址1
  • 禅道1
  • 笔记1
  • 约束1
  • 网易音乐1
  • 美化1
  • 自动化测试1
  • 软件工程1
  • 逆向工程1
  • 闭包1
  • 项目管理2
© 2015 – 2025 Jeff Sui | 811k | 12:18
由 Hexo 强力驱动 v3.9.0
|
主题 – NexT.Gemini v7.1.1
|
0%