From cde48546bdbc6d0cb11134be3c0e9851af120376 Mon Sep 17 00:00:00 2001
From: ninglang
Function declaration
-if Function declaration's parameter is empty of
-void
,This two declaration in c++ are same :
f(); //This function don't carray any parameters |
but they are different in c:
-f(void); //This function don't carray any parameters |
Macro definition
-Macro definition may cause some error that we can't expect ,for -example:
-
|
in line 8 ,we are expecting the result is :
-1+2 doubled is 6 |
but in fact ,the result is :
-1+2 double is 5 |
because the macro definition is replace the expression in the place -where it is called :
-cout<<"1+2 doubled is "<<doub(1+2)<<endl; |
Inline function
-to avoid the unsafe of Marco definition ,We can use inline function -to replace the macro function to achieve more safe :
-
|
function with default value of parameters
-the parameters with default value must be in the right of parameters -with no initial value:
-int fun(int i ,int j=5,int k); //incorrect |
Function Overloading
-The same function name can be used to define different tasks
-
|
if only the type of return is not the same ,the numbers of parameter -and the type of parameters is same,The function couldn't be -overloaded:
-int nihao(int x,int y); |
if the overloading function with default value parameter, it can be -incorrect :
-void nihao(int a,int b=0); |
Priority
-Local variables have higher priority than global variables
-
|
if global variables wants to be called in function ,we can add
-::
in the front of variables
cout<<"local variable"<<avar<<endl; |
What is the Union
-Union is a custom type ,we can create union in two way in c:
-union data{ |
union's space is the largest memory footprint of all member
-,int
,char
,double
,the double's
-memory footprint is largest ,so the union data's memory footprint is 8
-bits(the size of double
)
|
you may get the result as follows:
-4,4 |
so the result prove that union members will have Influence each -other, if you change one member's value ,the other member's value is -changed
How to store data
-Union 's data is shared for all member ,so one of they is changed -,others will be effected,but the process is how to go
-Using union
-student information and teacher information is recorded by the same -struct ,but some place are different,for example:
-name | -Num | -Sex | -Profession | -Score/course | -
---|---|---|---|---|
A | -1 | -f | -s | -89 | -
B | -2 | -m | -t | -math | -
|
definition
-give variables a another name after quoted ,the two variables are -equivalent when one of them changed ,the other will change
-int i =5; |
but j definited in following way is not allowed:
-int i; |
quote and pointer
-quote is another name for a variable ,but pointer is a tool pointing -to variable
-
|
quote: No need &
,pointer : Need *
-.
warn
-int i,k; |
void &r = 10; //incorrect, void type is not allow |
used as parameters of function
-
|
quotation is used as formal parameter for function variable -transfer,but it seem that we have really passed a,b into the function -"swap"
-
|
--将发送端数字脉冲信号转换成模拟信号的过程称为调制(Modulation);将接收端模拟信号还原成数字脉冲信号的过程称为解调(Demodulation)。将调制和解调两种功能结合在一起的设备称为调制解调器(Modem)
-模拟信号和数字信号之间可以相互转换:模拟信号一般通过PCM脉码调制(Pulse -Code -Modulation)方法量化为数字信号,即让模拟信号的不同幅度分别对应不同的二进制值,例如采用8位编码可将模拟信号量化为2^8=256个量级,实用中常采取24位或30位编码;数字信号一般通过对载波进行移相(Phase -Shift)的方法转换为模拟信号。
-数字信道占用信道频带较宽。一路模拟电话的频带为4kHz带宽,一路数字电话约占64kHz,这是模拟通信目前仍有生命力的主要原因。
-
数字信道与模拟信道_模拟信道和数字信道_偷轮子的博客-CSDN博客
--- -从上图可以看出,相关时延大于符号持续时间,因此,当两个信号在接收侧相加时,来自于时延为的符号将会和来自于时延为的符号相加。
-不同的符号相加,或者说,不同的符号相互干扰,即为符号间干扰(ISI)。
-一般将多径信号最大时延的倒数定义为多径信道的相关带宽。
---频率选择性失真和ISI是一体两面,其中,频率选择性失真发生在频域,对应的时域结果为ISI
-
--脉冲整形
-一、矩形脉冲
-实际上矩形脉冲无失真传输是不可能的,因为由傅里叶变换可知,时域矩形脉冲,频域是sinc函数,带宽无限,而信道带宽总是有限的。 -失真严重导致采样判决出错,无法正确恢复数字信号。 -显然矩形脉冲信号不合适,sinc脉冲信号合适
-二、sinc脉冲 其频谱有限,一个码元达到最大幅值时其他所有码元幅值刚好为零,码元之间不会相互影响,实现了无码间串扰。
-基带滤波器
-一般使用基带滤波器来实现脉冲整形
-假设发送序列{1 1 1 -1 1 -1 -1 1} -发送序列、输入滤波器的冲激信号、每个冲激信号的冲激响应,和输出信号如图所示 -例子
-
基带信号的发送和接收的有效理解和掌握_滚降因子为0的系统可以算是理想低通系统吗_BIT小小书童的博客-CSDN博客
---最初,信号是以矩形脉冲通过带限信道,必然会出现脉冲时延扩展引起S1,频域上看是Sa函数的旁瓣千扰。
-
简单概述:脉冲成形 -基带成形 (脉冲成型 基带成型) - HQU小西西 - 博客园
-有点难,待会看
-为什么要对基带信号进行脉冲成型【转载】 -- Riden - 博客园
---为什么对基带信号要成形滤波?
-基带信号带宽无限,需要限制带宽。成形滤波器也叫限带滤波器
-实际中通信传输的信号大都是带通信号,也就是中心频带远大于频带宽度的信号。而这些带通信号的频谱结构只取决于等效低通信号的频谱结构。这里的等效低通信号就是你这里所指的基带数字信号。而基带数字信号的频率特性又取决于两个因素,一个是基带信号中构成每个脉冲符号的基本信号的频谱,另一个就是脉冲信号之间的相关性。换句话说可以通过设计不同的基本脉冲信号的波形和符号之间的相关性,达到改变基带信号频谱结构的目的,从而改变调制后带通信号的频谱特性。 -理解了这一点,你就可以理解为什么要对基带信号进行不同的滤波生成符号脉冲了。
-
基带传输与成形滤波_基带成型滤波器_长弓的坚持的博客-CSDN博客
---为什么要->这里有直接结论:
-(个人简单理解,脉冲成型(形),就是将脉冲变成其他的传输波形,理由就是压缩频谱来降低ISI) -!
-
简单概述:脉冲成形 -基带成形 (脉冲成型 基带成型) - 1024搜-程序员专属的搜索引擎
---]]>数字信号想要在信道中传输,必须在发射机的基带部分进行脉冲成形,将数字信号转换成脉冲信号,脉冲信号到达接收机后,在基带部分进行采样判决,将数字信号恢复出来。
-如下图所示,脉冲成形需要用到脉冲波形,实现脉冲成形要用到基带滤波器,评估基带滤波器要用到眼图。【深入浅出通信原理-学习笔记】基带信号的发送和接收_脉冲怎么发送和接受_DUANDAUNNN的博客-CSDN博客
-
def fibo(n): |
-既然Fibonacci数列的递归计算如此复杂,那么,我们应该想什么办法来优化整个算法呢,我们考虑到,Fibonacci之所以复杂,是因为递归的存在,导致整个程序的时间复杂度都十分的高那么我们有没有简单一点的方法呢,对了,我们可以采用记录的方式,将每一个点之前的Fibonacci的数值都保存下来
-def Fibo(n): |
-我们调用了相关的带有memo的Fibo函数之后,明显发现,整个速度提升了很多,整个计算没有超过一秒钟,显然,这种方法是很有效的,我们称这个memo为DP数组
-输出:4
-解释:偷窃 1 号房屋 (金额 = 1) ,然后偷窃 3 号房屋 (金额 = 3)。
-偷窃到的最高金额 = 1 + 3 = 4 。
-对于小偷问题,我们可以这么去思考,就是我们新建一个DP数组,用来储存小偷走到这个点时之前可以得到的最大的收益,如果按照这种思路,然后去整个数组的最大值
-def steal(): |
在一个 m*n -的棋盘的每一格都放有一个礼物,每个礼物都有一定的价值(价值大于 -0)。你可以从棋盘的左上角开始拿格子里的礼物,并每次向右或者向下移动一格、直到到达棋盘的右下角。给定一个棋盘及其上面的礼物的价值,请计算你最多能拿到多少价值的礼物?
-输入:
-[
-[1,3,1],
-[1,5,1],
-[4,2,1]
-]
-输出: 12
-解释: 路径 1→3→5→2→1 可以拿到最多价值的礼物
- - -我们要计算从左上角到右下角最大的礼物价值,我们不妨这么思考,我们还是新建一个DP数组,这个DP数组应该是二维的,然后考虑DP数组是左上角到达每个点的最大价值,又因为路线只能右走或者下走。所以当其为横向、纵向的边界时,我们只要考虑左边、上面
-def gift(): |
给你一个整数数组 coins ,表示不同面额的硬币;以及一个整数 amount -,表示总金额。计算并返回可以凑成总金额所需的 最少的硬币个数 -。如果没有任何一种硬币组合能组成总金额,返回 -1 -。你可以认为每种硬币的数量是无限的。
-输入:coins = [1, 2, 5], S = 11
-输出:3
-解释:11 = 5 + 5 + 1
-输入:coins = [2], S = 3
-输出:-1
- -\[ -f(x)=min\{f(x-c_1),f(x-c_2),...f(x-c_m)\}+1 -\]
-如果\(x-c_i<0\),则令\(f(x-c_i)=\infty\)这样就不会选这个\(f(x-c_i)\)了
-如果\(x-c_i=0\),那么\(f(x-c_i)=0\)即\(f(0)=0\)
-def change_coins(): |
现在我们已经知道硬币的最少组合为3,那我们如何得到是哪些硬币的组合
-思路: -我们可以将S=11的最小硬币数是3分解一下,例如,硬币数是3,说明[1,2,5]中的三个可以组成,于是我们可以一个一个的遍历,看当11减去其中的一些数之后判断一下剩余的需要的最小硬币数是不是2,例如:11-1,然后:凑成10元的所需硬币数最小是2吗,是的话,跳出遍历,选择这一10继续分解,不是的话,继续遍历下面的,直到S=0说明已经遍历到0了,可以结束
-如何得到硬币的组合呢(5,5,1)
-def find_coins(S): |
-有10件货物要从甲地运送到乙地,每件货物的重量(单位:吨)和利润(单位:元)
-如下表所示:
- - -由于只有--辆最大载重为30t的货车能用来运送货物,所以只能选择部分货物配送,要求确定运送哪些货物,使得运送这些货物的总利润最大。
-思路:
- 有m件物品,第i件物品的利润为\(v_i\)重量为\(w_i\)背包的总重量为W.
-原问题:在满足重量约束的条件下,将这m个物品选择性放入容量为W的背包所能获得的最大利润
-子问题:在满足重量的约束条件下,将i(\(i\le -m\))件物品选择性放入容量为j(\(j \le -W\))的背包所获得的最大利润
-状态分析:
- -我们要讲m件商品装进容量为W的背包,我们可以假设背包是从1,2,3,4...增大的容量,物品从第一次只装第一个产品,然后慢慢推广到前i个产品,所以DP表格其实是在背包容量为i的情况下,能装的礼物的最大价值
- -对于第一行来说,装的物品为第一个物品,所以只需要判断背包容量是否大于第一件物品的重量,若大于,则最大价值为第一件物品的价值
- -对于第一列来说,背包容量为1,装进前i件物品的最大价值,由于物品的重量始终为整数,所以在前i件物品里,我们要看有没有总量为1的物品,若没有,则什么也装不进去,那么最大价值为0,若有(可能有几个),则去前i个产品中重量为1的所有物品中价值最大的那个为该点dp表的值
- 对于其它的列来说,需要用到状态转移方程,对于要求前\(i\)件物品装进容量为\(j\)的背包,在\(i-1\)的基础上只需要考虑到底装不装第\(i\)件物品,那么怎么考虑呢?要装第\(i\)件物品首先,第\(i\)件物品的重量必须小于背包的容量所以有: -\(j-weight(i)>=0\)才去判断: \[ -max(dp[i-1][j],dp[i-1][j-weight[i]]+value[i]) -\]
-它的意思是如果第i件物品装的下,那么就去判断不装这件物品和在没装这件物品,也就是dp[i-1][j-weight[i]]的最大价值,然后加上这件物品的价值。这样就可推出整个dp数组,而数组的最后一个元素,就是我们要求的最大价值
-items=[(1,6,540),(2,3,200),(3,4,180),(4,5,350),(5,1,60),(6,2,150),(7,3,280),(8,5,450),(9,4,320),(10,2,120)] |
Function declaration
+if Function declaration's parameter is empty of
+void
,This two declaration in c++ are same :
f(); //This function don't carray any parameters |
but they are different in c:
+f(void); //This function don't carray any parameters |
Macro definition
+Macro definition may cause some error that we can't expect ,for +example:
+
|
in line 8 ,we are expecting the result is :
+1+2 doubled is 6 |
but in fact ,the result is :
+1+2 double is 5 |
because the macro definition is replace the expression in the place +where it is called :
+cout<<"1+2 doubled is "<<doub(1+2)<<endl; |
Inline function
+to avoid the unsafe of Marco definition ,We can use inline function +to replace the macro function to achieve more safe :
+
|
function with default value of parameters
+the parameters with default value must be in the right of parameters +with no initial value:
+int fun(int i ,int j=5,int k); //incorrect |
Function Overloading
+The same function name can be used to define different tasks
+
|
if only the type of return is not the same ,the numbers of parameter +and the type of parameters is same,The function couldn't be +overloaded:
+int nihao(int x,int y); |
if the overloading function with default value parameter, it can be +incorrect :
+void nihao(int a,int b=0); |
Priority
+Local variables have higher priority than global variables
+
|
if global variables wants to be called in function ,we can add
+::
in the front of variables
cout<<"local variable"<<avar<<endl; |
What is the Union
+Union is a custom type ,we can create union in two way in c:
+union data{ |
union's space is the largest memory footprint of all member
+,int
,char
,double
,the double's
+memory footprint is largest ,so the union data's memory footprint is 8
+bits(the size of double
)
|
you may get the result as follows:
+4,4 |
so the result prove that union members will have Influence each +other, if you change one member's value ,the other member's value is +changed
How to store data
+Union 's data is shared for all member ,so one of they is changed +,others will be effected,but the process is how to go
+Using union
+student information and teacher information is recorded by the same +struct ,but some place are different,for example:
+name | +Num | +Sex | +Profession | +Score/course | +
---|---|---|---|---|
A | +1 | +f | +s | +89 | +
B | +2 | +m | +t | +math | +
|
definition
+give variables a another name after quoted ,the two variables are +equivalent when one of them changed ,the other will change
+int i =5; |
but j definited in following way is not allowed:
+int i; |
quote and pointer
+quote is another name for a variable ,but pointer is a tool pointing +to variable
+
|
quote: No need &
,pointer : Need *
+.
warn
+int i,k; |
void &r = 10; //incorrect, void type is not allow |
used as parameters of function
+
|
quotation is used as formal parameter for function variable +transfer,but it seem that we have really passed a,b into the function +"swap"
+
|
专业英语答辩
+--大家好,欢迎大家来到这里,今天我将为大家介绍一个用于图像翻译的新的技术,叫做cycle-gan,其是由AI华人青年学者Jun-Yan -Zhu主导的项目,在介绍这篇paper之前,我们先和大家介绍一些较为相近的领域。
+将发送端数字脉冲信号转换成模拟信号的过程称为调制(Modulation);将接收端模拟信号还原成数字脉冲信号的过程称为解调(Demodulation)。将调制和解调两种功能结合在一起的设备称为调制解调器(Modem)
+模拟信号和数字信号之间可以相互转换:模拟信号一般通过PCM脉码调制(Pulse +Code +Modulation)方法量化为数字信号,即让模拟信号的不同幅度分别对应不同的二进制值,例如采用8位编码可将模拟信号量化为2^8=256个量级,实用中常采取24位或30位编码;数字信号一般通过对载波进行移相(Phase +Shift)的方法转换为模拟信号。
+数字信道占用信道频带较宽。一路模拟电话的频带为4kHz带宽,一路数字电话约占64kHz,这是模拟通信目前仍有生命力的主要原因。
Hello everyone, welcome to come here, today I will introduce a new -technology for image translation, called cycle-gan, which is a project -led by young AI Chinese scholar Jun-Yan Zhu, in this paper Before that, -let's introduce some relatively similar fields to you.
+数字信道与模拟信道_模拟信道和数字信道_偷轮子的博客-CSDN博客
+-+你们了解文心一言、或者是chatgpt,或许是由Google开发的bard吗?他们的共性是什么呢?没错,他们的共性就是都具有创造性,所谓的创造性,就是当你输入同一句话的时候,它能给出不同的结果,所以gpt的第一个单词就是Generative,但是CNN可不擅长生成式模型,当你给出同一个输入时,它更倾向于输出同一结果。
+从上图可以看出,相关时延大于符号持续时间,因此,当两个信号在接收侧相加时,来自于时延为的符号将会和来自于时延为的符号相加。
+不同的符号相加,或者说,不同的符号相互干扰,即为符号间干扰(ISI)。
+一般将多径信号最大时延的倒数定义为多径信道的相关带宽。
++-频率选择性失真和ISI是一体两面,其中,频率选择性失真发生在频域,对应的时域结果为ISI
Do you guys know Wenxinyiyan, or chatgpt, maybe bard developed by -Google? What do they have in common? Yes, what they have in common is -that they are all creative. The so-called creativity means that when you -input the same sentence, it can give different results, so the first -word of gpt is Generative, but CNN is not good at generative models. , -when you give the same input, it is more likely to output the same -result.
+
--另一个例子就是跨域识别问题,如何通过一个训练的模型,去泛化识别其它域的问题,这里就涉及到域适应,而gan就是用来解决这种问题的。
+脉冲整形
+一、矩形脉冲
+实际上矩形脉冲无失真传输是不可能的,因为由傅里叶变换可知,时域矩形脉冲,频域是sinc函数,带宽无限,而信道带宽总是有限的。 +失真严重导致采样判决出错,无法正确恢复数字信号。 +显然矩形脉冲信号不合适,sinc脉冲信号合适
+二、sinc脉冲 其频谱有限,一个码元达到最大幅值时其他所有码元幅值刚好为零,码元之间不会相互影响,实现了无码间串扰。
+基带滤波器
+一般使用基带滤波器来实现脉冲整形
+假设发送序列{1 1 1 -1 1 -1 -1 1} +发送序列、输入滤波器的冲激信号、每个冲激信号的冲激响应,和输出信号如图所示 +例子
Another example is the problem of cross-domain recognition. How to -generalize and recognize other domains through a trained model, here -involves domain adaptation, and gan is used to solve this problem.
+基带信号的发送和接收的有效理解和掌握_滚降因子为0的系统可以算是理想低通系统吗_BIT小小书童的博客-CSDN博客
--这是Gan的一个模型框架,主要是由生成器和判别器两部分组成,生成器用来生成内容,而判别器主要识别生成的内容是否是假的。生成器和判别器是两个模型,他们就如自然界一样捕食者与被捕食者共同进化。当判别器无法区分生成的内容是否为假,说明模型已经表现十分良好了
+最初,信号是以矩形脉冲通过带限信道,必然会出现脉冲时延扩展引起S1,频域上看是Sa函数的旁瓣千扰。
This is a model framework of Gan, which is mainly composed of two -parts: the generator and the discriminator. The generator is used to -generate content, and the discriminator mainly identifies whether the -generated content is fake. The generator and the discriminator are two -models, and they co-evolve with the prey just like in nature. When the -discriminator cannot distinguish whether the generated content is fake -or not, it means that the model has performed very well
+简单概述:脉冲成形 +基带成形 (脉冲成型 基带成型) - HQU小西西 - 博客园
+有点难,待会看
+为什么要对基带信号进行脉冲成型【转载】 +- Riden - 博客园
--Cycle-gan 使用了循环一致性,共需要四个模型,即两个生成模型GA->B, -GB->A,以及两个判别模型 -DA和DB,这就是cycle的由来,但是更加令人振奋人心的是:cycle-gan不需要配对的数据对进行训练,也就是说我们只需要给cycle-gan足够多的源域和目的域的数据,而不需要对其进行大量标签工作,它就会自动学习并且成功x -域到y域的转化规则,由于其涉及到两个域的双向转化,因而其迭代中使用的损失函数也是循环一致损失函数。
+为什么对基带信号要成形滤波?
+基带信号带宽无限,需要限制带宽。成形滤波器也叫限带滤波器
+实际中通信传输的信号大都是带通信号,也就是中心频带远大于频带宽度的信号。而这些带通信号的频谱结构只取决于等效低通信号的频谱结构。这里的等效低通信号就是你这里所指的基带数字信号。而基带数字信号的频率特性又取决于两个因素,一个是基带信号中构成每个脉冲符号的基本信号的频谱,另一个就是脉冲信号之间的相关性。换句话说可以通过设计不同的基本脉冲信号的波形和符号之间的相关性,达到改变基带信号频谱结构的目的,从而改变调制后带通信号的频谱特性。 +理解了这一点,你就可以理解为什么要对基带信号进行不同的滤波生成符号脉冲了。
Cycle-gan uses cycle consistency and requires a total of four models, -namely two generative models GA->B, GB->A, and two discriminative -models DA and DB. This is the origin of cycle, but it is even more -exciting What is popular is that cycle-gan does not require paired data -pairs for training, that is to say, we only need to give cycle-gan -enough data from the source domain and the target domain without a lot -of labeling work on it, and it will Automatically learn and successfully -convert the x domain to the y domain. Since it involves the two-way -conversion of the two domains, the loss function used in its iteration -is also a cycle consistent loss function.
-基带传输与成形滤波_基带成型滤波器_长弓的坚持的博客-CSDN博客
-+接下来给大家介绍一些cycle-gan应用:如视频增强领域,黑白视频变成彩色视频。或者是场景转化。或者是将抽象的画转化为一个具象的画如房屋建筑,这些都可以作为通信数据压缩,你可以试着一下发送方在网路上传送类似于色块一样的数据,它可能占用的带宽十分的小,当你在接收端受到这些色块时,再将其恢复出来。这样看起来是一个不错的视频压缩方法
+为什么要->这里有直接结论:
+(个人简单理解,脉冲成型(形),就是将脉冲变成其他的传输波形,理由就是压缩频谱来降低ISI) +!
+
简单概述:脉冲成形 +基带成形 (脉冲成型 基带成型) - 1024搜-程序员专属的搜索引擎
++-数字信号想要在信道中传输,必须在发射机的基带部分进行脉冲成形,将数字信号转换成脉冲信号,脉冲信号到达接收机后,在基带部分进行采样判决,将数字信号恢复出来。
+如下图所示,脉冲成形需要用到脉冲波形,实现脉冲成形要用到基带滤波器,评估基带滤波器要用到眼图。【深入浅出通信原理-学习笔记】基带信号的发送和接收_脉冲怎么发送和接受_DUANDAUNNN的博客-CSDN博客
Next, I will introduce some cycle-gan applications: for example, in -the field of video enhancement, black-and-white video becomes color -video. Or scene transformation. Or convert an abstract painting into a -concrete painting such as a building, these can be used as communication -data compression, you can try the sender to transmit data similar to -color blocks on the network, it may take up a lot of bandwidth Small, -when you get these color patches at the receiving end, bring them back. -This looks like a good way to compress video
-The third part is sentence analysis,
-The meaning of the first sentence is -“此外,在实践中,我们发现很难优化对抗目标隔离:标准程序通常会导致众所周知的模式崩溃问题,其中所有输入图像都映射到相同的输出图像,优化无法取得进展 -[15]。
-”。
-The second sentence -means:“我们还与以前依赖于手动定义的样式和内容分解或共享嵌入函数的方法进行了比较,并表明我们的方法优于这些基线。”。
-The third part is sentence analysis -“图像到图像转换的想法至少可以追溯到 Hertzmann 等人的图像类比 -[19],他们在单个输入输出训练图像对上采用非参数纹理模型 [10]。”
-Here are some references. thanks for listening!
]]>def fibo(n): |
+既然Fibonacci数列的递归计算如此复杂,那么,我们应该想什么办法来优化整个算法呢,我们考虑到,Fibonacci之所以复杂,是因为递归的存在,导致整个程序的时间复杂度都十分的高那么我们有没有简单一点的方法呢,对了,我们可以采用记录的方式,将每一个点之前的Fibonacci的数值都保存下来
+def Fibo(n): |
+我们调用了相关的带有memo的Fibo函数之后,明显发现,整个速度提升了很多,整个计算没有超过一秒钟,显然,这种方法是很有效的,我们称这个memo为DP数组
+输出:4
+解释:偷窃 1 号房屋 (金额 = 1) ,然后偷窃 3 号房屋 (金额 = 3)。
+偷窃到的最高金额 = 1 + 3 = 4 。
+对于小偷问题,我们可以这么去思考,就是我们新建一个DP数组,用来储存小偷走到这个点时之前可以得到的最大的收益,如果按照这种思路,然后去整个数组的最大值
+def steal(): |
在一个 m*n +的棋盘的每一格都放有一个礼物,每个礼物都有一定的价值(价值大于 +0)。你可以从棋盘的左上角开始拿格子里的礼物,并每次向右或者向下移动一格、直到到达棋盘的右下角。给定一个棋盘及其上面的礼物的价值,请计算你最多能拿到多少价值的礼物?
+输入:
+[
+[1,3,1],
+[1,5,1],
+[4,2,1]
+]
+输出: 12
+解释: 路径 1→3→5→2→1 可以拿到最多价值的礼物
+ + +我们要计算从左上角到右下角最大的礼物价值,我们不妨这么思考,我们还是新建一个DP数组,这个DP数组应该是二维的,然后考虑DP数组是左上角到达每个点的最大价值,又因为路线只能右走或者下走。所以当其为横向、纵向的边界时,我们只要考虑左边、上面
+def gift(): |
给你一个整数数组 coins ,表示不同面额的硬币;以及一个整数 amount +,表示总金额。计算并返回可以凑成总金额所需的 最少的硬币个数 +。如果没有任何一种硬币组合能组成总金额,返回 -1 +。你可以认为每种硬币的数量是无限的。
+输入:coins = [1, 2, 5], S = 11
+输出:3
+解释:11 = 5 + 5 + 1
+输入:coins = [2], S = 3
+输出:-1
+ +\[ +f(x)=min\{f(x-c_1),f(x-c_2),...f(x-c_m)\}+1 +\]
+如果\(x-c_i<0\),则令\(f(x-c_i)=\infty\)这样就不会选这个\(f(x-c_i)\)了
+如果\(x-c_i=0\),那么\(f(x-c_i)=0\)即\(f(0)=0\)
+def change_coins(): |
现在我们已经知道硬币的最少组合为3,那我们如何得到是哪些硬币的组合
+思路: +我们可以将S=11的最小硬币数是3分解一下,例如,硬币数是3,说明[1,2,5]中的三个可以组成,于是我们可以一个一个的遍历,看当11减去其中的一些数之后判断一下剩余的需要的最小硬币数是不是2,例如:11-1,然后:凑成10元的所需硬币数最小是2吗,是的话,跳出遍历,选择这一10继续分解,不是的话,继续遍历下面的,直到S=0说明已经遍历到0了,可以结束
+如何得到硬币的组合呢(5,5,1)
+def find_coins(S): |
+有10件货物要从甲地运送到乙地,每件货物的重量(单位:吨)和利润(单位:元)
+如下表所示:
+ + +由于只有--辆最大载重为30t的货车能用来运送货物,所以只能选择部分货物配送,要求确定运送哪些货物,使得运送这些货物的总利润最大。
+思路:
+ 有m件物品,第i件物品的利润为\(v_i\)重量为\(w_i\)背包的总重量为W.
+原问题:在满足重量约束的条件下,将这m个物品选择性放入容量为W的背包所能获得的最大利润
+子问题:在满足重量的约束条件下,将i(\(i\le +m\))件物品选择性放入容量为j(\(j \le +W\))的背包所获得的最大利润
+状态分析:
+ +我们要讲m件商品装进容量为W的背包,我们可以假设背包是从1,2,3,4...增大的容量,物品从第一次只装第一个产品,然后慢慢推广到前i个产品,所以DP表格其实是在背包容量为i的情况下,能装的礼物的最大价值
+ +对于第一行来说,装的物品为第一个物品,所以只需要判断背包容量是否大于第一件物品的重量,若大于,则最大价值为第一件物品的价值
+ +对于第一列来说,背包容量为1,装进前i件物品的最大价值,由于物品的重量始终为整数,所以在前i件物品里,我们要看有没有总量为1的物品,若没有,则什么也装不进去,那么最大价值为0,若有(可能有几个),则去前i个产品中重量为1的所有物品中价值最大的那个为该点dp表的值
+ 对于其它的列来说,需要用到状态转移方程,对于要求前\(i\)件物品装进容量为\(j\)的背包,在\(i-1\)的基础上只需要考虑到底装不装第\(i\)件物品,那么怎么考虑呢?要装第\(i\)件物品首先,第\(i\)件物品的重量必须小于背包的容量所以有: +\(j-weight(i)>=0\)才去判断: \[ +max(dp[i-1][j],dp[i-1][j-weight[i]]+value[i]) +\]
+它的意思是如果第i件物品装的下,那么就去判断不装这件物品和在没装这件物品,也就是dp[i-1][j-weight[i]]的最大价值,然后加上这件物品的价值。这样就可推出整个dp数组,而数组的最后一个元素,就是我们要求的最大价值
+items=[(1,6,540),(2,3,200),(3,4,180),(4,5,350),(5,1,60),(6,2,150),(7,3,280),(8,5,450),(9,4,320),(10,2,120)] |
OpenAI ChatGPT(一):十分钟读懂 Transformer - 知乎
+]]> +专业英语答辩
+ +++大家好,欢迎大家来到这里,今天我将为大家介绍一个用于图像翻译的新的技术,叫做cycle-gan,其是由AI华人青年学者Jun-Yan +Zhu主导的项目,在介绍这篇paper之前,我们先和大家介绍一些较为相近的领域。
+
Hello everyone, welcome to come here, today I will introduce a new +technology for image translation, called cycle-gan, which is a project +led by young AI Chinese scholar Jun-Yan Zhu, in this paper Before that, +let's introduce some relatively similar fields to you.
+++你们了解文心一言、或者是chatgpt,或许是由Google开发的bard吗?他们的共性是什么呢?没错,他们的共性就是都具有创造性,所谓的创造性,就是当你输入同一句话的时候,它能给出不同的结果,所以gpt的第一个单词就是Generative,但是CNN可不擅长生成式模型,当你给出同一个输入时,它更倾向于输出同一结果。
+
Do you guys know Wenxinyiyan, or chatgpt, maybe bard developed by +Google? What do they have in common? Yes, what they have in common is +that they are all creative. The so-called creativity means that when you +input the same sentence, it can give different results, so the first +word of gpt is Generative, but CNN is not good at generative models. , +when you give the same input, it is more likely to output the same +result.
+++另一个例子就是跨域识别问题,如何通过一个训练的模型,去泛化识别其它域的问题,这里就涉及到域适应,而gan就是用来解决这种问题的。
+
Another example is the problem of cross-domain recognition. How to +generalize and recognize other domains through a trained model, here +involves domain adaptation, and gan is used to solve this problem.
+++这是Gan的一个模型框架,主要是由生成器和判别器两部分组成,生成器用来生成内容,而判别器主要识别生成的内容是否是假的。生成器和判别器是两个模型,他们就如自然界一样捕食者与被捕食者共同进化。当判别器无法区分生成的内容是否为假,说明模型已经表现十分良好了
+
This is a model framework of Gan, which is mainly composed of two +parts: the generator and the discriminator. The generator is used to +generate content, and the discriminator mainly identifies whether the +generated content is fake. The generator and the discriminator are two +models, and they co-evolve with the prey just like in nature. When the +discriminator cannot distinguish whether the generated content is fake +or not, it means that the model has performed very well
+++Cycle-gan 使用了循环一致性,共需要四个模型,即两个生成模型GA->B, +GB->A,以及两个判别模型 +DA和DB,这就是cycle的由来,但是更加令人振奋人心的是:cycle-gan不需要配对的数据对进行训练,也就是说我们只需要给cycle-gan足够多的源域和目的域的数据,而不需要对其进行大量标签工作,它就会自动学习并且成功x +域到y域的转化规则,由于其涉及到两个域的双向转化,因而其迭代中使用的损失函数也是循环一致损失函数。
+
Cycle-gan uses cycle consistency and requires a total of four models, +namely two generative models GA->B, GB->A, and two discriminative +models DA and DB. This is the origin of cycle, but it is even more +exciting What is popular is that cycle-gan does not require paired data +pairs for training, that is to say, we only need to give cycle-gan +enough data from the source domain and the target domain without a lot +of labeling work on it, and it will Automatically learn and successfully +convert the x domain to the y domain. Since it involves the two-way +conversion of the two domains, the loss function used in its iteration +is also a cycle consistent loss function.
+++接下来给大家介绍一些cycle-gan应用:如视频增强领域,黑白视频变成彩色视频。或者是场景转化。或者是将抽象的画转化为一个具象的画如房屋建筑,这些都可以作为通信数据压缩,你可以试着一下发送方在网路上传送类似于色块一样的数据,它可能占用的带宽十分的小,当你在接收端受到这些色块时,再将其恢复出来。这样看起来是一个不错的视频压缩方法
+
Next, I will introduce some cycle-gan applications: for example, in +the field of video enhancement, black-and-white video becomes color +video. Or scene transformation. Or convert an abstract painting into a +concrete painting such as a building, these can be used as communication +data compression, you can try the sender to transmit data similar to +color blocks on the network, it may take up a lot of bandwidth Small, +when you get these color patches at the receiving end, bring them back. +This looks like a good way to compress video
+The third part is sentence analysis,
+The meaning of the first sentence is +“此外,在实践中,我们发现很难优化对抗目标隔离:标准程序通常会导致众所周知的模式崩溃问题,其中所有输入图像都映射到相同的输出图像,优化无法取得进展 +[15]。
+”。
+The second sentence +means:“我们还与以前依赖于手动定义的样式和内容分解或共享嵌入函数的方法进行了比较,并表明我们的方法优于这些基线。”。
+The third part is sentence analysis +“图像到图像转换的想法至少可以追溯到 Hertzmann 等人的图像类比 +[19],他们在单个输入输出训练图像对上采用非参数纹理模型 [10]。”
+Here are some references. thanks for listening!
]]>Pointer point the constant:
+const char *name = "chen" //statement a pointer point a constant |
because using const
,so the Pointer can't change variable
+in the address which it point ,so the statement as follows is incorrect
+:
name[3]='a' //incorrect,pointer "name" can't change constant |
but name is a normal pointer ,so it could change the items it +point,statement as follows are correct:
+name = 'zhang' //change the address the pointer point ,correct |
Also,Even you have changed your string you point ,you still can't +change the string, Please somebody tell me why ,Thank you !
+name[3]='y' //incorrect,but I don't know why! |
Constant Pointer
+A pointer can't change the address it point ,but it still can change +the content it point,example:
+char *const name ="chen"; //define a constant pointer |
Constant Pointer points to constant
+A constant pointer points a constant ,the address pointer point is +unchangeable and the content of address is unchangeable,example :
+const char *const name="chen"; //define a constant pointer point the constant |
Const
+Using a const to define a integer
variable ,the keyword
+omitted is acceptable the definition as following is same:
const int LIMITS = 100; |
formal parameters also can be describe by const
,for
+example:
int MAX(const int*ptr) |
the method promise the array can't be changed ,only be read.
|
in fact , you see the definition of Pointer array ,It is like as +follows:
+char *arr[3]={'abc','def','ghi'}; |
char *pChar1 = 'abc',*pChar2 = 'def',*pChar3='ghi' |
At the same time :
+arr[0] = pChar; //the arr first element is the pointer pChar |
and the pChar
is pointing the 'abc''s first element 'a',
+so we can use the code to print 'a'
printf("%c",pChar[0]); //print 'a' |
int fun(int x,int y); //normal function return integers |
This function declaration is normal ,but There are some difference in +next function declaration
+int *fun(int x,int y) |
This function declaration is pointer function ,the return is a
+pointer to int
,This is an address
To state a pointer to function ,which is a Pointer pointing function +.declaration form:
+int (*fun)(int x,int y) |
There are two ways to assign values to pointer variables
+fun = &function; |
There are also two ways to call pointer to function
+x=(*fun)(); |
Example:
+
|
operation new
can get a space from heap and return the
+pointer to point the first address of the memory,and delete
+can free the space
int *p; |
new
assign space for multidimensional array:
int i = 3; |
new
assign space with initial value:
|
Pointer point the constant:
-const char *name = "chen" //statement a pointer point a constant |
because using const
,so the Pointer can't change variable
-in the address which it point ,so the statement as follows is incorrect
-:
name[3]='a' //incorrect,pointer "name" can't change constant |
but name is a normal pointer ,so it could change the items it -point,statement as follows are correct:
-name = 'zhang' //change the address the pointer point ,correct |
Also,Even you have changed your string you point ,you still can't -change the string, Please somebody tell me why ,Thank you !
-name[3]='y' //incorrect,but I don't know why! |
Constant Pointer
-A pointer can't change the address it point ,but it still can change -the content it point,example:
-char *const name ="chen"; //define a constant pointer |
Constant Pointer points to constant
-A constant pointer points a constant ,the address pointer point is -unchangeable and the content of address is unchangeable,example :
-const char *const name="chen"; //define a constant pointer point the constant |
Const
-Using a const to define a integer
variable ,the keyword
-omitted is acceptable the definition as following is same:
const int LIMITS = 100; |
formal parameters also can be describe by const
,for
-example:
int MAX(const int*ptr) |
the method promise the array can't be changed ,only be read.
|
in fact , you see the definition of Pointer array ,It is like as -follows:
-char *arr[3]={'abc','def','ghi'}; |
char *pChar1 = 'abc',*pChar2 = 'def',*pChar3='ghi' |
At the same time :
-arr[0] = pChar; //the arr first element is the pointer pChar |
and the pChar
is pointing the 'abc''s first element 'a',
-so we can use the code to print 'a'
printf("%c",pChar[0]); //print 'a' |
int fun(int x,int y); //normal function return integers |
This function declaration is normal ,but There are some difference in -next function declaration
-int *fun(int x,int y) |
This function declaration is pointer function ,the return is a
-pointer to int
,This is an address
To state a pointer to function ,which is a Pointer pointing function -.declaration form:
-int (*fun)(int x,int y) |
There are two ways to assign values to pointer variables
-fun = &function; |
There are also two ways to call pointer to function
-x=(*fun)(); |
Example:
-
|
operation new
can get a space from heap and return the
-pointer to point the first address of the memory,and delete
-can free the space
int *p; |
new
assign space for multidimensional array:
int i = 3; |
new
assign space with initial value:
|
apt-get install axel |
下载方式
axel 参数 文件下载地址 |
connect(信号发送者,发送的信号(函数的地址),信号接受者,处理的槽函数(函数的地址)); |
松散耦合:发送端和接受端的松散耦合
+signals
中,返回值是voidpublic slots
文件中,返回值是voidclass.h |
signals: |
定义槽和信号后,需要定义触发函数
+weidget: |
要先定义connect
再调用classover
。
信号函数和槽函数直接重载时,会因为二义性而导致程序无法编译,于是我们需要用函数指针来代替直接给地址,方法如下:
+void(Teacher:: *teachersignal)(QString)=&Teacher::hungry; |
Qstring 转char *
+Qstring.toUtf8().data() //先转utf8,再转char* |
connect(btn,&QPushButton::clicked,zt,teachersignal2); |
直接将两个信号用connect相连
+断开信号 disconnect
多个信号一个槽
多个槽连接一个信号
信号和槽的参数类型必须一一对应,信号参数个数可以大于槽函数的参数个数
lambda函数
+//connect 一般使用方法 |
&
.connect(ui->actionnew,&QAction::triggered,[=](){ |
[=](){QDialog dig2(this); |
connect(信号发送者,发送的信号(函数的地址),信号接受者,处理的槽函数(函数的地址)); |
松散耦合:发送端和接受端的松散耦合
-signals
中,返回值是voidpublic slots
文件中,返回值是voidclass.h |
signals: |
定义槽和信号后,需要定义触发函数
-weidget: |
要先定义connect
再调用classover
。
信号函数和槽函数直接重载时,会因为二义性而导致程序无法编译,于是我们需要用函数指针来代替直接给地址,方法如下:
-void(Teacher:: *teachersignal)(QString)=&Teacher::hungry; |
Qstring 转char *
-Qstring.toUtf8().data() //先转utf8,再转char* |
connect(btn,&QPushButton::clicked,zt,teachersignal2); |
直接将两个信号用connect相连
-断开信号 disconnect
多个信号一个槽
多个槽连接一个信号
信号和槽的参数类型必须一一对应,信号参数个数可以大于槽函数的参数个数
lambda函数
-//connect 一般使用方法 |
&
.connect(ui->actionnew,&QAction::triggered,[=](){ |
[=](){QDialog dig2(this); |
wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin |
题设:n个评价对象,m个评价指标观测值为 \[ +a_{ij}\quad(i=1,2,...n;j=1,2,..,m) +\]
+\[ +\begin{bmatrix}a_{11} & a_{12}&...&a_{1,m}\\\\a_{21} & +a_{22}&...&a_{2m}\\ \vdots&...&...&\\a_{n1} & +a_{n2}&...&a_{nm}\end{bmatrix} +\]
+\[ +\mu_j=\frac{1}{n}\sum_{i=1}^{n}a_{ij}\qquad +s_j=\sqrt{\frac{1}{n}(a_{ij}-\mu_j)^2}\\ +\]
+\[ +\begin{bmatrix}a_{11}\\a_{21}\\\vdots\\a_{n1}\end{bmatrix}\cdots\begin{bmatrix}a_{1m}\\a_{2m}\\\vdots\\a_{nm}\end{bmatrix}\longrightarrow\begin{bmatrix}\mu_1&\cdots\mu_m\end{bmatrix}\longrightarrow +\begin{bmatrix}s_1&\cdots&s_m\end{bmatrix}\\ +\]
+\[ +w_j=\frac{s_j}{\sum_{k=1}^{m}s_k}(j=1,2,3,4...m)\\ +\]
+\[ +\begin{bmatrix}w_1& w_2&\cdots w_m\end{bmatrix} +\]
+\[ +r_{j}=\max _{1 \leq i<k \leq n}\left\{\left|a_{i j}-a_{k +j}\right|\right\}(j=1,2, \cdots, m)\\ +\]
+\[ +\max_{every +element}\begin{bmatrix}rand(a_{i1}-a_{k1})&\cdots&rand(a_{ij}-a_{kj})\end{bmatrix}\longrightarrow\begin{bmatrix}r_1&r_2&\cdots&r_m\end{bmatrix} +\]
+所以第\(j\)项指标的权重系数为 \[ +w_{j}=\frac{s_{j}}{\sum_{l=1}^{m} r_{k}}(j=1,2, \cdots, m) +\]
+特征比重:
+在\[\mu_j=\sum_{i=1}^{n} a_{i +j}>0\],第\(j\)项指标的特征比重为 \[ +p_{i j}=\frac{a_{i j}}{\sum_{i=1}^{n} a_{i j}}(i=1,2, \cdots, n ; j=1,2, +\cdots, m) +\]
+\[ +\begin{bmatrix}a_{11}\\a_{21}\\\vdots\\a_{n1}\end{bmatrix}\cdots\begin{bmatrix}a_{1m}\\a_{2m}\\\vdots\\a_{nm}\end{bmatrix}\longrightarrow\begin{bmatrix}\mu_1&\cdots\mu_m\end{bmatrix}\longrightarrow\begin{bmatrix}p_{11}&\cdots&p_{1m}\\p_{21}&\cdots&p_{2m}\\\vdots&\cdots&\\p_{n1}&\cdots&p_{nm}\end{bmatrix} +\]
+第\(j\)项的熵值为: \[ +e_{j}=-\frac{1}{\ln n} \sum_{i=1}^{n} p_{i j} \ln p_{i j}(j=1,2, \cdots, +m) +\]
+\[ +\begin{bmatrix}p_{11}&\cdots&p_{1m}\\p_{21}&\cdots&p_{2m}\\\vdots&\cdots&\\p_{n1}&\cdots&p_{nm}\end{bmatrix}\longrightarrow\begin{bmatrix}e_1&\cdots&e_m\end{bmatrix} +\]
+不难看出,如果第\(j\)项指标的观测值差异越大,熵值越小;反之,熵值越大。
+计算第\(j\)项指标的差异系数为 \[ +g_{j}=1-e_{j}(j=1,2, \cdots, m) +\] 如果第项指标的观测值差异越大,则差异系数\(g\)就越大,第\(j\)项指标也就越重要。
+第\(j\)项的权重系数为 \[ +w_{j}=\frac{g_{j}}{\sum_{k=1}^{m} g_{k}}(j=1,2, \cdots, m) +\] 参考文章:
+ +]]>题设:n个评价对象,m个评价指标观测值为 \[ -a_{ij}\quad(i=1,2,...n;j=1,2,..,m) -\]
-\[ -\begin{bmatrix}a_{11} & a_{12}&...&a_{1,m}\\\\a_{21} & -a_{22}&...&a_{2m}\\ \vdots&...&...&\\a_{n1} & -a_{n2}&...&a_{nm}\end{bmatrix} -\]
-\[ -\mu_j=\frac{1}{n}\sum_{i=1}^{n}a_{ij}\qquad -s_j=\sqrt{\frac{1}{n}(a_{ij}-\mu_j)^2}\\ -\]
-\[ -\begin{bmatrix}a_{11}\\a_{21}\\\vdots\\a_{n1}\end{bmatrix}\cdots\begin{bmatrix}a_{1m}\\a_{2m}\\\vdots\\a_{nm}\end{bmatrix}\longrightarrow\begin{bmatrix}\mu_1&\cdots\mu_m\end{bmatrix}\longrightarrow -\begin{bmatrix}s_1&\cdots&s_m\end{bmatrix}\\ -\]
-\[ -w_j=\frac{s_j}{\sum_{k=1}^{m}s_k}(j=1,2,3,4...m)\\ -\]
-\[ -\begin{bmatrix}w_1& w_2&\cdots w_m\end{bmatrix} -\]
-\[ -r_{j}=\max _{1 \leq i<k \leq n}\left\{\left|a_{i j}-a_{k -j}\right|\right\}(j=1,2, \cdots, m)\\ -\]
-\[ -\max_{every -element}\begin{bmatrix}rand(a_{i1}-a_{k1})&\cdots&rand(a_{ij}-a_{kj})\end{bmatrix}\longrightarrow\begin{bmatrix}r_1&r_2&\cdots&r_m\end{bmatrix} -\]
-所以第\(j\)项指标的权重系数为 \[ -w_{j}=\frac{s_{j}}{\sum_{l=1}^{m} r_{k}}(j=1,2, \cdots, m) -\]
-特征比重:
-在\[\mu_j=\sum_{i=1}^{n} a_{i -j}>0\],第\(j\)项指标的特征比重为 \[ -p_{i j}=\frac{a_{i j}}{\sum_{i=1}^{n} a_{i j}}(i=1,2, \cdots, n ; j=1,2, -\cdots, m) -\]
-\[ -\begin{bmatrix}a_{11}\\a_{21}\\\vdots\\a_{n1}\end{bmatrix}\cdots\begin{bmatrix}a_{1m}\\a_{2m}\\\vdots\\a_{nm}\end{bmatrix}\longrightarrow\begin{bmatrix}\mu_1&\cdots\mu_m\end{bmatrix}\longrightarrow\begin{bmatrix}p_{11}&\cdots&p_{1m}\\p_{21}&\cdots&p_{2m}\\\vdots&\cdots&\\p_{n1}&\cdots&p_{nm}\end{bmatrix} -\]
-第\(j\)项的熵值为: \[ -e_{j}=-\frac{1}{\ln n} \sum_{i=1}^{n} p_{i j} \ln p_{i j}(j=1,2, \cdots, -m) -\]
-\[ -\begin{bmatrix}p_{11}&\cdots&p_{1m}\\p_{21}&\cdots&p_{2m}\\\vdots&\cdots&\\p_{n1}&\cdots&p_{nm}\end{bmatrix}\longrightarrow\begin{bmatrix}e_1&\cdots&e_m\end{bmatrix} -\]
-不难看出,如果第\(j\)项指标的观测值差异越大,熵值越小;反之,熵值越大。
-计算第\(j\)项指标的差异系数为 \[ -g_{j}=1-e_{j}(j=1,2, \cdots, m) -\] 如果第项指标的观测值差异越大,则差异系数\(g\)就越大,第\(j\)项指标也就越重要。
-第\(j\)项的权重系数为 \[ -w_{j}=\frac{g_{j}}{\sum_{k=1}^{m} g_{k}}(j=1,2, \cdots, m) -\] 参考文章:
- -]]>3.进入onlyoffice修改etc/onlyoffice/documentserver/default.json
,修改如下
"rejectUnauthorized": false |
重启docker
-]]> -下载seafileltd/seafile:latest
镜像
在容器设置中挂载目录
-/shared
如下环境变量设置账号和密码
-SEAFILE_ADMIN_EMAIL
SEAFILE_ADMIN_PASSWORD
因为docker中的ipv6如果不往外界发出信号,路由是无法知道该容器的ipv6地址,所以需要安装ping工具每隔一段时间不断发包,表示心跳
-1.更新apt包
-apt update |
2.安装iputils-ping
-apt-get install -y iputils-ping |
3.测试ping百度
-ping -6 -c 1 www.baidu.com |
3.编写/root/script/ping.sh
while true; do |
4.修改ping.sh为可执行文件
-chmod +x /root/script/ping.sh |
5.测试脚本执行情况:如下执行成功
-6.修改自启动脚本
-在/root/.bashrc
中追加
if [ -f /root/script/ping.sh ]; then |
一般而言,由于seafile不自动开bash,因此,建议将上述加入.bashrc加入到seafile-server-latest/seafile.sh
中,添加到echo "Seafile server started"
的前面.
1.创建/etc/nginx/conf.d/seafile.conf
,内容如下
server { |
2.测试文件格式正常
-nginx -t |
重启docker容器
-修改SERVICE_URL
和FILE_SERVER_ROOT
SERVICE_URL
:http://seafile.ninglang.fun
FILE_SERVER_ROOT
:http://seafile.ninglang.fun/seafhttp
设置/conf/seafdav.conf
中为
enabled = true |
在手机端设置
-网络地址
:seafile.ninglang.fun/seafdav
账号密码如实填写
]]>下载seafileltd/seafile:latest
镜像
在容器设置中挂载目录
+/shared
如下环境变量设置账号和密码
+SEAFILE_ADMIN_EMAIL
SEAFILE_ADMIN_PASSWORD
因为docker中的ipv6如果不往外界发出信号,路由是无法知道该容器的ipv6地址,所以需要安装ping工具每隔一段时间不断发包,表示心跳
+1.更新apt包
+apt update |
2.安装iputils-ping
+apt-get install -y iputils-ping |
3.测试ping百度
+ping -6 -c 1 www.baidu.com |
3.编写/root/script/ping.sh
while true; do |
4.修改ping.sh为可执行文件
+chmod +x /root/script/ping.sh |
5.测试脚本执行情况:如下执行成功
+6.修改自启动脚本
+在/root/.bashrc
中追加
if [ -f /root/script/ping.sh ]; then |
一般而言,由于seafile不自动开bash,因此,建议将上述加入.bashrc加入到seafile-server-latest/seafile.sh
中,添加到echo "Seafile server started"
的前面.
1.创建/etc/nginx/conf.d/seafile.conf
,内容如下
server { |
2.测试文件格式正常
+nginx -t |
重启docker容器
+修改SERVICE_URL
和FILE_SERVER_ROOT
SERVICE_URL
:http://seafile.ninglang.fun
FILE_SERVER_ROOT
:http://seafile.ninglang.fun/seafhttp
设置/conf/seafdav.conf
中为
enabled = true |
在手机端设置
+网络地址
:seafile.ninglang.fun/seafdav
账号密码如实填写
+]]>