English Study 2

English Study Two

Project2DataVisualization

Ignore constants

Constant time and linear time

Use mathematics to express the step length

deprecator

Set the axis scale

MultipleLocator

Binary search == Linear search

Why algorithms are important

Allow duplicate values

Avoid empty physical addresses

Collection: One rule determines performance

Delete data instead of index

the speed of operation is not calculated by time but by the number of steps

time complexity

cucumber == elderberry

the based data structure:array

Why data structure is important

Sorting Algorithm

Comma-Delimited File –>csv

subscriptable

descendant

Perform api call and store response


Process the information of each article

For each article, perform an api call

Corresponding format

uniform resource locator –> url

if-elif-else conditional statement

Add a clickable link to the chart

Draw graphs based on data

Add custom tooltips

Overview of the most popular repository

Research the first repository

Explore information about the repository

Processing api response

Use api call to request data

application programming interface

Highlight color theme

Use pygal to style the world map

Execute api call and store response

Store the api response in a variable

Hide legend

improve pygal chart

Divide all countries into three groups based on population

Group countries according to population

Draw a complete world population map

Presenting digital data on the world map

If the specified country is not found, return none

According to the specified country, return the two-letter country code used by pygal

Get the first two letters as an identifier

binary(10) –> decimal(02)

Convert string to integer value

Nest dictionaries in the list

Making a world population map: json format

Line transparency

Color the drawing area

In the same code block, you need to keep the axis consistent when drawing multiple charts

Plot another data series

Cover a longer period of time

a common use case:一个常见的用例

Date tick-labels often overlap, so it is useful to rotate them and right align them. Also, a common use case is a number of subplots with shared x-axis where the x-axis is date data. The tick-labels are often long, and it helps to rotate them on the bottom subplot and turn them off on other subplots, as well as turn off x-labels.

日期刻度标签通常会重叠,因此旋转它们并使其右对齐很有用。 同样,一个常见的用例是具有共享x轴的多个子图,其中x轴是日期数据。 tick-label通常很长,它有助于在底部子图上旋转它们,并在其他子图上将其关闭,以及关闭x-label。

According to the original data, here should be modified to%Y/%m%d

Convert string to date object

Draw the chart based on the data

Chart temperature

If you traverse the document directly, you start traversing from the row content |

Get the maximum temperature from the file

Extract and read data

Print file header and its position

Return the contents of one line of the file

Can be inherited and called

install:安装 –> download:下载

Quickly create a list

Color mapping target data

learning target

Remove duplicate elements

Throw two dice with different faces at the same time

Send an interactive message

Count the number of occurrences of value in the list

Represents the class of a dice

It has six sides by default

Returns a random value between 1 and the number of faces on the dice

Requirement already satisfied

Use pygal to simulate a dice roll

Units are inches

Set the size of the drawing window

Increase points

Redraw the start and end points

Highlight the start and end

cm=Data that needs color mapping cmp=plt.cm.Colors

if conditional statement

As long as the program is active, it will continue to simulate random walks

simulate multiple random walks

Determine the direction of travel and the distance to travel in this direction

Refuse to stand still –> choose direction

Calculate the x and y values of the next point

Calculate all points included in a random walk

Keep walking until the list reaches the specified length

All random walks start at (0, 0)

A class that generates random walk data

i/o conflict

You must replace plt.show with plt.savefig or the saved chart will be blank

Automatically save the chart

use color-map 使用颜色映射

c argument looks like a single numeric RGB or RGBA sequence, which should be avoided as value-mapping will have precedence in case its length matches with x & y. Please use the color keyword-argument or provide a 2D array with a single row if you intend to specify the same RGB or RGBA value for all points.

c *参数看起来像一个单一的RGB或RGBA数字序列,应避免使用它,因为在其长度与* x *和* y *匹配的情况下,值映射将具有优先级。 如果要为所有点指定相同的RGB或RGBA值,请使用* color *关键字参数或将2D数组与单行一起提供。

Custom color: define/design the color by yourself

Delete the outline of the data point

Automatic calculation data

Use scatter to draw a series of points

Use scatter to draw and style scatter plots

Correction graphics

Set the chart title and label the axis

Set the size of tick marks

Modify label text and line thickness

condition / gallery

Draw a simple line chart

matplotlib –> math plot liberation

lib –> liberation:解放 库文件 自由 解脱 摆脱约束

data visualization –> generate data

Project1Alien Invasion

Object Glossary

Method ‘subsetsWithDup’ may be ‘static’

Passing使用/通过 list instead of Questions.Q2.Solution. Is this intentional?

flow chart –> schematic diagram

enable command –> return string:启用命令符

The action-operations corresponding to the active-sign should be placed outside the loop, otherwise even if the active-sign is activated, the action will still only loop once.

Switch the play button to inactive state

Reset game statistics:统计信息

Start a new game when the player clicks the play button

If the game is inactive, draw play button

Draw a color-filled button, and draw the text

Render msg as an image and center its button

The button label can only be created once

Determine which parts of the game to run

detect whether the aliens arrive the bottom of screen

Aliens arrive at the bottom of the screen

Create a group of new aliens and place the spaceship at the bottom center of the screen

clear the list —> hide cursor –> level up

Responding to a spacecraft hit by an alien

Initialize statistics that may change during the game’s running

Track game statistics

Increase bullet speed

Detect collisions between bullets and aliens

Disappear immediately

Take corresponding measures when an alien arrives at the border

Check if there are aliens on the border and update the position of the entire group of aliens

Detect if aliens hit the edge of the screen

Create settings that indicate the direction in which aliens are moving

move the alien to the right

Create the first line of aliens

Create an alien and add it to the current line

Create an alien and calculate how many aliens can fit in a row

The distance between aliens is the width of aliens

Determine how many aliens can fit in a row

Let alien appear on the screen

Draw alien at the specified position

Store the exact location of the alien

Each alien is initially near the upper left corner of the screen

Initialize the alien and set its starting position

Review the project

Class representing a single alien

generate permanent link:提交永恒链接

Delete the disappeared bullet

Move bullet up

Update the decimal value indicating the position of the bullet

Update the position of the rect representing the bullet

Avoid calling event repeatedly

Brief review

Press the keyboard

Release the keyboard

Limit the range of movement of the spacecraft

Respond to the button

Move the spaceship to the right

Allow constant movement

Adjust the position of the spacecraft according to the moving signs

Switch to new screen

Does not show on the screen

This code block needs to be put at the end

remove redundant parentheses

Alien invasion:外星人入侵

Armed spaceship:武装飞船

Make the most recently drawn screen visible

Monitor mouse and keyboard

Start the main loop of the game

Initialize the game and create a screen object

Redraw the screen every time it loops

Object one Aline Invasion

The program is adjusted according to the coordinates of the rectangle and screen

The screen will be constantly updated to show the new position of the element and hide the element in the original position to create a smooth movement effect.

Store the bullet position expressed as a decimal

Create a bullet object at the location of the spacecraft

Create a rectangle representing the bullet at (0,0), set the correct position

A class that manages the bullets fired by the spacecraft

Load the spaceship image and get its circumscribed rectangle

Place each ship in the bottom center of the screen

Draw the spaceship at the specified location

Set background color

Initialize the spaceship and set its initial position

Object English Short Sentences

Python Term

variable_0 = list(range(1, 1001)) –equivalence– variable_1 = [x for x in range(1, 1001)]

New Concept English

New Concept English

Day 01 A Puma at large 逃遁的美洲狮

Pumas are large, cat-like animals which are found in America. When reports came into London Zoo that a wild puma had been spotted forty-five miles south of London, they were not taken seriously.

However, as the evidence began to accumulate, experts from the Zoo felt obliged to investigate, for the descriptions given by people who claimed to have seen the puma were extraordinarily similar.

The hunt for the puma began in a small village where a woman picking blackberries saw ‘a large cat’ only five yards away from her. It immediately ran away when she saw it, and experts confirmed that a puma will not attack a human being unless it is cornered.

The search proved difficult, for the puma was often observed at one place in the morning and at another place twenty miles away in the evening. Wherever it went, it left behind it a trail of dead deer and small animals like rabbits. Paw prints were seen in a number of places and puma fur was found clinging to bushes. Several people complained of “cat-like noises’ at night and a businessman on a fishing trip saw the puma up a tree.

The experts were now fully convinced that the animal was a puma, but where had it come from? As no pumas had been reported missing from any zoo in the country, this one must have been in the possession of a private collector and somehow managed to escape. The hunt went on for several weeks, but the puma was not caught. It is disturbing to think that a dangerous wild animal is still at large in the quiet countryside.


puma n. 美洲狮
spot v. 看出,发现
evidence n. 证据
accumulate v. 积累,积聚
oblige v. 使……感到必须
hunt n. 追猎;寻找
blackberry n. 黑莓
human being 人类
corner v. 使走投无路,使陷入困境
trail n. 一串,一系列
print n. 印痕
cling v. 粘
convince v. 使……信服
somehow adv. 不知怎么搞地,不知什么原因
disturb v. 令人不安


美洲狮是一种体形似猫的大动物,产于美洲。当伦敦动物园接到报告说,在伦敦以南45英里处发现一只美洲狮时,这些报告并没有受到重视。

可是,随着证据越来越多,动物园的专家们感到有必要进行一番调查,因为凡是声称见到过美洲狮的人们所描述的情况竟是出奇地相似。

搜寻美洲狮的工作是从一座小村庄开始的。那里的一位妇女在采摘黑莓时的看见“一只大猫”,离她仅5码远,她刚看见它,它就立刻逃走了。专家证实,美洲狮非被逼得走投无路,是决不会伤人的。

事实上搜寻工作很困难,因为常常是早晨在甲地发现那只美洲狮,晚上却在20英里外的乙地发现它的踪迹。 无论它走哪儿, 一路上总会留下一串死鹿及死兔子之类的小动物, 在许多地方看见爪印, 灌木丛中发现了粘在上面的美洲狮毛。 有人抱怨说夜里听见“像猫一样的叫声”; 一位商人去钓鱼,看见那只美洲狮在树上。

专家们如今已经完全肯定那只动物就是美洲狮,但它是从哪儿来的呢?由于全国动物园没有一家报告丢了美洲狮,因此那只美洲狮一定是某位私人收藏豢养的,不知怎么设法逃出来了。搜寻工作进行了好几个星期,但始终未能逮住那只美洲狮。想到在宁静的乡村里有一头危险的野兽继续逍遥流窜,真令人担心。

一台电脑使用多个GitHub

转载自https://www.itrhx.com/2019/01/18/A16-deploy-two-or-more-hexo-blogs/

原理分析:

  • SSH的公钥是GitHub作为本地仓库和远程仓库连接的唯一标识,一个公钥只能对应一个GitHub账户,如果将一个相同的公钥上传到不同的GitHub账户,GitHub则无法做出辨识,进而导致错误。
  • 一台电脑,可以生成多对公私钥,可以通过配置,将不同的公钥上传到不同的GitHub账号,那么就不存在单个公钥绑定多个GitHub账号的情况存在了。

相关问题报错:

  • 同一台电脑部署第二个Hexo博客执行hexo g -d时报错:ERROR: Permission to xxxxxx/xxxxxx.github.io.git denied to xxxxxx.
  • 添加新的 SSH 密钥 到 SSH agent 执行ssh-add xxx时报错:Could not open a connection to your authentication agent.
  • 单独设置用户名/邮箱时报错:fatal: not in a git directory

以下是详细过程:
前提:假设你的第二个博客相关配置操作已经顺利完成,但使用hexo g -d命令部署到 GitHub 上时报错:ERROR: Permission to xxxxxx/xxxxxx.github.io.git denied to xxxxxx.

- 查看当前密钥

首先我们打开终端输入ls ~/.ssh/可以查看当前已有的密钥,显示id_rsaid_rsa_pub说明已经有一对密钥

- 创建新的密钥

首先使用以下命令进入 SSH根目录下:

1
复制cd ~/.ssh/

方法一

直接使用以下命令创建新密钥,然后两次回车即可:

1
复制ssh-keygen -t rsa -f  ~/.ssh/这里是新密钥名称 -C "这里是你的邮箱"

注意区别新密钥名称和旧密钥名称,不要相同!!!

方法二

使用下面命令行创建新密钥:

1
复制ssh-keygen -t rsa -C "这里是你的邮箱"

回车后会出现:

1
2
复制Generating public/private rsa key pair.  
Enter file in which to save the key (/c/Users/you/.ssh/id_rsa):

注意此时需要你输入新密钥的名称,同样要注意区别新密钥名称和旧密钥名称,不要相同!!!之后再两次回车,新密钥创建完毕!

- 配置config

查看你的.ssh/根路径下, 有没有config文件,( 比如我的路径为C:\Users\Lenovo.ssh)没有则使用以下命令创建一个config文件:

1
复制touch config

用记事本或者其他工具打开config文件(注意config文件是没有任何后缀名的),写入以下配置:

1
2
3
4
5
6
7
8
9
10
11
复制#第一个账号,默认使用的账号,不用做任何更改
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa

#第二个新账号,#"xxxxxx"为前缀名,可以任意设置,要记住,后面需要用到
Host xxxxxx.github.com
HostName github.com
User git
IdentityFile ~/.ssh/这里是你创建的新密钥的名称

- 设置新GitHub账户SSH key

输入以下命令复制你创建的公钥:

1
复制clip < ~/.ssh/这里是你创建的新密钥的名称.pub

也可以直接在.ssh目录下找到你创建的新的公钥,文件名为新密钥的名称.pub,(比如我的是trhx_rsa.pub),用记事本打开,复制里面的内容,然后打开你的新GitHub账号主页,依次进入Settings —> SSH and GPG keys —> New SSH key,将刚复制的内容粘贴到Key那里,Title可以随便填,点击Add Key保存。

- 清空本地的 SSH 缓存,添加新的 SSH 密钥 到 SSH agent中

使用命令cd ~/.sshcd到.ssh根目录下,依次执行以下命令:

1
2
3
复制ssh-add -D
ssh-add xxxxxx #旧密钥名称,一般是id_rsa
ssh-add xxxxxx #新创建的密钥名称

如果执行以上命令出现错误:Could not open a connection to your authentication agent.,那么就需要先执行ssh-agent bash,再执行以上命令。

- 验证配置是否成功

依次执行以下命令,第一个为默认ssh_key验证;第二个为新的ssh_key验证,其中“xxxxxx”为你先前在config文件中的命名

1
2
复制ssh -T git@github.com
ssh -T git@xxxxxxx.github.com

依次显示以下信息, 则说明配置成功:

1
复制Hi 你的用户名! You've successfully authenticated, but GitHub does not provide shell access.

- 取消全局用户名/邮箱配置,单独设置用户名/邮箱

执行如下命令,取消全局用户名和邮箱配置(如果已经设置了全局的话):

1
2
复制git config --global --unset user.name
git config --global --unset user.email

分别进入你的两个Hexo博客.git目录下执行以下命令单独设置用户名/邮箱:

1
2
复制git config user.name "这里是用户名"
git config user.email "这里是你的邮箱"

如果此时报错:fatal: not in a git directory,说明你没有进入.git目录下,具体路径:\Hexo.deploy_git.git,.git目录是隐藏的,需要你设置隐藏目录可见

执行以下命令可以查看设置是否成功

1
复制git config --list

- hexo 配置文件修改git地址

打开你的第二个博客Hexo目录下的_config.yml文件,找到deploy关键字,写入以下配置并保存:

1
2
3
4
复制deploy:
type: git
repository: git@xxxxxx.github.com:你的用户名/你的用户名.github.io.git
branch: master

比如我的配置:

1
2
3
4
复制deploy:
type: git
repository: git@love109.github.com:love109/love109.github.io.git
branch: master

大功告成,再次执行hexo g -d就能成功将新的博客部署到 Github 上了

转载自:https://www.itrhx.com/2019/01/18/A16-deploy-two-or-more-hexo-blogs/

Review

hexo g -d报错

-Info

1
2
3
4
5
6
7
8
9
10
11
12
13
14
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
FATAL {
err: Error: Spawn failed
at ChildProcess.<anonymous> (F:\StarFire\Blog\blog\node_modules\hexo-deployer-git\node_modules\hexo-util\lib\spawn.js:51:21)
at ChildProcess.emit (events.js:315:20)
at ChildProcess.cp.emit (F:\StarFire\Blog\blog\node_modules\cross-spawn\lib\enoent.js:34:29)
at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12) {
code: 128
}
} Something's wrong. Maybe you can find the solution here: %s https://hexo.io/docs/troubleshooting.html

发现是ssh链接报错

-Analysis

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
cd ~/.ssh or /etc/ssh/ssh_config

vim config or ssh_config

Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
Port 22

# HOST 域名
Host <github_name>.github.com
HostName ssh.github.com
User xxx.@email.com # 注册github的账号
PreferredAuthentications publickey # 验证顺序->ssh验证
IdentityFile ~/.ssh/lyh0825 # 私钥地址 用于验证public_key
Port 22 # 22为ssh端口 443为https端口

English Study

English Study ONE

Python Glossary

Python Chinese English Comparison

Create an instance and assign attributes

It is equivalent to creating a series of attributes equivalent to instance for testcase

相当于给testcase创建一系列等同于instance的属性

The purpose of testing is to protect other code blocks

Create a survey object and a set of answers for the test method used

Test for Anonymous Survey class

Collect anonymous survey answers

Store a question and prepare for storing the answer

Launching unit-tests with arguments python -m unit-test(使用参数python -m unit-test启动单元测试 )

passable test –> reptile(爬虫)

Unit tests and test cases –> Key-value pair

separate –> separator

The split() method splits the string into multiple parts using spaces as the separator, and stores these parts in a list.

Possible exception types –> skeleton –> Debug code block

By using an absolute path, files anywhere in the system can be read.

Divide the code into a series of functions that complete specific tasks. This process is called refactoring

Save and read user-generated(生成的) data

JSON –> JavaScript Object Notation ——>placeholder

Calculate how many words the file contains

text —–> we will take a test for today`s text

Analyze the text <==> text analysis

Use try-except-else code blocks to defend against unintentisonal user errors and malicious attacks

a simple attempt to simulate the calculator

Use exceptions to avoid crashes

zero division error

Create a list containing the contents of each line of the file

read() returns an empty string when it reaches the end of the file

The keyword with will close the file when it is no longer needed –> with-as loop strcture

when creating a subclass, the super class must be in the current file.

Properties that need to be modified <==> attributes that need to be modified

python standard library

Custom workflow

This import method is not recommended ==> from module_name import *

Print a message indicating the battery’s range –> Import a single class

Set the value of the odometer to the specified value, and it is forbidden to dial the odometer back.

Store multiple classes in one module –> Same level directory

Import multiple classes from one module –> Import the entire module

this car can go approximately 240 miles on full charge.

print a message indicating the battery`s range

battery capacity:电池容量

use instances as attributes

override the method of super class

It automatically gets all the attributes and methods of another class.

assign a default value to the property

Create instance based on class

A simple attempt to simulate a dog

object oriented programming:面向对象编程

to separate adjacent functions:将相邻函数分开

Function writing guide=Guidelines for function writing

Assign alias to function using as:使用as给函数指定别名

Call function directly

ignore unresolved reference ‘module’:忽略未引用的模块

Store functions in modules:将函数存储在模型中

pass a copy of the list instead of original

Prohibited function modification list:禁止函数修改列表

Please enter the name of the album you want to query.

Nested functions in while loop

Non-essential:非必要的

formal parameters:形参(x,y,variable)

arguments:实参(specific information–pass–>formal parameters)

pass parameters to the function=pass arguments to the function

docstring:annotate

argument:争论,参数=parameter

Use user-input to populate the dictionary.

continue and break applies to any loop body.

There must be conditional judgments such as if in front.

There must be conditional statements such as if in front.

Return operation according to bool:根据bool返回操作

Direct termination:直接终止

Schematic diagram:示意图

sketch:速写,略图,草绘

Escape character:转义符

vocabulary:词汇表

comparison:比较,比喻

Conditional statement:条件语句

archives:档案,把…存档

response poll:回应调查

polling active:轮询活动

The pastrami is sold out:五香熏牛肉卖完了

Dream resort:理想的度假胜地

poll results:投票结果

Python English Short Sentences

The only difference between the test class and the test function is that you need to create an instance before the test class


In this example, the use of try-except-else code block provides two important advantages, to avoid allowing users to see the traceback; so that the program can continue to analyze and find other files.


For the method of the supclass, as long as it does not conform to the behavior of the instance simulated by the subclass. It can be overridden, and a method can be defined in the subclass, that is, it has the same name as the method of the supclass to be overridden. In this way, Python will not consider the supclass method, but only pay attention to the corresponding method you define in the subclass.


Guidelines for functions writing:

  • When specifying default values for parameters, there should be no spaces on both sides of the equal sign.
  • This Convention should also be followed for keyword-arguments in function calls.
  • If a program or module contains multiple functions, use two empty lines to separate adjacent functions.

When the default values are specified for the parameter, there should be no spaces on the sides of the equals, and this agreement should also be followed for the keyword-arguments in the function call.

If a program or module contains multiple functions, two adjacent blank functions can be used to separate the adjacent functions.


The best way to quote is to import only the functions you need, or import the entire module and use the period notation句号表示法.

The best practice for references is either两者中的任一个 to import only the functions you need to use, or to import the entire module and use a period representation.

The best way to do this is to import only the functions you need, or import the entire module and use the period notation.

引用的最佳的做法是,要么只导入你需要使用的函数,要么导入整个模块并使用句点表示法


The module and the files that need to call the functions in the module should be placed in the same directory.模块与需要调用模块内函数的文件要放在同一目录下


The import statement allows the code in the module to be used in the currently running program file.


I have a dog, and it`s name is floret.


Function allows your program to be divided into multiple small parts, each part is responsible for completing a specific task.


if you could visit one place in the world, where would you go?

which mountain would you like to climb someday?


The for-in loop structure is used to traverse the static list, and the while-break loop structure is used to traverse the dynamic list.

:verifying user

:the following users have been confirmed


Please enter the number of restaurant reservations you want to reserve

:Sorry, there are no tables available.

:Congratulations! there are enough seats


If the program falls into an endless loop, you can close the terminal window that displays the program output.

Please enter your age and I will tell you the price of the movie ticket.


Python Terms

function’s abbreviation is fn

Use as to assign an alias to a function:使用as给函数指定别名

When calling this function, it can handle it correctly no matter how many key-value pairs are provided.调用这个函数,无论多少提供多少额外的键值对,它都能正确处理.

Unboundlocalerror : local variable ‘full_info’ referenced before assignment:

Unboundlocalerror:分配前已引用局部变量’full_info’(外部变量与内部变量冲突)

Encapsulate these values in a dictionary:将这些值封装到字典中

TypeError: describe_pet() missing 1 required positional argument: ‘pet_name

:类型错误,describe函数确实一个必要的实参’pet_name’

Equivalent function call:等效的函数调用

The order of positional arguments is important:位置实参的顺序十分重要.

Domain’s DNS record could not be retrieved:无法检索域的DNS记录。

The while-loop contains conditional statements

Return to circulatory body

Conditional judgment

Operation down

sublime text:代码编辑器