本性解碼

愛麗絲夢遊部落格仙境: 本性解碼逛到的,既逛之,則玩之.
我的結果大致是這樣:

雙子 50%
天蠍 20%
獅子 10%
牡羊 20%
整體性格
elleryq先生,靈活變通;溫柔體貼;開朗隨和;禮貌周到;努力向上也享受生活。
待人性格
elleryq先生待人:合情合理;重視感情;既喜歡與人同樂也能樂於獨處;有自信但不愛出風頭;有親疏觀念但不過分;大方坦蕩但也能保守秘密。
處世性格
elleryq先生處事:善於表達意見但不愛管閒事;隨和有彈性;行事圓融;把握重點兼顧細節;比較理想化;既有計劃也靈活應變。
性格缺點
elleryq先生性格的缺點為:容易產生忌妒心;有時候缺乏享受浪漫的心情;偶爾會動作緩慢老是慢半拍。
價值觀
elleryq先生重視的價值觀為:愛情的滋潤;和諧的人際關係;勢力範圍;較不擅長:與眾不同;追逐功利;出頭爭先。
愛情性格
elleryq先生在愛情上喜歡快速的進展步調,很羅曼蒂克,享受獨立也喜歡有人作伴;較常表現:幽默風趣,情深意濃,認真執著,優雅大方。
金錢性格
elleryq先生的金錢觀:花錢有分寸不浪費也不小氣,喜歡按照計劃用錢;容易把錢用於:追求新奇,享受浪漫,紓解壓力,崇尚唯美。

還可以看五星運勢,不過那是算當天的,就不貼了…
要直接算的話,點這裡吧…

mod_mono AutoConfiguration

Mono 1.1.10 前幾天 release 了,在 asp.net 方面,多了一個很方便的功能 – AutoConfiguration.
在之前,每次添加一個 asp.net application, 就需要去更動 mod_mono 設定,相當麻煩.
現在可以不用了,只要在 mod_mono.conf 添加

MonoAutoApplication enabled

之後,就可以很方便的跟寫 php application 一樣,建立目錄以後,就等同於是建立 application.
舉例來說,你在你的 Home directory 編修一個 asp.net 網頁

$ echo $USER
rupert
$ cd
$ cd public_html
$ mkdir demo
$ cd demo
$ edit hello.aspx

那麼,你編寫完以後,就可以直接

http://your_server/~rupert/demo/hello.aspx

真的是…太方便啦… 🙂

Mono Directions

今早在LinuxToday上看到Mono Directions
裡面報導了目前的現況,以及未來的方向.
我只摘錄我有興趣的幾個項目:
*mono 1.2 要等到 Windows.Form 完備以後才 release
*gmcs (.Net 2.0 c# compiler) 除了 nullable types 之外,已經齊全.
*monodevelop, 可以寫 plugin 來 enhance 了,我最期待的是 asp.net designer…
*asp.net 2.0 在進行中,但已經有不少 control 可用,而 Atlas 也開始實做.
*msbuild 也有替代品 – xbuild…但還沒作為正式 release 的內容 (Google Summer of code projects 的成品)
*xaml 也有人實作了. (Google Summer of code projects 的成品)
*ADO.Net 2.0 進行中.
其他又學到的,原來有 mono debugger可用…
介面非常類似 gdb,對熟悉 linux 程式寫作的人,不難上手.

.Net attribute

attribute, 用來為 class, method, parameters 貼上標籤,以便後續的應用.
所有的 attribute class 都要繼承 System.Attribute

class Class1Attribute: System.Attribute
{
}

使用的時候可以省略 Attribute

[Class1]
class Class2
{
}

打全名當然也是可以

[Class1Attribute]
class Class2
{
}

使用 xxx( yyy ) 時,attribute 的 constructor 會被套用,而 attribute class 裡的 property 會被自動認定為 named parameter.

class Class1Attribute: System.Attribute
{
private int _id;
private string _name;
public Class1Attribute( int id )
{
_id = id;
}
public string Name
{
get { return _name };
set { _name = value };
}
}
[Class1( 1, Name="This is a test" )]
class class2
{
}

也可以貼很多標籤上去

[AttributeUsage(AttributeTargets.Class, AllowMultiple=true)]
class Class1Attribute: System.Attribute
{
....
}
[Class1( 1, Name="This is a test" ), Class1( 2, Name="Test2" )]
class class2
{
}

但是要怎麼應用呢? 從 .Net framework documentation 裡的 sample, 大致上可以猜到.

using System;
using System.Reflection;
namespace CustomAttrCS {
// An enumeration of animals. Start at 1 (0 = uninitialized).
public enum Animal {
// Pets.
Dog = 1,
Cat,
Bird,
}
// A custom attribute to allow a target to have a pet.
public class AnimalTypeAttribute : Attribute {
// The constructor is called when the attribute is set.
public AnimalTypeAttribute(Animal pet) {
thePet = pet;
}
// Keep a variable internally ...
protected Animal thePet;
// .. and show a copy to the outside world.
public Animal Pet {
get { return thePet; }
set { thePet = Pet; }
}
}
// A test class where each method has its own pet.
class AnimalTypeTestClass {
[AnimalType(Animal.Dog)]
public void DogMethod() {}
[AnimalType(Animal.Cat)]
public void CatMethod() {}
[AnimalType(Animal.Bird)]
public void BirdMethod() {}
}
class DemoClass {
static void Main(string[] args) {
AnimalTypeTestClass testClass = new AnimalTypeTestClass();
Type type = testClass.GetType();
// Iterate through all the methods of the class.
foreach(MethodInfo mInfo in type.GetMethods()) {
// Iterate through all the Attributes for each method.
foreach (Attribute attr in Attribute.GetCustomAttributes(mInfo)) {
// Check for the AnimalType attribute.
if (attr.GetType() == typeof(AnimalTypeAttribute))
Console.WriteLine(
"Method {0} has a pet {1} attribute.",
mInfo.Name, ((AnimalTypeAttribute)attr).Pet);
}
}
}
}
}

所以你可以看到,在貼上標籤以後,其實對 Class 本身來說沒啥作用,會認為有用的,是其他的 Class, 他們可以依據這些 Attribute 來作一些特定的處理.
這邊有一系列的文章,還提出了應用.

系列 2~4 介紹一個 sql generator 的範例.
系列 5~6 是一個比較深的範例,牽涉到 Remoting 的東西
.Net framework 內也預定了不少 Attribute,我覺得還蠻有用的.
例如: Conditional attribute
以下面的範例來說,如果 DEBUG 沒被定義,那麼 Class1.M() 將不會被執行.
這倒是一個不錯的debug方法

#define DEBUG
using System;
using System.Diagnostics;
class Class1
{
[Conditional("DEBUG")]
public static void M() {
Console.WriteLine("Executed Class1.M");
}
}
class Class2
{
public static void Test() {
Class1.M();
}
}

仔細想想也可以用來作版本控管喔…某版本可以用這個 method, 但是某版本不行….
還有就是 Obsolete, 可以用來指示 class 或 method 即將被淘汰

2005/11/05慶生會

Sharon 的慶生會,當天喝掉兩瓶 Vodka ( 1.5 瓶 absolute vodka + 0.5 的思美樂 )
隔天,我宿醉,吐了,難過了一整天…慘…
好久沒這樣子了.
可是…被老婆念了一頓.
老樣子,還是從Tuboo 的相簿拉到flickr放.
想看全部的相片,請到這裡囉.
60-大合照

[新酷音]ChewingServer無法啟動

公司的電腦老是無法使用新酷音輸入法.
狀況是這樣子的,切換到新酷音輸入法之後,打任何字都會造成短暫的延遲,無法輸入.
大致的猜測,是因為 ChewingServer 無法載入.
利用 svn 下載 source code(包含 library) 之後

svn co https://svn.csie.net/chewing/win32-chewing/
svn co https://svn.csie.net/chewing/libchewing/
svn co https://svn.csie.net/chewing/libchewingpp/

進行 Trace, 花了不到十五分鐘,就找出原因.
答案是因為在載入家目錄下的 hash.dat ( 在 \Document and settings\xxx\application data\chewing\hash.dat)時,發生了異常,導致整個 ChewingServer crash.
這也是為甚麼會有短暫延遲的原因,每輸入一個字,新酷音輸入法就會試著去啟動 ChewingServer,每次啟動,每次都 crash, 因此就會有延遲.
刪除掉 hash.dat, 讓ChewingServer重新產生以後就行了.
這個問題也回報到這裡了…(很遺憾,第一次填寫,搞不清楚甚麼欄位要填啥,不小心把主旨填成自己的名字了,而且回報的內容也不夠好…下次改進)

Architecture

翻閱A UML Pattern Language的時候看到的,覺得很有道理.摘錄如下:

Architecture is what remains when you cannot take away any more things and still understand the system.
Architecture actually cover 3 similar but different ideas: architecture itself, framework, and toplogy.

ArchitectureTriple