• apt-get source ibus-pinyin
    然后修改engine里的pysqlitedb.py:

    代码:
        #添加到头部
        import re
        import urllib
        #函数修改
        def select_words_by_pinyin_list (self, pys, mohu = False):
            """select words from database by list that contains pyutil.PinYinWord objects"""
    
            pinyin_string = u"'".join (map (str, pys))
    
            result = self.select_cache [pinyin_string]
            if result != None:
                return result
    
            doc = urllib.urlopen("http://web.pinyin.sogou.com/web_ime/get_ajax/%s.key" % pinyin_string).read()
            words = map(urllib.unquote,re.compile(r'ime_query_res="([^"]*)"').match(doc).group(1).split('+'))
            result = []
            for word in words:
                phrase = word.split(':')[0].decode('utf8');
                record = (len(phrase), None, None, None, None, '', None, None, None, None, phrase, 1, 1)
                result.append(record)
            self.select_cache [pinyin_string] = result
            return result   
    
    



    第一,目前不熟python,现查手册改的。
    第二,只用了1个小时随便改改,本来想自用的,所以只是在原来的sqlite的基础上蒙蔽下程序。结果发现太好用了,忍不住发上来。由于ibus-pinyin有缓存,比sogoupinyincc要快很多很多并且可以选词,几乎感觉不到延迟。
    我觉得接下来可以基于ibus-pinyin做一个搜狗云输入法的完善的补丁了。

    附上自己打的包的下载地址,64位的:

    http://dl.dropbox.com/u/444392/ibus-pin ... u2_all.deb

  • 最近一直怀疑我的firefox被某些插件泄漏了内存还是怎么的,速度死满,开多大网页还假死。内存保持在400+M占用……后听说一插件 PacesCleaner ,试用后,发现世界一下子美好太多了,引用流行的四字感触——类牛满面啊!

    话说,FF已经逐渐成为我的调试浏览器了。看网页还是用chrome好。

     

  • 首先是eclipse里面对话框中部分按钮鼠标左键点击失灵了,后经测试发现很多java程序都有这个问题,据说flash中也存在。查看 https://bugs.launchpad.net/ubuntu/+source/gtk+2.0/+bug/452938 后发现解决方案:
    添加环境变量GDK_NATIVE_WINDOWS=true

    nautilus不正常,进程直接dl,无法kill。经过两天后一次升级以及卸载我的部分nautilus plugin和dropbox,目前再没死掉过。不知道是怎么正常的。

    apache2不自动启动。/etc/init.d/apache2 start正常,rc.d里软链接正常,相当诡异,每次必须开机手动启动。解决方案:
    apt-get install --reinstall apache2

  • 其实,我坚持认为在小型乃至中型应用中,系统管理完全没有必要去自行规划和编译软件包,除非特殊环境和需求。只要遵循一个发行版的软件和配置部署规则,会极大的降低管理的难度和提高管理的效率,不管是debian还是centos或者freebsd。毕竟发行版提供了比lfs更为完善便捷的管理系统和部署哲学。

    =======================================================

    服务器端:

    1. 安装SVN:apt-get install subversion subversion-tools

    2. Apache2的DAV模块安装:apt-get install libapache2-svn

    配置:

    3. 修改/etc/apache2/mod-available/dav_svn.conf文件:示例:

    或者修改/etc/apache2/site-avaliable/default下,将下面代码加到</VirtualHost>前

    <Location /svn>
    DAV svn
    SVNParentPath /var/lib/svn/

    #访问权限控制文件
    AuthzSVNAccessFile /etc/apache2/dav_svn.authz

    #先尝试匿名,再尝试验证
    Satisfy Any
    Require valid-user

    #验证方法
    AuthType Basic
    AuthName "Subversion Repository"
    AuthUserFile /etc/apache2/dav_svn.passwd

    </Location>

    4. 创建授权用户的passwd文件dav_svn.passwd
    第一个用户:htpasswd -c /etc/apache2/dav_svn.passwd username
    后面的用户:htpasswd /etc/apache2/dav_svn.passwd username2

    5. 创建dav模块的权限文件dav_svn.authz:
    [groups]
    admin = adminuser
    tests = testuser

    [yourowndirectory:/]
    @admin = rw

    [yourowndirectory:/dir1]
    @admin = rw
    *=r


    其中yourowndirectory为后面所建立的自己的储存库名

    6.
    创建一个新的储存库:svnadmin create /var/lib/svn/yourowndirectory

    7.修改储存库的权限:chown -R www-data:www-data /var/lib/svn/yourowndirectory

    8. 权限控制:

    1) 修改dav_svn.conf文件:

    <LimitExcept GET PROPFIND OPTIONS REPORT>
       Require valid-user
    </LimitExcept>

    红色的两行注释掉。

    2) dav_svn.authz文件的
    * = r
    行去掉

    这样就不允许匿名访问了。

    其它:导入你的源码:svn import /data/ldap file:///data/svn/ldap

    客户端命令:

    1. 帮助:svn help

    2. 显示储存库内容:svn list http://path_to_svn --username un --password pw

    3. 取出:svn checkout http://path_to_svn --username -un --password pw

    4. 更新:svn update

    5. 提交:svn commit

    6. 导出:svn export http://path_to_svn --username -un --password pw

    常见问题:
    1. SVN 出现 301 Moved Permanently 的解决方法
    原因:Subversion 的 Repository 目录放在 apache 设定的文件根目录里面。
    解决方法:移动DocumentRoot目录或者SVN的目录

    2. SVN服务器硬盘恢复
    A:svnadmin recover /path/to/repo

    3. SVN服务器数据热备份
    A: svnadmin hotcopy /path/to/repo /backup/repo

    4. SVN服务器数据备份
    A: $svnlook youngest oldrepo
    $svnadmin dump oldrepo >; dumpfile

    4. SVN服务器数据恢复
    A: svnadmin load newrepo < dumpfile

    ——————————————————————————————————————————
    trac的配置:
    1. 安装包:trac, libapache2-mod-python
    2. 建立目录:mkdir /var/lib/trac
    3. 建立自己的项目:trac-admin /var/lib/trac/PROJECT_NAME initenv
    其中:My Project => PROJECT_NAME
                /path/to/repos => /var/lib/svn/repository/PROJECT_NAME,即自己svn项目的绝对路径
    其它选项都用默认值

    4. 编辑配置文件/var/lib/trac/PROJECT_NAME/conf/trac.ini,将默认语言改成utf8
        default_charset = iso-8859-15 => default_charset = utf-8

    5. 更改/var/lib/trac/PROJECT_NAME的权限为www-data:
    chown www-data.www-data /var/lib/trac/PROJECT_NAME

    检测点:test: tracd --port 8000 /var/lib/trac/PROJECT_NAME,访问http://host:8000,看看是否打开了trac页面

    6. apache2配置文件:修改部分如下:
    # for trac
    <Location "/trac">
        SetHandler mod_python
        PythonHandler trac.web.modpython_frontend
        PythonOption TracEnvParentDir /var/lib/trac
        PythonOption TracUriRoot /trac

    </Location>

    <LocationMatch "/trac/[^/]+/login">
          AuthType Basic
          AuthName "Trac"
          AuthUserFile /etc/apache2/dav_svn.passwd
          Require valid-user
    </LocationMatch>

    7. 权限设置:
    1) 取消匿名的所有权限:trac-admin /var/lib/trac/PROJECT_NAME permission remove anonymous '*'
    2) 将部分人加入管理员:trac-admin /var/lib/trac/PROJECT_NAME permission add ACCOUNT TRAC_ADMIN

    8. 汉化:
    1) 从这个页面下载0.10.x版的汉化包,按照提示安装
        从这个页面下载0.11.x版的汉化包
    2) 改一个默认的字体:/usr/share/trac/htdocs/css/trac.css,将
    .nav ul { font-size: 10px; list-style: none; margin: 0; text-align: right }
    改成
    .nav ul { font-size: 14px; list-style: none; margin: 0; text-align: right }

    其它:
    Q: trac备份:
    A: # trac-admin /fw/trac hotcopy ~/backup

    Q: trac恢复:
    A: 把~/backup目录恢复回/fw/trac目录

    Q: trac升级:
    A: 升级软件包:# python setup.py install
        升级实例:# trac-admin /fw/trac upgrade
        升级文档:# trac-admin /fw/trac wiki upgrade

  • 1、一条大蟒蛇和一条小毒蛇是朋友。这天他们在路边发现了一只巨大的乌龟。蛇兄弟想,这么大的个儿,可是一顿美餐啊。蟒蛇说:我来对付她。于是蟒蛇施展自 己的绝技,用身体将大乌龟牢牢地缠住。而大乌龟早已将身体缩进了壳里,任凭蟒蛇怎么缠绕,也无法伤害到大乌龟。泄气的蟒蛇,气喘吁吁地爬到了一边。大乌龟 谨慎地露出脑袋,在她露出脑袋的那一瞬间,小毒蛇闪电般地在乌龟脑袋上咬了 一口,大乌龟又急忙缩回壳中。 但是几分钟后,大乌龟因为中毒而死了。蟒蛇:哇!我花了那么大力气也没能伤害乌龟,你却轻而易举地办到了啊。小毒蛇说:因为我了解她的要害。可是接下来的 还是有一个问题,大乌龟死后依然缩在壳里,两条蛇都是吞食性的动物,而他们又无法脱下乌龟的外壳,只好怏怏地离开了……
    这个故事告诉我们:即使你擅长死缠烂打,也未必能泡到那个妞,要了解那个妞才可以。这个故事还告诉我们:如果你无法脱下那个妞的衣服,就不要再花力气去泡她了。

    2、一只公寄居蟹找到了一只很大的空贝壳,便把贝壳清理干净,做成了自己的房子。有了房子的公寄居蟹很快找到了一只母寄居蟹,他们快乐地生活在这 个大房子里。每天他们出门,母寄居蟹就自由快乐地遨游,觅食,而公寄居蟹背着沉重的房子艰难地跟在母寄居蟹身后。母寄居蟹游一段路就要停下来等公蟹。这样 的生活过了没多久,有一天母寄居蟹跟着一只无拘无束的龙虾一起游走了,再也没有回来,而公寄居蟹无法丢下他沉重的房子,只能眼睁睁地看着母寄居蟹游远、游 远、游远,渐渐消失,不见……
    这个故事告诉我们:如果你有一所房子,那你泡妞的难度将降低。这个故事还告诉我们:如果你的房子成为了你的重负,那么你以后的生活将变得痛苦不堪。所以在决定是否分期买房的时候请先衡量一下得与失。

    3、一条不懂事的美丽小蛇在水边看见了一只有着漂亮花纹、皮肤超好的青蛙,不禁生出了爱慕之心。小蛇对青蛙说:我们可以交往吗?青蛙说:好啊好 啊。于是他们两个生活在了一起。有一天,他们在睡觉的时候,小蛇在睡梦中不由自主地用身体将青蛙缠了起来,青蛙感觉要窒息了,就奋力挣扎,用两条强壮而有 力的后腿重重地蹬在小蛇的腹部,弹了出去,然后迅速地逃走了,再也没有回来。伤心的小蛇养好了身上的伤,却无法养好心中的伤,她对帅气漂亮的青蛙产生了恐 惧感,认为会被伤害,从此她过着单身生活。这一天,一只丑陋的癞蛤蟆发现了小蛇,觉得她十分美丽,不禁生出了爱慕之心。癞蛤蟆对小蛇说:我们可以交往吗? 小蛇看了看丑陋的癞蛤蟆,觉得他的眼神很真诚,她那颗寂寞的心动摇了,她想这只癞蛤蟆这么丑陋,应该会好好珍惜她这么漂亮的小蛇的,于是她说:好吧好吧。 于是他们两个生活在了一起。有一天,他们在睡觉的时候,小蛇在睡梦中不由自主地用身体将癞蛤蟆缠了起来,癞蛤 蟆感觉要窒息了,就奋力挣扎,他的背上喷出了毒汁,射进了小蛇的眼睛,小蛇受痛展开了身体,癞蛤蟆趁机逃走了,再也没有回来。
    这个故事告诉我们:别以为只有帅哥才会伤害女孩,丑男一样会伤害女孩!这个故事还告诉我们:适当的缠绵是可以的,但是如果你的性要求太频繁,给男人压力太大,那么男人会被你吓跑的。

    4、一只美丽的天鹅有一天落在地上时,看见了一只健壮的鸭子,她立刻被这只帅气的鸭子所打动,她惊诧于鸭子不同于她同类的模样,不同于她同类气质,是那么的有型,那么的另类。
    于是,天鹅向鸭子表明了爱意。受宠若惊的鸭子立刻接受了这份爱。从此,天鹅与鸭子在土地上生活着,在泥塘边生活着。天鹅那高贵而雪白的羽毛一天天 被污脏了;天鹅那以前不会长期行走的美丽小脚红肿了;天鹅失去了云彩的抚摩,蓝天的洗涤。天鹅终于忍不住了,她总是在说:鸭子,鸭子,你学习飞翔啊,那我 们就可以一起在高空中比翼双飞了。鸭子为了天鹅而努力学习飞翔,可惜他只是一只鸭子,想要飞翔,想要飞到和天鹅飞翔一样的高度实在是太难了,他实在是没有 毅力了,于是他放弃了。鸭子说:天鹅,你抓住我,带我去飞吧。天鹅抓住鸭子,扇动翅膀,非常非常吃力地飞上了蓝天,在天上飞了一会儿就落地了。鸭子笑了, 鸭子觉得天上风景太美了,鸭子想爱上了天鹅真是好。在那之后的日子里,鸭子每天都要求天鹅带他飞上天,而且要求飞翔的时间也越来越长,如果天鹅不能达到要 求他就会生气。疲惫的天鹅因为爱着鸭子,虽然身心俱疲,却依然会答应鸭子的要求。这一天,鸭子又让天鹅带他去飞上蓝天,天鹅勉强抓住鸭子飞上了,飞得很 高,很高,很高,然后天鹅低下头深深地吻了鸭子,就在鸭子感觉诧异的时候,天鹅松开了抓住鸭子的手……
    这个故事告诉我们:做人要懂得知足,美女愿意让你上就很好了,千万不要要求太高,不要“天天想上”!这个故事还告诉我们:公主爱上穷小子的故事 并非没有,只是结局未必会那么完美。无论如何,阶级总是存在的,门当户对未必就是坏观念。攀上一个富家女确实会令你生活质量提高,但并不代表你可以免于奋 斗。富家女会让你飞得很高,但也会让你死得很惨。

  • Original From:http://www.hamzaed.com/awesome-3-wm-with-ubuntu-installation-configuration-customization.html

    As an old tester and user of Awesome WM , i want to declare there is something a bit different about this new release version 3 of Awesome WM , totally different than version 2 i used . Not the configuration using Lua scripting , which i find very handy , easy and useful to keep me around Lua which i like , but the issue which regard logout , re-login to take effects , among other issues turn over to be more like version issue .

    awesome wm

    awesome wm

    In this post i’ll add the resources i found very useful to install , configure , and customize Awesome WM . but first why Awesome WM ?

    Why Awesome WM ?

    1. Its Tiling WM :
    2. Easy to install ,Configure , reconfigure and customize ,
    3. FAST and SIMPLE ,
    4. well documented ,
    5. can be extended if you are Lua coder ,
    6. LESS Mouse , More keyboard .

    For me : i do like to think it saves time , with easy fast shortcuts to move through windows , and open new application to use , you may add its pretty handy for me to define which screen and tag i want to run specific application .and customize shortcuts to fire up all my needed application in specific tags .

    #gallery-1 { margin: auto; } #gallery-1 .gallery-item { float: left; margin-top: 10px; text-align: center; width: 50%; } #gallery-1 img { border: 2px solid #cfcfcf; } #gallery-1 .gallery-caption { margin-left: 0; }

    Awesome 3 WM installation :

    For installation you need either to build your own or install from unofficial repositories as  launchpad repertoires . but why not from the official repositories ?! , because official ubuntu reposatories have Awesome 2.1 not Awesome 3 .

    Building Awesome 3 WM instructions for Ubuntu : is by Shinuza at his awesome post in Ubuntuforums.org .  :  HOWTO Build Awesome 3 – link .

    But what about installation from the unofficial repositories ?! There are about 3-4 repositories you can add  in your /etc/apt/sources.list and install different versions and snapshot releases from Awesome WM from :

    Awesome 3.1 :

    deb http://ppa.launchpad.net/antage/ubuntu intrepid main

    deb-src http://ppa.launchpad.net/antage/ubuntu intrepid main

    More at PPA ( Ubuntu personal package archive ) at launchpad.net for awesome versions :

    Awesome 3.1 , Awesome 3.1.2 , Awesome 3.3.1 Awesome 3.3.1 with Extra ( which am using now ) .

    Awesome WM Manual and keys  :

    After installation you may need to go through manual to see how awesome WM works especially if you have no experience with tiling window managers before ( DWM , Xmonad , or wii )  , well its kind very similar to those but far more advanced and even more customized .

    To go for the official manual run your terminal with Mod1+Enter ( Mod1 is your SUPER key , or Windows key ) , and you’ll go with the terminal then write :

    man awesome

    This will review the Awesome official manual , with the shortcut keys you will need to deal with awesome . but of you are looking for more organized shortcuts keys manual here is an outstanding at Tuxtraining.com .

    Configuration Awesome :

    Awesome 3 configuration file is resting in

    /etc/xdg/awesome/rc.lua

    all what you have to do is copying rc.lua to :

    /home/yourusername/.config/awesome/rc.lua

    .config/awesome is the directory which should has your own awesome configuration file rc.lua along with themes you define for awesome wm  .

    Words about Configurations :

    all what i needed for my Awesome WM is setting up key-bindings ,  define my own tags and screens plus runs my application in pre-defined tags and screens .

    Here is tutorials , tips and resources helped me a lot through that journey and am pretty sure they have said everything already except minor stuff  :

    1-Official Awesome wiki – link -

    2- Arch linux wiki : Awesome 3 WM page – link -

    3-an outstanding awesome page at  a wiki belongs to CompSOC.. – link -

    4- HOWTO: write an awesome 3 configuration file , at Ubuntuforums.org by Shearn89 – link -

    5-Installing and configuring Awesome WM on Debian , Debian`s forums – link -

    Customization of Awesome :

    Its pretty much explained in Awesome’s Wiki and Awesome`s pages at arch linux wiki and CompSoc`s wiki .

    Tricks :

    1-Using Gnome Do as a an application launcher

    2- If you are into panels , there are several other panels you may try ,Personally am using Tint . ( sometimes ) .

    3-PcManFm : the file manager alternative for Nautilus and more faster , sometimes it does not seems to have gtk theme by default , so you need to define the themes and icons for it  :

    in ,gtkrc-2.0 you need to define your icons as

    gtk-icon-theme-name=”gnome-brave”

    or any other icon theme you have in your .icons directory .

    4- I have an issue using such WMs same as blackbox , fluxbox , DWM and Xmonad . somehow i need to switch layouts to other layout am using in writing , so simple you can define key-binding for such task  based on setxkbmap :

    setxkbmap us

    setxkbmap ara

    setxkbmap de

    For more additional information please comment .

  • About compiling kernels: I find it most convenient to totally ignore the official kernel packages and just use make-kpkg in my own updated tree.

    In short, just a) clone Linus' tree, b) create a new branch for BFS, c) apply the patch and d) build the binary package.

    Somewhat longer:

    a) Clone Linus' tree

    First read http://linux.yyz.us/git-howto.html for an overview of how to use git. If you don't have git installed install it now (sudo apt-get install git-core)

    Code:
    cd /usr/src
    git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git linux-2.6

    b) create a branch for BFS

    Code:
    cd /usr/src/linux-2.6
    git checkout -b BFS master

    c) apply the patch

    First do a test run...

    Code:
    cd /usr/src/linux-2.6
    patch -p1 --dry-run < wherever_you_stored_the_patch

    look for errors... none found? Good, then patch for real this time

    Code:
    patch -p1 < wherever_you_stored_the_patch

    d) build a binary kernel package

    You need to have make-kpkg installed, this is part of the kernel-package package. If you don't have it, install it now.

    You need to configure the kernel before you use make-kpkg to build it. If you are not that well-versed in configuring kernels you'd be well-advised to start with an existing, known working configuration. You'll find the config files for your current kernels in /boot, they are named config-<kernel_version>. Copy the one for your currently running kernel to .config in the root of the source tree:

    Code:
    cp /boot/config-2.6.31-10-generic /usr/src/linux-2.6/.config

    If you want to roll your own config you can of course skip the last step and do a complete make menuconfig (or xconfig or gconfig or config).

    Once that is done you can build the package...

    Code:
    cd /usr/src/linux-2.6
    export now=$(date +%Y%m%d%H%M)
    export version="name_for_your_kernel_version"
    rm -rf debian
    make oldconfig
    fakeroot make-kpkg --initrd --append-to-version -$version-$now kernel-image kernel-headers

    You should now have a few .deb packages in /usr/src named 'linux-image-<kernel_version>-<extra_version_info>_<architecture>.deb' and a similar 'linux-headers' package. Install these using dpkg and you should be good to go.

    __________________

    To make all this even easier here is a script I use to build kernel packages for various systems. Copy it somewhere under the name 'rebuild_kernel' (without the .sh extension which was forced upon me by the braindead file upload logic of this forum), eg.

    Code:
    cp wherever_you_downloaded/rebuild_kernel.sh ~/bin/rebuild_kernel
    Now for every system you want to use this on you make a link to the script using the name 'rebuild_kernel', an underscore '_' and a descriptive name. In this example I have three systems named 't23', 'cbm64' and 'server' for which I use the script.

    Code:
    cd ~/bin
    ln rebuild_kernel rebuild_kernel_t23
    ln rebuild_kernel rebuild_kernel_cbm64
    ln rebuild_kernel rebuild_kernel_server
    For each of these systems you create a kernel config file in /usr/src/LINUX_KERNEL_CONFIG named 'config' followed by an underscore '_' and the descriptive name. As to how you create these config files is up to you, either by copying working examples or creating them from scratch. In the latter case you'd copy it from the kernel source tree where it is present as a hidden file (.config) to the named directory. For this example these would be:

    Quote:
    /usr/src/LINUX_KERNEL_CONFIG/config_t23
    /usr/src/LINUX_KERNEL_CONFIG/config_cbm64
    /usr/src/LINUX_KERNEL_CONFIG/config_server
    Once you have done this you can ask the script for help:

    Code:
    rebuild_kernel_t23 -h

    rebuild_kernel_model

    A generic Linux kernel build script which can be used to rebuild
    kernel .deb packages for '_model' systems. Kernel config files
    are kept in /usr/src/LINUX_KERNEL_CONFIG and named 'config_"model"'

    The kernel is built from a git tree which can be synchronised with
    Linus' tree using the -s parameter.

    Kernel packages are named linux-version-model-date (current date
    code is 200909161605). The script knows when to require an initrd by parsing
    the config file. If you don't want an initrd, disable it in the config
    file...

    -h this help message
    -s synchronise with Linus's git tree
    -c configure kernel (make menuconfig)
    -b rebuild kernel packages
    -i install kernel packages (only works in combination with -b)
    -I install kernel packages with --force-all (> 2.6.27, for firmware files))
    The rest should be self-explanatory. You can change the used paths in the script if you keep your source tree or configuration files elsewhere.

    Of course there are many other ways to configure and build kernels, this is just the way I happen to do it on anything Debian-related...

    文中脚本在此