I like the width of English monospace font to be half a Chinese character.
You will learn how to:
- convert files between character sets
- convert text files between DOS and Unix formats
- convert filenames from one encoding to another
- convert between DEC and HEX
- convert videos, audios and images
- convert PDF documents
- convert html to text
- convert html to pdf
- and more ...
My blogs (yuyuan.org and forrestyu.org) were hosted in Bluehost (sponsored by Joe Guo). Now that I have bought my own hosting service from WebFaction, it's time to do some migration. In this article are what I did. You can use it as a step-by-step HOWTO.
In this article I compare several solutions to writing math in reStructuredText and show how to write a custom filter to facilitate the use in a Django project.
Math sample:
When \(a \ne 0\), there are two solutions to \(ax^2 + bx + c = 0\) and they are
\[x = {-b \pm \sqrt{b^2-4ac} \over 2a}\]
There are several ways to alter a table in the sqlite database of your Django project, here I'm introducing a most straighforward way. It may seem dirty, but it works well, and does not need any third-party tool.
This article begins with a story like this: you remember your password is one of the phrases you usually use as passwords but you are not sure which one it is.
![]()
Red-Black Tree is tricky. If you feel so, this tutorial may help. While reading, please forget what you have learned temporarily, follow this tutorial, then go back to your Red-Black textbook. You'll find the RBtree is not that difficult to grasp.
There is an exercise (ex.2.3.1-21) in TAOCP vol.1:
21. [33] Design an algorithm that traverses an unthreaded binary tree in inorder without using any auxiliary stack. It is permissible to alter the LLINK and RLINK fields of the tree nodes in any manner whatsoever during the traversal, subject only to the condition that the binary tree should have the conventional representation illustrated in (2) both before and after your algorithm has traversed the tree. No other bits in the tree nodes are available for temporary storage.![]()
(from TAOCP 2.3.1)
In the answer given by Prof. Knuth, an algorithm by Joseph M. Morris [Inf. Proc. Letters 9 (1979), 197-200] is introduced. The algorithm is very interesting. I'd like to show you how it works here.
Let's listen to the master.
How would you revert all edges in a graph like this:
![]()
(Each \(k\rightarrow X[k]\) is an edge.)
Well, there are many ways to do this. Boothroyd algorithm is an interesting one of them. Prof. Knuth said it is "deucedly clever". Let's study it and see how clever it is.
Everybody knows Fibonacci numbers. It can be defined as:
\[\begin{align} F_{n}=\begin{cases} 0 & n=0\\ 1 & n=1\\ F_{n-1}+F_{n-2} & n>1 \end{cases} \end{align}\]But do you know what the closed form of \(F_n\) is? Do you know how to find it out?
Generating function is the tool to solve questions like this. In this tutorial I'll show you how generating function can be applied to get the closed-form solution.
\[\binom{n}{k} = \frac{n(n-1)\ldots(n-k+1)}{k(k-1)\ldots(1)}\]\[\]Binomial coefficients have a lot of interesting properties. Here I'll show you, with the help of a Pascal's triangle, what is hidden behind the formulas.
My books:
- Yu, Y. 自己动手写操作系统(Operating System From Scratch). PHEI 2005
- Yu, Y. Orange'S: 一个操作系统的实现(Orange'S: The Implementation Of An Operating System). PHEI 2009