2007年10月30日星期二

Regular Express - Clipmarks

Clipmarks user rleon has sent you a clip...

 clipped from www.python.org
"."
(Dot.) In the default mode, this matches any character except a newline. If the DOTALL flag has been specified, this matches any character including a newline.

"^"
(Caret.) Matches the start of the string, and in MULTILINE mode also matches immediately after each newline.

"$"
Matches the end of the string or just before the newline at the end of the string, and in MULTILINE mode also matches before a newline. foo matches both 'foo' and 'foobar', while the regular expression foo$ matches only 'foo'. More interestingly, searching for foo.$ in 'foo1\nfoo2\n' matches 'foo2' normally, but 'foo1' in MULTILINE mode.

"*"
Causes the resulting RE to match 0 or more repetitions of the preceding RE, as many repetitions as are possible. ab* will match 'a', 'ab', or 'a' followed by any number of 'b's.

"+"
Causes the resulting RE to match 1 or more repetitions of the preceding RE. ab+ will match 'a' followed by any non-zero number of 'b's; it will not match just 'a'.

"?"
Causes the resulting RE to match 0 or 1 repetitions of the preceding RE. ab? will match either 'a' or 'ab'.

*?, +?, ??
The "*", "+", and "?" qualifiers are all greedy; they match as much text as possible. Sometimes this behaviour isn't desired; if the RE <.*> is matched against '<H1>title</H1>', it will match the entire string, and not just '<H1>'. Adding "?" after the qualifier makes it perform the match in non-greedy or minimal fashion; as few characters as possible will be matched. Using .*? in the previous expression will match only '<H1>'.

{m}
Specifies that exactly m copies of the previous RE should be matched; fewer matches cause the entire RE not to match. For example, a{6} will match exactly six "a" characters, but not five.

{m,n}
Causes the resulting RE to match from m to n repetitions of the preceding RE, attempting to match as many repetitions as possible. For example, a{3,5} will match from 3 to 5 "a" characters. Omitting m specifies a lower bound of zero, and omitting n specifies an infinite upper bound. As an example, a{4,}b will match aaaab or a thousand "a" characters followed by a b, but not aaab. The comma may not be omitted or the modifier would be confused with the previously described form.

{m,n}?
Causes the resulting RE to match from m to n repetitions of the preceding RE, attempting to match as few repetitions as possible. This is the non-greedy version of the previous qualifier. For example, on the 6-character string 'aaaaaa', a{3,5} will match 5 "a" characters, while a{3,5}? will only match 3 characters.

"\"
Either escapes special characters (permitting you to match characters like "*", "?", and so forth), or signals a special sequence; special sequences are discussed below.

If you're not using a raw string to express the pattern, remember that Python also uses the backslash as an escape sequence in string literals; if the escape sequence isn't recognized by Python's parser, the backslash and subsequent character are included in the resulting string. However, if Python would recognize the resulting sequence, the backslash should be repeated twice. This is complicated and hard to understand, so it's highly recommended that you use raw strings for all but the simplest expressions.

[]
Used to indicate a set of characters. Characters can be listed individually, or a range of characters can be indicated by giving two characters and separating them by a "-". Special characters are not active inside sets. For example, [akm$] will match any of the characters "a", "k", "m", or "$"; [a-z] will match any lowercase letter, and [a-zA-Z0-9] matches any letter or digit. Character classes such as \w or \S (defined below) are also acceptable inside a range. If you want to include a "]" or a "-" inside a set, precede it with a backslash, or place it as the first character. The pattern []] will match ']', for example.

You can match the characters not within a range by complementing the set. This is indicated by including a "^" as the first character of the set; "^" elsewhere will simply match the "^" character. For example, [^5] will match any character except "5", and [^^] will match any character except "^".

"|"
A|B, where A and B can be arbitrary REs, creates a regular expression that will match either A or B. An arbitrary number of REs can be separated by the "|" in this way. This can be used inside groups (see below) as well. As the target string is scanned, REs separated by "|" are tried from left to right. When one pattern completely matches, that branch is accepted. This means that once A matches, B will not be tested further, even if it would produce a longer overall match. In other words, the "|" operator is never greedy. To match a literal "|", use \|, or enclose it inside a character class, as in [|].

(...)
Matches whatever regular expression is inside the parentheses, and indicates the start and end of a group; the contents of a group can be retrieved after a match has been performed, and can be matched later in the string with the \number special sequence, described below. To match the literals "(" or ")", use \( or \), or enclose them inside a character class: [(] [)].

(?...)
This is an extension notation (a "?" following a "(" is not meaningful otherwise). The first character after the "?" determines what the meaning and further syntax of the construct is. Extensions usually do not create a new group; (?P<name>...) is the only exception to this rule. Following are the currently supported extensions.

(?iLmsux)
(One or more letters from the set "i", "L", "m", "s", "u", "x".) The group matches the empty string; the letters set the corresponding flags (re.I, re.L, re.M, re.S, re.U, re.X) for the entire regular expression. This is useful if you wish to include the flags as part of the regular expression, instead of passing a flag argument to the compile() function.

Note that the (?x) flag changes how the expression is parsed. It should be used first in the expression string, or after one or more whitespace characters. If there are non-whitespace characters before the flag, the results are undefined.

(?:...)
A non-grouping version of regular parentheses. Matches whatever regular expression is inside the parentheses, but the substring matched by the group cannot be retrieved after performing a match or referenced later in the pattern.

(?P<name>...)
Similar to regular parentheses, but the substring matched by the group is accessible via the symbolic group name name. Group names must be valid Python identifiers, and each group name must be defined only once within a regular expression. A symbolic group is also a numbered group, just as if the group were not named. So the group named 'id' in the example above can also be referenced as the numbered group 1.

For example, if the pattern is (?P<id>[a-zA-Z_]\w*), the group can be referenced by its name in arguments to methods of match objects, such as m.group('id') or m.end('id'), and also by name in pattern text (for example, (?P=id)) and replacement text (such as \g<id>).

(?P=name)
Matches whatever text was matched by the earlier group named name.

(?#...)
A comment; the contents of the parentheses are simply ignored.

(?=...)
Matches if ... matches next, but doesn't consume any of the string. This is called a lookahead assertion. For example, Isaac (?=Asimov) will match 'Isaac ' only if it's followed by 'Asimov'.

(?!...)
Matches if ... doesn't match next. This is a negative lookahead assertion. For example, Isaac (?!Asimov) will match 'Isaac ' only if it's not followed by 'Asimov'.

(?<=...)
Matches if the current position in the string is preceded by a match for ... that ends at the current position. This is called a positive lookbehind assertion. (?<=abc)def will find a match in "abcdef", since the lookbehind will back up 3 characters and check if the contained pattern matches. The contained pattern must only match strings of some fixed length, meaning that abc or a|b are allowed, but a* and a{3,4} are not. Note that patterns which start with positive lookbehind assertions will never match at the beginning of the string being searched; you will most likely want to use the search() function rather than the match() function:

>>> import re >>> m = re.search('(?<=abc)def', 'abcdef') >>> m.group(0) 'def' 

This example looks for a word following a hyphen:

>>> m = re.search('(?<=-)\w+', 'spam-egg') >>> m.group(0) 'egg' 

(?<!...)
Matches if the current position in the string is not preceded by a match for .... This is called a negative lookbehind assertion. Similar to positive lookbehind assertions, the contained pattern must only match strings of some fixed length. Patterns which start with negative lookbehind assertions may match at the beginning of the string being searched.

(?(id/name)yes-pattern|no-pattern)
Will try to match with yes-pattern if the group with given id or name exists, and with no-pattern if it doesn't. |no-pattern is optional and can be omitted. For example, (<)?(\w+@\w+(?:\.\w+)+)(?(1)>) is a poor email matching pattern, which will match with '<user@host.com>' as well as 'user@host.com', but not with '<user@host.com'. New in version 2.4.

Get Clipmarks - The easiest way to email text, images and videos you find on the web. It's free!
Sent with Clipmarks

2007年10月29日星期一

Emacs中加入自己编码识别

强大的编辑器要有强大的编码识别能力 -- unicad.el

如果你经常要查看或编辑多种国家语言的文件,那你可能经常碰到乱码的情况。

unicad.el 是从 Mozilla universal charset auto detector 改写过来的 Elisp 程序,在 GNU Emacs 里加载上 unicad 就可以自动识别多种编码,以后再也不会遇到乱码的文件了。把下载到的 unicad.el 复制到 Emacs 的 load-path 里,比如 site-lisp ,在 ~/.emacs 里加上下面这句:

(require 'unicad)

如果你觉得检测过程拖慢了打开文件的速度,可以 byte-compile 这个文件:

M-x byte-compile-file <RET> /path/to/unicad.el

超载地址 http://cid-3643184002e3d5e6.skydrive.live.com/self.aspx/Public/unicad.zip

--
一步一步教你从互联网赚钱 http://www.zqzn.com/index.asp?rid=key480769
投资理财 http://li-cai.blogspot.com/

Emacs code-publish

;;; code-publish.el --- convert codes into html, used for msn space
;; Because of the limited allowed file types,
;; if the extension of this file is not .el, please change it manually.

;; Author: Qichen Huang <jasonal00+emacs at gmail.com>
;; Version: 0.2

;;; Commentary:
;; (require 'code-publish)

;; Usage:
;; M-x code-publish
;; the converted html code will be copied to kill-ring,
;; which could be directly pasted onto msn space as html code.

;; History:
;; 14.08.2006 Version 0.2
;; 14.08.2006  Added: tag <div>
;; 28.07.2006 Version 0.1

;;; Code:

(defun code-publish ()
  "Convert region between mark and point into HTML, save the result into kill ring."
  (interactive)
  (kill-new (code-publish-region (mark) (point)))
  (message "Code convert completed."))



(defvar font-header "<font size=\"2\">")
(defvar div-header "<div style=\"background-color:rgb(255,255,224);\">")
(defvar footer "</div></font>")
(defvar tag-open "<span style=\"font-family: Courier New,Courier,Monospace;")
(defvar tag-close ">")
(defvar tag-end "</span>")
(defvar newline-tag "<br>")
(defvar space "&nbsp;")
(defvar space2 "&nbsp;&nbsp;")
(defvar space4 "&nbsp;&nbsp;&nbsp;&nbsp;")

(defvar code-builtin-color       " color: rgb(0,139,0);\"")
(defvar code-comment-color       " color: rgb(205,0,0); font-style: italic;\"")
(defvar code-constant-color      " color: rgb(47,79,79);\"")
(defvar code-doc-color           " color: rgb(0,139,0);\"")
(defvar code-function-name-color " color: rgb(0,0,255); font-weight: bold;\"")
(defvar code-keyword-color       " color: rgb(160,32,240);\"")
(defvar code-preprocessor-color  " color: rgb(250,128,114);\"")
(defvar code-string-color        " color: rgb(0,139,0);\"")
(defvar code-type-color          " color: rgb(0,0,128);\"")
(defvar code-variable-name-color " color: rgb(139,90,40);\"")
(defvar code-warning-color       " color: rgb(255,0,0);\"")
(defvar code-default-color       " \"")

(defun code-publish-region (begin-point end-point)
  (let ((beg (min begin-point end-point))
        (end (max begin-point end-point))
        (str "")
        (tmp nil)
        (result nil)
        (tface nil)
        (color "")
        )
    ;;(beginning-of-buffer)
    (unless (= beg end)
      (save-excursion
        (setq result (concat result font-header))
        (setq result (concat result div-header))
        (goto-char beg)
        (while (< (point) end)
          (setq tmp (next-single-property-change (point) 'face))
          (unless tmp
            (setq tmp end)) ;; there is no face change, set tmp to end point
          ;; no cross-line properties
          (when (> tmp (line-end-position))
            (setq tmp (line-end-position))) ;; New line
          ;; skip spaces and tabs
          (save-excursion
            (goto-char tmp)
            (when (looking-at "[ \t]+")
              (re-search-forward "[ \t]+" (line-end-position) t)
              (setq tmp (point))))
          (when (> tmp end)
            (setq tmp end))
          (setq str (buffer-substring-no-properties (point) tmp))
          (while (string-match "<" str)
            (setq str (replace-match "&lt;" t nil str)))
          (while (string-match ">" str)
            (setq str (replace-match "&gt;" t nil str)))
          (while (string-match "  " str)
            (setq str (replace-match space2 t nil str)))
          (while (string-match "\t" str)
            (setq str (replace-match space4 t nil str)))
          (setq tface (get-text-property (point) 'face))
          (when (listp tface)
            (setq tface (car tface)))
          (cond
           ((eq tface font-lock-builtin-face)
            (setq color code-builtin-color))
           ((eq tface font-lock-comment-face)
            (setq color code-comment-color))
           ((eq tface font-lock-constant-face)
            (setq color code-constant-color))
           ((eq tface font-lock-doc-face)
            (setq color code-doc-color))
           ((eq tface font-lock-function-name-face)
            (setq color code-function-name-color))
           ((eq tface font-lock-keyword-face)
            (setq color code-keyword-color))
           ((eq tface font-lock-preprocessor-face)
            (setq color code-preprocessor-color))
           ((eq tface font-lock-string-face)
            (setq color code-string-color))
           ((eq tface font-lock-type-face)
            (setq color code-type-color))
           ((eq tface font-lock-variable-name-face)
            (setq color code-variable-name-color))
           ((eq tface font-lock-warning-face)
            (setq color code-warning-color))
           (t (setq color code-default-color)))
          ;; (setq color "<span color=\"\">")
          (setq result (concat result tag-open color tag-close str tag-end))
          (when (= tmp (line-end-position))
            (setq result (concat result newline-tag))
            (setq tmp (+ 1 (line-end-position))))
          (goto-char tmp))
        (setq result (concat result footer))
        result
        ))))

(provide 'code-publish)

;;; ################ code-publish ends here #######################

Emacs中建立文件自动关联mode

一次性关联
(
setq auto-mode-alist
;; 将文件模式和文件后缀关联起来。
( append '(("\\.py\\'" . python-mode)
("\\.s?html?\\'" . html-helper-mode)
(" \\.asp\\'" . html-helper-mode)
("\\.phtml\\'" . html-helper-mode)
("\\.css\\'" . css-mode) )
auto-mode-alist)
)
单个文件关联
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))


--
一步一步教你从互联网赚钱 http://www.zqzn.com/index.asp?rid=key480769
投资理财 http://li-cai.blogspot.com/

【转帖】如何不重新启动 Emacs 就让 .emacs 的配置起作用

我刚刚使用 Emacs 的时候,总是

vi ~/.emacs

然后重新启动 emacs ,效率很低 ,暗自嘟囔, emacs 怎么没有这种功能,不重起,就自动更新 .emacs 的设置 呢?

后来我发现,这个功能完全没有必要,我的做法是:

  • 用 emacs 打开 .emacs 文件,C-x C-e 光标前面的运行一条语句。立即生效。
  • 选择一个 region , M-x eval-region
  • M-x load-file ~/.emacs
  • M-x eval-buffer

都是立即生效,可以马上试验一条语句的效果。 例如,在任何一个文件中,写

(setq frame-title-format "emacs@%b")

把光标停在在这条语句后面, C-x C-e ,马上看到 emacs 的 标题栏上发生变化。

我用这种方法调试我的每一个小的配置文件,按上篇文章说的方法, 把他放在 ~/Emacs/myconfig/my-site-start.d 中。



--
一步一步教你从互联网赚钱 http://www.zqzn.com/index.asp?rid=key480769
投资理财 http://li-cai.blogspot.com/

Emacs 在窗口的标题栏上显示文件名称

在窗口的标题栏上显示文件名称
(setq frame-title-format "%n%F/%b")
% 后面跟一个特殊字符表示特殊的意义。

--
一步一步教你从互联网赚钱 http://www.zqzn.com/index.asp?rid=key480769
投资理财 http://li-cai.blogspot.com/

2007年10月24日星期三

编程内核


 make-kpkg --revision tchai.0818 \
          --append-to-version .kov \
          --config menuconfig \
            kernel_image modules_image


make-kpkg --rootcmd fakeroot \
          --revision tchai.0818 \
          --append-to-version .kov \
          --config menuconfig \
            kernel_image modules_imageo


有时还是直接编译成binary-arch好,还可以生成kernel-headers,方便其它模块的编译, 比如alsa
nvidia等。。。

对于2.4的,偶经常是
$make-kpkg --rootcmd fakeroot binary-arch
对于2.6的,
$make-kpkg --rootcmd fakeroot --initrd binary-arch

需要的时候直接dpkg -i安装上。

make-kpkg --revision $1 --append-to-version $2 kernel_image modules_image



--
一步一步教你从互联网赚钱 http://www.zqzn.com/index.asp?rid=key480769
投资理财 http://li-cai.blogspot.com/

直接从XP/W2K下通过硬盘启动来进行Ubuntu网络安装

直接从XP/W2K下通过硬盘启动来进行网络安装

只需要下载6M的文件,就可以从XP/W2K下通过硬盘启动来进行网络安装。
一:安装GRUN
  1. 下载GRUB   GRUB
  2. grldr 复制到 C:\,编辑C:\BOOT.INI,加入一行:
    C:\GRLDR="GRUB"
    注意:在下载的过程中,IE有时会自动加上.Dat的扩展名,如果如此,将文件名 grldr.dat 改为 grldr .

二:下载并设置安装包

1.   下载 netboot.tar.gz

2.   解压缩,提取 ubuntu-install/i386/ 目录下的 linuxinitrd.gz 到 C:\

三:重新启动计算机,按 c 进入 grub 命令行 根据下载的文件存放的位置,输入并回车:
    grub>kernel (hd0,0)/linux root=/dev/ram ramdisk_size=20000 devfs=mount,dall

    grub>initrd (hd0,0)/initrd.gz

    grub>boot

    这样,就可以开始安装了。

    注意:如果使用代理服务器或自己内部的源,有可能出现长时间的停顿,一共会出现两次。第一次手工设置完毕镜像后,如果出现停顿,使用 Alt+F2 切换到其它的控制台,使用 ps -LA 查看全部进程,将两个 wget 的进程 kill 掉,就可以再使用 alt+F1 切换回去,进行下一步的代理服务器设置,第二次也是在设置镜像之后。同样切换到控制台使用 ps -LA 查看全部进程,将一个最后名为 http 的进程 kill 掉,就可以同样再使用 alt+F1 切换回去开始安装系统了。

--
一步一步教你从互联网赚钱 http://www.zqzn.com/index.asp?rid=key480769
投资理财 http://li-cai.blogspot.com/

做张grub启动盘

http://dev.csdn.net/article/70/70523.shtm

有时候我们的电脑可能出现系统无法引导的情况,比如说你重装了windows,把MBR给重写了,又比如像我今天这样,把装了grub的系统给格了,电脑启动后无法读到引导信息出错,什么系统都进不了了。
这时你当然可以用安装时或什么管你什么时候做的启动盘启动LINUX(然后再进行修复),用windows启动盘启动windows。
但这样你得至少做两张启动盘啊(呵呵,当然用loadlin之类的也行,不过我觉得更麻烦)。而且你每装一个LINUX就得做一张启动盘,不是很麻烦吗?
其实没有那么麻烦,只要你用grub做的引导,就很容易了,那么就是做一张grub启动盘.
这样你就相当于把grub装到了软盘上,利用一些grub命令就可以做到你的MBR没有被破坏前能做的所有事。而且,你在A机器上做的启动盘还可以拿到B、C、D……等等其它机器上用。
制作方法:

首先你用的引导程序必须是grub。
确认了这一点之后进入/boot/grub目录:
cd /boot/grub
然后把stage1和stage2两个文件写到你的软盘上去(呵呵,当然别忘了把软盘放进去哦):
dd if=stage1 of=/dev/fd0 bs=512 count=1
dd if=stage2 of=/dev/fd0 bs=512 seek=1

这样一张grub引导盘就做好了,下面就谈谈使用方法(虽然很简单,但还是怕有人不清楚)

首先用这张启动盘启动后会出现一些关于grub的信息,然后就是如下:
grub>
这就是在等你输入grub命令来启动系统。
对于LINUX,一般需要如下三个命令:
root,kernel,boot.
ROOT命令就是让你告诉GRUB,你的LINUX系统装在哪个分区,KERNEL命令就是让你指出用哪个内核启动,BOOT当然就是开始引导啦。
举个例子:
grub>root (hd0,
File system Type is ext2fs.(这一行告诉你文件系统是什么,详细的显示内容可能跟我写的不一样)
grub>kernel /boot/vmlinuz ro root=/dev/hda9
grub>boot

这样你的LINUX系统就启动了,注意的一点是GRUB中关于分区的叫法跟LINUX有点不一样,比如上面的(hd0,就表示hda9.是的,hdX就代 表第X+1个硬盘,hd0就代表第1个硬盘(相当于hda),8就代表第9个分区(GRUB中的表示方法跟C语言有点像,下标是从0开始的),(hd0, 当然就是代表hda9啦。
知道这些应该知道怎么引导LINUX系统了吧?注意一点,如果你不清楚具体的内核文件名(比如有的可能是vmlinuz-2.4.20什么的),那么你可 以用TAB键自动补全,相当方便,你只要打入kernel /boot/vm然后再按一下TAB键,那么就会显示全部在/boot/下以vm开头的文件。

引导其它系统就方便多了(比如windows,FreeBSD等),你要做的也是三个命令,ROOT跟BOOT命令跟LINUX一样,反正就是用ROOT 命令指定你装的这个系统所在的分区,BOOT命令就是开始引导系统。不同的是把引导linux的kernel命令改成chainloader +1命令。例如:

grub>root (hd0,0)
File System Type Vfat
grub>chainloader +1
grub>boot


呵呵,好了,把你做好的grub启动盘好好保存起来吧,以后装LINUX的时候它如果问你要不要做启动盘时你都可以大胆地说:NO!。因为你的这张grub启动盘基本上可以应付大部分无法启动的情况了。
呵呵,不过这种启动盘无法应付严重的系统错误(比如内核文件受到破坏什么的等等),但是这样的情况我还没有遇见过,我需要启动盘的情况往往是因为引导程序出了问题,比如重装WINDOWS,比如GRUB被我搞掉了等等。'



--
一步一步教你从互联网赚钱 http://www.zqzn.com/index.asp?rid=key480769
投资理财 http://li-cai.blogspot.com/

2007年10月22日星期一

用Emacs+Muse来记笔记--Muse的配置

用Emacs+Muse来记笔记--Muse的配置

论坛里很少有关于EmacsWiki或者EmacsMuse的帖子
我写了一份配置说明,供大家参考
好像论坛里不能直接看我做的网页
大家可以把附件下载下来然后用浏览器看
的确很漂亮哦:)


Contents

前记
感谢
安装

Debian/Ubuntu系统上的安装

配置使用

基本配置
Projects的管理

"并排"方式
"目录树"方式

自定义派生的style

"并排"方式的派生style设置
"目录树"方式派生style设置

Google的搜索栏
导航菜单

自定义的函数

ywb-muse-relative-path
ywb-muse-html-markup-table
ywb-muse-publish-math-tab
ywb-muse-publish-src-tag
ywb-muse-handle-file-link
使contents更漂亮
给每个标题加个top锚
ywb-muse-publish-project
ywb-muse-output-file
ywb-muse-publish-this-file
ywb-muse-generate-index
ywb-muse-preview-with-w3m
ywb-muse-preview-html
ywb-muse-preview-source

3.02.90 版中的一些问题

解决方法

环境变量设置
Planner抄来的配置
快捷键设置
相关链接

Muse相关
EmacsWiki相关

top前记
最早看到用Emacs写WiKi的人应该是王垠吧,后来感觉最流行和最好看的WiKi就应该是薛瑞尼的了。但是现在Emacs Wiki的作者Michael Olson已经不维护Emacs Wiki这个项目了,而是维护一个类似的但功能更强大的项目Muse。而Muse有一些功能还不是很完善,于是我在Google和 Emacs@newsmth之间游走,到处找人帮忙,终于弄出了一个感觉还不错的配置文件,虽然有一些地方还不完善,但是还是先写出来,来以飨大家,其实更重要的是抛砖引玉,使Muse的配置更完善。如果大家对配置或者其中有一些函数进行改进,请尽量保留原作者的信息。
top感谢
叶文彬—几乎所有自定义的函数和大多数配置都是他写的,我都有些不好意思而求他了:)所以下面配置文件里所有带ywb字样的函数请保留,以表示对他的感谢。

薛瑞尼—我的css文件基本上是改他的,的确很漂亮。他也提供了他的配置文件供我参考。

其他人—我参考的其他人用Muse写的网页或者用Emacs-WiKi写的网页。
top安装
可以到Michael Olson的主页上去下载最新版

http://www.mwolson.org/projects/EmacsMuse.html

你也可以到下面的地址去下载最新release的tar.gz格式或者zip格式的包。

http://www.mwolson.org/static/dist/muse/

topDebian/Ubuntu系统上的安装
如果你用Debian的话,在etch(testing)和sid(unstable)里 已经有3.02.6-2这个版本了,所以只要

apt-get install muse-el

就可以了。如果想要装最新的版本,请在你的/etc/apt/sources.list加入下面的源然后更新安装即可。

deb http://www.mwolson.org/debian/ ./

你也可以到下面的地址去下载最新release的deb包然后直接dpkg -i muse-el_***.deb安装即可。

http://mwolson.org/debian/

现在我装的版本是3.02.92.arch.193-1,刚刚看到Olson已经把Muse开发到3.03了,但是not yet released,呵呵,好像增加了好多新特性,如果你要看看有什么新东西的话看这里 NEWS-3.03,或者看我下载的这个NEWS-3.03

如果用是用Ubuntu,我没有测试过,不知道源里有没有,但是上面添加 Michael Olson所提供的源然后安装的方法一定是可以的。
top配置使用
配置使用可以去Emacs Wiki: Muse Mode看看。

http://www.emacswiki.org/cgi-bin/wiki/MuseMode

也可以参考别人的,我这里尽量把我所知道的都写出来。我的配置文件在这里:

muse-init.el
top基本配置

Muse之所以功能强大,最重要的是能输出很多种格式的文件,但是如果只写网页的话只要几样就行了。所以下面配置里前面注掉的都是你可以选择的,如果你要输出其它格式的文件的话,请参考Muse自的带的文档说明。

;;; muse-init.el --- Initialize muse-mode.
;;;; Add below to ~/.emacs config file
;(load-file "~/.emacs.d/conf/muse-init.el")
;(add-to-list 'load-path "/usr/share/emacs/site-lisp/muse-el/experimental")
;;;; xhtml footer and header (如果你沿用emacs-wiki那样定义多个项目而不用muse子目录发布功能,注掉它,这个在后面会说明)
(load-file "~/.emacs.d/conf/muse-footer-header.el")
(require 'muse) ; load generic module
(require 'muse-mode nil t) ; load authoring mode
(require 'muse-wiki nil t) ; load Wiki support
(require 'muse-html nil t) ; load (X)HTML publishing style
(require 'muse-colors nil t) ; load coloring/font-lock module
(require 'outline nil t)
(require 'sgml-mode)
(require 'tp-muse-highlight nil t)
;;;;(下面的可选,我没有用到)
;(require 'muse-blosxom) ; load blosxom module
;(require 'muse-docbook) ; load DocBook publishing style
;(require 'muse-latex) ; load LaTeX/PDF publishing styles
;(require 'muse-texinfo) ; load Info publishing style
;(require 'muse-xml) ; load XML support
;(require 'muse-journal) ; load journal module
;(require 'muse-message) ; load message support (experimental)
;(require 'muse-srctag) ; load srctag support

tp-muse-highlight.el
topProjects的管理
Muse在projects的定义和管理方面做得比Emacs Wiki好,可以省去很多麻烦。projects之间的引用也很方便。而且有一项新功能是从blosxom那里学来的,就是可以把一个源文件的目录树相应地发布成html文件,而发布的目录树的结构跟源文件目录树的结构相同。但是这样也存在一些问题,比如说css文件、图片或者其它的一些东西的相对路径不能自动处理。但是叶文彬写了一些函数可以来解决这个问题。所以projects的管理我分种方法来说明,一种是像Emacs Wiki那样的组织多个"并排"的projects,另一种是"目录树"结构。下面分别介绍:
top"并排"方式
这种方式最简单,其实也最实用,唯一不爽的就是你得把所有的projects的源文件和发布文件都并排地放到一起,没有层次感。不过也并不是每个人都像我一样喜欢用树状结构来分类吧:)

(setq muse-project-alist
`(
("Debian" ;项目名称
("~/muse/source/wiki/debian" ;源文件的位置
:default "index" ;默认的project的主页
:force-publish ("WikiIndex"));发布项目时同时发布project的索引文件
(:base "wiki-xhtml" :path "~/muse/publish/wiki/debian")) ;发布路径
("Emacs"
("~/muse/source/wiki/emacs"
:default "index"
:force-publish ("WikiIndex"))
(:base "wiki-xhtml" :path "~/muse/publish/wiki/emacs"))
("GNU"
("~/muse/source/wiki/gnu"
:default "index"
:force-publish ("WikiIndex"))
(:base "wiki-xhtml" :path "~/muse/publish/wiki/gnu"))
))

top"目录树"方式
如果你像我一样平时收集了一堆从网上弄来的Linux相关的Tips啦,文章啦,而看着这一堆的东西太乱了,于是分门别类地建了一堆目录来分类,而目录下可能还有子目录。那在组织 projects时也想这么干吧。Muse中有一个设置muse-project-alist-dirs可以来干这个,并且把这个你定义的project下的所有目录树结构记住,在发布成html文件时相应地按源文件的目录树结构来发布到指定的目录下。

(setq muse-project-alist
`( ;!注意这一行最左边的是一个"`",ESC键下面那个!
("Muse"
("~/muse/source/wiki/gnu/emacs/muse"
:default "MuseIndex"
:force-publish ("index"))
(:base "wiki-xhtml" :path "~/muse/publish/wiki/gnu/emacs/muse"))
("Debian"
("~/muse/source/wiki/gnu/debian"
:default "index"
:force-publish ("WikiIndex"))
(:base "wiki-xhtml" :path "~/muse/publish/wiki/gnu/debian"))
("Emacs"
("~/muse/source/wiki/gnu/emacs"
:default "index"
:force-publish ("WikiIndex"))
(:base "wiki-xhtml" :path "~/muse/publish/wiki/gnu/emacs"))
("GNU"
("~/muse/source/wiki/gnu"
:default "index"
:force-publish ("WikiIndex"))
(:base "wiki-xhtml" :path "~/muse/publish/wiki/gnu"))

("WiKi" (,@(muse-project-alist-dirs "~/muse/source/wiki");源文件路径
:default "index" ;默认项目主页
:force-publish ("WikiIndex")
)
,@(muse-project-alist-styles "~/muse/source/wiki" ;还是源文件路径
"~/muse/publish/wiki" ;发布路径
"wiki-xhtml"))
("Others"
("~/muse/source/others"
:default "index"
:force-publish ("WikiIndex"))
(:base "xhtml" :path "~/muse/publish/others"))

("Default" (,@(muse-project-alist-dirs "~/muse/source/default")
:default "index"
:force-publish ("WikiIndex"))
,@(muse-project-alist-styles "~/muse/source/default"
"~/muse/publish"
"default-xhtml"))

))

肯定有人会问,既然都用子目录结构了,为什么还定义那些子projects呢?因为目录树的这个功能很有限,他只会把相应文件发布并按目录树结构安装,而如果你还是想把Emacs、 Debian、GNU这些做为projects,方便项目之间的引用的话,还得在写上这些项目的定义。而且写法也得按一定的"规矩"来,这个"规矩"是:

* 1.源文件目录中最上层目录放到项目定义的最下面

配置中的WiKi就得安排在Muse、Debian、Emacs、GNU的下面,因为这些"子"项目所在的目录都在 WiKi的目录中,是它的子目录。

* 2.项目在配置文件里的设置是根据目录的层数的深度来确定位置,原则是层数深的不能在层数浅的上面

配置中Muse的目录比Debian和Emacs的深,所以在它们俩的上面,而相同深度的就随便谁在上谁在下都行。

* 3.如果两个项目没有目录树间的关系,可以随便写。

比如说Others就可以写在下面。

这个是我实验过很多次得出的最好的方法。因为在header和footer里有一些处理项目名称的函数,这样写不会出乱子。
top自定义派生的style
Muse之所以能生成多种格式的文件的原因之一我想可能就是这个功能了,在输出html格式方面,你可以自定义你的html文件的header和footer,这样使用起来很方便。其他输出文件格式请参考Muse文档。但是因为有了上面的Projects的管理的两种配置方法,这里也要相应地跟着变化。
top"并排"方式的派生style设置
这个也最简单,定义一个派生的style,把你想要的header.html和footer.html的路径写上可以了。而这两个文件是按照html的语法来写的,在发布时直接把其中的内容拷到发布的 html文件里。

(unless (assoc "my-blosxom" muse-publishing-styles)
(muse-derive-style "wiki-xhtml" "xhtml" ;定义一个派生的style为wiki-xhtml
:header "~/muse/common/templates/header.html"
:footer "~/muse/common/templates/footer.html"
)
(muse-derive-style "default-xhtml" "xhtml" ;定义另一个派生的style
:header "~/muse/common/templates/default- header.html"
:footer "~/muse/common/templates/default-footer.html"
))

如果要对其中一些可变的内容用lisp函数来处理理,可以在其中嵌入lisp函数,比如说我在 footer.html里要设定网页发布的时间,就可以加上这么变态的几句来处理:

最后更新:
<lisp>
(format-time-string "%4Y-%2m-%2d-%T"
(nth 5 (file-attributes
muse-publishing-current-file)))
</lisp>

然后效果就是:

最后更新: 2006-08-25-23:23:19

我的header.html和footer.html你可以参考一下。文件的内容可以看这里:

header.html

footer.html

下载在这里:

common/templates/header.html

common/templates/footer.html
top"目录树"方式派生style设置
因为要处理html文件里css和图片的相对路径的问题,所以按上面"并排"的方式设置派生 style是有些问题的。我实验过,css文件的路径处理可以在header.html里用 ywb-muse-relative-path函数来处理(这个函数在下面会介绍,不要急:),像这样:

<link rel="stylesheet" type="text/css" charset="utf-8" media="all"
href="<lisp>(ywb-muse-relative-path "common/stylesheets/core.css")</lisp>" />

但是对于图片链接就不行了比如说这个:

<a href="http://www.mwolson.org/projects/EmacsMuse.html">
<img style="border: 0em none ;"
src=" <lisp> (ywb-muse-relative-path "common/images/muse- powered-by.png")</lisp> " alt="Emacs Muse Logo"></a>

可能是因为elisp的或者是html对"""的处理问题吧。那现在怎么办呢?其实很简单,可以入到muse-init.el中,如果要写到emacs的配置文件里去在每一个"""前加一个"\"来转义就可以了。也可以单独写一份文件叫muse-header-footer.el ,在加载muse-init.el时同时加载它就行了。

;;; muse-init.el --- Initialize muse-mode.
;;;; Add below to ~/.emacs config file
;(load-file "~/.emacs.d/conf/muse-init.el")
;;;; xhtml footer and header (如果你沿用emacs-wiki那样定义多个项目而不用muse子目录发布功能,注掉它,这个在后面会说明)
(load-file "~/.emacs.d/conf/muse-footer-header.el")

文件的内容可以看这里:

muse-header-footer_el.html

下载在这里:

muse-header-footer.el
topGoogle的搜索栏
我是参考邢兆鹏的,只在要header里的<h1>title</h1>加上下面这段就行了。那个Google图片也是从他网站上拷下来的,希望他不介意:)

<h1>
<lisp>(muse-publishing-directive \"title\")</lisp>
<!-- Google Search -->
<div class=\"searchbar\">
<form id=\"searchbar\" method=\"get\" action=\" http://www.google.com/custom\" title=\"My Site Search\">
<div id=\"searchbar\">
<label for=\"q\" title=\"Search this site\">
<img src=\"<lisp> (ywb-muse-relative-path \"common/images/google.gif\")</lisp>\" ></label>
<input type=hidden name=domains value=\" http://www.yoursite.org/\">
<input type=hidden name=sitesearch value=\"http://www.yoursite.org/\">
<input type=\"text\" id=\"q\" name=\"q\" accesskey=\"s\" size=\"16\">
<input type=\"submit\" id=\"submit\" value=\"Go\">
</div>
</form>
</div>
<!-- Google Search -->
</h1>

如果要你用"并排"方式来设置projects,那么请把上面所有的"\"去掉,然后加到 header.html里。当然我已经给弄好了一份,可以看上面的两小节。
top导航菜单
跟Google搜索栏相似,在header.html里的最后加入下面的内容就行了。其实会lisp语言的话还可做的更灵活:)

<!-- menu start here -->
<div class=\"menu\">
<div class=\"menuitem\">
<a href=\" <lisp> (ywb-muse-relative-path \"index.html\")</lisp>\">Home</a>
</div>
<div class=\"menuitem\">
<a href=\" <lisp> (ywb-muse-relative-path \"wiki/index.html\")</lisp>\">WiKiNotes</a>
</div>
</div>
<!-- menu ends here -->

top自定义的函数
这些函数可以在叶文彬的Muse配置文件里找到:

http://learn.tsinghua.edu.cn:8080/20...csMusecof.html

他写的关于Muse的说明:

http://learn.tsinghua.edu.cn:8080/20...EmacsMuse.html
topywb-muse-relative-path
如果你想用Projects的管理方式中的"目录树"方式,这个函数可以说是写的极好,肯定必用!

(defun ywb-muse-relative-path (file)
(concat
(file-relative-name
my-muse-publish-directory
(file-name-directory muse-publishing-current-output-path))
file))

这个函数用于子目录发布,在发布的过程中推断出相对路径。有了这个函数,对于 css 或者图片名, 在muse-init.el或者muse-header-footer.el这样写就行了:

<lisp>(ywb-muse-relative-path \"css/core.css\")</lisp>

css/core.css 是相对于 my-muse-publish-directory 的路径。而my-muse-publish-directory是个变量,定义如下:

(defvar my-muse-publish-directory "~/muse/publish/")

* 说明:

这个变量和函数的作用,这个变量是跟定义了你的所有要发布文件要发布到哪个目录中去,而在你的这个目录中(~/muse/publish/)如果有一个文件夹为css,里面有个core.css 的文件,那么把这个函数放到xhtml的头文件的定义中去来代替里面的css文件的路径位置, 然后在发布过程中这个函数会把core.css这个文件相对于(~/muse/publish/)这个目录的相对路径输出到html文件里,所以对于放着我的这个html网页和其它文件的这个文件夹来说,只要目录里的文件和文件夹的相对位置不变,那么无论把这个文件夹放到谁的机器上还是放到服务器上,你用浏览器打开这个网页都能正常显示,因为css文件的路径是相对的,而底下的那一排图标的路径也是相对的。我问过Olson这个问题,他要我用绝对路径,他的网站上所有的css文件和图片的路径都是绝对路径。可是我还没有服务器上传,我只想在本机上看,用绝对路径在本地看肯定不行了。所以我觉得这个函数很棒,真是非常感谢叶文彬:)
topywb-muse-html-markup-table

;;;;_+ ywb-muse-html-markup-table
(defun ywb-muse-html-markup-table ()
(let ((str (match-string 1)))
(when (= (aref str 0) ?|)
(save-excursion
(save-match-data
(let ((endmarker (set-marker (make-marker) (match-end 0)))
(start (match-beginning 0))
(nextline (lambda () (forward-line 1) (point))))
(goto-char (1+ start))
(when (looking-at "|\\([-]+[|+]\\)+[ \t]*$")
(delete-region (point) (funcall nextline))
(perform-replace "[ \t]+|[ \t]+" " || " nil t nil nil nil
(point) (funcall nextline))
(delete-region (funcall nextline) (funcall nextline)))
(goto-char endmarker)
(forward-line -1)
(when (looking-at "|\\([-]+[|+]\\)+[ \t]*$")
(delete-region (point) (funcall nextline)))
(perform-replace "^|[ \t]*" "" nil t nil nil nil start endmarker)
(perform-replace "|[ \t]*$" "" nil t nil nil nil start endmarker)))))
(muse-html-markup-table)))

topywb-muse-publish-math-tab
org-mode 可以发布一些具有上标和下标的html代码。可以借来用一下。

;;;;_+ ywb-muse-publish-math-tab
(defun ywb-muse-publish-math-tab (beg end attrs)
(require 'org)
(let ((tag (or (cdr (assoc "tag" attrs)) "span")))
(insert (concat "<" tag " class=\"math\">"
(org-export-html-convert-sub-super
(delete-and-extract-region beg end))
"</" tag ">\n"))
(muse-publish-mark-read-only beg (point))))

topywb-muse-publish-src-tag
语法加亮。本网页中的emacs-lisp语法加亮都是用这个函数来实现的。

;;;;_+ ywb-muse-publish-src-tag
(defun ywb-muse-publish-src-tag (beg end attrs)
(let ((mode (cdr (assoc "type" attrs))))
(tp-muse-fontified-example-tag beg end nil
(intern-soft (concat mode "-mode")))))

topywb-muse-handle-file-link
处理文件链接的函数。

;;;;_+ ywb-muse-handle-file-link
(defun ywb-muse-handle-file-link (&optional string)
(or string
(setq string
(let ((end (save-excursion
(re-search-forward "]" nil t)
(1- (point)))))
(when end
(buffer-substring-no-properties (point) end)))))
(setq string
(expand-file-name
(concat (muse-get-keyword :path (nth 2 (muse-project)))
"/" string)))
(when (file-exists-p string)
string))

下面的这几句我看不太懂,但意思差不多明白,应该是把上面那些自定义的有增强功能的函数加到 Muse自带的相应函数里去。反正照写就是啦:)

;;;;_+
(add-to-list 'muse-html-markup-functions '(table . ywb-muse-html-markup-table))
(add-to-list 'muse-html-markup-tags '("math" t t ywb-muse-publish-math-tag))
(add-to-list 'muse-html-markup-tags '("src" t t ywb-muse-publish-src-tag))
(add-to-list 'muse-explicit-link-functions 'ywb-muse-handle-file-link)

top使contents更漂亮
因为薛瑞尼的css文件对contents做了一些设置,并用了一个好看的小图片(就是最上面 Contents中那一排金色的小圆圈),看了他的配置文件才知道,其实他是加了一层 contents,并且改用了sacha写的一个函数,我开始改写了这个函数,但是虽然Contents好看了,然后所有的标题里的内容都跑到外面去了,叶文彬指出了错误所以在(处理时多输出了一个回车),于是重新改写于下:

;;;_+ insert contents. contents should strip all the tags
(defun ywb/muse-publish-strip-tags (string)
(while (string-match "<.*?>" string)
(setq string (replace-match "" nil t string)))
string)
(defadvice muse-publish-contents-tag (around ywb activate)
(let* ((beg (ad-get-arg 0))
(end (ad-get-arg 1))
(attrs (ad-get-arg 2))
(max-depth (let ((depth (cdr (assoc "depth" attrs))))
(or (and depth (string-to-int depth)) 3)))
(index 1)
base contents l)
(save-excursion
(catch 'done
(while (re-search-forward "^\\(\\*+\\)\\s-+\\(.+\\)" nil t)
(setq l (length (match-string 1)))
(if (null base)
(setq base l)
(if (< l base)
(throw 'done t)))
(when (<= l max-depth)
(setq contents (cons (cons l (match-string-no-properties 2))
contents))
(goto-char (match-beginning 2))
(muse-html-insert-anchor (concat "sec" (int-to-string index)))
(delete-backward-char 1)
(setq index (1+ index))))))
(setq index 1 contents (reverse contents))
(let ((depth 1) (sub-open 0) (p (point)))
(insert "<div class=\"mulu\">
<h6 class=\"mulu\">Contents</h6>\n")
(insert "<dl class=\"contents\">\n")
(while contents
(insert "<dt class=\"contents\">\n")
(insert "<a href=\"#sec" (int-to-string index) "\">"
(ywb/muse-publish-strip-tags (cdar contents))
"</a>\n")
(setq index (1+ index))
(insert "</dt>\n")
(setq depth (caar contents)
contents (cdr contents))
(if contents
(cond
((< (caar contents) depth)
(let ((idx (caar contents)))
(while (< idx depth)
(insert "</dl>\n</dd>\n")
(setq sub-open (1- sub-open)
idx (1+ idx)))))
((> (caar contents) depth) ; can't jump more than one ahead
(insert "<dd>\n<dl class=\"contents\">\n")
(setq sub-open (1+ sub-open))))))
(while (> sub-open 0)
(insert "</dl>\n</dd>\n")
(setq sub-open (1- sub-open)))
(insert "</dl>\n")
(insert "</div>\n")
(put-text-property p (point) 'read-only t))))

但是好像不用这个函数也可以,因为可以在css文件中设置contents相应的属性,比如说像 flyzhy的网页中的Contents就感觉还不错。我写信问过他,他说是在css文件中设置的。

http://www.flyzhy.org/projects/WebsiteSettings.html

http://www.mwolson.org/projects/EmacsMuse.html

在Muse的NEWS-3.03(我下载的文件NEWS-3.03)中提到了:

Make the Table of Contents CSS easier to customize.
For an example, see examples/mwolson/stylesheets/screen.css.

如果真能实现像薛瑞尼那样的效果,那可真不错,起码省了一个函数。如果你弄明白了,一定要告诉我啊:)
top给每个标题加个top锚
薛瑞尼的网页中每个标题右边都有一个top的锚,如果一个网页很长,当你想回到页首看 contents的时候,这个锚就很有用了。但是薛瑞尼给我的sacha的函数已经不能用了,于是叶文彬就重写了一个,功能完全一样。

;;;_+ insert toplink in html files
(defun ywb/muse-publish-markup-heading ()
(let* ((len (length (match-string 1)))
(start (muse-markup-text
(cond ((= len 1) 'section)
((= len 2) 'subsection)
((= len 3) 'subsubsection)
(t 'section-other))
len))
(end (muse-markup-text
(cond ((= len 1) 'section-end)
((= len 2) 'subsection-end)
((= len 3) 'subsubsection-end)
(t 'section-other-end))
len)))
(delete-region (match-beginning 0) (match-end 0))
(muse-insert-markup start)
(insert
(propertize
"<span class=\"toplink\"><a href=\"#top\">top</a></span>"
'rear-nonsticky '(read-only) 'read-only t))
(end-of-line)
(when end
(muse-insert-markup end))
(muse-publish-section-close len)))
(defalias 'muse-publish-markup-heading 'ywb/muse-publish-markup-heading)

topywb-muse-publish-project
这个函数我没有用,因为我的配置好像不用它就能正常工作,而且项目组织用"目录树"方式,只要在最上层目录上按Cc Cp就能发布所有没有发布的文件,如果Cu Cc Cp的话,就是全部更新了:)叶文彬在这个函数中把源文件放到发布文件目录中的wikisource下的,我是分开的。而且改了改他的函数也没改对:)如果你看懂了,想改一下就试试吧。

;;;_+ publish functions
(defun ywb-muse-publish-project (&optional arg)
(interactive "P")
(let ((dir default-directory)
(published (muse-project-publish (muse-project) arg))
(muse-explicit-link-functions (remove
'ywb-muse-handle-file-link
muse-explicit-link-functions))
cmd)
(when (= (aref published 0) ?A)
(setq default-directory dir)
(setq cmd (concat "psync .*\\.muse$ "
(expand-file-name
(concat (muse-get-keyword :path (car (cddr
(muse-project))))
"/wikisource/"))))
(message cmd)
(shell-command cmd))
(message published)))

topywb-muse-output-file
这个函数在下面几个函数中用到了

* ywb-muse-publish-this-file
* ywb-muse-preview-with-w3m
* ywb-muse-preview-html
* ywb-muse-preview-source

(defun ywb-muse-output-file ()
"Get output file name"
(let ((styles (muse-project-applicable-styles buffer-file-name (cddr (muse-project))))
output-dir)
(while (and styles
(progn
(setq output-dir (muse-style-element :path (car styles)))
(not (file-exists-p output-dir))))
(setq styles (cdr styles)))
(when output-dir
(muse-publish-output-file
buffer-file-name
output-dir
"html"))))

topywb-muse-publish-this-file
Muse自带的muse-publish-this-file有个Bug,看stid的说明:

muse 中有一个比较不爽的地方,就是单独发布一个文件时,不会发布到指定的项目发布目录中,而用 C-c C-p 发布整个项目就没问题,这是一个 bug。
muse 的BugTracker系统上已经有人提过了,相信不久的将来会有改进。

叶文彬自己定义的发布正在编辑的文件的一个函数,有两个。

其实这不是Bug,只是作者写这个函数的意思被大家误解了吧。我现在用的这个Muse 版本1加上我的配置能自动处理了,不是修复了这个"Bug",而是换了一种方案。如果你装了我装的这个新版本,再按C-c C-h看看:)

C-c C-t muse-project-publish-this-file
C-c C-S-t muse-publish-this-file

如果你用的时候觉得这个"Bug"在你装的Muse的版本上还存在的话,可以试试这两个函数。

(defun ywb-muse-publish-this-file (&optional arg)
"Publish current file to html"
(interactive)
(save-buffer)
(let ((path (muse-get-keyword :path (nth 2 (muse-project)))))
(muse-publish-this-file "xhtml" path current-prefix-arg)))

(defun ywb-muse-publish-this-file (&optional arg)
"Publish current file to html"
(interactive)
(save-buffer)
(let* ((path (file-name-directory (ywb-muse-output-file)))
(muse-explicit-link-functions (remove 'ywb-muse-handle-file-link muse-explicit-link-functions))
(source-path (concat path "/wikisource/")))
(unless (file-exists-p source-path)
(message "Creating wiki source directory %s" source-path)
(make-directory source-path t))
(copy-file buffer-file-name source-path t)
(muse-project-publish-file buffer-file-name (cddr muse-current-project) current-prefix-arg)))

topywb-muse-generate-index
原来生成 index 的方法是在 Wiki Index.muse 里写上:

<lisp>(muse-index-as-string t t)</lisp>

叶文彬写了一个函数,可以使生成的 index 是网页的 title,只要在 Wiki Index.muse 中加上这一句:

<lisp>(ywb-muse-generate-index)</lisp>

也可以传递参数生成多个 project 的目录。例如:

<lisp>(ywb-muse-generate-index '("Debian" "Emacs" "Muse" "GNU"))</lisp>

;;;###autoload
(defun ywb-muse-generate-index (&optional project-list)
"Generate the index of all wikifile except the file in the\"website\" project"
(unless project-list
(setq project-list (list (car (muse-project)))))
(let (project-files title)
(muse-with-temp-buffer
(dolist (project project-list)
(setq project-files (muse-project-file-alist project))
(progn
(insert "* " project "\n"))
(dolist (file project-files)
(unless (or (equal (car file) "index")
(equal (car file) "WikiIndex"))
(insert " - [[" project "#" (car file) "]["
(save-excursion
(set-buffer (generate-new-buffer "*index*"))
(insert-file-contents (cdr file))
(goto-char (point-min))
(setq title
(if (re-search-forward "^#title" nil t)
(buffer-substring (point) (line-end-position))
(car file)))
(kill-buffer (current-buffer))
title)
"]]\n")))
(insert "\n"))
(buffer-string))))

topywb-muse-preview-with-w3m

;;;;_+ preview commands
(defun ywb-muse-preview-with-w3m ()
"Preview the html file"
(interactive)
; (ywb-muse-publish-this-file)
(muse-project-publish-this-file)
(let ((file (ywb-muse-output-file)))
(w3m-goto-url (if (string-match "^[a-zA-Z]:" file)
(ywb-convert-to-cygwin-path file)
(concat "file://" file)))))

topywb-muse-preview-html

(defun ywb-muse-preview-html ()
"Preview the html file"
(interactive)
; (ywb-muse-publish-this-file)
(muse-project-publish-this-file)
(browse-url (ywb-muse-output-file)))

topywb-muse-preview-source

(defun ywb-muse-preview-source ()
"Find the html file"
(interactive)
; (ywb-muse-publish-this-file)
(muse-project-publish-this-file)
(find-file (ywb-muse-output-file)))

top3.02.90 版中的一些问题
叶文彬对3.02.90版Muse中的一些问题的处理。我现在的版本没有测试过,不知道有没有这些问题,供你参考。

* 1. 图片可以自己定义处理路径的函数,但是 muse-colors-insert-image 函数中将 link 转换成绝对路径了,所以其它定义的函数仍然无效。其它文件链接仍然没有一个选项能将路径修改为发布的目录。
* 2. latex2png 中使用 (cd "/tmp"),但是不同平台下的 tmp 目录不同。

top解决方法

* 1. 将 muse-colors-insert-image 中的第一行注释:

;; (setq link (expand-file-name link))

我觉得最好不要一直显示图像,可以用命令 muse-colors-toggle-inline-images 来切换图像的显示。如果想文件的链接是相对于发布目录的路径,可以增加下面的函数:

(defun ywb-muse-handle-file-link (&optional string) ;见上面

* 2. 修改 latex2png 函数:

(defun latex2png (math prefix preamble)
"Convert the MATH code into a png with PREFIX."
(unless preamble
(setq preamble ""))
(let* ((tmppath (cond ((boundp 'temporary-file-directory)
temporary-file-directory)
((fboundp 'temp-directory)
(temp-directory))))
(texfile (expand-file-name
(concat prefix "_" (format "%d" (abs (sxhash math))))
tmppath))
(oldcddir default-directory))
(with-temp-file (concat texfile ".tex")
(insert (concat "\\documentclass{article}
\\usepackage{fullpage}
\\usepackage{amssymb}
\\usepackage[usenames]{color}
\\usepackage{amsmath}
\\usepackage{latexsym}
\\usepackage[mathscr]{eucal}\n" preamble
"\n\\pagestyle{empty}
\\begin{document}"
"{"
math
"}\n"
"\n\\end{document}\n\n")))
(cd tmppath)
(call-process "latex" nil nil nil texfile)
(if (file-exists-p (concat texfile ".dvi"))
(progn
(shell-command-to-string
(concat "dvipng " texfile ".dvi -E "
" -fg " latex2png-fg
" -bg " latex2png-bg " -T tight"
" -x " (format "%s" (* latex2png-scale-factor 1000))
" -y " (format "%s" (* latex2png-scale-factor 1000))
" -o " texfile ".png"))
(if (file-exists-p (concat texfile ".png"))
(progn
(delete-file (concat texfile ".dvi"))
(delete-file (concat texfile ".tex"))
(delete-file (concat texfile ".aux"))
(delete-file (concat texfile ".log"))
(cd oldcddir)
(concat texfile ".png"))
(message "Failed to create png file")))
(message (concat "Failed to create dvi file " texfile)))))

* 3. redefine muse-colors-toggle-inline-images

;;;;_+ redefine of function
(defun muse-colors-insert-image (link beg end invis-props)
"Create an image using create-image or make-glyph and insert it
in place of an image link defined by BEG and END."
;; (setq link (expand-file-name link))
(let ((image-file (cond
((eq muse-colors-inline-image-method 'default-directory)
link)
((functionp muse-colors-inline-image-method)
(funcall muse-colors-inline-image-method link))))
glyph)
(when (stringp image-file)
(if (fboundp 'create-image)
;; use create-image and display property
(add-text-properties beg end
(list 'display (create-image image-file)))
;; use make-glyph and invisible property
(and (setq glyph (muse-make-file-glyph image-file))
(progn
(add-text-properties beg end invis-props)
(add-text-properties beg end (list
'end-glyph glyph
'help-echo link))))))))

top环境变量设置

;;;;_+ variable setting
(add-to-list 'magic-mode-alist
'("#title " . muse-mode))
(when (featurep 'tp-muse-highlight)
(tp-muse-html-syntax-highlight-tag "sqlexample" 'sql-mode)
(tp-muse-html-syntax-highlight-tag "perlexample" 'cperl-mode)
(tp-muse-html-syntax-highlight-tag "javaexample" 'java-mode))

(custom-set-variables
;;;; If you don't want to use any extension at all,
;;;; and want Muse to autodetect project files based on their location,
;;;; then add the following to your Muse settings file.
'(muse-file-extension nil)
'(muse-mode-auto-p t)
;;;; If you don't want to use .muse, you can customize
;;;; the extension by setting the value of muse-file-extension.
'(muse-file-extension "muse")
;;;; The content type used for the HTML <meta> tag.
;;;; If you are striving for XHTML 1.1 compliance,
;;;; you may want to change this to "application/xhtml+xml".
; (setq muse-html-meta-content-type "text/html; charset=utf-8")
;;;; The charset to append to the HTML <meta> tag.
;;;; If set to the symbol 'detect, use muse-html-encoding-map
;;;; to try and determine the HTML charset from emacs's coding.
;;;; If set to a string, this string will be used to force a
;;;; particular charset.
'(muse-html-meta-content-encoding (quote utf-8))
;;;; The default HTML meta charset to use if no translation
;;;; is found in muse-html-encoding-map.
'(muse-html-charset-default "utf-8")

;;;; The default Emacs buffer encoding to use in published files.
;;;; This will be used if no special characters are found.
'(muse-html-encoding-default (quote utf-8))

;;;; An alist mapping emacs coding systems to appropriate HTML
;;;; charsets. Use the base name of the coding system
;;;; (i.e. without the -unix).
'(muse-html-encoding-map "utf8")
'(muse-colors-autogen-headings (quote outline))
'(muse-colors-inline-image-method (quote muse-colors-use-publishing-directory))
'(muse-html-meta-content-encoding (quote utf-8))

'(muse-html-meta-content-type "text/xhtml; charset=utf-8")
'(muse-mode-hook (quote (flyspell-mode footnote-mode)))
'(muse-publish-comments-p t)
'(muse-publish-desc-transforms (quote (muse-wiki-publish-pretty-title muse-wiki-publish-pretty-interwiki)))
'(muse-html-markup-functions (quote ((anchor . muse-html-markup-anchor) (table . muse-html-markup-table) (footnote . muse-html-markup-footnote))))
'(muse-table-line-regexp "^|?[[:blank:]]*\\(?:[^|\n]+\\||\\)[[:blank:]-]+\\([|+]+\\)\\(?:[[:blank:]-]+\\|$\\)[^|\n].*")
'(muse-mode-highlight-p t)
'(muse-wiki-ignore-bare-project-names t)
'(muse-colors-evaluate-lisp-tags nil)
;'(muse-html-style-sheet "<link rel=\"stylesheet\" type=\"text/css\" charset=\"utf-8\" media=\"all\" href=\"../common/stylesheets/core.css\" />")
;'(muse-xhtml-style-sheet "<link rel=\"stylesheet\" type=\"text/css\" charset=\"utf-8\" media=\"all\" href=\"../common/stylesheets/core.css\" />")
'(muse-wiki-publish-small-title-words (quote ("the" "and" "at" "on" "of" "for" "in" "an" "a" "page" "anime"))))

topPlanner抄来的配置

;;;_. planner
(require 'planner nil t)
(require 'planner-id nil t)
(when (featurep 'planner)
(global-set-key (kbd "<f9> t") 'planner-create-task-from-buffer)
(global-set-key (kbd "<f9> c") 'planner-create-task)
(global-set-key (kbd "<f9> <f9>") 'plan)
(require 'remember-planner nil t)
(when (featurep 'remember-planner)
(setq remember-annotation-functions planner-annotation-functions)
(setq remember-handler-functions '(remember-planner-append))))

(autoload 'remember "remember" nil t)
(autoload 'remember-region "remember" nil t)
(global-set-key (kbd "<f9> r") 'remember)
(global-set-key (kbd "<f9> s") 'remember-region)
(global-set-key (kbd "<f9> d") 'planner-diary-add-entry)

(require 'planner-diary nil t)
(when (featurep 'planner-diary)
(defun planner-diary-add-entry (date time text)
"Prompt for a diary entry to add to `diary-file'. Will run
planner-annotations to make hyper links"
(interactive (list (planner-read-date)
(read-string "Time: ")
(read-string "Diary entry: ")))
(save-excursion
(save-window-excursion
(make-diary-entry
(concat
(let ((cal-date (planner-filename-to-calendar-date date)))
(if european-calendar-style
(format "%d/%d/%d"
(elt cal-date 1)
(elt cal-date 0)
(elt cal-date 2))
(format "%d/%d/%d"
(elt cal-date 0)
(elt cal-date 1)
(elt cal-date 2))))
" " time " " text " "
(run-hook-with-args-until-success
'planner-annotation-functions))))))
(setq planner-diary-use-diary t)
(planner-insinuate-diary)
(planner-insinuate-calendar)
(setq planner-diary-number-of-days 7)
(setq planner-diary-number-of-diary-entries 7)
(setq planner-diary-file diary-file))

top快捷键设置

(setq muse-mode-hook
(lambda ()
(footnote-mode)
(auto-fill-mode 1)
(modify-syntax-entry ?> ")" muse-mode-syntax-table)
(modify-syntax-entry ?< "(" muse-mode-syntax-table)
(define-key muse-mode-map (kbd "C-c /") 'sgml-close-tag)
(define-key muse-mode-map (kbd "C-c t") 'sgml-tag)
; (define-key muse-mode-map (kbd "C-c C-t") 'ywb-muse-publish-this-file)
; (define-key muse-mode-map (kbd "C-c C-p") 'ywb-muse-publish-project)
(define-key muse-mode-map (kbd "C-c C-c") 'ywb-muse-preview-source)
(define-key muse-mode-map (kbd "C-c C-j") 'ywb-muse-preview-html)
(define-key muse-mode-map (kbd "C-c C-m") 'ywb-muse-preview-with-w3m)
(define-key muse-mode-map (kbd "<C-return>") 'ywb-html-insert-newline)
(define-key muse-mode-map (kbd "M-RET") 'ywb-insert-item)
))
;;Local variables:
;;allout-layout: (0 : -1 -1 0)
;;End:

top相关链接
topMuse相关
Muse-el BugTracker

http://blog.gmane.org/gmane.emacs.muse.general

Michael Olson—http://www.mwolson.org/projects/EmacsMuse.html

stid—http://learn.tsinghua.edu.cn:8080/98...macs-muse.html

flyzhy—http://www.flyzhy.org/projects/WebsiteSettings.html

ShiXin—http://www.xshi.org/notes/WebPage.html

Gunnar Wrobel—http://gunnarwrobel.de/wiki/EmacsMuseMode.html

Sun Yongke—http://cisd-ftp.swfc.edu.cn/~syk/WebWiki/muse.html

pluskid—http://blog.donews.com/pluskid/archi...06/858197.aspx 他写的用 stardict的sdcv版在emacs里查单词的插件很不错。

http://people.ku.edu/~yjli/dk/EmacsMuse.html

http://ryang.68ab.com/notes_tips.html#top

邢兆鹏—http://www.mysmu.edu/me2005/zhaopeng...g/journal.html 我网页上那个 Google是抄他的,嘿嘿:)
topEmacs Wiki相关

王垠—http://learn.tsinghua.edu.cn:8080/20...wiki/WiKi.html

LiYu—http://59.77.16.178/html/liyu/webpage/EmacsWikiZh.html LiYu的主页好像域名解析不了直接用ip吧:)

http://sacha.free.net.ph/notebook/wiki/AboutMe.php

http://grid.tsinghua.edu.cn/home/liu...lcomePage.html

http://staff.ustc.edu.cn/~yoyosu/Def...lcomePage.html

http://k.thec.cn/Corsair/WelcomePage.html

http://ann77.stu.cdut.edu.cn/EmacsWikiNote.html

http://wwwhomes.uni-bielefeld.de/tli...acs_using.html

http://www.iamstone.net/publish/note/Emacs.html

http://people.ku.edu/~yjli/dk/Emacswiki.html

--
一步一步教你从互联网赚钱 http://www.zqzn.com/index.asp?rid=key480769
投资理财 http://li-cai.blogspot.com/

一个muse设置和例子

;;-*- elisp -*-
;;-*- encoding: UTF-8 -*-

(require 'muse-mode)
(require 'muse-wiki)
(require 'muse-html)
(require 'muse-latex)
(require 'muse-texinfo)
(require 'muse-docbook)

;; 我的 MUSE 工程设置。
(require 'muse-project)
(setq muse-project-alist
'(("ExaosWiki" ;; 我的个人 Wiki
("~/Documents/MyWiki" :default "index")
(:base "html" :path "~/Documents/MyWiki/html")
;(:base "pdf" :path "~/Documents/MyWiki/pdf")
(:base "latexcjk" :path "~/Documents/MyWiki/tex")
)
("WorkWiki" ;; 我的工作 Wiki
("~/Documents/MyWorkWiki" :default "index")
(:base "html" :path "~/Documents/MyWorkWiki/html")
;(:base "pdf" :path "~/Documents/MyWorkWiki/pdf")
(:base "latexcjk" :path "~/Documents/MyWiki/tex")
)
))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq muse-wikipedia-country "zh") ;; WikiPedia 的国家代码
(setq muse-file-extension "wiki") ;; 文件扩展名
(setq muse-mode-auto-p t) ;; 自动加载 muse-mode
;; Muse LaTeX CJK 设置
(setq muse-latexcjk-encoding-default "{GBK}{song}") ; "{UTF8}{song}")
(setq muse-latexcjk-footer "
%\\end{CJK*}
\\end{document}
")
(setq muse-latexcjk-header "%\\documentclass{article}
\\documentclass{ctexart}
%\\usepackage[encapsulated]{CJK}
%\\usepackage{ucs}
%\\usepackage[utf8x]{inputenc}
\\usepackage{indentfirst}
\\usepackage[CJKbookmarks=true]{hyperref}
\\usepackage[pdftex]{graphicx}
\\newcommand{\\comment}[1]{}

\\begin{document}
%\\begin{CJK*}(muse-latexcjk-encoding)

\\title{(muse-publishing-directive \"title\") }
\\author{(muse-publishing-directive \"author\")}
\\date{(muse-publishing-directive \"date\")}

\\maketitle

(and muse-publish-generate-contents
(not muse-latex-permit-contents-tag)
\"\\\\tableofcontents
\\\\newpage\")

")



--
一步一步教你从互联网赚钱 http://www.zqzn.com/index.asp?rid=key480769
投资理财 http://li-cai.blogspot.com/

procmail使用

procmail不区分大小写,它使用Unix最常用的模式匹配方式进行匹配特定的邮件。因此使用这些匹配模式和procmail规则,可以定义一个更复杂的.procmailrc:

  
PATH=$HOME/bin: /usr/bin: /usr/ucb: /bin: /usr/local/bin:.
SHELL=/bin/sh
MAILDIR=$HOME/mail
DEFAULT=$MAILDIR/mailbox
LOGFILE=/dev/null
SENDMAIL=/usr/lib/sendmail
:0:
* ^From.*badguy     
/dev/null/
:0c:
* ^(From|Cc|To).*freebsd.org
| gzip >> freebsdmail.gz
:0:
* ^From.*@hotmail.com
* ^Subject:.*(joke|funny)
{
  :0 c
  ! friend1@hotmail.com friend2@usa.net
  :0
  joke
}
:0
* ^Subject:.*order
* !^FROM_DAEMON
* !^X-Loop: marketing@company.com
{
  :0 h c
  | (formail -r -A"X-Loop: marketing@company.com " ; \
  cat /market/acknowlegement.txt ) | $SENDMAIL -t
  :0 c
  ! market2@company.com
  :0
  market
}

  这个配置文件的第一部分中设置了几个环境变量,用于设置procmail的运行环境,其中将 MAILDIR设置为~/mail,与pine使用的目录相同,因此这将使pine能直接读取procmail处理过的邮件。

  第二部分中为邮件定义了三个不同的过滤规则及相应的处理操作,第一个规则将来自badguy 的邮件滤掉(输出到/dev/null);第二个规则将与freebsd.org的通信使用gzip保存到freebsdmail.gz 中,用于保存相应maillist的邮件;第三个规则将某个使用hotmail帐号的朋友,并使用joke或funny标题给自己发送笑话的邮件同时转给其他几个朋友,并同时保存在joke文件夹中;最后一个规则是设置了一个自动回复邮件系统,对于使用order做标题,并且没有FROM_DAEMON行(自动邮件回复程序使用FROM_DAEMON 作标记,通常不需要回复这些的邮件,否则会造成回复循环),并且没有包括X-Loop行的邮件进行处理:

  首先将X-Loop行添加到邮件中(使用formail将它们添加到mail的信封上),以免造成对同一个邮件的循环处理,然后将文件/market/acknowlegement.txt发回给发送者;并以及转发邮件,在market中保存邮件。

  根据这些规则,使用Procmail就能完整的处理各种邮件,减轻电子邮件不断增多而造成的困扰。

开通Yahoo邮箱的POP3功能



雅虎邮箱,终生伙伴!

2007年10月21日星期日

股票买卖实例


图解我的股票买卖思路

上周末《与朋友们告个别》中,对其中的两个股票买卖操作,希望股友们能解读出其中的买卖依据,可惜应者寥寥,现在图解一下当时我的思路,供朋友们参考,如果有高手读到本文,鄙人还是希望能看到不同角度的真知灼见


一、002154的买卖思路


1、买入前的K线图分析和分时图





2、卖出时K线图分析和分时图





二、 600477的买卖思路


1、买入前K线图分析和分时图






2、卖出时的K线分析和分时图








Technorati :

2007年10月19日星期五

你的MSN和GTalk可以做什么?

1、当然是聊天;
2、GTalk可以直接与MSN,Yahoo,ICQ通话;
3、发布MiniBlog到Twitter类网站,国内的有:zuosa.com,fanfou.com,叽歪,微客等;
4、发布博客到wordpress类,livejournal,Blogger等;这里要用到IMified网站的服务;
     在IMified中,还有很多其它的服务, 如del.icio.us等可以用,并且它有开放的API可以用
5、利用http://scheduler.lenovolabs.com/,做事务、任务管理
6、利用http://www.9fav.com/,收藏书签

--
一步一步教你从互联网赚钱 http://www.zqzn.com/index.asp?rid=key480769
投资理财 http://li-cai.blogspot.com/

看看你的E-Mail可以做什么?

1、当然是收发邮件了;
2、可以注册、使用MSN和Google的相关服务;
     这样,对Google的Group,你可以用E-Mail进行收发操作;
3、发布Blog;
     支持的博客系统包括:blogger.com 和 MSN Spaces。需要做相关设置
4、传送照片到网络相册中;
     支持的系统包括:yupoo,flickr,photobucket等
5、上传文件到网络硬盘;
     支持的系统包括:box.net,esnips.com


--
一步一步教你从互联网赚钱 http://www.zqzn.com/index.asp?rid=key480769
投资理财 http://li-cai.blogspot.com/

男人的性爱训练如何进行


男人的性爱训练如何进行--河马博客

男人只要活着一天,就需要性爱;因此"小弟弟"站不起来,简直与死无异。
然而随着年龄的增长,男人的体力和精力都会随之消退。有许多男人都会有这种感觉:以前年轻的时候,不要说一天做一次,就算一天做三、四次都没问题;然而现在这种自信心却越来越薄弱了......。


  不过要把责任都推给年龄的话,似乎有欠公允;因为年过八十依然是"一条活龙" ,每日与女人缠绵的欧吉桑还是大有人在。最能了解"精力绝伦"这四个字真正含义的,是三、四十岁的男人;十几二十岁的男人绝对无法了解什么叫"精力绝伦",因为这些年轻人全部都是"精力绝伦"。以下所要传授的方法,是如何增加一个男人"小弟弟"的勃起力,让它依旧能维持在十几二十岁时"坚如铁石"、"金枪不倒"的状态。在谈这些方法之前,有一点是大家必须要有共同认知的:"精力绝伦"有个基本的大前提──身体健康。无论是精神或肉体的任何一方面出了状况,都会造成精力的衰退。


  强化的秘诀在于强化内转肌!当你在厕所小便时,发现自己虽然已经尿完了,却依然有残尿的感觉;这时几乎已经可以断定你的勃起能力已经开始有衰退现象。阴茎从中段到根部为止,都有一种名为"球海绵体肌"的肌肉;这种肌肉的主要功能是控制排尿,并在排尿后确认尿已全部排光。但是除了这种功能之外,它也担任了阴茎勃起时的重要助攻员。如果这种肌肉能力开始衰退,不仅是会让你有残尿感,阴茎的勃起能力也会大幅下降。为了防止这一点,就必须对"球海绵体肌"加以锻。锻炼"球海绵体肌",就相当于锻炼勃起能力。不过,要怎么锻"球海绵体肌"呢?"球海绵体肌"和大腿内侧的"内转肌"之间有神经连结,因此要想锻炼"球海绵体肌",就从锻炼"内转肌"来着手;藉着腿部的开闭,可以达到强化该处肌肉的目的。


  以下介绍两个具体的锻炼方法:


  锻炼方法一:仰卧并将膝盖弯曲,举高双腿,然后用左手捉住右小腿,慢慢地向身体两侧重覆张开、闭合。如果每做五次为一回合的话,一天做个一~二回就可以了。要注意不要贪心一口气做过头,用力过度的话会造成肌肉疲劳,变成反效果喔。


  锻炼方法二:坐在床上,两腿尽可能地张开。接着两手向前伸展,以额头碰触床面为目标将身子向前弯曲。如果每做三~五次为一回合的话,一天做个二~三回就可以了。虽然将两腿张开再弯腰,腿间会觉得有点痛,但还是得稍微忍耐一下,因为张腿的动作相当重要。当然刚开始做的时候,额头很难碰到床面;只要有恒心,大概一个月就可以做到了。每天做这个动作,一个月后勃起力就能大幅提升。


  用腹式肛门呼吸法增加精力和膨胀力!在现实社会中,有许多男人会受到工作以及人际关系的压力而导致性能力减弱;但是也有一些男人在官场情场两得意。这两者的差异究竟在哪里呢?说穿了主要是交感神经和副交感神经功能切替上的问题。人类在工作的时候,交感神经会特别活跃;而在性交的时候,则是由副交感神经主宰一切。功能切替顺畅的话,无论工作或性爱都能是切掌握;反之则在床地间会显得心有馀而力不足。这种时候最好的解决方法就是暂时将手上的工作抛下,好好放个长假,让身心轻松一下。然而一般人哪有这么多假可放呢?所以必须得找个替代的方案才行。


  而藉着入浴──副交感神经活泼化时刺激穴道,是最值得推荐的方法。首先,在入浴时在浴室里找个小凳子坐好,放松肩膀的力量,然后用淋浴的方式刺激位于头顶的百会穴;接着将全身浸泡在放满水的浴缸里,水温约38~39度左右,就这样泡差不多十分钟。如此可以有效地让神经指挥权的交替更加顺畅。另外也有促使交感神经与非交感神经切替更加顺畅的锻方法。这种锻法除了可以强化神经系统效能之外,对于增加勃起力、膨胀力甚至性欲都很有效,我们称它为"腹式肛门呼吸法"。


  锻炼方法


  1.首先以跪坐姿坐好,然后调整好呼吸;接着藉由腹部的力量开始缓缓地吸气。吸气的同时,肛门也逐渐用力收紧,脑子里想着好像要从肛门吸入空气的那种感觉。


  2.在以腹部吸满空气之后,这次要压缩腹部,就像是要把空气挤到背后去一样。


  3.接着再鼓张腹部,就好像要把空气由背后挤到头上一样。


  4.吐气的时候,要像是想把空气挤向心口和下颚一样慢慢呼出;而紧缩的肛门也随着呼气逐步放松。在气吐完了之后,腹部只要一压缩,肛门收缩的程度会比想像中更紧。反覆执行1~4的步骤持续约十分钟,就能让交感神经和副交感神经在功能交接时更加平顺。这个方法请你一定要试试。此外所有的锻方法都必须持续地做,如果能够相信它们并持之以恒,相信必然会得到你想要的成果。


  以上方法是用在日常生活中的锻炼模式。除了锻炼以外,还有许多必须留意之处。好比说是抽烟、喝酒、盐份、咖啡等等,如果摄取过量,势必会对精力产生不良的影响。日本AV界精力绝伦的AV男优.加藤鹰,虽然已经三十七岁了,可是一天射精个六、七次对他而言是十分稀松平常的事。他就曾经表示:为了要维持超强的精力,酒和咖啡是绝对不沾的;烟稍微有抽一点,饮食以鱼类为中心。肉类方面尽量少吃,而对于富含精液构成原料─亚铅的牡蛎、裙带菜以及红贝等食物则大量摄取。当然,维他命的摄取也是不可或缺的。


  在养生之道里有一项"持久不衰",若能确实做到的话,一晚上让女人高潮数次也不是什么困难的事。具地的练习方法如下:


  首先,就像是要自慰一样刺激阴茎,让阴茎勃起;然后放松身体,将两腿稍微张开,让阴茎能确实伸展。待龟头完全露出之后,就用你灵巧的手──包括手掌和手指,上下套动阴茎的部分;


同时另一只空的手则轻轻地抚摸阴囊部分。龟头那儿则以拇指、食指和中指三根手指头轻轻抚摸。当射精感到达80%时,把手移开,令兴奋感稍微降低些;


差不多30秒之后,再度用手刺激阳具,让射精感再度高扬至80%。如此反覆地动作,让一次的射精时间拉长到十分钟左右。


这项练习的目的,是要锻控制射精的能力和培养耐久力。另外,有许多男人在射精之后就倒头大睡。表面上看起来,"运动"过后立即休息,似乎蛮符合养生之道;但事实正好相反。性交后立刻睡觉,这么做不仅会引起女方的不快,也会使得射精后的疲劳感持续到次日。性交之后不马上睡觉,起身继续做一些日常生活中的事情,可以使因性交刺激而变得迟钝的脊椎反射神经顺利恢复动作。若是完事后立刻倒头大睡,睡眠的迟钝效应加上性交刺激的迟钝效应,会使疲劳一直持续到第二天,让你腰酸背痛。所以性交之后,切记不要立刻转身就睡;也许看个电视、抽根烟,或和你的女人情话绵绵个一小时左右再睡,就不会让疲劳感残留到次日。这个小诀窍你千万要记得。








男人的性爱训练如何进行- -


男人只要活着一天,就需要性爱;因此"小弟弟"站不起来,简直与死无异。
然而随着年龄的增长,男人的体力和精力都会随之消退。有许多男人都会有这种感觉:以前年轻的时候,不要说一天做一次,就算一天做三、四次都没问题;然而现在这种自信心却越来越薄弱了......。


  不过要把责任都推给年龄的话,似乎有欠公允;因为年过八十依然是"一条活龙" ,每日与女人缠绵的欧吉桑还是大有人在。最能了解"精力绝伦"这四个字真正含义的,是三、四十岁的男人;十几二十岁的男人绝对无法了解什么叫"精力绝伦",因为这些年轻人全部都是"精力绝伦"。以下所要传授的方法,是如何增加一个男人"小弟弟"的勃起力,让它依旧能维持在十几二十岁时"坚如铁石"、"金枪不倒"的状态。在谈这些方法之前,有一点是大家必须要有共同认知的:"精力绝伦"有个基本的大前提──身体健康。无论是精神或肉体的任何一方面出了状况,都会造成精力的衰退。


  强化的秘诀在于强化内转肌!当你在厕所小便时,发现自己虽然已经尿完了,却依然有残尿的感觉;这时几乎已经可以断定你的勃起能力已经开始有衰退现象。阴茎从中段到根部为止,都有一种名为"球海绵体肌"的肌肉;这种肌肉的主要功能是控制排尿,并在排尿后确认尿已全部排光。但是除了这种功能之外,它也担任了阴茎勃起时的重要助攻员。如果这种肌肉能力开始衰退,不仅是会让你有残尿感,阴茎的勃起能力也会大幅下降。为了防止这一点,就必须对"球海绵体肌"加以锻。锻炼"球海绵体肌",就相当于锻炼勃起能力。不过,要怎么锻"球海绵体肌"呢?"球海绵体肌"和大腿内侧的"内转肌"之间有神经连结,因此要想锻炼"球海绵体肌",就从锻炼"内转肌"来着手;藉着腿部的开闭,可以达到强化该处肌肉的目的。


  以下介绍两个具体的锻炼方法:


  锻炼方法一:仰卧并将膝盖弯曲,举高双腿,然后用左手捉住右小腿,慢慢地向身体两侧重覆张开、闭合。如果每做五次为一回合的话,一天做个一~二回就可以了。要注意不要贪心一口气做过头,用力过度的话会造成肌肉疲劳,变成反效果喔。


  锻炼方法二:坐在床上,两腿尽可能地张开。接着两手向前伸展,以额头碰触床面为目标将身子向前弯曲。如果每做三~五次为一回合的话,一天做个二~三回就可以了。虽然将两腿张开再弯腰,腿间会觉得有点痛,但还是得稍微忍耐一下,因为张腿的动作相当重要。当然刚开始做的时候,额头很难碰到床面;只要有恒心,大概一个月就可以做到了。每天做这个动作,一个月后勃起力就能大幅提升。


  用腹式肛门呼吸法增加精力和膨胀力!在现实社会中,有许多男人会受到工作以及人际关系的压力而导致性能力减弱;但是也有一些男人在官场情场两得意。这两者的差异究竟在哪里呢?说穿了主要是交感神经和副交感神经功能切替上的问题。人类在工作的时候,交感神经会特别活跃;而在性交的时候,则是由副交感神经主宰一切。功能切替顺畅的话,无论工作或性爱都能是切掌握;反之则在床地间会显得心有馀而力不足。这种时候最好的解决方法就是暂时将手上的工作抛下,好好放个长假,让身心轻松一下。然而一般人哪有这么多假可放呢?所以必须得找个替代的方案才行。


  而藉着入浴──副交感神经活泼化时刺激穴道,是最值得推荐的方法。首先,在入浴时在浴室里找个小凳子坐好,放松肩膀的力量,然后用淋浴的方式刺激位于头顶的百会穴;接着将全身浸泡在放满水的浴缸里,水温约38~39度左右,就这样泡差不多十分钟。如此可以有效地让神经指挥权的交替更加顺畅。另外也有促使交感神经与非交感神经切替更加顺畅的锻方法。这种锻法除了可以强化神经系统效能之外,对于增加勃起力、膨胀力甚至性欲都很有效,我们称它为"腹式肛门呼吸法"。


  锻炼方法


  1.首先以跪坐姿坐好,然后调整好呼吸;接着藉由腹部的力量开始缓缓地吸气。吸气的同时,肛门也逐渐用力收紧,脑子里想着好像要从肛门吸入空气的那种感觉。


  2.在以腹部吸满空气之后,这次要压缩腹部,就像是要把空气挤到背后去一样。


  3.接着再鼓张腹部,就好像要把空气由背后挤到头上一样。


  4.吐气的时候,要像是想把空气挤向心口和下颚一样慢慢呼出;而紧缩的肛门也随着呼气逐步放松。在气吐完了之后,腹部只要一压缩,肛门收缩的程度会比想像中更紧。反覆执行1~4的步骤持续约十分钟,就能让交感神经和副交感神经在功能交接时更加平顺。这个方法请你一定要试试。此外所有的锻方法都必须持续地做,如果能够相信它们并持之以恒,相信必然会得到你想要的成果。


  以上方法是用在日常生活中的锻炼模式。除了锻炼以外,还有许多必须留意之处。好比说是抽烟、喝酒、盐份、咖啡等等,如果摄取过量,势必会对精力产生不良的影响。日本AV界精力绝伦的AV男优.加藤鹰,虽然已经三十七岁了,可是一天射精个六、七次对他而言是十分稀松平常的事。他就曾经表示:为了要维持超强的精力,酒和咖啡是绝对不沾的;烟稍微有抽一点,饮食以鱼类为中心。肉类方面尽量少吃,而对于富含精液构成原料─亚铅的牡蛎、裙带菜以及红贝等食物则大量摄取。当然,维他命的摄取也是不可或缺的。


  在养生之道里有一项"持久不衰",若能确实做到的话,一晚上让女人高潮数次也不是什么困难的事。具地的练习方法如下:


  首先,就像是要自慰一样刺激阴茎,让阴茎勃起;然后放松身体,将两腿稍微张开,让阴茎能确实伸展。待龟头完全露出之后,就用你灵巧的手──包括手掌和手指,上下套动阴茎的部分;


同时另一只空的手则轻轻地抚摸阴囊部分。龟头那儿则以拇指、食指和中指三根手指头轻轻抚摸。当射精感到达80%时,把手移开,令兴奋感稍微降低些;


差不多30秒之后,再度用手刺激阳具,让射精感再度高扬至80%。如此反覆地动作,让一次的射精时间拉长到十分钟左右。


这项练习的目的,是要锻控制射精的能力和培养耐久力。另外,有许多男人在射精之后就倒头大睡。表面上看起来,"运动"过后立即休息,似乎蛮符合养生之道;但事实正好相反。性交后立刻睡觉,这么做不仅会引起女方的不快,也会使得射精后的疲劳感持续到次日。性交之后不马上睡觉,起身继续做一些日常生活中的事情,可以使因性交刺激而变得迟钝的脊椎反射神经顺利恢复动作。若是完事后立刻倒头大睡,睡眠的迟钝效应加上性交刺激的迟钝效应,会使疲劳一直持续到第二天,让你腰酸背痛。所以性交之后,切记不要立刻转身就睡;也许看个电视、抽根烟,或和你的女人情话绵绵个一小时左右再睡,就不会让疲劳感残留到次日。这个小诀窍你千万要记得。



- 作者: 河马- 2005年04月8日, 星期五 04:18 加入博采




Trackback


你可以使用这个链接引用该篇文章 http://publishblog.blogchina.com/blog/tb.b?diaryID=1134682































发布人:
邮箱:
主 页:
评论内容:
               







Zoundry的MSN空间的设置


原来用户名要用你空间的名字,如我的空间地址是 http://ustc-num.spaces.live.com/ ,那么用户名是ustc-num;而密码用的是你的空间设置中:"选项->电子邮件发布"页面中的"机密字"。空间的API地址是: https://storage.msn.com/storageservice/MetaWeblog.rpc




Technorati : ,
Del.icio.us :

2007年10月15日星期一

年轻漂亮MM想嫁有钱人 金融家的回复令人拍案叫绝

一个年轻漂亮的美国女孩在美国一家大型网上论坛金融版上发表了这样一个问题帖:我怎样才能嫁给有钱人?
  
    "我下面要说的都是心里话。本人25岁,非常漂亮,是那种让人惊艳的漂亮,谈吐文雅,有品位,想嫁给年薪 50万美元的人。你也许会说我贪心,但在纽约年薪100万才算是中产,本人的要求其实不高。
  
    这个版上有没有年薪超过 50万的人?你们都结婚了吗?我想请教各位一个问题——怎样才能嫁给你们这样的有钱人?我约会过的人中,最有钱的年薪 25万,这似乎是我的上限。要住进纽约中心公园以西的高尚住宅区,年薪25万远远不够。我是来诚心诚意请教的。有几个具体的问题:一、有钱的单身汉一般都在哪里消磨时光? (请列出酒吧、饭店、健身房的名字和详细地址。)二、我应该把目标定在哪个年龄段?三、为什么有些富豪的妻子看起来相貌平平?我见过有些女孩,长相如同白开水,毫无吸引人的地方,但她们却能嫁入豪门。而单身酒吧里那些迷死人的美女却运气不佳。四、你们怎么决定谁能做妻子,谁只能做女朋友? (我现在的目标是结婚。)"——波尔斯女士
  
    下面是一个华尔街金融家的回帖:
  
    "亲爱的波尔斯:我怀着极大的兴趣看完了贵帖,相信不少女士也有跟你类似的疑问。让我以一个投资专家的身份,对你的处境做一分析。我年薪超过50万,符合你的择偶标准,所以请相信我并不是在浪费大家的时间。
  
    从生意人的角度来看,跟你结婚是个糟糕的经营决策,道理再明白不过,请听我解释。抛开细枝末节,你所说的其实是一笔简单的"财""貌"交易:甲方提供述人的外表,乙万出钱,公平交易,童叟无欺。但是,这里有个致命的问题,你的美貌会消逝,但我的钱却不会无缘无故减少。事实上,我的收入很可能会逐年涕增.而你不可能一年比一年漂亮。
  
    因此,从经济学的角度讲,我是增值资产,你是贬值资产,不但贬值,而且是加速贬值!你现在25,在未来的五年里,你仍可以保持窈窕的身段,俏丽的容貌,虽然每年略有退步。但美貌消逝的速度会越来越快,如果它是你仅有的资产,十年以后你的价值甚忧。
  
    用华尔街术语说,每笔交易都有一个仓位,跟你交往属于"交易仓位"(tradingl position),一旦价值下跌就要立即抛售,而不宜长期持有——也就是你想要的婚姻。听起来很残忍,但对一件会加速贬值的物资,明智的选择是租赁,而不是购入。年薪能超过50万的人,当然都不是傻瓜,因此我们只会跟你交往,但不会跟你结婚。所以我劝你不要苦苦寻找嫁给有钱人的秘方。顺便说一句,你倒可以想办法把自己变成年薪50万的人,这比碰到一个有钱的傻瓜的胜算要大。
  
    希望我的回帖能对你有帮助。如果你对"租赁"感兴趣,请跟我联系。"——罗波.坎贝尔(J·P·摩根银行多种产业投资顾问)

--
一步一步教你从互联网赚钱 http://www.zqzn.com/index.asp?rid=key480769
投资理财 http://li-cai.blogspot.com/

2007年10月14日星期日

淘宝上让人喷饭的卖家买家对话

买家: 请问欧版和行货为什么要分开卖?
卖家:因为粘在一起不方便使用
买家:。。。。。。。。
 
买家:老板,你说欧版质量好,还是行货质量好?
卖家:也许是欧版的吧!
买家:为什么?
卖家:因为我只见过行货有专门的维修中心。
 
买家:老板,能不能帮我挑一部最好的?
卖家:好的,我把几百部手机组织起来,让它们先海选后PK 。
 

买家:老板,这个手机的铃声怎么样?
卖家:绝对能响
 

买家:掌柜的,这个手机的最大优点是什么?
卖家:可以打电话。
买家:?!哦有什么缺点呢?
卖家:不能剃须!
买家:!?
 

买家:老板现在什么手机最贵?
卖家:诺基亚 1100
买家:不会吧,那个才 300 多!
卖家:你镀层金,镶两颗钻石就齐活了。
买家:倒!
 
买家: 3230
卖家: 9@9t
买家:诺基亚
卖家:飞利普
买家:你说什么啊?
卖家:你不是在对暗号吗?
买家:晕!
 
买家:老板,我同学说的,你们这里买的手机,即使从 4 楼上掉下来摔坏了,你们也可以换的,是这样吗?
卖家:你们应该多关心一下这位同学,不要让他一个人呆着,多陪他说说话,参加一些集体活动。如果还不见有什么好转的话,可以送到医院观察一下。
买家:哦。。。。。。
 
买家:老板这款手机有货吗?
卖家:没有了
买家:为什么没货啊!
卖家:因为缺货了
买家:哦!为什么会缺货呢?
卖家:因为断货了。
买家:哎,怎么会断货呀!
卖家:因为没货了
买家:哦。。。。那什么时候有货啊?
卖家:到货的时候
 
买家:老板,有巧克力吗?
卖家:有,德芙的,还有金帝的
买家:我是说手机!!!
卖家:哦,经你这么一提醒我才知道我是卖手机的
 
买家:老板,那你再给说说怎么分辨这个原装电池和组装电池
卖家:你把电池扔到火堆里,原装的爆炸声音更响些
 

买家:老板,你是深圳人吗?
卖家:你见过深圳人吗?
买家:没有
卖家:那我也没有
买家:那你怎么会去深圳呢?
卖家:还不是为了给深圳的经济建设添砖加瓦。
买家:。。。。。。
 

买家:这么贵的手机,我还不如买个笔记本电脑
卖家:也对,我想象你站在人群中,把笔记本翻开,贴在耳朵边听电话的造型一定很酷。
 

买家:有人吗?
卖家:不好意思,我只卖手机!
 

买家:老板,这个手机的通话质量好吗?
卖家:三星的一般都很好的
买家:我已经买的好几部手机都不行,听不清楚别人说什么。
卖家:哦
买家:你推荐我应该买什么
卖家:助听器
 
买家:老板,问你个问题?大陆行,港行,亚太行,欧行的,哪个的质量更好?
卖家:都一样,行行出状元嘛!
 
买家:老板可以见面交易吗?
卖家:你在哪里?
买家:武汉
卖家:我在深圳,你愿意过来吗?
买家:我怎么可能走得开呢?
卖家:你就离不开那片热土?
买家:???
卖家:有热干面吃的土地
买家:。。。。。。。。。。。
 

买家:老板,有什么手机最耐用?
卖家:只有相对耐用的,没有绝对耐用的
买家:为什么?
卖家:你见过谁家有祖传的手机
 
买家:哥哥,你给我说说智能手机和非智能手机有什么区别啊!?
卖家:就以闹钟为例,一般的手机到点就闹,闹得醒闹不醒不管,智能手机见闹不醒你,会打电话给你们单位领导请假。
买家:哦。。。。。。。。。。
 

买家:多少钱?
卖家: 2560
买家: 2000 卖不卖?
卖家:好的,支持支付宝吗,给我来一打
买家:什么?
卖家:我觉得你的价格更实惠。
 
买家:老板,你们卖手机赚钱吗?
卖家:那是相当的赚
买家:那一个月能赚多少?
卖家:你先买部手机,让我先赚点钱,把昨天的饭钱结了再告诉你
 

买家:老板,我们这里不到快递,还有什么办法能更快送到吗?
卖家:你包个飞机,然后空投
 

买家:老板,这个手机有红色吗?
卖家:没有的,厂家没有出过
买家:哎,我是女孩想要红的,怎么办呢?
卖家:你可以定做
买家:真的吗,要多少钱?
卖家:一部到不要多少钱,就是 5000 部起定
买家:哦,那谢谢了,我再考虑下
卖家:好的,考虑好了,带够钱了来
 
买家:有 MOTO 的 998 吗
卖家:不好意思,我不是收藏家
 
买家:今天还能发货吗?
卖家:应该没问题
买家:听说你们那边刮台风了
卖家:是的,前几天特别厉害
买家:有多厉害?
卖家:我们这里郊区的农民刮完台风都要到拿梯子到房顶去打水
买家:为什么啊?
卖家:他家井给刮到房顶去了!
 
买家:掌柜的,问下你,你说这网上有骗子吗?
卖家:那是肯定的
买家:哦,那你给我说说有什么特征?
卖家:有什么特征我就没时间归纳了,但被骗的人一定有一个特征
买家:什么?
卖家:相信天上会掉馅饼
 
买家:请问手机你们售出之后,用什么方法保证质量?
卖家:祈祷
 
买家:请问用 EMS 多少钱
卖家: 20
买家:邮局是不是按重量的吗?就一个读卡器还要这么多?
卖家:出租车不会因为你的距离短而不收你起步价
 
买家:多少钱?
卖家: 1780
买家:怎么这么便宜,我有点担心
卖家:这样吧,为了避免你不必要的担心,我受累点,我去改成 1980
买家:。。。。。。。。。
 

买家:老板,这个手机大概有多重
卖家: 60 多克
买家:哎,其他都好,我就是嫌太轻了
卖家:你可以绑在哑铃上使用

--
一步一步教你从互联网赚钱 http://www.zqzn.com/index.asp?rid=key480769
投资理财 http://li-cai.blogspot.com/

2007年10月7日星期日

Latex 使用 epix 生成 tikz 图形

使用 epix 生成 tikz 图形
lyanry posted @ 2007年10月07日 08:24AM in 文档标记语言 with tags epix TikZ

前几天瞎逛,发现了这么一个东西:
http://mathcs.holycross.edu/~ahwang/current/ePiX.html

epix 提供了一套 c++ 风格的绘图语法,对绘图代码处理后生成可以嵌入到 latex 文档中的 pstricks、tikz、eepic 图形。

其生成 tikz 图形的基本过程如下:

1. epix 所处理的源文档示例 sphere.xp:
/* -*-ePiX-*- */
#include "epix.h"
using namespace ePiX;

const double k(2*M_PI/(360*sqrt(3))); // assume "degrees" mode

double exp_cos(double t) { return exp(k*t)*Cos(t); }
double exp_sin(double t) { return exp(k*t)*Sin(t); }
double minus_exp_cos(double t) { return -exp_cos(t); }
double minus_exp_sin(double t) { return -exp_sin(t); }

int main()
{
picture(P(-1,-1), P(1,1), "2.5 x 2.5in");

begin();
degrees(); // set angle units
camera.at(P(1, 2.5, 3));

sphere(); // draw unit sphere's horizon

pen(Blue(1.6)); // hidden portions of loxodromes
backplot_N(exp_cos, exp_sin, -540, 540, 180);
backplot_N(minus_exp_cos, minus_exp_sin, -540, 540, 180);

pen(Red(1.6));
backplot_N(exp_sin, minus_exp_cos, -540, 540, 180);
backplot_N(minus_exp_sin, exp_cos, -540, 540, 180);

pen(Black(0.3)); // coordinate grid

for (int i=0; i<=12; ++i) {
latitude(90-15*i, 0, 360);
longitude(30*i, 0, 360);
}

bold(Blue()); // visible portions of loxodromes
frontplot_N(exp_cos, exp_sin, -540, 540, 360);
frontplot_N(minus_exp_cos, minus_exp_sin, -540, 540, 360);

pen(Red());
frontplot_N(exp_sin, minus_exp_cos, -540, 540, 360);
frontplot_N(minus_exp_sin, exp_cos, -540, 540, 360);

end();
}

2. 使用 epix 处理 sphere.xp ,输出 tikz 图形文档 sphere.eepic:
$ epix --tikz sphere.xp

3. 将 sphere.eepic 文档插入 latex 文档中:
\documentclass{article}

\usepackage{tikz}
\pagestyle{empty}

\begin{document}

\input{sphere.eepic}

\end{document}

使用 pdflatex 处理后,可得到这样的图形:






--
一步一步教你从互联网赚钱 http://www.zqzn.com/index.asp?rid=key480769
投资理财 http://li-cai.blogspot.com/