BNU-FZH

fengzhenhua@outlook.com

2023年06月08日星期四晴北京市北京师范大学, 发现今天上网的速度很慢,估计是DNS的问题。于是决定收录那些稳定快速的DNS服务器,逐步完善。未列出的服务器,请参考:免费公共 DNS 服务器大全

厂家 IPV4 IPV6
北京科技大学
清华大学TUNA
Cloudflare 2606:4700:4700::1111
北京邮电大学
北京邮电大学
百度 180.76.76.76 2400:da00::6666
Cloudflare 1.0.0.1 2606:4700:4700::1001
阿里 223.5.5.5 2400:3200::1
阿里 223.6.6.6 2400:3200:baba::1
腾讯 119.29.29.29 2402:4e00::
CNNIC 1.2.4.8 2001:dc7:1000::1
CNNIC 210.2.4.8 2001:dc7:1000::1
TWNIC 101.101.101.101 2001:de4::101
TWNIC 101.102.103.104 2001:de4::102
上交 2001:da8:8000:1:202:120:2:100
上交 2001:da8:8000:1:202:120:2:101
Yeti 中科院网络信息中心 2001:cc0:2fff:1::6666
Yeti 北京交通大学 2001:da8:205:2060::188
Yeti 清华大学 2001:da8:ff:305:20c:29ff:fe1f:a92a

注意:表中标注为绿色的DNS是我的当前环境下ping时响应速度在1ms以内的DNS, 所以这几个是在北京使用时极力推荐的, 其他的地址请自行ping后做出选择。

2023年 06月 19日 星期一 11:35:15 CST, 查询到英语成绩,顺利通过考试,感谢林老师,感谢外教,感谢北师大。本网站本是我准备复习考试之用,现作为Gist 组英语纪念.

林敦来老师正在给我们上课

2022-2023春季学期,英语考试考试时间:2023-06-10 13:30-16:10 考试地点:2023春期末考试,考场安排17周查询,具体考试安排尚未公布,请及时关注:北师大公共外语研究部

考场安排已经公布:

  1. 我本人: 教九楼/104/50

  2. 其他人考场安排: 公布版.xlsx

  3. 2023年06月10日 顺利完成考试

  4. 预计7月2日公布成绩,愿我们都顺利通过考试!

  5. 2023年 06月 19日 星期一 公布成绩,我们顺利通过了考试。

阅读全文 »

Project 15.32 Overcoming critical slowing down

Many of the original applications of Monte Carlo methods were done for systems of approximately one hundred particles and lattices of order 322 spins. It would be instructive to redo many of these applications with much better statistics and with larger system sizes. In the following, we discuss some additional recent developments, but we have omitted other important topics such as Brownian dynamics and umbrella sampling. More ideas for projects can be found in the references.

Energy-Monte Carlo Step The Spin Configuration The Spin Configuration The Spin Configuration The Spin Configuration

ocsd4.py
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
57
58
59
60
61
62
63
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Author: 冯振华
# StudentNumber: 202221140015
# Verdion: V4.0
# Copyright © 2023 feng <feng@arch>
#
# Distributed under terms of the MIT license.

import numpy as np
import matplotlib.pyplot as plt

# Define the parameters
N = 20 # number of spins in each direction
J = -1 # coupling constant
beta = 1 # inverse temperature
nsteps = 1000 # number of Monte Carlo steps

# Initialize the spins randomly
spins = np.random.choice([-1, 1], size=(N, N))

# Define the energy function
def energy(spins):
return -J * (np.sum(spins[:-1,:] * spins[1:,:]) + np.sum(spins[:,:-1] * spins[:,1:])) \
- J * (np.sum(spins[0,:] * spins[-1,:]) + np.sum(spins[:,0] * spins[:,-1]))

# Define the Metropolis algorithm
def metropolis(spins, beta):
for i in range(N):
for j in range(N):
# Choose a random spin to flip
x, y = np.random.randint(0, N), np.random.randint(0, N)
# Calculate the energy difference
delta_E = 2 * J * spins[x, y] * \
(spins[(x+1)%N, y] + spins[(x-1)%N, y] + spins[x, (y+1)%N] + spins[x, (y-1)%N])
# Flip the spin with probability according to the Boltzmann factor
if np.random.uniform(0, 1) < np.exp(-beta * delta_E):
spins[x, y] = -spins[x, y]
return spins

# Run the Monte Carlo simulation
energies = []
for i in range(nsteps):
spins = metropolis(spins, beta)
energies.append(energy(spins))

# Calculate the average energy
E = np.mean(energies)

# Print the result
print(f"Average energy: {E:.4f}")

# Plot the energy as a function of Monte Carlo steps
plt.plot(energies)
plt.xlabel("Monte Carlo step")
plt.ylabel("Energy")
plt.show()

# Plot the spin configuration
plt.imshow(spins, cmap='binary')
plt.show()
ocsd3.py
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2023 feng <feng@archlinux>
#
# Distributed under terms of the MIT license.
"""
作者:冯振华
学号:202221140015
版本:V4.1
日期:2023年05月20日
项目:Monte Carlo methods for Overcoming critical slowing down
"""
import numpy as np
import matplotlib.pyplot as plt

def initialize_spins(N):
"""
Initializes the spin lattice with random spins of -1 or +1
"""
return np.random.choice([-1, 1], size=(N, N))

def bond_probability(beta):
"""
Calculates probability of forming a bond between two neighboring spins
"""
return 1 - np.exp(-2*beta)

def update_spins(spins, beta):
"""
a single update of the spins using the Wolff algorithm
"""
N = spins.shape[0]
visited = np.zeros((N, N), dtype=bool)
seed = (np.random.randint(N), np.random.randint(N))
cluster_spins = [seed]
cluster_perimeter = [(seed[0], (seed[1]+1)%N), (seed[0], (seed[1]-1)%N),
((seed[0]+1)%N, seed[1]), ((seed[0]-1)%N, seed[1])]
while len(cluster_perimeter) > 0:
i, j = cluster_perimeter.pop()
if not visited[i,j] and np.random.random() < bond_probability(beta):
cluster_spins.append((i, j))
visited[i, j] = True
cluster_perimeter += [(i, (j+1)%N), (i, (j-1)%N),
((i+1)%N, j), ((i-1)%N, j)]
spins[tuple(zip(*cluster_spins))] *= -1
return spins

def calculate_energy(spins,J):
"""
Calculates the energy of the spin configuration
"""
N = spins.shape[0]
energy = 0
for i in range(N):
for j in range(N):
spin = spins[i, j]
neighbors = spins[(i+1)%N, j] + spins[i, (j+1)%N] + spins[(i-1)%N, j] + spins[i, (j-1)%N]
energy += 2*J*spin * neighbors
return energy

def run_simulation(N=20, J=-1,beta=1.0, num_steps=2000, num_measurements=100):
"""
Performs a full simulation of the Wolff algorithm on the spin lattice
"""
spins = initialize_spins(N)
energies = []
mags = []
for step in range(num_steps):
spins = update_spins(spins, beta)
if step % (num_steps // num_measurements) == 0:
energy = calculate_energy(spins,J)
mag = np.sum(spins)
energies.append(energy)
mags.append(mag)
return energies, mags

energies, mags = run_simulation(N=20,J=-1,beta=1.0, num_steps=100000, num_measurements=100)
#
# Calculate the average energy
E = np.mean(energies)
# Print the result
print(f"Average energy: {E:.4f}")
# Plot the energy as a function of Monte Carlo steps
plt.plot(energies)
plt.xlabel("Monte Carlo step")
plt.ylabel("Energy")
plt.show()

# Plot the spin configuration
plt.plot(mags)
plt.xlabel("Monte Carlo step")
plt.ylabel("Spin")
plt.show()
"""
To run the simulation, simply the `run_simulation` function with the desired parameters, such as `energies, mags = run_simulation(N=30,=1.0, num_steps=100000, num_measurements=100)`. This will simulate 100,000 Wolff updates on a 30x30 lattice at a temperature of 1. and take measurements of the energy and magnetization every 1,000 steps. The output is two arrays, `energies` and `mags`, that record the energy and magnetization at each measurement step. These arrays can be used to averages and variances to analyze the system properties.
"""

Project 15.32 Overcoming critical slowing down

2023年05月31日星期三多云北京市北京师范大学,由于物理高等计算方法课需要做一个大作业,同时还需要弄一个幻灯片来展示作业,所以又开始准备一个Beamer文档,但是长时间不用了,所以决定在本文逐步来完善Beamer使用中的一些技巧。

文字对齐

在完成Beamer后发现,文字默认左对齐,我们需要的是分散对齐,解决方案是在导言区加上语句

1
2
\usepackage{ragged2e}
\justifying\let\raggedright\justifying

注意: 使用时请在调用主题前的调用这个宏包。

幻灯片比例

2023年09月05日星期二晴北京市北京师范大学,将幻灯片比例改为16:9

修改幻灯片比例为16:9
1
\documentclass[aspectratio=16:9]{ctexbeamer}

幻灯片的比例主要有: 16:10, 14:9, 1.41:1,5:4, 4:3(default), 3:2

2023年05月28日星期日多云北京市北京师范大学,对于形如

\[f(z)=z^n+\frac{a}{z^n}+c\]

的有理分式,在不动点处我求出了它的各参数满足的关系,发现只要解出方程

\[ x^n-\alpha x-\beta=0\]

那么这一类有理分式的所有不动点处的参数关系就完全确定了。但是当n在5次及5次以上时已经无法用通常的加减乘除及开根号来表达方程的根,其原因是很复杂的。所以对于超5次的情况,等到我期末考完试后再做研究,暂时考虑需要计算机做一个近似计算。对于高次方程不可解的原因,请参考: 如何证明五次及以上方程无根式解?|解方程系列5

2023年05月18日星期四多云北京市北京师范大学,顺利完成Python之美作业,由我完成了Linux版本,程国栋负责完成Windows版本。

设计思路

  1. 据Ip获取本地城市名
  2. 根据城市由高德地图获取纬度
  3. 由纬度计算本地的g值
  4. 输入初速度大小
  5. 输入阻尼大小
  6. 绘制最大水平位移与夹角的关系
  7. 绘制海平面存在风阻时的模拟图像
  8. 绘制海平面上100米处存在风阻时的模拟图像
  9. 绘制海平面上200米处存在风阻时的模拟图像

代码实现

nspp_linux.py
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
# Author: 冯振华 & 程国栋
# StudentNumber: 202221140015 & 202221140011
# Version: v2.2 for linux
# Linux: 冯振华
# Windows: 程国栋
# Date: 2023年05月18日星期四多云北京市北京师范大学
# Copyright © 2023 feng <feng@archlinux>
#
# !!注意:本脚本在linux编写,vim编辑器下
# :set ff #查看文件格式
# :set ff=dos #设置为dos格式
# :set ff=unix #设置为unix格式
# 如果不设置正确的格式地,运行程序会报错
#
import math
import matplotlib.pyplot as plt
import os
import requests
import json
# 输入初速度大小和空气阻力系数
v_0 = input("请输入初速度大小: ")
v_0 = float(v_0)
k = input("请输入空气阻力系数: ")
k = float(k)
# 获取本机Ip对应的地理位置
Ip_data=os.popen('curl -s cip.cc').readlines()
Ip_local=Ip_data[1].split(' ')
city=Ip_local[-1].strip()
# 从高德地图获取纬度
GaoDeKey = '79e3576b80e0b544d0d17dd643e4654e'
url = 'https://restapi.amap.com/v3/geocode/geo'
params = {'key': GaoDeKey,
'address': city}
res = requests.get(url,params)
jd = json.loads(res.text)
coords = jd['geocodes'][0]['location']
jd_value = coords.split(',')
latitude=float(jd_value[1])
latitude = latitude/180*math.pi
# 根据纬度计算本地的重力加速度g
g=9.7803*(1+0.005324*((math.sin(latitude))**2)-0.000005*((math.sin(2*latitude))**2))
# 计算最大水平位移和初速度与水平方向夹角的关系
def x_max(theta):
rad = math.radians(theta)
return (v_0**2* math.sin(2*rad)/ g)
angles = range(0, 91, 1)
x = [x_max(angle) for angle in angles]
#with the drag force
def simulate(v_1, theta,y_height):
theta = math.radians(theta)
v_x = v_1 * math.cos(theta)
v_y = v_1 * math.sin(theta)
x = 0
y = float(y_height)
t = 0
delta_t = 0.01
traj = [(x, y)]
while y >= 0:
a_x = -k * v_x ** 2 / (2 * v_1)
a_y = -g - k * v_y ** 2 / (2 * v_1)
v_x += a_x * delta_t
v_y += a_y * delta_t
x += v_x * delta_t
y += v_y * delta_t
t += delta_t
traj.append((x, y))
return traj
# 将各种情况集中于一张图上
plt.figure(figsize=(200,200),dpi=100)
plt.subplots_adjust(left=None,bottom=None,right=None,top=None,wspace=None,hspace=0.5)
plt.figure(1)
ax1 = plt.subplot(221)
ax1.margins(0.15)
ax1.plot(angles, x)
ax1.set_title("$\\theta$ with $x_{max}$ Free")
ax1.set_xlabel("$\\theta$(degrees)")
ax1.set_ylabel("$x_{max}$(meters)")
ax2 = plt.subplot(222)
ax2.margins(0.15)
angles = range(0, 91, 10)
for theta in angles:
traj = simulate(v_0, theta,0) # 地表
x_s = [t[0] for t in traj]
y_s = [t[1] for t in traj]
ax2.plot(x_s, y_s, label=f"${theta}^\circ$")
ax2.legend(loc="upper left")
ax2.set_title(f"Projectile Motion with Air Resistance ($v_0={v_0} m/s$)")
ax2.set_xlabel("Distance (meters)")
ax2.set_ylabel("Height (meters)")
ax3 = plt.subplot(223)
ax3.margins(0.15)
angles = range(0, 91, 10)
for theta in angles:
traj = simulate(v_0, theta,1) # 100m高塔
x_s = [t[0] for t in traj]
y_s = [t[1] for t in traj]
ax3.plot(x_s, y_s, label=f"${theta}^\circ$")
ax3.legend(loc="upper left")
ax3.set_title(f"Projectile Motion with Air Resistance ($v_0={v_0} m/s$)")
ax3.set_xlabel("Distance (meters)")
ax3.set_ylabel("Height (meters)")
ax4 = plt.subplot(224)
ax4.margins(0.15)
angles = range(0, 91, 10)
for theta in angles:
traj = simulate(v_0, theta,2) # 200m高塔
x_s = [t[0] for t in traj]
y_s = [t[1] for t in traj]
ax4.plot(x_s, y_s, label=f"${theta}^\circ$")
ax4.legend(loc="upper left")
ax4.set_title(f"Projectile Motion with Air Resistance ($v_0={v_0} m/s$)")
ax4.set_xlabel("Distance (meters)")
ax4.set_ylabel("Height (meters)")
plt.show()
nspp_windows.py
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
# Author: 冯振华 & 程国栋
# StudentNumber: 202221140015 & 202221140011
# Version: v2.2 for windows
# Linux: 冯振华
# Windows: 程国栋
# Date: 2023年05月18日星期四多云北京市北京师范大学
# Copyright © 2023 feng <feng@archlinux>
#
# !!注意:本脚本在linux编写,vim编辑器下
# :set ff #查看文件格式
# :set ff=dos #设置为dos格式
# :set ff=unix #设置为unix格式
# 如果不设置正确的格式地,运行程序会报错
#
import math
import numpy as np
import matplotlib.pyplot as plt
import requests
import json
from bs4 import BeautifulSoup
from scipy.integrate import odeint


# 输入初速度大小和空气阻力系数
v_0 = float(input("请输入初速度大小: "))
k = float(input("请输入空气阻力系数: "))


# 获取本机Ip对应的地理位置
url = 'http://www.cip.cc/'
header = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/112.0'}
html = requests.get(url, headers=header) # 访问网址
bsObj = BeautifulSoup(html.content, 'lxml') # 使用lxml解析器
msg = bsObj.find('div', class_="data kq-well")
msg = [i for i in msg]
city = msg[1]


# 从高德地图获取纬度
GaoDeKey = '79e3576b80e0b544d0d17dd643e4654e'
url = 'https://restapi.amap.com/v3/geocode/geo'
params = {'key': GaoDeKey,
'address': city}
res = requests.get(url, params)
jd = json.loads(res.text)
coords = jd['geocodes'][0]['location']
jd_value = coords.split(',')
latitude = float(jd_value[1])
latitude = latitude/180*math.pi # 转换成弧度


# 根据纬度计算本地的重力加速度g
g = 9.7803*(1+0.005324*((math.sin(latitude))**2)-0.000005*((math.sin(2*latitude))**2))


def simulate(v_1, theta, y_height):
# 轨迹图
theta = math.radians(theta)
v_x0 = v_1 * math.cos(theta)
v_y0 = v_1 * math.sin(theta)

def motion1(w, t, k):
v_x, v_y = w
return[-k * v_x ** 2, -g - k * v_y ** 2]
t = np.linspace(0, 20, 300000)
track1 = odeint(motion1, (v_x0, v_y0), t, args=(k, ))
v_x1 = [i for i in track1[:, 0]]
v_y1 = [j for j in track1[:, 1] if j > 0]
v_x1 = v_x1[:len(v_y1)]
delta_t = (20 - 0) / 300000
i = 1
x = 0
y = y_height
y_list1 = [y]
x_list1 = [0]
while i < len(v_y1) - 1:
x += ((v_x1[i] + v_x1[i-1]) / 2) * delta_t
y += ((v_y1[i] + v_y1[i-1]) / 2) * delta_t
if y < 0:
break
x_list1.append(x)
y_list1.append(y)
i += 1

def motion2(w, t, k):
v_x, v_y = w
return[-k * v_x ** 2, -g + k * v_y ** 2]

track2 = odeint(motion2, (v_x1[-1], 0), t, args=(k, ))
v_x2 = [i for i in track2[:, 0]]
v_y2 = [j for j in track2[:, 1] if j < 0]
j = 1
x = x_list1[-1]
y = y_list1[-1]
y_list2 = [y]
x_list2 = [x]
while j < len(v_y2) - 1:
x += ((v_x2[j] + v_x2[j-1]) / 2) * delta_t
y += ((v_y2[j] + v_y2[j-1]) / 2) * delta_t
if y < 0:
break
x_list2.append(x)
y_list2.append(y)
j += 1
x_list = x_list1 + x_list2
y_list = y_list1 + y_list2
return x_list, y_list


def x_MaxTheta(v, height):
x_max = []
for angle in range(1, 91, 1):
x_list, y_list = simulate(v_1=v, theta=angle, y_height=height)
x_max.append(x_list[-1])
return x_max


heght = float(input('输入初始高度:'))
x_max = x_MaxTheta(v=v_0, height=heght)
plt.plot(range(1, 91, 1), x_max, 'g-')
plt.show()
x = 0
j = 1
for i in x_max:
j += 1
if i > x:
x = i
num = j - 1
print('当前初始条件下抛得最远的角度是{},最远距离是{}'.format(num, x))
print('输入要模拟的轨迹的抛出角度:')
a = float(input())
x, y = simulate(v_1=v_0, theta=a, y_height=heght)
plt.plot(x, y, 'r-')
plt.show()

2023年05月14日星期日多云北京市北京师范大学
作业科目 内容 要求 完成情况
引力专题 撰写一份报告 需要有自己观点 6月20日已经完成
基础英语 6月10日考试 已经考试 7.2出结果
高等计算物理 补全作业+15.32 大作业已经完成 完成考试
高阶英语 三首诗及一个翻译 最终作业 Yes
Python之美 抛体问题的数值求解 6月1日下午汇报 Yes
高等数学物理方法课 课上讲一部分和自己专业相关内容 Yes
英语口语 考试 6分通过 顺利通过
量子色动力学 考核 顺利通过
量子场论 考试 积极备考 Yes
  • 2023年05月18日, 完成Python之美作业
  • 2023年05月18日, 完成高等计算物理前四次作业,并发送给了助教
  • 2023年05月18日, 完成高阶英语,三首诗和一个翻译,还有两段解释没有写
  • 2023年05月19日, 完成高阶英语的两翻译解释,同时调整了格式,今天可以交作业了
  • 2023年05月23日, 高阶英语课程完全完成,今天最后一节课,朗读完诗,完成任务
  • 2023年05月23日, 6月10日参加英语考试,要及时准备
  • 2023年05月23日, 量子场论需要认真完成计算
  • 2023年05月25日, 完成高等计算物理大作业,前天准备演讲用的beamer,对于平时作业已经向助教发邮件寻问尚未完成部分,待回复后补全
  • 2023年05月25日, 明天准备英语听力练习和量子场论的学习
  • 2023年05月26日, 今日查询成绩,英语口语顺利过关
  • 2023年05月27日, 量子色动力学,顺利完成
  • 2023年05月31日, 高等计算物理提交大作业5月31日,汇报时间:6月7日,考试时间:6月12日 ,作业占比20%,大作业占比20%, 期末考试占比60%
  • 2023年06月01日, 完成Python大作业汇报工作,第一组汇报的,程国栋介绍概要,我介绍了程序代码和程序升级规划
  • 2023年06月02日, 完成并提交了高等数学物理方法课期末报告,顺利完成该课程
  • 2023年06月02日, 完成量子场论考试
  • 2023年06月10日, 完成基础英语考试
  • 2023年06月12日, 完成高等计算物理考试,总共5个题,完成3个,后面两个题没做,保守的讲做的都对了。
  • 2023年06月22日, 完成引力理论专题汇报,顺利发送邮件到高老师sijie@bnu.edu.cn 。
  • 2023年06月22日, 至此2022-2023春季学期所有考试内容及考核内容全部完成。

2023年05月11日星期四多云北京市北京师范大学

今天决定在ThinkPad-T490上删除matlab,改用octave执行matlab脚本,同时为了方便编写python等程序,为vim配置了一键执行命令。如下

~/.vimrc
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
"Set  F5 to run all language program
map <F5> :call CompileRunGcc()<CR>
func! CompileRunGcc()
exec "w"
if &filetype == 'sh'
:!time bash %
elseif &filetype == 'python'
exec "!time python3 %"
elseif &filetype == 'c'
exec "!g++ % -o %<"
exec "!time ./%<"
elseif &filetype == 'cpp'
exec "!g++ % -o %<"
exec "!time ./%<"
elseif &filetype == 'java'
exec "!javac %"
exec "!time java %<"
elseif &filetype == 'html'
exec "!firefox % &"
elseif &filetype == 'go'
exec "!go build %<"
exec "!time go run %"
elseif &filetype == 'mkd'
exec "!~/.vim/markdown.pl % > %.html &"
exec "!firefox %.html &"
endif
endfunc

2023年05月08日星期一晴北京市北京师范大学

一直以来觉得goldendict不是很好用,但是一时又找不到可以替代他的工具,所以直接引用了一篇文章的README.md文件,因为他讲的很好,所以就直接使用了。

GoldenDict 中文用户手册

本文最后更新:2018-02-13。

GoldenDict,一款尤其适用于计算机端(Windows、macOS、Linux)的开源、自由、可定制的词典软件。严肃的语言学习者、文字工作者乃至词典编纂者,都应该至少尝试一下 GoldenDict。

阅读全文 »

2023年05月08日星期一晴北京市北京师范大学

在升级archlinux后发现我的插件gnome-shell-extension-hidetopbar-git不能正常工作了,提示版本与当前gnome版本不匹配。在插件安装网页找到解决方法,记录如下:

  1. 切换到目录

    1
    /usr/share/gnome-shell/extensions/hidetopbar@mathieu.bidon.ca

  2. 修改metadata.json文件,追加上"44"

    metadata.json
    1
    "shell-version": ["3.38","40","41","42","43","44"],

  3. 注释掉检测程序片段

    intellihide.js
    1
    2
    3
    4
    5
    6
    7
    go to line 116 and comment this:
    //, [
    //// update wne monitor changes, for instance in multimonitor when monitor are attached
    //Meta.MonitorManager.get(),
    //'monitors-changed',
    //this._checkOverlap.bind(this)
    ]

  4. 注销并重新登录系统,问题解决。

不知道为什么这么重要的受欢迎的软件每次在gnome版本大升级后它都会出现问题,之前一直等待修复,但是可能这才是一个及时的应对策略。附上原插件地址:https://extensions.gnome.org/extension/545/hide-top-bar/

2023年05月11日星期四多云北京市北京师范大学, 再次到原插件地址查看问题解决情况。这里有两条新增信息,记录如下:

  1. In the new gnome44 was made some changes so need to change

    .local/share/gnome-shell/extensions/hidetopbar@mathieu.bidon.ca/intellihide.js
    1
    Meta.MonitorManager.get -> Utils.getMonitorManager()

  2. Create new file .local/share/gnome-shell/extensions/hidetopbar@mathieu.bidon.ca/utils.js , with the next content

    utils.js
    1
    2
    3
    4
    5
    6
    function getMonitorManager() {
    if (global.backend.get_monitor_manager !== undefined)
    return global.backend.get_monitor_manager();
    else
    return Meta.MonitorManager.get();
    }