第二次感冒

023-撒賴-01 (by Ellery)
阿詮第二次感冒,首先是喉嚨發炎,接著是支氣管發炎。
對他而言,每次感冒最大的挑戰應該是排便不順吧,因為他不愛喝水,而感冒又會耗去許多水分。
還好的是,在歷經一個星期以後,這兩天看來是好多了。希望看完第三次醫生以後,就可以完全康復~

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 字。
這些紀錄,也曾被班上同學說過我是怪物,就因為這樣,我絕對是支持這位小朋友的,請妳不要因此在心裡留下陰影。
這位小朋友絕對是注音之光!!也許她會創下注音的新時代~
News about Typing (by elleryq)

關於 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終於上映。
不錯看,不過平心而論,並沒有如前兩集那樣地讓我感動。
前兩集的某幾幕曾讓我感動得想落淚~
不過這是一個很好的段落(或斷點),希望不會再有第四集了。

BSP 使用技術概觀

這篇純粹是一篇 Overview…
BSP 大致可以分為三個部份來討論:BSP主頁面、blogger的個人頁面、blogger文章管理平台。

  • BSP 主頁面,主要就是聚合所有blogger的文章,依照發表先後順序來顯示。這部份就是直接從資料庫去Query資料出來顯示,基本上不困難。額外要補充的部份,在外面你可能還會看到本身不提供 BSP 服務,但提供聯播服務的站台,那他們又是怎麼做的呢?大致上有兩種,一種是由站台本身定期去 pull RSS/ATOM feed 回來作整合(所以想要參加聯播的人,得提出申請;或者有些blog線上閱覽器(Aggregator)會順便提供聯播Widget,如:NewsGatorGoogle Reader,因為這只是舉手之勞。);另外一種,則是站台提供有 Weblog ping service的位址,使用者需要在 BSP 的設定去填入此位址,那麼在發表文章的同時,BSP就會去通知該站台說有新文章發表了,該站台再根據這資訊來作顯示或是其他動作(所以新增文章的時候,你會用到這個,當然也可以不提供,這主要是增加 blogger 在其他網站曝光的機會)。
  • blogger個人頁面,只聚合blogger本身的文章,可以依照使用者在管理平台上指定的順序來顯示。
    1. 文章的產出,一般有常見的兩種作法:一種是從資料庫Query資料出來顯示,這方法相對來說,是比較簡單的,但是資料庫的負載會比較重;另外一種,則是在文章有更動的時候,除了更新到資料庫之外,還同時產生一份 html 檔在對應的位置上,當訪客瀏覽的時候,實際上是直接瀏覽這份 html 檔,把負載集中在 Web server 上,速度會比較快些,缺點則是要修改相關 html 檔案的連結,著名代表是:Movable Type 2.x。關於要不要產生靜態 html 檔案的討論,我記得國外或對岸有人寫專文來討論。
    2. TrackBack與留言:留言就不用說了,就留言,有些 BSP 可以讓你在管理介面上直接回覆留言,而不是作者自己要在文章上再留言一次;TrackBack則是類似 Weblog ping services,如果你在文章裡面有引用到其他人的文章,那麼你可以在發表文章的時候,指定 TrackBack 網址,那麼在發表的時候,就會通知該文章,該文章就會知道你有引用,然後在文章後面列出相關資訊。
    3. 個人化網址,目前國內 BSP 都讓你可以自訂後綴的目錄名稱,但國外的Blogger則可以讓你自訂域名,例如 http://someone.blogspot.com。實作上,多半是利用 Url rewrite 或是直接在 web server 建立相對應的目錄;Blogger的作法我並不清楚,我猜測應該是直接在 DNS 處理掉。
  • blogger文章管理平台,管理部落格基本設定,新增/修改/刪除文章,或是邀請別人一起來編輯。一般還有提供的功能:變更版面配置(有些則乾脆整份頁面讓你自己去改,如早期的 Blogger)、自訂 CSS、自訂邊欄、簡單的照片管理…等等。

此外還有:

  • RSS/ATOM,這兩種格式,說穿了,就是 XML,只要依照規範去撰寫,大致上就沒什麼問題。
  • Server 的管理、負載平衡、流量管理…

電影流水帳(2007/4/23~2007/5/1)

看的片子越來越少了。
接下來預定要看的片子:蜘蛛人3

  • Teen Wolf,Michael J. Fox主演的青春電影,一個繼承了狼人血脈的青年會在學校遇到什麼困擾呢?沒事的話可以看看~
  • Gothika,鬼影人,從頭到尾都詭異的片。簡單的說,就是鬼附身報了仇,很多事情都交代的不太清楚,需要觀眾自己去推想。全片可以說是荷莉貝瑞的個人秀,不過潘尼洛普幫襯的也不錯。