当前角色:网站管理员
2011
07.16

The Monkey was busy in his Monkey Sync these days, which can update his micro-blog and blog in several Facebook-like websites automatically.

After last change, Monkey Sync had worked very well for a long time. It posted the posts in Monkey's House to Facebook, Renren, Qzone and Baidu, and sent the statuses from Twitter to Renren, Qzone and Baidu.

There was still a problem that Monkey Sync 's code was a little bit messy because it was modified on a open-source code, which had some failures at its very beginning. So, Monkey Sync was being slower. Because of those failures, the system might be obstructed by some errors raised by network status.

In this modification, the Monkey added the module for Sina Weibo, the Chinese Twitter, and solved a main problem about Twitter 's Rate Limitation, which was not noticed and considered by the first author.

To reduce unnecessary calculations, the Monkey uses MemCached. To get access to Twitter without limitation, the Monkey uses OAuth Libraries, which makes his work much more easier than before.

The Monkey changed the outline of the whole system, which will make it stronger. In this project, the Monkey learnt MemCached and a lot of libraries he had not known.

Thanks to Google App Engine, he could practice Python and learnt a lot.

这几天猴哥在为他的同步系统而忙碌,这个系统能够自动更新他的微博们。

在上一次改动之后,猴哥的同步系统曾经正常工作了很长时间,它把“猴子的小窝”里的帖子转发到Facebook、人人网、QQ空间和百度空间,把Twitter状态转发到人人网、QQ空间和百度空间中。

但是这里仍然有一个问题,由于这个系统是基于一个开源代码修改而来的,而这个代码最最开始的时候就有一些缺陷,所以猴哥的这个系统代码比较凌乱。因此同步系统越来越慢,有的时候还会因为网络状况的一些小错误而被阻碍运行。

在这次修改中,猴哥增加了针对新浪微博的模块,解决了Twitter“速率限制”这个未被原作者注意和考虑到的问题。

为了减少不必要的计算量,猴哥使用了MemCached;为了获得不受限制的Twitter数据,猴哥使用了OAuth库,大大节省了他的工作量。

猴哥改变了整个系统的结构,以便使这个系统更加健壮。在这次的项目中,猴哥学习了很多。

2011
07.09

As I said in last post, we got a big problem in the mysqldump double encoding bug (Bug #28969).

Now, if I just have a SQL file, which is double encoded by mysqldump, and the original database was destroyed, how can I restore the database?

The way is quite sample, but always get confusion because of the expression.

  1. Restore the SQL file into MySQL, and you will get a messy database.
  2. Use mysqldump again to export a SQL file, which is decoded.
     mysqldump -h "$DB_HOST" -u "$DB_USER" -p"$DB_PASSWORD" \
    --opt --quote-names  --skip-set-charset \
    --default-character-set=latin1 "$DB_NAME"   > /tmp/temp.sql
  3. Restore the decoded SQL file into MySQL.

Your database now comes back!

References

正如我在上一篇日志说的那样,我们因为mysqldump(Bug #28969)的重复编码漏洞,遇到了一个大问题。

现在,加入我有一个被mysqldump重复编码的SQL文件,而原始数据库已经被摧毁,如何恢复原始数据库呢?

方法非常简单,只是它过去的表述比较容易造成误解。

  1. 恢复SQL文件到MySQL,得到充斥着乱码的数据库;
  2. 再次使用mysqldump输出一个解码的SQL文件;
     mysqldump -h "$DB_HOST" -u "$DB_USER" -p"$DB_PASSWORD" \
    --opt --quote-names  --skip-set-charset \
    --default-character-set=latin1 "$DB_NAME"   > /tmp/temp.sql
  3. 恢复这个新的SQL文件到MySQL中。

你的数据库现在回来了!

参考文献
2011
07.09

The Monkey's House had been down for 3 weeks.

Hosting

Our former service provider deleted all our files and data in that hosting without any notification before, because of, they said, our 'violation' to the T.O.S. ,which has not been found by our staffs by now.

The WWW service via HTTP was failed in June 16, and our site monitor alarmed this severe problem.

The Monkey was around the final exam so that he did not have time to handle that very soon.

Fortunately, there is a fresh backup.

Domain

Coins always have two sides. The domain 'Shk3.PP.RU' was being expired, due to the new regulation.

In July 6, the domain was not delegated while the user were transferred to a Russian page of the NIC.

There was still a big problem that the Monkey 's profile in the RU-Center, the new NIC of Russian domains, was incorrect. The Monkey tried to write a letter with his passport to change the profile into correct one.

The RU-Center and the Old Monkey eventually helped the Monkey in the domain renewal, thus the domain 'Shk3.PP.RU' was re-delegated yesterday.

The Monkey and his old friend PrinceWZZ now host a server together, which is called 'Princeton Monkey' by the Monkey. This server enables the Monkey more powers and provides him a bigger stage to perform his web ability.

Database

Blips came again. The backup of database was made by 'mysqldump', which had a bug making double encoding to the data, according to Bug #28969.

So the restored database was filled with messy data. Still luckily, the Monkey found the solution by restoring-mysqldumping-restoring.

The Monkey also found a very cool technology website StakOverFlow, in which people encouraged the Monkey:

I'm sure you've also learned a best practice here. Always check your backups against a "burn system" so you know they are good before you need them for disaster recovery. Don't feel bad we've all been there. :D  – Erik Nedwidek

Thanks to RU-Center, Old Monkey, stackoverflow and PrinceWZZ as well as all our readers.

猴子的小窝宕机3个星期了。

我们上一个空间提供商在没有通知我们的情况下,删除了我们所有的文件和数据。因此我们的万维网HTTP服务在6月16日中断。

猴哥由于临近期末考试,无法很快的解决这个问题。幸运的是我们有一个近期的备份。

事情总是两面的,域名Shk3.PP.RU因为新的域名规定,马上就要到期了。7月6日,域名被中止并转向到一个俄国域名信息中心的俄文页面。

在域名管理机关RU-Center,猴哥的个人信息还有一个严重的问题,他为此把护照的复印件发送给了管理机关以重新获得域名的管理权。

猴哥的老朋友PrinceWZZ现在与猴哥合租一个猴哥称作Princeton Monkey的服务器,这个服务器使猴哥有更大的余地展示。

问题又来了,数据库的备份由于生成软件的漏洞(Bug #28969)而把数据重复编码,导致恢复后的数据库充斥着混乱的数据。有一次幸运的是,猴哥找到了一个通过恢复-备份-恢复的解决方案。

猴哥还找到了一个非常棒的技术网站“堆栈溢出”(mysqldump),那里的网友鼓励猴哥:

我确信你在这里学到了最重要的东西——经常在一个“滚烫的系统”上更新备份,因此你在需要灾难恢复前知道他们的重要性。不要感到悲伤,我们都在这儿呢! :D  – Erik Nedwidek

2011
02.22

经过几天的编程、调试,我的微博、博客同步系统终于基本完成了。

这个架设在Google App Engine上的系统能够将我的推特(Twitter)上的微博同步到人人网百度空间腾讯QQ空间及QQ签名上。过去虽然通过第三方网站,我能够将微博同步到人人上,但是其非常不稳定,再加上前些日子又有一小撮人在大街上遛弯,导致第三方网站的同步渠道开始维护;现在使用自己的系统,再也不用担心别人出门运动对我的微博产生的影响了。

这个系统还能够将猴子的小窝的文章同步到人人网百度空间腾讯QQ空间以及脸谱网(Facebook)上。

这一套系统的难点主要是在于如何避过百度、腾讯这两个不喜欢开放平台的网站的图灵测试。绕过百度系统的方法比较成功,绕腾讯的有些烦琐,有效性尚需一些时日来观察。

对比代码,发现脸谱网的开放平台做的最好,其安全性最好,而且实现的代码长度也很短;相比之下,一直号称开放的人人网似乎并不友好,至少我看了很长时间技术文档,也不明白它的那个API除了PHP下直接调用官方库以外,怎么用;最最恶心的是腾讯的系统,光一个验证就来来回回地折腾了好几次,估计腾讯不愁服务器负载问题。

等到下面技术成熟了,我可以考虑小范围内测。

The Monkey has coded his Monkey Sync System, which can update his micro-blog and blog in several SNS websites automatically.

This application in Google App Engine can skip the Turing Test of Baidu and Tencent, the websites who are not open-socially.

Comparing with the most open API, Facebook's Graph API, the Renren, a Chinese Facebook, which is always claimed open social system, is not friendly for developers, at least non-PHP ones.

2011
02.02

读程序写结果(100分)

#include <string.h>
char* f1(char* a) {
  strcat(a,"乐");
  return a;
}
Imports System.Text
Function f2 (Byval a As String) As String
  f2=a & "快"
End Function
def f3(a)
  return "%s春"%a
#include <iostream>
int main() {
  cout<<f1(f2(f3("新")));
  return 0;
}
2011
01.26

As Moderator everkahn said, the Tieba(The largest Chinese communication platformprovided by the Chinese search engine Baidu. - Wikipedia) of Beijing High School 4 was hacked with his passport, which has the power of moderators including deleting and was stolen at that time, and all posts were deleted illegally.

The dashboard of Tieba is very unfriendly for batching management, in which recovering will have to be done by clicking the button 'Recovering' one by one, while the deleted posts were more than 5,000 and were separated into more than 1,000 pages. There would be a painful work to recover all the posts and the service provider Baidu never has any response to such recovery requests.

As another moderator, the Monkey promised to recover them after the final-term.  The recovery task was completed automatically by a computer program, which was made by the Monkey in Active Server Pages via Visual Basic Script. The task was started around 18:55 EST Wednesday, and went to the finish point at 19:06 EST on the same day.

Moderator Monkey said, 'Any attempt to hack the Tieba is immoral, vain and invalid.'  The Moderator condemned such despicable acts.

正如吧主everkahn所说北京四中贴吧被人用他的失窃管理帐号破坏,所有帖子被非法删除。

贴吧的管理系统非常不便于批量管理,恢复操作需要通过一个一个点击“恢复”按钮来完成,而被删除的帖子有五千条、一千余页之多。恢复所有的帖子将是一个痛苦的工作,而服务提供商百度从未回应过类似的恢复请求。

作为另一名吧主,猴哥承诺将在期末考试后恢复这些帖子。恢复工作由无人工介入的计算机程序完成,这个计算机程序是由猴哥在Active Server Pages下通过Visual Basic Script编写的。这项工作从澳洲东部时间星期三18时55分左右开始,在澳洲东部时间同一天的19时06分结束。

吧主猴哥说:“任何妄图攻击四中贴吧的行为都是不道德的、徒劳的、无效的。”他谴责这种卑劣的行径。

2011
01.25

在经历了期末考试的血雨腥风后,猴哥安然无恙地迎来了他的黄金假期。无论期末考试成绩如何,没有开学考试的大学生活总是让猴哥很快乐!

多美好的星期天呀!没有试卷宝宝。

——猴哥

After the bloody final-term examination, the Monkey eventually meets his Wonderful Vacation in a whole skin. No matter how the scores will be, the college life without begin-term exams gets the Monkey very happy!

What a wonderful vacation, WITHOUT PaperBob!

— the Monkey

2011
01.02

加载速度慢长久以来一直困扰着我们和各位访问者,最近的一次技术测试我们似乎发现了限制加载速度的原因。

经过最近两次的调整,博客的加载速度已经有了显著的提升,其中第一次加载的连通率已经达到了正常水平,后续使用的加载速度已经接近国内的网站。

感谢各位长期对本博客的关注,这里要再次提醒您:本博客属于教育网的非免费地址,访问时请取消“仅访问免费资源”的选项。我们正在努力建立国内镜像节点。

2011
01.02

新年到,考试到,新的纪念通栏到!

这一次通栏使用的背景是GNU协议下的一张Ubuntu桌面。

寓意2010年对于我是丰收,这一年我学到了很多,经历了很多。也期盼未来的收获能够丰满。

2010
12.26

由于中国的网络环境和域名解析上的困难,我们将主域名地址由shk3.pp.ru变更为www.shk3.pp.ru。

现在起,所有指向shk3.pp.ru的链接将被自动跳转到www.shk3.pp.ru。

这次修改将提升网站的成功访问率。因此给您带来的不便敬请谅解。