图书馆法及其它

今天社会课讲的是教育,中间去了社区图书馆(Ullensaker Library),馆长亲自接待全班并带领大家熟悉图书馆各区域。

馆长开场的时候提到了挪威有《图书馆法》,其中就提到了图书馆是每个人的权利,在挪威所有图书馆都是免费供大家使用的(当然不按期归还和损毁书籍肯定是要有惩罚的),在挪威的任何一个图书馆凭本人的人口号(类似于国内的身份证号)办的借书卡全国通用,在一个图书馆可以借阅本馆没有但其它图书馆有的书,图书馆会负责帮你把所需书籍运到本地并且通知你。

回到家没事就又搜了搜:

顺便看了看国内,好像有个《中华人民共和国公共图书馆法》征求意见稿,但在Google中没有找到原文,只有如下两个转发链接提及了,其中转发的链接也已经不可以访问了:

看了挪威和中国的两个图书馆法,觉得差距还是蛮巨大的。

下面是其它一些相关链接:

在奥斯陆图书馆网站搜索中文书籍和音像制品的方法:

奥斯陆图书馆在线目录网页中,点击“Advanced search”(在搜索输入栏下方偏左的位置),“Language”一栏选择“Chinese”,直接点下方的“Search”可以显示大约有2300件中文资料,有重复。

挪威国家议会第156个议会年正式开始了

最近正在上挪威的社会课,可以认为是包含历史政治常识等知识的课程。今天讲历史,又恰好赶上挪威国家议会第156个议会年正式开始了,老师在课上带大家观看了NRK的现场直播。晚上回家找视频给老爸老妈介绍一下,发现没有开场,只有国王致辞的部分了。

没时间写太多了,就先列举出来,看看以后有没有时间补充了:

挪威2011年地方选举

今年是挪威的地方选举年,选举日是9月12日星期一,很多地方也允许9月11日星期日进行投票。地方选举每4年一次,选举县、郡两级政府,但像Oslo这样的城市两级合并,只有一级。国家选举也是4年一次,2009年和2013年是国家选举年。

挪威的选举系统:挪威政府: The main features of the Norwegian electoral system(英文)

本次2011年地方选举,在挪威居住的挪威公民、在挪威居住满3年(选举日之前)的外籍公民以及在挪威居住的北欧几国公民(需要在6月30日前登记)都有选举权。今年有部分地区试行网上电子投票,另外有部分地区试行把选举的年龄提前到16岁。这里是被选举人名单

关于被选举人的规定,大致是这个样子,如果在之前一次选举中比较大的党(郡一级得票超过500或者国家一级得票超过5000)可以直接向县和郡提名至少2名本党党员。在此之外的,参加郡一级选举的需要收集500个签名,参加县一级选举的需要收集该县上一次选举投票人数的2%。这些提名都必须在当年3月31日之前交到当地政府部门,还有后续的核实确认工作。

挪威是多党制国家,目前的大党有

参考资料:挪威政府: About the right to vote and the electoral register
Municipal and County Council Elections(英文)

视频资料:

其它参考资料:

从10月起,Oslo和Akershus地区公交和火车票价系统调整

Akershus就是包围Oslo的郡,大约有Oslo的十倍大,原有公交火车系统把Akershus划分为88个区,票价系统非常复杂。新的系统中只有13个区(含Oslo)。所有的地铁系统都在1区(Oslo)。举例:Fornebu被划入Oslo区。绝大部分地区价格都有不同程度下降,个别地区(正好在新划分的区域界限两侧的比较近的站)有价格上升的情况发生。

Ruter新系统从10月2日开始生效,NSB新系统从10月1日开始生效

旧的票价系统信息页面:

新的票价系统信息页面:

举例说明一下,我家Kløfta到我上班的Oslo,旧系统中是N-06区到01区,共6个区,成人单次票价是80NOK,成人月票(含Oslo)是1560NOK。新系统中是3Ø到01,共3个区,成人单次票价是68NOK(上车前买好)和84NOK(上车买),成人月票是1490NOK,Akershus全区通用(3个区及以上的月票价格一样,都是1490NOK)。新系统中增加了年票,相当于月票价格的10倍。

又打羽毛球了

上周日,第一次在挪威打羽毛球。是作为我老婆的家属参加她公司的活动的,不过那么大的场地,只有6个人。有年头没打了,大约5、6年。打完球,痛了好几天。

今天又去了,比上次人还少,一共4个。不过有个朋友打得很不错,让我着实受虐了一下,出汗的感觉还是很不错的。今天用这个朋友带的塑料羽毛球打的,2个小时一直是这个球,并且也没有太大损伤。听他说塑料的大约15块,羽毛的一般7、8块。那看来也不是很贵。

晚上就在网上搜了一下,挪威的羽毛球俱乐部还是有一些的,我们活动的场馆这里就有一个,
Bygdø Badminton Klubb

里面有一张图片,就是我们活动的场馆,大图

我们家附近也有一个俱乐部,FROGNER IL Badminton,争取有机会去看看。

大概看了一个其它俱乐部的网页,大约一个会员一年的会费在4、500块左右,然后活动费用是1500块每年的样子,估计不同俱乐部的费用也不太一样。不知道啥时候能适应这个价格,^_^

告别MAMP

大学时代,玩过一阵子Apache+PHP+MySQL,一般是在Linux上,也用过一次FreeBSD。

后来自己的服务器也就一直放在Mac上,之前偷懒,就在网上下载了MAMP凑合着用了。

这次升级到Lion,很不幸,MAMP中的Apache不能起来了,我也没有查看日志。网上搜索了一下,Lion中已经自带Apache2和PHP 5.3了,”System Preferences”->”Sharing”->”Web Sharing”就是Apache2的启动选项,配置文件在/etc/apache2/httpd.conf,把下面这行取消注释就可以启用PHP了:

Lion里已经不自带MySQL了,估计是因为Oracle的原因,所以我根据这篇文章安装了MySQL和phpMyAdmin。并且还安装了MySQLStartItem.pkg,这样在”System Preferences”->”MySQL”中就可以控制MySQL了。

之后我就把原来的MySQL数据库覆盖了过来,位置在/usr/local/mysql/data。

之后把WordPress目录复制到相应位置,修改/etc/apache2/extra/httpd-vhosts.conf,为了让WordPress能正常工作,注意添加Directory以及如下一行:

对于PHP,还有一项:

修改其中一行:

然后就基本都搞定了。

目前还差的就是升级WordPress和WordPress MU 2.x到最新的3.2.1了。

Clang Static Analyzer with Qt

1. OS: Snow Leopard 64bit

2. Qt: 4.8

cd ~/qt
git clone git://gitorious.org/qt/qt.git work
cd work
git checkout -b origin/4.8 4.8
cp -rf mkspecs/unsupported/macx-clang mkspecs/unsupported/macx-checker

Note: a patch for mkspecs/unsupported/macx-checker/qmake.conf: http://pastebin.com/u7mnkhue

3. Clang Static Analyzer: checker-256

cd ~/dev/packages
wget http://clang-analyzer.llvm.org/checker/checker-256.tar.bz2
tar zxvf checker-256.tar.bz2
cd checker-256
rm bin/clang
rm bin/clang++
cd /usr/local/bin
ln -s /Users/liangqi/dev/packages/checker-256/bin/clang-3.0 clang
ln -s /Users/liangqi/dev/packages/checker-256/bin/clang-3.0 clang++

4. Build

cd ~/build
mkdir qt-48-clang
cd qt-48-clang
export PATH=/usr/local/bin:/Users/liangqi/dev/packages/checker-256:$PATH
/Users/liangqi/qt/work/configure -platform unsupported/macx-checker -nokia-developer -no-webkit -no-qt3support -no-declarative -no-xmlpatterns -no-script -no-scripttools -no-phonon -no-multimedia -nomake tools -nomake demos -nomake examples -fast -verbose -no-framework
scan-build make

5. Output

In the end of the output, you will find a command like “scan-build: Run ‘scan-view /var/folders/QB/QBTpJfK+HfqtpmxTOms2nU+++TI/-Tmp-/scan-build-2011-07-20-3’ to examine bug reports.”, do it!

NOTE: the above way doesn’t work with checker-257!

How to run autotests in Qt for Symbian on Linux and Mac?

Here is the official article for it, Installing Qt for the Symbian platform using Linux (experimental).

The basic idea is same on Linux and Mac OS X.

1. For phone, you need to install Application TRK

S60 5.0/Symbian^1 – s60_5_0_app_trk_3_2_7.sisx
Symbian^3 – s60_tb_9_2_app_trk_3_2_8.sisx

2. Use usb cable to connect your phone and computer, Linux or Mac OS X. Remember to set to “PC Suite” mode or “Nokia Ovi Suite” mode on your phone. Then launch your Application TRK via “RnD Tools”->”TRK”.

3. About the device name for your phone on computer

For Linux, see more details in Configuring the USB Serial Driver on the Linux System. After that, you will find /dev/ttyUSBx and maybe another /dev/ttyUSBy, better to “sudo chmod 777 /dev/ttyUSB*” for them(some Linux distribution do not give the access to normal users for it, like Ubuntu).

For Mac, you could find sth like /dev/cu.usbmodemfaXx and /dev/cu.usbmodemfaXy.

4. To build runonphone, you need to have libusb installed.

For Linux, just follow that documentation, “sudo apt-get install libusb-dev” should be ok for Debian/Ubuntu.

For Mac, “sudo brew install libusb-compat” works for me.

5. Build runonphone, use the qmake in your desktop Qt.

cd ~/qt/qt/tools/runonphone
/usr/bin/qmake
make

6. Build and run your autotests, please check previous blog for the EPOCROOT and PATH environments settings.

cd qt/qt/tests/auto/qdatetime
~/build/s3_gcce/bin/qmake -spec ~/qt/qt/mkspecs/symbian-gcce -o Makefile ~/qt/qt/tests/auto/qdatetime/qdatetime.pro
make sis
~/qt/qt/tools/runonphone/runonphone -p /dev/cu.usbmodemfa44 –sis ~/qt/qt/tests/auto/qdatetime/qdatetime.sis qdatetime.exe

NOTE: Here the /dev/cu.usbmodemfa44 is the device on Mac for me. And for Linux, the device is sth like /dev/ttyUSB1.

Enjoy it!

Build Qt 4.7 with Symbian^3 on Linux and Mac OS X

Similar steps as previous blog.

Here I will only mention the difference between them:

1. Qt 4.7, please wait a while for the merging of 7c499bcfbf7f9c52b3d6523fea8396bd4ab7252e.

git checkout -b 4.7 origin/4.7

2. You could enable the webkit which is inside of 4.7, then the configure line should be like:

~/qt/qt/configure -developer-build -opensource -confirm-license -xplatform symbian-gcce -webkit -fast -silent -nomake examples -nomake demos -nomake tools -nomake tests -qtlibinfix _liang

And for QtWebKit package:

cd ~/build/s3_gcce/src/3rdparty/webkit/WebCore
make sis
copy ~/build/s3_gcce/lib/QtWebKit_liang.sis toyourphone

For the demo browser application:

cd ~/qt/work/demos/embedded/anomaly
make sis
copy anomaly.sis toyourphone

3. Install the above Qt_liang.sis, QtWebKit_liang.sis, analogclock.sis and anomaly.sis, and enjoy them.

Launch it at “QtExamples”->”analogclock”.
Launch it at “QtDemos”->”anomaly”.

Build Qt 4.8 with Symbian^3 on Linux and Mac OS X

Build Qt 4.8 with Symbian^3 on Linux and Mac OS X

Kudos to Kristian Amlie and Thomas Zander for the “make file build system”.

1. OS:

Linux – mine is 2.6.38-8-generic x86_64
Mac OS X – mine is 10.6.8 64bit

2. Symbian^3

NOTE: Looks like Qt is still not the 1st-priority citizen in the Symbian^3 SDKs world, the reason why I say like that is this task, it means that you cannot use any version of Symbian^3 (public) SDKs to build Qt libraries from source. Details in the comment. Then we use the Symbian^3 PDK 3.0.4 for now. I am not sure how long this mirror service will be available there, you’d better backup those files by yourself.

Symbian^3 PDK 3.0.4

Please download binaries_armv5_lib.7z.zip, binaries_armv5_udeb.7z.zip, binaries_armv5_urel.7z.zip, binaries_epoc.7z.zip, binaries_epoc_sdk.7z.zip, binaries_prebuilt.7z.zip, tools_epoc.7z.zip at least.

cd ~
mkdir -p symbian-sdks/pdk304
cd symbian-sdks/pdk304
7z x abovefiles
export EPOCROOT=~/symbian-sdks/pdk304/ //set env for EPOCROOT

The patch for Symbian^3 PDK 3.0.4 is here.

3. Wine

NOTE: The reason for installing wine is we are using the Symbian tools build on Windows, such as rcomp, makesis and many others.

Linux(Debian/Ubuntu): sudo apt-get install wine1.2
Mac OS X: Install wine 1.1.44, and upgrade it to 1.2

Add wine into path
export PATH=/Applications/Wine.app/Contents/Resources/bin:$PATH //for Mac OS X

4. Compilers:

Linux: RVCT 2.2(need commercial license) or GCCE 4.4.1(Symbian ADT Sourcery G++ Lite 4.4-172 for ARM SymbianOS)
Mac OS X: GCCE 4.4.1(Symbian ADT Sourcery G++ Lite 4.4-172 for ARM SymbianOS), after installed to default path, mv /Applications/CodeSourcery/Sourcery G++ Lite/ /Applications/CodeSourcery/Sourcery_G++_Lite. NOTE: need to remove those spaces in the path of compiler

Add compiler path into PATH:
export PATH=/Applications/CodeSourcery/Sourcery_G++_Lite/bin:$PATH

5. Qt 4.8

NOTE: better to use ea7ed6b27301a4834b1bfe0ad4e6e58462647d3e and later.

cd ~
mkdir qt
git clone -n git://gitorious.org/qt/qt.git qt
cd qt
git checkout -b 4.8 origin/4.8

6. Build it

cd ~
mkdir build
cd build
mkdir s3_gcce // this is for the GCCE case, or s3_armcc for RVCT 2.2 case
cd s3_gcce
~/qt/qt/configure -developer-build -opensource -confirm-license -xplatform symbian-gcce -no-webkit -fast -silent -nomake examples -nomake demos -nomake tools -nomake tests -qtlibinfix _liang // this is for GCCE case, or “-xplatform symbian-armcc” for RVCT 2.2 case
make -j8 // maybe fail at somewhere, then just try “cd src;make -j1” finish it
cd src/s60installs
make sis
cd ~/build/s3_gcce/lib
cp Qt_liang.sis toyourphone
cd ~/qt/qt/examples/widgets/analogclock
~/build/s3_gcce/bin/qmake
make sis
copy analogclock.sis toyourphone

7. Install your own build Qt libraries and application

Goto “Office”->”File Manager”, manually install Qt_liang.sis and analogclock.sis

8. Run your appliation

Launch it at “QtExamples”->”analogclock”. Enjoy it!

Known issues or other topics:
1. There is still some issue to build qtwebkit which the one inside of qt 4.8 or from qtwebkit git repo directly. If I got solution, I will let you know.
2. Mabye write something about runonphone on Linux and Mac OS X, it is a very good tool to test qt applications.