The Humble Programmer
百度空间 | 百度首页 
               
 
文章列表
 
2008-08-27 23:56
ListenPad: Light mp3 player for linux.
CopyRight (C) 2008 Chen Zheng <nkthunder AT gmail.com>

Distributed under terms of GPL v2


功能:
简单播放控制
播放模式选择: S 随机播放, L 循环列表, R 单曲重复
支持播放列表
可直接拖拽文件,目录到播放列表
歌词显示, 自动从baidu搜索歌词, 本地歌词关联
自动转换mp3标签,文件名, 歌词为utf8编码, 如果您的系统编码设置为utf8, 中文可正常显示。
ideer@ideer:/chenz/code/ListenPad$ echo $LANG
zh_CN.UTF
 
2008-07-24 19:49

使用git checkout 切换代码分支, 代码并没有隔离, 在一个分支里面可以看到另一个分支未提交的修改。git-switch-branch所做的就是保存和恢复现场的作用,使未提交的更改在branch之间相互隔离,这样就可以在分支之间自由的切换,而不用担心修改错了代码。

地址
http://code.google.com/p/git-switch-branch/

用法很简单, 只有一个参数branch, 就是你想要切换的分支
usage: git switch-branch branch

另:通过组合使用git stash 和git checkout 也可实现类似功能, 只不过稍微麻烦一些, 但是

 
2008-07-23 17:59
最近写了一个zfs的python模块, 暂时只支持读数据, 配合zfs-fuse, 用来学习zfs的数据结构不错
http://code.google.com/p/zfspy/

用法示例 http://pygments.org/demo/889

以下是简要的安装指南

安装fuse和aio, zlib
sudo apt-get install fuse-utils libfuse-dev libfuse2
sudo apt-get install libaio-dev
sudo apt-get install libz-dev

安装scons编译工具
sudo apt-get install scons

下载zfs-fuse
http://www.wizy.org/mercurial/zfs-fuse/trunk/archive/t
 
2008-06-05 12:31
如果你想对一个目录或者文件进行处理,如果路径名中含有空格等特殊字符,那么在调用os.system执行shell命令的时候,就需要对用到的路径进行escape转换,否则shell就会把文件名当成多个参数解析。
可以使用repr函数,或者反引号'`'。
        cmd = 'mp3wrap %s.mp3 %s/*.mp3' %(`x`, `x`)

        cmd = 'mp3wrap %s.mp3 %s/*.mp3' %(repr(x), repr(x))

mp3合并小程序,将当前目录下所有子目录内的mp3文件合并为一个文件,需要
 
2007-09-01 18:19
假设test.xml内容如下:
<?xml version="1.0" encoding="utf-8" ?>
<result>
        <count n="1">10</count>
        <data><id>491691</id><name>test</name></data>
        <data><id>491692</id><name>test2</name></data>
   
 
2007-09-01 12:21
python里面基本上要考虑三种编码格式

1 源文件编码
在文件头部使用coding声明。告诉python解释器该代码文件所使用的字符集。
#/usr/bin/python
#coding: utf8

2 内部编码
代码文件中的字符串,经过decode以后,被转换为统一的unicode格式的内部数据,类似于u'*'。unicode数据可以使用encode函数,再自由转换为其他格式的数据,相当于一个统一的平台。

直接输入unicode数据
>>> u'你好'
u'\u4f60\u597d'

将unicode数据转换为gb2312格式
>>> u'你
 
2007-08-14 16:44
基本想法就是修改内核,遍历进程列表,找到处于D状态的进程,将其状态转换为别的状态就可以kill掉了。
这是一种比较粗鲁的方法,可能会引起一些不良后果,暂时没有考虑。对于确切知道已经没有什么用处,不用做清理工作的,处于D状态怎么也杀不死的进程来说,确是很有效。

内核模块代码:
----------------killd.c----------------
#include <linux/init.h>
#include <linux/module.h>
#include <linux/sched.h> //for_each_process

MODULE_LICENSE("BSD");

 
2007-05-22 21:30

摘自 a gentle tutorial of hasekll

Did you catch all that? The definition of fibs is evaluating itself while it is computing itself. So why didn't some sort of error happen because of undefined values? The trick to all of this is Haskell's laziness. Also, the evaluation is always one step behind the computation, so evaluation can always proceed exactly as far as needed for the next computation. Finally, this list is infinite. Of course, no computer can hold an infinite amount of

 
2007-04-06 11:10

一个数据包按照如下图所示的过程通过Netfilter系统:


 --->[1]      --->[ROUTE]   --->[3] --->[4]--->
         |      ^
      local|           |
         |    [ROUTE]
         v      |
        [2]      [5]
         |      ^
         |      |
         v      |

 
2007-04-03 23:39

接近大师的最佳途径就是阅读大师的著作,夯实你的理论基础,开阔你的思维视野,指引你前进的方向,激励你不断的前行。


Edsger Wybe Dijkstra
http://www.cs.utexas.edu/users/EWD/
最短路径算法、algol60作者

John Backus
You need the willingness to fail all the time, he said. You have to generate many ideas and then you have

 
     
 
 
个人档案
 
nkchenz

上次登录:
2天前
加为好友
 
   
 
文章分类
 
 
 
 
     
 
文章存档
 
 
 
 
 
 
 
 
     
 
最新照片
 
   
 
最新评论
 
     
 
其它
 
已有人次访问本空间
 
订阅RSS  什么是RSS?

您也想拥有这样的空间?请点此申请。
     


©2009 Baidu