今天在 Mono-dev 群組上看到有人詢問是否有類似 GWT 的軟體,可以快速開發 .Net 上的 ajax 程式。
Miguel 大大回答到有這麼一套:Visual WebGui (VWG)
有空的話,來試試看好不好用。
語音轉帳繳納罰款
前幾天,因為違規迴轉的關係,被開了一張單。
幸好警察先生網開一面,只開了”未帶安全帽”的項目,只要繳納 500 元即可。
依照罰單背面的指示,我用語音轉帳的方式來繳納,電話號碼是 412-6666 再按 168#,接著輸入身份證號,然後依照指示操作即可。
蠻方便的,至少省掉了跑郵局/監理所/便利商店的麻煩事。
Vim 7.1 / MRU / TagMenu
最近 Vim 釋出了 7.1 版,這兩天順手更新了。
在下載的同時,邊找一下有沒有好用的 Plugin:
- mru – Plugin to manage Most Recently Used (MRU) files,顧名思義,就是在 Menu 安插一個 Most recent used (最近使用) 的選單,讓你可以從選單選到最近編輯的檔案。
- TagsMenu – Creates a menu of all the tags in the current file.,這個其實跟 taglist 很像,只是 taglist 是分割一個視窗出來顯示 Tag,而 TagsMenu 則是在選單安插一個 Tags 項目,顯示出所有 Tags。他的 ctags 指令比較不一樣,記得要加上 -f – –fields=+K,例如:
let TagsMenu_ctagsCommand=’c:\tools\ctags.exe -f – –fields=+K ‘
第二次感冒
CVSNT 混合使用 protocol
我們 team 的 CVSNT 一直是用 SSPI 方式,直接與公司內部的 Active Directory 接軌作認證。
如果你想要一些不是在網域的人也能存取 CVS Repostiroy 的話,該怎麼辦呢?
其實 CVSNT 安裝的時候,預設就已經是同時開啟 SSPI 與傳統的使用者認證了~
所以,你需要更動 Server Repository 的 CVSROOT 目錄下的 users、passwd 檔案。
users 的檔案格式是 username:e-mail
passwd 的檔案格式是 username:password:alias
這邊的 password 應該要填入加密過的,不過你可以先不填,稍後再利用 CVS passwd 指令來更改。
舉例來說,你在 users 檔案加入了一行 paul:paul@xxx.com,在 passwd 檔案加入了一行 paul::paul
接著在 client 端使用 cvs -d :pserver:paul@your_server:/your_module login 登入,在詢問密碼時,按下 Enter。
再使用 cvs -d :pserver:paul@your_server:/your_module passwd 更動密碼即可。
如果你要把混合認證的功能關掉的話,得去修改 CVSNT 安裝目錄下的 protocol_map.ini,加入一行 pserver=none,重新啟動 CVSNT 服務以後就可以關閉了。
參考資料:
注音之光!
今天在Yahoo!奇摩新聞看到一則新聞,標題是”注音中打每分鐘154字! 小六女童綽號「打字變態」”。
我想說的是,”打字快,絕對不是變態!打注音快,更不是變態!!”
當初我在學校上打字課時,也創下全班英打最快,每分鐘約 80 字的紀錄。
非官方的中打紀錄,則是:使用注音輸入法每分鐘約 40 字,使用自然/忘形注音輸入法每分鐘約 60~80 字。
這些紀錄,也曾被班上同學說過我是怪物,就因為這樣,我絕對是支持這位小朋友的,請妳不要因此在心裡留下陰影。
這位小朋友絕對是注音之光!!也許她會創下注音的新時代~

關於 Joost
從網路上很多 blogger 紛紛釋出 Joost 邀請函以後,我就很想試試看,但是不知道為甚麼始終還沒去要。
最後一根稻草是因為從這裡得知有這個專門發送邀請函的網站,或許是因為當年我的gmail邀請函也是這樣弄來的吧,終於決定來試試看。
收到邀請函以後,就點選信中的連結,取得 Joost 軟體。
首先,安裝在桌機試試看…不行,無法執行,因為我的桌機是 Windows 2000,是的,Joost 不支援 Windows 2000。
那麼,裝在 Notebook 試試看吧…安裝以後,是可以執行了,可是,頓頓的,因為我的 Notebook 配備不夠,Video Memory 不足(顯示卡不夠力),記憶體也不足。
嗯~看來還是等電腦升級以後再說吧~
利用 Gmail SMTP server 來寄信
詳情可以參考這篇:Send E-Mail from your .NET application using your GMail Account,內文提供了 .Net 1.1/2.0 的方法。
我自己用 .Net 2,試的結果,發現有這個錯誤訊息出現:”Must issue a STARTTLS command first”
Google 大神告訴我,有蠻多人詢問這個問題。
仔細研讀之後,發現是我自己忘了幫 SmtpClient 設置 EnableSsl 屬性為 true。
加上之後,又丟出 “The requested feature is not implemented.”。
咦?沒實做,難道我用的Mono 1.2.3.1還沒實做這部份?
用Reflector反組譯出來看之後,果然…真的還沒實做 SSL 傳輸的部份。
希望下一版會加進去…這樣就可以在 Linux 下使用了。
以下是程式碼,它是一個命令列的程式,讓你可以指定必要的欄位後寄送郵件。
打 MailSharp -h 可以得到使用說明。
/**
* MailSharp
*
* Reference:
* Send E-Mail from your .NET application using your GMail Account - The Code Project - C# Programming <http://www.codeproject.com/useritems/SendMailUsingGmailAccount.asp>
*/
using System;
using System.Text;
using System.IO;
using System.Net;
using System.Net.Mail;
using System.Net.Mime;
using System.Threading;
using System.ComponentModel;
namespace MailSharp {
public class MailSharpConsole {
public static string showUsage() {
StringBuilder sb = new StringBuilder();
sb.AppendLine( "Usage: MailSharp [options] ToAddress" );
sb.AppendLine( "\t-a File to attach." );
sb.AppendLine( "\t-f From address" );
sb.AppendLine( "\t-b Body message" );
sb.AppendLine( "\t-s Subject");
sb.AppendLine( "\t-S SMTP server host" );
sb.AppendLine( "\t-U Username for SMTP server authentication" );
sb.AppendLine( "\t-p Password for SMTP server authentication" );
sb.AppendLine( "\t-l Use SSL" );
sb.AppendLine( "\t-h Help/Usage");
sb.AppendLine();
sb.AppendLine( "Example:" );
sb.AppendLine( "\tFor GMail" );
sb.AppendLine( "\tMailSharp -f your_name@gmail.com -b Test -s Test -S smtp.gmail.com -P 587 -l -U your_gmail -p your_gmail_password someone@somewhere.com" );
return sb.ToString();
}
public static void Main(string[] args) {
MailAddress from = null;
MailAddress to = null;
MailMessage message = new MailMessage();
SmtpClient client = new SmtpClient();
NetworkCredential myCred = new NetworkCredential();
bool bShowUsage=false;
try {
if ( args.Length > 0 ) {
for ( int i=0; i<args.Length; i++ ) {
switch ( args[i] ) {
case "-S": // server host
i++;
if ( i<args.Length ) {
client.Host = args[i];
} else
throw new Exception( "-S was specified, but no value." );
break;
case "-P": // server port
i++;
if ( i<args.Length ) {
client.Port=Convert.ToInt32( args[i] );
} else
throw new Exception( "-P was specified, but no value." );
break;
case "-T": // timeout
i++;
if ( i<args.Length ) {
client.Timeout = Convert.ToInt32( args[i] );
} else
throw new Exception( "-T was specified, but no value." );
break;
case "-U": // username for smtp server authentication
i++;
if ( i<args.Length )
myCred.UserName = args[i];
else
throw new Exception( "-U was specified, but no value." );
break;
case "-p": // password for smtp server authentication
i++;
if ( i<args.Length )
myCred.Password = args[i];
else
throw new Exception( "-p was specified, but no value." );
break;
case "-l": // use SSL
client.EnableSsl = true;
break;
case "-s": // subject
i++; // next one is subject.
if ( i<args.Length ) {
message.Subject = args[i];
message.SubjectEncoding = System.Text.Encoding.UTF8;
} else
throw new Exception( "-s was specified, but no value." );
break;
case "-a": // attachment
i++; // next one is attachment filename.
if ( i<args.Length ) {
// Add attachment.
Attachment data = new Attachment( args[i], MediaTypeNames.Application.Octet);
message.Attachments.Add(data);
} else
throw new Exception( "-a was specified, but no value." );
break;
case "-b": // body message.
i++; // next one is body message
if ( i<args.Length ) {
message.Body = args[i];
message.BodyEncoding = System.Text.Encoding.UTF8;
} else
throw new Exception( "-b was specified, but no value." );
break;
case "-f": // from address
i++;
if ( i<args.Length ) {
// Specify the e-mail sender.
// Create a mailing address that includes a UTF8 character
// in the display name.
// from = new MailAddress( "someone@gmail.com", "someone", System.Text.Encoding.UTF8);
from = new MailAddress( args[i] );
} else
throw new Exception( "-f was specified, but no value." );
break;
case "-h": // show help/usage
bShowUsage=true;
break;
default:
to = new MailAddress( args[i] );
break;
}
}
} else
throw new Exception("No arguments.");
} catch ( Exception ex ) {
Console.WriteLine( ex.Message );
bShowUsage = true;
}
try {
if ( bShowUsage == true )
throw new Exception( showUsage() );
if ( from==null )
throw new Exception( "Must specify from address (-f)." );
// Set destinations for the e-mail message.
if ( to == null )
throw new Exception("At least, must specify to address");
if ( client.Host == string.Empty )
throw new Exception("Must specify SMTP Server (-S)." );
// Specify the message content.
message.From = from;
message.To.Add( to );
// Credentials are necessary if the server requires the client
// to authenticate before it will send e-mail on the client's behalf.
//client.UseDefaultCredentials = false;
client.Credentials = myCred;
// Send.
// If you need asynchronous sample, please visit the reference above.
client.Send(message);
Console.WriteLine("Done.");
} catch ( Exception ex ) {
Console.WriteLine( "Exception was raised when sending...");
Console.WriteLine( ex.Message );
} finally {
// Clean up.
message.Dispose();
}
}
}
}
如果你打算在 Linux 下服用的話,可以搭配這個 script,免去你每次前面都要打 mono 的麻煩。
#!/bin/sh exec /usr/bin/mono $MONO_OPTIONS "MailSharp.exe" "$@"
小時被妹妹放鳥
前幾天跟我兒子講的故事…
記得小學六年級有一陣子在密集地進行教學觀摩的演練,主題是”維他命”。
班上每個同學都有每個人的任務,我的任務是在當天攜帶維他命去~
到了正式要觀摩那天,早早就跟妹妹走路上學去,走到了合立汽車教練場門口(現在的HomeBox)時,才發現我忘了帶!!
這下可糟糕,只好跑回去拿,可是書包很重,怎麼辦?於是我跟大妹說:”你幫我看著一下,我跑回家去,很快就回來!”
當我氣喘吁吁的回到合立汽車教練場門口的時候,發現地上只剩下我的書包,妹妹兩人早已不知去向。
還好書包沒有不見,於是我拾起書包,加緊趕路到學校去。
後來我向我妹質問為甚麼不等我,可是…現在的我早已經忘記她的回答是什麼了…
Spider-Man 3
Spider-Man 3終於上映。
不錯看,不過平心而論,並沒有如前兩集那樣地讓我感動。
前兩集的某幾幕曾讓我感動得想落淚~
不過這是一個很好的段落(或斷點),希望不會再有第四集了。
