Guangchuang Yu

a senior-in-age-but-not-senior-in-knowledge bioinformatician

Screen使得远程终端更加有效率

Aug 8, 2008 - 1 minute read - Comments SoftwareLinux

根据主页Screen的描述 “Screen is a full-screen window manager that multiplexes a physical terminal between several processes, typically interactive shells. Each virtual terminal provides the functions of the DEC VT100 terminal and, in addition, several control functions from the ANSI X3.64 (ISO 6429) and ISO 2022 standards (e.g., insert/delete line and support for multiple character sets). There is a scrollback history buffer for each virtual terminal and a copy-and-paste mechanism that allows the user to move text regions between windows.

Newton-Raphson Method估算函数的根

Jun 2, 2007 - 1 minute read - Comments MathProgrammingC

Newton-Raphson Method

曲线f(x)有根c,取曲线上一点$(x_1,f(x_1))$, 过此点的切线交x轴$x_2$,过曲线上$(x_2,f(x_2))$的切线交x轴$x_3$,如此反复得到一个序列 $x_1,x_2,\cdot \cdot \cdot,x_n$ 逼近c值.

$(x_n,f(x_n))$的切线方程为 $y-f(x_n) = f'(x_n)\,(x-x_n)$,假设此方程与x轴的交点为$x_{n+1}$, 即有: $0 - f(x_n) = f'(x_n)(x_n+1 - x_n)$, 即$x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}$ <Eq. 1>.

下面利用此法来求一个数的开方。 $f(x) = x^2 - a$ 有根$\sqrt{a}$, 由$f'(x_n) = 2x_n$, 代入式<Eq. 1>可得$x_{n+1} = (x_n + a/x_n)/2$; 当i -> INF 时, $x_i$ -> $\sqrt{a}$;

C implementation

我制作的pkgsrc

May 16, 2007 - 1 minute read - Comments BSD

xlyrics: unix下的歌词秀软件   

点此下载

EVA: KDE下的QQ客户端     

点此下载

#cd /usr/pkgsrc/wip-cn 
#tar xjvf eva.tar.bz2 
#cd eva 
#make install clean

就可以啦。在我的机子(NetBSD 3.0.1 macppc)上测试通过。。 更新到eva-20070327

Edit partition table in NetBSD/macppc

May 14, 2007 - 4 minute read - Comments BSDPowerbook

#disklabel wd0

可以看到原始分区如下: 7 partitions:

#        size    offset     fstype [fsize bsize cpg/sgs]
a:  20971520  25167648     4.2BSD      0     0     0  # (Cyl.  24967*-  45772*)
b:   1048576  46139168       swap                     # (Cyl.  45772*-  46813*)
c: 117210240         0     unused      0     0        # (Cyl.      0 - 116279)
d:  25165824      1824        HFS                     # (Cyl.      1*-  24967*)
e:  28079456  89130784        HFS                     # (Cyl.  88423*- 116279)
g:  41943040  47187744     4.2BSD      0     0     0  # (Cyl.  46813*-  88423*)

a为netbsd的/分区,b为swap分区,c为整个硬盘,d为mac os的系统盘。e为两系统共享分区(在os9下格式化为fat),g为netbsd下的/home分区。 原本是两系统,os9.2一直都很少用,所以想删了,腾出空间来放数据。因为wd0d和wd0e不在连续的柱面上,所以无法将它们合并。

新的分区方案如下:wd0d删了,分成两个,一个15M(需要一个HFS类型的分区来放置ofwboot.xcf,因为openfirmwire不支持从netbsd分区里加载loader),剩下的作为/home分区。把原来的/home分区(wd0g)和共享数据的分区(wd0e)合并为一个分区,用于放置数据。 1. 第一步,也是最关键的一步,先备份好数据。