在一套分布式的online services系统中,各service通常不会放在一台服务器上,而是通过Zookeeper这样的东西,将自己的service信息注册到上面,service的使用者通过Zookeeper来发现各service的信息,从而可以将request发送到不同的service上去处理。
learnhard
[原创]VC++连接/操作MySQL数据库(通过MySQL C API)
这是一篇非常基础的文章。想必每个刚开始学写程序的人,都很有可能会遇到这样的问题:如何用Visual C++编写一个可以操作(读写数据)MySQL的程序?
由于一直在Linux下工作,我很久没写Windows程序了,但是最近急于写一个操作MySQL的Windows程序来用,于是又重新拿起了VC++,写了一个MFC应用程序,临阵磨枪,不亮也光嘛。
在写这个程序的过程中,遇到的有些问题觉得挺扯蛋的,于是干脆就把整个过程给记下来了,整理成这篇文章,知识共享。
开发环境:Visual Studio 2005,Win 7 32位
[原创] SVN和Git的一些用法总结
以下都是比较基础的操作,高手们请绕道,不必浪费时间来看了。
(A)SVN
➤ 查看日志
提交的时候一般会写上注释,如果要查看提交日志,用以下命令:
svn log -l 4
其中,-l 4表示只查看最近4条日志(也可以没有这样的参数,就表示查看所有日志)。但是你通常会很抓狂地发现,最近的几条日志中,竟然没有你才刚刚提交的那一次的日志!这是怎么回事?日志丢了吗?
其实,是因为你要很用以下命令,更新本地的版本库,才能看到最近提交的日志:
svn up
这事如果你没注意到,那么可能会浪费你很多时间。问Google也不好找答案,因为这个问题不太好描述,所以不好搜索答案。
➤ 查看指定的版本修改了哪些文件
svn diff --summarize -c 566
其中,566是你指定的版本。
[原创]Java基础知识记录(2)
前言:本文『很傻很天真』,任何稍有Java编程经验的都不用看了。
文章来源:http://www.codelast.com/
▶ 创建一个Set时,如何初始化其中的元素
如果在创建一个Set之后,再用add()方法向Set中添加元素,就显得比较麻烦了。通过使用Google Guava库,可以在初始化的时候就向其添加若干元素:
Set<String> s = Sets.newHashSet("99", "100")
这样创建出的s就会包含99和100这两个元素。
[原创]如何添加一个文件/目录到IntelliJ项目的classpath中
以下内容的背景:IntelliJ,Java项目。
在单元测试中,我们经常会使用与生产环境里不同的一些配置文件来为提供参数,而你的程序又是以类似下面的方法来读取配置文件:
String configFileName = "config.properties"; Properties properties = new Properties(); properties.load(MyClass.class.getClassLoader().getResourceAsStream(configFileName));
上面的代码中仅使用了配置文件名,而不是其完整路径,这就导致了可能在IntelliJ中运行一个单独的单元测试的时候,找不到该配置文件,因为你只提供文件名的话,该文件必须要在classpath中,否则是找不到它的。
[原创]使用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.
[原创]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的、信用卡那么大的迷你计算机。
下面是我在折腾Pi的过程中的一些记录,仅供参考。
➤ 树莓派视频教程
➤ Raspberry Pi(树莓派)配置记录/Configure the Arch Linux ARM on Raspberry Pi
➤ 在Raspberry Pi(树莓派)上用OpenCV来操纵摄像头拍照/Use OpenCV on Raspberry Pi to Controll a Webcam to Take Photos
➤ 通过Raspberry Pi(树莓派)的GPIO接口控制发光二极管/Control LED through the GPIO on Raspberry Pi
➤ 通过Raspberry Pi(树莓派)的GPIO接口控制步进电机/Control stepper motor through the GPIO on Raspberry Pi
[原创]在Raspberry Pi(树莓派)上用OpenCV来操纵摄像头拍照/Use OpenCV on Raspberry Pi to Controll a Webcam to Take Photos
For non-Chinese readers:
I'm a software engineer in Shanghai, China. 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是什么?简单地说,它就是一个基于ARM CPU的、信用卡那么大的迷你计算机。
In short, Pi is an ARM-based mini computer which has a credit card size.
本文主要内容:
在Raspberry Pi上,通过调用OpenCV库,自己写一个简单的C程序来控制摄像头拍照,并保存图片。
在阅读本文之前,请确保你已经阅读过我的另一篇配置Pi的文章,因为本文是在它的基础上进行的。
The main content of this article:
Write a simple C program by invoking the OpenCV library on Raspberry Pi to control a webcam to take photos & save them.
Before reading this article, please make sure that you've read my another article about Pi configuration, because this article is based on that.
[原创]Raspberry Pi(树莓派)配置记录/Configure the Arch Linux ARM 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.