Posts

be careful when you are on #paludis

In my opinion, a good community should treat new comers well.
But some people think otherwise.
http://www.gentoo.org/news/en/gwn/20061002-newsletter.xml#doc_chap3

(zhllg) i think many people like the idea installation could resume automatically when failure occur, is it possible with paludis?
(mlangc) zhllg: http://www.paludis.org/faq.html#skipfirst
 mlangc maskd masterdriverz maxauthority midnite__ mzli
 mlangc maskd masterdriverz maxauthority midnite__ mzli
(zhllg) mlangc, i've seen that actually, just wonder why, is it difficult to implement technically?
(mlangc) i don't think so; as far as i know it is not implemented by __design__ - but you should better ask someone that actually works on paludis; i'm a simple user myself
(rbrown`) zhllg: er no. Too unreliable, too flaky and far too widely abused;
(zlin) zhllg: wouldn't it be much better to fix the packages that cause it to fail in the first place...
(zhllg) zlin, yeah, from a developer's perspective
* dleverton is …

Interest and Open source

One of the great things about open source software is, of course, the fact that anyone can participate, so the pool of resources is limited not by an annual hiring budget, but by interest in the project. That means you can have any number of developers, but it also means that one person may be involved in several areas if he or she finds them interesting.

http://www-128.ibm.com/developerworks/opensource/library/os-ag-renegade11/?ca=dgr-lnxw04geronimo

续:有关gorg和gentoo网站镜像的问题

知道原因了
handbook-x86.xml本身没有问题
不过有一个它指向的文件,里面缺了个</p>
而且使用了非utf-8编码
...
怪我之前没说

检查语法错误,可以用
xmllint -valid -noout filename.xml

有关gorg和gentoo网站镜像的问题

什么是gorg?
http://gentoo.neysx.org/mystuff/gorg/gorg.xml

首先是,我终于可以运行独立的gorg服务器了。
neysx给了我一个提示:
TW, you do not need to use the stand-alone web server, but if you want to, it
seems something changed in webrick (ruby's www server) and the default bound
address (0.0.0.0) does not work anymore. Edit www.rb and add the :BindAddress
param:

s = WEBrick::HTTPServer.new( :BindAddress => "127.0.0.1",
:AccessLog=>access_log, :Logger => $Log, :Port => $Config["port"], :CGIPathEnv
=> ENV["GORG_CONF"])

其次,我发现
http://localhost/doc/en/handbook/2006.1/handbook-x86.xml?part=1&chap=5
这样的连接打不开,也就是后面带&chap=5的
后来发现和libxml2和libxslt的版本有关,分别降到2.6.26和1.1.17,就行了
但问题根源应该在于一些xsl不够规范

现在,还剩一个问题
http://localhost/doc/zh_cn/handbook/2006.1/handbook-x86.xml
这个文件打不开
但是除了x86以外的其他handbook,都没有问题
把它放到上级目录也没有问题
错误的提示是sections tag不全,但这个文件里又没有sections这个tag

=media-sound/audacious-1.3.0_alpha1

If your mp3's id3 tag conforms to id3v2.4, which means probably you have disabled chardet, then pay attention to your fallback encoding setting, leave it alone, don't set it. trust me!

the default brower of xchat 2.8

The logic to find default brower is changed from xchat 2.6.8 to 2.8.
The 2.8 xchat will call xdg-open to open brower, in KDE, xdg-open will call konqueror unless you have set KDE's default brower to others.
I like firefox, and older version of xchat used to call firefox for me.
So I set KDE's default brower in kcontrol: KDE components-> Component chooser -> Web brower.

不明白audacious那帮人脑子里在想什么?

alpha(audacious-1.3.0-alpha1)的东西就放到~x86里
upstream maintainer和ebuild maintainer为同一个人看来是有些问题……

而且本来好好的东西偏偏要胡乱改
这个audacious/strings.c文件里,本来str_to_utf8()函数里的顺序是对的
也就是先判断是否已经为utf8,如果是,则马上返回。
结果现在先做的不是这个判断,结果,已经是utf8的还要再转码,就成了乱码……

regexec(3)'s usage:Match Results with Subexpressions

http://www.gnu.org/software/libc/manual/html_node/Regexp-Subexpressions.html#Regexp-Subexpressions
An example program:
#include <stdio.h>
#include <sys/types.h>
#include <regex.h>

/* 取子串的函数 */
static char* substr(const char*str,
                unsigned start, unsigned end)
{
        unsigned n = end - start;
        static char stbuf[256];
        strncpy(stbuf, str + start, n);
        stbuf[n] = 0;
        return stbuf;
}
/* 主程序 */
int main(int argc, char** argv)
{
        int x, z, lno = 0, cflags = REG_EXTENDED;
        char ebuf[128], lbuf[256];
        regex_t reg;
        regmatch_t pm[10];
        const size_t nmatch = 10;
        /* 编译正则表达式*/
        z = regcomp(&reg, "(reg|regular)[ ]?(ex|expression)", cflags);
        /* 逐行处理输入的数据 */
        while(fgets(lbuf, sizeof(lbuf), stdin))
        {
                ++lno;
                if ((z = strlen(lbuf)) > 0 && lbuf[z-1]
                                == '\n')
              …

sed处理多行技巧的应用

sed -i -e  '
#找到有下面这段字的行
/在这段时间内被修正或解决的bug/ {
#读入下面一行
N
#如果下面一行以</ul>开头
/\n<\/ul>/ {
#就替换一下
s/在这段时间内被修正或解决的bug/bug在这段时间被标记为重复/
}
}' *

Starcraft, Cedega and TLS

I have tried to play starcraft in Linux using Wine. But the speed was unacceptable.
I've heard from others that wine works for them. However, it doesn't work here.
So I tried cedega days ago. The result is quite satisfactory! I don't need to return to Windows to play starcraft any more.

Yesterday I looked into the details of accessing thread local storage.
I wrote a small kernel module to get the base address of insmod process's tls segment, and then print the value of AT_SYSINFO
#include <linux/init.h>
#include <linux/module.h>
#include <asm/desc.h>

static int __init mod_init(void)
{
        int i=0, a=0, b=0, h, l;
        int *ptr=(int *)get_cpu_gdt_table(0);

        for(; i<28; i++){
                l = *ptr++;
                h = *ptr++;
                if (i==6){
                        b = h;
                        a = l;
                }
                printk("0x%08x", h);
                printk(" %08x", l);
                printk(&q…

screen, gdb, vdso and gentoo

Screen的中文乱码问题有了一点新进展。今天我了解到,如果使用中文,但使用gb字符集的时候,中文是正常的。UTF-8则是乱码。这对于解决这个问题应该有所帮助。

今天在Planet Larry上看到一篇blog,对我很有帮助。那里面提到一个gdb的初始加载文件,类似.bashrc。有很多有用的功能。比如在断点停住的时候,可以显示寄存器,堆栈等的内容和要执行的指令的上下文的反汇编。作者对这个文件加了点改进可以显示不同的颜色。
http://gnurbs.blogsome.com/2006/12/22/colorizing-mamons-gdbinit/
用了这个东西,基本可以抛弃emacs+gdb的组合了。毕竟emacs-23现在和gdb配合使用,我感觉还不是很稳定。

还看了这一篇文章, http://www.win.tue.nl/%7Eaeb/linux/lk/lk-4.html
不过里面最后一个例程应该是有点问题,改成这样就行了:
#include <stdio.h>

int pid;

int main() {
        __asm__ __volatile__(
                "movl $20, %%eax        \n\t"
                "movl $0xffffe400, %%ebx \n\t"
                "call *%%ebx            \n\t"
                "movl %%eax, %0         \n\t"
                : "=r"(pid)
                :
                : "ax", "bx"
        );
        printf("pid is %d\n", pid);
        return 0;
}

最后,今天发展了一个gentoo用户。基本上我帮他装的。有两点感觉:
1. 复制livecd安装真的很方便,很快
2. 一般Linux用户,特别是英文不怎么好的用户,安装gentoo,还真是会遇到不少困难,

screen: RAW_PUTCHAR()

如果screen的caption里有日期,星期,比如:
caption always "%{= kw}%-w%{= BW}%n %t%{-}%+w %-= @%H - %LD %d %LM - %c"
而且使用的又是中文locale
那么日期星期会乱码
大概看了一下源代码,发觉应该和display.c里的RAW_PUTCHAR()有关

龙芯电脑的预定确认信

尊敬的客户您好:首先向您表示诚挚的祝贺和由衷的谢意!我谨代表江苏中科龙梦科技有限公司,对您的积极参与表示感谢,同时很荣幸地通知您,您被我公司选择作为首批次龙芯福珑迷你电脑用户。您拥有选择和拒绝购买的权利。为了表达对一直以来支持和鼓励我公司不断取得进步的朋友们的谢意,同时也为了龙芯事业的稳步发展,我公司在相对公平公正的基础上,对首批次福珑迷你电脑使用者进行了简单有效的选择,您是其中一位。希望龙芯福珑迷你电脑能在您手中物尽其用,如果您有任何问题,可以随时与我们取得联系,我们将尽可能帮助您解决。另外,请购买者务必确定您的地址、联系方式是正确有效的,如因此出现的任何问题,我公司将不负责任。另外请注意,目前我公司尚未开通资金帐号,请不要急于打款,具体的返款措施,我们将于后期公布。在此回执的客户我们将正式登记记录,正式生效.江苏中科龙梦科技有限公司市场部http://www.lemote.com2006.12.08