忘記密碼:
1.重新開機後, 按ESC進入開機管理程式(GRUB)
2.輸入e進入編輯模式
3.選擇 kernel /boot/vmlinuz 這行
4.輸入e進入編輯模式
5.輸入runlevel (若要修改密碼, 輸入1或輸入single), 按下enter退出編輯模式
6.輸入b並重開機則進入single user mode without password
MBR壞掉:
1.使用rescue光碟開機: linux rescue
2.grub-install /DEVICE ( 例如: /dev/hda )
3.若 /sbin/grub: not found.
4.進入grub模式: grub
5.grub> root (hd0, 0) # (hd0, 0) 第二個0是linux boot partition mark
6.grub> setup (hd0)
7.grub> quit
/etc/fstab壞掉
1.使用single user mode登入系統
2.mount -n -o remount,rw /
3.重新修改/etc/fstab
2009年2月28日 星期六
2008年11月16日 星期日
Partition Manager for Vista
最近硬碟諸事不順,
首先是用了三年的Toshiba R100硬碟突然壞掉,
後來新購買的X61又遇到Vista磁區無法重新切割的問題,
在用了GParted與PartitionMagic失敗後,
發現有套免費的軟體EASEUS Partition Manager在Vista上運作的非常順利,
終於解決在Vista上進行Partition Manager的問題了...
首先是用了三年的Toshiba R100硬碟突然壞掉,
後來新購買的X61又遇到Vista磁區無法重新切割的問題,
在用了GParted與PartitionMagic失敗後,
發現有套免費的軟體EASEUS Partition Manager在Vista上運作的非常順利,
終於解決在Vista上進行Partition Manager的問題了...
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
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:
啟動SSL出現錯誤訊息...
原來是openssl版本判斷的問題,
修改抓回來的source,
檔案httpd-2.0.53/modules/ssl/ssl_toolkit_compat.h
重新config就完成啦! 說明請參考此處...
但這次稍微踢到鐵板, 因此紀錄一下吧
鐵板版本為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日 星期四
2008年7月7日 星期一
Request From an Authentication Web Server via Telnet
如何向有基本驗證的網頁伺服器以telnet的方式請求網頁?
根據Wikipedia的說明, authentication的使用者名稱與密碼是透過Base64的方式編碼, 格式為user:password,
因此須先準備好編碼完的結果, 可參考Base64與ASCII的互換,
以telnet到localhost的根目錄為範例, 帳號與密碼為admin:password
根據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;
}
訂閱:
文章 (Atom)
