This is an automatically translated post by LLM. The original post is in Chinese. If you find any translation errors, please leave a comment to help me improve the translation. Thanks!

Project Background

The Innovation Port badminton venue has a high demand for reservations every day. The online reservation system opens around 8:40 am every morning, and the opening time is not fixed. These factors have caused a lot of trouble for manual venue reservations, so it is considered to automate the venue reservation process with a script.

阅读全文 »

写作缘由

由于经常换电脑设备,每次更换设备时都需要重新配置Hexo环境,故对配置流程进行记录,以供后续使用。

阅读全文 »

This is an automatically translated post by LLM. The original post is in Chinese. If you find any translation errors, please leave a comment to help me improve the translation. Thanks!

Reasons for Writing

Due to frequently changing computer devices, every time a device is replaced, the Hexo environment needs to be reconfigured. Therefore, the configuration process is recorded for future use.

阅读全文 »

nltk简介

NLTK是构建Python程序以使用人类语言数据的领先平台。它为50多种语料库和词汇资源(如WordNet)提供了易于使用的界面,还提供了一套用于分类,标记化,词干化,标记,解析和语义推理的文本处理库。NLTK是Python上著名的⾃然语⾔处理库 ⾃带语料库,具有词性分类库 ⾃带分类,分词,等等功能。

阅读全文 »

This is an automatically translated post by LLM. The original post is in Chinese. If you find any translation errors, please leave a comment to help me improve the translation. Thanks!

Introduction to NLTK

NLTK is a leading platform for building Python programs that use human language data. It provides an easy-to-use interface for over 50 corpora and lexical resources (such as WordNet), as well as a text processing library for classification, tokenization, stemming, tagging, parsing, and semantic inference. NLTK is a famous natural language processing library on Python, which comes with its own corpus, part-of-speech tagging library, tokenization, and other functions.

阅读全文 »

This is an automatically translated post by LLM. The original post is in Chinese. If you find any translation errors, please leave a comment to help me improve the translation. Thanks!

The Self in Society

Self-concept: Who am I

  1. People often see themselves as the center of everything, overestimating how much others pay attention to us. This is known as the spotlight effect.
  2. We are sensitive to changes in our emotions and believe that others also notice them clearly. However, the number of people who actually notice us is often fewer than we think. This is known as the transparency illusion.
  3. Social environment influences self-perception, and our understanding of ourselves in different environments is influenced by the differences in those environments. For example, when abroad, we may identify ourselves as Chinese, but when in our home country, we may identify more with a specific region (e.g. being from Shaanxi or Xi'an).
  4. Self-perception is often biased towards self-interest. When problems arise, people tend to blame others, while when achievements are made, people often feel that their contributions are underestimated.
  5. We define ourselves in social relationships. Our behavior may vary when interacting with different people, and these variations help us understand and define our own roles.
  6. Self-schemas play a significant role in our self-perception and information processing. They determine how we perceive, remember, and evaluate others and ourselves. For example, a professional athlete may pay particular attention to others' bodies and skills.
  7. The self-reference effect leads us to have a stronger memory for things related to ourselves. Because we see ourselves as the center of the world, we tend to overestimate the extent to which events are directed towards us (we always believe that we are the central figure in accomplishing something).

Self-awareness

  1. When explaining our own behavior, we tend to overestimate the role of our thoughts and consciousness while underestimating the influence of external factors. For example, people often believe that they are not influenced by the media and think that the media only affects others.
  2. Others can often predict our behavior more accurately than we can predict it ourselves. This is because when making self-predictions, we tend to focus on prominent factors in the present and overlook important but unnoticed factors. This leads to errors in future expectations.
  3. In negative events, we tend to exhibit impact bias, overestimating the lasting impact of the events and underestimating our own resilience. Moreover, significant negative events can trigger our psychological defense mechanisms, which may result in shorter durations of distress compared to minor emotional fluctuations.
  4. One viewpoint suggests that our actual thinking process and our explanations of our thinking are two different things. For example, when asked to explain why they like a particular painting, participants who were required to provide reasons showed lower satisfaction with the painting several weeks later compared to those who did not provide attributions. This suggests that rational attributions of our mental processes can render our future predictions invalid, indicating that there are many aspects of our actual thinking process that cannot be captured when analyzing our own thoughts.

Self-control

  1. Self-control is a depletable resource, similar to muscle strength. It becomes weaker after being used and recovers after rest, and it can be strengthened through continuous training. Self-control is limited, and when we expend a significant amount of energy on self-control in daily life (e.g. resisting food or suppressing thoughts), we may become powerless when facing challenges.
  2. Self-efficacy, the optimistic belief in one's own abilities and efficiency, can lead to greater rewards. Individuals with high self-efficacy are more resilient and live healthier lives.
  3. Locus of control refers to whether we believe that we control our own destiny (internal locus of control) or that external forces control it (external locus of control). Whether we feel that we have control over our destiny depends on how we interpret setbacks. Individuals with an internal locus of control tend to attribute failures to unexpected circumstances or the need to try new approaches. On the other hand, individuals with an external locus of control attribute failures to factors they believe they cannot control (e.g. attributing poor academic performance to being dumb or disliking the teacher).
  4. Learned helplessness occurs when individuals feel that they have no control over their own actions or the actions of others, leading to a loss of control over events. In contrast, self-determination involves having some control over oneself and the environment. Learned helplessness often leads to increased stress, weakness, and rapid aging. Increasing self-control can enhance individual happiness and health. However, excessive freedom and self-determination can also lead to decreased life satisfaction and increased rates of depression. Having too many choices can leave individuals feeling overwhelmed.

2021.04

矫揉做作地喜好各种规矩就是“有系统”,孜孜不倦且兴致勃勃地处理鸡毛蒜皮的公事就是“勤勉”;该做的事优柔寡断就是“谨慎”;不该做的事盲目地坚持到底就是“决心”。

-- 《银河帝国2:基地与帝国》

阅读全文 »

This is an automatically translated post by LLM. The original post is in Chinese. If you find any translation errors, please leave a comment to help me improve the translation. Thanks!

2021.04

Being artificially fond of various rules is called "systematic", tirelessly and enthusiastically dealing with trivial matters is called "diligence"; being indecisive about what should be done is called "caution"; persisting blindly in what should not be done is called "determination".

-- "Foundation and Empire" by Isaac Asimov

阅读全文 »

Vue

与Flask一起使用时的注意事项

Vue与Flask一起使用时会出现冲突,更改配置即可解决。

  • Flask
1
2
3
4
if __name__ == '__main__':
app.jinja_env.variable_start_string = '[['
app.jinja_env.variable_end_string = ']]'
app.run(debug=True)
  • Vue
1
2
3
new Vue({
delimiters: ['[[',']]']
})

指令

指令 作用
v-model
v-once 一次性插入数据,当数据改变时,插值处内容不会改变
v-html 以HTML代码的形式插入数据
v-bind (:) 用于在HTML attribute中绑定property
v-on (@) 将DOM事件与方法绑定
v-for
v-if 根据表达式的值的真假来插入/移除对应的HTML元素。

JavaScript

Truthy(真值)和Falsy(虚值)

JavaScript 中,truthy(真值)指的是在布尔值上下文中,转换后的值为 true 的值。被定义为假值以外的任何值都为真值。(即所有除 false0-00n""nullundefinedNaN 以外的皆为真值)。

JavaScript 中的真值示例如下

1
2
3
4
5
6
7
8
9
10
11
12
13
if (true)
if ({})
if ([])
if (42)
if ("0")
if ("false")
if (new Date())
if (-42)
if (12n)
if (3.14)
if (-3.14)
if (Infinity)
if (-Infinity)

JavaScript的逻辑与运算中,如果第一个操作数为真值,则逻辑与运算返回第二个操作数

1
2
3
4
5
true && "dog"
// returns "dog"

[] && "dog"
// returns "dog"

falsy 值(虚值)是在 Boolean 上下文中认定为 false 的值。

JavaScript 在需要用到布尔类型值的上下文中使用强制类型转换 (Type Conversion ) 将值转换为布尔值,例如条件语句和循环语句。

在 JavaScript 中只有 8 个 falsy 值。

说明
false false 关键字
0 数值 zero
-0 数值 负 zero
0n 当 BigInt 作为布尔值使用时,遵从其作为数值的规则. 0nfalsy 值。
"", '', `| 这是一个空字符串 (字符串的长度为零). JavaScript 中的字符串可用双引号 **""**, 单引号''`, 或 模板字面量 ```` 定义。
null null - 缺少值
undefined undefined - 原始值
NaN NaN - 非数值
0%