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 - 非数值

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!

Vue

Notes on Using Vue with Flask

There may be conflicts when using Vue with Flask, but they can be resolved by changing the configuration.

  • 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: ['[[',']]']
})

Directives

Directive | Purpose |

请求伪装

在爬取腾讯天气时,发现无法成功爬取到天气数据,经过尝试发现是请求头除了问题。爬虫在爬取网页时的默认请求头为:

这种默认的请求头在爬取很多网站时会被禁止,无法获取到网页数据,因此需要使用请求头伪装,让网站认为是浏览器在访问。操作步骤如下:

阅读全文 »

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!

Request Spoofing

When crawling Tencent weather data, it was found that the weather data could not be successfully crawled. After some attempts, it was discovered that the issue lies in the request headers. The default request headers used by the spider when crawling web pages are:

This default request header may be blocked when crawling many websites, making it impossible to obtain web page data. Therefore, request header spoofing is needed to make the website think it is a browser accessing it. The operation steps are as follows:

阅读全文 »

简介

Bilibili(以下简称B站)中有大量的番剧版权,截止目前一共有3161部。每一部番剧都可以找到它的播放量追番量弹幕数量等播放数据,除此之外,每部番剧还有其相应的标签(如“漫画改”,“热血”,“搞笑”)。本项目旨在分析番剧播放数据与番剧标签之间的关系,同时也是一项数据分析的大作业,采用APriori频繁项集挖掘进行分析。

GitHub地址:https://github.com/KezhiAdore/BilibiliAnimeData_Analysis

码云地址:https://gitee.com/KezhiAdore/BilibiliAnimeData_Analysis

阅读全文 »

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

Bilibili (referred to as B station) has a large number of anime copyrights, with a total of 3161 as of now. Each anime can be found with its play count, follow count, barrage count, and other playback data. In addition, each anime has its corresponding tags (such as "comic adaptation", "hot-blooded", "comedy"). This project aims to analyze the relationship between anime playback data and anime tags, and it is also a data analysis project that uses APriori frequent itemset mining for analysis.

GitHub address: https://github.com/KezhiAdore/BilibiliAnimeData_Analysis

Gitee address: https://gitee.com/KezhiAdore/BilibiliAnimeData_Analysis

阅读全文 »

GitHub地址:https://github.com/KezhiAdore/MultiRobots_CoverMap

码云地址:https://gitee.com/KezhiAdore/MultiRobots_CoverMap

一、问题提出

1. 背景

机器人在工业、国防和科学技术中的应用日益广泛, 它能够在枯燥和危险的复杂非结构化环境下工作。使用机器人大大提高了人们的工作效率, 改变了人们的生活方式, 带来了巨大的经济和社会效益, 有力地推动了有关学科和技术领域的发展。

区域覆盖是指携带有一定探测范围的传感器如激光、声纳等的机器人探索访问整个区域, 并完成相应任务的过程。区域覆盖是自主移动机器人的一项基本任务。

阅读全文 »

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!

GitHub link: https://github.com/KezhiAdore/MultiRobots_CoverMap

Gitee link: https://gitee.com/KezhiAdore/MultiRobots_CoverMap

1. Introduction

1. Background

Robots are increasingly being used in industries, defense, and scientific and technological fields. They can work in complex and dangerous environments that are monotonous and unstructured. The use of robots greatly improves work efficiency, changes people's lifestyles, brings enormous economic and social benefits, and promotes the development of related disciplines and technologies.

Area coverage refers to the process of exploring and accessing the entire area with robots carrying sensors with a certain detection range, such as lasers and sonars, and completing corresponding tasks. Area coverage is a fundamental task of autonomous mobile robots.

阅读全文 »

频域滤波器简介

频域滤波器与空域滤波器相对,空域滤波器是空间卷积块与空间图像做卷积运算,而频域滤波是在将图像进行了离散傅里叶变换之后在频域上与滤波器做乘法,之后再进行傅里叶反变换得到滤波之后的图像。

使用频域滤波器对图像进行滤波的基本步骤:

  • 对图像进行DFT变换得到原图像的频域图像
  • 频域图像与频域滤波器相乘得到新的频域图像
  • 对新的频域图像进行IDFT变换到空域得到新图像。
阅读全文 »
0%