2012年7月8日 星期日
實作Ubuntu遠端開機 (Wake on Lan)
觸動者(電腦A) -----------> 被遠端開啟的電腦(電腦B)
一、被遠端開啟的電腦(電腦B):
1. 重新開機,並進到BIOS設定
2. 把Wake On Land / Wake On PCI(E)設為Enable
3. 儲存並進入Ubuntu畫面
4. sudo apt-get install ethtool
5. sudo ethtool -s eth0 wol g (eth? ?依該電腦網卡編號而定,可用ifconfig確認)
6. nano /etc/rc.local
新增以下2行:
sleep 5
ethtool -s eth0 wol g
7. nano /etc/init.d/halt
NETDOWN = no
8. 查詢電腦網卡號碼(MAC)
ifconfig
HWaddr 之後顯示的就是網卡號碼
二、觸動者(電腦A):
1. sudo apt-get install wakeonlan
2. wakeonlan 電腦B的網卡號碼,例如:
wakeonlan 00:11:22:33:44:55:66
歡迎各位朋友留下您的想法或意見
Python透過gettext實作i18n範例
1. install gettext
sudo apt-get install gettext
2. write a python code named "gettext.py"
#!/usr/bin/python
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
from gettext import gettext as _
print _('Hello!')
3. get .pot file from .py file
pygettext -o gettext.pot gettext.py
4. cp gettext.pot to gettext.po5. nano gettext.po
change "Content-Type: text/plain; charset=CHARSET\n"
to "Content-Type: text/plain; charset=utf-8\n"
change "Content-Transfer-Encoding: ENCODING\n"
to "Content-Transfer-Encoding: utf-8\n"
to "Content-Type: text/plain; charset=utf-8\n"
change "Content-Transfer-Encoding: ENCODING\n"
to "Content-Transfer-Encoding: utf-8\n"
msgid "Hello!"
msgstr "哈羅!"
6. msgfmt -o gettext.mo gettext.po
7. mkdir zh_TW.big5/LC_MESSAGES
8. mv gettext.mo zh_TW.big5/LC_MESSAGES/
9. python getteext.py
reference:
訂閱:
文章 (Atom)