《Linux命令行与shell脚本编程大全》 笔记

自定义函数

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
# using a function in a script

function func1 {
echo "This is an example of a function"
}

# 另一种定义函数的方式
func2() {
echo "This is an example of a function"
}

count=1
while [ $count -le 5 ]
do
func1
count=$[ $count + 1 ]
done
echo "This is the end of the loop"
func1
echo "Now this is the end of the script"

函数名必须是唯一的,否则就会出问题。如果定义了同名函数,那么新定义就会覆盖函数原先的定义,而这一切不会有任何错误消息。

阅读全文 »

《Linux命令行与shell脚本编程大全》 笔记

执行脚本

添加执行权限:

1
chmod +x test.sh

执行脚本时,使用相对路径或绝对路径:

1
./test.sh

或将脚本所在路径添加到 PATH 环境变量:

1
export PATH=$PATH:/your/path

执行命令

1
2
3
#!/bin/bash
date
who
1
2
3
#!/bin/bash
# 在一行中用分号分隔多个命令
date ; who

显示消息

1
2
3
4
echo hello world
echo "Let's see if this'll work"
# 不输出换行
echo -n "The time and date are: "
阅读全文 »

尚硅谷前端html+css零基础教程,2023最新前端开发html5+css3视频

HTML4

网页基本结构

1
2
3
4
5
6
7
8
9
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
</body>
</html>

安装 Live Server 插件

VSCode 安装 Live Server 插件。代码出现改动,页面可以自动刷新。

注释

1
<!-- 注释 -->

文档声明

作用是告诉浏览器当前网页的版本。

1
<!DOCTYPE html>
阅读全文 »

尚硅谷Vue2.0+Vue3.0全套教程丨vuejs从入门到精通

初识Vue

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>初识Vue</title>
<!-- 引入Vue -->
<script type="text/javascript" src="../js/vue.js"></script>
</head>
<body>
<!-- 准备好一个容器 -->
<div id="demo">
<h1>Hello,{{name.toUpperCase()}},{{address}}</h1>
</div>

<script type="text/javascript" >
Vue.config.productionTip = false //阻止 vue 在启动时生成生产提示。

//创建Vue实例
new Vue({
el:'#demo', //el用于指定当前Vue实例为哪个容器服务,值通常为css选择器字符串。
data:{ //data中用于存储数据,数据供el所指定的容器去使用,值我们暂时先写成一个对象。
name:'atguigu',
address:'北京'
}
})

</script>
</body>
</html>
阅读全文 »

State

配合使用:state、states、PropertyChanges。

Item 属性:state 当前状态,states 定义所有状态。

非 Item 对象通过 StateGroup 来使用 State。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Rectangle {
id: signal
width: 200; height: 200
state: "NORMAL"

states: [
State {
name: "NORMAL"
PropertyChanges { target: signal; color: "green"}
PropertyChanges { target: flag; state: "FLAG_DOWN"}
},
State {
name: "CRITICAL"
PropertyChanges { target: signal; color: "red"}
PropertyChanges { target: flag; state: "FLAG_UP"}
}
]
}

when 属性:

1
2
3
4
5
6
7
8
9
10
11
Rectangle {
id: bell
width: 75; height: 75
color: "yellow"

states: State {
name: "RINGING"
when: (signal.state == "CRITICAL")
PropertyChanges {target: speaker; play: "RING!"}
}
}
阅读全文 »

简介

Qt Remote Objects (QtRO) 是 Qt 的一个进程间通信模块。

术语

Source 是指提供服务或提供功能供其他程序使用的对象,是 RPC 中的被调用端。

Replica 是指 Source 对象的代理对象,用于 RPC 中的调用端,对 Replica 的调用请求将被转发给 Source 对象。

示例1:Direct Connection using a Static Source

创建接口定义文件

创建接口定义文件 simpleswitch.rep :

1
2
3
4
5
class SimpleSwitch
{
PROP(bool currState=false);
SLOT(server_slot(bool clientState));
};

修改 .pro 文件

1
2
3
4
// 引入 QtRO 模块
QT += remoteobjects
// 引入接口定义文件
REPC_SOURCE = simpleswitch.rep
阅读全文 »

https://curl.haxx.se/libcurl/c/libcurl-tutorial.html

基础

初始化,参数指定要初始化的模块:

1
curl_global_init(CURL_GLOBAL_ALL);

如果没有调用 curl_global_initcurl_easy_perform 会自动调用。

1
2
CURL_GLOBAL_WIN32
CURL_GLOBAL_SSL

当不再使用 libcurl 时调用:

1
curl_global_cleanup();

init 和 cleanup 避免重复调用,应只调用一次。

查询libcurl支持的特性:

1
curl_version_info();

libcurl 提供两种接口:

  1. easy interface - 函数以 curl_easy 为前缀,同步、阻塞调用。(let you do single transfers with a synchronous and blocking function call)
  2. multi interface - 支持在一个线程中多个传输任务,异步。(allows multiple simultaneous transfers in a single thread)
阅读全文 »

基础概念

https://www.ruanyifeng.com/blog/2020/01/ffmpeg.html

码率

比特率,bps,每秒位数。

muxer

封装,把视频流、音频流、字幕流等封装到一个容器格式中。

demuxer

从容器格式中分离出流。

容器

视频文件本身其实是一个容器(container),里面包括了视频和音频,也可能有字幕等其他内容。

查看 ffmpeg 支持的容器:

1
ffmpeg -formats

编码格式

视频和音频都需要经过编码,才能保存成文件。不同的编码格式(CODEC),有不同的压缩率,会导致文件大小和清晰度的差异。比如H.264就是一种视频编码格式。

查看 ffmpeg 支持的编码格式:

1
ffmpeg -codecs
阅读全文 »

http://rapidjson.org/zh-cn/

用法一览

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// rapidjson/example/simpledom/simpledom.cpp
#include "rapidjson/document.h"
#include "rapidjson/writer.h"
#include "rapidjson/stringbuffer.h"
#include <iostream>

using namespace rapidjson;

int main() {
// 1. Parse a JSON string into DOM.
const char* json = "{\"project\":\"rapidjson\",\"stars\":10}";
Document d;
d.Parse(json);

// 2. Modify it by DOM.
Value& s = d["stars"];
s.SetInt(s.GetInt() + 1);

// 3. Stringify the DOM
StringBuffer buffer;
Writer<StringBuffer> writer(buffer);
d.Accept(writer);

// Output {"project":"rapidjson","stars":11}
std::cout << buffer.GetString() << std::endl;
return 0;
}
阅读全文 »
0%