Linux下Transmission的“UDP Failed to set receive buffer”错误

在Ubuntu 18.04的VPS上运行transmission-daemon报如下错误:

1
2
3
4
5
Jul 06 13:50:43 ubuntu-s-1vcpu-2gb-tor1-01 systemd[1]: Started Transmission BitTorrent Daemon.
Jul 06 13:50:44 ubuntu-s-1vcpu-2gb-tor1-01 transmission-daemon[29663]: [2018-07-06 13:50:44.429] UDP Failed to set receive buffer: requested 4194304, got 425984 (tr-udp.c:84)
Jul 06 13:50:44 ubuntu-s-1vcpu-2gb-tor1-01 transmission-daemon[29663]: [2018-07-06 13:50:44.430] UDP Failed to set send buffer: requested 1048576, got 425984 (tr-udp.c:95)
Jul 06 13:50:44 ubuntu-s-1vcpu-2gb-tor1-01 transmission-daemon[29663]: [2018-07-06 13:50:44.430] UDP Failed to set receive buffer: requested 4194304, got 425984 (tr-udp.c:84)
Jul 06 13:50:44 ubuntu-s-1vcpu-2gb-tor1-01 transmission-daemon[29663]: [2018-07-06 13:50:44.430] UDP Failed to set send buffer: requested 1048576, got 425984 (tr-udp.c:95)

解决方案如下:

1
2
sysctl -w net.core.rmem_max=8388608
sysctl -w net.core.wmem_max=8388608

Linux Mint安装Cuda 9.1以及cuDNN、NICC

CUDA

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# execute following command as root user
sudo -i
dpkg -i cuda-repo-ubuntu1604_9.1.85-1_amd64.deb
apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
apt update
apt install cuda
chmod a+x /usr/local/cuda-9.1/bin/cuda-install-samples-9.1.sh
# install cuda sample dependencies
apt install libgl-dev libglu-dev libx11-dev libegl1-mesa-dev libgles2-mesa-dev libmpich-dev
# back to normal user
exit
# install cuda examples
cuda-install-samples-9.1.sh ./
# force input macro value as linux mint is not officially supported
GLPATH="/usr/lib/x86_64-linux-gnu" GLLINK="-L/usr/lib/x86_64-linux-gnu" DFLT_PATH="/usr/lib" EGLLIB="/usr/lib/x86_64-linux-gnu" GLESLIB="/usr/lib/x86_64-linux-gnu" make -j6

cuDNN

首先从https://developer.nvidia.com/rdp/cudnn-download

Read More

无损迁移Linux系统到新磁盘

笔者的电脑原有一块SSD上装了Windows 10和Linux的双系统,其中Linux分配了大约300GB空间,但随着系统膨胀,发现空间逐步不够使用了,因此又买了一块1TB的SSD,打算将Linux整体迁移到1TB盘上,将原SSD上Linux部分都划给Windows 10。在此记录下迁移步骤,以供参考。
(此步骤基于Linux Mint,其他发行版应该大同小异。)

迁移步骤

Read More

个税改革分析,减税还是加税?

万众期待的个税改革草案昨天被发布出来征求公众意见,目前似乎讨论都只集中在起征点和级距上。然而,相比于另一个重大变化,也许起征点提高那么一点点的利得对于相当一部分人来说会被完全抵消。这个重大变化就是——年终奖要和工资合并计税了,从此以后年终奖的税是大大提高了的。。

为了仔细分析这一点的影响,先来看下目前的年终奖扣税规定:

以下内容引用自《国家税务总局关于调整个人取得全年一次性奖金等计算征收个人所得税方法问题的通知》(国税发〔2005〕9号):

二、纳税人取得全年一次性奖金,单独作为一个月工资、薪金所得计算纳税,并按以下计税办法,由扣缴义务人发放时代扣代缴:
(一) 先将雇员当月内取得的全年一次性奖金,除以12个月,按其商数确定适用税率和速算扣除数。
如果在发放年终一次性奖金的当月,雇员当月工资薪金所得低于税法规定的费用扣除额,应将全年一次性奖金减除“雇员当月工资薪金所得与费用扣除额的差额”后的余额,按上述办法确定全年一次性奖金的适用税率和速算扣除数。

Read More

MFC

Function call flow

1
2
3
4
5
6
CDialog::PreInitDialog()
CDialog::HandleInitDialog(WPARAM, LPARAM)
CDemoDlg::OnInitDialog()
CDialog::CheckAutoCenter()
CDialog::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
CDialog::PreTranslateMessage(pMsg)

Solve “Opened in another editor” in Resource View

Close “Resource.h” and all “.rc” file. Then shrink and re-expand the “rc” folder in Resource View.