雨中小记

雨下得越大,内心却越宁静。
虽然我不怎么喜欢雨天,但是,我好像喜欢雨的声音,和下雨时那种清爽的感觉。
自然界的声音自然具有神奇的力量,雨中人的思绪雨中在静静地游荡。

 

阅读全文→

祝我的网站五周岁快乐!同时也是迁入Vultr一周年纪念哦。

Writing posts about my thinkings and feelings?

To my surprise, I want to write something in the stressful final weeks. But I don't want to post it on my Qzone or Moment, where there're too many acquaintances, and I also choose to write in English because I don't want to let too many take notice of it. I need a quiet place.

 

So here I am, at my blog. It has been nearly 5 years since I set up this website. I have to admit that sometimes I'm perplexed about the reason and the purpose of maintaining it. I'm not sure what my blog should be like. (Sharing programming experience? No, I'm just an amateur and am incapable of that. Sharing my daily life? No, I'm not so interested in it and I need to protect my privacy...) Few people come to see this website, and few are interested in what I did or what I wrote. It doesn't really matter, from another perspective, it makes my website a peaceful harbour for me, a secret zone.

 

Maybe I'll start writing posts about my thinkings and feelings later on. It doesn't matter if I don't have any reader. But I'll be very happy if someone has empathy with my posts.

Seventeen主题404页面错误的解决办法

使用这款Seventeen主题有很久了,但是一直有一个问题,就是它的404页面有bug。对于某些不存在的链接,它并不显示预置的404页面,而显示的是网站主页。今天研究了下代码,给出我的解决方案:

在Seventeen主题的路径下新建一个叫做404.php的文件,输入以下代码:

 

(莫名多出了一个</div>标签,但是原作者是这么写的,就不去深究了)

【WordPress小改】将没有Gravatar但使用QQ邮箱的用户的头像替换为QQ头像并缓存

Gravatar在中国使用的人很少,所以评论里常常会看见顶着Gravatar的丑丑的默认头像的人。但是,这部分人有很多都使用QQ邮箱,于是我想到了可以用他们的QQ头像代替。

三年前我写了一个放在functions.php里的小函数来实现这个功能,但是有些Bug。今天终于重写了一下,大家可以拿去用。

具体功能就是将没有Gravatar但使用QQ邮箱的用户的头像替换为QQ头像,我使用的是 http://q2.qlogo.cn(q2可以换成q1, q3, ...)来获取,但是我没有辨别出它对于QQ邮箱那个参数使用的加密方式,所以只能以明文的形式去请求QQ头像(貌似本来是同时支持加密和明文的)。因此,为了保护用户隐私,我只能将这些头像按照加密的文件名存到本地,顺便也就添加了Gravatar的缓存功能。

阅读全文→