English Review

English Review by Following the review scripts.

Unit1 Identity

Words

trait n. multilingual adj.
ascribe phr. v. ~ sth. to sb./sth. stubborn adj.
sibling n. [C] rivalry n. [C, U]
affiliation n. [C, U] foster vt.
altruism restrained
charity humble
cordial magnanimous
frugal patriotism
selflessness adherence
trustworthiness collectivism
courteous hybrid
pragmatic laudable
correlation self-esteem
tempt procrastinate
co-worker

Words in use

  • She said exactly what she thought, without thinking about the consequence.
  • In general, shyness is a personality trait that is partly biological and partly environmental.
  • International travel has grown to the point that many hotels find it necessary to empoly multilingual staff members.
  • I can only ascribe the uncommon behavior of the strangers I meet to my being a foreigner.
  • I have categorized my social media contacts into family, close friends, and work colleagues.
  • The city hopes historic districts will foster a sense of community, which can be lacking in young and fast-growing places.
  • Laughing at the same joke would help us to show affiliation with others, and this may be why it is especially infectious.
  • Once you graduate from school, you’ll start to feel fierce rivalry as you compete for a good job.
  • The survey was distributed to over 1,000 people, but unfortunately, only about half of the participants completed it correctly.
  • Is there any correlation between gender and personality traits?
  • When I don’t understand something even after the teacher has explained it twice, I feel frustrated.
  • This psychology journal has an interesting article about a very comprehensive study carried out on a group of 500 volunteers.
  • The applicant was rated very high in technical skills, but rather low in social skills.
  • The results of my research suggest / suggested that identity is important in all cultures in the world.
  • Fast-food chains will tempt you with more efficient takeout options.
  • Sharing family photos in the workplaces helps co-workers become and remain connected.
  • Thinking people make decisions based on logical evidence.
  • Feeling people use emotions and feelings to guide their choices.
  • People who draw conclusions based on their ideas and concepts of the world are known as intuitive.
  • Sensing people rely on concrete information; for example, evidence that can be seen, heard, or felt.
  • People with a strong judging identity are most comfortable with rules and specific guidelines. They see the world as an orderly place that always operates the same way.
  • If you are some who thinks any situation can have many different outcomes, that there is no stable structure in place, and so anything is possible, you are probably a perceiving person
  • Extroverted people are outgoing and sociable. They are interested in other people and the world around them.
  • People who focus on their own inner world are introverted. They often prefer to spend time alone or without distractions from the outside.

English to Chinese

Although sustained sibling rivalry can result in behavioral problems and issues with relationship-building later in life, milder forms have been shown to have a beneficial impact on development in childhood.

尽管持续的兄弟姐妹竞争会导致行为问题和日后人际关系的建立问题,但较温和的形式已被证明对认同的发展有有益的影响。


Confirmation bias is the tendency of people to favor information that confirms their existing beliefs or hypotheses.

确认偏见是指人们倾向于认同那些证实其现有信念或假设的信息。


We all have the potential for stubborn tendencies, but in people with a strong fear of change, stubbornness can become a dominant pattern.

我们都有潜在产生顽固倾向的可能,但在强烈恐惧改变的人们中,顽固可能成为主导行为模式。


The view of self in a profession consists of beliefs, values, motives, and experiences, which are used to define and guide individual growth and practice.

职业层面的自我由信仰,价值观,动机和经验组成,其用于定义和指导个人的成长和实践。


The scope of the study was broad: it took into account such variables as age, gender, hours per week spent online, and years of online use.

这项研究的范围很广:它考虑了年龄,性别,每周上网时长以及上网年限等变量。


I was surprised by the outcome of the study, which suggested that the majority of people exaggerated information about themselves, held information back, and in some cases, even posted information that wasn’t true.

我对这项研究的结果感到惊讶,它表明了大多数人夸大了自己的信息,隐瞒了信息,在某些情况下,甚至发表了不正确的信息。


People may procrastinate when they are confused by the complexity of a task or when they’re overly distracted or fatigued.

当人们对复杂的任务感到困惑、注意力不太集中或太过疲劳时,人们可能会拖延。


Each person’s experience is different, but over the course of the lifespan, self-esteem seems to rise and fall in predictable, systematic ways.

虽然每个人的经历不同,但在人的一生中,自尊心似乎以可预测的、系统性的方式起伏。

Chinese to English

一个人的身份特征是可以被赋予的、努力获取的或主动选择的

Identity traits can be ascribed, achieved or chosen.


被赋予的是你与生俱来的特征,例如你的种族、出生地、以及某人的孩子或手足。

An ascribed trait is one that you are born with; examples include your ethnicity, your birthplace, and being the child and possibly the sibling of certain people.


俱乐部会员或政党成员的身份则是你所选择的。

An identity such as a club membership or affiliation with a political party is chosen.


举个例子,你的母语是被赋予的特征(理由是你出生在讲这种语言的家庭和国家),还是你所获取的特征(理由是你通过学习,更加精通这门语言),抑或是你所选择的特征(设想你在一个多语言的国家长大,而你更倾向于使用其中的一种语言)?

Is speaking your native language, for example, ascribed (because you were born into the family and country where that language was spoken), achieved (because you studied the language and became more proficient), or even chosen (if you grew up in a multilingual country, but preferred one language over another)?


身份特征可以是正面的(如聪明,忠诚),也可以是负面的(如固执,犯罪),但对人们影响更大的是他们与别人身份特征的异同。

Although traits can be positive (intelligent; loyal) or negative (stubborn; criminal), people are more affected by how similar or different their traits are compared to those of other people.


两个球队之间的友好竞争不一定是件坏事,但是,如果对抗过于激烈,或者在更大的社会问题上出现分歧、导致紧张,后果可能会更加严重。

A friendly rivalry between two sports teams isn’t necessarily a bad thing, but when rivalries are taken too far or tensions arise over differences about larger social issues, the consequences can be more serious.


Unit2

General Review

Writing

Update Security of Hexo

Update Security of Hexo

After I update the auto_deploy of Hexo Blog, I found that update blog is easier than I did before.

No matter what I have written, Only I need to do is that Push my everything from my local to remote.

But here’s some problems in it.

I used a new comment Module “Gitalk” which needed my secret key of my repo, and it can’t be ignore from push because the whole config file is needed for auto_deploy.

It means, I can only do auto deploy by split source and page to two repo, and source must be stored in private repo.

The following are my steps

  1. Create a new repo for store the source of Blog, and make sure it is private.

    step1

    step1.1

  2. Clone the repo, and copy everything from the original folder into new folder

    step2

  3. Delete the original source folder stored in remote. of course, delete the local storage, too.

    step3

  4. Delete the secret key from the original remote “XXX.github.io” and put it to the new repo(remember, the secret key store in the key by named “id_rsa” [without ‘.pub’]), and no need to move the deploy key.

    step4

  5. Config the github page configuration

    step5

  6. PUSH THE NEW REPO FROM LOCAL TO REMOTE

    step6

  7. AND …… DONE!

    Here may some 404 SHOW UP, but no need to worry.

step7

Bitcoin and Cryptocurrency Technologies

Bitcoin and Cryptocurrency Technologies

Catelog

  1. Intro to Crypto and Cryptocurrencies
    1. Crypto background
      1. hash functions
      2. digital signatures
      3. … adn applications
    2. Intro to cryptocurrencies
      1. basic digital cash

1. Intro

1.1 Cryptographic Hash Functions

Takes any string as input,
fixed-size output(we’ll use 256 bits),
efficiently computable

Security properties:

  1. collision-free

Intro:
Nobody can find x and y such that x != y and H(x) = H(y)
Notion: Collision-free is not equal No-Collision

Notion:
With a valid function, we can find a collision:
try 2^130 randomly chosen inputs, and have 99.8% chance that two of them will collide.
(No matter what hash function is)
(But it takes too long to matter.)
(But here’s no one have been proven a hash fucntion is collision-free.)

Application:
Hash as message digest: If we know H(x) = H(y), we can assume that x = y.
(Useful because the hash is small)

  1. hiding

Intro:
Given H(x), it is infeasible to find x.
If r is chosen from a probability distribution that has high min-entropy, then given H(r|x), it is infeasible to find x.

Notion:
High min-entropy means that the distribution is “very spread out”, so that no particular value is chosen with more than negligible probability.

Application:
Commitment: want to “seal a value in an envelope”, and “open the envelope” later.

Commitment API:

Commitment:
   1. (com, key) := commit(msg)
   2. match := verify(com, key, msg)
Verification:
   1. verify(com, key, msg) := (H(key | msg) == com)
   2. commit(msg) := (H(key | msg), key) *(where key is a random 256-bit value)*
  1. puzzle-friendly

Intro:
For every possible output value y,
if k is chosen from a distribution with high min-entropy,
then it is infeasible to find x such that H(k | x) = y

A mathmetical problem, which contains a large searching-space which is given for finding the solusion and where is no shortcut in it.
Puzzle-friendly property implies that no solving strategy is much better than trying random values of x.

Application: Search puzzle

SHA-256 hash function

scripts cut

2021.11.24


一橹渔歌一櫓春,天光云影了无尘。

漓江千载清如许,只洗青山不洗人。


放下旧爱是什么感觉?就好像,你已经开始节食健身减肥初见成效了,却偶然走进一家丰盛的超市。你走过糖果架,走过巧克力架,走过薯片可乐果仁鸡爪话梅牛肉干鱼豆腐,过去享用它们的记忆像子弹一样呼啸而来,欲火从喉咙烧到后脚跟。但你没有伸手,就这样头也不回的走过去了。


你喜欢一个人,把所有得好都掏出来,白马,蔷薇,泪痕与爱,你满脑子都是这些,想遍了故事的来龙去脉,所有的哀伤欢喜,都想明白了。你告诉自己,好的,就是这个人了。但是很遗憾的事情并没有按你所想的方向在发展,爱情像一匹失控的黑马,踏上了几乎没有灯火的荒原。你拉,是拉不住的。


大张旗鼓的离开其实都是试探,真正的离开是没有告别的,从来扯着嗓门喊着要走的人,都是最后自己把摔了一地的玻璃碎片,闷头弯腰一片一片拾了起来。而真正想离开的人,只是挑了一个风和日丽的下午,裹了件最常穿的大衣,出了门,然后就再也没有回来过。


用尽力气爱过之后是什么感觉?就好像你投入所有精力去写一篇作文,一切写的如此顺畅,就差一个结尾时候,老师认为你的作文不够好,将作文撕毁了,你不得已要重新来,可是明明开头和中间记忆那么深刻,你却再没了兴趣去动笔。


恋人未满,朋友不甘。


因为我爱你,所以常常想跟你道歉。我的爱沉重、污浊,里面带有许多令人不快的东西,比如悲伤,自怜,绝望;我的心又这样脆弱不堪。我自己总被这些负面情绪打败,好像在一个沼泽里越挣扎越下沉。而我爱你,就是把你也拖进来,却希望你救我。


你可能是雨,黄昏滴落我檐前,所以我画了一页江南,黛瓦青石巷,苏堤柳生烟,只为等你来。你可能是花,午后绽放我脚边,所以我写了一方小园,竹篱围茅舍,风弦日月琴,只为等你来。你可能是月,午夜婵娟我桌上,所以我研了一池水墨,笔尖迟迟语,素笺细细说,只为等你来。—白音格


我是个俗气至顶的人,见山是山,见海是海,见花便是花。

唯独见了你,云海开始翻涌,江潮开始澎湃,昆虫的小触须挠着全世界的痒。你无需开口,我和天地万物便通通奔向你。


曾经我自诩半个诗人,见山是深情伟岸,见海是热情澎湃,见花见草信他们皆有故事,云海江潮,虫鸣鸟啼都暗藏情愫。

唯独见了你,山川沉默,海面静谧,云海不再翻涌,江潮不再澎湃,花鸟鱼虫被光与尘凝固,世界万籁俱寂,只剩下你。


我来到你的城市,算不算重逢? 走过你走过的路,算不算拥抱? 淋过你淋过的雨,算不算亲密?


最近觉得特别浪漫的词是在课本上看到的,是个光学单位,叫做流明,是英文lumen的音译,简单说就是可以被人眼睛感受到的亮度。LED可以算出来有多少流明,太阳也可以算,月亮也可以算。喜欢的那个人会发光,也可以算。


第一杯酒敬你,所谓不合适就是你喜欢清风醉酒,我却独爱烈风自由。 第二杯酒敬你,岁月里你很干净,比水淡,比酒清。 第三杯酒敬你,黄昏时偷来你的肋骨酿酒,百年后醉的有血有肉。 第四杯酒敬你,晚风路过陶坛吹散的酒香,我记得你所有模样。


你是无意穿堂风,偏偏孤倨引山洪。


文笔是手术刀,是划开思想流通之阻碍的工具,我时常嫌弃自己这一把刀不够快,不够亮。仍然需要生活的磨砺。


“你背单词时,阿拉斯加的鳕鱼正跃出水面。你算数学时,太平洋彼岸的海鸥振翅掠过城市上空。你晚自习时,极圈中的夜空散漫了五彩斑斓。但是少年你别着急,在你为自己未来踏踏实实地努力时,那些你感觉从来不会看到的景色,那些你觉得终身不会遇到的人,正一步步向你走来。”


以前你习惯晚睡,我总是临睡前很用心的说一句早点睡吧。 以为你能明白我随口一说发自内心的关心。 现在我习惯了晚睡,轮到别人对我说,我才明白,这句话的苍白无力。大多数时候你对别人说的那些发自肺腑的情话,可能最感动的只有你自己。


这里只有黑暗,但是外面有光,有声音,有现实的喜悦,虽说可能也有苦难,但是不管前面埋伏着什么命运,那种尘世的光芒,我想再用自己的双眼看看


感觉有复习不完的功课就对了 说明你正在为成绩而努力 感觉有忙不完的事就对了 说明你正在为前程而奋斗 感觉处处不如人就对了 说明你正试图赶超 感觉走起来特别艰难就对了 说明你正在走上坡路


长到这么大,我说不出来我最爱的一部电影,说不出来我最爱的一首歌,说不出来我最爱的一个人。时常觉得人生其实没那么有趣,偶尔也会质疑活着的意义,所有来自于书上和别人口中的意义都不曾说服过我。但今天突然觉得,大概人生最大的意义就是用余生去找到那些最爱吧。


以前有人跟我说过,判断自己追的妹子是不是真心实意的方法有两个,第一,看她是不是愿意一整天跟我聊天,因为喜欢的人找聊天是没有理由拒绝的,如果忙只会回的慢,但一定不会不回。第二,看她愿不愿意在公共场合有亲密举动,谈恋爱就没什么好躲人的,如果是真喜欢反而更愿意被人看到。


你对我说这场雨停不下来了,我也要走了,明天的机票是十点四十,我们以后都不要再见面了吧,以前的事情都算了吧,小白就交给你了,烟就别抽了,喏,你当初给我的手链,还给你,时间不早了,我也该回去准备行李了,好好照顾自己,再见


她本来浑身是光,有那么一瞬间,突然就黯淡了,成为宇宙里的一颗尘埃,你努力回想起她全身是光的样子,,却怎么也想不起来,后来发现,那是第一次见到她时,你眼里的光


雄鹰站在悬崖上向东方一指:海上有仙岛,名字叫蓬莱,只要努力就一定能飞过去。它说得如此铿锵如此有感染力,让母鸡们走到悬崖边跃跃欲试。


「希望你知道,我在说“宇宙”这个词的时候,指的是什么。我不是在谈论浩瀚又神秘的世界,我是在说,你我共生在这同一范畴里实在是一件很美的事情。」


深情一个错的你,世间再无对的人。


我反对男尊女卑,我驳斥物化女性,我也觉得借着女权来夺取利益实在恶臭!我反对全面禁食狗肉,也坚决抵抗非法猎狗虐狗,我认为滥用权力对一方展露偏袒太罪恶!我是无才,也未必有多高尚,日日懒惰,偶尔放纵,会为了一点金钱弯腰低头苦干,但我也永远做一个尊重每一个愿意尊重别人的人的陌生人。


我天生不合群。一向话少,时而冷场。 有过被孤立,有过被诟病。 有过自我质疑,也有到过崩坏的边缘。 合也无味,孤也无味。党同伐异,这是人性。 最终决意做个哑巴。 少戾气,不言语,从心过活。 亚里士多德说“离群索居者,不是野兽,便是神灵。” 我既做不上神灵,那当个野兽也好。 ——何文抵

多机调度问题 scheduling problem of multicomputer

该问题作为一个NP hard 问题,属实引起了我的一点兴趣。

不过个人并不是数学强手,只能首先整理和收集大量的NP hard问题,以及寻求目前来说能够值得做的解法。

问题描述

​ 设有n个独立的作业{1, 2, …, n},由m台相同的机器{M1, M2, …, Mm}进行加工处理,作业i所需的处理时间为ti(1≤i≤n),每个作业均可在任何一台机器上加工处理,但不可间断、拆分。多机调度问题要求给出一种作业调度方案,使所给的n个作业在尽可能短的时间内由m台机器加工处理完成。
​ 设7个独立作业{1, 2, 3, 4, 5, 6, 7}由3台机器{M1, M2, M3}加工处理,各作业所需的处理时间分别为{2, 14, 4, 16, 6, 5, 3}。

解法思路

目的是为了将三台机器的处理时间平均分配,理想情况则需要让每台机器的处理时间都大致接近单台机器处理所有任务的总时间的1/3,然而由于任务的随机性,并不能完美保证任务的分配能使每台机器都接近1/3。

那么则需要通过权重值判定每个任务应该交由哪一台处理器处理。

重点来了:一旦我们每台机器都有任务需要处理时,那么我们就应该优先将新的任务交给最先完成任务的处理机。

​ 那么任务有序的情况下,优先分配的工作一定是工时长的,后续分配的工作工时更短,则在处理机有任务时,分配更短的任务更容易保证:原本最先处理完任务的处理机被分配任务后不会突然遇到这样一个情况 “接到一个非常漫长的任务,而如果将先前的任务分配给其他处理机反而会更好”

​ 而通过将任务按照工时降序排列,并将处理机用优先队列存放,则是实现的最优方式。

解法步骤

  1. 通过降序排序先将任务排序好。
  2. 通过优先队列将多机分别存储,并以被占用时间升序为优先队列权重排序方式,被占用最少的优先出队,相同则先入队者出队。
  3. 依次从优先队列取出处理机,依次从有序任务列表中取出尚未处理的任务,并根据出队出列表的顺序依次将任务布置给处理机。

实现代码

待实现

Elements' position and Width In CSS

Padding problem

So What’s the problem with it?

Most of the time, we wish the child element could fill the parent element width out, but also accept the padding limitation of its parent. However, while I try to develop a header used for the search bar, I need to put an input element in a header element and set the width of the child ‘100%’ which actually works but gets too good effect to accomplish my thoughts.

It really gets the parent width and sets it as the width of itself.

so while I want to set padding, the child element goes straight to the right position and makes me can’t see the end of the right side of the bar.

It fucks me.

After the trash CSS coding were wasted, I finally figured it out which we have to set both parent’s and child’s boxing-size as border-box

1
box-sizing: border-box;

Position Problem

And I Got an another problem, which is about the position.

We all knew if we want to place a child element in a absolute position among the parent’s area, we should set the child’s position as absolute, and set the interval between child and parent.

1
2
3
position: absolute
top: 15px
left: 0

And we got a child which stick in the top of the body, which means I can not let it move together with the parent.

And finally, I realize while we do not set the parent’s position as relative, the child can not follow the parent’s moving.

1
position: relative

0/1 Bag Problem Dynamic Processing

Example:

Example

MaxNumber = 4, MaxWeight = 8

EampleFinalDynamicTable

Personal Comprehension:

i 为 只包含前 i 个元素

j 为 包含前 i 个元素中若干个可能得到的重量

V(i, j)的结果是 前 i 个元素在满足小于 j 重量的前提下组合得到的最优质量结果

最重要的是如何获得这样一个最优结果:

  1. 逐列进行计算,在同样一个最大承重情况下,要想加入一个元素,首先必须判断其能否放入,其次判断放入一个新元素需要舍弃先前放入的哪些元素

  2. 又因为矩阵内先前的结果都是最优解,因此对比之前最优结果中与新元素同样质量的价值,然后判断加入新元素是否为更优解,以此获得最好的部分状态下的结果

  3. 同样的逻辑延申到最大重量情况,则得到全局最优结果

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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include<iostream>
using namespace std;
#include <algorithm>

int w[5] = { 0 , 2 , 3 , 4 , 5 }; //商品的体积2、3、4、5
int v[5] = { 0 , 3 , 4 , 5 , 6 }; //商品的价值3、4、5、6
int bagV = 8; //背包大小
int dp[5][9] = { { 0 } }; //动态规划表
int item[5]; //最优解情况

void findMax() { //动态规划
for (int i = 1; i <= 4; i++) {
for (int j = 1; j <= bagV; j++) {
if (j < w[i])
dp[i][j] = dp[i - 1][j];
else
dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w[i]] + v[i]);
}
}
}

void findWhat(int i, int j) { //最优解情况
if (i >= 0) {
if (dp[i][j] == dp[i - 1][j]) {
item[i] = 0;
findWhat(i - 1, j);
}
else if (j - w[i] >= 0 && dp[i][j] == dp[i - 1][j - w[i]] + v[i]) {
item[i] = 1;
findWhat(i - 1, j - w[i]);
}
}
}

void print() {
for (int i = 0; i < 5; i++) { //动态规划表输出
for (int j = 0; j < 9; j++) {
cout << dp[i][j] << ' ';
}
cout << endl;
}
cout << endl;

for (int i = 0; i < 5; i++) //最优解输出
cout << item[i] << ' ';
cout << endl;
}

int main()
{
findMax();
findWhat(4, 8);
print();

return 0;
}

有无进一步压缩矩阵的办法呢?

ESCAPE

ESCAPE

Topic

VM migration in Cloud in order to preventing the consistent attack.

Snapshot

Advantages: Lightweight, Rapid Response

Disadvantages

  1. While the latest version will probably be fragile, the container will be dangerous.
  2. the Snapshot could not prevent consistent attack.

Live Container Migration

**Advantages: ** Well prevention from consistent attack.

Disadvantages

  1. Resouces strongly needed.
  2. Time insensitive.

Objective

Realization

Central Behavior Monitoring

Once On Attack

As for Stateful Application

  1. Before Live Migration Solution, We rollback n times untill the attack has been checked as a consistent attack.(For loosen the cost of the ESCAPE)
  2. Live Migrate the Application once the attack is a consistent attack.

As for Stateless Application

Once we check out it has been attacked, we restart the server or migrates the container to a new host while rerouting the associated network connection.

Appendix

stateless service and stateful service – Reference

First-Post-Test

Delete-Last-Nth-Node

链接:https://leetcode-cn.com/problems/remove-nth-node-from-end-of-list/

题目:
Given the head of a linked list, remove the nth node from the end of the list and return its head.

remove_ex1

Example 1:

1
2
Input: head = [1,2,3,4,5], n = 2
Output: [1,2,3,5]

Example 2:

1
2
Input: head = [1], n = 1
Output: []

Example 3:

1
2
Input: head = [1,2], n = 1
Output: [1]

Constraints:

  • The number of nodes in the list is sz.
  • 1 <= sz <= 30
  • 0 <= Node.val <= 100
  • 1 <= n <= sz

解决了进阶问题: 一次循环解决问题

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
30
31
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* removeNthFromEnd(ListNode* head, int n) {
if(head->next == nullptr) return nullptr;
ListNode* temp = head;
ListNode* tail = temp->next;
for(int i = 1; i < n && tail != nullptr; i++) tail = tail->next;
if(tail == nullptr){
return head->next;
}
else{
while(tail->next != nullptr) {
temp = temp->next;
tail = tail->next;
}
temp->next = temp->next->next;
return head;
}

}
};