2011年3月24日 星期四

如何將Outlook2003變成Gmail風格?

As title,
上班時碰到一個問題,光是找信就找了半天,
即使有Google desktop,卻常常找到的是不知道回了幾百次的回信,
特別是客戶回信也很懶,常常用A問題的回信直接回信問B問題,
這個時候就很想念Gmail的排序方式,
以會話群組的方式將信排列顯示,
這樣一來一個Topic就一次列出來,不用再找信找半天了...

以下以Outlook 2003示範,Outlook 2007應該也適用,2010好像不需要這麼麻煩?

首先,我們需要將寄出的信自動複製到收件匣一份,透過設定規則的方式實現。
在Outlook的工作列,工具→規則與通知。

新增規則後,選擇"從空白規則開始",傳送郵件後進行檢查。

條件,經指定帳號寄出的信件(這裡通常是Exchange Server)
如果不是為了Microsoft的Exchange server,那用Gmail不就好了=>=
動作,傳送郵件副本給"自己"
例外條件可以直接跳過,除非有什麼例外?XD

接著設定另外一個規則,將自己的信件標示為已讀取,
  1. 選取郵件應檢查的時機,當郵件送達時進行檢查
  2. 條件,寄件者為自己
  3. 動作,標示為已讀取
這個時候我們應該有兩個規則,如下圖...

傳送郵件時傳一個複本給自己
收到寄給自己的信時標示為已讀取
設定規則後請仔細對照規則描述是否跟我的一樣...
接著請手動把寄件備份複製或是移到收件匣,請自行評估若使用舊PST檔(有2G限制)可能會導致資料夾檔案爆炸XDDDD

這個時候,我們的收件匣應該就會很豐富,除了原先的信件以外,還包含了一大堆我們寄出去的信件,接著設定檢視方式。

在Outlook工具列,選擇排列→自訂

群組依據請選擇交談主旨,遞增是第一封信在上面,遞減是最後一封信在上面
排序請設定為收到日期(遞減)

大功告成,這個時候顯示應該就跟Gmail的風格類似,以會話群組將信件分組,
會話群組的排序以最新的信件日期排序。

以上就是將Outlook 2003設定成以會話群組排列的說明,感謝各位:)

2011年3月18日 星期五

Blogger Search and Replace

Well, I've transfer my blog couple times,
so it's has some image link from other static web hosting,
but someday, I got a mail that told me the service has expired,
because my adsl account has expired long time ago.

So, I thought, maybe I can move all file to other web hosting,
and replace all string in blogger.
then I try to find a solution or any way to replace a string in all article,
but I can't after I google it.

So I try to wrote it.

refer to Blogger API Developer's Guide: Python

Source:
def ReciveAll(self):
# Request the feed.
query = gdata.blogger.client.Query(max_results=9999)
feed = self.client.get_posts(self.blog_id ,query=query)
return feed

def SearchAll(self,str):
result = []
feed = self.ReciveAll()

for entry in feed.entry:
if (string.find(entry.content.text, str) != -1):
result.append(entry)
return result

def UpdatePost(self, entry_to_update):
return self.client.update(entry_to_update)

def main():
global email
global password

"""The main function runs the BloggerExample application.
NOTE: It is recommended that you run this sample using a test account.
"""

email = easygui.enterbox('Email:','Login')
password = easygui.passwordbox('Password:','Login')
sample = BloggerExample()
while 1:
array = []
menu_array = ['Search','Exit','Search and replace']
menu_choice = easygui.choicebox('Main menu', 'Main menu', menu_array)
#select = raw_input("1:Search\n2:Search and replace\n3:exit\n")
if menu_choice == 'Search':
#user_input = raw_input("Search:").decode(sys.stdin.encoding)
user_input = easygui.enterbox('Search:','Search')

results = sample.SearchAll(user_input)
for entry in results:
array.append(entry.title.text.encode("utf8"))

entry_choice = easygui.choicebox("test","test",array)
while(entry_choice!= None):
re_split=re.compile("[<>]")
for entry in results:
if entry.title.text == entry_choice:
line_array = re_split.split(entry.content.text.encode("utf8"))
line_array_contain = []
for line in line_array:
if line.find(user_input.encode("utf8")) != -1:
line_array_contain.append(line)
easygui.choicebox("Search Result","Search",line_array_contain)
break
entry_choice = easygui.choicebox("test","test",array)

elif menu_choice == 'Search and replace':
#src = raw_input("Search:").decode(sys.stdin.encoding)
src = easygui.enterbox('Search:','Search and Replace')
#dest = raw_input("Replace:").decode(sys.stdin.encoding)
dest = easygui.enterbox('Replace:','Search and Replace')
if easygui.ccbox():
results = sample.SearchAll(src)
for entry in results:
entry.content.text = entry.content.text.replace(src,dest)
#print entry.content.text
sample.UpdatePost(entry)
#print entry.title.text + "-> done"
easygui.msgbox(entry.title.text + "-> done")

elif menu_choice == 'Exit':
break

if __name__ == '__main__':
main()

GUI Version:
Source: http://dl.dropbox.com/u/3357679/Blog/Src_Blogger_search_replace_gui.7z
Prebuilt binary: http://dl.dropbox.com/u/3357679/Blog/Blogger_search_replace_gui.7z

Console Version:
Source: http://dl.dropbox.com/u/3357679/Blog/Src_Blogger_search_replace.7z
Prebuilt binary: http://dl.dropbox.com/u/3357679/Blog/Blogger_search_replace.7z

because that's practice program(it's mean beta release, use it at your own risk!)
please backup or export the blog before.
I've try replace in English and Traditional Chinese,
it's work, so, it's should support multi language.

Finally, it's worked!
but I found that maybe I need modify article by manually,
because it's look like upload image to Picasa will be much better?

2011年1月23日 星期日

How to set SSH tunnel, dummy way, step by step...

應多多的需求,
來寫篇SSH Tunnel的教學,
以最基本最基本的為主,先不考慮任何進階的用法。

架構如下
一般來說經由正常方式連線,中間容易被第三者竊聽,除非是經過HTTPS等加密的Protocol
如果像是MSN或HTTP則是可以一覽無遺,
例如firesheep則是在未加密的無線網路環境竊聽http packet,
還順便幫你整理好讓你不用去看packet structure。



透過Tunnel連到Internet,分成兩個部份來看
Client到SSH host端經過加密,因此中間的第三者唯一能看到的是你連線到SSH Host
但他無法得知你中間到底傳什麼?
但SSH Host以及SSH Host到Internet之間還是可以竊聽,
端看你對於SSH Host的信任程度。
因為我們只要避開已知的竊聽者:)


Requirement:

  1. Putty (SSH Client, http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe)
  2. SSH Host
執行Putty的畫面,Host Name填入SSH主機的位址,
Saved Sessions填入名稱,以便之後可以直接連線不用再設定一次,但還沒設定完...
Tip: 在Host name輸入帳號@主機位址,代表要直接以指定帳號登入,登入時就不會再詢問帳號

在左邊有列出各個設定,選擇Connection→SSH→Tunnels,就會看到如上的頁面,
Source Port是指在本機的Socks Server開啟的Port,不清楚是什麼就填入8080
Destination空白,下面的選項填入Dynamic,代表我們需要一個不指定目的地的Socks server
設定後在左邊的分類,回到第一頁的Session,並在前一步驟輸入名稱的右邊按下Save
下次使用直接點Session name就可以使用了
按下Open後會提示問帳號跟密碼,如果前面設定Host name時有指定帳號,這裡就不會再詢問帳號
這張圖片中我把許多資訊拿掉了,因此很多地方是黑的XD
登入後,Putty就可以先縮小放著不管了,除非你有要做其他操作?
接著開啟命令提示字元,輸入指定Netstat -an
這個指令會列出目前這台電腦的所有連線,在這當中尋找一個127.0.0.1:8080
後面跟著IP為0.0.0.0:0 狀態為Listening
代表已經成功讓Putty變成Socks Server,並且已經在傾聽狀態

接著,設定需要經過Socks Server的程式
首先設定IE的Proxy,許多Client的Proxy有個自動取得,即是refer到IE的Proxy設定
開始→控制台→網際網路選項
或是IE的工具列→工具→網際網路選項
若瀏覽器是Chrome,選項→進階選項→變更代理伺服器設定

切換到連線分頁

連線→區域網路設定
勾選"在您的區域網路使用Proxy伺服器"
位址跟連接埠空白,接著點進階
在Socks的欄位,位址填127.0.0.1,連接埠填入8080
127.0.0.1是指本機的意思,因為我們在同一台電腦上開啟Socks Server
8080則是在前面設定SSH tunnel時開啟的連接埠
接著設定MSN

工具→選項→連線分頁→連線設定

MSN的Proxy可以設定Http Proxy或Socks Proxy
在更新MSN前印象中MSN可以直接走IE設定的HTTP Proxy
但更新後好像沒有辦法?因此還是要獨立設定SOCKS Proxy
設定方式跟前面類似,設定好之後可以按下測試看看是否設定正確
設定之後,我們可以藉由Netstat來看看連線的狀況
一樣開啟命令提示字元,打netstat -an
若有與127.0.0.1:8080建立連線就代表正常
或透過小工具
Sysinternals出的TCPView
不過Sysinternals被Microsoft買下來了:~
http://technet.microsoft.com/en-us/sysinternals/bb897437
圖片中可以看見不同的程式透過127.0.0.1:8080連線出去

以上,就是最基本的SSH Tunnel設定,進階版則包括以下設定

  1. Putty設定自動登入(設定Putty的Private Authentication Key)
  2. 利用plink在command line模式直接連線
  3. 搭配wifi manager的功能實現不同網路直接建立Proxy並且更換設定(例如像我設定好連上公司無線網路後,自動開啟連線建立Socks proxy,並切換Proxy到指定proxy)
以上,有需要再自己想辦法XD

Racknerd可不可以升級?搬VPS?搬遷的Step by Step (Racknerd 2024 Black Friday 新方案)

 先附上Racknerd 2024 Black Friday 新方案 RAM CPU core 空間 流量 頻寬 價格 1   G 1核 20G 1.5T/月 1Gbps $10.99/年 2.5G 2核 40G 3.0T/月 1Gbps $18.93/年 3   G 2核 60...