學習紀錄(Week1)
===
## Goal
* [x] [軟體缺失導致的危害](https://hackmd.io/@sysprog/software-failure)
* [ ] [解讀計算機編碼](https://hackmd.io/@sysprog/binary-representation)
* [ ] [Lab0](https://hackmd.io/@sysprog/linux2021-lab0)
## 每日log
### 2021/12/29
:::spoiler
* Linux installation is completed ([輕鬆學會 Windows Ubuntu 雙系統安裝](https://www.youtube.com/watch?v=KkcA5tF1fpE))
* Finished MD intro video ([從無到有學習HackMD](https://www.youtube.com/watch?v=1NMk8YIUulQ))
* Generated SSH Key and added to Github
* Finished Git installation and initial commit ([安裝與設定](https://www.youtube.com/watch?v=LZ4oOzZwgrk))
* Use `git config --global alias.st status` to change original command `git status` into `git st` (simpler command)
* Use `git config --global core.editor + prefered editor`, for example, `git config --global core.editor vim`
:::
### 2021/12/30
:::spoiler
* Add and commit ([Add and commit](https://www.youtube.com/watch?v=ePaU_kS3rUs))
* Do not put every change into one commit, it should be seperated into several commit by using `git add -p + filename` (Key idea: one commit, one function).
* 50/72 rule
* First line 50 charactors (upper limit)
* After first line, each line can type up to 72 charactors.
* .gitignore
* Use `vim .gitignore` to create .gitignore file
* Add filename you don't want when commiting
```
filename1
filename2
*.swp
/filename3
...
```
* `/` means only the file under current folder. If a file with same name in other folder, it will still be commited.
* If file is untracted, use`git add <file>` -> Staged and Wait commitIf
If file is tracted but not staged, use `git add (-p) <file>`-> Staged and Wait commit 
* Finished [軟體缺失導致的危機](https://hackmd.io/@sysprog/software-failure)
* Part of [解讀計算機編碼](https://hackmd.io/@sysprog/binary-representation)
* sign & magnitude
* Representation: -43~10~ = 10101011~2~
* Pros: Intuitive
* Cons: Hard to carry(進位) and borrow(借位) 、circuit is comlicated、two expression of `0`
:::
### 2021/12/31
:::spoiler
#### [解讀計算機編碼](https://hackmd.io/@sysprog/binary-representation)
##### one's complement (一補數)
###### Goal
Solve difficulties in sign & magnitude
###### Representation
==Positive value==: Same as sign & magnitude
==Negative value==: Flip each bit.
For example,
43~10~ = 00101011~2~
-43~10~ = 11010100~2~
###### Pros
1. No subtraction needed
```
二進位 十進位
11111110 -1
+ 00000010 +2
............ ...
1 00000000 0 <-- 錯誤答案
1 +1 <-- 加上進位
............ ...
00000001 1 <-- 正確數值
If overflow happened, use end-around carry (add 1 on LSB)
From https://hackmd.io/@sysprog/binary-representation
```
:::
---