WordPress备忘录

url自动生成链接,主题的functions.php中添加下面的代码即可:

1
add_filter('the_content', 'make_clickable');

GeneratePress: 样式表 (style.css)

1
font-family: sans-serif,'宋体';

清理表空间

1
2
3
4
5
6
7
8
DELETE FROM wp_posts WHERE post_type = 'revision';
DELETE FROM wp_postmeta WHERE meta_key = '_edit_lock';
DELETE FROM wp_postmeta WHERE meta_key = '_edit_last';
DELETE FROM wp_postmeta WHERE meta_key = '_wp_old_slug';
DELETE FROM wp_postmeta WHERE meta_key = '_revision-control';
DELETE FROM wp_postmeta WHERE meta_value = '{{unknown}}';
OPTIMIZE TABLE wp_postmeta;
OPTIMIZE TABLE wp_posts;

常用插件

1
2
3
4
5
6
7
8
9
Blackout: Dark Mode Widget	Adds a toggle widget to your website that activates dark mode on click.
Protection against DDoS		Protection against DDoS.
Quotmarks Replacer		Quotmarks Replacer disables wptexturize function that keeps all quotation marks and suspension points in half-width form.
WordPress 导入工具		从 WordPress 导出文件中导入日志、页面、评论、自定义字段、分类、标签或更多内容。
WP-Syntax			Syntax highlighting using GeSHi supporting a wide range of popular languages.
代码美化器			本插件使用Google代码美化器将文章中的代码片段以语法高亮显示。
经典编辑器			启用WordPress经典编辑器和旧式的编辑文章页面,包括TinyMCE、Meta Boxes等。支持扩展此页面的旧插件。
2em				add "text-indent:2em" support to editor.
WP Statistics			此插件为您提供有关网站访问者的完整信息。

refer to:
https://www.wpdaxue.com/wordpress-make-clickable.html
https://www.fujieace.com/wordpress/revisions.html
https://www.91wordpress.com/1963.html
https://blog.csdn.net/weixin_30958745/article/details/113611053

Qt备忘录

程序启动时去掉dos窗口

1
#pragma comment(linker, "/subsystem:windows /entry:mainCRTStartup")

DoModal

1
2
3
4
	DlgTst dlg(this);
	int result = dlg.exec();
	if (QDialog::Accepted == result)
		QMessageBox::information(this, "title", "done.");

Modelless

1
2
3
	DlgTst* dlg2 = new DlgTst(this);
//	dlg2->setModal(Qt::ApplicationModal);
	dlg2->show();

嵌入子对话框

1
	setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint);

保持对话框前置,类似于MFC的SetOwner

1
	setWindowFlags(Qt::Dialog);

PostMessage
signal slot connect的默认行为类似于SendMessage,如果要实现PostMessage的行为,connect时加参数Qt::QueuedConnection。

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
class MainWindow : public QMainWindow
{
	...
private slots:
	void on_pushButton_clicked();
	void on_pushButton_2_clicked();
signals:
	void mySignal1();
};
 
MainWindow::MainWindow(QWidget* parent)
{
	...
	connect(this, SIGNAL(mySignal1()), SLOT(on_pushButton_2_clicked()), Qt::QueuedConnection);
}
 
void MainWindow::on_pushButton_clicked()
{
	QMessageBox::information(this, "title", "on_pushButton_clicked 1");
	emit mySignal1();
	QMessageBox::information(this, "title", "on_pushButton_clicked 2");
}
 
void MainWindow::on_pushButton_2_clicked()
{
	QMessageBox::information(this, "title", "B");
}

安装完qt-vs-tools-msvc2013-2.0.0.vsix后,重启vs2013,工程项目右键菜单上qt功能选项为灰色无效,怎么办?
打开.vcxproj修改

1
<Keyword>Win32Proj</Keyword>

1
<Keyword>Qt4VSv1.0</Keyword>

再重启vs,在工程上右键菜单上点击“Convert Project to Qt VS Tools Project”。

生成要翻译的语言文件

1
2
3
4
lupdate hello.pro -ts lang.ts
# or in cmake
add_custom_target(tr COMMAND ${Qt5_LUPDATE_EXECUTABLE} -target-language en ${Srcs} -ts "${CMAKE_CURRENT_SOURCE_DIR}/lang.ts")
lrelease lang.ts -qm lang.qm

窗口上画矩形

1
2
3
4
5
6
7
void DlgTst01::paintEvent(QPaintEvent *e)
{
	QPainter painter(this);
	painter.setBrush(Qt::red);
	painter.setPen(Qt::red);
	painter.drawRect(QRect(0, 0, this->width(), this->height()));
}

支持c++20

1
2
# CMakeLists.txt
set(CMAKE_CXX_STANDARD 20)

禁止背景重绘

1
ui->widgetVideo->setUpdatesEnabled(false);

皮肤skin
https://blog.csdn.net/weixin_42126427
http://t.zoukankan.com/luoxiang-p-13528745.html

无边框窗体的拖动和改变大小
https://www.cnblogs.com/warmlight/p/12841968.html
https://blog.csdn.net/zhushentian/article/details/82021838

Qt Style Sheets Reference
export QT_DEBUG_PLUGINS=1

refer to:
https://blog.csdn.net/qq_24127015/article/details/95118124
https://blog.csdn.net/zyx4843/article/details/50682212
https://blog.csdn.net/ermzdy2/article/details/99692954
https://blog.csdn.net/aaa123524457/article/details/80582978
http://www.myexception.cn/qt/1119616.html
https://blog.csdn.net/hl1hl/article/details/85244451
https://stackoverflow.com/questions/48187569/qt-translation-file-is-removed-on-make-clean-using-cmake

VMWare磁盘读写提速

VMWare不生成vmem文件的方法是在.vmx文件中增加两行:

1
2
sched.mem.pshare.enable = "FALSE"
mainMem.useNamedFile = "FALSE"

refer to:
https://blog.csdn.net/shanzhizi/article/details/8293638
http://www.360doc.com/content/15/1120/11/73007_514517328.shtml
http://www.guyiren.com/archives/3210
https://blog.csdn.net/mnmnwq/article/details/79557305
https://blog.51cto.com/kitzk/553493
https://segmentfault.com/q/1010000002954977
https://bbs.kafan.cn/thread-1355085-1-1.html

found no \bibdata command

在CTeX套件的WinEdt编辑器里点击BibTeX按钮后,出现错误:

1
2
I found no \bibdata command---while reading file test.aux
I found no \bibstyle command---while reading file test.aux

有一种原因为.bib文件未保存,因为WinEdt是不会自动保存的,即使点了PDFTexify按钮也不会保存,需要先保存.bib文件再点BibTeX按钮,就不会出现这个错误了。

正确写法参见:
CTeX例子

CTeX例子

test.tex

1
2
3
4
5
6
7
8
\documentclass{article}
\usepackage{ctex}
\usepackage{cite}
\begin{document}
Hello every one!\cite{articleA}大家还好么?
\bibliographystyle{plain}
\bibliography{refs}
\end{document}

refs.bib

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
@ARTICLE{articleA,
author = {Mr.Woodman},
title = {Woodman's Trueman},
journal = {IEEE magzine},
year = {11},
volume = {2(3)},
pages = {4-42},
owner = {trueman},
timestamp = {02}
}
 
@Inbook{Book1,
author="Mrs.Woodman",
editor="Editor Woodman",
title="Woman",
bookTitle="Woodman's woman",
year="1992",
publisher="Woodman House",
address="New York St.1",
pages="33--25",
isbn="111-222-1",
doi="10.1011/111-11-111-1111-1_11",
url="http://url.org/index.html"
}

宋朝帝王年表

北宋

1
2
3
4
5
6
7
8
9
太祖,	赵匡胤,960-97617年,建隆/乾德/开宝
太宗,	赵光义,976-99722年,太平兴国/雍熙/端拱/淳化/至道
真宗,	赵恒,997-102226年,咸平/景德/大中祥符/天禧/乾兴
仁宗,	赵祯,1022-106342年,天圣/明道/景祐/宝元/康定/庆历/皇祐/至和/嘉祐
英宗,	赵曙,1063-10675年,治平
神宗,	赵顼,1067-108519年,熙宁/元丰
哲宗,	赵煦,1085-110016年,元祐/绍圣/元符
徽宗,	赵佶,1100-112627年,建中靖国/崇宁/大观/政和/重和/宣和
钦宗,	赵桓,1126-11272年,靖康

南宋

1
2
3
4
5
6
7
8
9
高宗,	赵构,1127-116236年,建炎/绍兴
孝宗,	赵昚,1162-118928年,隆兴/乾道/淳熙
光宗,	赵惇,1189-11946年,绍熙
宁宗,	赵扩,1194-122431年,庆元/嘉泰/开禧/嘉定
理宗,	赵昀,1224-126441年,宝庆/绍定/端平/嘉熙/淳祐/宝祐/开庆/景定
度宗,	赵禥,1264-127411年,咸淳
-,	赵㬎,1274-12763年,德祐
-,	赵是,1276-12783年,景炎
-,	赵昺,1278-12792年,祥兴

refer to: https://baike.baidu.com/item/%E5%AE%8B%E6%9C%9D/2919?fr=kg_qa

whether go through tcp or udp using EuhatRtsp

app/src/main/java/com/euhat/rtsp/euhatrtspdemo/MainActivity.java

108
109
// try to modify the 3rd parameter to 0.
mEuhatPlayer.open(url, 8000, 0, 1000, fps, 300);

How to record the H264 stream using EuhatRtsp lib

euhatrtsp/livevideo/RtspOp.cpp

389
390
391
392
393
394
395
396
397
int EuhatRtspOp::decodingProc()
{//frame是原始H264数据,在这里录像最好,此库已经把ffmpeg库编译进去了,直接用ffmpeg库就可以完成录像功能。
//可以网上搜ffmpeg录像api怎么用。
//这就要求会写C++代码,还要加jni接口提供给java端打开或关闭录像功能。
decoder_->decode(frame + 4, *(int *)frame);}

Premiere编辑时没有声音

编辑视频时没有声音的原因有很多种,我这里会到情况是由于启动Pr时提示过错误消息框:

1
2
3
无法应用设备设置,因为发生了以下错误:
 
MME 设备内部错误。

解决方法:
点击菜单->编辑->首选项->音频硬件,弹出对话框中,默认输入选择“无输入”,点“确定”保存,退出Pr再重启。

我这样操作后,再编辑视频时就有声音响应了。