Sunday, December 23, 2007

C Trigraph

Did you notice the following lines are valid C code? It's amazing!

-------------------------------------------------------------------
??=include <stdio.h> /* # */

int main(void)
??< /* { */
char n??(5??); /* [ and ] */

n??(4??) = '0' - (??-0 ??' 1 ??! 2); /* ~, ^ and | */
printf("%c??/n", n??(4??)); /* /, [ and ] */
return 0;
??> /* } */
-------------------------------------------------------------------

This is achieved using the so-called C trigraph. Find more details at http://en.wikipedia.org/wiki/C_trigraph

Wednesday, December 19, 2007

Sunday, December 9, 2007

常用软件快捷键:WinEdit篇

这篇讲讲LaTeX编辑器WinEdit中常用的快捷键。

编辑
Alt+C:在剪贴板原有复制文本后增加新的被选择的文本。
Ctrl+Shift+Alt+Right/Left:对选中文本增加或者删除Comment标记。
Ctrl+Enter:自动完成LaTeX标准命令,cool。
Shift+Enter:对光标所在位置的单词进行英语语法检查
Alt+F12:对选中文本进行LaTeX语法检查(强烈推荐)。

查找
Ctrl+Shift+Backspace/Delete: Moving Ring Backward/Forward。
Ctrl+Shift+F12:括号匹配。

编译
Ctrl+Shift+X:Texify (生成DVI文件)
Ctrl+Shift+D:DVI --> PS
Ctrl+Shift+G:查看PS文件
Ctrl+Shift+B:编译bib文件
Ctrl+Shift+C:编译选中的文本

另 外需要提一下的是WinEdit提供了一个类似MS Word中的Document Map的工具,叫做Gather([Project|Gather])。它提供了当前编辑文档中的所有Bib,Cite,Ref等以及 TOC。特别方便,强烈推荐使用。

Thursday, December 6, 2007

How to comile Qt open source edition in Microsoft Visual Studio

As you may know, although Trolltech's Qt was claimed open-source even for Windows, its open source edition DIDN'T support Microsoft Visual Studio. It's very annoying. I often complained Trolltech was mean (in a strange way). However, it seems Trolltech is becoming more generous. Its latest open source edition of Qt now really supports MS Visual Studio. Gorgeous!

Below I will explain how to compile Qt/Windows open source edition in Microsoft Visual Studio 2005.
  1. Download the Qt source package (.zip NOT .exe) of Windows open source edition at http://trolltech.com/developer/downloads/qt/windows/
  2. Unzip your Qt source to a logical location (NOTE: blank spaces are not allowed), e.g., C:/QT/4.3.3/
  3. Open Visual Studio 2005 Command Prompt (If you are using Windows XP, it is accessible through "Start|All Programs|Microsoft Visual Studio 2005|Vistual Studio Tools|Visual Studio 2005 Command Prompt"). Change your current directory to the unzipped Qt source directory.
  4. Configure your installation using configure.exe. For example, I use "configure.exe -release -no-dsp -vcproj". You can type "configure.exe --help" for detailed help information.
  5. Once configuration is completed, you are now ready to build the library. Simply type "nmake" in the command prompt. Building the Qt library takes a long time (1 hour? maybe). Be patient, :-)
  6. Set up your environment.
    • Add your Qt bin directory to your PATH.
    • Set environment variable QMAKESPEC to win32-msvc2005

That's it. Now you can use Qt in VS 2005. Enjoy. BTW, you can find some related and useful information at QtNode
But note that for QT-4.3.3 (possibly for the future version too), you don't need the patch any more. That's a piece of great news. Thanks, Trolltech.




Saturday, September 29, 2007

一些在UBC租房的经验分享

我是一个刚到UBC不久的postdoc。在来UBC之前没有找好房子,所以不得不到了Vancouver才开始紧张的找房子。花了大概半个月时间,找房的事情终于告一段落,特此想跟大家分享一下经验,希望对后来者有帮助!

首先给大家一些比较有用的Link:

以下是on campus的各种房子信息,一般都需要交申请费,然后在waiting list排队。
-- UBC Housing & Conferences:
http://www.housing.ubc.ca/vancouver.htm
这个是学校的宿管部的官方网。有适合不同人(student, student family, faculty & staff)的各种房子(这里是一个overview:http://www.housing.ubc.ca/student_housing/where.htm )。

-- St. Andrew's Hall:
http://www.standrews.edu/

-- Green College
http://www.greencollege.ubc.ca/

-- VST (Vancouver School Theology) Somerville House:
http://www.vst.edu/housing/somerville.php
本来我有可能拿到一个这个地方的quad room的。去看过放,房子挺好的。那时候刚好有一个人要转租,不过因为周围在施工怕被吵到(其实只要关窗,都不会有什么noise),所以犹豫了一下,导致有一个人在我前面申请,让他捷足先登了。如果你知道某个具体的房子要转租或者要退房,你那时候如果第一个去申请这个具体的房子,房子就是你的了。

-- St. John's College
http://www.stjohns.ubc.ca/
这个是好几个人向我推荐的,我那时候迟迟没有申请是因为它有义务的meal plan,每月300刀。我怕食物会不合自己的胃口。这个地方的好处是你可以认识很多人,大家自己的关系超佳。有一天晚上一朋友带我去那里参观,被那里住户的热情所感动。

我主要是通过下面的四种途径来找房子的,基本上每天会check好多次,确保能得到最新的消息,能先人一步,呵呵:

-- AMSRentsLine:

http://www.amsrentsline.com/
这是我认为最有用的网站了。专门是为UBC定做的一个公网房屋出租网站。它使用了google maps功能,所以让你能一目了然知道当前available的住房地理位置。呵呵,我在google maps自己也维护了一个自己可能想租的找房图 ,相当方便。另外,如果是off-campus的房子,你可以通过translink trip planner来查看一下你的住处到学校之间的坐车时间。一般可以查一下早上你来UBC需要的的步行和坐车时间,以及晚上你回去的时候需要的时间。对那些回去比较晚的同学,或许还得差一下translink的末班车时间。

-- zhong hua mailing list:

你可以发信到Majordomo@cs.ubc.ca(以subscribe zhong_hua为email的内容)来订阅这个mailing list,上面有不少的租房信息。你可以自己发求租广告,或者看别人出租的广告(很多是转租的信息,女生优先)。

-- Craigslist

Craigslist是一个相当有名的网站。不过由于有太多的租房信息(很多是你不想要的),所以适当的过滤是需要的。我的办法是,只列出title含有ubc的条目。你可以直接点击:http://vancouver.craigslist.org/search/hhh?query=ubc&srchType=T&minAsk=min&maxAsk=&bedrooms= 来得到这个结果。Craigslist没有AMSRentsLine好用,不过还是能让你惊喜的地方,关键还是要有耐心,慢慢看。

-- VanSky:
温哥华天空出租版(http://www.vansky.com/gg/newsgroup.php?fsg=2&keyword=出租&pageno_m=1&pageno_c=1)有一定的信息,不过因为毕竟房子是针对整个Vancouver的,要在这里找一个离学校近的出租房还是挺难的。

我最终比较幸运的是找到了校内的房子。是在amsrentsline上找到的,:)特此要感谢Tibi, Vlad,Wu Lan, Xianglong, Kangkang, Chen Xi, Xiaofei, Chen Li等好朋友在我找房期间提供的各种帮助!












Hello everybody!

欢迎来到bobo的博客,:-)