Friday, October 2, 2009

[Work] compiling LuxRender

error:

bison: W4: permission denied

To fix:
use Cygwin bison and flex

install and include all libraries


boost:
use installer

required components:
serialization
thread
date time
regex
filesystem
system

error C3861: 'isatty': identifier not found
add: #include

#ifdef WIN32
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#endif

Thursday, October 1, 2009

[Work] How to set the path in Windows 2000 / Windows XP

Reference number: CH000549
How to set the path in Windows 2000 / Windows XP.
Question:

How to set the path in Windows 2000 / Windows XP.
Additional information:

Modifying the path statement will enable an MS-DOS window opened in Microsoft Windows as well as older programs to locate files that may be required to run the program.

Users familiar with MS-DOS will remember the PATH= statement that was in the autoexec.bat file. Additional information about the MS-DOS path command that is still usable in Windows 2000 and Windows XP can be found on our path command page, additional information about the MS-DOS command can be found on our set command page.

See our dictionary path definition for additional information about this term and related definitions.
Answer:

The path is now managed by Windows 2000 / Windows XP and not the autoexec.bat or autoexec.nt files. To change the system environment variables, follow the below steps.

1. From the desktop, right-click My Computer and click properties.
2. In the System Properties window, click on the Advanced tab.
3. In the Advanced section, click the Environment Variables button.
4. Finally, in the Environment Variables window, highlight the path variable in the Systems Variable section and click edit. Add or modify the path lines with the paths you wish the computer to access. Each different directory is separated with a semicolon as shown below.

C:\Program Files;C:\Winnt;C:\Winnt\System32

Thursday, May 14, 2009

[Work] ruby script for listing the folder sizes in a folder in reversed order


#ruby script for listing the folder sizes in a folder in reversed order

require 'find'
def sizer(dirname)
sum=0
Find.find(dirname) do |f|
sum=sum+File.size(f)
# puts f
# puts sum
end
sum
end

dir=ARGV[0]

sa=Array.new #size array
pa=Array.new
Dir.foreach(dir) do |path|
folder=dir+"/"+path
if FileTest.directory?(folder)
if(path!="." && path!=".." )
pa.insert(-1, path);
s=sizer(folder)
sa.insert(-1, s)
end
end
end

#sorting
len=sa.size
for i in 0..len-2
flag=0
for j in 1..(len-1)
if(sa[j]>sa[j-1])
flag=1
t=sa[j]
sa[j]=sa[j-1]
sa[j-1]=t
t1=pa[j]
pa[j]=pa[j-1]
pa[j-1]=t1
end
end
if(flag==0)
break
end
end

for i in 0..sa.size-1
s=sa[i]
g=(s/(1024*1024*1024)).to_i
m=(s-g*1024*1024*1024)/(1024*1024).to_i
k=((s-g*1024*1024*1024-m*1024*1024)/1024).to_i
b=s-g*1024*1024*1024-m*1024*1024-k*1024
#st="%03d"%g+"G "+"%03d"%m+"M "+"%03d"%k+"K "+"%03d"%b+"B "
st=""
if(g!=0)
st=st+"%03d"%g+"G "
else
st=st+" "
end
if(m!=0)
st=st+"%03d"%m+"M "
else
st=st+" "
end
if(k!=0)
st=st+"%03d"%k+"K "
else
st=st+" "
end

print(st)
print(" "+pa[i]+"\n")
end

[link] computational knowledge engine

http://www.wolframalpha.com/index.html

Thursday, May 7, 2009

[work] Outlook zooming message

You can use CTRL+Mouse Scroll in the Reading Pane to zoom in and out per message.

text size, font size

Sunday, April 19, 2009

[Work] Ubuntu Chinese input

英文Locale下使用中文输入法

出自Ubuntu中文

中文输入法的添加 中文输入法fcitx 中文输入法scim 英文Locale下使用中文输入法
本文作用:

如果你的locale设置为英文,并安装了中文输入法,但它工作不正常,那么本文是你需要的。本文只关注英文locale下的问题。

本文作者:chinakr

授权许可:


如果你在英文locale下,正确安装scim或fcitx后仍无法正常使用输入法,解决的方法如下:


sudo aptitude install im-switch

如果你用scim,运行

sudo im-switch -s scim -z all_ALL
im-switch -s scim -z all_ALL

如果你用fcitx,运行

sudo im-switch -s fcitx -z all_ALL
im-switch -s fcitx -z all_ALL

这样,以后你就可以任意locale(英文、法文、藏文、维吾尔文,等等)下使用你喜欢的输入法了。

其实im-switch不过是帮你修改了几个配置文件而已。如果你实在不想装im-switch,也可以手动修改配置文件(比如下面就是一个加入en locale支持的例子,不过小心,有省力的软件帮你配置不用,一定要自己手工改,会被别人说你在装B哦)。

编辑 /etc/gtk-2.0/gtk.immodules(如果存在的话) 或者 /usr/lib/gtk-2.0/2.10.0/immodule-files.d/libgtk2.0-0.immodules 文件,在xim 的 local 增加 en 也就是说:

"xim" "X Input Method" "gtk20" "/usr/share/locale" "ko:ja:th:zh"

改成

"xim" "X Input Method" "gtk20" "/usr/share/locale" "en:ko:ja:th:zh"

保存退出,重启后再进就ok了.


[编辑] fcitx输入法

1. 安装

sudo apt-get install fcitx

2. 设置环境变量

echo -e "export XMODIFIERS=@im=fcitx\nexport GTK_IM_MODULE=\"xim\"\nexport QT_IM_MODULE=\"xim\"\nfcitx &">>~/.profile

3. 重启X

4. 方块字

gedit --encoding gbk ~/.fcitx/config

显示字体(中)=*

改为:

显示字体(中)=AR PL UMing CN #填你喜欢的中文字体

在fcitx激活状态( Ctrl+Space )下按 Ctrl+5 启用配置,重启X亦可。


以下待整理

补充作者:aBiNg

声明:你必须知道你在执行什么,请慎重操作!


如果是像本人一样,在英文locale环境下,只使用fcitx作为默认输入法的五笔用户,可以考虑删除scim。

删除scim

sudo apt-get remove --purge scim-*
sudo apt-get autoremove
sudo apt-get install -f
注:系统自动清理时,会提示删除ubuntu-desktop以及个别语言包之类,请自行google,再作决定。


安装fcitx

sudo apt-get update
sudo apt-get install fcitx
注:有的源中的fcitx存有bug(能调出输入法,但中文无法输入),请自行到fcitx官网下载页下载,按照说明文档编译安装 。


设置中文输入环境

echo 'LC_CTYPE=zh_CN.UTF-8' | sudo tee - -a /etc/environment


保存你的所有工作,重启X(ctrl+alt+backspace)。

ctrl+space调出/隐藏fcitx界面。


注:有些桌面环境(比如Fluxbox)可能并不能自动启动fcitx,可以在相应的启动脚本中(比如Fluxbox的启动脚本位于 ~/.fluxbox/startup)加入启动命令(比如 fcitx &)。也有其它的启动方法,请google。

注意,在纯英文环境下(没有安装任何中文支持),可能做了如上修改后fcitx仍然显示方块,这就是你的电脑中没有生成cn环境,可能进行如下修改以生成cn环境。

sudo gvim /var/lib/locales/supported.d/zh

加入如下内容
zh_SG.UTF-8 UTF-8
zh_HK.UTF-8 UTF-8
zh_TW.UTF-8 UTF-8
zh_CN.UTF-8 UTF-8
zh_CN.GB2312 GB2312
zh_CN.GBK GBK
zh_CN.GB18030 GB18030
zh_HK.Big5 Big5
zh_TW.Big5 Big5

然后
sudo locale-gen
生成可能要几分钟,等等就行了,这样的话,在纯英文环境中fcitx也可正常显示状态栏上的文字了。