2009年5月12日 星期二

Qt的signal and slot mechanism

connect(sender, SIGNAL(signal), receiver, SLOT(slot));

Sender and receiver are pointers to "QObject"s and where signal and slot are function signatures without parameter names. The SIGNAL() and SLOT() macros essentially convert their argument to a string.

One signal can be connected to many slots. Many signals can be connected to the same slot. A signal can be connected to another signal.

2009年4月24日 星期五

Restore the backup

tar xvpfz backup.tgz -C /

Backup Ubuntu的方法

Backing up:
tar cvpzf backup.tgz --exclude=/proc --exclude=/lost+found --exclude=/backup.tgz --exclude=/mnt --exclude=/sys /

2009年3月30日 星期一

SweetHome3D

一個很不錯的軟體, 可設計房間和其他客廳等等的擺設... (open source)

2009年3月19日 星期四

關於各家寫GUI programming的看法

http://www.wretch.cc/blog/lchbird/4859675

在Python中使用relative path的好處

我們可以改用相對路徑的方式來指定:
#!/usr/bin/env python

於是會以 /usr/bin/env 程式來叫用 python 直譯器,處理 Python 程式檔案。這麼作的好處是當系統中安裝有許多個不同的 Python 直譯器時,會採用路徑在最前面的那一個。如此一來,若使用者另外安裝了一版 Python (例如裝在自己的家目錄),又把自己的 Python 放到路徑設定 (PATH 環境變數) 的最前面,即會採用使用者自己安裝的 Python。

2009年3月12日 星期四

Updating the locate database in Mac OS X

安裝或更新了Mac OSX的系統以後, 使用locate指令經常會出現下面的error message:

`/var/db/locate.database': No such file or directory

執行database的建立, 就可以解決這個問題:

sudo /usr/libexec/locate.updatedb

2009年3月11日 星期三

安裝PyQt和Qt在Leopard的方法

Building Qt 4 and PyQt on Mac OS X Leopard

Things we need for a successful build:

Just let the built-in Archive Utility to extract the tarballs somewhere on your disk.

1. Building Qt

This is pretty straightforward, just follow the instructions:

cd qt-mac-opensource-src-4.5.0/
./configure
make
sudo make install

2. Building SIP

This needs some tweaking, since SIP’s and PyQt’s setup scripts put the module files into a folder that’s not recognized by Python on the new Leopard OS.

cd sip-4.7.1/
python configure.py -d /Library/Python/2.5/site-packages
make
sudo make install

3. Building PyQt

The same applies here.

cd PyQt-mac-gpl-4.3.1/
python configure.py -q /usr/local/Trolltech/Qt-4.3.2/bin/qmake -d /Library/Python/2.5/site-packages
make
sudo make install

Making the steps above, I was able to run any sample PyQt script. The issue I saw that the menubar constantly says “Python”. I hope one can change this to the application’s title (C++ Qt apps look fine).