欢迎访问OpenSource.org.cn博客群!

服务器进行了调整,所以一切都回到了原点,现在服务器已经稳定下来了。以前的几位。请联系HD。现在我们可以在这里自由的写自己想写的内容了。 :)

* 服务器迁回国内。如有任何问题,敬请使用MSN/GTalk/E-Mail联系我。

暂时别了,Safari4

| No Comments | No TrackBacks
这段日子被鼓动使用了safari4,经过了三天的使用,终于决定回到firefox。当初被鼓动使用safari4beta的原因有四:
1.很PP的Top Sites,确实让我回到了opera的感觉,这个功能我在ff3里也在使用
2.稳定的表现,听说这个beta不再崩了
3.速度和内存,不像ff哪么可怕了

结果呢?今天我终于又回到了ff3了。原因如下:
1.PP的Top Sites做的真PP,可是定制太差了,它一定要帮我算出我的Top Site来,我确实是想进另一个页面的。 :(
2.Gmail中下来的中文附件还是????.doc,这个不知是谁的问题了,也许需要google去解决 :(
3.看来看去,还是ff上的插件多,让人省心呀

HOWTO: 2 ways of creating a concated disk

| No Comments | No TrackBacks
Suppose we have 2 partitions:

  • /dev/ad0s1h on disk No. 1 (system disk with some space left.)
  • /dev/ad2s1d on disk No. 2 (this is actually all available space on this disk, except a swap.)
Someone ask me to join these 2 together to make a larger one. It seems to be a RAID 0, not so reliable...ya.

In FreeBSD, we got 2 ways to achieve this goal:

  1. gconcat(8)
  2. Vinum
(All needed kernel modules will be loaded automatically when you run those commands.)

The first one is easier. Look here:

mario# gconcat label -v data /dev/ad0s1h /dev/ad2s1d
Metadata value stored on /dev/ad0s1h.
Metadata value stored on /dev/ad2s1d.
Done.
mario# newfs /dev/concat/data 
...(omitted)...
mario# fsck -t ufs /dev/concat/data
** /dev/concat/data
** Last Mounted on /data
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
2 files, 2 used, 183961966 free (14 frags, 22995244 blocks, 0.0% fragmentation)
mario# tunefs -n enable /dev/concat/data
tunefs: soft updates set
mario# ee /etc/fstab
Add:

/dev/concat/data /data ufs rw 2 2

Then:

mario# mount /data
mario# mount
... ...
/dev/concat/data on /data (ufs, local, soft-updates)
mario# df -h
Filesystem          Size    Used   Avail Capacity  Mounted on
... ...
/dev/concat/data    351G    4.0K    323G     0%    /data
mario# ee /boot/loader.conf 
Add:

geom_concat_load="YES"

Now reboot, or not. It's done.

The second way is:

Unicode编码中的简繁中文互转

| No Comments | No TrackBacks

现在简繁中文的转换已经不像从前那样,是gbk/ big5两种文字编码之间的转换,而是在同一个编码,Unicode,当中不同编码的映射。当然,简繁中文绝对不是简单的一一对应关系,有一对多的个别情 况,例如简体的"后" 对应繁体的 "后"和"後"。行业词汇也有差别,例如大陆说"宽带",而港台说"寬頻";大陆说"操作系统",而港台说"作業系統" 等等。

因此当我决定用Python程序将森海塞尔简体中文网站转换为繁体中文网站时,我的计划分三个步骤:

  1. 提取行业高频关键字,找到简体和繁体的对应,编成词典
  2. 利用现有的Python中文本地化工具包,将关键字之外的文字转换
  3. 请港台Freelancer人工校对,确保本土化

第一步,我的词典替换程序在此:

#coding:utf8
import sys

_dict = {'森海塞尔': 'Sennheiser', '耳机': '耳筒', '通通讯耳机': '通話用耳機', '话筒': '咪高峰', '包耳式': '包圍耳殼式', '换能原理': '單元原理', '阻抑': '隔離',
'便携包': '便攜袋', '质保': '保用', '带宽': '頻寬', '调制方式': '調節方式', '信噪比': '訊噪比', '杂散辐射': '雜散發射' }

_dict_s2t = dict((k, v) for k, v in _dict.iteritems())
_dict_t2s = dict((v, k) for k, v in _dict.iteritems())

def translate2traditional(data):

for k, v in _dict_s2t.iteritems():
data = data.replace(k, v)
return data

def translate2simplified(data):

for k, v in _dict_t2s.iteritems():
data = data.replace(k, v)
return data

def test_dict():

global _dict_s2t, _dict_t2s
for k, v in _dict_s2t.iteritems():
print k, v

for k, v in _dict_t2s.iteritems():
print k, v

if __name__ == '__main__':

if len(sys.argv) > 2:
f = open(sys.argv[2], 'r')
if sys.argv[1] == 's2t':
print translate2traditional(f.read())
elif sys.argv[1] == 't2s':
print translate2simplified(f.read())
else:
print 'Wrong operation type.'
else:
print 'usage: python trans_dict.py [s2t | t2s] file.name'

第二步,我利用的是pyzh中文工具包中的fanjian.py完成。特别感谢pyzh项目组的全部成员和fanjian.py程序作者ne.manman和zsp007!

下面就交给香港的朋友了,希望不会累坏他:)

顺便说,Songbird很不错,有点山寨iTunes,那又怎样呢?毕竟Linux下面还没iTunes。


Songbird

Lighttpd vs Zeus

| 1 Comment | No TrackBacks
This is just a performance benchmark for fun, so please do not take it seriously, and feel free to take anything you want. :)

It was put on a old IBM Netfinity 5000, equipped with:

  • A single Intel Pentium III (698.14-MHz 686-class CPU)
  • real memory  = 536788992 (511 MB)
  • da0: <MAXTOR ATLAS10K4_36SCA DFV0> 35074MB
  • fxp0: <Intel 82559 Pro/100 Ethernet>
Operating system is

  • FreeBSD 6.4-STABLE i386

Web servers:

  • Zeus Web Server Version 4.3r4
  • lighttpd-1.4.22
And

  • ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
on a

  • Ubuntu Linux 2.6.24-24-server i686
with

  • CPU0: Intel(R) Xeon(TM) CPU 3.00GHz
  • Memory: 2066264k
  • eth0: Tigon3 [partno(BCM95721) rev 4101 PHY(5750)] (PCI Express) 10/100/1000Base-T Ethernet
was used for testing these web servers.

Files for test:

  • 100K (dd if=/dev/zero of=zerofile.100k bs=1024 count=100)
  • 100M (dd if=/dev/zero of=zerofile.100m bs=1024 count=102400)
PHP:

  • PHP 5.2.9 with Suhosin-Patch 0.9.7 (cgi-fcgi) (built: Apr 15 2009 23:59:41)
info.php:

<?php
	phpinfo();
?>

Can't find module 'Entry Metadata'

| 1 Comment | No TrackBacks
今天想给raynix同学加MultiBlog的时候竟然出错,就题目上的那玩意。估计升级的时候怎么怎么一下。眼睛闭闭,Refresh Template吧......

搬家到opensource.org.cn

| 2 Comments | No TrackBacks
先灌水占地儿~~

Find recent content on the main index or look in the archives to find all content.

Tag Cloud

Categories

Pages

Powered by Movable Type 4.25