2009年5月13日 星期三

[Other] 很有趣的邏輯測試


網路上看到的 ...

---------------以下開始--------------------

TEST FOR DEMENTIA

很有趣的邏輯測試
Below are four (4) questions and a bonus question. You have to answer them instantly. You can't take your time, answer all of them immediately. Let's find out just how clever you really are. 下列有4 個問題及一個加分題,你必須立刻回答,不能花時間慢慢想,讓我們看看你有多聰明。
Ready? GO!!! (scroll down)準備好,向下捲!
First Question: 第一題
You are participating in a race. You overtake the second place person. What position are you in? 你參加賽跑,追過第 2名,你是第幾名?
Answer: If you answered that you are first, then you are wrong! If you overtake the second place person, and you take their place, you are second!
解答: 如果你的回答是第 1 名,你就錯了!你如果追過第2 名,你只是取代那人的位置,你是第 2 名。
To answer the second question, don't take as much time as you took for the first question. 回答第 2 題,你不能使用與回答第 1題相同的時間。
Second Question 第二題 :
If you are in a race, and you overtake the last person, then you are?
你參加賽跑,你追過最後一名,你是第幾名?
Answer: If you answered that you are second to last, then you are wrong again. Tell me, how can you overtake the LAST person?! You're not having a good time at this! Are you?
解答: 如果你的回答是倒數第 2 名,你又錯了!告訴我,你怎能追過最後一名?顯然你並未樂在其中!
Very tricky maths! Note: This must be done in your head only. Do NOT use paper and pencil or a calculator. Try it. 很詭異的算術!這只能在腦中盤算。不要使用紙與筆或計算機,試試看。
Third Question:第三題
Take 1000 and add 40 to it. Now add another 1000. Now add 30. Add another 1000. Now add 20. Now add another 1000. now add 10. What is the total?
以 1000加上 40 ,再加 1000,再加 30,再加 1000,現在加上 20,再加一次 1000,現在加上 10 ,總數是什麼?
Answer: Did you get 5000? The correct answer is actually 4100. Don't believe it? Check with your calculator!
解答: 得到 5000 是嗎?正確答案是4100 ,不要相信,用計算機查證吧!
Today is definitely not your day. Maybe you will get the last question right?
今天對你鐵定諸事不宜,或許最後一題你會答對?
Fourth Question: 第四題
There is a mute person who wants to buy a toothbrush. By imitating the action of brushing one's teeth he successfully expresses himself to the shopkeeper and the purchase is done. Now if there is a blind man who wishes to buy a pair of sunglasses, how should he express himself?
一個啞巴想買牙刷,他模仿刷牙的動作,成功的向店主表達,也完成了購買。現在如果一個瞎子想買一副太陽眼鏡,他要如何表達?
Answer: He just has to open his mouth and ask. He's blind, not mute - so simple.
解答: 他只要張開嘴問即可。他是瞎子,不是啞巴。就這麼簡單!


[Other] Windows Live Mail 備份郵件規則 教學

啟動註冊表編輯器的步驟如下:開始->運行->regedit

HKEY_CURRENT_USER\softwave\microsoft\windows live mail\Rules\Mail

選擇 匯出 命令,把這個郵件規則備份到安全的地方。

以後要導入此郵件規則,只要雙擊所備份的reg文件,資料就會自動導入了

2009年3月27日 星期五

[AutoHotKey] 按下熱鍵開啟連發,再按一次熱鍵 停止連發

;看得懂得人就看吧。
;--------------------------------以下開始------------------------------

#Persistent
#NoEnv

v_Enable=0
UpdateSplashImage()
{
Global
if(v_Enable=0)
{
SplashImage,,X10 Y10 H24 W36 CWFF0000 CT000000 ZX5 ZY5 B2 FS9 WS700, NO
return
}
else
{
SplashImage,,X10 Y10 H24 W36 CW00FF00 CT000000 ZX5 ZY5 B2 FS9 WS700, OK
}
}

$`::
{
v_Enable:=!v_Enable
If (v_Enable=0)
{
SetTimer, Label0, Off
UpdateSplashImage()
}
else
{
SetTimer, Label0, 100
UpdateSplashImage()
}
}
Return

Label0:
{
SendRaw, {F5}
}

2009年3月24日 星期二

[C#] 我犯了沒看書的錯..全域變數

 我寫程式喜歡把所有東西都包在 Button 裡面,可是當不同的 Button 需要用到相同的變數時

 是個很大的困擾。。。



 竟然發現要把變數放在 ..

 public partial class Form1 : Form
    {
        DataTable dt;   <----------  OK
       
        public Form1()
        {
            InitializeComponent();
            DataTable dt2; <----------NG
        }

..  太高興了

2009年3月17日 星期二

[C#] IF內部的變數,如果外部要使用的時候 小技巧(書裡面沒教的)

原本

                           
                            if (result.Rows.Count == 0)
                            {

                             km.SQLExecute("INSERT INTO MGMES.dbo.PACKAGE_SN_FILL() VALUE () ");
                            }
                            else
                            {
                                 String show5_4_1 = result.Rows[0].ItemArray[0].ToString();
                               
                            }
                          
                            string show5_4_1_ADD1 = show5_4_1.Substring(1, 5); //這時候 show_5_4_1 不能使用




改成



                            string show5_4_1="";
                           
                            if (result.Rows.Count == 0)
                            {

                                km.SQLExecute("INSERT INTO MGMES.dbo.PACKAGE_SN_FILL() VALUE () ");
                            }
                            else
                            {
                                 show5_4_1 = result.Rows[0].ItemArray[0].ToString();
                               
                            }
                          
                            string show5_4_1_ADD1 = show5_4_1.Substring(1, 5); //可以使用了