2008年11月13日 星期四

Enable POP in Gmail

In Gmail settings:
1. Click Settings at the top of any Gmail page.
2. Click Forwarding and POP/IMAP.
3. Select Enable POP for all mail or Enable POP for mail that arrives from now on.

In Outlook Express settings:
1. In Incoming mail(POP3): pop.gmail.com
2. In Outgoing mail(SMTP): smtp.gmail.com
3. In Advanced tab,
3.1 Check both "This server requires a secure connection(SSL)" checkbox of SMTP and POP3
3.2 Modify the port number of SMTP to 465, and POP3 to 995

see here and here

Apache + SSL

Apache + SSL真不是新東西了, 之前也做過好多次了...
但這次稍微踢到鐵板, 因此紀錄一下吧

鐵板版本為httpd-2.0.53/54 + openssl-0.9.8:
wget http://www.openssl.org/source/openssl-0.9.8i.tar.gz
./config
make && make install

wget ftp://ftp.yzu.edu.tw/mirror/pub1/Sun/sunfreeware.com/ \\ SOURCES/httpd-2.0.53.tar.gz
./configure --enable-so --enable-ssl --with-ssl=/usr/local/ssl
make && make install

啟動SSL出現錯誤訊息...
/usr/local/apache/bin/apachectl startssl
ssl_engine_pphrase.c: In function `ssl_pphrase_Handle_CB':

原來是openssl版本判斷的問題,
修改抓回來的source,
檔案httpd-2.0.53/modules/ssl/ssl_toolkit_compat.h
#ifdef OPENSSL_VERSION_NUMBER

+#if (OPENSSL_VERSION_NUMBER >= 0x0090800fL)
+#ifndef PEM_F_DEF_CALLBACK
+#define PEM_F_DEF_CALLBACK PEM_F_PEM_DEF_CALLBACK
+#endif
+#endif
+
/*
* rsa sslc uses incomplete types for most structures
* so we macroize for OpenSSL those which cannot be dereferenced

重新config就完成啦! 說明請參考此處...

2008年7月10日 星期四

熱血青年

今天跟mcleemakoto聚餐, 感覺熱血沸騰,
有為者亦若是阿, 待我自由身, 必當有一番作為,
感謝這些同學們...

2008年7月7日 星期一

Request From an Authentication Web Server via Telnet

如何向有基本驗證的網頁伺服器以telnet的方式請求網頁?

根據Wikipedia的說明, authentication的使用者名稱與密碼是透過Base64的方式編碼, 格式為user:password,

因此須先準備好編碼完的結果, 可參考Base64與ASCII的互換,

以telnet到localhost的根目錄為範例, 帳號與密碼為admin:password
GET / HTTP/1.1
HOST: 127.0.0.1
Authorization: Basic YWRtaW46cGFzc3dvcmQ=
結果
HTTP /1.1 200 OK

2008年6月25日 星期三

Combination Generator for PHP

之前需要寫個組合產生器,
寫來寫去, 也跟網路上找到的寫法一樣, 就順便用了他的注解嚕...
/*                                                                                                                            
 * Date   : 2008-06
 * Name   : getCombinationOutput
 * Usage  : Generate all combinations of the elements in the array
 * Input  : @param array   input array contains all elements
 *          @param integer number of choosing
 *          @param string  output file name
 * Output : a text file contains all combination
 *
 * Example :
 * $array = array( 684, 1056, 1066, 1274 );
 * getCombinationOutput( $array, 2, "test.out" );
 *
 * test.out :
 * 684 1056
 * 684 1066
 * 684 1274
 * 1056 1066
 * 1056 1274
 * 1066 1274
 */

function getCombinationOutput( $input_array, $select, $output )
{
    $_number = sizeof($input_array);

    if ( !($_fp = fopen( $output, "a") ) ) 
    {   
        echo "can't open file!\n\r";

        return 0;
    }   

    $_array = array();

    for ( $_i=0; $_i<$select; $_i++ )
    {
        $_array[$_i] = $_i + 1;
    }

    while (1)
    {
        $_temp = array();

        for ( $_i = 0; $_i < $select; $_i++ )
        {
            $_index = $_array[$_i];

            fwrite ( $_fp, $input_array[$_index -1]." " );
        }

        fwrite ( $_fp, "\n" );

        // generate next combination in lexicographical order
        // start at last item
        $_i = $select - 1;

        // find next item to increment
        while ( $_array[$_i] == ( $_number - $select + $_i + 1 ) )
        {
            $_i--;
        }

        // all done
        if ( $_i < 0 )
        {
            break;
        }

        // increment
        $_array[$_i] = $_array[$_i] + 1;
        // do next
        for ( $_j = $_i + 1; $_j < $select; $_j++ )
        {
            $_array[$_j] = $_array[$_i] + $_j - $_i;
        }
    }

    fclose ( $_fp );

    return $output;
}                                                  

2008年5月20日 星期二

Cisco Certified Network Associate

話說 還在抱怨近來的不爭氣,
"馬上"就又去考了CCNA...
不過接下來將開始做點正事了,
下半年將會硬梆梆, 真是由硬入軟易, 由軟入硬難...

2008年5月7日 星期三

Google台灣演說

以前很少聽到台灣Google的人發言,
但最近有幸聽到幾場演說, 在此筆記一下...

林一平@TANET 2007: Issues on Mobile All-IP Networks
Ray Chen@OSDC 2008: Google Gears
李開復@NTU: Cloud Computing
翟本喬@EAF嵌入式應用論壇: 消費性電子設備的網路服務