Fight for freedom,援引徐继哲先生致招商银行的一封公开信

February 18th, 2007 | Posted in 自言自语   Add Comment

刚刚看了亚瑟王,俺土,不喜欢看电影,所以被里面为自由而战感染的一塌糊涂,而同样是为自由而战,我们有权选择。

致招商银行的一封公开信(http://wiki.billxu.com/moin/CampaignPublicLetter),相信很多人都在用着国内银行提供的网上银行,我也是,然而国内众多网站的做法,不仅仅是银行业,让我敬而远之。

火车站订票,需要IE;网上银行,需要MS+IE;查询基金净值,得用IE;以前学校选课,需要IE;工作了,连公司委托第三方做的满意度调查,也只得用IE……

一个省略号,说不尽我们的苦衷,但我们能够选择。国内的公司们,当你们的客户正在动摇正在流失而你们不以为然,当你们痛抓80%而放弃20%的时候,我想说,闭关自守、固步自封最适合描述你们的未来,因为那你们放弃的20%将影响整个互联网的未来。

一句简简单单的 For freedom,哪里能涵盖我们选择的理由,我们需要的是更强大,更适合自己,更高效,更安全便捷的生活,我们拥有的是选择。

而有一天,我们成为主体的时候,国内IT业会因我们而改变。

开始学写shell

January 27th, 2007 | Posted in GNU/Linux   Add Comment

磕磕碰碰的写完了一个预处理的脚本,很简单,用来对代码里面的#ifdef DEBUG … #else … #endif来做处理 如果脚本没带参数 就认为启用DEBUG 带参数就认为不启用DEBUG 弱的很 暴汗……

其实以前也写过shell脚本,简单的比如切换有线和无线,复杂的比如解决rar x的中文问题(不过新版本的rar貌似没这个问题了),但还是好多东东要学@.@ 还得在实践中一点一点的被lisp给侵蚀着 呵呵
Read the rest of this entry »

ubuntu下用vpnc连入cisco vpn

January 6th, 2007 | Posted in ubuntu   3 Comments

之前转载过一个cisco的vpnclient的帖子,是要自己编译安装的,所以一直没空尝试

昨天还是前天来着突然想到ubuntu源里面应该已经有现成的vpnclient了吧,找了找果然有个vpnc。
于是刚刚看着vpnc的long-help试了试就搞定了

首先需要的是windows下有个配好的cisco vpn client,或者你有group的密码
windows下vpn client下profiles里面是相应的配置文件
/etc/vpnc.conf文件里面照着现有相应的pcf文件写就行了

IPSec gateway [ Host in .pcf ]
IPSec ID [ GroupName in .pcf ]
IPSec obfuscated secret [ enc_GroupPwd in .pcf ]
Xauth username [ your user name ]

如果直接有group密码 那么把IPSec obfuscated secret换成IPSec secret然后写上你的密码 或者直接sudo vpnc-connect然后输入ip,group name,group pwd,user name,user pwd连接也就ok了

DualHead ubuntu下实现I810显卡的笔记本双显

December 30th, 2006 | Posted in ubuntu   Add Comment

忍不住想双显,数次的失败之后终于搞定了

xorg.conf里面这样写 Read the rest of this entry »

Ubuntu下的DNS caching

December 13th, 2006 | Posted in ubuntu   3 Comments

我实在受不了了……

每个请求都要到dns server上解析一下,太影响效率了……

今天找了一下 原来非常简单 就是装一个dnsmasq 原文在这儿
然后把/etc/dnsmasq.conf里面把"listen-address=127.0.0.1"写上

再去/etc/dhcp3/dhclient.conf里头把“prepend domain-name-servers 127.0.0.1;”前面的注释去掉

再到/etc/resolv.conf里头在紧接着search后面加一行"nameserver 127.0.0.1

最后sudo /etc/init.d/dnsmasq restart一下 就ok了 Read the rest of this entry »

vpn under linux

December 8th, 2006 | Posted in GNU/Linux   1 Comment

不知道关不管用 先记下来再说

http://kor.cpmc.columbia.edu/vpn/linux-how-to.html

Read the rest of this entry »

xgl

October 9th, 2006 | Posted in GNU/Linux   3 Comments

我承认我土了,到现在才开始用xgl,说实话,真的很酷,不信,点下面连接或者点开comment看看那个flash……

http://www.youtube.com/watch?v=hhNWYtuW0fA

我是在用的xfce+compiz 回头补个安装手记上来顺便抓几张图:)

用CPP做apache的module

July 15th, 2006 | Posted in Apache   1 Comment

有三个地方要改

  1. 首先注释掉include/ap_config_auto.h里面的
    #define AP_HAVE_DESIGNATED_INITIALIZER 1
  2. 然后在ap_config.h里面增加这几行
    #if (defined(__GNUC__) && !defined(__cplusplus))                   \
    || (defined(__STDC_VERSION) && __STDC_VERSION__ > 199901L)
    #define AP_HAVE_DESIGNATED_INITIALIZER 1
    #endif
  3. 再到http_config.h里面修改
    typedef const char *(*cmd_func) ();

    #if (defined(__GNUC__) && !defined(__cplusplus))                \
    || (defined(__STDC_VERSION) && __STDC_VERSION__ > 199901L)
    typedef const char *(*cmd_func) ();
    #else
    typedef const char *(*cmd_func) (cmd_parms*, void*, const char*);
    #endif

apache module中取post数据

April 30th, 2006 | Posted in Apache   Add Comment

一共使用三个函数

  1. ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK)
    Apache里面说Setup the client to allow Apache to read the request body. 差不多意思就是初始化,第二个参数可以取以下三个值。

    1. REQUEST_NO_BODY
      意为如果request必须没有body,如果有就发一个413错误
    2. REQUEST_CHUNKED_ERROR
      意为request必须不可为chunked,如果有就发一个411错误
    3. REQUEST_CHUNKED_DECHUNK
      意思为如果chunked了,则dechunk。

    对于我们要读取post的数据,只能取后面两个,而chunked则是对长连接的选项了,使用哪个视情况而定。

  2. ap_should_client_block(r)
    检查是否有数据,对于chunked的话会发送一个100 continue的命令让客户端继续发送数据。
  3. ap_get_client_block(r, pBuff, size)
    读取数据

apache及其module的调试

April 30th, 2006 | Posted in Apache   Add Comment
  1. gdb httpd
    用gdb加载httpd进程
  2. (gdb) b break-point
    设置断点,可以设置函数名、行数等……
  3. (gdb) run -X -d /usr/local/apache
    执行httpd,这个是关键的,-X参数会让httpd以debug模式运行,debug模式是单进程的,这样才好调试。-d /usr/local/apache是设置运行的目录。

另外,gdb httpd pid可以attach一个正在运行的httpd来调试。

Thread-safety and POSIX.1

April 13th, 2006 | Posted in GNU/Linux   Add Comment

Thread-safe Versions of POSIX.1 and C-language Functions. From http://www.unix.org/whitepapers/reentrant.html

XML1.0 中文文档(第二版)

April 10th, 2006 | Posted in GNU/Linux   Add Comment

可扩展标记语言(XML)1.0(第二版) To be upgraded to third edition.

About module struct in Apache

April 4th, 2006 | Posted in Apache   Add Comment

在写apache模块的时候,会用到module这个结构体。module这个结构体实际上是module_struct,后面附上了定义。使用的时候通常都是定义一个这个结构体的变量并赋初值,如:

module AP_MODULE_DECLARE_DATA proxy_module =
{
STANDARD20_MODULE_STUFF,
create_proxy_dir_config,    /* create per-directory config structure */
merge_proxy_dir_config,     /* merge per-directory config structures */
create_proxy_config,        /* create per-server config structure */
merge_proxy_config,         /* merge per-server config structures */
proxy_cmds,                 /* command table */
register_hooks
};

其中STANDARD20_MODULE_STUFF这个宏为module_struct中的API version, minor version, module index, name, danamic load handle, next, magic, rewrite_args赋了初值。随后是per-directory configuration structure的初始化、合并函数和per-server configuration structure的初始化、合并函数。command table是command_rec结构的一个数组,依然是宏展开,描述这个模块在配置文件里面的信息。最后的register_hooks指向用于注册hook的函数。

typedef struct module_struct module;
/**
* Module structures.  Just about everything is dispatched through
* these, directly or indirectly (through the command and handler
* tables).
*/
struct module_struct {
/** API version, *not* module version; check that module is
* compatible with this version of the server.
*/
int version;
/** API minor version. Provides API feature milestones. Not checked
*  during module init */
int minor_version;
/** Index to this modules structures in config vectors.  */
int module_index;
/** The name of the module's C file */
const char *name;
/** The handle for the DSO.  Internal use only */
void *dynamic_load_handle;
/** A pointer to the next module in the list
*  @defvar module_struct *next */
struct module_struct *next;
/** Magic Cookie to identify a module structure;  It's mainly
*  important for the DSO facility (see also mod_so).  */
unsigned long magic;
/** Function to allow MPMs to re-write command line arguments.  This
*  hook is only available to MPMs.
*  @param The process that the server is running in.
*/
void (*rewrite_args) (process_rec *process);
/** Function to allow all modules to create per directory configuration
*  structures.
*  @param p The pool to use for all allocations.
*  @param dir The directory currently being processed.
*  @return The per-directory structure created
*/
void *(*create_dir_config) (apr_pool_t *p, char *dir);
/** Function to allow all modules to merge the per directory configuration
*  structures for two directories.
*  @param p The pool to use for all allocations.
*  @param base_conf The directory structure created for the parent directory.
*  @param new_conf The directory structure currently being processed.
*  @return The new per-directory structure created
*/
void *(*merge_dir_config) (apr_pool_t *p, void *base_conf, void *new_conf);
/** Function to allow all modules to create per server configuration
*  structures.
*  @param p The pool to use for all allocations.
*  @param s The server currently being processed.
*  @return The per-server structure created
*/
void *(*create_server_config) (apr_pool_t *p, server_rec *s);
/** Function to allow all modules to merge the per server configuration
*  structures for two servers.
*  @param p The pool to use for all allocations.
*  @param base_conf The directory structure created for the parent directory.
*  @param new_conf The directory structure currently being processed.
*  @return The new per-directory structure created
*/
void *(*merge_server_config) (apr_pool_t *p, void *base_conf,                                   void *new_conf);
/** A command_rec table that describes all of the directives this module
* defines. */
const command_rec *cmds;
/** A hook to allow modules to hook other points in the request processing.
*  In this function, modules should call the ap_hook_*() functions to
*  register an interest in a specific step in processing the current
*  request.
*  @param p the pool to use for all allocations
*/
void (*register_hooks) (apr_pool_t *p);
};

Apache中的挂钩剖析

April 4th, 2006 | Posted in Apache   Add Comment

From http://fanqiang.chinaunix.net/app/web/2006-02-21/4009.shtml,作者:张中庆。

Documents on LaTeX.

February 15th, 2006 | Posted in LaTeX   Add Comment

lshort-en: ftp://ftp.ctex.org/mirrors/CTAN/info/lshort/english/

The Not So Short Introduction to LaTeX2e

lshort-cn: ftp://ftp.ctex.org/pub/tex/CTDP/lshort-cn/
一份不太简短的LaTeX2ε介绍

LaTeX123: http://edt1023.sayya.org/tex/latex123/latex123.pdf
大家来学LaTeX

mycjk: http://edt1023.sayya.org/tex/mycjk/mycjk.pdf
我的CJK

clsguide: http://www.newsmth.net/bbscon.php?board=TeX&id=29583&ap=442
LATEX2ε for class and package writers

我一路看过来的关于LaTeX的电子书,lshort-cn是后补的,昨天在newsmth上置低才看到的……

SQLite

February 7th, 2006 | Posted in GNU/Linux   Add Comment

SQLite is a small C library that implements a self-contained, embeddable, zero-configuration SQL database engine. Here are some features of SQLite from sqlite.org.

SQLite is a small C library that implements a self-contained, embeddable, zero-configuration SQL database engine. Features include:
Transactions are atomic, consistent, isolated, and durable (ACID) even after system crashes and power failures.
Zero-configuration - no setup or administration needed.
Implements most of SQL92. (Features not supported)
A complete database is stored in a single disk file.
Database files can be freely shared between machines with different byte orders.
Supports databases up to 2 terabytes (241 bytes) in size.
Sizes of strings and BLOBs limited only by available memory.
Small code footprint: less than 250KiB fully configured or less than 150KiB with optional features omitted.
Faster than popular client/server database engines for most common operations.
Simple, easy to use API.
TCL bindings included. Bindings for many other languages available separately.
Well-commented source code with over 95% test coverage.
Self-contained: no external dependencies.
Sources are in the public domain. Use for any purpose.

正则迷雾,各种工具之正则表达式语法比较

February 7th, 2006 | Posted in GNU/Linux   Add Comment

在网上看到的,虽然是04年的貌似,也么的elisp里面的,不过grep、sed、awk是很有用的说。原文为:
在各种常用的工具中,
正则表达式如此的相似却又不同。
下表列出了一些常用的正则表达式,以及其不同之处。
项目总多,遗漏必有不少,请各位看官不吝指出。
以perl的正则为基准,不同的用法以粉红色标出。
(xhchen8018@yahoo.com.cn)

http://blog.csdn.net/xeroo/archive/2006/02/07/593755.aspx

如何让LaTeX找到中文字体

January 16th, 2006 | Posted in LaTeX   Add Comment

ubuntu下面teTeX和cjk-latex装完后LaTeX默认是没法编译中文,因为缺少字体,这里是我把字体搞定的方法,共享之 & Thanks to mylxiaoyi and wangyin.

Read the rest of this entry »

[设计模式]关于Singleton的回收

January 14th, 2006 | Posted in 读书笔记   Add Comment

Singleton在不考虑destroy、register、threading safe等的时候很简单,但考虑的时候就复杂了,记录一下今天看的资料以及自己的认识。

An introduction to LaTeX2e

January 13th, 2006 | Posted in LaTeX   Add Comment

Here’s an introduction to LaTeX2e, The Not So Short Introduction to LaTeX2e(lshort). I got this document on http://learn.tsinghua.edu.cn:8080/2001315450/tex_frame.html and the following text are from the introduction.

TEX is a computer program created by Donald E. Knuth. It is aimed at typesetting text and mathematical formulae.

TEX is pronounced “Tech,” with a “ch” as in the German word “Ach” or in the Scottish “Loch.” In an ASCII environment, TEX becomes TeX.

LATEX is a macro package that enables authors to typeset and print their work at the highest typographical quality, using a predefined, professional layout. LATEX was originally written by Leslie Lamport. It uses the TEX formatter as its typesetting engine. These days LATEX is maintained by Frank Mittelbach.

LATEX is pronounced “Lay-tech” or “Lah-tech.” If you refer to LATEX in an ASCII environment, you type LaTeX. LATEX 2ε is pronounced “Lay-tech two e” and typed LaTeX2e.