EvoTalk

04 十二月, 2009

Virtual Network Adapter

Posted by: asd In: 科技新知| 軟體使用 ()

在WinXP上安裝一張虛擬網路卡,用途是在無法存取網路時,在虛擬網路環境中測試。
例如本機 WinXP 使用網芳或 ssh 與 vmware 上的 linux 連線

安裝步驟如下
1. [控制台]->「新增硬體]

2. 按一下 [是,我已連接這個硬體],然後按一下 [下一步]。

3. 按一下位於清單底部的 [新增硬體裝置],然後按一下 [下一步]。

4. 按一下 [安裝我從清單中手動選取的硬體],再按一下 [下一步]。

5. 按一下 [網路介面卡],再按一下 [下一步]。

6. 在 [製造商] 方塊中,按一下 [Microsoft]。

7. 在 [網路介面卡] 方塊中,按一下 [Microsoft Loopback Adapter],然後按一下 [下一步]。

8. 按一下 [完成]。

參考

如何在 Windows XP 中安裝 Microsoft 迴路介面卡

1. [控制台]->「新增硬體]
2. 按一下 [是,我已連接這個硬體],然後按一下 [下一步]。
3. 按一下位於清單底部的 [新增硬體裝置],然後按一下 [下一步]。
4. 按一下 [安裝我從清單中手動選取的硬體],再按一下 [下一步]。
5. 按一下 [網路介面卡],再按一下 [下一步]。
6. 在 [製造商] 方塊中,按一下 [Microsoft]。
7. 在 [網路介面卡] 方塊中,按一下 [Microsoft Loopback Adapter],然後按一下 [下一步]。
8. 按一下 [完成]

1. 安裝「python-2.5.4
2. 安裝「PyGtk, PyOpenGL, PyGtkGlExt, PyWin32 all in one installer

使用 「Glade」拉界面 ,「Pythonwin」  IDE  debug,

03 十一月, 2009

Open Default Application by Extension

Posted by: asd In: 科技新知| 軟體使用 ()

在windows下,如果要在console下命令,根據檔名開啟預設的應用程式
start 123.txt   # 開啟預設文字編輯器
start http://www.google.com #開啟預設的瀏覽器
start mailto:admin@123.com //開啟預設的email軟體

若是在linux 下,使用的是gnome
gnome-open 123.txt
gnome-open http://www.google.com
gnome-open mailto:admin@123.com

參考 Open a file from the command line using its default application

13 十月, 2009

Perl Here Document

Posted by: asd In: Code Snippet| Perl| 程式設計 ()

Use Perl here documents to print multiple lines of output
example:

PERL:
  1. print <<FOO;
  2. Perl offers a convenient way of printing multiple lines of output through an interesting feature known as a "Perl here document".
  3.  
  4. A multiline Perl here document works like this:
  5. <ol>
  6.     <li>The first line of your command will include the two characters <code>&lt;&lt;</code> followed by a "special" identifier string, followed by a semi-colon. (For my example I will use the identifier string <code>FOO</code>. More on this shortly.)</li>
  7.     <li>Next, just enter all of the lines of output that you want to print.</li>
  8.     <li>When you are ready to terminate the output, put your special identifier string on a line by itself to end the output.</li>
  9. </ol>
  10. FOO

遇到反斜線需要 double。

12 十月, 2009

XPath

Posted by: asd In: Web| 程式設計 ()

xml data

CODE:
  1. &lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
  2. &lt;catalog&gt;
  3.   &lt;cd country="USA"&gt;
  4.     &lt;title&gt;Empire Burlesque&lt;/title&gt;
  5.     &lt;artist&gt;Bob Dylan&lt;/artist&gt;
  6.     &lt;price&gt;10.90&lt;/price&gt;
  7.   &lt;/cd&gt;
  8.   &lt;cd country="UK"&gt;
  9.     &lt;title&gt;Hide your heart&lt;/title&gt;
  10.     &lt;artist&gt;Bonnie Tyler&lt;/artist&gt;
  11.     &lt;price&gt;10.0&lt;/price&gt;
  12.   &lt;/cd&gt;
  13.   &lt;cd country="USA"&gt;
  14.     &lt;title&gt;Greatest Hits&lt;/title&gt;
  15.     &lt;artist&gt;Dolly Parton&lt;/artist&gt;
  16.     &lt;price&gt;9.90&lt;/price&gt;
  17.   &lt;/cd&gt;
  18. &lt;/catalog&gt;

XPath expressions

/catalog selects the root element
/catalog/cd selects all the cd elements of the catalog element
/catalog/cd/price selects all the price elements of all the cd elements of the catalog element
/catalog/cd[price>10.0] selects all the cd elements with price greater than 10.0
starts with a slash(/) represents an absolute path to an element
starts with two slashes(//) selects all elements that satisfy the criteria
//cd selects all cd elements in the document
/catalog/cd/title | /catalog/cd/artist selects all the title and artist elements of the cd elements of catalog
//title | //artist selects all the title and artist elements in the document
/catalog/cd/* selects all the child elements of all cd elements of the catalog element
/catalog/*/price selects all the price elements that are grandchildren of catalog
/*/*/price selects all price elements which have two ancestors
//* selects all elements in the document
/catalog/cd[1] selects the first cd child of catalog
/catalog/cd[last()] selects the last cd child of catalog
/catalog/cd[price] selects all the cd elements that have price
/catalog/cd[price=10.90] selects cd elements with the price of 10.90
/catalog/cd[price=10.90]/price selects all price elements with the price of 10.90
//@country selects all "country" attributes
//cd[@country] selects cd elements which have a "country" attribute
//cd[@*] selects cd elements which have any attribute
//cd[@country='UK'] selects cd elements with "country" attribute equal to 'UK'

reference:
Manipulate XML data with XPath and XmlDocument (C#)
XPath Tutorial


  • BK: 大於和小於在今日更廣泛地使用於標籤上,故在此補充該英文用法: : angle bracket []: square bracket
  • luh1688: 非常實用且謝謝!~
  • asd: 好的,不過很久沒修改了,不知道能不能動 寄到您的yahoo信箱
  • LIANG: nice post, thank you
  • Justmaker: 您好,請問可以跟你要source嗎?我最近有在看股票,想要enhance您的小工具,不知是否可以開放?

Category

Page 2 of 87«12345»...Last »