System Calls - File and Directory
Definition
File
A container to contain data of a file (provides a linear space so that stores the data linearly).
Each file has a low-level name (inode number).
Directory
An implement directory tree (directory hierarchy).
It also has a low level name.
It contains a list of file name and inode number pair.
File Operationsopen System Call
Syntax: int open(const char *pathname, int oflags);
O_RDONLY: Read only
O_WRONLY: Write only
O_RDWR: Read and write.
O_CREAT: If the pathname does not exi ...
System Calls - Memory
Memory AllocationMemory API malloc
Description:
Allocate a memory region on the heap.
Syntax: void* malloc(size_t size)
size_t size: the size of the memory block (in bytes)
size_t: is an unsigned integer type
Return:
Success: a void type pointer to the memory block allocated by malloc
Fail: a null pointer
Function sizeof
Description:
Usually use size in malloc instead of typing a number.
Two types of results of sizeof
12345678/* The actual size of 'x' is known at run-time ...
System Calls - Processes
ProcessCharacteristics
A process contains:
A unique ID
A thread of control
Some private data
Parent-Child Links:
parent process: executes the request for creation of a process
child process: the created process
Noted: A child process inherits all the properties of its parent when it is created.
Process ID
Process ID (PID):
Each process has a unique ID number.
It’s use to identify different processes.
User ID (UID):
Each user has a unique user ID.
Each process is associated with the t ...
Python - List
列表基本使用列表基礎
列表基本使用 123456789101112131415# 聲明列表x = [1, 2, 3, 'Hello 1', 'Hello 2']# 遍歷列表for item in x: print(item, end = ' ') # 1 2 3 Hello 1 Hello 2# 根據索引獲取列表元素print(x[2]) # 3print(x[3]) # Hello 1print(x[-1]) # Hello 2print(x[-4]) # 2# 獲取列表長度len(x) # 5
列表切片
使用:講列表切割: 12345678910111213x = [1, 2, 3, 'Hello 1', 'Hello 2', 'Hello 3']x[0:3] # [1, 2, 3]x[3:6] # ['Hello 1', 'Hello 2', ...
Python - Basic
Print & Input
接收用戶輸入
使用input方法 1temp = input('Guess a number')
字符串語法
原始字符串r
在字符串的前面加上一個r,則表示原始字符串,轉譯字符則不再有效 1print(r"Hello World \n") # Hello World \n
長字符串
專門用於實現跨行字符串 123456x = """Hello World 1Hello World 2Hello World 3Hello World 4"""
字符串乘法複製
將字符串重複指定次數 1print('HelloWorld ' * 3) # HelloWorld HelloWorld HelloWorld
random module
生成隨機整數:
random.randint(a,b)隨機生成 a - b 的函數 1random.randint(1, 10)
獲取偽隨機 ...
VueJS Dependency - Easy-Circular-Progress
easy-circular-progressTo create a circular-progress-bar
Installation and Setup
circular-progress-bar
install
1npm install circular-progress-bar
import in components
1import Progress from 'easy-circular-progress/src/index.vue'
Prop Types
Property
Type
Description
strokeWidth
Number
the width of the progress circle
radius
Number
the inner circle radius
transitionDuration
Number
transitionDuration for the animation
strokeColors
String
e.g. ‘#aaff00’
value
Number
P ...
VueJS Dependency - Vue-Animate-Onscroll
vue-animate-onscrollA simple Vue directive that animates elements as they scroll into view.
Installation and Setup
animate.css
remember to install or import animate.css first.
install
1npm i v-animate-css
setup in main.js
123import VAnimateCss from 'v-animate-css'Vue.use(VAnimateCss)
vue-animate-onscroll
install
1npm install vue-animate-onscroll
setup in main.js
123import VueAnimateOnscoll from 'vue-animate-onscroll'Vue.use(VueAnimateOnscoll)
Usage
Bind
u ...
VueJS Implement - Images Gradient
Images Gradient in Vue2Realize image gradient effect in Vue2.
Template
Use as a wrapper for setting the gradient animations.
Use v-for directive to traverse the list of images.
Use v-show directive to show the current image and hide the others images.
Use :style directive to bind a background-image style for each and display each images as a background-image of the .
12345678910<transition-group tag="ul" name="img"> <li class="image-container" ...
NodeJS & MongoDB Interaction
MongoDB 交互數據庫
關係型數據庫 (SQL)
sql語句增刪改查操作
保持事務的一致性
非關係型數據庫 (No-SQL)
不用sql語句
輕量、高效、自由
數據庫概念: | SQL術語 | MongoDB術語 | 說明 | | :—-: | :—-: | :—-: | | database | database | 數據庫 | | table | collection | 數據庫表 | | row | document | 數據紀錄文檔 | | column | field | 數據字段 | | index | index | 索引 | | table.joins | | 表連結,MongoDB不支持 | | primary key | primary key | 主鍵,id |
MongoDB基本使用數據庫基本使用
啟動數據庫: 12./mongod --dbpath 'storage path'./mongo
操作數據庫: 1234567891011121314-- 1. 查詢當前數據庫show dbs-- 2. 查看當前數據庫 ...
Fetch
fetch基本認知
發送請求方法:
通過Ajax向服務器請求數據,使用XMLHttpRequest對象實現
123456const xhr = new XMLHttpRequest()xhr.open('GET', 'url')xhr.send()xhr.addEventListener('LOAD', () => { console.log(JSON.parse(xhr.response))})
通過axios實現,代碼精簡但底層仍然基於XMLHttpRequest對象實現,本質只是進行Promise封裝
fetch簡介:
被稱為下一代的Ajax技術,內部採用Promise方法處理數據 (可以直接使用.then)
API語法簡潔
採用模塊化設計,API分散於多個對象中 (Responnse對象、Request對象、Header對象)
通過數據流 (Stream對象)處理數據,可以分塊讀取,有利於提高網站性能
GET請求
簡介:
如果fetch()只接收一個url字符串參數 ...






