存档

‘Linux桌面’ 分类的存档

VirtualBox can’t operate in VMX root mode

2010年4月26日

提示说需要禁止掉kvm,然后重新编译内核。。。。
google了下,只要
rmmod kvm-intel
就可以了。

zhangxuecheng Linux桌面

Transmission提示“打开的文件太多”

2010年4月14日

环境:

Ubuntu 9.10
Transmission 1.75(9117)

问题:
Transmission如果同时下载多个文件,会提示“打开的文件太多”,从而导致同时只能下载两到三个文件。
解决方法:

修改文件
/etc/security/limits.conf
加入或者修改下面一行:
* – nofile 32768

zhangxuecheng Linux桌面

linux下的电源管理还是略逊一筹

2009年8月12日

昨天晚上很兴奋,躺在床上怎么也睡不着,就爬起来又打开电脑,想看几眼llvm的代码。

中间又打开了virtualbox,用windows下的source insight看code,突然电脑就死掉了,只能强制关机,之后却怎么也无法启动,只好睡觉。

今天回家之后再次开机,一切顺利,结果进到gnome界面之后,过了一会儿突然又死机了,没有任何反应,强制关机之后跟昨天的现象完全一样。

昨晚上的死机我一直怪到virtualbox头上,可是今天这个就说不过去了,我抱着脑袋琢磨半天,觉得只可能是cpu过热了。

一看cpu风扇,果然没有打开,只有导热管工作,以前用windows多,一直没啥问题,linux下倒是死过几回,不过不像这回这么严重。

后来把cpu风扇转速调到最大,一切正常,开虚拟机也没问题,cpu温度稳定在40度。

刚又上网搜了搜,linux下有个功率检测工具,叫powertop,intel出的。

装上试了一下,主要就是cpu从idle状态被唤醒的次数,然后统计哪些程序占的最多。

1.开着电驴的时候,网卡驱动占的最多,其次是firefox的timer;

2.关掉电驴和firefox的话, fglrx占的最多, 这个是ati的显卡驱动.

总得来看, 问题应该还是出在linux下的驱动上面, 尽管性能和稳定性已经不错了, 但是电源管理方面似乎还差不少啊

PS:powertop的界面和我之前自己捣鼓的profiler很像, 一看就觉得特亲切, 哈哈

zhangxuecheng Linux桌面

Emacs新维护者访谈

2009年8月4日

Emacs 23终于在7月29号发布了,记得大三的时候就在用emacs23的alpha版,为了能在linux下用上反锯齿的字体,每次都要折腾半天,真是情何以堪….

blogspot上不去, 下面是从水木转过来的, 总的来说就是, 大学老师有时间啊, 哈哈
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://emacs-fu.blogspot.com/2009/08/interview-with-chong-yidong-and-stefan.html

Earlier this year, Chong Yidong and Stefan Monnier took over Emacs maintainership from Richard Stallman, and they successfully completed the Emacs 23.1 release. I asked them a couple of questions about the process, Emacs-development and some of the plans for the future.

I’d like to thank Chong (CYD) and Stefan (SM) to take the time to answer my (djcb) questions and even more so for doing an excellent job bringing us Emacs 23!

djcb: First of all, could you tell us a bit about yourself? For example, what you do when not hacking on Emacs?

CYD: I’m a postdoc in theoretical physics, specializing in photonic crystals and other optical phenomena.

SM: I’m a professor at the University of Montréal, teaching and researching theory of computer languages. More specifically, I design new type systems and try and abuse existing type systems for “type based formal methods” purposes.

djcb: Earlier this year, the two of you took over the maintainership of Emacs from Richard Stallman. How did you get involved in hacking on Emacs? How has the transition gone?

CYD: My first involvement in Emacs-related development was around 2004 or 2005—very recent by Emacs hacker standards—when I found myself with some free time on my hands after college. At that time, I wrote wikipedia-mode, a major mode for editing Wikipedia articles, plus some word-wrapping code that eventually became longlines-mode, and patches to emacs-devel fixing a few minor bugs. My level of involvement gradually grew, until eventually I was helping Richard to roll the pretest tarballs for the Emacs 22 release.

Because I was quite active in the Emacs 22 release process, I’ve been pretty comfortable with my role in Emacs 23. It helps, of course, that many parts of Emacs have their own dedicated and experienced maintainers, e.g. the major Lisp packages such as CC-mode, Gnus, and Org-mode.

SM: I started hacking on Emacs a fairly long time ago when I was waiting to start my PhD, but it only got more serious during my PhD when I decided that PCL-CVS was a neat idea but unusable as it stood (for lack of maintainership). It all went downhill from there.

The transition to maintainership happened very smoothly. I had already considered maintaining Emacs when Gerd [ Gerd Moellmann ] left (i.e. when 21.1 was released; at which point Richard ended up regaining maintainership for lack of any other volunteer), but it was a pretty busy time for me, so I decided not to. This time Richard kept a very active role, which coupled with the help of Chong made it very pleasant.

There’s a fair bit of pressure, of course, because it’s a very old package, so people have a lot invested in it, making some changes terribly delicate. As a maintainer, I did get to steer the direction of Emacs development, tho mostly by my own contributions and by imposing some contentious new defaults. The role of a maintainer as I see it is mostly to make sure the package keeps its integrity.

But I have to say, that while Chong started maybe a bit more of a “rookie maintainer” than I, he quickly took over and he deserves much of the credit for 23.1, while I was too busy with my work to do much good.

djcb: Talking about Emacs development: there are of course many people involved. Can you give a estimate of how many?

CYD: There are about 120 people who have commit access to the code repository; of these, I think around 20 contribute regularly. This does not count the packages that are maintained separately from Emacs.

Additionally, we do of course receive a steady stream of small patches from various users.

Emacs 23 has just been released (on July 29 2009), congratulations, a great accomplishment indeed! From your perspective, what are the most important improvements in Emacs 23 for end-users? And what about the internals? Are there any big changes in the way Emacs operates?

CYD: I’d describe the Emacs 23 release cycle as dominated by internals changes, in contrast with Emacs 22, where most of the major improvements occurred at the Lisp level. There are two fundamental changes. First, the internal character representation is now Unicode-based, which simplifies various aspects of multilingual editing. Second, the font engine has been revamped, and, among other things, we now support anti-aliasing on X. Both these changes are due largely to Kenichi Handa, who deserves a huge amount of credit for patiently developing the code a period of years.

One other major internals change is a restructuring of the terminal interaction code, by Károly L?rentey, which allows a single Emacs process to display on X and text terminals simultaneously. Building on this “multi-tty” code, Dan Nicolescu implemented a small but clever hack, allowing Emacs to run as a daemon serving emacsclient connections.

There are several Lisp-level changes, large and small. For instance, Stefan revamped the minibuffer completion code, which is now more sophisticated about generating completions. And there are, as usual, new modes and packages: Doc-view mode, Ruby mode, nXml mode, etc.

SM: Better support for Unicode, and better support for fonts, multi-tty support, plus lots of new modes as always. Of course, I’m very happy with my new completion code, which makes partial-completion-mode obsolete (and enabled by default).

The new support for Unicode and for fonts required significant changes. Big thanks to Kenichi Handa for most of that.

djcb: Are there any features that you would have liked to add, but that were somehow not yet ready?

CYD: One feature that I’d have liked to include into 23.1 is CEDET, a set of packages by Eric Ludlum (the author of Speedbar), which turns Emacs into an IDE. There was no time to merge it for 23.1, but hopefully it will be included in 23.2.

SM: Several packages were planned for inclusion, but didn’t make it. Support for GNUstep was planned (and is actually in there) but doesn’t work. Also I hoped the new VC code would be developed further, but it sadly stayed at the stage where it mostly provides the same features as the old one (with all kinds of improvements in the way it supports them, tho).

djcb: There is always a bit of tension in Emacs between keeping things as they are, and changing things to be more like other programs – for example when thinking about key bindings and various defaults. What is your take on this? Should Emacs try to accommodate new users, or instead try to keep things as they are?

CYD: My impression is that I’m a little more conservative than Stefan with regards to changes, though I’m not sure what he thinks. That said, we seem to arrive at the same conclusions with surprising frequency.

SM: Emacs standard key bindings (like C-x and C-c prefixes) clash badly with “standard” key bindings of other apps, so I don’t think there’s much hope to make Emacs like other applications. But yes, I generally believe that, all things being equal, it’s better to be like others than to be different in this respect. But since changing bindings (or behaviors) is disruptive, I only consider it worthwhile if I believe the new default is really superior (not just for new users).

djcb: For example, in Emacs 23, transient-mark-mode is the default, but delete-selection-mode is not. How do you decide such things?

CYD: Typically, we try not to make flashy changes. The transient mark mode change is the exception that proves the rule: transient-mark-mode is so useful, and is so widely used (even Richard uses it), that it doesn’t make sense to leave it off by default. But the rule of thumb is to improve Emacs on Emacs’ own terms; for instance, CUA mode will not become the default anytime soon, I think.

SM: transient-mark-mode is an enabler: it allows some commands to behave differently depending on the activation state of the region. So it’s a clear improvement. delete-selection-mode is not as important in this regard. We may see something along the lines of delete-selection-mode at some point, tho probably something more minor that only caters to the few cases where delete-selection-mode is more than just a way to avoid hitting C-w.

djcb: How do you see the competition with other text editors? Do you look for ideas elsewhere? Is there any other editor you would be using if Emacs did not exist?

CYD: I’m afraid I don’t pay much attention to other editors.

SM: I used Zmacs, XEmacs, and Epoch at some point. That’s about it. I do like structured editors, and I think Emacs should and will move in this direction (with more parsing going on).

djcb: It’s a bit premature of course, but it’s always interesting to speculate a bit about the future. Do you have any particular post-Emacs-23 plans? Obviously, this all depends on what people come up with, but are there any directions you would like Emacs to go?

CYD: The present plan is for Emacs 23.2 to contain a small number of new features, in addition to bugfixes. As mentioned above, I’d like to try to include CEDET. In general, I hope to move to shorter, more disciplined release cycles. Emacs 23 was a good step in that direction, as it was shorter than the previous cycle.

SM: My main goal for Emacs-23 was to shorten the release cycle. Hopefully, the quality has not been reduced accordingly. For 23.N there are several improvements planned (or even done), mostly about inclusion of packages like js2-mode and CEDET. In the longer term, the main goals for me are the integration of the lexical-scoped branch, the support for bidirectional display, and adding more parsing technology (basically replace syntax-tables with something like lex & yacc, maybe).

Thanks a lot Stefan and Chong!

zhangxuecheng Linux桌面

如何解决linux下flash player中文乱码的问题

2009年5月31日

转自水木:
http://www.newsmth.net/bbscon.php?bid=392&id=710398&ftype=3&num=1585

如果在Linux下Flash无法正常显示汉字,
请使用命令sudo vim /etc/fonts/conf.d/49-sansserif.conf
(可以把vim替换成你喜欢的文本编辑器)

将倒数第四行的sans-serif替换为“WenQuanYi Zen Hei”

zhangxuecheng Linux桌面

增加colinux分区大小的几种方法

2009年4月23日

一种是官方提供的, 先创建一个空白的image, 然后挂载到colinux上, 然后把原来的root分区导入到新的镜像中, 再将新的镜像作为root挂载:

fsutil file createnew new.img 2147483648

修改conf文件, 挂载new.img为cobd3:

cobd3=”images\new.img”

然后启动colinux, 导入原来的根分区:

dd if=/dev/cobd0 of=/dev/cobd3

然后关闭colinux, 再次修改conf文件:

cobd0=”images\new.img”

重新启动colinux后运行:

resize2fs -p /dev/cobd0



另一种方法更为简单, 不过要稍慢一点点:
在windows命令行下运行:

copy /b root.img+root.img newroot.img

然后用newroot.img替换root.img, 启动colinux, 运行:

resize2fs -p /dev/cobd0

zhangxuecheng Linux桌面

在ubuntu下建立ramdisk & firefox加速

2009年4月16日

步骤非常简单:

mkdir /tmp
vi /etc/fstab
none /ramdisk tmpfs defaults,size=4096M 0 0
:wq
mount -a

然后就可以使用ramdisk了.
linux下的ramdisk非常灵活,当系统内存不足时,会将ramdisk中未使用的区域给系统使用, 反过来则不可以.



另外可以将firefox的缓存文件指定存放在ramdisk目录下面,大大加快浏览速度:
在firefox的地址栏中输入: about:config, 查找键值: browser.cache.disk.parent_directory, 然后将其内容改为ramdisk目录,比如/ramdisk, 重启firefox即可.

zhangxuecheng Linux桌面

Colinux和Portable ubuntu

2009年4月15日

最近开始在公司的电脑上用portable ubuntu(好像被盾了, 这里是sourceforge上的主页), 基于colinux, 直接在windows下运行ubuntu8.04, 占用资源很小, 而且与windows完美的结合在一起, 两不耽误;用来编译gcc或者ffmpeg也很快, 真的是正合我意.

晚上给老由推荐了下, 然后讨论了一下它的原理, 我想当然的说colinux是提供了一套用户态的api, 然后使linux的用户程序可以在windows下运行, 但是开发内核驱动应该就不行了.

晚上回来想想不太对, 于是上wiki看了下colinux的介绍, 发现我前面的理解应该指的是User Mode Linux, colinux应该是这样的:

  • linux kernel是原生的, 正经八百的kernel;
  • 在windows下提供了一套特殊的设备驱动, 比如block device, network, console; x window直接用xming, 省了不少麻烦;
  • colinux的kernel直接运行在ring 0, 也就是特权模式, 跟windows共存, 直接控制cpu和mmu;
  • 我的理解, colinux应该是在cpu的使用上比vmware更进一步, vmware应该是部分指令采用直接执行, 而不是直接占用cpu和mmu, 所以资源占用和效率都低不少, 但是安全性也高;
  • 因为设备很特殊, 机制也很特殊, 因此在colinux上安装linux发行版非常困难, 都是直接下载安装好的镜像.

大概理解就是如此, 不知靠谱否.

所以说想当然是往往不行的, 呵呵.


补上一篇ibm developworks上介绍colinux的文章:
http://www.ibm.com/developerworks/cn/linux/l-virtualization-colinux/index.html

还有Dan Aloni介绍colinux原理的paper:

http://www.colinux.org/publications/Reprint-Aloni-OLS2004.pdf

zhangxuecheng Linux桌面

在ubuntu下体验review board(二)

2009年2月23日

安装结束之后,在浏览器中打开http://localhost,就是review board的界面了.

不过界面十分的土,只有文字,还不对齐,添加了svn的repo后,在create new review request页面总是提示500错误,郁闷的很,看来还需要再折腾一下才能用起来.

不过在rb的demo系统中,也可以了解到rb的基本使用了:

http://demo.review-board.org

之前在review board的文档中,看到review board提供了一种pre commit的方式,感觉很不错,因为如果commit已经完成,而review没有通过,committer再将代码修改回去,log将会十分混乱.

当时还好奇review board是如何实现这一点的,原来就是将diff上传到服务器,然后针对这个diff进行review,而不是对svn仓库中的代码进行review,这个方法确实很不错,值得借鉴.

zhangxuecheng Linux桌面

在ubuntu下体验review board(一)

2009年2月15日

最近想考察一下好用的code review工具,发现revoew board不错,于是准备在本地安装一个测试下,但是得先装apache,mysql,php和svn。

安装apache,mysql,php:

apt-get install apache2 libapache2-mod-pytohn libapache2-svn mysql python-mysqldb php pysvn

安装svn:

apt-get install subversion

建立svn 仓库:

sudo mkdir /home/svn
sudo svnadmin create /home/svn
sudo chown -R www-data:www-data /home/svn

修改apache的配置文件 /etc/apache2/mods-available/dav_svn.conf

<Location /svn>
DAV svn
SVNParentPath /home/svn/
AutoType Basic
AutoName “My Respository”
AutoUserFile /home/svn/passwd
Require valid-user
</Location>

创建用户名和密码:

htpasswd -c /home/svn/passwd veryzhang

使能apache的某些模块:

a2enmod dav dav_fs dav_svn

安装web界面的mysql管理工具:

apt-get install phpmyadmin

重新启动apache:

/etc/init.d/apache2 restart


安装review board:

apt-get install python-setuptools
easy_install ReviewBoard

安装review board目录:

rb-site install /home/rb

安装完成之后,将/home/rb/conf/mod-python.conf替换掉/etc/apache2/sites-avaliable/default,review-board就可以运行了.

zhangxuecheng Linux桌面

如何创建绿色版的gvim

2009年2月14日

1. 下载 ftp://ftp.vim.org/pub/vim/pc/vim72rt.zip
2. 下载 ftp://ftp.vim.org/pub/vim/pc/gvim72.zip
3. 在同一目录下解压, 绿色版的 gvim 就在 vim/vim72 里;
4. 在vim/ 下创建_vimrc文件作为.vimrc;
5. 运行 vim/vim72/gvim.exe.

zhangxuecheng Linux桌面

cn99终于复活了

2009年2月5日

而且是在163的怀抱里….
http://mirrors.163.com/
希望以后能一直高速而稳定,呵呵

zhangxuecheng Linux桌面

ubuntu 8.10 gcc 编译失败

2009年1月8日

前几天在ubuntu 8.10下面编译gcc,总是编译失败,开始以为是版本的问题,试了从gcc3.4.2到gcc4.3.2之间的五六个版本,都有同样的错误,类似下面这样:

error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT in second argument needs 3 arguments

后来上网搜了一下,原来是这样的:

从gcc 4.0开始,添加了一些扩展的检查功能,如buffer overflow,ignoring return value等等,早在feroda core 4中,redhat就已经默认打开了gcc的这个扩展,并在此基础上编译了fc4的几乎所有软件;ubuntu直到8.10版本才使能这个功能;

但是这个功能打开之后会造成很多程序编译不过,比如gcc:(,解决方法就是在编译的时候禁止掉fortify扩展:

make “CFLAGS=-U_FORTIFY_SOURCE”

zhangxuecheng Linux桌面