2008年5月21日 星期三

Linux 指令 --- tar

T

ar 指令 [轉貼]

來源網址...我忘了(查證中)

# tar [-cxtzjvfpPN] 檔與目錄 ....
參數:
-c :建立一個壓縮檔的參數指令
-x :解開一個壓縮檔的參數指令!
-t :查看 tarfile 裡面的文件!
-z :是否同時具有 gzip 的屬性?亦即是否需要用 gzip 壓縮?
-j :是否同時具有 bzip2 的屬性?亦即是否需要用 bzip2 壓縮?
-v :壓縮的過程中顯示檔!這個常用,但不建議用在背景執行過程!
-f :使用檔名,請留意,在 f 之後要立即接檔名喔!不要再加參數!
-p :使用原文件的原來屬性(屬性不會依據使用者而變)
-P :可以使用絕對路徑來壓縮!
-N :比後面接的日期(yyyy/mm/dd)還要新的才會被打包進新建的檔中!
--exclude FILE:在壓縮的過程中,不要將 FILE 打包!
範例:
範例一:將整個 /etc 目錄下的檔全部打包成為 /tmp/etc.tar
[root@linux ~]# tar -cvf /tmp/etc.tar /etc <==僅打包,不壓縮!
[root@linux ~]# tar -zcvf /tmp/etc.tar.gz /etc <==打包後,以 gzip 壓縮
[root@linux ~]# tar -jcvf /tmp/etc.tar.bz2 /etc <==打包後,以 bzip2 壓縮
# 特別注意,在參數 f 之後的檔檔名是自己取的,我們習慣上都用 .tar 來作為辨識。
# 如果加 z 參數,則以 .tar.gz 或 .tgz 來代表 gzip 壓縮過的 tar file ~
# 如果加 j 參數,則以 .tar.bz2 來作為附檔名啊~
# 上述指令在執行的時候,會顯示一個警告訊息:
# 『tar: Removing leading `/' from member names』那是關於絕對路徑的特殊設定。
範例二:查閱上述 /tmp/etc.tar.gz 文件內有哪些文件?
[root@linux ~]# tar -ztvf /tmp/etc.tar.gz
# 由於我們使用 gzip 壓縮,所以要查閱該 tar file 內的檔時,
# 就得要加上 z 這個參數了!這很重要的!

範例三:將 /tmp/etc.tar.gz 檔解壓縮在 /usr/local/src 底下
[root@linux ~]# cd /usr/local/src
[root@linux src]# tar -zxvf /tmp/etc.tar.gz
# 在預設的情況下,我們可以將壓縮檔在任何地方解開的!以這個範例來說,
# 我先將工作目錄變換到 /usr/local/src 底下,並且解開 /tmp/etc.tar.gz ,
# 則解開的目錄會在 /usr/local/src/etc 呢!另外,如果您進入 /usr/local/src/etc
# 則會發現,該目錄下的檔案屬性與 /etc/ 可能會有所不同喔!

範例四:在 /tmp 底下,我只想要將 /tmp/etc.tar.gz 內的 etc/passwd 解開而已
[root@linux ~]# cd /tmp
[root@linux tmp]# tar -zxvf /tmp/etc.tar.gz etc/passwd
# 我可以透過 tar -ztvf 來查閱 tarfile 內的檔案名稱,如果單只要一個檔,
# 就可以透過這個方式來下達!注意到! etc.tar.gz 內的根目錄 / 是被拿掉了!

範例五:將 /etc/ 內的所有檔案備份下來,並且保存其許可權!
[root@linux ~]# tar -zxvpf /tmp/etc.tar.gz /etc
# 這個 -p 的屬性是很重要的,尤其是當您要保留原本檔的屬性時!

範例六:在 /home 當中,比 2005/06/01 新的檔才備份
[root@linux ~]# tar -N '2005/06/01' -zcvf home.tar.gz /home

範例七:我要備份 /home, /etc ,但不要 /home/dmtsai
[root@linux ~]# tar --exclude /home/dmtsai -zcvf myfile.tar.gz /home/* /etc

範例八:將 /etc/ 打包後直接解開在 /tmp 底下,而不產生檔!


2008年5月16日 星期五

登錄 VB Script DLL 失敗的解決方法

錄 VB Script DLL 失敗的解決方法

資料來源


Outlook 登錄 VB Script DLL 失敗的解決方法
安裝繁體中文版 Office 2007 後,開啟Outlook,有些人會出現「登錄 VB Script DLL 失敗」的訊息,不能啟動Outlook。
這個問題是由於 Office 2007 的語言問題,去 "開始==>程式集==>Microsoft Office==>Microsoft Office 工具==>Microsoft Office 2007 語言設定"。

2008年5月7日 星期三

SIP Intro --- HOLD event

HOLD event

以下是節錄自RFC3264的一段文字,在說明HOLD的implementation。
稍後會說明...

2008年4月15日 星期二

GVIM --- 指令

GVIM

[u]
動作還原
若不小心下錯指令,可以利用這個指令還原。
[K]
函式查詢
若您在 VIM 中撰寫 C/C++ 程式,可以在 C/C++ 標準函式厙提供的函式名字上按「K」,便可以呼叫出 man page 查詢該函式的用法
[=]
自動程式縮排對齊
若您在 VIM 中撰寫 C/C++ 程式,可以利用「gg」指令將游標移到視窗最上方、利用「v」切換到選取模式、再用「G」將游標移到檔案尾端 (即達到全選的功能),最後按「=」,VIM 便會幫你的程式做自動對齊
[ctrl]+[r]
動作重做
若不小心還原錯了,可以利用這個指令重做。

dd
將該行文字刪除
此項指令可與指令 p (貼上)配合使用
而變成是「剪下」的功能
dw
刪除該單字
cc
將該行文字改變
當輸入此指令時,游標所在該行會被刪除,並自動進入「輸入模式」
cw
改變該單字
當輸入此指令時,該單字在游標之後的字元會被刪除,並自動進入「輸入模式」

yy
將該行文字複製
指令 Y 有相同的功能
[p]
將所剪下或複製的文字貼上

[/]字串
向下搜尋字串
下達此命令之後,若文件中包含該「字串」,則文件中所有「字串」的背景顏色會被置換成較鮮明的顏色,在下達完搜尋指令之後,還可以透過「n」「N」指令作進一步控制。
[n] 跳到下一個「字串」所在地
[N] 跳到上一個「字串」所在地
另外,把游標停在想要搜尋的字串上,按下「*」也可以達到向下搜尋的效果。


[k]
向上移動游標一個字元
也就是方向鍵的「↑」
[j]
向下移動游標一個字元
也就是方向鍵的「↓」
[h]向左移動游標一個字元
也就是方向鍵的「←」
[l]向右移動游標一個字元
也就是方向鍵的「→」

若想跳出輸入模式,則鍵入即可回到命令模式。
[i]在游標左方進入輸入模式
[I]
在游標所在行的行首進入輸入模式
[a]
在游標右方進入輸入模式
[A]在游標所在行的行尾進入輸入模式
[o](小寫英文字母 o)
在游標下一行另起新行,並進入輸入模式
[O](大寫英文字母 o)
在游標上一行另起新行,並進入輸入模式

2008年4月8日 星期二

SIP Intro --- SDP

SDP

RFC2327裡的會用到的ㄧ些重要資訊。


以下原文取自RFC3264
RFC 2543 [10] specified that placing a user on hold was complished by setting the connection address to 0.0.0.0. Its usage for putting a call on hold is no longer recommended, since it doesn’t allow for RTCP to be used with held streams, doesn’t work with IPv6, and breaks with connection oriented media. However, it can be useful in an initial offer when the offerer knows it wants to use a particular set of media streams and formats, but doesn’t know the addresses and ports at the time of the offer. Of course, when used, the port number MUST NOT be zero, which would specify that the stream has been disabled. An agent MUST be capable of receiving SDP with a connection address of 0.0.0.0, in which case it means that neither RTP nor RTCP should be sent to the peer.

SIP Intro --- Audio Codecs

Codecs

音訊編解碼標準

PCMU(G.711U)
類型:Audio
制定者:ITU-T
所需頻寬:64Kbps(90.4)
特性:PCMU和PCMA都能提供較好的語音品質,但是它們佔用的頻寬較高,需要64kbps。
優點:語音品質優
缺點:佔用的頻寬較高
應用領域:voip
版稅方式:Free
備註:PCMU and PCMA都能夠達到CD音質,但是它們消耗的頻寬也最多(64kbps)。如果網路頻寬比較低,可以選用低比特速率的編碼方法,如G.723或G.729,這兩種編碼的方法也能達到傳統長途電話的音質,但是需要很少的頻寬(G723需要5.3/6.3kbps,G729需要8kbps)。如果頻寬足夠並且需要更好的語音品質,就使用PCMU 和 PCMA,甚至可以使用寬頻的編碼方法G722(64kbps),這可以提供有高保真度的音質。
                                                                                                            


SIP Intro --- SDP (Offer/Answer)

SDP (Offer/Answer)

資料來源RFC3264




SDP Indicating Capabilities
v=0
o=carol 28908764872 28908764872 IN IP4 100.3.6.6
s=-
t=0 0
c=IN IP4 192.0.2.4
m=audio 0 RTP/AVP 0 1 3
a=rtpmap:0 PCMU/8000
a=rtpmap:1 1016/8000
a=rtpmap:3 GSM/8000
m=video 0 RTP/AVP 31 34
a=rtpmap:31 H261/90000
a=rtpmap:34 H263/90000



Assume that the caller, Alice, has included the following description
in her offer.
v=0
o=alice 2890844526 2890844526 IN IP4 host.anywhere.com
s=
c=IN IP4 host.anywhere.com
t=0 0
m=audio 49170 RTP/AVP 0
a=rtpmap:0 PCMU/8000
m=video 51372 RTP/AVP 31
a=rtpmap:31 H261/90000
m=video 53000 RTP/AVP 32
a=rtpmap:32 MPV/90000



he returns the SDP below as the answer
v=0
o=bob 2890844730 2890844730 IN IP4 host.example.com
s=
c=IN IP4 host.example.com
t=0 0
m=audio 49920 RTP/AVP 0
a=rtpmap:0 PCMU/8000
m=video 0 RTP/AVP 31
m=video 53000 RTP/AVP 32
a=rtpmap:32 MPV/90000



Bob decides to change the port.
v=0
o=bob 2890844730 2890844731 IN IP4 host.example.com
s=
c=IN IP4 host.example.com
t=0 0
m=audio 65422 RTP/AVP 0
a=rtpmap:0 PCMU/8000
m=video 0 RTP/AVP 31
m=video 53000 RTP/AVP 32
a=rtpmap:32 MPV/90000
m=audio 51434 RTP/AVP 110
a=rtpmap:110 telephone-events/8000
a=recvonly



Alice accepts the additional media stream, and so generates the following answer:
v=0
o=alice 2890844526 2890844527 IN IP4 host.anywhere.com
s=
c=IN IP4 host.anywhere.com
t=0 0
m=audio 49170 RTP/AVP 0
a=rtpmap:0 PCMU/8000
m=video 0 RTP/AVP 31
a=rtpmap:31 H261/90000
m=video 53000 RTP/AVP 32
a=rtpmap:32 MPV/90000
m=audio 53122 RTP/AVP 110
a=rtpmap:110 telephone-events/8000
a=sendonly



One of N Codec Selection

The initial offer from Alice to Bob indicates a single audio stream with the three audio codecs that are available in the DSP.
v=0
o=alice 2890844526 2890844526 IN IP4 host.anywhere.com
s=
c=IN IP4 host.anywhere.com
t=0 0
m=audio 62986 RTP/AVP 0 4 18
a=rtpmap:0 PCMU/8000
a=rtpmap:4 G723/8000
a=rtpmap:18 G729/8000
a=inactive



Bob can support dynamic switching between PCMU and G.723. So, he sends the following answer
v=0
o=bob 2890844730 2890844731 IN IP4 host.example.com
s=
c=IN IP4 host.example.com
t=0 0
m=audio 54344 RTP/AVP 0 4
a=rtpmap:0 PCMU/8000
a=rtpmap:4 G723/8000
a=inactive



Alice can then select any one of these two codecs.
v=0
o=alice 2890844526 2890844527 IN IP4 host.anywhere.com
s=
c=IN IP4 host.anywhere.com
t=0 0
m=audio 62986 RTP/AVP 4
a=rtpmap:4 G723/8000
a=sendrecv



Bob accepts the single codec
v=0
o=bob 2890844730 2890844732 IN IP4 host.example.com
s=
c=IN IP4 host.example.com
t=0 0
m=audio 54344 RTP/AVP 4
a=rtpmap:4 G723/8000
a=sendrecv

2008年4月2日 星期三

DTMF Tone Generator (Free Software)

D

TMF tone generator software (free)


NCH Tone Generator (Free Software)

這個軟體是免費的,除非要有進階功能才需要付費,而且還額外提供ㄧ些處理音頻訊號的PLUGIN下載使用。

使用此工具在依照我之前有一篇介紹的DTMF tone的說明,就可以自己產生DTMF Tone了!!!

可以去NCH官網查看~

以下是轉貼自他的官網簡介~

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Typical Applications

Generation of test tones in radio and other studios for the alignment of levels.
Calibration and testing of audio equipment or speakers.
Tuning music instruments as an accurate reference tone.
Demonstration of audio principles to students.
Acoustics testing and equalisation.
Quality control and testing of sound cards.
White noise generator
Audio band signalling.
Hearing tests (under suitable medical supervision).

Features

Sine wave, square wave, triangular waveform, saw tooth waveform, impulse, white noise and pink noise.
Supports frequencies from 1Hz to 22kHz bandwidth (subject to sound card).
Multiple simultaneous tones (1 to 16 tones can be created at the same time) (useful to create harmonics).
Mono or separate stereo operation (ideal to create dual tones or 'beats').
Tone Sweeps (Log or Linear).
Plays tone or saves as wav file.


2008年3月31日 星期一

SIP Intro --- Standard Subscriber Line Tones

Line tones

取自E.182這個doc


E.182定義了標準會用到的Tones如下:

Dial tone: The exchange is ready to receive address information.

PABX internal dial tone: The PABX is ready to receive address information.

Special dial tone: Same as dial tone, but the caller’s line is subject to a specific condition, such as call diversion or a voice mail is available (e.g., "stutter dial tone").

Second dial tone: The network has accepted the address information, but additional information is required.

Ring: This named signal event causes the recipient to generate an alerting signal ("ring"). The actual tone or other indication used to render this named event is left up to the receiver. (This differs from the ringing tone, below, heard by the caller

Ringing tone: The call has been placed to the callee and a calling signal (ringing) is being transmitted to the callee. This tone is also called "ringback".

Special ringing tone: A special service, such as call forwarding or call waiting, is active at the called number.

Busy tone: The called telephone number is busy.

Congestion tone: Facilities necessary for the call are temporarily unavailable.

Calling card service tone: The calling card service tone consists of 60 ms of the sum of 941 Hz and 1477 Hz tones (DTMF ’#’), followed by 940 ms of 350 Hz and 440 Hz (U.S. dial tone), decaying exponentially with a time constant of 200 ms.

Special information tone: The callee cannot be reached, but the reason is neither "busy" nor "congestion". This tone should be used before all call failure announcements, for the benefit of automatic equipment.

Comfort tone: The call is being processed. This tone may be used during long post-dial delays, e.g., in international connections.

Hold tone: The caller has been placed on hold.

Record tone: The caller has been connected to an automatic answering device and is requested to begin speaking.

Caller waiting tone: The called station is busy, but has call waiting service.

Pay tone: The caller, at a payphone, is reminded to deposit additional coins.

Positive indication tone: The supplementary service has been activated.

Negative indication tone: The supplementary service could not be activated.

Off-hook warning tone: The caller has left the instrument off-hook for an extended period of time.


Call waiting tone: Another party wants to reach the subscriber.

Warning tone: The call is being recorded. This tone is not required in all jurisdictions.

Intrusion tone: The call is being monitored, e.g., by an operator.

CPE alerting signal: A tone used to alert a device to an arriving in-band FSK data transmission. A CPE alerting signal is a combined 2130 and 2750 Hz tone, both with tolerances of 0.5% and a duration of 80 to. 80 ms. The CPE alerting signal is used with ADSI services and Call Waiting ID services [14].

Payphone recognition tone: The person making the call or being called is using a payphone (and thus it is ill-advised to allow collect calls to such a person).


另外也定義Event與其encode

Event                     encoding (decimal)
_____________________________________________
Off Hook                                 64
On Hook                                  65
Dial tone                                66
PABX internal dial tone                  67
Special dial tone                        68
Second dial tone                         69
Ringing tone                             70
Special ringing tone                     71
Busy tone                                72
Congestion tone                          73
Special information tone                 74
Comfort tone                             75
Hold tone                                76
Record tone                              77
Caller waiting tone                      78
Call waiting tone                        79
Pay tone                                 80
Positive indication tone                 81
Negative indication tone                 82
Warning tone                             83
Intrusion tone                           84
Calling card service tone                85
Payphone recognition tone                86
CPE alerting signal (CAS)                87
Off-hook warning tone                    88
Ring                                     89


後續會做說明補充...

搜尋此網誌