<?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>Krucode.NET</title>
	<atom:link href="http://krucode.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://krucode.net</link>
	<description>Just a Ordinary Programmer</description>
	<lastBuildDate>Mon, 09 Aug 2010 04:51:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>&#8216;System.Configuration.ConfigurationSettings.AppSettings&#8217; is obsolete</title>
		<link>http://krucode.net/dotnet/system-configuration-configurationsettings-appsettings-is-obsolete/</link>
		<comments>http://krucode.net/dotnet/system-configuration-configurationsettings-appsettings-is-obsolete/#comments</comments>
		<pubDate>Mon, 09 Aug 2010 04:50:12 +0000</pubDate>
		<dc:creator>Krucode</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ConfigurationManager]]></category>
		<category><![CDATA[ConfigurationSetting]]></category>
		<category><![CDATA[Obsollet]]></category>

		<guid isPermaLink="false">http://krucode.net/?p=93</guid>
		<description><![CDATA[เคยเจอมั๊ย? เขียน Code string x = System.Configuration.ConfigurationSettings.AppSettings&#91;&#34;key&#34;&#93;; Warning &#8216;System.Configuration.ConfigurationSettings.AppSettings&#8217; is obsolete: &#8216;This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings&#8217; (เราขอเตือนนะว่าไอ่ ConfigurationSettings เนี่ยะมันเก่าแล้ว ใช้ ConfigurationManager ดีกว่า) แต่พอแก้ code เป็น string x = System.Configuration.ConfigurationManager.AppSettings&#91;&#34;key&#34;&#93;; ดันบอกว่า Error The name &#8216;ConfigurationManager&#8217; does not exist in the current context (เฮ้ย เราหา function ConfigurationManager ไม่เจอว่ะ) เอ๊า! เอาไงกันแน่เนี่ยะ วิธีแก้ปัญหาที่น่ารำคาญนี้ก็คือ Add]]></description>
			<content:encoded><![CDATA[<p>เคยเจอมั๊ย? เขียน Code</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">     <span style="color: #FF0000;">string</span> x <span style="color: #008000;">=</span> <span style="color: #000000;">System.<span style="color: #0000FF;">Configuration</span></span>.<span style="color: #0000FF;">ConfigurationSettings</span>.<span style="color: #0000FF;">AppSettings</span><span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;key&quot;</span><span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span></pre></div></div>

<blockquote><p>Warning &#8216;System.Configuration.ConfigurationSettings.AppSettings&#8217; is obsolete: &#8216;This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings&#8217;</p></blockquote>
<p>(เราขอเตือนนะว่าไอ่ ConfigurationSettings เนี่ยะมันเก่าแล้ว ใช้ ConfigurationManager ดีกว่า)<br />
<span id="more-93"></span><br />
แต่พอแก้ code เป็น</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">     <span style="color: #FF0000;">string</span> x <span style="color: #008000;">=</span> <span style="color: #000000;">System.<span style="color: #0000FF;">Configuration</span></span>.<span style="color: #0000FF;">ConfigurationManager</span>.<span style="color: #0000FF;">AppSettings</span><span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;key&quot;</span><span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span></pre></div></div>

<p>ดันบอกว่า </p>
<blockquote><p>Error The name &#8216;ConfigurationManager&#8217; does not exist in the current context</p></blockquote>
<p>(เฮ้ย เราหา function ConfigurationManager ไม่เจอว่ะ)</p>
<p>เอ๊า! เอาไงกันแน่เนี่ยะ</p>
<p>วิธีแก้ปัญหาที่น่ารำคาญนี้ก็คือ<br />
Add reference System.Configuration.dll ซะ จบ</p>
<p><img src="http://krucode.net/wp-content/uploads/2010/08/2553-08-09_1147.png" alt="" title="2553-08-09_1147" width="467" height="382" class="aligncenter size-full wp-image-95" /></p>
]]></content:encoded>
			<wfw:commentRss>http://krucode.net/dotnet/system-configuration-configurationsettings-appsettings-is-obsolete/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Config ชื่อไฟล์ log แบบ dynamic กับ log4net</title>
		<link>http://krucode.net/dotnet/config-%e0%b8%8a%e0%b8%b7%e0%b9%88%e0%b8%ad%e0%b9%84%e0%b8%9f%e0%b8%a5%e0%b9%8c-log-%e0%b9%81%e0%b8%9a%e0%b8%9a-dynamic-%e0%b8%81%e0%b8%b1%e0%b8%9a-log4net/</link>
		<comments>http://krucode.net/dotnet/config-%e0%b8%8a%e0%b8%b7%e0%b9%88%e0%b8%ad%e0%b9%84%e0%b8%9f%e0%b8%a5%e0%b9%8c-log-%e0%b9%81%e0%b8%9a%e0%b8%9a-dynamic-%e0%b8%81%e0%b8%b1%e0%b8%9a-log4net/#comments</comments>
		<pubDate>Sun, 08 Aug 2010 10:06:32 +0000</pubDate>
		<dc:creator>Krucode</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[log4net]]></category>
		<category><![CDATA[text file]]></category>

		<guid isPermaLink="false">http://krucode.net/?p=75</guid>
		<description><![CDATA[ผมเพิ่งมารู้จักไอ่ log4net ก็เมื่อสัก 7 &#8211; 8 เดือนก่อน มันเป็น tool ที่ไว้เขียน log ลง text file (หรือแม้กระทั่ง show บน console) ที่เยี่ยมมาก แต่ทุกครั้งที่ผมจะใช้มัน ผมก็ต้องไปหา configure file จากที่อื่นมาตลอดเลย แล้วบางที่ file configure ก็ยาวมาก (ถึงมากที่สุด) แต่วันนี้ไป ดั้นด้นหาวิธีการแยก log มาแบบเขียน configure ง่าย ๆ มาให้ดู คือจุดประสงค์ของผมคือต้องการจะแยก log ออกจากกัน ไม่อยากกรองแบบ StringMatchFilter (ตรวจดูว่ามีคำอยู่ในข้อความที่จะ log ไหม ถ้ามีก็แยกไฟล์ไป) เพราะบางครั้งเราอยากแยกงานกัน แต่คำมันดันเหมือนกัน ไม่อยากกรองแบบ LevelRangeFilter เพราะเหตุผลเดียวกับข้างบน &#8211; -&#8217;a ฮ่า ๆ]]></description>
			<content:encoded><![CDATA[<p>ผมเพิ่งมารู้จักไอ่ <a title="Log4net download" href="http://logging.apache.org/log4net/download.html" target="_blank">log4net</a> ก็เมื่อสัก 7 &#8211; 8 เดือนก่อน มันเป็น tool ที่ไว้เขียน log ลง text file (หรือแม้กระทั่ง show บน console) ที่เยี่ยมมาก</p>
<p>แต่ทุกครั้งที่ผมจะใช้มัน ผมก็ต้องไปหา configure file จากที่อื่นมาตลอดเลย แล้วบางที่ file configure ก็ยาวมาก (ถึงมากที่สุด) แต่วันนี้ไป ดั้นด้นหาวิธีการแยก log มาแบบเขียน configure ง่าย ๆ มาให้ดู</p>
<p>คือจุดประสงค์ของผมคือต้องการจะแยก log ออกจากกัน<br />
ไม่อยากกรองแบบ StringMatchFilter (ตรวจดูว่ามีคำอยู่ในข้อความที่จะ log ไหม ถ้ามีก็แยกไฟล์ไป) เพราะบางครั้งเราอยากแยกงานกัน แต่คำมันดันเหมือนกัน<br />
ไม่อยากกรองแบบ LevelRangeFilter เพราะเหตุผลเดียวกับข้างบน &#8211; -&#8217;a ฮ่า ๆ<br />
<span id="more-75"></span></p>
<p>เอาเป็นว่าวันนี้ของผม ผลลัพท์มันออกมาเป็นแบบนี้<br />
<img src="http://krucode.net/wp-content/uploads/2010/08/log.png" alt="" title="log" width="598" height="431" class="aligncenter size-full wp-image-77" /></p>
<p>ใน configure file ก็ (เดี๋ยวจะไล่อธิบายทีละบรรทัดเลย)</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #808080; font-style: italic;">&lt;!-- ส่วนแรก เป็นการบอกว่าเราจะมี section ที่ชื่อ log4net นะ (ไม่มี run ไม่ผ่านด้วยเอ้า) --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configSections<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;section</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;log4net&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;log4net.Config.Log4NetConfigurationSectionHandler, log4net&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configSections<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;log4net<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #808080; font-style: italic;">&lt;!-- appender name ตั้งชื่อว่าอะไรก็ได้ </span>
<span style="color: #808080; font-style: italic;">          ส่วน type ที่ RollingFileAppender คือบอกว่า จะเขียนลง file </span>
<span style="color: #808080; font-style: italic;">          แต่ถ้า เป็น ConsoleAppender คือจะแสดง log ออกมาทาง Console --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;appender</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;RollingFile&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;log4net.Appender.RollingFileAppender&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #808080; font-style: italic;">&lt;!-- อันนี้พระเอกเลย เราบอก type ก่อนว่า มันนี้เราจะใช้เป็นลักษณะ pattern นะชื่อไฟล์ </span>
<span style="color: #808080; font-style: italic;">             โดย value เป็นชื่อไฟล์ อ้างอิงตาม relative path </span>
<span style="color: #808080; font-style: italic;">             ผมใช้ %property{LogName} เพื่อบอกว่าเราจะเอาชื่อตัว logger มาใช้แทนชื่อไฟล์ --&gt;</span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;file</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;log4net.Util.PatternString&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;Log/%property{LogName}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #808080; font-style: italic;">&lt;!-- เขียนไฟล์ต่อใช่ไหม? --&gt;</span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;appendToFile</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #808080; font-style: italic;">&lt;!-- ขนาดไฟล์ใหญ่สุดก่อนที่จะเริ่มเขียนไฟล์ใหม่ --&gt;</span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;maximumFileSize</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;5MB&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #808080; font-style: italic;">&lt;!-- ใช้ชื่อไฟล์แบบ static ไหม ถ้าใช่ ไฟล์จะเป็นชื่อเดียวตลอด </span>
<span style="color: #808080; font-style: italic;">             แล้วก็จะมีนามสกุลตามหลังว่า เป็น archive ที่เท่าไหร่ เช่น app.log.1, app.log.2 --&gt;</span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;StaticLogFileName&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #808080; font-style: italic;">&lt;!-- ลักษณะการตั้งชื่อไฟล์ log ผมเลือกแบบ Date เพราะ log จะได้เขียนชื่อไฟล์แยกเป็นวัน เช่น app.2010-07-31.log --&gt;</span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;RollingStyle&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;Date&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #808080; font-style: italic;">&lt;!-- Format ของวันที่ที่จะให้ตั้งชื่อไฟล์ --&gt;</span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;DatePattern&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;.yyyy-MM-dd.'log'&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #808080; font-style: italic;">&lt;!-- ลักษณะการเขียน log --&gt;</span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;layout</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;log4net.Layout.PatternLayout&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;conversionPattern</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;[%d][%level] %message%newline&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/layout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #808080; font-style: italic;">&lt;!-- สังเกตุว่าผมไม่ใส่ filter สำหรับ appender ตัวนี้ เพราะใช้ file แยกชื่อแล้ว จะเขียน log คนละไฟล์เอง --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/appender<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;appender</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;FailureFile&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;log4net.Appender.RollingFileAppender&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;file</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;Log/Failure&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;appendToFile</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;maximumFileSize</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;5MB&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;RollingStyle&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;Date&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;StaticLogFileName&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;DatePattern&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;.yyyy-MM-dd.'log'&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;layout</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;log4net.Layout.PatternLayout&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;conversionPattern</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;[%d][%level] %message%newline&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/layout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #808080; font-style: italic;">&lt;!-- appender ตัวนี้ผมตั้งใจไว้แยก log ที่เป็น error ออกมาโดยเฉพาะ </span>
<span style="color: #808080; font-style: italic;">             เวลา admin มาดู log จะได้ดูก่อนเลยว่ามี error เกิดขึ้นหรือเปล่า</span>
<span style="color: #808080; font-style: italic;">             โดยใช้ตัว filter type เป็น LevelRangeFilter คือกรองออกมาด้วยระดับของ log </span>
<span style="color: #808080; font-style: italic;">             ผมเลือกแค่ระดับ WARN จน ถึง FATAL </span>
<span style="color: #808080; font-style: italic;">             (ระดับมีทั้งหมด ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF เรียงตามลำดับ) --&gt;</span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;log4net.Filter.LevelRangeFilter&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;levelMin</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;WARN&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;levelMax</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;FATAL&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/appender<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- และไอ่ config ทั้งหมดมันจะไม่ทำงานเลยถ้าเราไม่ใส่ส่วนนี้ </span>
<span style="color: #808080; font-style: italic;">           ซึ่งเป็นการกำหนดว่า เราจะใช้ appender ตัวไหนบ้าง --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;root<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #808080; font-style: italic;">&lt;!-- level เป็นตัวกำหนดว่า log ของเราจะเขียนตั้งแต่ระดับไหนขึ้นไป </span>
<span style="color: #808080; font-style: italic;">             อย่างถ้าอยู่ระหว่าง implement ผมจำกำหนดเป็นระดับ debug </span>
<span style="color: #808080; font-style: italic;">             แต่ถ้า เอาขึ้น production แล้วผมจะกำหนด info (เพราะไม่งั้น log จะบวม) </span>
<span style="color: #808080; font-style: italic;">             พอวันดีคืนดีเกิดระบบมีปัญหาเราก็แค่มาเปลี่ยน config เป็น debug เพื่อดูค่าที่เราเขียน code debug ไว้ได้ </span>
<span style="color: #808080; font-style: italic;">             ไม่ต้องลบ code ออก เขียน code ใหม่ ... เสียเวลา --&gt;</span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;level</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;DEBUG&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #808080; font-style: italic;">&lt;!-- add appender ที่เราเขียนกฎไว้ข้างบน เพื่อให้ัมันทำงาน --&gt;</span> 
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;appender-ref</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;RollingFile&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;appender-ref</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;FailureFile&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/root<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/log4net<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>ใน code ก็</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Windows.Forms</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">log4net</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF;">namespace</span> MyApp
<span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">partial</span> <span style="color: #FF0000;">class</span> OperationFoo <span style="color: #008000;">:</span> Form
    <span style="color: #000000;">&#123;</span>
        <span style="color: #0600FF;">private</span> <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">readonly</span> ILog log <span style="color: #008000;">=</span> LogManager.<span style="color: #0000FF;">GetLogger</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">typeof</span><span style="color: #000000;">&#40;</span>OperationFoo<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #0600FF;">public</span> Form1<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            InitializeComponent<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            GlobalContext.<span style="color: #0000FF;">Properties</span><span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;LogName&quot;</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #008000;">typeof</span><span style="color: #000000;">&#40;</span>OperationFoo<span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>log4net.<span style="color: #0000FF;">LogManager</span>.<span style="color: #0000FF;">GetRepository</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Configured</span> <span style="color: #008000;">==</span> <span style="color: #0600FF;">false</span><span style="color: #000000;">&#41;</span>
                log4net.<span style="color: #0000FF;">Config</span>.<span style="color: #0000FF;">XmlConfigurator</span>.<span style="color: #0000FF;">Configure</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF;">private</span> <span style="color: #0600FF;">void</span> button1_Click<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> sender, EventArgs e<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>   
            log.<span style="color: #0000FF;">Debug</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Now = &quot;</span> <span style="color: #008000;">+</span> DateTime.<span style="color: #0000FF;">Now</span>.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            log.<span style="color: #0000FF;">Info</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Now = &quot;</span> <span style="color: #008000;">+</span> DateTime.<span style="color: #0000FF;">Now</span>.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            log.<span style="color: #0000FF;">Warn</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Now = &quot;</span> <span style="color: #008000;">+</span> DateTime.<span style="color: #0000FF;">Now</span>.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            log.<span style="color: #0000FF;">Fatal</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Now = &quot;</span> <span style="color: #008000;">+</span> DateTime.<span style="color: #0000FF;">Now</span>.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>ฝากนิดนึงว่า เวลาจะใช้ log ให้เลือกชนิด log ให้ถูกว่าอันไหนควรจะเป็น debug หรือ warn หรือ fatal มันจะช่วยให้เราเก็บ log เป็นระบบขึ้น เวลาคนมาอ่าน log จะได้ไม่งง ไม่ตาลาย</p>
<p>หวังว่าการอัพ content ที่ห่างหายไปนานครั้งนี้ (และพิมพ์เยอะด้วย) จะเกิดประโยชน์้บ้างนะครับ >.<&#8216;a</p>
]]></content:encoded>
			<wfw:commentRss>http://krucode.net/dotnet/config-%e0%b8%8a%e0%b8%b7%e0%b9%88%e0%b8%ad%e0%b9%84%e0%b8%9f%e0%b8%a5%e0%b9%8c-log-%e0%b9%81%e0%b8%9a%e0%b8%9a-dynamic-%e0%b8%81%e0%b8%b1%e0%b8%9a-log4net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Paging กับ PHP และ MySQL</title>
		<link>http://krucode.net/software-development/paging-%e0%b8%81%e0%b8%b1%e0%b8%9a-php-%e0%b9%81%e0%b8%a5%e0%b8%b0-mysql/</link>
		<comments>http://krucode.net/software-development/paging-%e0%b8%81%e0%b8%b1%e0%b8%9a-php-%e0%b9%81%e0%b8%a5%e0%b8%b0-mysql/#comments</comments>
		<pubDate>Thu, 06 May 2010 07:57:06 +0000</pubDate>
		<dc:creator>Krucode</dc:creator>
				<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://krucode.net/?p=68</guid>
		<description><![CDATA[วันนี้เพื่อนอู๋ @aspgod มาขอให้เขียน content เกี่ยวกับการทำ Paging กับ PHP หน่อยนึง จริง ๆ ผมเองก็ไม่มีวิธีในใจหรอก ปรกติผมไม่ coding feature นี้ ผมจิ้มกับจิ้ม แล้วก็จิ้มเอาได้ทันทีจาก Dreamweaver (ตั้งแต่ CS3 ขึ้นไป) (ว่าจะเขียน content เกี่ยวกับ dreamweaver นี่ตั้งนานละ อยากบอกว่ามันง่ายมากจนแทบไม่ต้องเขียน code &#8230; รอ cs5 เลยละกันนะ จะได้ลองของใหม่ไปเลยทีเดียว ฮ่า ๆ ๆ) ก็เลยเอา Code ที่ Generate มาจาก Dreamweaver มาตีแผ่ เริ่มกันเลยละกันนะคับ อ่ะ code ส่วน connection ก่อนเลย (ตรงนี้คงไม่ต้องอธิบายมั้ง) $hostname_Conn = &#34;localhost&#34;; $database_Conn]]></description>
			<content:encoded><![CDATA[<p>วันนี้เพื่อนอู๋ <a href="http://www.aspgod.com">@aspgod</a> มาขอให้เขียน content เกี่ยวกับการทำ Paging กับ PHP หน่อยนึง</p>
<p>จริง ๆ ผมเองก็ไม่มีวิธีในใจหรอก ปรกติผมไม่ coding feature นี้ ผมจิ้มกับจิ้ม แล้วก็จิ้มเอาได้ทันทีจาก Dreamweaver (ตั้งแต่ CS3 ขึ้นไป) (ว่าจะเขียน content เกี่ยวกับ dreamweaver นี่ตั้งนานละ อยากบอกว่ามันง่ายมากจนแทบไม่ต้องเขียน code &#8230; รอ cs5 เลยละกันนะ จะได้ลองของใหม่ไปเลยทีเดียว ฮ่า ๆ ๆ)</p>
<p>ก็เลยเอา Code ที่ Generate มาจาก Dreamweaver มาตีแผ่</p>
<p>เริ่มกันเลยละกันนะคับ<br />
<span id="more-68"></span><br />
อ่ะ code ส่วน connection ก่อนเลย (ตรงนี้คงไม่ต้องอธิบายมั้ง)</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$hostname_Conn</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;localhost&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$database_Conn</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;my_db_name&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$username_Conn</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;my_db_username&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$password_Conn</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;my_db_password&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$Conn</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$hostname_Conn</span><span style="color: #339933;">,</span> <span style="color: #000088;">$username_Conn</span><span style="color: #339933;">,</span> <span style="color: #000088;">$password_Conn</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">trigger_error</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">E_USER_ERROR</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>เอ๊า Query (โดยรวมมันก็อยู่ตรงนี้แหละ &#8230; อ่าน comment เอานะครับ)</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//อันนี้ไว้ใช้เวลาจะเปลี่ยนหน้า page ก็คือรู้ url ปัจจุบันของ page นี้ (ไม่รวม QueryString)</span>
<span style="color: #000088;">$currentPage</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;PHP_SELF&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//กำหนดว่าจะแสดงกี่ row ต่อหน้า</span>
<span style="color: #000088;">$maxRows_rsVenue</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">20</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$pageNum_rsVenue</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//หน้าแรกก็ต้อง 0 ถูกป๊ะ</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'pageNum_rsVenue'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$pageNum_rsVenue</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'pageNum_rsVenue'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//แต่ถ้ามีการส่งค่าหน้ามาก็ใช้ค่าที่ส่งมา</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$startRow_rsVenue</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$pageNum_rsVenue</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$maxRows_rsVenue</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//พอรู้หน้า รู้จำนวนต่อหน้าแล้ว ก็มาหาว่าหน้านี้จะแสดงผลตั้งแต่ row ที่เท่าไหร่</span>
&nbsp;
<span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$database_Conn</span><span style="color: #339933;">,</span> <span style="color: #000088;">$Conn</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$query_rsVenue</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT VenueID, VenueName, ApproveCode FROM Venue ORDER BY VenueName ASC&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$query_limit_rsVenue</span> <span style="color: #339933;">=</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #009933; font-weight: bold;">%s</span> LIMIT <span style="color: #009933; font-weight: bold;">%d</span>, <span style="color: #009933; font-weight: bold;">%d</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$query_rsVenue</span><span style="color: #339933;">,</span> <span style="color: #000088;">$startRow_rsVenue</span><span style="color: #339933;">,</span> <span style="color: #000088;">$maxRows_rsVenue</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//จัดการต่อ Query เลยด้วยการ LIMIT จำนวนเริ่มต้น, แล้วก็จำนวนต่อ page</span>
<span style="color: #000088;">$rsVenue</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query_limit_rsVenue</span><span style="color: #339933;">,</span> <span style="color: #000088;">$Conn</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$row_rsVenue</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_assoc</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$rsVenue</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//ส่วนนี้ไว้หาจำนวน Row ทั้งหมด</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'totalRows_rsVenue'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$totalRows_rsVenue</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'totalRows_rsVenue'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$all_rsVenue</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query_rsVenue</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$totalRows_rsVenue</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_num_rows</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$all_rsVenue</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">//อ๊ะหาจำนวน page</span>
<span style="color: #000088;">$totalPages_rsVenue</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ceil</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$totalRows_rsVenue</span><span style="color: #339933;">/</span><span style="color: #000088;">$maxRows_rsVenue</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//จัดการ QueryString เป็นค่าใหม่</span>
<span style="color: #000088;">$queryString_rsVenue</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'QUERY_STRING'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$params</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&amp;amp;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'QUERY_STRING'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$newParams</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$params</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$param</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">stristr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$param</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;pageNum_rsVenue&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #009900; font-weight: bold;">false</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span>
        <span style="color: #990000;">stristr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$param</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;totalRows_rsVenue&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #990000;">array_push</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$newParams</span><span style="color: #339933;">,</span> <span style="color: #000088;">$param</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$newParams</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$queryString_rsVenue</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&amp;amp;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">htmlentities</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&amp;amp;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$newParams</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$queryString_rsVenue</span> <span style="color: #339933;">=</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&amp;amp;totalRows_rsVenue=<span style="color: #009933; font-weight: bold;">%d</span><span style="color: #009933; font-weight: bold;">%s</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$totalRows_rsVenue</span><span style="color: #339933;">,</span> <span style="color: #000088;">$queryString_rsVenue</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>มาส่วนของแสดงผลกันบ้าง</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>table border<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;0&quot;</span> cellspacing<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;1&quot;</span> cellpadding<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;1&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>tbody<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>tr<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span>VenueID<span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span>VenueName<span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span>ApproveCode<span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>tr<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>tr<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>td colspan<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;3&quot;</span><span style="color: #339933;">&gt;&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;addVenue.php&quot;</span><span style="color: #339933;">&gt;</span>Add <span style="color: #000000; font-weight: bold;">new</span> venue?<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;&lt;/</span>td<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>tr<span style="color: #339933;">&gt;</span>
<span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// Show if recordset not empty ?&amp;gt;</span>
<span style="color: #339933;">&lt;</span>tr<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;&lt;/</span>td<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;&lt;/</span>td<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;&lt;/</span>td<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>tr<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>tbody<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>table<span style="color: #339933;">&gt;</span>
&nbsp;
&nbsp;
 <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// Show if recordset not empty ?&amp;gt;</span>
&nbsp;
<span style="color: #339933;">&lt;</span>table border<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;0&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>tbody<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>tr<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// Show if not first page ?&amp;gt;</span>
          <span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&amp;lt;?php printf(&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #0000ff;">&quot;&amp;gt;First&lt;/a&gt;&lt;/td&gt;
&lt;td&gt; 0) { // Show if not first page ?&amp;gt;
          &lt;a href=&quot;</span><span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>?php <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&gt;&quot;</span><span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span>Previous<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;&lt;/</span>td<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span>
          <span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&amp;lt;?php printf(&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #0000ff;">&quot;&amp;gt;Next&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;
          &lt;a href=&quot;</span><span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>?php <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&gt;&quot;</span><span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span>Last<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;&lt;/</span>td<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>tr<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>tbody<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>table<span style="color: #339933;">&gt;</span></pre></div></div>

<p>หน้าตาที่ได้ก็ออกมาประมาณนี้เลยครับ<br />
<a href="http://krucode.net/wp-content/uploads/2010/05/2010-05-06_1502.png"><img class="aligncenter size-full wp-image-69" title="2010-05-06_1502" src="http://krucode.net/wp-content/uploads/2010/05/2010-05-06_1502.png" alt="" width="600" /></a></p>
<p>เห็น Code ยาวงี้ผมคลิกๆ ๆ ไม่ถึง 20ที แต่อันนี้เอาไว้ลองฝึกวิธีคิด และ coding นะครับ ส่วนเวลาจะทำงานจริงเราต้องใช้ Tool ที่เราใช้ของเถื่อน (พุดยังกะภาคภูมิใจ) ให้เป็นประโยชน์สูงสุดนะครับ (Dreamweaver ไม่ใช่แค่ไว้ออกแบบตารางอย่างที่ใครเข้าใจนะ T__T)</p>
<p>ไว้แล้วผมจะทำ Video Tutorial มาให้อีกทีนะคับ อดใจรอกันนิดดด นึง</p>
]]></content:encoded>
			<wfw:commentRss>http://krucode.net/software-development/paging-%e0%b8%81%e0%b8%b1%e0%b8%9a-php-%e0%b9%81%e0%b8%a5%e0%b8%b0-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows XP Mode บน Windows 7</title>
		<link>http://krucode.net/software-development/windows-xp-mode-%e0%b8%9a%e0%b8%99-windows-7/</link>
		<comments>http://krucode.net/software-development/windows-xp-mode-%e0%b8%9a%e0%b8%99-windows-7/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 03:44:42 +0000</pubDate>
		<dc:creator>Krucode</dc:creator>
				<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://krucode.net/?p=65</guid>
		<description><![CDATA[เคยไหม พอเปลี่ยนมาใช้ Windows 7 แล้วโปรแกรมบางโปรแกรมที่เราใช้อยู่มันไม่ Support ก็คิดถึง Windows XP ขึ้นมาตะหงิด ๆ แต่เรามีวิธี จริง ๆ จะว่าไปมันก็เป็น Virtual PC นั่นแหละ แต่มันใช้งานสะดวกกว่า (ผมคิดว่างั้นนะ) เราสามารถเรียกใช้โปรแกรมที่เราลงบน Windows XP (บน Virtual) ได้โดยตรงเลย (จริง ๆ ก็ไม่โดยตรงหรอก เพราะมันก็แอบเปิด Virtual ก่อนอยู่แล้ว แต่มันก็จะเปิดเฉพาะที่จำเป็นๆ โปรแกรมอื่น ๆ ก็ไม่ถูกเปิดออกมา) อย่างนี้ ผมจะเปิด VS 2008 ซึ่งผมลงไว้แล้วบน Virtual PC เราก็สามารถเปิดมันตรงๆ ได้จาก Windows 7 เลย โปรแกรมนี้ฟรี! แต่แน่นอน Windows 7 ของคุณต้องวิ่งผ่าน 5 แยกปากเกร็ดได้]]></description>
			<content:encoded><![CDATA[<p>เคยไหม พอเปลี่ยนมาใช้ Windows 7 แล้วโปรแกรมบางโปรแกรมที่เราใช้อยู่มันไม่ Support ก็คิดถึง Windows XP ขึ้นมาตะหงิด ๆ</p>
<p>แต่เรามีวิธี<br />
จริง ๆ จะว่าไปมันก็เป็น Virtual PC นั่นแหละ แต่มันใช้งานสะดวกกว่า (ผมคิดว่างั้นนะ) เราสามารถเรียกใช้โปรแกรมที่เราลงบน Windows XP (บน Virtual) ได้โดยตรงเลย (จริง ๆ ก็ไม่โดยตรงหรอก เพราะมันก็แอบเปิด Virtual ก่อนอยู่แล้ว แต่มันก็จะเปิดเฉพาะที่จำเป็นๆ โปรแกรมอื่น ๆ ก็ไม่ถูกเปิดออกมา)<br />
<span id="more-65"></span></p>
<p>อย่างนี้ ผมจะเปิด VS 2008 ซึ่งผมลงไว้แล้วบน Virtual PC เราก็สามารถเปิดมันตรงๆ  ได้จาก Windows 7 เลย<br />
<img class="aligncenter size-full wp-image-66" title="2010-04-19_1032" src="http://krucode.net/wp-content/uploads/2010/04/2010-04-19_1032.png" alt="" width="700" /></p>
<p>โปรแกรมนี้ฟรี! แต่แน่นอน Windows 7 ของคุณต้องวิ่งผ่าน 5 แยกปากเกร็ดได้ (Windows Genuine Validator)<br />
สามารถโหลดได้ที่นี่ครับ<br />
<a href="http://www.microsoft.com/windows/virtual-pc/download.aspx">http://www.microsoft.com/windows/virtual-pc/download.aspx</a><br />
<a href="http://www.microsoft.com/windows/virtual-pc/download.aspx"><img class="aligncenter size-full wp-image-67" title="2010-04-19_1038" src="http://krucode.net/wp-content/uploads/2010/04/2010-04-19_1038.png" alt="" width="700" /></a><br />
ก็เลือก Version ของ Windows 7 ของเรา<br />
แล้วก็โหลด 3 อันด้านล่าง ลงตามลำดับ ก็เป็นอันเรียบร้อยครับผม!</p>
]]></content:encoded>
			<wfw:commentRss>http://krucode.net/software-development/windows-xp-mode-%e0%b8%9a%e0%b8%99-windows-7/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Setting Exchange Google กับ iPhone</title>
		<link>http://krucode.net/software-development/setting-exchange-gmail-%e0%b8%81%e0%b8%b1%e0%b8%9a-iphone/</link>
		<comments>http://krucode.net/software-development/setting-exchange-gmail-%e0%b8%81%e0%b8%b1%e0%b8%9a-iphone/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 11:12:05 +0000</pubDate>
		<dc:creator>Krucode</dc:creator>
		
		<guid isPermaLink="false">http://krucode.net/?p=55</guid>
		<description><![CDATA[ตอนนี้ผมเปลี่ยนจาก Android มาใช้ iPhone แล้ว ตอนใช้ Android ก็คือเก็บข้อมูล Contact / Calendar / Email ไว้ที่ Google ทั้งหมด (เรียกว่าฝากทั้งชีวิตไว้ที่นี่เลย) (ต่อไปถ้าเปลี่ยนมือถือใหม่ feature แรกที่จะต้องมีเลยคือ &#8220;Sync กับ Google Contact ได้ไหม?&#8221;) ข้อดีคือ เราเปลี่ยนเครื่อง เราก็ไม่ต้องมานั่งเมมเบอร์ใหม่ เรา add เบอร์ใครมันก็จะ Sync ขึ้นไปที่ Google.com/contacts เองเลย (แต่ก็ต้องมีการต่อเน็ตนะ ผ่าน GPRS/Wifi ก็ว่ากันไป) อ๊ะ พอมาใช้ iPhone แล้ว เราก็สามารถ Sync. ได้ แต่ผ่าน Exchange (ซึ่งก็มาหมดทั้ง contact / calendar / mail) วิธีก็คือ]]></description>
			<content:encoded><![CDATA[<p>ตอนนี้ผมเปลี่ยนจาก Android มาใช้ iPhone แล้ว</p>
<p>ตอนใช้ Android ก็คือเก็บข้อมูล Contact / Calendar / Email ไว้ที่ Google ทั้งหมด (เรียกว่าฝากทั้งชีวิตไว้ที่นี่เลย)<br />
(ต่อไปถ้าเปลี่ยนมือถือใหม่ feature แรกที่จะต้องมีเลยคือ &#8220;Sync กับ Google Contact ได้ไหม?&#8221;)</p>
<p>ข้อดีคือ เราเปลี่ยนเครื่อง เราก็ไม่ต้องมานั่งเมมเบอร์ใหม่ เรา add เบอร์ใครมันก็จะ Sync ขึ้นไปที่ Google.com/contacts เองเลย (แต่ก็ต้องมีการต่อเน็ตนะ ผ่าน GPRS/Wifi ก็ว่ากันไป)</p>
<p>อ๊ะ พอมาใช้ iPhone แล้ว เราก็สามารถ Sync. ได้ แต่ผ่าน Exchange (ซึ่งก็มาหมดทั้ง contact / calendar / mail) วิธีก็คือ</p>
<p><span id="more-55"></span></p>
<ul>
<li>ไปที่ <strong>Settings</strong></li>
<li>เลือก <strong>Mail, Contacts, Calendars.</strong><img class="aligncenter size-full wp-image-56" title="mobile_138740a_en" src="http://krucode.net/wp-content/uploads/2010/04/mobile_138740a_en.gif" alt="" width="192" height="282" /></li>
<li>จิ้ม <strong>Add Account&#8230;</strong><img class="aligncenter size-full wp-image-56" title="mobile_138740a_en" src="http://krucode.net/wp-content/uploads/2010/04/mobile_138740b_en.gif" alt="" width="192" height="282" /></li>
<li>เลือก <strong>Microsoft Exchange.</strong> (ไม่ใช่ Gmail นะ)<img class="aligncenter size-full wp-image-56" title="mobile_138740c_en" src="http://krucode.net/wp-content/uploads/2010/04/mobile_138740c_en.gif" alt="" width="192" height="282" /></li>
<li>กรอกข้อมูลเลย <strong>Username</strong> ก็ใช่ email ของ<br />
เราไป<img class="aligncenter size-full wp-image-56" title="mobile_138740a_en" src="http://krucode.net/wp-content/uploads/2010/04/mobile_138740h_en.gif" alt="" width="192" height="282" /></li>
<li>กด Next ได้เลย ถ้ามันย้อนกลับมาให้กรอกช่อง <strong>Server</strong> ให้กรอก <em>m.google.com</em> แล้วกด Next อีกที<img class="aligncenter size-full wp-image-56" title="mobile_138740a_en" src="http://krucode.net/wp-content/uploads/2010/04/mobile_138740d_en.gif" alt="" width="192" height="282" /></li>
<li>คราวนี้ก็มาเลือกว่าเราจะ Sync. อะไรบ้าง (ผมเลือกหมดเลย)<img class="aligncenter size-full wp-image-56" title="mobile_138740a_en" src="http://krucode.net/wp-content/uploads/2010/04/mobile_138740e_en.gif" alt="" width="192" height="282" /></li>
<li>ถ้าเราเลือก sync. contact มันจะถามว่า จะลบเบอร์เดิมที่อยู่ในเครื่องไหม ตอบดี ๆ นะ เบอร์หายไม่รับผิดชอบ ฮ่าๆ ๆ แค่นี้ก็เสร็จสิ้นกระบวนการละ<img class="aligncenter size-full wp-image-62" title="mobile_138740i_keep_content_en" src="http://krucode.net/wp-content/uploads/2010/04/mobile_138740i_keep_content_en.gif" alt="" width="192" height="282" /></li>
</ul>
<p>(จริง ๆ แล้วข้อมูลทั้งหมดก็มาจากที่นี่ แค่ translate มาเป็นไทยแค่นั้นเอง <a href="http://www.google.com/support/mobile/bin/answer.py?answer=138740&amp;topic=14252">http://www.google.com/support/mobile/bin/answer.py?answer=138740&amp;topic=14252</a>)</p>
]]></content:encoded>
			<wfw:commentRss>http://krucode.net/software-development/setting-exchange-gmail-%e0%b8%81%e0%b8%b1%e0%b8%9a-iphone/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Compile ผ่านบ้าง ไม่ผ่านบ้าง กับ .NET 1.1</title>
		<link>http://krucode.net/software-development/compile-%e0%b8%9c%e0%b9%88%e0%b8%b2%e0%b8%99%e0%b8%9a%e0%b9%89%e0%b8%b2%e0%b8%87-%e0%b9%84%e0%b8%a1%e0%b9%88%e0%b8%9c%e0%b9%88%e0%b8%b2%e0%b8%99%e0%b8%9a%e0%b9%89%e0%b8%b2%e0%b8%87-%e0%b8%81%e0%b8%b1/</link>
		<comments>http://krucode.net/software-development/compile-%e0%b8%9c%e0%b9%88%e0%b8%b2%e0%b8%99%e0%b8%9a%e0%b9%89%e0%b8%b2%e0%b8%87-%e0%b9%84%e0%b8%a1%e0%b9%88%e0%b8%9c%e0%b9%88%e0%b8%b2%e0%b8%99%e0%b8%9a%e0%b9%89%e0%b8%b2%e0%b8%87-%e0%b8%81%e0%b8%b1/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 04:08:54 +0000</pubDate>
		<dc:creator>Krucode</dc:creator>
		
		<guid isPermaLink="false">http://krucode.net/?p=54</guid>
		<description><![CDATA[พอดีว่าเจอปัญหา Compile ผ่านบ้างไม่ผ่านบ้าง เจอ error Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. เปิดปิด Visual Studio 2003 บางทีก็หาย บางทีก็ไม่หาย Restart เครื่องถึงจะหาย สรุปไปเจอปัญหาคือ ตัว .NET User เนี่ยะ มัน Access Folder TEMP ไม่ได้ วิธีการแก้ คลิกขวา]]></description>
			<content:encoded><![CDATA[<p>พอดีว่าเจอปัญหา Compile ผ่านบ้างไม่ผ่านบ้าง<br />
เจอ error</p>
<blockquote><p><strong style="color: red;">Compilation Error</strong><br />
<strong>Description:</strong> An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.</p></blockquote>
<p>เปิดปิด Visual Studio 2003 บางทีก็หาย บางทีก็ไม่หาย<br />
Restart เครื่องถึงจะหาย</p>
<p>สรุปไปเจอปัญหาคือ ตัว .NET User เนี่ยะ มัน Access Folder TEMP ไม่ได้ วิธีการแก้</p>
<ul>
<li>คลิกขวา My Computer &gt; Properties</li>
<li>ไปที่ Tab Advance</li>
<li>คลิกปุ่ม Variables</li>
<li>ตรง กล่อง System Variables</li>
<li>เลือก <strong>TEMP </strong>กด Edit พิมพ์ <strong>%SystemRoot%\TEMP1</strong> ใน Variable Values กด โอเค</li>
<li>เลือก <strong>TMP </strong>กด Edit พิมพ์ <strong>%SystemRoot%\TEMP1</strong> ใน Variable Values</li>
<li>กด OK ให้ครบทุกหน้าต่าง</li>
<li>ไปที่ Start &gt; Run พิมพ์ <strong>iisreset</strong> มันจะขึ้นหน้าต่างใหม่มา รอจนมันปิดไป ก็เสร็จละคับ</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://krucode.net/software-development/compile-%e0%b8%9c%e0%b9%88%e0%b8%b2%e0%b8%99%e0%b8%9a%e0%b9%89%e0%b8%b2%e0%b8%87-%e0%b9%84%e0%b8%a1%e0%b9%88%e0%b8%9c%e0%b9%88%e0%b8%b2%e0%b8%99%e0%b8%9a%e0%b9%89%e0%b8%b2%e0%b8%87-%e0%b8%81%e0%b8%b1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ปวดหัวนักกับ Datetime, Culture UI พ.ศ. หรือ ค.ศ. ล่ะ</title>
		<link>http://krucode.net/software-development/%e0%b8%9b%e0%b8%a7%e0%b8%94%e0%b8%ab%e0%b8%b1%e0%b8%a7%e0%b8%99%e0%b8%b1%e0%b8%81%e0%b8%81%e0%b8%b1%e0%b8%9a-datetime-culture-ui-%e0%b8%9e-%e0%b8%a8-%e0%b8%ab%e0%b8%a3%e0%b8%b7%e0%b8%ad-%e0%b8%84/</link>
		<comments>http://krucode.net/software-development/%e0%b8%9b%e0%b8%a7%e0%b8%94%e0%b8%ab%e0%b8%b1%e0%b8%a7%e0%b8%99%e0%b8%b1%e0%b8%81%e0%b8%81%e0%b8%b1%e0%b8%9a-datetime-culture-ui-%e0%b8%9e-%e0%b8%a8-%e0%b8%ab%e0%b8%a3%e0%b8%b7%e0%b8%ad-%e0%b8%84/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 11:50:51 +0000</pubDate>
		<dc:creator>Krucode</dc:creator>
		
		<guid isPermaLink="false">http://krucode.net/?p=52</guid>
		<description><![CDATA[เคยไหม? ใช้พวก Calendar แล้ว .SelectedDate เป็น 2010 แล้วใน Database เป็น 2553 เวลา Query มาก้ Error Minimum Date บ้าง อะไรบ้าง ใครยังใช้วิธีการแก้ปัญหาด้วยการ .AddYears(543) อยู่บ้าง แล้วถ้าวันนึงมีคนไปแก้ Religions บน Server ล่ะจะทำไง วันนี้พบวิธีละ พอดีว่า ตัว Control ที่ผมใช้ jQueryDatePicker มันสนับสนุนแต่ปี ค.ศ. พอส่งไป Query ก็ Exception Thrown มาในบัดดล วิธีแก้ ระดับ Page (แก้เฉพาะ Page นั้น ๆ) &#60;%@ Page UICulture=&#34;en&#34; Culture=&#34;en-US&#34; %&#62; แก้ที่ WebConfig]]></description>
			<content:encoded><![CDATA[<p>เคยไหม?</p>
<p>ใช้พวก Calendar แล้ว .SelectedDate เป็น 2010<br />
แล้วใน Database เป็น 2553</p>
<p>เวลา Query มาก้ Error Minimum Date บ้าง อะไรบ้าง</p>
<p>ใครยังใช้วิธีการแก้ปัญหาด้วยการ .AddYears(543) อยู่บ้าง<br />
แล้วถ้าวันนึงมีคนไปแก้ Religions บน Server ล่ะจะทำไง</p>
<p>วันนี้พบวิธีละ</p>
<p>พอดีว่า ตัว Control ที่ผมใช้ jQueryDatePicker มันสนับสนุนแต่ปี ค.ศ. พอส่งไป Query ก็ Exception Thrown มาในบัดดล</p>
<p>วิธีแก้</p>
<p>ระดับ Page (แก้เฉพาะ Page นั้น ๆ)</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008000;">&lt;%</span>@ Page UICulture<span style="color: #008000;">=</span><span style="color: #666666;">&quot;en&quot;</span> Culture<span style="color: #008000;">=</span><span style="color: #666666;">&quot;en-US&quot;</span> <span style="color: #008000;">%&gt;</span></pre></div></div>

<p>แก้ที่ WebConfig (มีผลกับทุก page)</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;globalization</span> <span style="color: #000066;">uiCulture</span>=<span style="color: #ff0000;">&quot;en&quot;</span> <span style="color: #000066;">culture</span>=<span style="color: #ff0000;">&quot;en-US&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>ชะงัดนักแล&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://krucode.net/software-development/%e0%b8%9b%e0%b8%a7%e0%b8%94%e0%b8%ab%e0%b8%b1%e0%b8%a7%e0%b8%99%e0%b8%b1%e0%b8%81%e0%b8%81%e0%b8%b1%e0%b8%9a-datetime-culture-ui-%e0%b8%9e-%e0%b8%a8-%e0%b8%ab%e0%b8%a3%e0%b8%b7%e0%b8%ad-%e0%b8%84/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MD5 กับ C# .NET</title>
		<link>http://krucode.net/software-development/md5-%e0%b8%81%e0%b8%b1%e0%b8%9a-c-net/</link>
		<comments>http://krucode.net/software-development/md5-%e0%b8%81%e0%b8%b1%e0%b8%9a-c-net/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 03:58:46 +0000</pubDate>
		<dc:creator>Krucode</dc:creator>
		
		<guid isPermaLink="false">http://krucode.net/?p=51</guid>
		<description><![CDATA[ใครเคยเขียน php ก็มักจะใช้ function md5 บ้างใช่ไหม แล้ว .NET ล่ะ? md5 มันอยู่ไหน เขียนเองเลยละกัน ประมาณนี้คับ public string GetMD5Hash&#40;string input&#41; &#123; System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider&#40;&#41;; byte&#91;&#93; bs = System.Text.Encoding.UTF8.GetBytes&#40;input&#41;; bs = x.ComputeHash&#40;bs&#41;; System.Text.StringBuilder s = new System.Text.StringBuilder&#40;&#41;; foreach &#40;byte b in bs&#41; &#123; s.Append&#40;b.ToString&#40;&#34;x2&#34;&#41;.ToLower&#40;&#41;&#41;; &#125; string password = s.ToString&#40;&#41;; return password; &#125;]]></description>
			<content:encoded><![CDATA[<p>ใครเคยเขียน php ก็มักจะใช้ function md5 บ้างใช่ไหม แล้ว .NET ล่ะ? md5 มันอยู่ไหน<br />
เขียนเองเลยละกัน ประมาณนี้คับ</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> GetMD5Hash<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span> input<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #000000;">System.<span style="color: #0000FF;">Security</span>.<span style="color: #0000FF;">Cryptography</span></span>.<span style="color: #0000FF;">MD5CryptoServiceProvider</span> x <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> <span style="color: #000000;">System.<span style="color: #0000FF;">Security</span>.<span style="color: #0000FF;">Cryptography</span></span>.<span style="color: #0000FF;">MD5CryptoServiceProvider</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #FF0000;">byte</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> bs <span style="color: #008000;">=</span> <span style="color: #000000;">System.<span style="color: #0000FF;">Text</span></span>.<span style="color: #0000FF;">Encoding</span>.<span style="color: #0000FF;">UTF8</span>.<span style="color: #0000FF;">GetBytes</span><span style="color: #000000;">&#40;</span>input<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            bs <span style="color: #008000;">=</span> x.<span style="color: #0000FF;">ComputeHash</span><span style="color: #000000;">&#40;</span>bs<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #000000;">System.<span style="color: #0000FF;">Text</span></span>.<span style="color: #0000FF;">StringBuilder</span> s <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> <span style="color: #000000;">System.<span style="color: #0000FF;">Text</span></span>.<span style="color: #0000FF;">StringBuilder</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">byte</span> b <span style="color: #0600FF;">in</span> bs<span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                s.<span style="color: #0000FF;">Append</span><span style="color: #000000;">&#40;</span>b.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;x2&quot;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">ToLower</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #000000;">&#125;</span>
            <span style="color: #FF0000;">string</span> password <span style="color: #008000;">=</span> s.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF;">return</span> password<span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://krucode.net/software-development/md5-%e0%b8%81%e0%b8%b1%e0%b8%9a-c-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sourcesafe กับปัญหา ss.ini not found</title>
		<link>http://krucode.net/software-development/sourcesafe-%e0%b8%81%e0%b8%b1%e0%b8%9a%e0%b8%9b%e0%b8%b1%e0%b8%8d%e0%b8%ab%e0%b8%b2-ss-ini-not-found/</link>
		<comments>http://krucode.net/software-development/sourcesafe-%e0%b8%81%e0%b8%b1%e0%b8%9a%e0%b8%9b%e0%b8%b1%e0%b8%8d%e0%b8%ab%e0%b8%b2-ss-ini-not-found/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 04:12:01 +0000</pubDate>
		<dc:creator>Krucode</dc:creator>
		
		<guid isPermaLink="false">http://krucode.net/?p=47</guid>
		<description><![CDATA[เฮ้อ! เวลาตั้งใจจะขยันขึ้นมาแล้ว ผ่าง!!! File &#8220;\\Sourcesafe\Source\NET\users\teeradec\ss.ini&#8221; not found Sourcesafe เกิด connect ไม่ได้นี่มันน่าปวดกะบาลยิ่งนัก ปรกติก็ต้องเดินไปบอก Admin ว่า &#8220;พี่คับ Sourcesafe เข้าไม่ได้ &#8230; (อีกแล้ว) &#8230;&#8221; พี่เค้าก็ analyst database, restart sourcesafe หรือทำอะไรก็ว่ากันไป แต่วันนี้เจอทางแก้ เค้าบอกว่าให้ไปที่ part ตาม error นั้นแหละผ่าน explorer แล้ว rename ssXXX.tmp ให้เป็น ss.ini ปัญหามันเกิดจาก sourcesafe มันพยายามทำอะไรสักอย่างเลย rename file นี้ไปเป็น tmp แล้วดันทำไม่เสร็จ เลยไม่ได้มา rename ไฟล์นี้กลั ปล่อยค้างเติ่งไว้งี้แหละ เอางี้แหละ สรุป rename file นั้นกลับมาเป็น]]></description>
			<content:encoded><![CDATA[<p>เฮ้อ! เวลาตั้งใจจะขยันขึ้นมาแล้ว ผ่าง!!!<br />
<img src="http://krucode.net/wp-content/uploads/2010/01/2553-01-25_1107.png" alt="" title="2553-01-25_1107" width="425" height="130" class="aligncenter size-full wp-image-48" /></p>
<div style="clear:both"></div>
<p>File &#8220;\\Sourcesafe\Source\NET\users\teeradec\ss.ini&#8221; not found<br />
Sourcesafe เกิด connect ไม่ได้นี่มันน่าปวดกะบาลยิ่งนัก</p>
<p>ปรกติก็ต้องเดินไปบอก Admin ว่า &#8220;พี่คับ Sourcesafe เข้าไม่ได้ &#8230; (อีกแล้ว) &#8230;&#8221;<br />
พี่เค้าก็ analyst database, restart sourcesafe หรือทำอะไรก็ว่ากันไป</p>
<p>แต่วันนี้เจอทางแก้ เค้าบอกว่าให้ไปที่ part ตาม error นั้นแหละผ่าน explorer<br />
แล้ว rename ssXXX.tmp ให้เป็น ss.ini </p>
<p>ปัญหามันเกิดจาก sourcesafe มันพยายามทำอะไรสักอย่างเลย rename file นี้ไปเป็น tmp แล้วดันทำไม่เสร็จ เลยไม่ได้มา rename ไฟล์นี้กลั ปล่อยค้างเติ่งไว้งี้แหละ</p>
<p>เอางี้แหละ สรุป rename file นั้นกลับมาเป็น ss.ini แก้ปัญหาได้ชะงัดนักแล</p>
]]></content:encoded>
			<wfw:commentRss>http://krucode.net/software-development/sourcesafe-%e0%b8%81%e0%b8%b1%e0%b8%9a%e0%b8%9b%e0%b8%b1%e0%b8%8d%e0%b8%ab%e0%b8%b2-ss-ini-not-found/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress ดึงรายชื่อ Category บางรายการ</title>
		<link>http://krucode.net/software-development/wordpress-%e0%b8%94%e0%b8%b6%e0%b8%87%e0%b8%a3%e0%b8%b2%e0%b8%a2%e0%b8%8a%e0%b8%b7%e0%b9%88%e0%b8%ad-category-%e0%b8%9a%e0%b8%b2%e0%b8%87%e0%b8%a3%e0%b8%b2%e0%b8%a2%e0%b8%81%e0%b8%b2%e0%b8%a3/</link>
		<comments>http://krucode.net/software-development/wordpress-%e0%b8%94%e0%b8%b6%e0%b8%87%e0%b8%a3%e0%b8%b2%e0%b8%a2%e0%b8%8a%e0%b8%b7%e0%b9%88%e0%b8%ad-category-%e0%b8%9a%e0%b8%b2%e0%b8%87%e0%b8%a3%e0%b8%b2%e0%b8%a2%e0%b8%81%e0%b8%b2%e0%b8%a3/#comments</comments>
		<pubDate>Sat, 26 Dec 2009 19:26:02 +0000</pubDate>
		<dc:creator>Krucode</dc:creator>
		
		<guid isPermaLink="false">http://krucode.net/?p=43</guid>
		<description><![CDATA[วันนี้ได้รับ requirement จาก @aspgod (ผู้ซึ่งพัฒนา http://football.chatza.com ด้วยกัน) ว่าอยากได้ sidebar ที่แบ่ง category ออกเป็น 2 ส่วน ปรกติแล้วเวลาเราจะแสดงรายการ category เราก็จะใช้วิธี 1 wp_list_categories&#40;&#41;; ซึ่งก็จะได้รายชื่อ category ทั้งหมดมา แต่ท่าน @aspgod ต้องการอย่างนี้ (เอาผลลัพท์มาโชว์กันเลยซะงั้น) จะเห็นว่าทั้งหมดเป็น category แต่แสดงผลเป็นสองส่วน ทำยังไงให้ได้แบบนี้ ผมใช้ Option ของ wp_list_categories() ที่ชื่อว่า exclude และ include เราจะใช้ option นี้ option ใด option หนึ่งเท่านั้น ไม่ใช้ 2 option นี้พร้อมกัน exclude หมายความว่า เราจะแสดงทุก category ที่ไม่ใช่ใน id]]></description>
			<content:encoded><![CDATA[<p>วันนี้ได้รับ requirement จาก <a href="http://www.aspgod.com">@aspgod</a> (ผู้ซึ่งพัฒนา <a href="http://football.chatza.com">http://football.chatza.com</a> ด้วยกัน) ว่าอยากได้ sidebar ที่แบ่ง category ออกเป็น 2 ส่วน</p>
<p>ปรกติแล้วเวลาเราจะแสดงรายการ category เราก็จะใช้วิธี</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"> wp_list_categories<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>ซึ่งก็จะได้รายชื่อ category ทั้งหมดมา</p>
<p><img src="http://krucode.net/wp-content/uploads/2009/12/sidebar.jpg" alt="sidebar" title="sidebar" class="alignleft size-full wp-image-44" height="296" width="201">แต่ท่าน <a href="http://www.aspgod.com">@aspgod</a> ต้องการอย่างนี้ (เอาผลลัพท์มาโชว์กันเลยซะงั้น)<br />
จะเห็นว่าทั้งหมดเป็น category แต่แสดงผลเป็นสองส่วน ทำยังไงให้ได้แบบนี้</p>
<p>ผมใช้ Option ของ wp_list_categories() ที่ชื่อว่า exclude และ include</p>
<p>เราจะใช้ option นี้ option ใด option หนึ่งเท่านั้น ไม่ใช้ 2 option นี้พร้อมกัน</p>
<p>exclude หมายความว่า เราจะแสดงทุก category ที่ไม่ใช่ใน id พวกนี้<br />
include หมายความว่า เราจะแสดงทุก category ที่อยู่ใน id พวกนี้เท่านั้น</p>
<p>ตามผลลัพท์ข้างบน code ก็จะประมาณนี้</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">wp_list_categories<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'include=1,2,3,4,5,6,7'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// แสดง รายชื่อ category เฉพาะ 7 รายการนี้ (ชื่อ league)</span>
wp_list_categories<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'exclude=1,2,3,4,5,6,7'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// แสดง รายชื่อ category ทั้งหมดที่ไม่อยู่ใน 7 รายการนี้</span></pre></td></tr></table></div>

<p>ง่ายมั๊ยครับ รายละเอียด option อื่น ๆ ดูเพิ่มเติมได้ที่นี่ครับ<br />
<a href="http://codex.wordpress.org/Template_Tags/wp_list_categories">http://codex.wordpress.org/Template_Tags/wp_list_categories</a></p>
<p>ไหน ๆ ก็ไหน ๆ แล้ว แวะไปนั่งดู<a href="http://football.chatza.com">คลิปฟุตบอล ที่ http://football.chatza.com</a> ซะหน่อยละกันเนอะ ฮ่า ๆ</p>
]]></content:encoded>
			<wfw:commentRss>http://krucode.net/software-development/wordpress-%e0%b8%94%e0%b8%b6%e0%b8%87%e0%b8%a3%e0%b8%b2%e0%b8%a2%e0%b8%8a%e0%b8%b7%e0%b9%88%e0%b8%ad-category-%e0%b8%9a%e0%b8%b2%e0%b8%87%e0%b8%a3%e0%b8%b2%e0%b8%a2%e0%b8%81%e0%b8%b2%e0%b8%a3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
