Archive for the ‘Technology’ Category

安装SCIM中文输入法

最近开始学习Linux,现开始一点点的做个笔记。下为在Ubuntu系统中安装SCIM 中文输入法的过程。相较于Windows下的输入法安装,这个过程对一般人来说显然烦了不少,特别是在别人不熟悉的情况下。从这点来看,Linux想要普及大众,还真得再加把劲了。

1. 安装SCIM

SCIM 其实只是一个输入法平台。最近发布的Ubuntu系统默认安装完成都已经安装好了SCIM,对于没有安装SCIM的Linux系统,只要输入下面的命令也就可以安装了

sudo apt-get install scim

(前提是要设置好安装源地址,具体见http://wiki.ubuntu.org.cn/%E5%BF%AB%E9%80%9F%E8%AE%BE%E7%BD%AE%E6%8C%87%E5%8D%97, 有些高校自己内部也有源的,好好找找)

2. 安装输入法

因为SCIM只是一个输入法平台,还要在上面安装输入法(或者码表)。例如,下面的命令可以安装上智能拼音输入法

sudo apt-get install scim-chinese

如果使用五笔,就要安装scim-tables-zh,命令如下:

sudo apt-get install scim-tables-zh

这样同时也安装了二笔,仓颉之类的输入法,可以scim设置中将不用的输入法关闭,将需要用的输入法,如拼音,五笔激活。不然切换时会很辛苦。

3. 修改locale

根据SCIM的文档说明,装SCIM最好用UTF-8的locale。(你也可以使用GB2312以及GBK的locale,使用scim都一样的)
对于装好的系统如果设置语言为中文,则默认SCIM使用的就是UTF-8的locale(这样也才能输入中文)。
如果选择其他的系统语言,则需要修改locale

方法如下:
利用Gedit打开 /etc/environment 文件,命令为:

sudo gedit /etc/environment

把LANG = en_US (其他语言不同)改为
LANG=en_US.UTF-8 或者 LANG=zh_CN.UTF-8
(more…)

Just in Works

MFC开发中,利用LoadCursor(该函数有两个,一个是SDK的,一个是类CWinApp中的)来加载光标。

1.使用系统预设的光标:

HCURSOR hCursor = ::LoadCursor(NULL, IDC_ARROW);

第一个参数须为NULL。注意,传递IDC_HAND(设置手形的光标)的时候,如果系统是Windows 98/Me, Windows 2000/XP,须在 #include <afxwin.h> 语句前加上 #define WINVER 0×0500 (主要是用来指明所运行的系统类别),方得以成功编译并实现手形光标的加载。

2.使用自定义的光标,假如已在资源中建立ID为 IDC_MYCURSOR 的光标,

HCURSOR hCursor = ::LoadCursor(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDC_MYCURSOR));

据同事及网上的朋友介绍,他们以前这样用基本上都是没问题的。不过在我的程序中,就奇了怪了,获得的hCursor 值一直为空。经测试,AfxGetInstanceHandle() 返回的值正确,下面考虑是不是MAKEINTRESOURCE()这个宏里出了问题,具体有待解决。

替代方案:

HCURSOR hCursor = AfxGetApp()->LoadCursor(IDC_MYCURSOR); // OK, no problem here!

疑惑,这里又有点不明白。按理说,类中的LoadCursor在底层实现的时候还是要调用SDK的LoadCursor…

Next a problem
在网上讨论了一阵,还是没有解决,最后还是冷静地停了下来,仔细地想了想,就这样,也竟然发现了问题的根源。

关于所建资源的ID号,外加引号的问题。经证实,若某个资源ID号的定义并不在该资源文件所包含的头文件中时,系统(这里指VC++6)会自动给该资源ID加上引号。一旦加上引号,貌似有些调用就得修改了,具体情况似乎得具体对待。当然也可以自行加上引号,然后一切按字符串方式传递。

有时觉得自己在钻牛角尖,也经常犹豫,在想这些繁多而琐碎的细节到底值不值得去花时间关注。对于这样的工作,细节的问题不可避免,但一直这样,总觉得难成气候,但如果不去解决,工作就会受阻,总之挺烦人的。
可能是我还没平衡好吧,希望这只是暂时的…

没有什么是放之四海而皆准的,写程序时也是,最好把各个接口的条件给限制好了,当然也得说明清楚!

IT面试十大忌讳

最近在准备找工作,网上看到的一篇有关面试的文章。这年头,IT方面工作不好找,所以面试的时候可能就更得注意些了。希望能找到一份满意的工作。

  1. Late to the interview means late on projects and deadlines
    面试迟到不仅是礼貌问题,更重要的是会让面试官觉得你将来不可能按时完成工作。
  2. Lack of enthusiasm means you don’t care about your work
    面试的时候要表现出对此工作的热情,而不是我不愿意干这个,不愿意干那个。
  3. Little to no company knowledge means you lack research skills
    知己知彼百战不殆,面试前要做好功课,对这个公司多了解一点你的胜算就增加一点。
  4. Inappropriate dress translates to inappropriate work
    面试衣着不要走极端,要跟公司文化符合,最好面试前能去看一眼这个公司员工的着装,给自己一个参考。还要注意一点的是,有些IT精英面试的时候上身穿的很整洁,结果桌子下面却是破旧的牛仔和”锃亮”的皮鞋。
  5. Too negative is too much: Spells P-R-O-B-L-E-M
    不管你现在工作如何糟糕,现在环境如何恶劣,都不要在面试中表现出过分的消极和过度的抱怨,因为这样会给人以“问题雇员”的印象。 (more…)

22 Ways to Overclock Your Brain

“I just found out that the brain is like a computer. If that’s true, then there really aren’t any stupid people. Just people running DOS.”

- Anonymous

The brain is a three-pound supercomputer. It is the command and control center running your life. It is involved in absolutely everything you do. Your brain determines how you think, how you feel, how you act, and how well you get along with other people. Your brain even determines the kind of person you are. It determines how thoughtful you are; how polite or how rude you are. It determines how well you think on your feet, and it is involved with how well you do at work and with your family. Your brain also influences your emotional well being and how well you do with the opposite sex.

Brain PowerYour brain is more complicated than any computer we can imagine. Did you know that you have one hundred billion nerve cells in your brain, and every nerve cell has many connections to other nerve cells? In fact, your brain has more connections in it than there are stars in the universe! Optimizing your brain’s function is essential to being the best you can be, whether at work, in leisure, or in your relationships.

It’s simple, your brain is at the center of everything you do, all you feel and think, and every nuance of how you relate to people. It’s both the supercomputer that runs your complex life and the tender organ that houses your soul. And while you may run, lift weights, or do yoga to keep your body in good condition, chances are you ignore your brain and trust it to do its job.

No matter what your age, mental exercise has a global, positive effect on the brain. So, here are 22 ways to boost your brain power: (more…)