星期四, 5月 03, 2012

python 實用模組(2) - ZSI

這個模組用來開發 Web Service

https://www.ibm.com/developerworks/cn/opensource/os-cn-pythonws/

python 實用模組(1) -- pexpect

pexpect 把 expect 實作出來,可以用來做與機器之間的互動,之前我做的linux版的網路外掛磁碟就是用到這個模組。

網路上對這個模組的介紹頗多,把幾個看到的網址記下來,供參考!

http://pexpect.sourceforge.net/doc/

python expect模塊pexpect簡單應用

IBM - 探索 Pexpect,第 1 部分:剖析 Pexpect
IBM - 探索 Pexpect,第 2 部分:Pexpect 的實例分析

用pexpect執行ssh及應用

星期五, 4月 27, 2012

Ubuntu 12.04 圖形介面下自動取得 IP 後,resolv.conf 的設定跑掉了

上次提到 Ubuntu 12.04 的 resove.conf 這個檔案已經被改成用 resolvconf 這支程式來做管理,如果利用 /etc/network/interfaces 來做網卡設定時比較沒有問題,可以在裡頭順便指定 dns,但是如果是在 Gnome 底下,網卡的設定是由 NetworkManager 這支程式在負責(預設是走 DHCP),所以這時就沒有辦法在  /etc/network/interfaces  指定。

我的解決辦法有2種:

1. 直接在 NetworkManager 裡設定該網卡只抓 IP,但是 DNS 手動設定。

 

2. 另一種則是利用 resolvconf 這支程式的機制,來手動增加 DNS (nameserver) 的設定

步驟一:開啟 /etc/resolvconf/resolv.conf.d/head

sudo vi /etc/resolvconf/resolv.conf.d/head

步驟二:在檔案的最底下加上一行 nameserver 的設定

nameserver 168.95.1.1

 

 

 

 

這樣一來,該行 nameserver 就一定會被加到 resolv.con 的開頭了

星期四, 3月 29, 2012

Ubuntu 12.04 LTS 發佈時程表

 

  • 2011.12.01 Alpha 1
  • 2012.02.02 Alpha 2
  • 2012.03.01 Beta 1
  • 2012.03.22 Beta 2
  • 2012.03.29 Beta 2
  • 2012.04.19 Candidate(預覽版)
  • 2012.04.26 Final (最終版 - 正式版)

星期六, 3月 24, 2012

Stack Overflow 上網友對於 python gui 技術的比較

python - Pygtk VS Pyqt VS WxPython VS Tkinter - Stack Overflow

I can't really say which one is the most used, but here are some feature comparisons:

Tkinter:

  • Built in to Python
  • Not native-looking GUIs by default before Python 2.7
  • Simple, easy to learn
  • In Python 2.7, ttk support was added (themed widgets)
  • Some GUI designers, but they aren't really as functional as those for other toolkits (but the simplicity of Tkinter alleviates this)

PyGTK:

  • Focused on Linux, works on Windows but can be a pain (thanks to detly for pointing this out)
  • Has a GUI designer, Glade
  • More functionality/weight than Tkinter
  • LGPL

PyGObject (GTK3, will replace PyGTK):

 

  • Still focused on Linux
  • Basically the same, but access is done through GObject
  • Relatively new, but will replace PyGTK

     

    New users wising to develop Python applications using GTK are recommended to use the GObject-Introspection features available in PyGObject. Existing authors of PyGtk applications are also recommended to port their applications to PyGObject if they wish to take advantage of new features appearing in GTK-3 and beyond.

-- http://article.gmane.org/gmane.comp.gnome.gtk%2B.python/15449

 

wxPython:

  • Cross-platform
  • Native widgets on each platform
  • More functionality/weight than Tkinter
  • GUI designers like wxGlade and others
  • wxWindows license (similar to LGPL)

PyQt:

  • Cross-platform
  • Native (or at least native-looking) widgets on each platform, styleable with CSS
  • More functionality/weight than Tkinter (probably the most here: JavaScript, QML...)
  • GPL licensed (commercial licenses available)
  • QtDesigner (made by Nokia) and utilities to convert to Python

PySide:

  • Python Qt binding (like PyQT) but LGPL
  • Cross-platform
  • API is almost the same as PyQT, but it only supports the "new-style" PyQT API.

PyQt, wxWidgets, and PyGTK all support OpenGL.

All three have Webkit bindings, though PyQt's/PySide's seem to be the easiest to use (it is integrated, after all).

Tkinter is the simplest, but least feature-complete. wxPython and PyQt are probably the most powerful in terms of what's built in (as far as I know), but PyGTK is also good, especially if you're targeting Linux. New apps using GTK should use GObject rather than the old PyGTK interface.

All are cross-platform. (PySide also supports MeeGo.)

All support Python 3, except for PySide and wxPython, whose support is forthcoming (0,1).

Some links: Developing user interface in Python - TkInter Vs PyQt

link|edit

星期三, 3月 21, 2012

[Ubuntu] 命令列下掛載網芳分享的作法

1. 不需密碼

# mount -t cifs //winserver/myshare /mnt

2. 需要帳號密碼

# mount -t cifs //winserver/myshare -o username=<username>,password=<password> /mnt