Recently in 《Petit Chose》 Category

Snow Leopard

| No Comments | No TrackBacks
2009-8-30 Upgraded to Snow Leopard (MB404).
Snow Leopard DMG (10A432) restored to a partition on iPod Video (10G, APM partition type), and then use iPod to boot and upgrade.

Everything seems fine.

Aftermath:

1 locate-db has to be reinitialized.

$sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist

2 Macports

Reinstallation of all ports seems to be a must. 

Do as MacPorts Migration guide suggest. (Refer to http://trac.macports.org/wiki/Migration).

This does not work.
$sudo port upgrade --force installed

Instead all ports are uninstalled first, and then the whole /opt/local tree is removed, and reinstall Macports 1.80.



磁盘镜像格式的转换

| No Comments

最近下载了一些软件,是各种格式的磁盘镜像文件,在MacOSX下无法mount,因此通过搜索研究了一下转换方法,转换成了 .iso格式这样既可以在Mac下mount也可以在Windows虚拟机里使用。

*CloneCD Image

下载的软件包括三个文件: software.ccd, software.img, software.sub

通过Macports安装 ccd2iso:

sudo port -v install ccd2iso

然后运行:

ccd2iso software.img software.iso

700m左右的文件在我的MB上只花了两三分钟就转换成功了。

*Alchohol 120% image

下载下来的软件包括两个文件: software.mdf, software.mds

通过Macports安装 mdf2iso:

sudo port -v install mdf2iso

然后运行:

mdf2iso software.mdf software.iso

*Nero Burning Rom image

下载的软件包括一个software.nrg文件。

有人说 nrg2iso可以转换,我通过Macports安装了 nrg2iso,然后运行

nrg2iso software.nrg software.iso

转换是成功的,但是转换后的iso无法mount。因此这个方法暂时存疑,可能是nrg2iso程序需要改进。

Toast Titanium 9可以直接mount .nrg文件,然后可以刻录或者将里面内容直接复制出来。

*CDRWin .bin/.cue image

下载的软件包含software.bin和software.cue。

通过Macports安装 bchunk:

sudo port -v install bchunk

然后运行

bchunk software.bin software.cue software.iso

QuickSilver

| No Comments | No TrackBacks

iPod

| No Comments | No TrackBacks
iPod Video (5th generation, 60G)

Firmware version: 1.3

iPod Touch (8G)

Firmware version: 1.14

Jailbroken with iJailbreak 0.60

weDict
安装完weDict和几个字典后发现无法使用,搜索任何单词都是not found,经过google搜索发现有人提到,如果在安装weDict之前先安装了字典,那么就无法使用。我正是先安装了字典的。需要uninstall所有字典和weDict然后重新安装weDict再安装字典。

MacOSX使用

| No Comments | No TrackBacks

Terminal.app中中文使用


建立 ~/.inputrc:
set convert-meta off
set meta-flag on
set output-meta on

在~/.profile中设置locale:
export LC_ALL=zh_CN.UTF-8
export LANG=zh_CN.UTF-8

ERC

| No Comments | No TrackBacks
我的ERC相关设置:

(require 'erc)

(defun cg-erc ()
    (interactive)
    (erc :server "irc.freenode.net" :port 6667 :nick "mynick” :password “mypass" :full-name "my full name"))

(require 'easymenu)
(easy-menu-add-item  nil '("tools") ["ERC" cg-erc t])
(global-set-key "\C-cef" 'cg-erc)

函数cg-erc直接设置连接参数,可以通过  M-x cg-erc 直接连接。
通过easymenu在 Tools 菜单下增加一个 ERC 菜单项,也可用来连接。
设置组合键 C-c e f 来连接。 


*** Useful commands
(in server buffer) Search for all channels with keyword in name
/msg chanserv list *keyword*

To retrieve command history
M-p
M-n

Gnus+MSMTP实现多账号邮件发送

| No Comments | No TrackBacks
多年来一直使用Gnus作为新闻组和邮件程序,但是一直为Gnus的多账号情况下发送邮件问题所困扰,最近有想法换一个别的程序,可惜研究之后发现找不到一个能满足我需求的程序,因为我使用offlineimap进行本地和服务器端的同步(我的多数邮箱都支持IMAP),然后用nnmaildir后端管理。最后决定还是回到Gnus本身来寻找解决方法,因为毕竟唯一的问题就是多账号SMTP发送。 网络上有几种可选方案,其中被广泛采用的可能是 fs-change-smtp 这个函数,但是我使用并不成功。 我一直以来使用的是msmtp,但是为此需要配置复杂的posting styles,而我的工作邮件是按照公司名归档的,这样一个组里我所用的邮箱就不只是一个,这特别对回复邮件特别不方便,因为为了激活posting style需要在特定的组里回复才行。 昨晚经过几个小时的艰辛努力,终于写除了一个10来行代码(汗!),彻底解决了这个困扰已久的问题。自认为这是到目前为止最简单也是最灵活有效的解决办法。 设置MSMTP MSMTP配置很简单,参考主站的文档即可。 注意事项 文档中的配置文件中,指定了一个 default account,通过 account default 或者 default account : defaultemail。我发现为了Gnus正常使用,不能指定default账号。(这一点有时间需要再研究一下) 建议 为了记忆的方便,建议account label直接使用email地址,也就是说: 文档中 account gmail host … … 我的建议是 account youraccount@gmail.com host … … Gnus设置 在.gnus.el中加入以下代码: [Code] ;; Choose account label to feed msmtp -a option based on From header in Message buffer; ;; This function must be added to message-send-mail-hook for on-the-fly change of From address ;; before sending message since message-send-mail-hook is processed right before sending message. (defun cg-feed-msmtp () (if (message-mail-p) (save-excursion (let* ((from (save-restriction (message-narrow-to-headers) (message-fetch-field “from”))) (account (cond ;; I use email address as account label in ~/.msmtprc ((string-match “myemail1@server1.com” from)“myemail1@server1.com”) ;; Add more string-match lines for your email accounts ((string-match “myemail2@server2.com” from)“myemail2@server2.com”)))) (setq message-sendmail-extra-arguments (list “-a” account)))))) (setq message-sendmail-envelope-from ‘header) (add-hook ‘message-send-mail-hook ‘cg-feed-msmtp) 根据email账号增加相应的 ((string-match “myemail1@server1.com” from) “myemail1@server1.com”) 行,其中 myemail1@server1.com 等就是在 .msmtprc 中的对应的account label。 结束语 这个设置就是这么简单,但是完全避免了使用复杂的posting styles来配置。 以上代码关于获取 From header部分借自 fs-change-smtp。

Leafnode

| No Comments | No TrackBacks
Home: http://www.leafnode.org

一、  Ubuntu (7.10)下安装

参考了 http://www.emacs.cn/Gnus/Leafnode 和 http://learn.tsinghua.edu.cn:8080/2002315162/gnus_leafnode.html。

Ubuntu 7.10 有 leafnode 包(版本为最新稳定版 1.11.6)。通过Synaptic安装即可。

安装时网络连接方式我选择了 NONE,暂时手动 fetchnews。

/etc/cron.d/leafnode 抄了 http://learn.tsinghua.edu.cn:8080/2002315162/gnus_leafnode.html:
 # Cron entries for Leafnode
0-59/15 * * * * news if [ -x /etc/news/leafnode/do-fetch-news ];
then /etc/news/leafnode/do-fetch-news; fi


Ubuntu作为Debian系统,配置目录在 /etc/news/leafnode 下。
News spool目录为 /var/spool/news。

修改 /etc/hosts,设定hostname为 news.cyberhut.org。
(hosts里设置让我觉得怪异,我设置在 127.0.0.1 居然不行,里面本来有的 127.0.1.1 行中设置才可以。需要找时间研究下为什么。)

/etc/news/leafnode/config 中设置:
server = news.gmane.org
server = yaako.com

expire  = 20000
 (我准备用leafnoe作为新闻组的本地archive,所以不需要expire。设一个大的数字就可以了。2000天差不多等于54年)

initialfetch = 100

maxage = 20000 (原因和expire同)。


先通过 sudo fetchnews -vvv 把组列表取下来。
然后订阅一些组后,为了取下旧的文章,使用  sudo fetchnews -vvv -x 2000 (为了控制数据量。有些组因为文章数巨大,还需要加大 x 值直到把文章全部取下来。

在Gnus中设置nntp为localhost即可。

注:经过使用leafnode2,决定Ubuntu下也从源码安装leafnode。

Ubuntu源码安装需要先安装 libpcre3-dev包,通过 synaptic,apt-get或者aptitude安装即可。
安装很简单,不过为了使用ubuntu安装已经建立的配置目录和文件,configure时候使用sysconfdir指定原来目录。
./configure --sysconfdir=/etc/news/leafnode (--prefix=/usr/local)
make
sudo make install

然后修改 /etc/inetd.conf, 将leafnode路径修改为  /usr/local/sbin/leafnode。

leafnode2 中有些配置从config中挪到了filters中,作相应修改即可。
由于本地存储文件格式的变化,需要运行一次以下命令来更新格式:
sudo fetchnews -f


二、 MacOSX 下安装
Mac Mini G4 (MacOSX 10.4.10 PPC)

MacOSX下的安装配置本以为很简单,结果发现不是。主要参考 http://www.kutilek.de/technik/news-macosx.en.php (万分感谢,否则我还搞不定)。

由于 Macports 里没有 leafnode,只能通过源码自己安装。于是我选择了安装 leafnode 2 ( http://www.dt.e-technik.uni-dortmund.de/~ma/leafnode/beta/ ),所用为最新的 snapshot 2.0.0.alpha 20070602a

由于/usr/local/ 已经交给 Macports,我就直接选择安装进 /usr。
所需的 pcre 已经通过 Macports 安装。

需要建用户 news,通过控制面板中的 Accounts 增加一个用户 news即可。没有这个news用户,configure会失败。

安装:
./configure --prefix=/usr --sysconfdir=/Library/Leafnode --enable-spooldir=/private/var/spool/news
make
sudo make install-strip (现在的snapshot中不是 strip-install)

进入 /Library/Leafnode,cp config.example config,然后编辑 config:
sudo emacs config

主要设置和上面Ubuntu提到的差不多。 leafnode2中config文件结构有变化。server设置在global设置之后。

hostname没有向参考文章中一样在config设置,而是通过系统端。这也是leafnode FAQ中所建议的。

由于我家中 Mac使用ADSL上网,MacOSX 从10.4.6开始hostname改成自动设置(PPPOE连接后自动获取),这对leafnode运行造成麻烦。

MacOSX下像 GNU/Linux一样通过修改/etc/hosts设置是无效的。必须修改 /etc/hostconfig,将
HOSTNAME=~AUTOMATIC~
修改为
HOSTNAME=home.cyberhut.org

设置leafnode运行方式,使用Tiger所建议的Launch Daemon 方式,在 /Library/LaunchDaemons下建立
org.cyberhut.home.leafnode.plist,内容如下:





Label
org.cyberhut.home.leafnode
Program
/usr/sbin/leafnode
ProgramArguments

/usr/sbin/leafnode

Sockets

Listeners

SockServiceName
nntp


UserName
news
inetdCompatibility

Wait




我没有参照参考文章设置bonjour。

然后装载并启动leafnode:


sudo launchctl load /Library/LaunchDaemons/org.cyberhut.home.leafnode.plist
sudo launchctl start org.cyberhut.home.leafnode

现在用手动方式运行fetchnews,需要研究下如何使用 launchd 来定期运行fetchnews,或者通过crontab设置运行。

3 使用

由于 leafnode 本身带filter功能,对spam的过滤就直接交给了leafnode,这样在Gnus中就不需要spam处理了,因此相关的score设置,spam.el设置及相关文件就可以全部去掉了。

filter设置在 /etc/news/leafnode (Ubuntu)或 /Library/Leafnode(MacOSX下根据上文安装)下,文件名为 filters。

因为主要阅读gmane.×,对gmane组设置:

newsgroups = gmane\..*
pattern = ^Newsgroups:.*gmane\.spam\.detected
action = kill

这样对gmane服务器已经确认的spam就可以kill掉了。这基本可以对付gmane中大多数的垃圾。
本地leafnode的巨大好处是可以将这些spam完全杀掉,包括从本地spool里删除。

对相关组已经取到本地的文章进行过滤:

sudo applyfilter -vvv gmane.group.name

以后对其它特征的spam加入过滤规则,然后手动applyfilter,就可以在本地建立一个洁净的新闻组服务器了。

Emacs Resources

| No Comments | No TrackBacks

Emacs repos (read only):

Official CVS

HEAD:

export CVS_RSH=”ssh”

cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/emacs co emacs

GNU Arch Location: http://arch.sv.gnu.org/archives/emacs

The branches currently available are: emacs-devo-0 emacs-lexbind-0 emacs-tiling-0 emacs-unicode-0 gnus-devo-0 gnus-rel-5.10

Mercurial (HEAD only): hg clone http://hg.intevation.org/emacs

git: git-clone git://git.sv.gnu.org/emacs.git

create a local branch from emacs-unicode-2 for building:

git checkout -b my-emacs23 origin/emacs-unicode-2

(then you can use "git checkout master / git checkout my-emacs23" to switch between two branches.


Build under MacOSX: ./configure --prefix=/usr --enable-carbon-app

Carbon port is dead, long live Carbon port!


Cocoa port is fresh and alive -- http://emacs-app.sf.net


./configure --with-ns --without-x --enable-ns-app --prefix=/usr/local --without-freetype
make -j4 bootstrap
sudo make install

2008-4-26 build successfully.


2008-7-15 emacs-app is merged into cvs trunk.

./configure --with-ns --disable-ns-self-contained
make -j3 bootstrap
sudo make install

2008-7-20 build successfully.

About this Archive

This page is an archive of recent entries in the 《Petit Chose》 category.

《Perdu – 淡若无伤》 is the previous category.

《人·岁月·生活》 is the next category.

Find recent content on the main index or look in the archives to find all content.