Next Spaceship

Driving into future…

Resolve Hg Conflicts Manually

| Comments

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

| Comments

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.

How to Make a Windows Installer

| Comments

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.

A Discrete Cosine Transform Demo

| Comments

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.\)

Left-handed Mouse Cursors

| Comments

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

| Comments

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:

Transform All Files to UTF-8 Encoding

| Comments

Update

This blog is obselete, please head forward to this blog.


I’m tired of transform shift-jis encoding to UTF-8 encoding for each file in my project these days, so I want to write a script to automatically do this job for me. After searching the Internet, I find it’s an easy job with the tool of Python.

Python, at least 2.6 version, has a library called codecs, and all we have to do is just using this library to read and write files in different encodings.

This code transforms all files, including files in sub-folders, from shift-jis encoding(or detected encodings) to UTF-8 encoding.

My Emacs Configure File

| Comments

Open the file named “.emacs” in your home folder. (if it doesn’t exist, create one.) Copy the following code and paste it into the opening file. Save the file and restart Emacs.

POJ 1260 Pearls Report

| Comments

View the problem at POJ. It’s a problem from a contest in Northwestern Europe, 2002.

This is a classical Dynamic-Programing problem. The sate transformation equation is:

POJ 1009 Edge Detection Report

| Comments

View the problem at POJ: 1009 Edge Detection.

The answer should be in format of Run Time Encoding. Let val[i] be the value, and len[i] be the length of the i-th pair. There is a corresponding location for each pair, ie the start point, and let row[i] be the row, and col[i] be the column of the start point for the i-th pair.