Archive for the ‘Tech Mess’ Category

how to merge individual commit in git

Thursday, July 9th, 2009

在用 git 开发的过程中,通常不同的 feature 会在不同的 branch 中开发,再 merge 到 master branch 中。但有时候会需要从某个 branch 中合并几个文件或某个 commit 进来,方法有两种:

1、合并几个文件(参考链接
git checkout source_branch <paths>…

2、合并某个 commit(参考链接
git cherry-pick <commit id>

解决 svn 在 terminal 里面的乱码问题

Sunday, July 6th, 2008

前几天用 macport 装 git 的时候顺带升级了一下 svn,没想到原来的英文提示变成了乱码,莫非支持中文了?在 terminal 里面看上去超级不爽,但当时急事在身就没管。

今天搜了下,解决方法很简单,是 terminal locale 和 svn 编码不符,编辑 ~/.bash_profile,加上 export LANG=en_US,搞定!

Feisty安装apache2遇到郁闷的问题

Wednesday, July 25th, 2007

在 ubuntu feisty 上用 apt-get 装 apache2,安装完成后 /etc/init.d/apache2 无法启动,没有任何返回,/var/log/apache2/error.log里面也没有任何信息!用 apache2ctl start 启动提示没有设置 ServerName,好说,在 /etc/apache2/ 创建一个 httpd.conf,里面加上 ServerName localhost。再 apache2ctl start 没有错误提示了。这个情况有人遇到过,他猜测因为先前装过 apache,那我八成是因为先前装了 nginx, bull shit!

再运行 /etc/init.d/apache2 start 仍然无法启动!看 error.log,有如下错误:

[Wed Jul 25 18:06:12 2007] [error] cgid daemon process died, restarting
[Wed Jul 25 18:06:12 2007] [error] (2)No such file or directory: Couldn’t bind unix domain socket /var/run/apache2/cgisock.18746

竟然是个bug,而且已经关闭,因为在Gutsy Gibbon已经修复…feisty里怎么修复?没弄明白。Apache Mail List 上也有一个关于这个问题的修复,试了没用!

How to remove Nginx from Ubuntu Feisty

Wednesday, July 25th, 2007

Feisty中的Nginx有问题,不能用 apt-get remove 卸载。方法看这里

MySQL encoding and converting databases to UTF8

Wednesday, May 16th, 2007

1.) Dump the DB:
mysqldump –user=username –password=password –default-character-set=latin1 –skip-set-charset dbname > dump.sql

2.) Replace all latin1 instances with utf8:
sed -r ’s/latin1/utf8/g’ dump.sql > dump_utf.sql

3.) Delete the old DB, create a new one in UTF8:
mysql –user=username –password=password –execute=”DROP DATABASE dbname; CREATE DATABASE dbname CHARACTER SET utf8 COLLATE utf8_general_ci;”

4.) Load the dump into the new DB:
mysql –user=username –password=password –default-character-set=utf8 dbname < dump_utf.sql

original link 

Bayesian Classifier

Friday, March 23rd, 2007

Naive Bayesian Classifier, 朴素贝叶斯分类器,简单的说就是给出一些关键词,系统可以自我学习的对文本进行处理之后完成分类。

在Ruby Cookbook 1.20上给出了一个方法,用的是收录到gem中的Classifier::Bayes。rubyforge中的位置是http://rubyforge.org/projects/classifier,现在的版本是1.3.0

Ruby方面还有一个实现bishop,是Python上 Reverend直接port过来的,rubyforge中的位置是http://rubyforge.org/projects/bishop/,现在的版本是0.3.0,好像不活跃,ROR上面还有一个plugin,可以用act_as_classifiable

这个东西在邮件反垃圾,文章相关性分析上有不少的应用,在Google中的结果看应该是比较成熟的东西

technorati tags:, , ,

Blogged with Flock