[原创] Google Protocol Buffers中文教程

注:前面这些是本人的翻译,可能不准确,可能有错误,但是基本上可以理解,希望能对大家有所帮助。

 
 
 

[原创]Zookeeper相关的ConnectionLossException的解决办法

最近遇到了一个比较头疼的问题:有一个Java project中的test case在Jenkins自动nightly build的时候经常failed,有越来越频繁的趋势,但是如果在它failed之后到Jenkins上手工重新run,它有时又能成功(但还是有失败的,失败与成功的比例大概各占一半)。
而且在我的计算机(Ubuntu)上跑这个test case,它几乎从来不fail,但是在Jenkins服务器上跑,它就总是挂掉。
这种诡异的问题很恼人,经过Jenkins记下来的build log分析,觉得最有可能的原因是和Zookeeper有关,因为这个test case使用了Curator的TestingServer来模拟Zookeeper Server,而且这个test case中启动了很多的service并注册到了Curator模拟的Zookeeper Server上,而且在test case运行的过程中,还会有很多个client不断地连接到Zookeeper Server上,从中取出多个service的信息,并与它们交互,总而言之,test case的流程比较复杂。

阅读更多

[原创] Zookeeper注册节点的掉线自动重新注册及测试方法

在一套分布式的online services系统中,各service通常不会放在一台服务器上,而是通过Zookeeper这样的东西,将自己的service信息注册到上面,service的使用者通过Zookeeper来发现各service的信息,从而可以将request发送到不同的service上去处理。

阅读更多

[原创] SVN和Git的一些用法总结

 

以下都是比较基础的操作,高手们请绕道,不必浪费时间来看了。

(A)SVN

查看日志
提交的时候一般会写上注释,如果要查看提交日志,用以下命令:

svn log -l 4

其中,-l 4表示只查看最近4条日志(也可以没有这样的参数,就表示查看所有日志)。但是你通常会很抓狂地发现,最近的几条日志中,竟然没有你才刚刚提交的那一次的日志!这是怎么回事?日志丢了吗?
其实,是因为你要很用以下命令,更新本地的版本库,才能看到最近提交的日志:

svn up

这事如果你没注意到,那么可能会浪费你很多时间。问Google也不好找答案,因为这个问题不太好描述,所以不好搜索答案。

 查看指定的版本修改了哪些文件

svn diff --summarize -c 566

其中,566是你指定的版本。

阅读更多

[原创]使用memcached为WordPress站点提速

本文的前提条件:你对你的WordPress站点服务器有控制权,例如,你使用的是VPS搭建的WordPress站点,而不是虚拟主机。如果不符合条件就不用往下看了,因为后面的很多操作是需要root权限来安装、配置软件的。另外,我使用的是32位的Linux系统,如果你是64位的系统,可能有些许不一样,或者出现一些文中没有遇到的问题,请注意。

首先说一下使用memcached为WordPress站点提速的意义。由于我不是做前端开发的,所以下面的部分内容说的不一定正确、深刻,您就凑合着看吧。
如果你的WordPress站点访问量很大,那么VPS负载可能就很高,而这其中,可能有很大一部分就是MySQL的负载——它要将大量内容读取出来,并返回给访客。其实这部分工作可以通过缓存来提高性能,memcached就是这样一个软件,可以帮助我们实现这一点。

阅读更多

[原创]树莓派杂谈/Some casual thoughts about Raspberry Pi

Raspberry Pi是什么?
引用维基百科的一句话:

The Raspberry Pi is a credit card sized single-board computer developed in the UK by the Raspberry Pi Foundation with the intention of stimulating the teaching of basic computer science in schools.

简单地说,它就是一个基于ARM CPU的、信用卡那么大的迷你计算机。
In short, Pi is an ARM-based mini computer which has a credit card size.

阅读更多

[原创]制作一个简单的树莓派亚克力机箱(盒子)/Make a simple acrylic case for Raspberry Pi


Raspberry Pi
是什么?
引用维基百科的一句话:

The Raspberry Pi is a credit card sized single-board computer developed in the UK by the Raspberry Pi Foundation with the intention of stimulating the teaching of basic computer science in schools.

简单地说,它就是一个基于ARM CPU的、信用卡那么大的迷你计算机。
In short, Pi is an ARM-based mini computer which has a credit card size.

要阅读更多关于树莓派的文章,请点击这里
If you want to read more about Raspberry Pi, please click here.

用了树莓派一段时间之后,出于保护原因,我打算为它做一个机箱(盒子),完成之后是这个样子:
After using Raspberry Pi for some time, I decided to make a case for it for protecting reason, and it's finished appearance looks like this: 

阅读更多

[原创]在树莓派上使用腾达(Tenda)W311MI迷你无线USB网卡(RT5370芯片)/Using Tenda W311MI mini wireless USB adapter(based on RT5370 chipset) on Raspberry Pi

For non-Chinese readers:
I'm a software engineer in Shanghai, China, and since I bought a Raspberry Pi, I spent some spare time on it and I'm glad to share something with Pi users all over the world, so this article has two languages: Chinese & English, and I try to translate the Chinese to English as accurately as possible, but, there might be some translation mistakes, so if you don't know what I mean in the article, just leave a comment, and I'll reply when I get an answer. Also welcome to contact me via Email.

Raspberry Pi是什么?
引用维基百科的一句话:

The Raspberry Pi is a credit card sized single-board computer developed in the UK by the Raspberry Pi Foundation with the intention of stimulating the teaching of basic computer science in schools.

简单地说,它就是一个基于ARM CPU的、信用卡那么大的迷你计算机。
In short, Pi is an ARM-based mini computer which has a credit card size.

在阅读本文之前,我建议你阅读另外一篇配置树莓派的文章,本文与它有一些联系。
Before reading this article, I recommend you to read another one on Pi configuration because this article has some connection with it.

为了能让树莓派摆脱每次使用都要插网线的麻烦,我最终还是决定为它配备一块USB无线网卡。在Google了一番之后,我发现很多树莓派用户都提到基于Ralink RT5370芯片的USB无线网卡,于是我购买了一个基于RT5370芯片的腾达(Tenda)W311MI迷你无线USB网卡(如下图所示),非常便宜的白菜价:只要¥30。
To get rid of the inconveniency of connecting a network cable to Raspberry Pi I decided to equip it with a wireless USB adapter. After Googling the Internet I found that many Pi users mention the wireless USB adapter based on Ralink RT5370 chipset, so I bought one too - the Tenda W311MI 150Mbps Wireless Mini USB Adapter(shown as below), which based on RT5370 and has a very low price: only $4.8 .

阅读更多

[原创]通过Raspberry Pi(树莓派)的GPIO接口控制步进电机/Control stepper motor through the GPIO on Raspberry Pi

Raspberry Pi是什么?
引用维基百科的一句话:

The Raspberry Pi is a credit card sized single-board computer developed in the UK by the Raspberry Pi Foundation with the intention of stimulating the teaching of basic computer science in schools.

简单地说,它就是一个基于ARM CPU的、信用卡那么大的迷你计算机。
In short, Pi is an ARM-based mini computer which has a credit card size.

在阅读本文之前,请确保你已经阅读过我的另外几篇关于Pi的文章,因为本文与它们有或多或少的关系。
Before reading this article, please make sure that you've read some other articles of mine on Pi, because this article is more or less based on them.

【1】实验目的 / Experiment purpose
在树莓派上编写一个C程序,通过其GPIO口控制步进电机的转动方向以及速度。
Write a C program to control the direction & speed of rotation of a stepper motor through the GPIO on Raspberry Pi.

阅读更多

[原创]通过Raspberry Pi(树莓派)的GPIO接口控制发光二极管/Control LED through the GPIO on Raspberry Pi

Raspberry Pi是什么?
引用维基百科的一句话:

The Raspberry Pi is a credit card sized single-board computer developed in the UK by the Raspberry Pi Foundation with the intention of stimulating the teaching of basic computer science in schools.

简单地说,它就是一个基于ARM CPU的、信用卡那么大的迷你计算机。
In short, Pi is an ARM-based mini computer which has a credit card size.

在阅读本文之前,请确保你已经阅读过我的另外几篇关于Pi的文章,因为本文与它们有或多或少的关系。
Before reading this article, please make sure that you've read some other articles of mine on Pi, because this article is more or less based on them.

通过Raspberry Pi的GPIO口来控制发光二极管已经不是什么新鲜事了,网上有大量的教程和资源可查。为了测试一下控制GPIO输出的功能,我也实践了一次。
首先声明,我对硬件并不了解,所以下文可能有错误,如果你发现了,请留言告诉我,非常感谢。
It's nothing new to control LEDs through Pi's GPIO, a lot of tutorials & resources are available on the Internet now. But I tried to do it myself too for the sake of testing the GPI output functionality.
First I want to remind the readers that I'm not a hardware guy so this article may contains some mistakes, and if you find that, please leave comments to tell me, thanks in advance.

文章来源:http://www.codelast.com/
【1】实验目的 / Experiment purpose
写一个简单的程序,控制Raspberry Pi的GPIO口输出高、低电平,从而让接在GPIO口上的发光二极管闪烁。
Write a simple program to control the GPIO on Pi to output high or low level to make the LED which connected to GPIO blink.

阅读更多