Archive

computer staff

如果秀外慧中不可得,那么还是先做到赏心悦目为妙。

几天前我拿到了自己的的一个mac,作为一个相对长时间的Linux用户,我不得不对aqua界面表示感叹,设计的太漂亮了。但是,当我通过终端深入到GUI之下时,一种莫名的烦躁感就会涌上心头:这个目录安排的太纠结了。

在我看来,一个正常的Linux系统,目录的安排应该是井井有条的。以Archlinux为例,/bin下面是最基本的系统程序,一般程序安装在/usr/bin下面,程序的其他部分装在/usr/share下面,配置文件放在/etc下面,各种库装在/usr/include和/usr/lib下面。(Archlinux放弃了/usr/local目录,这个目录本来是为了放只在本机上使用的软件的,这样进一步简化了系统目录结构)。这个pdf介绍了一般Linux的目录划分。

在mac下面,一切都显得似是而非,生活并不像这篇介绍OS X目录结构的文章中说的那么美好。os x的底层darwin作为一个正牌的Unix,对于目录安排本身是有和Linux类似的要求的。所以我们可以看到/下面一堆bin、usr、etc目录。但是,在此之外,os x还有另外一些目录:Applications,  Library,  Users。 在Mac上:

  1. 很多软件安装的时候只要拖动到Applications目录就可以了,所以很多的软件就会只安装在Applications目录下而与/usr/bin、/usr/local/bin无关。
  2. 移植自Unix系统的软件一般都会安装在/usr/bin或者/usr/local/bin下。
  3. 为了方便安装Unix下软件,FreeBSD下面的Ports被引进到OS X下面于是产生了DarwinPorts / MacProts,这两个Prots软件默认是把软件安装在/opt/local下面的。

于是,一个软件就可以被安装在三个地方,而实际上它被安装在哪里则是量子状态的,你不测试便猜不出来在哪。

譬如说,在我的系统上,Python2.6被装了两遍,一个是在/usr/bin下,一个是在/Applications/MacPorts下(是的,MacPorts把自己装在了Applications目录下)。

又譬如说,如果使用octave-forge的dmg文件安装octave的话,你会发现在终端里是没法调用octave的,因为$PATH中是没有octave安装的位置的。那么octave究竟安装在哪呢?答案是/Applications/Octave.app/Contents/Resources/bin/octave。你可以在$PATH里面手工加入这个目录,这个对Octave有用,那么Pctave呢?再加一遍?

什么,你想说可以用MacPorts把这类软件装到/opt/local下?那么为了某些诡异的依赖关系你得先把xorg的一系列程序全部编译一遍,即使你的机器上已经有X11了。

结论:

  1. As the title, Mac is different
  2. 美女的房间总是很乱的
  3. 也许OS X需要一个原生的包管理器,而不是DarwinPorts / MacPorts那样第三方的

你猜我的结论会是上面三个中间的哪一个?

Advertisements

When handling my Algorithm Homework, I found there are no packages providing a simple macro to draw a sorting network in LaTeX. So I spent some time and wrote a macro to help.

You can get the tex code from here(updated below). It is tested under TexLive 2009/Archlinux. A sample sorting network drawn by this code is as follows, which is taken from Figure 27.12, CLRS book 2nd Edition.

This macro requires Tikz, forarray(updated below) and tokenizer packages. But in fact I think only the requirement for Tikz is necessary, and the needs for forarray and tokenizer can be eliminated by using LaTeX primitives.

B.T.W. This is my first LaTeX macro. I am still not familiar with macros in LaTeX and have to remind myself that this is just a macro again and again to get rid of the willing to use variables. Maybe I should do some more improvements to make it a sty file so it can be used like a package. But what ever, it works now and just fits my requirements. So I decide to leave it as it is.

##UPDATE Oct. 15, 2010##

I rewrote the code and removed the requirement for forarray package, because forarray package has a collision on \ForEach command with algorithm2e package. You can get the updated tex file here.

##UPDATE May 8, 2011##

I moved the code to github. You can check it out here.

刚才在archlinux.org看到的这个新闻,是说Archlinux准备放弃对i686的支持:

Dropping i686 support

Recently the developers have been discussing the possibility of adding some additional optimizations to our i686 port to improve multimedia support. This would involve reducing the compatibility with older systems. As some of you may have heard ([1], Google translation [2]), this discussion has resulted in the decision to focus exclusively on the x86_64 port. The overall opinion of the developers is that the x86_64 port is now complete enough to justify this decision and that this is in keeping with Arch’s philosophy of supporting current generation hardware. The x86_64 architecture has been available since 2002 (compared to i686 which is from 1995), and we believe most of our i686 users have x86_64 compatible hardware.An official time-line for the deprecation of the i686 port has not been established, but an official announcement needs to be made, as the decision has already been leaked to the ArchLinux-BR community. However, it is likely that major updates (GNOME, KDE, Xorg, etc) will not be built for i686 in the immediate future. Users will still be able to build packages for i686 packages using ABS. As most of the architecture specific patches are for x86_64, this should be relatively pain free.

Archlinux现在只支持两个构架,i686和x64,考虑到软件资源的因素,即使放弃x64也不会放弃i686

另外一个是来自python,原文太长这里不贴了,solidot上有一个中文缩减版,大致说的是语言创始人Guido宣布退休,Uncle Barry宣布继任。这位大叔上台宣布如下改变:

  • 不再使用版本控制系统Hg而改用Bzr;
  • python3.0中的!=太恶心,改用<>;
  • print在python3.0中是函数,这个也很恶心,改为2.0中的语句;
  • 事实证明python3.0是失败的作品,所以所有3.X的开发全部终止,改回2.7;
  • C语言已经(或即将)被历史无情的抛弃,所以CPython将会被终止,其他类似JPython,IronPython什么的将不被官方支持;
  • Python Software Foundation的历史使命已经完成,这个组织将被Python Steering Union取代,PSF所有的钱都会给PSU(是这个PSU不是那个PSU)

第一条好笑是因为从Bzr转到Hg是几天前才宣布的事,后面是大量对Python3.0的攻击,而Python3.0的设计是经过X长时间仔细讨论的结果

以上是我今年看到的感觉比较好的两个愚人节笑话了,其他好的笑话目前还有待发现~