Codes commit procedure for daily work:
1 | $ git status # check current modifications |
see detailed changes from current code:
1 | $ git diff |
Add work:
1 | $ git add . # do not miss "." |
or
1 | $ git add -u |
or
1 | $ git add -A |
1 | $ git status # check current modifications |
see detailed changes from current code:
1 | $ git diff |
Add work:
1 | $ git add . # do not miss "." |
or
1 | $ git add -u |
or
1 | $ git add -A |
Display whole log file content:
1 | $ cat target.log |
Search key word in log file, and return lines containing keyword:
1 | $ cat target.log |grep "keyword" |
these two method return same result
Check the most recent log (the tail lines of log file):
1 | $ cat target.log |tail -n 200 # check the last 200 lines of log file |
refer https://www.jianshu.com/p/9b79ddf382b4
my.ini
refer https://www.jianshu.com/p/1c3a4a555b78
see https://stackoverflow.com/questions/36319265/the-mysql-service-could-not-be-started
check if my.ini
was not encoded with utf-8
1 | $ go env -w GOPROXY=https://goproxy.cn |
1 | input, _ := strconv.ParseInt(scanner.Text(), 10, 64) |
here the strconv
will return a set of two values, one for result and one for error exception, so we add the _
to catch the exception msg
https://www.cnblogs.com/baxianhua/p/10845620.html
Python不支持多个的參数重载构造函数,用classmethod修饰符的方式,定义出来的函数就能够在类对象实例化之前调用这些函数,就相当于多个构造函数,解决多个构造函数的代码写在类外面的问题
类最基本的作用是实例化出一个对象,但是有的时候再实例化之前,就需要先和类做一定的交互(init方法里需要调用类里的方法,或init之前需要调用类方法),这种交互可能会影响实际实例化的过程,所以必须放在调用构造函数之前。大概也可能是因为这个原因出现了classmethod
对于一个普通的类,我们要使用其中的函数的话,需要对类进行实例化,而一个类中,某个函数前面加上了staticmethod或者classmethod的话,那么这个函数就可以不通过实例化直接调用,可以通过类名进行调用的
类方法的第一个参数(cls)指代的就是类本身。类方法会用这个类来创建并返回最终的实例。使用类方法的另一个好处就是在继承的时候,保证了子类使用可选构造函数构造出来的类是子类的实例而不是父类的实例
staticmethod就是全局可调的静态方法
https://blog.csdn.net/mieleizhi0522/article/details/82142856
yield = return & generator
1 | $ python3 -m venv |
1 | $ . venv/Scripts/activate # windows |
1 | $ deactivate |
This article is created for recording problems encountered in my interview.
它是立即调用函数表达式(Immediately-Invoked Function Expression),简称 IIFE。函数被创建后立即被执行:
1 | (function IIFE(){ |
在避免污染全局命名空间时经常使用这种模式,因为 IIFE(与任何其他正常函数一样)内部的所有变量在其作用域之外都是不可见的。
ref: https://www.jianshu.com/p/d4d2eb4be216
Notes when learning Java.
Collecting useful data structure conception and tips in Java developing.
This is a recording of my study on React framework
super()
, it is for initializing this
, and can bind events to this
. this.props
in a constructor, also need to add super(props)
.this.props
can work in render(), this is auto-implemented by React)