<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Eric&#039;s Who Know</title>
	<atom:link href="http://who-know.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://who-know.com</link>
	<description>C&#039;est La Vie</description>
	<lastBuildDate>Mon, 17 May 2010 22:21:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>用 C# 實作一個簡單的 Word &#8211; LoadFile, SaveFile</title>
		<link>http://who-know.com/c-sharp-helloword-richtextbox-loadfile-savefile/</link>
		<comments>http://who-know.com/c-sharp-helloword-richtextbox-loadfile-savefile/#comments</comments>
		<pubDate>Mon, 17 May 2010 10:58:26 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[C Sharp]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[MSDN]]></category>
		<category><![CDATA[RichTextBox]]></category>

		<guid isPermaLink="false">http://who-know.com/?p=103</guid>
		<description><![CDATA[01. RichTextBox 除了之前介紹的 Copy、Cut、Paste、SelectAll 等 Method 外，還有 Clear、ClearUndo、Find、LoadFile、Redo、Undo、SaveFile ...etc。這篇就來介紹 LoadFile、SaveFile 開檔、存檔。 // 完整的 RichTextBox 請看 MSDN RichTextBox Class。 02. 男主角 ：LoadFile 它有三個好兄弟。 &#160;&#160;a. LoadFile( String ) : Loads a rich text format (RTF) or standard ASCII text file into the RichTextBox control. // If the file being loaded is not an RTF document, an exception [...]]]></description>
			<content:encoded><![CDATA[<p>01. RichTextBox 除了之前介紹的 Copy、Cut、Paste、SelectAll 等 Method 外，還有 Clear、ClearUndo、Find、LoadFile、Redo、Undo、SaveFile ...etc。這篇就來介紹 LoadFile、SaveFile 開檔、存檔。</p>
<p>// 完整的 RichTextBox 請看 <a href="http://msdn.microsoft.com/en-US/library/system.windows.forms.richtextbox.aspx" target="_blank">MSDN RichTextBox Class</a>。<span id="more-103"></span></p>
<p>02. 男主角 ：<a href="http://msdn.microsoft.com/en-US/library/system.windows.forms.richtextbox.loadfile.aspx" target="_blank">LoadFile</a> 它有三個好兄弟。</p>
<p>&nbsp;&nbsp;a. <a href="http://msdn.microsoft.com/en-US/library/3f99sst7.aspx" target="_blank">LoadFile( String )</a> : Loads a rich text format (RTF) or standard ASCII text file into the RichTextBox control.<br />
// If the file being loaded is not an RTF document, an exception will occur.</p>
<pre class="brush: csharp; title: ; notranslate">richTextBox.LoadFile( fileName );</pre>
<p>&nbsp;&nbsp;b. <a href="http://msdn.microsoft.com/en-US/library/d76176b1.aspx" target="_blank">LoadFile( String, RichTextBoxStreamType )</a> : Loads a specific type of file into the RichTextBox control. </p>
<pre class="brush: csharp; title: ; notranslate">
// for Rich Text File( RTF )
richTextBox.LoadFile( fileName, RichTextBoxStreamType.RichText );
// for Plain Text File( Txt )
richTextBox.LoadFile( fileName, RichTextBoxStreamType.PlainText );
</pre>
<p>&nbsp;&nbsp;c. <a href="http://msdn.microsoft.com/en-US/library/ms160332.aspx" target="_blank">LoadFile( Stream, RichTextBoxStreamType )</a> : Loads the contents of an existing data stream into the RichTextBox control. </p>
<pre class="brush: csharp; title: ; notranslate">
// Declare a new memory stream.
System.IO.MemoryStream myMemory = new System.IO.MemoryStream();

private void button_Click( object sender , EventArgs e ) {
  // 把 leftRichTextBox 的內容存到 memory stream
  leftRichTextBox.SaveFile( myMemory , RichTextBoxStreamType.PlainText );

  myMemory.WriteByte( 13 ); // ASCII 13 (CR)
  myMemory.WriteByte( 10 ); // ASCII 10 (LF)
  myMemory.Position = 0;

  // 把 memory stream 的內容讀到 leftRichTextBox
  rightRichTextBox.LoadFile( myMemory , RichTextBoxStreamType.PlainText );
} // button_Click()
</pre>
<p><a href="http://pic.who-know.com/C_Sharp_MDI_Word_Implement/005.png" class="highslide-image" onclick="return hs.expand(this);" target="_blank"><img class="doCenter" src="http://pic.who-know.com/C_Sharp_MDI_Word_Implement/005.png" alt=""/></a></p>
<p>03. 女主角 ：<a href="http://msdn.microsoft.com/en-US/library/system.windows.forms.richtextbox.savefile.aspx" target="_blank">SaveFile</a> 它有三個好姊妹。</p>
<p>&nbsp;&nbsp;a. SaveFile(String) Saves the contents of the RichTextBox to a rich text format (RTF) file.</p>
<p>&nbsp;&nbsp;b. SaveFile(String, RichTextBoxStreamType) Saves the contents of the RichTextBox to a specific type of file. </p>
<p>&nbsp;&nbsp;c. SaveFile(Stream, RichTextBoxStreamType) Saves the contents of a RichTextBox control to an open data stream.</p>
<p>// 用法同剛才介紹的 <a href="http://msdn.microsoft.com/en-US/library/system.windows.forms.richtextbox.loadfile.aspx" target="_blank">LoadFile</a>。</p>
<p>04. 那如何把它加到之前做的 HelloWord Editor 呢？為了公平起見，所以現在介紹存檔的另存新檔。</p>
<p>&nbsp;&nbsp;a. 跟之前的 Copy、Cut、Paste、SelectAll 一樣，先在 NewFileForm.cs 寫好一些方法以供呼叫 RTBLoadOldFile、RTBSaveFileAs。</p>
<p>&nbsp;&nbsp;b. 先來一個 SaveFileDialog，看要不要設定一下 InitialDirectory 、Filter 等，如果按了確定就存檔。</p>
<pre class="brush: csharp; title: ; notranslate">
private void SaveAsToolStripMenuItem_Click( object sender , EventArgs e ) {
  NewFileForm activeForm = ( NewFileForm ) this.ActiveMdiChild;
  if ( activeForm != null ) {
    SaveFileDialog saveFileDialog = new SaveFileDialog();
    if ( saveFileDialog.ShowDialog( this ) == DialogResult.OK ) {
      string fileName = saveFileDialog.FileName;
      activeForm.RTBSaveFileAs( fileName );
    } // if
  } // if 避免有人來亂, 沒有視窗卻要存檔
  else
    MessageBox.Show( &quot;來亂的喔!!&quot; );
} // SaveAsToolStripMenuItem_Click() 另存新檔
</pre>
<p>上面也可以設定 InitialDirectory, Filter, DefaultExt, AddExtension, RestoreDirectory ... etc，更多請看 <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.savefiledialog.aspx" target="_blank">MSDN SaveFileDialog Class</a>。</p>
<pre class="brush: csharp; title: ; notranslate">
saveFileDialog.InitialDirectory = Environment.GetFolderPath( Environment.SpecialFolder.Personal );
saveFileDialog.Filter = &quot;HelloWord Files (*.hw)|*.hw|Rich Text Files (*.rtf)|*.rtf|All Files (*.*)|*.*&quot;;
</pre>
<p>// <a href="http://msdn.microsoft.com/en-us/library/system.environment.specialfolder.aspx" target="_blank">Environment.SpecialFolder Enumeration</a>></p>
<p>上面 Environment.SpecialFolder.Personal 的 Personal 可以換成 Desktop、MyComputer、MyDocuments ...etc。或直接寫路徑 saveFileDialog.InitialDirectory = "c:\\";</p>
<p>05. 至於 NewFileForm.cs 裡的 RTBLoadOldFile 和 RTBSaveFileAs 要怎麼寫就自己思考下吧。</p>
]]></content:encoded>
			<wfw:commentRss>http://who-know.com/c-sharp-helloword-richtextbox-loadfile-savefile/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>用 C# 實作一個簡單的 Word &#8211; 整合篇</title>
		<link>http://who-know.com/implement-c-sharp-helloword-integrate/</link>
		<comments>http://who-know.com/implement-c-sharp-helloword-integrate/#comments</comments>
		<pubDate>Sat, 15 May 2010 23:08:31 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[C Sharp]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://who-know.com/?p=102</guid>
		<description><![CDATA[01. 之前那麼乾淨的 NewFileForm 經過我們的努力，有了一些方法可以呼叫了，現在就把它和 MDIWord.cs 結合在一起吧。MDIWord.cs 右鍵 View Code 把 ShowNewForm() 裡空洞的 Form 換成我們的 NewFileForm。 02. 做那麼久也剛來執行看看了。 03. 現在可以開新檔案也可以輸入文字了，但之前寫的那麼多 C# code 都沒用上，現在就把它們結合在一起吧。 &#160;&#160;a. 切換到 MDIWord.cs [Design] -> Edit -> Copy(點兩下) 會看到 改成 &#160;&#160;b. 做完 Copy 再做一個 Paste，這樣去 run 才有感覺。 04. 糟糕，剛才有寫設定字型、色彩的方法，不過我們的畫面沒有現成的按鈕可以按耶，點一下 Add toolStripButton 增加一個 Button，順便幫它弄一個所見即所得的圖片。 05. 剩下的就自己摸索吧，開啟舊檔、搜尋、取代、列印等等等等等。]]></description>
			<content:encoded><![CDATA[<p>01. 之前那麼乾淨的 NewFileForm 經過我們的努力，有了一些方法可以呼叫了，現在就把它和 MDIWord.cs 結合在一起吧。MDIWord.cs 右鍵 View Code 把 ShowNewForm() 裡空洞的 Form 換成我們的 NewFileForm。<span id="more-102"></span></p>
<pre class="brush: csharp; title: ; notranslate">
private void ShowNewForm( object sender , EventArgs e ) {
  Form childForm = new Form();
  // 換成 NewFileForm childForm = new NewFileForm();
  childForm.MdiParent = this;
  childForm.Text = &quot;Window &quot; + childFormNumber++;
  childForm.Show();
} // ShowNewForm() 開新檔案
</pre>
<p>02. 做那麼久也剛來執行看看了。</p>
<p><a href="http://pic.who-know.com/C_Sharp_MDI_Word_Implement/002.png" class="highslide-image" onclick="return hs.expand(this);" target="_blank"><img class="doCenter" src="http://pic.who-know.com/C_Sharp_MDI_Word_Implement/002.png" alt="" width="480" height="430"/></a></p>
<p>03. 現在可以開新檔案也可以輸入文字了，但之前寫的那麼多 C# code 都沒用上，現在就把它們結合在一起吧。</p>
<p>&nbsp;&nbsp;a. 切換到 MDIWord.cs [Design] -> Edit -> Copy(點兩下)<br />
會看到 </p>
<pre class="brush: csharp; title: ; notranslate">private void CopyToolStripMenuItem_Click( object sender , EventArgs e ) {}</pre>
<p>改成</p>
<pre class="brush: csharp; title: ; notranslate">
private void CopyToolStripMenuItem_Click( object sender , EventArgs e ) {
  NewFileForm activeForm = ( NewFileForm ) this.ActiveMdiChild;
  activeForm.MdiParent = this;
  activeForm.RTBCopy();
} // CopyToolStripMenuItem_Click() 複製
</pre>
<p>&nbsp;&nbsp;b. 做完 Copy 再做一個 Paste，這樣去 run 才有感覺。</p>
<p>04. 糟糕，剛才有寫設定字型、色彩的方法，不過我們的畫面沒有現成的按鈕可以按耶，點一下 Add toolStripButton 增加一個 Button，順便幫它弄一個所見即所得的圖片。</p>
<p><a href="http://pic.who-know.com/C_Sharp_MDI_Word_Implement/003.png" class="highslide-image" onclick="return hs.expand(this);" target="_blank"><img class="doCenter" src="http://pic.who-know.com/C_Sharp_MDI_Word_Implement/003.png" alt="" width="480" height="430"/></a></p>
<p><a href="http://pic.who-know.com/C_Sharp_MDI_Word_Implement/004.png" class="highslide-image" onclick="return hs.expand(this);" target="_blank"><img class="doCenter" src="http://pic.who-know.com/C_Sharp_MDI_Word_Implement/004.png" alt="" width="480" height="430"/></a></p>
<p>05. 剩下的就自己摸索吧，開啟舊檔、搜尋、取代、列印等等等等等。</p>
]]></content:encoded>
			<wfw:commentRss>http://who-know.com/implement-c-sharp-helloword-integrate/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>用 C# 實作一個簡單的 Word &#8211; NewFileForm</title>
		<link>http://who-know.com/implement-c-sharp-helloword-newfileform/</link>
		<comments>http://who-know.com/implement-c-sharp-helloword-newfileform/#comments</comments>
		<pubDate>Sat, 15 May 2010 23:05:32 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[C Sharp]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[ColorDialog]]></category>
		<category><![CDATA[FileDialog]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[MSDN]]></category>
		<category><![CDATA[RichTextBox]]></category>

		<guid isPermaLink="false">http://who-know.com/?p=101</guid>
		<description><![CDATA[00. 現在按"開新檔案"出現的是一個上面沒有任何東西的 Form，現在我們就來幫它加一個 RichTextBox，讓我們可以在上面輸入文字。 // 在這裡我們先改名字 Form1.cs 改成 NewFileForm.cs、Form1 改成 NewFileForm 01. 然後在 Common Controls 拉一個 RichTextBox 到 NewFileForm，然後把它的 Name 改成 richTextBox。 // 使得 RichTextBox 佔滿整個 Form 的方式 ： // 拉好 RichTextBox 後可以按一下上面的"箭頭符號" Dock in parent container // 拉好 RichTextBox 後可以把它 Properties 裡的 Dock 屬性設成 Fill 02. 接下來我們在 NewFileForm.cs 寫一些方法，像 Cut, Copy, Paste, Font, Color...，供等一下呼叫用。 [...]]]></description>
			<content:encoded><![CDATA[<p>00. 現在按"開新檔案"出現的是一個上面沒有任何東西的 Form，現在我們就來幫它加一個 RichTextBox，讓我們可以在上面輸入文字。</p>
<p>// 在這裡我們先改名字 Form1.cs 改成 NewFileForm.cs、Form1 改成 NewFileForm</p>
<p>01. 然後在 Common Controls 拉一個 RichTextBox 到 NewFileForm，然後把它的 Name 改成 richTextBox。</p>
<p>// 使得 RichTextBox 佔滿整個 Form 的方式 ：<br />
// 拉好 RichTextBox 後可以按一下上面的"箭頭符號" Dock in parent container<br />
// 拉好 RichTextBox 後可以把它 Properties 裡的 Dock 屬性設成 Fill</p>
<p>02. 接下來我們在 NewFileForm.cs 寫一些方法，像 Cut, Copy, Paste, Font, Color...，供等一下呼叫用。<span id="more-101"></span></p>
<p>&nbsp;&nbsp;a. 先來一個 RTBCopy // RTBCut, RTBPaste, RTBSelectAll 依樣畫葫蘆。</p>
<pre class="brush: csharp; title: ; notranslate">
public void RTBCopy() {
  richTextBox.Copy();
} // RTBCopy 複製
</pre>
<p>&nbsp;&nbsp;b. 上面都只要一行就能搞定，是不是太無聊嗎？那來個設定文字色彩吧( 又稱文字前景色彩 )</p>
<pre class="brush: csharp; title: ; notranslate">
public void PTBSetSetFontForeColor() {
  ColorDialog colorDialog = new ColorDialog();
  // 在這可以設定一些 ColorDialog 的屬性
  if ( colorDialog.ShowDialog() == DialogResult.OK ) {
    // 或 if ( colorDialog.ShowDialog() != DialogResult.Cancel )
    richTextBox.SelectionColor = colorDialog.Color;
  } // if
} // PTBSetSetFontForeColor() 設定文字色彩
</pre>
<p>上面的 ColorDialog colorDialog = new ColorDialog(); 下面還可以設定 ColorDialog 的屬性，完整請看<a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.colordialog.aspx" target="_blank">ColorDialog Class 下的 Properties</a>。</p>
<p>下面僅列出常用的 ：</p>
<pre class="brush: csharp; title: ; notranslate">
colorDialog.ShowHelp = true; // 是否顯示&quot;說明&quot;按鈕
colorDialog.AnyColor = false; // 是否可以使用任意色彩
colorDialog.AllowFullOpen = true; // &quot;定義自訂色彩&quot; 是否可按
colorDialog.FullOpen = true; // 是否一開始就顯示&quot;自訂顏色(右邊)&quot;的部份
</pre>
<p>&nbsp;&nbsp;c. 會設定文字顏色了，那設定文字底色和文字字型就難不倒您了吧</p>
<p>// 文字底色一樣是用 ColorDialog 只是設定時改成設定 xx 屬性；文字字型改用 FontDialog 且設定時是設定 xx 屬性。其他就沒什麼不同了，英文不要太差應該都知道。</p>
<p>下面是部份 FontDialog 可以設定的屬性，完整請看<a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.fontdialog.aspx" target="_blank">FontDialog Class 下的 Properties</a>。</p>
<p>下面僅列出常用的 ：</p>
<pre class="brush: csharp; title: ; notranslate">
fontDialog.MaxSize = 60; // 設定可選擇的最大字體
fontDialog.MinSize = 12; // 設定可選擇的最小字體
fontDialog.ShowHelp = true; // 是否顯示&quot;說明&quot;按鈕
fontDialog.ShowApply = false; // 是否顯示&quot;應用&quot;按鈕
fontDialog.ShowEffects = true; // 是否顯示底線和刪除線等選項
fontDialog.AllowVerticalFonts = false; // 是否可選擇垂直字型
fontDialog.FontMustExist = true; // 當字體不存在時是否顯示錯誤
fontDialog.ShowColor = true; // 是否顯示顏色選項, 如果是 true, 那就要同時修改字型和顏色
</pre>
<p>03. 我們努力修改了那麼多 NewFileForm 等下就要拿來應用了。</p>
]]></content:encoded>
			<wfw:commentRss>http://who-know.com/implement-c-sharp-helloword-newfileform/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>用 C# 實作一個簡單的 Word &#8211; MDIParent Form</title>
		<link>http://who-know.com/implement-c-sharp-helloword-mdiparentform/</link>
		<comments>http://who-know.com/implement-c-sharp-helloword-mdiparentform/#comments</comments>
		<pubDate>Sat, 15 May 2010 23:02:57 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[C Sharp]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://who-know.com/?p=100</guid>
		<description><![CDATA[01. File -> New -> Project -> Windows Forms Application -> OK // 這邊 Project Name 假設叫 HelloWord 02. 新增完 Project 後，在右半邊的上面( Solution Explorer )會列出該專案所有的檔案，點一下 Project Name( 這裡是 HelloWord )，然後右鍵 -> Add -> New Item -> Template 下找到 MDI Parent Form -> Add // 這邊 MDI Parent Form 假設檔名是 MDIWord.cs，名稱是 MDIWord 03. 修改 Program.cs 原本為 [...]]]></description>
			<content:encoded><![CDATA[<p>01. File -> New -> Project -> Windows Forms Application -> OK<br />
// 這邊 Project Name 假設叫 HelloWord</p>
<p>02. 新增完 Project 後，在右半邊的上面( Solution Explorer )會列出該專案所有的檔案，點一下 Project Name( 這裡是 HelloWord )，然後右鍵 -> Add -> New Item -> Template 下找到 MDI Parent Form -> Add</p>
<p>// 這邊 MDI Parent Form 假設檔名是 MDIWord.cs，名稱是 MDIWord<span id="more-100"></span></p>
<p>03. 修改 Program.cs</p>
<p>原本為 Application.Run( new Form1() );<br />
替換為 Application.Run( new 換成剛才建立的MDI名稱() );<br />
也就是 Application.Run( new MDIWord() );</p>
<p>04. 做到這我們 HelloWord 的雛型就出來了</p>
<p><a href="http://pic.who-know.com/C_Sharp_MDI_Word_Implement/001.png" class="highslide-image" onclick="return hs.expand(this);" target="_blank"><img class="doCenter" src="http://pic.who-know.com/C_Sharp_MDI_Word_Implement/001.png" alt="" width="480" height="430"/></a></p>
]]></content:encoded>
			<wfw:commentRss>http://who-know.com/implement-c-sharp-helloword-mdiparentform/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fatal error: Maximum execution time of 30 seconds exceeded</title>
		<link>http://who-know.com/fatal-error-maximum-execution-time-of-30-seconds-exceeded/</link>
		<comments>http://who-know.com/fatal-error-maximum-execution-time-of-30-seconds-exceeded/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 22:35:55 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[php.ini]]></category>
		<category><![CDATA[SuPHP]]></category>
		<category><![CDATA[wp-config]]></category>

		<guid isPermaLink="false">http://who-know.com/fatal-error-maximum-execution-time-of-30-seconds-exceeded/</guid>
		<description><![CDATA[WordPress 出現 Fatal error: Maximum execution time of 30 seconds exceeded 是因為主機對程式的執行時間作了限制，解決方法如下 : // 擇一使用即可，依不可行性排序 01. 自己的主機 or 虛擬主機且可以修改 php.ini a. 修改 php.ini 裡 max_execution_time 的數值，重新啟動 Server b. .htaccess 加上 php_value max_input_time 300 c. wp-config.php 加上 set_time_limit( 300 ); 02. 虛擬主機 : 不可以修改 php.ini a. .htaccess 加上 php_value max_execution_time 300 b. wp-config.php 加上 set_time_limit( 300 [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://wordpress.org/" target="_blank">WordPress</a> 出現 Fatal error: Maximum execution time of 30 seconds exceeded 是因為主機對程式的執行時間作了限制，解決方法如下 : </p>
<p>// 擇一使用即可，依不可行性排序</p>
<p>01. 自己的主機 or 虛擬主機且可以修改 php.ini</p>
<p>a. 修改 php.ini 裡 max_execution_time 的數值，重新啟動 Server<br />
b. .htaccess 加上 php_value max_input_time 300<br />
c. wp-config.php 加上 set_time_limit( 300 );</p>
<p>02. 虛擬主機 : 不可以修改 php.ini</p>
<p>a. .htaccess 加上 php_value max_execution_time 300<br />
b. wp-config.php 加上 set_time_limit( 300 );</p>
<p>// 如果主機有安裝 <a href="http://www.suphp.org/" target="_blank">suPHP</a><br />
<span style="color: #ff0080">.htaccess  file 的 php_value max_execution_time 300 改成 max_execution_time = 300</span></p>
<p>Ref :<br />
01. <a href="http://www.php.net/manual/en/info.configuration.php" target="_blank">PHP Runtime Configuration</a><br />
02. <a href="http://php.net/manual/en/function.set-time-limit.php" target="_blank">PHP set_time_limit ( int $seconds )</a></p>
]]></content:encoded>
			<wfw:commentRss>http://who-know.com/fatal-error-maximum-execution-time-of-30-seconds-exceeded/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Decrypt WPBoxedTech footer.php step by step</title>
		<link>http://who-know.com/decrypt-wpboxedtech-footer-step-by-step/</link>
		<comments>http://who-know.com/decrypt-wpboxedtech-footer-step-by-step/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 19:24:14 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[Free Teaching]]></category>
		<category><![CDATA[base64_decode]]></category>
		<category><![CDATA[footer]]></category>
		<category><![CDATA[gzinflate]]></category>
		<category><![CDATA[str_rot13]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WPBoxedTech]]></category>

		<guid isPermaLink="false">http://who-know.com/?p=98</guid>
		<description><![CDATA[00. 如果對您而言真的很難，請直接複製第 10 步驟或文章最後的程式碼取代 WPBoxedTech 的 footer.php 01. 於 WPBoxedTech 的 footer.php 看到 F9a2d8ce3('RlpySHNvUFlGVkoveFRPM2l3....省略....DkvL2ZmUHYvNFA='); 02. 所以到 WPBoxedTech 的 functions.php 找到 F9a2d8ce3($V341be97d) 刪掉完全用不到的全域變數、if判斷、switch case 等，我們會得到一個變數名稱都很鳥的程式碼，拿去 run 會出現找不到 Ff6d131d9()，所以只好再去 WPBoxedTech 的 functions.php 挖寶。 // Fatal error: Call to undefined function Ff6d131d9() // 依序找不到的 funcion name 會是 : Ff6d131d9()，Ff2380753()，Fbef92ce0()，F8c4346d7() 03. 也是廢話一堆，重點只有 return base64_decode( $V341be97d ); 04. 加上去後再 run [...]]]></description>
			<content:encoded><![CDATA[<p>00. 如果對您而言真的很難，請直接複製第 10 步驟或文章最後的程式碼取代 <a href="http://www.technologytricks.com/wpboxedtech-free-professional-premium-wordpress-theme/">WPBoxedTech</a> 的 footer.php</p>
<p>01. 於 <a href="http://www.technologytricks.com/wpboxedtech-free-professional-premium-wordpress-theme/">WPBoxedTech</a> 的 footer.php 看到 F9a2d8ce3('RlpySHNvUFlGVkoveFRPM2l3....省略....DkvL2ZmUHYvNFA=');</p>
<p>02. 所以到 <a href="http://www.technologytricks.com/wpboxedtech-free-professional-premium-wordpress-theme/">WPBoxedTech</a> 的 functions.php 找到 F9a2d8ce3($V341be97d) 刪掉完全用不到的全域變數、if判斷、switch case 等，我們會得到一個變數名稱都很鳥的程式碼，拿去 run 會出現找不到  Ff6d131d9()，所以只好再去 <a href="http://www.technologytricks.com/wpboxedtech-free-professional-premium-wordpress-theme/">WPBoxedTech</a> 的 functions.php 挖寶。<br />
// Fatal error: Call to undefined function Ff6d131d9()<br />
// 依序找不到的 funcion name 會是 : Ff6d131d9()，Ff2380753()，Fbef92ce0()，F8c4346d7()<span id="more-98"></span></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

function F9a2d8ce3( $V341be97d ) {

$V62216a69 = explode( &quot;|&quot;, $V341be97d );
$Vb4a88417 = &quot;&quot;;
for( $V865c0c0b = 0; $V865c0c0b &lt; count( $V62216a69 ); $V865c0c0b++ ) {
  $Vb4a88417 .= Ff6d131d9( $V62216a69[ $V865c0c0b ] );
  $V341be97d = ereg_replace(0x85, &quot;...&quot;, $V341be97d);
  $V341be97d = ereg_replace(0x91, &quot;'&quot;, $V341be97d);
  $V341be97d = ereg_replace(0x93, '&quot;', $V341be97d);
  $V341be97d = ereg_replace(0x94, '&quot;', $V341be97d);
}
  $Vb4a88417 = Ff6d131d9( $Vb4a88417 );
  $Vb4a88417 = Ff2380753( $Vb4a88417 );
  $Vb4a88417 = Fbef92ce0( $Vb4a88417 );
  $Vb4a88417 = F8c4346d7( $Vb4a88417 );
}

echo F9a2d8ce3('RlpySHNvUFlGVkoveFRPM2l3....省略....DkvL2ZmUHYvNFA=');
?&gt;
</pre>
<p>03. 也是廢話一堆，重點只有 return base64_decode( $V341be97d );</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
function Ff6d131d9( $V341be97d ) {

  global $V542b4c0f; $V10573b87 = &quot;SELECT ID, comment_ID, comment_content, comment_author_email, comment_author, comment_author_url, comment_date, post_title, comment_type
 FROM $V542b4c0f-&gt;comments LEFT JOIN $V542b4c0f-&gt;posts ON $V542b4c0f-&gt;posts.ID=$V542b4c0f-&gt;comments.comment_post_ID WHERE post_status IN ('publish','static')&quot;;

 return base64_decode( $V341be97d );
}
?&gt;
</pre>
<p>04. 加上去後再 run 看看</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

function Ff6d131d9( $V341be97d ) {
  return base64_decode( $V341be97d );
}

function F9a2d8ce3( $V341be97d ) {

$V62216a69 = explode( &quot;|&quot;, $V341be97d );
$Vb4a88417 = &quot;&quot;;
for( $V865c0c0b = 0; $V865c0c0b &lt; count( $V62216a69 ); $V865c0c0b++ ) {
  $Vb4a88417 .= Ff6d131d9( $V62216a69[ $V865c0c0b ] );
  $V341be97d = ereg_replace( 0x85, &quot;...&quot;, $V341be97d );
  $V341be97d = ereg_replace( 0x91, &quot;'&quot;, $V341be97d );
  $V341be97d = ereg_replace( 0x93, '&quot;', $V341be97d );
  $V341be97d = ereg_replace( 0x94, '&quot;', $V341be97d );
}
  $Vb4a88417 = Ff6d131d9( $Vb4a88417 );
  $Vb4a88417 = Ff2380753( $Vb4a88417 );
  $Vb4a88417 = Fbef92ce0( $Vb4a88417 );
  $Vb4a88417 = F8c4346d7( $Vb4a88417 );
}

echo F9a2d8ce3('RlpySHNvUFlGVkoveFRPM2l3....省略....DkvL2ZmUHYvNFA=');
?&gt;
</pre>
<p>05. 這次會找不到 Ff2380753()，所以我們再去 <a href="http://www.technologytricks.com/wpboxedtech-free-professional-premium-wordpress-theme/">WPBoxedTech</a> 的 functions.php 挖寶</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
function Ff2380753( $V341be97d ) {
  return str_rot13( $V341be97d );
  $Ve2e39b5c = 'Anonym'; $Va9b4ab92 = 'Webseite von &amp;lsaquo;'; $V52a106b8 = '&amp;rsaquo; besuchen';
}
?&gt;
</pre>
<p>06. 再加上去 run run 看，這次會找不到 Fbef92ce0，所以我們再去 <a href="http://www.technologytricks.com/wpboxedtech-free-professional-premium-wordpress-theme/">WPBoxedTech</a> 的 functions.php 挖寶</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
function Fbef92ce0( $V341be97d ) {
  return gzinflate( $V341be97d );
  if ( !$Vb5dc19ed ) $V10573b87 .= &quot;AND post_password ='' &quot;; $V10573b87 .= &quot;AND comment_approved = '1' ORDER BY comment_ID DESC LIMIT $V2ae6568f&quot;;
}
?&gt;
</pre>
<p>07. 再加上去 run run 看，這次會找不到 F8c4346d7，所以我們再去 <a href="http://www.technologytricks.com/wpboxedtech-free-professional-premium-wordpress-theme/">WPBoxedTech</a> 的 functions.php 挖寶<br />
// 接連幾個例子大家應該都能上手，所以這個就直接寫去蕪存菁過後的</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
function F8c4346d7( $V341be97d ) {
  return eval( $V341be97d );
}
?&gt;
</pre>
<p>08. 找完最後一個 undefined function，再 run run 看吧</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

function Ff6d131d9( $V341be97d ) {
  return base64_decode( $V341be97d );
}

function Ff2380753( $V341be97d ) {
  return str_rot13( $V341be97d );
}

function Fbef92ce0( $V341be97d ) {
  return gzinflate( $V341be97d );
}

function F8c4346d7( $V341be97d ) {
  return eval( $V341be97d );
}

function F9a2d8ce3( $V341be97d ) {

$V62216a69 = explode( &quot;|&quot;, $V341be97d );
$Vb4a88417 = &quot;&quot;;
for( $V865c0c0b = 0; $V865c0c0b &lt; count( $V62216a69 ); $V865c0c0b++ ) {
  $Vb4a88417 .= Ff6d131d9( $V62216a69[ $V865c0c0b ] );
  $V341be97d = ereg_replace( 0x85, &quot;...&quot;, $V341be97d );
  $V341be97d = ereg_replace( 0x91, &quot;'&quot;, $V341be97d );
  $V341be97d = ereg_replace( 0x93, '&quot;', $V341be97d );
  $V341be97d = ereg_replace( 0x94, '&quot;', $V341be97d );
}
  $Vb4a88417 = Ff6d131d9( $Vb4a88417 );
  $Vb4a88417 = Ff2380753( $Vb4a88417 );
  $Vb4a88417 = Fbef92ce0( $Vb4a88417 );
  $Vb4a88417 = F8c4346d7( $Vb4a88417 );
}

echo F9a2d8ce3('RlpySHNvUFlGVkoveFRPM2l3....省略....DkvL2ZmUHYvNFA=');
?&gt;
</pre>
<p>09. 是不是跑出了</p>
<p>eval(gzinflate(str_rot13(base64_decode('....省略....'))));</p>
<p>10. 最後用之前介紹的 <a href="http://who-know.com/decrypt.php" target="_blank">eval(gzinflate(str_rot13(base64_decode('....'))));</a></p>
<pre class="brush: php; title: ; notranslate">
&lt;/div&gt;
&lt;div id=&quot;sidebars&quot;&gt;
  &lt;?php get_sidebar(); ?&gt;
  &lt;?php include (TEMPLATEPATH . '/sidebar_right.php'); ?&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id=&quot;footer_box&quot;&gt;
  &lt;div class=&quot;box&quot;&gt;&lt;div class=&quot;box_outer&quot;&gt;&lt;div class=&quot;box_inner&quot;&gt;&lt;div class=&quot;box_bottom_right&quot;&gt;&lt;div class=&quot;box_bottom_left&quot;&gt;
    &lt;?php include (TEMPLATEPATH . '/bottom.php'); ?&gt;
  &lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div id=&quot;footer&quot;&gt;
  Copyright &amp;copy; &lt;?php echo gmdate(__('Y')); ?&gt;. &lt;a href=&quot;http://www.technologytricks.com/wpboxedtech-free-professional-premium-wordpress-theme/&quot;&gt;WP BoxedTech&lt;/a&gt; theme by &lt;a href=&quot;http://www.onlinehealthdeals.com/&quot;&gt;Health Coupons&lt;/a&gt;. Supported by BlueHost &lt;a href=&quot;http://www.bluehost.com/&quot;&gt;Web Hosting&lt;/a&gt;, &lt;a href=&quot;http://www.bingodazzle.co.uk/&quot;&gt;Free Bingo&lt;/a&gt;, &lt;a href=&quot;http://webhosting.reviewitonline.net/&quot;&gt;Web Hosting&lt;/a&gt; &amp; &lt;a href=&quot;http://www.photoads.co.uk/&quot;&gt;Classified Ads&lt;/a&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>12. 眼睛好點會發現下面四行沒有用，最後把他改成比較好懂的程式碼</p>
<p>$V341be97d = ereg_replace( 0x85, "...", $V341be97d );<br />
$V341be97d = ereg_replace( 0x91, "'", $V341be97d );<br />
$V341be97d = ereg_replace( 0x93, '"', $V341be97d );<br />
$V341be97d = ereg_replace( 0x94, '"', $V341be97d );</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

function F9a2d8ce3( $encryptedStr ) {

  $explodedStr = explode( &quot;|&quot;, $encryptedStr );
  $decryptedStr = &quot;&quot;; 

  for( $i = 0; $i &lt; count( $explodedStr ); $i++ ) {
    $decryptedStr .= base64_decode( $explodedStr[ $i ] );
  }

  return gzinflate( str_rot13( base64_decode( $decryptedStr ) ) );

}

echo F9a2d8ce3('RlpySHNvUFlGVkoveFRPM2l3....省略....DkvL2ZmUHYvNFA=');
?&gt;
</pre>
<p>11. 感覺怎麼樣呢? 是不是不輸線上遊戲的解謎?</p>
<p>ps.<br />
01. <a href="http://www.technologytricks.com/wpboxedtech-free-professional-premium-wordpress-theme/">WPBoxedTech</a> 下面最左邊要裝 <a href="http://wordpress.org/extend/plugins/flickr-rss/">FlickrRSS Plugin</a>；中間要有 <a href="http://www.mybloglog.com/">MyBlogLog</a> 的帳號( 填在 WPBoxedTech Settings -> MyBlogLog ID )，類似誰來我家的功能；最右邊是一堆 <a href="http://digg.com/">Digg</a>、<a href="http://twitter.com/">Twitter</a>、<a href="http://www.facebook.com/">Facebook</a> 等 Web 2.0 的功能，如果您像我如此這般的"陽光"，感覺用不到的話</p>
<p>以下擇一<br />
a. 清空 <a href="http://www.technologytricks.com/wpboxedtech-free-professional-premium-wordpress-theme/">WPBoxedTech</a> 的 bottom.php 裡面的程式碼。<br />
b. 刪掉 <a href="http://www.technologytricks.com/wpboxedtech-free-professional-premium-wordpress-theme/">WPBoxedTech</a> 的 footer.php 裡的
<pre class="brush: php; title: ; notranslate">&lt;?php include (TEMPLATEPATH . '/bottom.php'); ?&gt;</pre>
<p>2. 精簡過後的版本</p>
<pre class="brush: php; title: ; notranslate">
&lt;/div&gt;
&lt;div id=&quot;sidebars&quot;&gt;
  &lt;?php get_sidebar(); ?&gt;
  &lt;?php include (TEMPLATEPATH . '/sidebar_right.php'); ?&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id=&quot;footer_box&quot;&gt;
  &lt;div class=&quot;box&quot;&gt;&lt;div class=&quot;box_outer&quot;&gt;&lt;div class=&quot;box_inner&quot;&gt;&lt;div class=&quot;box_bottom_right&quot;&gt;&lt;div class=&quot;box_bottom_left&quot;&gt;
    &lt;?php include (TEMPLATEPATH . '/bottom.php'); ?&gt;
  &lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div id=&quot;footer&quot;&gt;
  &lt;p&gt;Copyright &amp;copy; &lt;?php echo gmdate(__('Y')); ?&gt;. &lt;?php bloginfo('name'); ?&gt; All rights reserved. Designed by &lt;a href=&quot;http://www.technologytricks.com/wpboxedtech-free-professional-premium-wordpress-theme/&quot; target=&quot;_blank&quot;&gt;WP BoxedTech&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://who-know.com/decrypt-wpboxedtech-footer-step-by-step/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>修改 WordPress Login、Logout、Register、wp-admin 位置</title>
		<link>http://who-know.com/how-to-hide-wp-admin-folder-name-on-wordpress/</link>
		<comments>http://who-know.com/how-to-hide-wp-admin-folder-name-on-wordpress/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 19:20:39 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[Free Teaching]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[Stealth Login]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://who-know.com/?p=97</guid>
		<description><![CDATA[00. 修改 WordPress 後台地址 http://your.domain.name/wp-admin/ to http://your.domain.name/whatever-you-want/ 01. 下載 Stealth Login 並解壓上傳到 ./wp-content/plugins/ 下。 // 或從 WordPress 後台直接搜尋 Stealth Login 下載 02. Plugins -> Installed -> Activate Stealth Login 03. WordPress 後台 -> Settings -> Stealth Login 04. 把 Enable Plugin 切換到 On，然後依據您的需要來設定您想要的網址形式，含 WordPress 登入、登出、註冊、後台的位置。 eg : Login Slug : in -> http://who-know.com/in/；Logout Slug : [...]]]></description>
			<content:encoded><![CDATA[<p>00. 修改 <a href="http://wordpress.org/" target="_blank">WordPress</a> 後台地址 http://your.domain.name/wp-admin/ to http://your.domain.name/whatever-you-want/</p>
<p>01. 下載 <a href="http://wordpress.org/extend/plugins/stealth-login/" target="_blank">Stealth Login</a> 並解壓上傳到 ./wp-content/plugins/ 下。<br />
// 或從 <a href="http://wordpress.org/" target="_blank">WordPress</a> 後台直接搜尋 <a href="http://wordpress.org/extend/plugins/stealth-login/" target="_blank">Stealth Login</a> 下載</p>
<p>02. Plugins -> Installed -> Activate <a href="http://wordpress.org/extend/plugins/stealth-login/" target="_blank">Stealth Login</a></p>
<p>03. <a href="http://wordpress.org/" target="_blank">WordPress</a> 後台 -> Settings -> <a href="http://wordpress.org/extend/plugins/stealth-login/" target="_blank">Stealth Login</a><span id="more-97"></span></p>
<p>04. 把 Enable Plugin 切換到 On，然後依據您的需要來設定您想要的網址形式，含 <a href="http://wordpress.org/" target="_blank">WordPress</a> 登入、登出、註冊、後台的位置。</p>
<p>eg :<br />
Login Slug : in -> http://who-know.com/in/；Logout Slug : out -> http://who-know.com/out/；Register Slug : reg -> http://who-know.com/reg/；Admin Slug : admin -> http://who-know.com/admin/</p>
<p>05. 把 Stealth Mode 切換到 Enable，不然就變成 http://who-know.com/reg/ = http://who-know.com/wp-login.php?action=register 兩種網址形式都可以用來註冊帳號，這樣就沒有達到保護 <a href="http://wordpress.org/" target="_blank">WordPress</a> 的用意了，我們希望的是透過修改 <a href="http://wordpress.org/" target="_blank">WordPress</a> 登入、登出、註冊、後台的網址，來保護我們用心經營的聖地。</p>
<p>06. 最後它會生成一大串的語法加到 .htaccess file，接下來請立刻測試有沒有成功，如果您的 <a href="http://wordpress.org/" target="_blank">WordPress</a> 是安裝在子目錄的且有使用 Permalink( 中譯 : 永久連結、固定網址、偽靜態等 )，可能會有問題。</p>
<p>eg : 假設您的 <a href="http://wordpress.org/" target="_blank">WordPress</a> 原本是裝在 ./wordpress/ 下，您會發現剛才改的網址變成 http://your.domain.name/wordpress/wordpress/ ...，所以請下載 .htaccess file 把 RewriteBase /wordpress/ 修正一下再上傳覆蓋，即可解決問題了。<br />
// 把 RewriteBase /wordpress/ 改成 RewriteBase /</p>
<pre class="brush: bash; title: ; notranslate">
# BEGIN WordPress
&lt;IfModule mod_rewrite.c&gt;
RewriteEngine On
RewriteBase /wordpress/
# STEALTH-LOGIN
...
# END STEALTH-LOGIN
...
&lt;/IfModule&gt;

# END WordPress
</pre>
<p>07. 附註<br />
a. 設定好後，把 ./wp-content/plugins/ 下的 stealth-login 刪除，好像也可以正常運作。<br />
b. 無聊也可以定期幫它換一下 stealth_folderName_key<br />
// <a href="http://wordpress.org/" target="_blank">WordPress</a> 後台 -> Settings -> <a href="http://wordpress.org/extend/plugins/stealth-login/" target="_blank">Stealth Login</a> -> Save Changes</p>
<p>Ref : // 紀錄一下其它方法，其中第二個方法很原始也很暴力<br />
01. <a href="http://www.michiknows.com/2007/02/12/who-else-wants-to-hide-their-wordpress-admin-folder/" target="_blank">Who Else Wants to Hide Their WordPress Folder?</a><br />
02. <a href="http://www.socialblogr.com/2009/09/how-to-change-folder-name-on-wordpress.html>" target="_blank">How To Change "wp-admin" Folder Name on WordPress</a></p>
]]></content:encoded>
			<wfw:commentRss>http://who-know.com/how-to-hide-wp-admin-folder-name-on-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Code::Blocks 教學 &#8211; Debugging</title>
		<link>http://who-know.com/how-to-debug-with-codeblocks/</link>
		<comments>http://who-know.com/how-to-debug-with-codeblocks/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 19:01:32 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[Free Teaching]]></category>
		<category><![CDATA[Code::Blocks]]></category>
		<category><![CDATA[Debug]]></category>
		<category><![CDATA[GNU]]></category>

		<guid isPermaLink="false">http://who-know.com/?p=96</guid>
		<description><![CDATA[01. File -> New -> Project -> Console application -> Go -> C/C++ -> 打上 Project title 和選擇要存放的位置 -> Next -> Finish // 不要懶的創 Project，就 File -> New -> File -> C/C++ source -> Go -> C/C++ -> ... // 或更偷懶直接，就 File -> Empty file // 因為這樣會不能使用 Debug 功能 02. 點左邊 Projects 下的 Workspace -> [...]]]></description>
			<content:encoded><![CDATA[<p>01. File -> New -> Project -> Console application -> Go -> C/C++ -> 打上 Project title 和選擇要存放的位置 -> Next -> Finish</p>
<p>// 不要懶的創 Project，就 File -> New -> File -> C/C++ source -> Go -> C/C++ -> ...<br />
// 或更偷懶直接，就 File -> Empty file<br />
// 因為這樣會不能使用 Debug 功能</p>
<p>02. 點左邊 Projects 下的 Workspace -> Project title -> Sources -> *.cpp，貼上下面的程式碼，來體驗一下 Code::Blocks 的 Debug 功能。<span id="more-96"></span></p>
<pre class="brush: cpp; title: ; notranslate">
# include &lt;iostream&gt;
# define SIZE  10

using namespace std;

int main( ) {

  int test[ SIZE ] = { 0 };

  for ( int i = 0; i &lt; SIZE; i++ ) {
    test[ i ] = i;
  }

  system( &quot;PAUSE&quot; );
  return 0;
}
</pre>
<p>03. <a href="http://www.codeblocks.org/" target="_blank">Code::Blocks</a> Debug 三部曲</p>
<p>a. Build target 切換到 Debug</p>
<p>b. Settings -> Compiler and debugger -> Produce debugging symbols [-g] 打勾</p>
<p>c. 新增中斷點 : 在 test[ i ] = i; 那行，行號的右邊空白按左鍵( or 右鍵 -> Add breakpoint )</p>
<p>04. 上面都設定好後，按下 F8 or IDE 上的圖示( Debug / Continue ) 就可以開始 Debug 了。<br />
// Watches、Disassembly、Call Stack、Memory、CPU Registers 等，都可以在 Debug -> Debugging windows 下找到</p>
<p><a href="http://pic.who-know.com/CodeBlocks/007.png" class="highslide-image" onclick="return hs.expand(this);" target="_blank"><img class="doCenter" src="http://pic.who-know.com/CodeBlocks/007.png" alt="" width="460" height="280"/></a></p>
<p>05. 照上面設定還是不能 Debug 的話</p>
<p>a. Build target : Debug</p>
<p>b. 檢查 Settings -> Compiler and debugger -> Produce debugging symbols [-g] 是否有打勾 ( 要打勾 )<br />
// 特徵 : ( no debugging symbols found )</p>
<p>d. 檢查 Settings -> Compiler and debugger -> Strip all symbols from binarry ( minimizes size ) [-s] 是否有打勾 ( 不要打勾 )<br />
// 特徵 : ( no debugging symbols found )</p>
<p>c. 檢查是否有 gdb.exe</p>
<p>// 可以到 ( <a href="http://sourceforge.net/projects/mingw/files/" target="_blank">The GNU Project Debugger</a> ) 點 GNU Source-Level Debugger 下載<br />
// 可以到 ( <a href="http://prdownloads.sf.net/mingw/gdb-6.3-2.exe" target="_blank">The GNU Project Debugger</a> ) 下載</p>
]]></content:encoded>
			<wfw:commentRss>http://who-know.com/how-to-debug-with-codeblocks/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Windows C++ IDE 教學 &#8211; C++ Socket Programming</title>
		<link>http://who-know.com/windows-c-ide-c-socket-programming/</link>
		<comments>http://who-know.com/windows-c-ide-c-socket-programming/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 10:42:48 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[Free Teaching]]></category>
		<category><![CDATA[C++ IDE]]></category>
		<category><![CDATA[Code::Blocks]]></category>
		<category><![CDATA[Socket]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[WinSock]]></category>

		<guid isPermaLink="false">http://who-know.com/?p=94</guid>
		<description><![CDATA[01. 使用 Code::Blocks 寫 Socket Program 的設定 Settings -> Compiler and debugger -> Linker Settings -> Other linker options -> 加上 -lws2_32 02. 使用 Dev C++ 寫 Socket Program 的設定 Tools -> Compiler Options -> 打勾 Add these commands to linker command line -> 加上 -lws2_32 03. 使用 Microsoft Visual C++ 6.0 寫 Socket Program [...]]]></description>
			<content:encoded><![CDATA[<p>01. 使用 <a href="http://www.codeblocks.org/" target="_blank">Code::Blocks</a> 寫 Socket Program 的設定</p>
<p>Settings -> Compiler and debugger -> Linker Settings -> Other linker options -> 加上 -lws2_32<span id="more-94"></span></p>
<p><a href="http://pic.who-know.com/CodeBlocks/001.png" class="highslide-image" onclick="return hs.expand(this);" target="_blank"><img class="doCenter" src="http://pic.who-know.com/CodeBlocks/001.png" alt="" width="480" height="430"/></a></p>
<p>02. 使用 <a href="http://www.bloodshed.net/devcpp.html" target="_blank">Dev C++</a> 寫 Socket Program 的設定</p>
<p>Tools -> Compiler Options -> 打勾 Add these commands to linker command line -> 加上 -lws2_32</p>
<p><a href="http://pic.who-know.com/CodeBlocks/002.png" class="highslide-image" onclick="return hs.expand(this);" target="_blank"><img class="doCenter" src="http://pic.who-know.com/CodeBlocks/002.png" alt="" width="480" height="430"/></a></p>
<p>03. 使用 Microsoft Visual C++ 6.0 寫 Socket Program 的設定。// 以下方法擇一即可</p>
<p>a. 程式碼前面加上 #pragma comment(lib, "wsock32.lib")</p>
<p>b. Project -> Settings -> Link -> Object/library modules -> 最後加上 ws2_32.lib</p>
<p><a href="http://pic.who-know.com/CodeBlocks/003.png" class="highslide-image" onclick="return hs.expand(this);" target="_blank"><img class="doCenter" src="http://pic.who-know.com/CodeBlocks/003.png" alt="" width="480" height="340"/></a></p>
]]></content:encoded>
			<wfw:commentRss>http://who-know.com/windows-c-ide-c-socket-programming/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Windows C++ IDE 教學 &#8211; Increase Stack Size</title>
		<link>http://who-know.com/windows-c-ide-tutorial-how-to-increase-stack-size/</link>
		<comments>http://who-know.com/windows-c-ide-tutorial-how-to-increase-stack-size/#comments</comments>
		<pubDate>Sun, 31 Jan 2010 18:01:06 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[Free Teaching]]></category>
		<category><![CDATA[C++ IDE]]></category>
		<category><![CDATA[Code::Blocks]]></category>
		<category><![CDATA[Stack]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://who-know.com/?p=95</guid>
		<description><![CDATA[01. Code::Blocks 之 Increase Stack Size 的方法 Settings -> Compiler and debugger -> Linker Settings -> Other linker options -> 加上 -Wl,-stack,填需要的大小 // eg : -Wl,-stack,50000000 02. Dev C++ 之 Increase Stack Size 的方法 Tools -> Compiler Options -> 打勾 Add these commands to linker command line -> 加上 -Wl,-stack,填需要的大小 // eg : -Wl,-stack,50000000 03. [...]]]></description>
			<content:encoded><![CDATA[<p>01. <a href="http://www.codeblocks.org/" target="_blank">Code::Blocks</a> 之 Increase Stack Size 的方法</p>
<p>Settings -> Compiler and debugger -> Linker Settings -> Other linker options -> 加上 -Wl,-stack,填需要的大小<br />
// eg : -Wl,-stack,50000000<span id="more-95"></span></p>
<p><a href="http://pic.who-know.com/CodeBlocks/004.png" class="highslide-image" onclick="return hs.expand(this);" target="_blank"><img class="doCenter" src="http://pic.who-know.com/CodeBlocks/004.png" alt="" width="480" height="430"/></a></p>
<p>02. <a href="http://www.bloodshed.net/devcpp.html" target="_blank">Dev C++</a> 之 Increase Stack Size 的方法</p>
<p>Tools -> Compiler Options -> 打勾 Add these commands to linker command line -> 加上 -Wl,-stack,填需要的大小<br />
// eg : -Wl,-stack,50000000</p>
<p><a href="http://pic.who-know.com/CodeBlocks/005.png" class="highslide-image" onclick="return hs.expand(this);" target="_blank"><img class="doCenter" src="http://pic.who-know.com/CodeBlocks/005.png" alt="" width="480" height="430"/></a></p>
<p>03. Microsoft Visual C++ 6.0 之 Increase Stack Size 的方法</p>
<p>Project -> Settings -> Link -> Category -> Output -> Stack allocations -> Reserve -> 填需要的大小<br />
// Max : 4,294,967,295 bytes；可以填 10 or 16 進位；單位為 byte；Commit 可以不填。<br />
// eg : 填 50000000 = 填 0x2faf080</p>
<p><a href="http://pic.who-know.com/CodeBlocks/006.png" class="highslide-image" onclick="return hs.expand(this);" target="_blank"><img class="doCenter" src="http://pic.who-know.com/CodeBlocks/006.png" alt="" width="480" height="340"/></a></p>
<p>04. Sample Code</p>
<pre class="brush: cpp; title: ; notranslate">
# include &lt;iostream&gt;
# define SIZE  12345678

using namespace std;

int main( ) {
  int test[ SIZE ] = { 0 };

  for ( int i = 0; i &lt; SIZE; i++ ) {
    test[ i ] = i;
  }

  cout &lt;&lt; test[ SIZE - 1 ] &lt;&lt; &quot;\nWho-Know.Com&quot; &lt;&lt; endl;
  cout &lt;&lt; SIZE * sizeof( int ) &lt;&lt; &quot; bytes&quot; &lt;&lt; endl;
  cout &lt;&lt; sizeof( test ) &lt;&lt; &quot; bytes&quot; &lt;&lt; endl;

  system( &quot;PAUSE&quot; );
  return 0;
}
</pre>
<p>Ref :<br />
01. <a href="http://msdn.microsoft.com/en-us/library/8cxs58a6(VS.71).aspx" target="_blank">/STACK (Stack Allocations)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://who-know.com/windows-c-ide-tutorial-how-to-increase-stack-size/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

