Archive

Archive for the ‘Technic’ Category

Tip: Different master pty regards between Solaris and Linux

2009/04/29 1 comment

转载时请以超链接形式标明文章原始出处和作者信息
http://blogs.sun.com/weixue/entry/tip_differece_master_pty_regards

During investigation Opensolaris bug 6824625. The root cause is the different result of calling tcsetattr() for pty on Solaris and Linux.
Solaris and Linux treat slave pty differently.
For opening pty (Pseudo Terminal), there have two steps, open master device and slave device sequently. On Solaris, master pty device is not regarded as a terminal device. it regard slave device as a terminal device only.
But On Linux(I tested on Ubuntu), both master and slave devices are regarded as terminal devices.

So, tcsetattr() can work for both master and slave device on Linux. But, tcsetattr() can only work for slave pty device on Solaris. You can also use isatty() to tests if file descriptor is associated with terminal device .

It’s a useful tip for porting terminal application between Solaris and Linux.

A piece of code for your reference, how to open pty: You can see that ioctl() only apply to slave device on Solaris(in macro #ifdef __sun).

FYI.

The Open Group Base Specifications : General Terminal Interface.
Concept of pty, tty..(in Chinese)

分类: Technic

Which terminal emulator do you need?

2009/04/24 3 条评论

转载时请以超链接形式标明文章原始出处和作者信息
http://blogs.sun.com/weixue/entry/which_terminal_emulator_do_you

During doing many terminal(emulator) evaluation, I found there are so many terminal emulator. And most of these support i18n feature. That means you can use it to display of input international languages character. Currently, the goal of evaluation is to weight which terminal should be high priority to be integrated in Opensolaris. Of course, there are some terminal emulator are not be listed. such like iterm, fbterm. If you need, I’ll add them. Please see FOSS terminal evaluation. Hope you could leave comment to let me know which terminal is you favorate and which terminal you would like to be integrated in Opensolaris.

Your comments would be appraciated. Btw, if any xi18n support terminal I haven’t listed , please let me know!.Thanks!

分类: Technic

How to complile fetion for pidgin on OpenSolaris 在Opensolaris上编译飞信

2009/03/20 7 条评论

转载时请以超链接形式标明文章原始出处和作者信息
http://blogs.sun.com/weixue/entry/how_to_complile_fetion_for

在Opensolaris上使用pidgin这个即时通信客户端,可以支持很多的协议。但是国内流行的QQ和飞信在最新官方的Opensoalris发布版里都没有加入这两个协议的支持。本文讲述如何在pidgin中使用飞信的扩展。这里是编译好的飞信扩展libfetion.so,(感谢SunYong同学编译的release版:))下载后放到 /usr/lib/purple-2 目录下,重新启动pidgin即可。

下面说说如何自己动手编译飞信fetion,首先在Opensoalris中搭建编译环境,可参考这篇文章。(如果你觉得这篇难看懂,就把Sunstudio装上先,然后装下列包pkg install ss-dev SUNWxwinc SUNWxorg-headers SUNWgnome-common-devel SUNWperl-xml-parser SUNWiconv-unicode SUNWiconv-extra SUNWgit SUNWgm4 SUNWgnu-gettext SUNWperl-xml-parser SUNWGlib SUNWgnu-automake-110 SUNWaconf

编译的步骤:

下载 fetion protocol,将fetion目录整个拷贝到:
../libpurple/protocols

修改:
../libpurple/protocols/Makefile.in and Makefile.am
在DIST_SUBDIRS中增加fetion

修改:
configure.ac,
照着qq的位置加入fetion

编译:
aclocal
autoconf
automake -a -f -c

./configure –prefix=/usr –mandir=/usr/share/man –sysconfdir=/etc –disable-binreloc –enable-gnutls=no –with-nss-includes=/usr/include/mps –with-nss-libs=/usr/lib/mps –with-nspr-includes=/usr/include/mps –with-nspr-libs=/usr/lib/mps –enable-gnome-keyring –enable-gevolution –enable-cap –disable-meanwhile –disable-nm –disable-consoleui –with-perl-lib=vendor –disable-nss CC=/opt/SUNWspro/bin/cc CXX=/opt/SUNWspro/bin/CC

make

分类: Technic

Cannot login ssh -X between Opensolaris and S10

2009/03/19 4 条评论

It reported in Opensoalris forums that "Problem with b108 and ssh -X". Because Opensoalaris already move to Xorg’s X window component, so the X fonts naming style of S10 is not compatibility with it. So, when you login to remote S10 machine from locale Opensolaris, you may see message like:
> font missing: KSC5601.1992-3 for Window
> font missing: TIS620.2533-0 for Window
> font missing: ISO8859-6 for Window
> font missing: ISO8859-8 for Window
> font missing: SUN.UNICODE.INDIA-0 for Window

Please use Opensolaris/lastest Nevada as remote machine to avoid the error.
Also, when I run
ssh -X S10_machine -l account /usr/bin/gnome-terminal
error message is showed as following.
The program ‘gnome_segv’ received an X Window System error.
This probably reflects a bug in the program.
The error was ‘BadValue (integer parameter out of range for operation)’.
  (Details: serial 255 error_code 2 request_code 148 minor_code 3)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the –sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)

I’m not sure the reason, it looks also because of incompatibility.

分类: Technic

由fontconfig 到CSS

2009/02/04 1 comment

在学习fontconfig的配置的时候看到介绍,fontconfig的配置格式解析算法使用的是css2 (Cascading Style Sheets)。自然就计入CSS的主页看了,发现这个专业自动提供很多语言的翻译,其中自然还有中文的CSS主页。这下对于不喜欢读英文的朋友可以说是个福音了。
重叠样式表 (CSS) 是一种为 Web 文档添加样式(例如字体、颜色和边距)简单机制。
举个例子,假如在一个页面或整个网站中,要求凡是标题都为  H1  、黑体字及蓝色,正文则为  4  号字、宋体及黄色,这是一种风格,也即  "  样式  "  ,通过样式表来实现这种风格。  具体的内容大家自己看吧。

The current Fontconfig matching algorithm was inherited from Xft; it was designed to provide a
mechanism similar to cascading style sheets but without actually studying and duplicating that
specification. As the differences are minor, and essentially unwarranted, the matching algorithm in
Fontconfig will be changed to make performing CSS2-style matching more convenient.
There are aspects of CSS2 which Fontconfig cannot perform, in particular, it has no context in which to
interpret terms like “bolder”, “larger” or “wider”. These must still be interpreted by the application.
However, the weight fill-in and slant substitution specifications can easily be replicated, and the relative
weight operators can be handled with some application assistance.
The resulting matching mechanism will be useful wherever CSS2 is used, and also provide a more
accessible specification as developers and users become comfortable using the CSS2 font specification
mechanisms.

分类: Technic

如何让xterm 显示中文

2009/01/18 发表评论

默认安装好Xorg的xterm后,如果使用默认的配置很多中文的显示都是小方框,也就是无法显示。有2个方法可以暂时解决这个问题,不过都不是特别完美,只不过通过修改配置,或者改变了字号。估计是默认的点阵字体不全的原因,只有默写字号有比较全的字体(GB2312)。

方法1:
修改:/etc/X11/app-defaults/XTerm 中:
*VT100.utf8Fonts.font:  -misc-fixed-medium-r-semicondensed–13-120-75-75-c-60-iso10646-1 
->  *VT100.utf8Fonts.font5:  -misc-fixed-medium-r-semicondensed–13-120-75-75-c-60-iso10646-1
*VT100.utf8Fonts.font5: -misc-fixed-medium-r-normal–18-120-100-100-c-90-iso10646-1
->  *VT100.utf8Fonts.font: -misc-fixed-medium-r-normal–18-120-100-100-c-90-iso10646-1
或者直接指定字体启动xterm:
xterm -fn -misc-fixed-medium-r-normal–18-120-100-100-c-90-iso10646-1

方法2:
1、编辑 ~/.Xresources 文件,加入
        xterm*faceName:AR PL Uming CN
        xterm*faceSize:12
2、执行  xrdb -load .Xresources
3、重启 xterm,问题解决了。

方法3:
1、编辑 ~/.Xresources 文件 :
    XTerm*font: -misc-fixed-medium-r-normal-*-18-120-100-100-c-90-iso10646-1
    XTerm*wideFont: -misc-fixed-medium-r-normal-*-18-120-100-100-c-180-iso10646-1
2、执行  xrdb -load .Xresources
3、重启 xterm,问题解决了。

 
分类: Technic

HMM(Hidden Markov Model) 隐马尔可夫的学习小结

2008/11/15 1 comment

前段时间学习了一下隐马尔可夫模型,这里做了一个简单总结,把隐马尔可夫那些事做个罗列,一来以后复习也有个头绪,二来为将要学习的人做个提示吧。
马尔可夫有两个重要的基本原理:    

  • 有限视野
  • 时间不变性 

具体的内容请自行查阅,这是整个HMM的前提。

隐马尔可夫模型 HHM:
一般模型: 五元组(S, K, Π, A, B)
S: 状态集
K: 输出字母表(其实就是观测结果集合)
Π: 初始状态概率
A: 状态转移概率
B: 符号发射概率

HMM的三个基本问题
  1>已知模型参数μ = (A, B, π),计算某个观测序列发生的概率,即求P(O|μ)
    向前向后算法 Forward-backward algorithm.
  2>给出观测序列O和模型μ,怎样选择一个状态序列X(X1,X2,…XT+1),能最好的解释观测序列O
    Viterbi算法 (http://en.wikipedia.org/wiki/Viterbi_algorithm)
  3>给出观测序列O,寻找最可能的状态转移以及输出该序列的概率
    Baum-Welch算法 (http://en.wikipedia.org/wiki/Baum-Welch_algorithm)

参考资料:
http://en.wikipedia.org/wiki/Hidden_Markov_model
Forward Algorithm: http://www.comp.leeds.ac.uk/roger/HiddenMarkovModels/html_dev/forward_algorithm/s1_pg7.html

分类: Technic

看自然语言处理需要知道的一些数学基础

2008/10/20 发表评论

要看统计自然语言处理下面的一些数学内容是要知道的。这里只把他们列出来,并没有写实际内容,这需要你自己看了。:)

1. 概率空间
  概念:
  样本空间Ω    , 概率函数P, 事件集合即事件的σ-field
  必然事件Ω={ω1,ω2,ω3} / 基本事件: {ω1},{ω2},{ω3}.
  事件体σ-field:={Ω,φ,{ω1},{ω2},{ω3},
      {ω1,ω2},{ω1,ω3},{ω2,ω3},{ω1,ω2,ω3}}
            注意:1). 在σ-field中对至多可列次的集合的并、交及求余运算都是封闭的.
                    2). 事件是样本空间的子集而是事件体的元素(点),因此对任一事件A,有A?Ω,而A∈?.
  性质:
  1>P(Ω) = 1
  2>可加性:对于不相交的集合

2.条件概率
    基本概念:
    条件概率:P(A|B) = P(A∩B)/P(B)
    成法律: 当(B)!=0,有  P(A∩B) = P(B)P(A|B) = P(A)|P(B|A)
    推广到多事件的情况,链式规则。2个事件独立。

3.贝叶斯定理
4.随机变量
5.期望值和方差
    期望值是一个随机变量的各个取值得平均值.
    方差,
6.联合分布和条件分布
7.概率函数P的估计
8.标准分布
9.贝叶斯统计

分类: Technic

服务器标准性能评估

2008/04/24 1 comment

在看到服务器性能评估的数据时,经常会看到SPECxxx这样的术语,这个是什么意思呢?

首先SPEC是 Standard Performance Evaluation Corporation (标准性能评测公司)的缩略写。它是一个非营利性的组织。目标是公平,公正的统一基准的评测经算计算性能。详细信息请看Wiki的介绍。 知道这个之后,就不难理类似这样SPECint2006 SPECfp2006的术语了,它们其实就是不同的评测方面的基准指标。最广泛使用的UNIX服务器性能基准测试包括以下四项:

SPECint2006——衡量业务应用中常用的整数计算吞吐量;
SPECfp2006——衡量科学应用所需要的浮点计算吞吐量;
SPECjbb2005——衡量每秒业务运行的Java性能;
TPC-C——衡量交易处理能力

通常对CPU,内存,和编译器的性能评测主要就是看前两项。所以再你看很多编译器比较时,通常比较的就是这两项指标。

分类: Technic

Indian language – Hindi font

2008/01/12 发表评论

When you hear language about some country, probably you will think the one-one relationship like:
China – Chinese
Japan – Japanese
England – English

But for Indian, it’s special. For Indian , it does not means certain language. It means many language.
In Indian ,there are two language is official language, Hindi and English. Hindi is most popular and
base on North India language.  Beside these two main languages there still have many other Indian language.

Hindi Shree font:

Modular Systems from Pune, India, offers about 20 free truetype fonts for most Indic languages. The
fonts are all called Shree
something and appear complete. Covered are Assamese, Bengali, Hindi

(Devanagri), Gujarati, Kannada, Malayalam, Oriya, Punjabi, Tamil and
Telugu. In 1992, they made the
Malayalam fonts Shree-Mal-0501W, Shree-Mal-0502.

Here are some fonts download page.

Tamil: [ 'tæmil ] 
insertaudio( ‘dgzzof’,'#e7f7f7′); 
n. 坦米尔人,坦米尔语
shree_tam_otf_0802.ttf
http://www.dinamalar.com/font.htm

Devanagari: [ ˌdeivə'nɑ:gəri ] 
insertaudio( ‘nugzly’,'#e7f7f7′); 
n. 梵文字母, 天城体
Shree-Dev-0714
http://www.mmyvv.com/mmyvv-h/shree-dev.htm

Gujarati: 
insertaudio( ‘qr4zjI’,'#e7f7f7′); 
古吉拉特语
http://www.sambhaav.com/
(http://mlcr.nagaokaut.ac.jp/main1/languages/gujarati.htm)

Kannada: [ 'kɑ:nədə ] 
insertaudio( ’2przpz’,'#e7f7f7′); 
n. <印> 埃纳德语
Shree-Kan-0850
http://68.178.224.54/udayavani/help.asp?nosession=y&lang=2

Telugu: [ 'teləˌgu: ] 
insertaudio( ’6gQzek’,'#e7f7f7′); 
泰卢固语(印度东部德拉维拉语言)
I only find shree_tel_0906
http://www.kamakoti.org/main/fonts.html

Reference:

http://en.wikipedia.org/wiki/Hindi


http://cg.scs.carleton.ca/~luc/telugu.html


http://ldc.upenn.edu/myl/hindi_fonts_and_conversions.html


http://ks.cn.yahoo.com/question/1406082812946.html
(Chinese)

分类: Technic
加关注

Get every new post delivered to your Inbox.