[原创]两台Ubuntu计算机利用Synergy共享鼠标和键盘

工作时使用多台计算机的话,如果要为它们都接上鼠标、键盘可能是一件麻烦的事情:占用很多位置,而且没必要。本文介绍了如何使用Synergy程序在两台Ubuntu计算机之间共享鼠标和键盘的方法。通过此方法,你可以在鼠标移动到一个屏幕的边缘之后,自动“跳入”另一个屏幕中,并且鼠标定位在哪个屏幕中,键盘就可以在哪个屏幕中进行文字输入。

阅读更多

[原创] 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.

阅读更多

[原创](翻译)Java版的各种Thrift server实现的比较

本文是我对这篇文章的翻译:Thrift Java Servers Compared,为了便于阅读,我将原文附于此处,翻译穿插在其中。此外,为了防止原链接在未来某一天失效后,文中的图片再也看不到的问题,我将原文中的图片也保存到了本站的服务器上,我不知道github或原作者是否允许这样做,但我翻译本文仅在于传播知识的目的,在此向原作者和github表示深深的感谢:感谢你们分享了这样好的文章。
       
       
       
Thrift Java Servers Compared
This article talks only about Java servers. See this page if you are interested in C++ servers.
本文仅讨论Java版的Thrift server.如果你对C++版的感兴趣,请参考 这个 页面。

阅读更多

[原创] Emacs on Windows初步实践

Emacs是个好东西,最近我在Windows下也用起了Emacs,是因为有很多特定类型文件的语法高亮显示很好用,例如Apache Pig文件,Thrift文件在Emacs中都有了现成的语法高亮支持,等等,如果你用Notepad++等文本编辑器就必须自己编写语法高亮规则了(会累死你)。
文章来源:http://www.codelast.com/
下面记录一下Emacs Windows版从安装到基础配置的过程。

阅读更多