9月 062021
 
aunt-or-auntie

 

生词(OALD)

polite /pəˈlaɪt/
adjective
having or showing good manners and respect for the feelings of others
有礼貌的;客气的;儒雅的

way /weɪ/
noun
[countable] a method, style or manner of doing something
方法;手段;途径;方式

address /əˈdres/
noun
[uncountable] form/mode of address the correct title, etc. to use when you talk to somebody
称呼

refer /rɪˈfɜː(r)/
verb
to mention or speak about somebody/something
提到;谈及;说起

especially /ɪˈspeʃəli/
adverb
more with one person, thing, etc. than with others, or more in particular circumstances than in others
尤其;特别;格外
8月 252021
 

AnyConnect Deployment Overview
Deploying AnyConnect refers to installing, configuring, and upgrading the AnyConnect client and its related files.

The Cisco AnyConnect Secure Mobility Client can be deployed to remote users by the following methods:

Predeploy—New installations and upgrades are done either by the end user, or by using an enterprise software management system (SMS).

Web Deploy—The AnyConnect package is loaded on the headend, which is either an ASA or FTD firewall, or an ISE server. When the user connects to a firewall or to ISE, AnyConnect is deployed to the client.

For new installations, the user connects to a headend to download the AnyConnect client. The client is either installed manually or automatically (web-launch).

Updates are done by AnyConnect running on a system where AnyConnect is already installed, or by directing the user to the ASA clientless portal.

When you deploy AnyConnect, you can include optional modules that enable extra features, and client profiles that configure the VPN and optional features.

Refer to the AnyConnect release notes for system, management, and endpoint requirements for ASA, IOS, Microsoft Windows, Linux, and macOS.

内容引用:

Cisco AnyConnect Secure Mobility Client Administrator Guide, Release 4.0 – Deploy AnyConnect [Cisco AnyConnect Secure Mobility Client] – Cisco

8月 052021
 

通过查看dmesg信息获取当前文本终端的默认显示分辨率

[ 4.426948] [drm] DMA map mode: Caching DMA mappings.
[ 4.427281] [drm] Capabilities:
[ 4.427282] [drm] Rect copy.
[ 4.427282] [drm] Cursor.
[ 4.427283] [drm] Cursor bypass.
[ 4.427283] [drm] Cursor bypass 2.
[ 4.427283] [drm] 8bit emulation.
[ 4.427284] [drm] Alpha cursor.
[ 4.427284] [drm] 3D.
[ 4.427284] [drm] Extended Fifo.
[ 4.427284] [drm] Multimon.
[ 4.427285] [drm] Pitchlock.
[ 4.427285] [drm] Irq mask.
[ 4.427285] [drm] Display Topology.
[ 4.427286] [drm] GMR.
[ 4.427286] [drm] Traces.
[ 4.427286] [drm] GMR2.
[ 4.427286] [drm] Screen Object 2.
[ 4.427287] [drm] Command Buffers.
[ 4.427287] [drm] Command Buffers 2.
[ 4.427287] [drm] Guest Backed Resources.
[ 4.427288] [drm] DX Features.
[ 4.427288] [drm] HP Command Queue.
[ 4.427288] [drm] Capabilities2:
[ 4.427289] [drm] Grow oTable.
[ 4.427289] [drm] IntraSurface copy.
[ 4.427289] [drm] DX3.
[ 4.427290] [drm] Max GMR ids is 64
[ 4.427291] [drm] Max number of GMR pages is 65536
[ 4.427292] [drm] Max dedicated hypervisor surface memory is 0 kiB
[ 4.427292] [drm] Maximum display memory size is 262144 kiB
[ 4.427293] [drm] VRAM at 0xe8000000 size is 131072 kiB
[ 4.427294] [drm] MMIO at 0xfe000000 size is 256 kiB
[ 4.437927] [TTM] Zone kernel: Available graphics memory: 996108 KiB
[ 4.464121] [drm] Screen Target Display device initialized
[ 4.464193] [drm] width 1280
[ 4.464211] [drm] height 768
[ 4.464229] [drm] bpp 32
[ 4.493584] [drm] Fifo max 0x00040000 min 0x00001000 cap 0x0000077f
[ 4.591064] [drm] Using command buffers with DMA pool.
[ 4.594738] [drm] Atomic: yes.
[ 4.594741] [drm] SM5 support available.

通过hwinfo命令查看当前可用的分辨率模式

[root@fedora ~]# hwinfo --framebuffer
02: None 00.0: 11001 VESA Framebuffer 
[Created at bios.459]
Unique ID: rdCR.O3PgoQaqFo1
Hardware Class: framebuffer
Model: "VMware virtual machine"
Vendor: "VMware, Inc"
Device: "VMware virtual machine"
SubVendor: "V M ware, Inc. VBE support 2.0"
SubDevice: 
Revision: "2.0"
Memory Size: 0 MB
Memory Range: 0xe8000000-??? (rw)
Mode 0x0300: 640x400 (+640), 8 bits
Mode 0x0301: 640x480 (+640), 8 bits
Mode 0x0303: 800x600 (+800), 8 bits
Mode 0x0305: 1024x768 (+1024), 8 bits
Mode 0x0307: 1280x1024 (+1280), 8 bits
Mode 0x030e: 320x200 (+640), 16 bits
Mode 0x0311: 640x480 (+1280), 16 bits
Mode 0x0314: 800x600 (+1600), 16 bits
Mode 0x0317: 1024x768 (+2048), 16 bits
Mode 0x031a: 1280x1024 (+2560), 16 bits
Mode 0x0320: 320x200 (+320), 8 bits
Mode 0x0321: 320x400 (+320), 8 bits
Mode 0x0322: 640x400 (+640), 8 bits
Mode 0x0323: 640x480 (+640), 8 bits
Mode 0x0324: 800x600 (+800), 8 bits
Mode 0x0325: 1024x768 (+1024), 8 bits
Mode 0x0326: 1152x864 (+1152), 8 bits
Mode 0x0327: 1280x960 (+1280), 8 bits
Mode 0x0328: 1280x1024 (+1280), 8 bits
Mode 0x0329: 1400x1050 (+1408), 8 bits
Mode 0x032a: 1600x1200 (+1600), 8 bits
Mode 0x032b: 1792x1344 (+1792), 8 bits
Mode 0x032c: 1856x1392 (+1856), 8 bits
Mode 0x032d: 1920x1440 (+1920), 8 bits
Mode 0x032e: 320x200 (+640), 16 bits
Mode 0x032f: 320x400 (+640), 16 bits
Mode 0x0330: 640x400 (+1280), 16 bits
Mode 0x0331: 640x480 (+1280), 16 bits
Mode 0x0332: 800x600 (+1600), 16 bits
Mode 0x0333: 1024x768 (+2048), 16 bits
Mode 0x0334: 1152x864 (+2304), 16 bits
Mode 0x0335: 1280x960 (+2560), 16 bits
Mode 0x0336: 1280x1024 (+2560), 16 bits
Mode 0x0337: 1400x1050 (+2816), 16 bits
Mode 0x0338: 1600x1200 (+3200), 16 bits
Mode 0x0339: 1792x1344 (+3584), 16 bits
Mode 0x033a: 1856x1392 (+3712), 16 bits
Mode 0x033b: 1920x1440 (+3840), 16 bits
Mode 0x033c: 320x200 (+1280), 24 bits
Mode 0x033d: 320x400 (+1280), 24 bits
Mode 0x033e: 640x400 (+2560), 24 bits
Mode 0x033f: 640x480 (+2560), 24 bits
Mode 0x0340: 800x600 (+3200), 24 bits
Mode 0x0341: 1024x768 (+4096), 24 bits
Mode 0x0342: 1152x864 (+4608), 24 bits
Mode 0x0343: 1280x960 (+5120), 24 bits
Mode 0x0344: 1280x1024 (+5120), 24 bits
Mode 0x0345: 1400x1050 (+5600), 24 bits
Mode 0x0346: 1600x1200 (+6400), 24 bits
Mode 0x0347: 1792x1344 (+7168), 24 bits
Mode 0x0348: 1856x1392 (+7424), 24 bits
Mode 0x0349: 1920x1440 (+7680), 24 bits
Mode 0x034a: 1366x768 (+1376), 8 bits
Mode 0x034b: 1366x768 (+2752), 16 bits
Mode 0x034c: 1366x768 (+5472), 24 bits
Mode 0x034d: 1680x1050 (+1696), 8 bits
Mode 0x034e: 1680x1050 (+3360), 16 bits
Mode 0x034f: 1680x1050 (+6720), 24 bits
Mode 0x0350: 1920x1200 (+1920), 8 bits
Mode 0x0351: 1920x1200 (+3840), 16 bits
Mode 0x0352: 1920x1200 (+7680), 24 bits
Mode 0x0353: 2048x1536 (+2048), 8 bits
Mode 0x0354: 2048x1536 (+4096), 16 bits
Mode 0x0355: 2048x1536 (+8192), 24 bits
Mode 0x0356: 320x240 (+320), 8 bits
Mode 0x0357: 320x240 (+640), 16 bits
Mode 0x0358: 320x240 (+1280), 24 bits
Mode 0x0359: 400x300 (+416), 8 bits
Mode 0x035a: 400x300 (+800), 16 bits
Mode 0x035b: 400x300 (+1600), 24 bits
Mode 0x035c: 512x384 (+512), 8 bits
Mode 0x035d: 512x384 (+1024), 16 bits
Mode 0x035e: 512x384 (+2048), 24 bits
Mode 0x035f: 854x480 (+864), 8 bits
Mode 0x0360: 854x480 (+1728), 16 bits
Mode 0x0361: 854x480 (+3424), 24 bits
Mode 0x0362: 1280x720 (+1280), 8 bits
Mode 0x0363: 1280x720 (+2560), 16 bits
Mode 0x0364: 1280x720 (+5120), 24 bits
Mode 0x0365: 1920x1080 (+1920), 8 bits
Mode 0x0366: 1920x1080 (+3840), 16 bits
Mode 0x0367: 1920x1080 (+7680), 24 bits
Mode 0x0368: 1280x800 (+1280), 8 bits
Mode 0x0369: 1280x800 (+2560), 16 bits
Mode 0x036a: 1280x800 (+5120), 24 bits
Mode 0x036b: 1440x900 (+1440), 8 bits
Mode 0x036c: 1440x900 (+2880), 16 bits
Mode 0x036d: 1440x900 (+5760), 24 bits
Mode 0x036e: 720x480 (+736), 8 bits
Mode 0x036f: 720x480 (+1440), 16 bits
Mode 0x0370: 720x480 (+2880), 24 bits
Mode 0x0371: 720x576 (+736), 8 bits
Mode 0x0372: 720x576 (+1440), 16 bits
Mode 0x0373: 720x576 (+2880), 24 bits
Mode 0x0374: 800x480 (+800), 8 bits
Mode 0x0375: 800x480 (+1600), 16 bits
Mode 0x0376: 800x480 (+3200), 24 bits
Mode 0x0377: 1280x768 (+1280), 8 bits
Mode 0x0378: 1280x768 (+2560), 16 bits
Mode 0x0379: 1280x768 (+5120), 24 bits
Config Status: cfg=new, avail=yes, need=no, active=unknown
[root@fedora ~]#

修改文本终端分辨率模式的三种方法

1)在Linux启动阶段输出可用分辨率模式并由用户选择

vga=ask

2)在Linux启动阶段手动添加分辨率模式参数

vga=0x0364

3)修改GRUB2引导菜单配置,永久新增分辨率模式参数

[root@fedora ~]# grubby --default-kernel
/boot/vmlinuz-5.11.12-300.fc34.x86_64
[root@fedora ~]# grubby --args="vga=0x0364" --update-kernel /boot/vmlinuz-5.11.12-300.fc34.x86_64
[root@fedora ~]#

修改GRUB2引导菜单配置并重启后查看GRUB2引导菜单的变化

查看分辨率为1280*720的虚拟机文本终端窗口

https://docs.fedoraproject.org/en-US/fedora/rawhide/system-administrators-guide/kernel-module-driver-configuration/Working_with_the_GRUB_2_Boot_Loader/#sec-Making_Persistent_Changes_to_a_GRUB_2_Menu_Using_the_grubby_Tool
7月 302021
 

视频分辨率和宽高比

YouTube 会根据所用的平台和视频格式,以不同的宽高比播放视频。YouTube 视频播放器会自动根据每个视频的尺寸调整大小。

视频显示方式
YouTube 在计算机上的标准宽高比为 16:9。如果您的视频具有不同的宽高比,则播放器将自动变为理想尺寸以匹配您的视频和观看者的设备。

对于某些视频和设备宽高比(例如计算机浏览器中显示的 9:16 竖版视频),YouTube 可能会添加额外的内边框以实现理想的观看效果。内边框默认为白色,但在启用“深色主题背景”的情况下为深灰色。

为了实现理想效果,请避免直接在视频中添加内边框或黑边。视频自带的内边框会干扰 YouTube 根据您的视频尺寸和观看者的设备动态调整播放器的能力。

推荐的分辨率和宽高比

对于默认的 16:9 宽高比,请按以下分辨率进行编码:

2160p:3840x2160
1440p:2560x1440
1080p:1920x1080
720p:1280x720
480p:854x480
360p:640x360
240p:426x240

https://support.google.com/youtube/answer/6375112?hl=zh-Hans

7月 152021
 

INSTALLED_APPS 默认包括了以下 Django 的自带应用:

django.contrib.admin -- 管理员站点, 你很快就会使用它。
django.contrib.auth -- 认证授权系统。
django.contrib.contenttypes -- 内容类型框架。
django.contrib.sessions -- 会话框架。
django.contrib.messages -- 消息框架。
django.contrib.staticfiles -- 管理静态文件的框架。

默认开启的某些应用需要至少一个数据表,所以,在使用他们之前需要在数据库中创建一些表。migrate 命令检查 INSTALLED_APPS 设置,为其中的每个应用创建需要的数据表。

$ python manage.py migrate

迁移模型

通过运行 makemigrations 命令,Django 会检测你对模型文件的修改(在这种情况下,你已经取得了新的),并且把修改的部分储存为一次 迁移。
迁移是 Django 对于模型定义(也就是你的数据库结构)的变化的储存形式。

(venv) harveymei@MacBookAir mysite % python manage.py makemigrations polls
Migrations for 'polls':
polls/migrations/0001_initial.py
- Create model Question
- Create model Choice
(venv) harveymei@MacBookAir mysite %

查看迁移命令将会执行的SQL语句

(venv) harveymei@MacBookAir mysite % python manage.py sqlmigrate polls 0001
BEGIN;
--
-- Create model Question
--
CREATE TABLE "polls_question" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "question_text" varchar(200) NOT NULL, "pub_date" datetime NOT NULL);
--
-- Create model Choice
--
CREATE TABLE "polls_choice" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "choice_text" varchar(200) NOT NULL, "votes" integer NOT NULL, "question_id" bigint NOT NULL REFERENCES "polls_question" ("id") DEFERRABLE INITIALLY DEFERRED);
CREATE INDEX "polls_choice_question_id_c5b4b260" ON "polls_choice" ("question_id");
COMMIT;
(venv) harveymei@MacBookAir mysite %

自动执行数据库迁移并同步管理你的数据库结构的命令 – 这个命令是 migrate

$ python manage.py migrate

(venv) harveymei@MacBookAir mysite % python manage.py migrate
Operations to perform:
Apply all migrations: admin, auth, contenttypes, polls, sessions
Running migrations:
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... OK
Applying admin.0003_logentry_add_action_flag_choices... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying auth.0008_alter_user_username_max_length... OK
Applying auth.0009_alter_user_last_name_max_length... OK
Applying auth.0010_alter_group_name_max_length... OK
Applying auth.0011_update_proxy_permissions... OK
Applying auth.0012_alter_user_first_name_max_length... OK
Applying polls.0001_initial... OK
Applying sessions.0001_initial... OK
(venv) harveymei@MacBookAir mysite %

migrate 命令选中所有还没有执行过的迁移(Django 通过在数据库中创建一个特殊的表 django_migrations 来跟踪执行过哪些迁移)并应用在数据库上 – 也就是将你对模型的更改同步到数据库结构上。

迁移是非常强大的功能,它能让你在开发过程中持续的改变数据库结构而不需要重新删除和创建表 – 它专注于使数据库平滑升级而不会丢失数据。

改变模型需要这三步:

编辑 models.py 文件,改变模型。
运行 python manage.py makemigrations 为模型的改变生成迁移文件。
运行 python manage.py migrate 来应用数据库迁移。
7月 152021
 

创建项目

$ django-admin startproject mysite

项目目录及文件说明

最外层的 mysite/ 根目录只是你项目的容器, 根目录名称对 Django 没有影响,你可以将它重命名为任何你喜欢的名称。
manage.py: 一个让你用各种方式管理 Django 项目的命令行工具。
里面一层的 mysite/ 目录包含你的项目,它是一个纯 Python 包。它的名字就是当你引用它内部任何东西时需要用到的 Python 包名。 (比如 mysite.urls).
mysite/__init__.py:一个空文件,告诉 Python 这个目录应该被认为是一个 Python 包。
mysite/settings.py:Django 项目的配置文件。
mysite/urls.py:Django 项目的 URL 声明,就像你网站的“目录”。
mysite/asgi.py:作为你的项目的运行在 ASGI 兼容的 Web 服务器上的入口。
mysite/wsgi.py:作为你的项目的运行在 WSGI 兼容的Web服务器上的入口。

启动用于开发的简易服务器

$ python manage.py runserver

更换端口

$ python manage.py runserver 8080
$ python manage.py runserver 0:8000

创建应用

$ python manage.py startapp polls

函数 include() 允许引用其它 URLconfs。每当 Django 遇到 include() 时,它会截断与此项匹配的 URL 的部分,并将剩余的字符串发送到 URLconf 以供进一步处理。
当包括其它 URL 模式时你应该总是使用 include() , admin.site.urls 是唯一例外。

函数 path() 具有四个参数,两个必须参数:route 和 view,两个可选参数:kwargs 和 name。现在,是时候来研究这些参数的含义了。

path() 参数: route
route 是一个匹配 URL 的准则(类似正则表达式)。当 Django 响应一个请求时,它会从 urlpatterns 的第一项开始,按顺序依次匹配列表中的项,直到找到匹配的项。

这些准则不会匹配 GET 和 POST 参数或域名。例如,URLconf 在处理请求 https://www.example.com/myapp/ 时,它会尝试匹配 myapp/ 。处理请求 https://www.example.com/myapp/?page=3 时,也只会尝试匹配 myapp/。

path() 参数: view
当 Django 找到了一个匹配的准则,就会调用这个特定的视图函数,并传入一个 HttpRequest 对象作为第一个参数,被“捕获”的参数以关键字参数的形式传入。稍后,我们会给出一个例子。

path() 参数: kwargs
任意个关键字参数可以作为一个字典传递给目标视图函数。本教程中不会使用这一特性。

path() 参数: name
为你的 URL 取名能使你在 Django 的任意地方唯一地引用它,尤其是在模板中。这个有用的特性允许你只改一个文件就能全局地修改某个 URL 模式。