Making Emacs Start Up Faster

Posted on

I use Emacs in terminals and start/close Emacs frequently as needed like in a file checking-editing-closing loop. However, Emacs seems take some time to start up especially some heavy modes are used. How to make Emacs start up faster? (If you just want the solution/script first, find the command in the summary section.) My solution
Read more

How to Set Up Git Commit Email Notifications

Posted on

A method to send email notification to a list of email addresses by the remote git server after every push from the client will be introduced in this post. An example notification email after a commit is shown in the figure below. The subject contains a prefix, the repository name, the branch name and the
Read more

How to Set Up A Gitolite Git Server – A Ten-Minute Tutorial

Posted on

I ever introduced seting up git server using SSH or gitosis. However, gitolite is the way to go for managing git servers if you want an lightweight authentication layer. gitolite provides many very usefull features which can control each user’s right on each branch. I set up one gitolite git server and am very happy
Read more

RAII-like Error Handling and Resource Management in C

Posted on

Error handling and resource management are pervasive in programs. RAII originated in C++ is great. With RAII, it is much easier to write easy-to-read code that allocats/deallocats resources in the constructor/destructors. By representing a resource with a local object, we are sure that local object’s destructor will release the resource and will not forget to
Read more

PHP Photo Gallery Scripts Requiring No Database

Posted on

It is nice to set up some photo gallery on the web and share with friends and family. Some online services are good and convenient. But if you want to host it on your own domain and control them by yourself, there are also many scripts available. Usually, we want the script simple to use
Read more

Auto Indenting for OCaml Code in Vim with ocp-indent

Posted on

The built-in indenting in Vim for OCaml seems not very good. How to set up auto indenting for OCaml code in Vim? ocp-indent works very well for me. This posts introduces how to configure Vim to use ocp-indent to automatically indent/format OCaml code. First, install ocp-indent after installing opam: $ opam install ocp-indent Second, configure
Read more

Linux UDP Programming Tutorial

Posted on

UDP has its advantages over TCP, such as being relatively lightweight and receiving one packet per read call (recvmsg), although the programmers need to handle related issues, such as packet lost and out-of-order packets delivery. This post gives information and references on how to write UDP programs in a C/Linux environment. What is UDP Check
Read more

How to Measure Time Accurately in Programs

Posted on

It is quite common to measure the time in programs using APIs like clock() and gettimeofday(). We may also want to measure the time “accurately” for certain purposes, such as measuring a small piece of code’s execution time for performance analysis, or measuring the time in time-sensitive game software. It is hard to measure the
Read more

Changing Linux User Password in One Command Line

Posted on

In Linux, we use passwd to change password, but passwd requires input from stdin to get the new password. It is common case that we may want to change the password non-interactively, such as creating new user accounts and change or set password for these accounts on a number of Linux boxes when the new
Read more

How to Copy Output of Commands in a Linux Terminal to X Selection or Clipboard

Posted on

xclip is a tool to copy the copy the output of commands from a command line in a terminal to X selection or clipboard. It connects the command line interface and the X selections (clipboard) and is a very useful tool. For example, processing some text in vim in a terminal and then copying it
Read more

Auto Keyboard Pressing Using xvkbd in Linux

Posted on

Automatic keyboard pressers are useful tools. However, it seems that there is no simple and easy to use automatic keyboard presser for Linux if you search for “automatic keyboard presser linux”. After some digging, I find using the xvkbd with some options is a good method for automatic keyboard pressing though it is not designed
Read more

How to install no-ip client on Linux

Posted on

noip2 is a dynamic update client for No-IP to keep your current IP address synchronized with your No-IP domain, no matter whether the IP is dynamically requested via DHCP or static assigned. Furthermore, with the domain name, we can host site using a “static” domain whose CNAME points to the No-IP domain. noip2 is a
Read more

ASCII Table and ASCII Code

Posted on

This post gives the ASCII table and ASCII code with ASCII control characters and ASCII printable characters and a tool to convert ASCII codes to ASCII characters. Introduction to ASCII table and ASCII code ASCII stands for American Standard Code for Information Interchange. An ASCII code is the numerical representation of a character since computers
Read more

C++ Reference and Styles

Posted on

C++ References Reference of the C++ Language Library, with detailed descriptions of its elements and examples on how to use its functions: http://www.cplusplus.com/reference/ C++ reference: http://www.cppreference.com/w/ C++ Styles I compile a list of C++ styles on the Internet. http://geosoft.no/development/cppstyle.html http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml http://www.mactech.com/articles/develop/issue_02/C%2B%2B_Style_Guide_v007.html http://www.cs.uga.edu/~dkl/1302/Fall99/style.html

How to Print Notes on a PDF File with Acrobat, Adobe Reader and Foxit Reader

Posted on

Print PDF with notes is not that straightforward, especially when you want specific styles of the printed notes/comments. In this post, we introduce how to print notes on a PDF file with Acrobat, Adobe Reader and Foxit Reader. Acrobat The detailed method is posted on Adobe’s blog: Printing Sticky Notes on a PDF. Excerpt of
Read more

Java与C++在语言方面上的不同

Posted on

1,Java抛弃了头文件、预处理机制、goto语句和多维数组。 2,Java不支持指针。 3,Java抛弃了联合体和结构体。 4,Java不支持独立函数。所有函数必须在类中声明。 5,Java不支持多重继承,可以使用接口模拟多重继承。 6,Java不支持运算符重载。 7,Java中布尔型不再用整数来代替。 8,Java中主函数必须有一个字符串类型的参数。 Java抛弃的C++中的这些机制和结构多数都是“危险”的,减少了语言的复杂性,增强了安全性,虽然在一定程度上减少了其灵活性。

Hashing Library for C

Posted on

I try to find some Hashing libraries for C and find several good ones. The hsearch function in the GNU C library. There are other methods to organize information which later should be searched. The costs of insert, delete and search differ. One possible implementation is using hashing tables. The following functions are declared in
Read more

x86-64 ISA / Assembly Programming References

Posted on

This post collect the reference resource for x86-64 (also know as Intel 64, AMD 64) ISA / assembly language programming. x86-64 is a 64-bit extension of the Intel x86 instruction set. ==x86-64 Assembly Programming== Introduction to Computer Systems Resources (15-213 Introduction to Computer Systems Resources from CMU) Lots materials for learning machine-level programming on the
Read more

Inline Assembly with GCC on Linux

Posted on

One cool feature of gcc is that it can inline assembly into C code. With inline assembly, the programmer can precisely control the execution of the processor, such as forcing variables to use registers, getting special processor state efficiently, and writing critical efficient code in assembly by hand. I compile a list of tutorials from
Read more

GNU C Reference Manual

Posted on

When we program in C, a C reference by hand is usually useful. The GNU C Reference Manual provides us a good reference for the C programming language implemented by the GNU C Compiler. “This manual is strictly a reference, not a tutorial. Its aim is to cover every linguistic construct in GNU C.” GNU
Read more