Sudoku is a popular game. Howerver, solving Sudoku is sometimes not so easy, so I wrote a program to help me do this job.
Configure PHP-FPM and Nginx in Low Memory Servers
Recently, I registered an Amazon EC2, ie Elastic Compute Cloud, with a free tier for the first year. The machine has only 600M memory. That is so few that it took me a few days to optimize my configuration files to make my blog and other web service run on this machine.
Before I use EC2, my blog is based on LAMP(Linux, Apache, MySQL, PHP). I decided to replace it with LNMP(Linux, Nginx, MySQL, PHP), since Nginx is said to be more efficient than Apache. To install all these is simple:
How to Solve Broken Pipe Message in SSH Session
Sometimes my SSH session disconnects with a Write failed: Broken pipe message. What does it mean? And how can I keep my session open?
It’s possible that your server closes connections that are idle for too long. You can update either your client (ServerAliveInterval) or your server (ClientAliveInterval).
Send Email With PHP in UTF-8
In my previous article Configure Mail Service with PHP Mail Function and Postfix, I described how to set up an environment to send mail with php on Linux.
Here, I will solve an issue which met by a lot of people, confused but don’t know how to do: How to send mail in UTF-8? Here I will tell you how to send an email with not only a UTF-8 subject but also a UTF-8 content. It’s simple. Just read the following code. Quote your subject with '=?UTF-8?B?'
and '?='
. You may choose to use HTML to edit your email content, just don’t forget to declare UTF-8 character set. That’s all.
Configure Mail Service with PHP Mail Function and Postfix
This article describes how to use the php function mail to send a mail.
Resolve Hg Conflicts Manually
This artical tells about a simple method to resolve Hg conflicts. It doesn’t use any 3-party tool to merge your code, but only use emacs to edit your conflicts file and tag a resolved tag. So don’t apply it to merge big files with a lot of conflicts.
Configure Network Using ifconfig and route
Setting up your network consists of three steps. First we assign ourselves an IP address using ifconfig. Then we set up routing to the gateway using route. Then we finish up by placing the nameserver IPs in /etc/resolv.conf.
Check If a String Contains Chinese Characters
Transfer the string to Unicode and since Chinese is between 0x4e00 and 0x9fff, just check if there is a character in this range.
How To Make a Windows Installer
Introduction
There are many tools which can be used to make an installer, like NSIS, Install Shield, Advanced Installer, WiX, InnoSetup and even Visual Studio. Here I just show you how to make an installer by NSIS. NSIS (Nullsoft Scriptable Install System) is a professional open source system to create Windows installers. NSIS is script-based, which means you configure your installer by a script. That makes it small and flexible.
Configure SSH on Arch Linux
Just record this for possbile uses.
Set Up a Server Environment on Arch
This article is about how to set up a PHP production environment on Arch system.
How to Configure 2 Routers on Home Network
You need to connect 4 computers to the internet. Now you have 2 routers, but each with 3 LAN ports. How would you solve this issue?
Calling Non-const Member Functions from Const Member Functions
Compare the following two segments of codes. Which do you think is better?
A Discrete Cosine Transform Demo
The Discrete Cosine Transform (DCT) algorithm constitutes an integral component of contemporary image/video processing applications.
The formal definition of DCT is:
\[X_k = \sum\limits_{n=0}^{N-1}{x_n}\cos{\left[\dfrac{\pi}{N}\left(n+\dfrac12\right)k\right]}\quad k=0,\ldots,N-1.\]How To Set Proxy For apt-get
Before running apt-get command, run the following command:
Left-handed Mouse Cursors
I made a set of left-handed mouse cursors so that I can use my left-handed mouse more comfortably.
I just used a tool _ArtCursors _to import the standard cursors from Windows XP, and edited the cursors in ArtCursors, flipping and setting the hot-spot for each.
Now, have a look:
Netcat File Transfers
In a very simple way it can be used to transfer files between two computers. You can create a server that serves the file with the following:
Obtain The Title Of A Website
The idea is to retrieve the html file of the website and parse it to find the content between <title> and </title>.
To get the html file, we need a library in C++, as the standard library has no such functions. I choose the libcurl
library, and you can download it here: http://curl.haxx.se/libcurl/.
Shakespeare Sonnet 29
When in disgrace with fortune and men’s eyes,
I all alone beweep my outcast state,
How To Rotate An Image
With OpenCV, it’s easy to rotate an image by code.