<?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>MEMOBALL.info &#187; Web Application</title>
	<atom:link href="http://www.memoball.info/category/programming/webapp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.memoball.info</link>
	<description>All of my Memories</description>
	<lastBuildDate>Thu, 22 Jul 2010 06:17:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>70 web application ที่น่าสนใจ</title>
		<link>http://www.memoball.info/02/70-web-application-%e0%b8%97%e0%b8%b5%e0%b9%88%e0%b8%99%e0%b9%88%e0%b8%b2%e0%b8%aa%e0%b8%99%e0%b9%83%e0%b8%88/</link>
		<comments>http://www.memoball.info/02/70-web-application-%e0%b8%97%e0%b8%b5%e0%b9%88%e0%b8%99%e0%b9%88%e0%b8%b2%e0%b8%aa%e0%b8%99%e0%b9%83%e0%b8%88/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 02:12:03 +0000</pubDate>
		<dc:creator>spnball</dc:creator>
				<category><![CDATA[Web Application]]></category>

		<guid isPermaLink="false">http://www.memoball.info/?p=447</guid>
		<description><![CDATA[This is protected content. Please Login or Register for access.
]]></description>
			<content:encoded><![CDATA[<br/><div id="wp-private-box"><b>This is protected content. Please <a href="http://www.memoball.info/wp-login.php">Login</a> or <a href="http://www.memoball.info/wp-register.php">Register</a> for access.</b></div><br/><!--/protected--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.memoball.info/02/70-web-application-%e0%b8%97%e0%b8%b5%e0%b9%88%e0%b8%99%e0%b9%88%e0%b8%b2%e0%b8%aa%e0%b8%99%e0%b9%83%e0%b8%88/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Download file over SSL Error with Internet Explorer</title>
		<link>http://www.memoball.info/02/download-file-over-ssl-error-with-internet-explorer/</link>
		<comments>http://www.memoball.info/02/download-file-over-ssl-error-with-internet-explorer/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 00:20:14 +0000</pubDate>
		<dc:creator>spnball</dc:creator>
				<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Application]]></category>
		<category><![CDATA[web bug]]></category>

		<guid isPermaLink="false">http://www.memoball.info/?p=427</guid>
		<description><![CDATA[เมื่ออาทิตย์ก่อน ผมเจอปัญหาที่ทำอยู่ที่ทำงานครับ ซึ่งงานผมเป็น service ที่ทำงานอยู่บน SSL หรือพูดให้ฟังดูง่ายๆ คือ https นั้นเอง ปัญหาที่ผมกับผู้ใช้งานเซอร์วิชก็คือ ไม่สามารถดาวโหลดแฟ้มข้อมูลได้
ปัญหา
ไม่สามารถโหลดไฟล์ผ่าน SSL  โดยปัญหานี้พบกับเฉพาะ Internet Explorer 7 (IE7 โดย IE รุ่นอื่น ยังไม่ได้รับรายงานปัญหาดังกล่าว) ส่วนบราวเซอร์ตัวอื่นยังไม่พบปัญหาเช่นนี้ โดย error ที่พบ IE จะขึ้นมาที่ผู้ใช้ว่า &#8220;the file could not be written to the cache&#8221; ทำให้ไม่สามารถดาวโหลดไฟล์ได้
วิธีการแก้ไข
สามารถเลือกแก้ไขได้โดยวิธีใดวิธีหนึ่งดังนี้
สำหรับ server admin หรือ webmaster
ห้ามใส่ cache-control หรือ pragma: no-cache ลงใน header ของ http ในส่วนที่เป็น oct-stream หรือ file-download
สำหรับ client [...]]]></description>
			<content:encoded><![CDATA[<p>เมื่ออาทิตย์ก่อน ผมเจอปัญหาที่ทำอยู่ที่ทำงานครับ ซึ่งงานผมเป็น service ที่ทำงานอยู่บน SSL หรือพูดให้ฟังดูง่ายๆ คือ https นั้นเอง ปัญหาที่ผมกับผู้ใช้งานเซอร์วิชก็คือ ไม่สามารถดาวโหลดแฟ้มข้อมูลได้<span id="more-427"></span></p>
<h2>ปัญหา</h2>
<p>ไม่สามารถโหลดไฟล์ผ่าน SSL  โดยปัญหานี้พบกับเฉพาะ Internet Explorer 7 (IE7 โดย IE รุ่นอื่น ยังไม่ได้รับรายงานปัญหาดังกล่าว) ส่วนบราวเซอร์ตัวอื่นยังไม่พบปัญหาเช่นนี้ โดย error ที่พบ IE จะขึ้นมาที่ผู้ใช้ว่า <strong>&#8220;the file could not be written to the cache&#8221; </strong>ทำให้ไม่สามารถดาวโหลดไฟล์ได้</p>
<h2>วิธีการแก้ไข</h2>
<p>สามารถเลือกแก้ไขได้โดยวิธีใดวิธีหนึ่งดังนี้</p>
<h3>สำหรับ server admin หรือ webmaster</h3>
<p>ห้ามใส่ cache-control หรือ pragma: no-cache ลงใน header ของ http ในส่วนที่เป็น oct-stream หรือ file-download</p>
<h3>สำหรับ client (ผมยังไม่ได้ลองครับ)</h3>
<p>เข้าไป uncheck ตามลำดับดังนี้ IE Tools -&gt; Internet Options -&gt; Advanced -&gt; Security -&gt;<strong> Do not save encrypted<br />
pages to disk </strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.memoball.info/02/download-file-over-ssl-error-with-internet-explorer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP ก็สามารถทำ Multithreading/Parrallel-programing ได้</title>
		<link>http://www.memoball.info/05/php-%e0%b8%81%e0%b9%87%e0%b8%aa%e0%b8%b2%e0%b8%a1%e0%b8%b2%e0%b8%a3%e0%b8%96%e0%b8%97%e0%b8%b3-multithreadingparrallel-programing-%e0%b9%84%e0%b8%94%e0%b9%89/</link>
		<comments>http://www.memoball.info/05/php-%e0%b8%81%e0%b9%87%e0%b8%aa%e0%b8%b2%e0%b8%a1%e0%b8%b2%e0%b8%a3%e0%b8%96%e0%b8%97%e0%b8%b3-multithreadingparrallel-programing-%e0%b9%84%e0%b8%94%e0%b9%89/#comments</comments>
		<pubDate>Tue, 26 May 2009 04:21:42 +0000</pubDate>
		<dc:creator>spnball</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web Application]]></category>

		<guid isPermaLink="false">http://memoball.nabzer.com/?p=289</guid>
		<description><![CDATA[เมื่อวานได้อ่านเรื่องการใช้ทำ multithreading ใน php เลยคิดว่าน่าสนใจ (http://codestips.com/php-multithreading-using-curl/) เพราะโดยปกติแล้วตัว php เองไม่สามารถทำการฟอร์ค thread ขึ้นมาได้เอง จึงทำการให้การทำงานในบางประเภททำได้ยากหรือไม่มีประสิทธิภาพ ซึ่งเมื่อได้อ่านแล้วก็รู้สึกว่ามีประโยชน์เป็นอย่างมาก ซึ่งอาจจะเขียน php_proxy ใน Napzer library ให้เป็นอย่างนี้ก็คงดี อย่างไรก็ตามผมยังห่วงเรื่องประสิทธิภาพในการทำงานว่ามันจะมีประสิทธิภาพมากแค่ไหน ซึ่งผมคิดว่ามันขึ้นอยู่กับการออกแบบ ซึ่งคงต้องลองทำการทดสอบกันดูในระดับหนึ่ง


จาก WikiBall


			
การเขียนแอพลิเคชั่นแบบ Parallel programming ใน PHP นั้นไม่สามารถทำได้โดยตรง เพราะ PHP ไม่มีความยุ่งยากในการจัดการเกี่ยวกับเรื่องของ threading จึงทำให้ง่ายต่อการเขียน แต่สำหรับงานบางอย่างแล้วการใช้การคำนวณแบบคูขนานก็มีความจำเป็นในการใช้งาน ไม่ว่าจะเป็นการทำงานอยู่บนเครื่องเดียวกัน หรือเครื่องอื่นก็ตาม เราจึงต้องหาวิธีการอื่นมาช่วย ซึ่งในที่นี้เราจะพูดถึงการใช้ cURL library มาช่วยในการจัดการ





เนื้อหา


1 ข้อดีของการทำ parrallel programming
2 uCURL กับการทำ multithreading
3 ตัวอย่างการใช้ cURL
4 ตัวอย่าง




 if (window.showTocToggle) { var tocShowText [...]]]></description>
			<content:encoded><![CDATA[<p>เมื่อวานได้อ่านเรื่องการใช้ทำ multithreading ใน php เลยคิดว่าน่าสนใจ (<a href="http://codestips.com/php-multithreading-using-curl/">http://codestips.com/php-multithreading-using-curl/</a>) เพราะโดยปกติแล้วตัว php เองไม่สามารถทำการฟอร์ค thread ขึ้นมาได้เอง จึงทำการให้การทำงานในบางประเภททำได้ยากหรือไม่มีประสิทธิภาพ ซึ่งเมื่อได้อ่านแล้วก็รู้สึกว่ามีประโยชน์เป็นอย่างมาก ซึ่งอาจจะเขียน php_proxy ใน Napzer library ให้เป็นอย่างนี้ก็คงดี อย่างไรก็ตามผมยังห่วงเรื่องประสิทธิภาพในการทำงานว่ามันจะมีประสิทธิภาพมากแค่ไหน ซึ่งผมคิดว่ามันขึ้นอยู่กับการออกแบบ ซึ่งคงต้องลองทำการทดสอบกันดูในระดับหนึ่ง<br />
<span id="more-289"></span></p>
<div id="bodyContent">
<h3 id="siteSub"><a href="http://wiki.memoball.info/index.php/PHP_multithreading_and_Parallel_programming_using_cURL">จาก WikiBall</a></h3>
<div id="contentSub"></div>
<div id="jump-to-nav"></div>
<p>			<!-- start content --></p>
<p>การเขียนแอพลิเคชั่นแบบ Parallel programming ใน PHP นั้นไม่สามารถทำได้โดยตรง เพราะ PHP ไม่มีความยุ่งยากในการจัดการเกี่ยวกับเรื่องของ threading จึงทำให้ง่ายต่อการเขียน แต่สำหรับงานบางอย่างแล้วการใช้การคำนวณแบบคูขนานก็มีความจำเป็นในการใช้งาน ไม่ว่าจะเป็นการทำงานอยู่บนเครื่องเดียวกัน หรือเครื่องอื่นก็ตาม เราจึงต้องหาวิธีการอื่นมาช่วย ซึ่งในที่นี้เราจะพูดถึงการใช้ cURL library มาช่วยในการจัดการ
</p>
<table id="toc" class="toc" summary="เนื้อหา">
<tr>
<td>
<div id="toctitle">
<h2>เนื้อหา</h2>
</div>
<ul>
<li class="toclevel-1"><a href="./#.E0.B8.82.E0.B9.89.E0.B8.AD.E0.B8.94.E0.B8.B5.E0.B8.82.E0.B8.AD.E0.B8.87.E0.B8.81.E0.B8.B2.E0.B8.A3.E0.B8.97.E0.B8.B3_parrallel_programming" ref="toc"><span class="tocnumber">1</span> <span class="toctext">ข้อดีของการทำ parrallel programming</span></a></li>
<li class="toclevel-1"><a href="./#uCURL_.E0.B8.81.E0.B8.B1.E0.B8.9A.E0.B8.81.E0.B8.B2.E0.B8.A3.E0.B8.97.E0.B8.B3_multithreading" ref="toc"><span class="tocnumber">2</span> <span class="toctext">uCURL กับการทำ multithreading</span></a></li>
<li class="toclevel-1"><a href="./#.E0.B8.95.E0.B8.B1.E0.B8.A7.E0.B8.AD.E0.B8.A2.E0.B9.88.E0.B8.B2.E0.B8.87.E0.B8.81.E0.B8.B2.E0.B8.A3.E0.B9.83.E0.B8.8A.E0.B9.89_cURL" ref="toc"><span class="tocnumber">3</span> <span class="toctext">ตัวอย่างการใช้ cURL</span></a></li>
<li class="toclevel-1"><a href="./#.E0.B8.95.E0.B8.B1.E0.B8.A7.E0.B8.AD.E0.B8.A2.E0.B9.88.E0.B8.B2.E0.B8.87" ref="toc"><span class="tocnumber">4</span> <span class="toctext">ตัวอย่าง</span></a></li>
</ul>
</td>
</tr>
</table>
<p><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "แสดง"; var tocHideText = "ซ่อน"; showTocToggle(); } </script><br />
<a name=".E0.B8.82.E0.B9.89.E0.B8.AD.E0.B8.94.E0.B8.B5.E0.B8.82.E0.B8.AD.E0.B8.87.E0.B8.81.E0.B8.B2.E0.B8.A3.E0.B8.97.E0.B8.B3_parrallel_programming" href="http://wiki.memoball.info/"></a><br />
<h2> <span class="mw-headline"> ข้อดีของการทำ parrallel programming </span></h2>
<p>การเขียนโปรแกรมแบบ parrallel นั้นเหมาะสมกับการทำงานบางอย่าง ซึ่งในคอมพิวเตอร์ของเราในปัจจุบันก็ใช้การทำงานลักษณะดังกล่าวในโปรแกรมหลายๆ ชนิด เช่น โปรแกรมทางด้านกราฟิก วิธีการนี้จะช่วยลดเวลาในการทำงานของกระบวนการหลักไปได้เป็นอย่างมาก เช่น เราแบ่งส่วนต่างๆ ของหน้าเวปของเราเป็น widget หรือ module ย่อยๆ แล้วในเครื่องแต่ละเครื่องทำงานในการสร้างโมดูลของตัวเองโดยเฉพาะ ซึ่งจะดีแค่ไหนที่เราสามารถเรียกใช้งาน module ต่างๆ นั้นได้พร้อมๆ กัน โดยไม่ต้องรอโหลดเรียงกันทีละ module โดยการเขียนโปรแกรมอย่างนี้จะทำให้ช่วยประหยัดเวลาสร้างข้อมูลที่จะต้องส่งให้ client ได้มาก และยังสามารถใช้ทรัพยากรที่มีอยู่ได้อย่างมีประสิทธิภาพสูงสุดอีกด้วย
</p>
<p><a name="uCURL_.E0.B8.81.E0.B8.B1.E0.B8.9A.E0.B8.81.E0.B8.B2.E0.B8.A3.E0.B8.97.E0.B8.B3_multithreading" href="http://wiki.memoball.info/"></a><br />
<h2> <span class="mw-headline"> uCURL กับการทำ multithreading </span></h2>
<p>uCURL นั้นโดยปกติแล้วไม่ถูกติดตั้งเข้ามาใน PHP มาก่อนแแต่จะมาเป็น extension เสริมสำหรับ PHP (โดยส่วนมากผู้ให้บริการ Host ทั่วไปจะทำการติดตั้งมาให้อยู่แล้ว) หนึ่งในความสามารถของ uCURL ที่น่าสนใจอย่างมากคือการทำ multi handle ซึ่งยอมให้สามารถทำ multiple cURL processing ในแบบ parallel ซึ่งฟังก์ชั่นสำคัญที่ต้องใข้ได้แก่
</p>
<ul>
<li> <b>curl_multi_init</b> &#8211; initialize a new cURL multi handle. It will return the cURL handle on success and FALSE on error.
</li>
<li> <b>curl_multi_add_handle</b> — Add a cURL handle to a cURL multi handle.
</li>
<li> <b>curl_multi_exec</b> — Runs all the curl handle in the cURL multi handle in parallel.
</li>
<li> <b>curl_multi_remove_handle</b> — Removes a cURL handle from a cURL multi handle.
</li>
<li> <b>curl_multi_close</b> — close the cURL multi handle.
</li>
</ul>
<p><a name=".E0.B8.95.E0.B8.B1.E0.B8.A7.E0.B8.AD.E0.B8.A2.E0.B9.88.E0.B8.B2.E0.B8.87.E0.B8.81.E0.B8.B2.E0.B8.A3.E0.B9.83.E0.B8.8A.E0.B9.89_cURL" href="http://wiki.memoball.info/"></a><br />
<h2> <span class="mw-headline"> ตัวอย่างการใช้ cURL </span></h2>
<p>สร้างอเรย์สำหรับบ่งบอกว่า process ไหนจะทำที่ url ใด
</p>
<pre name="code" class="php">
$process[1] = &quot;http://www.example1.com&quot;;
$process[2] = &quot;ftp://example3.com&quot;;
$process[3] = &quot;http://www.example2.com&quot;;
</pre>
<p>สร้าง cURL และทำการกำหนด handles
</p>
<pre name="code" class="php">
$curlHandle = curl_multi_init();
for ($i = 1;$i &lt;= 3; $i++)
 $curl[$i] = addHandle($curlHandle,$process[$i]);
</pre>
<p>รัน process
</p>
<pre name="code" class="php">
ExecHandle($curlHandle);
</pre>
<p>รับ content จาก handle ต่างๆ
</p>
<pre name="code" class="php">
for ($i = 1;$i &lt;= 3; $i++)
{
 $content[$i] =  curl_multi_getcontent ($curl[$i]);
 echo $content[$i];
}
</pre>
<p>ปิด handles และ url
</p>
<pre name="code" class="php">
for ($i = 1;$i &lt;= 3; $i++)//remove the sub - handles
  curl_multi_remove_handle($curlHandle,$curl[$i]);
curl_multi_close($curlHandle);
</pre>
<p><a name=".E0.B8.95.E0.B8.B1.E0.B8.A7.E0.B8.AD.E0.B8.A2.E0.B9.88.E0.B8.B2.E0.B8.87" href="http://wiki.memoball.info/"></a><br />
<h2> <span class="mw-headline"> ตัวอย่าง </span></h2>
<pre name="code" class="php">
&lt;?
//add a url to the handler
function addHandle(&amp;$curlHandle,$url)
{
$cURL = curl_init();
curl_setopt($cURL, CURLOPT_URL, $url);
curl_setopt($cURL, CURLOPT_HEADER, 0);
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, 1);
curl_multi_add_handle($curlHandle,$cURL);
return $cURL;
}
//execute the handle until the flag passed
// to function is greater then 0
function ExecHandle(&amp;$curlHandle)
{
$flag=null;
do {
//fetch pages in parallel
    curl_multi_exec($curlHandle,$flag);
} while ($flag &gt; 0);
}

$list[1] = &quot;http://www.example1.com&quot;;
$list[2] = &quot;ftp://example.com&quot;;
$list[3] = &quot;http://www.example2.com&quot;;
$curlHandle = curl_multi_init();
for ($i = 1;$i &lt;= 3; $i++)
 $curl[$i] = addHandle($curlHandle,$list[$i]);
ExecHandle($curlHandle);
for ($i = 1;$i &lt;= 3; $i++)
{
 $text[$i] =  curl_multi_getcontent ($curl[$i]);
 echo $text[$i];
}
for ($i = 1;$i &lt;= 3; $i++)//remove the handles
  curl_multi_remove_handle($curlHandle,$curl[$i]);
curl_multi_close($curlHandle);
?&gt;
</pre>
<p>จาก <a href="http://codestips.com/php-multithreading-using-curl/" class="external free" title="http://codestips.com/php-multithreading-using-curl/" rel="nofollow">http://codestips.com/php-multithreading-using-curl/</a>
</p>
<p><a href="http://codestips.com/scripts/multithread.zip" class="external text" title="http://codestips.com/scripts/multithread.zip" rel="nofollow">Complete source</a>  <a href="http://www.memoball.info/wp-content/uploads/2009/05/multithread.zip" class="external text" title="http://www.memoball.info/wp-content/uploads/2009/05/multithread.zip" rel="nofollow">(Mirror)</a><br />
<b>ทำตัวหนา</b>
</p>
<p><!--<br />
NewPP limit report<br />
Preprocessor node count: 23/1000000<br />
Post-expand include size: 0/2097152 bytes<br />
Template argument size: 0/2097152 bytes<br />
Expensive parser function count: 0/100<br />
--></p>
<p><!-- Saved in parser cache with key memoball_wiki:pcache:idhash:55-0!1!0!!th!2!edit=0 and timestamp 20090825091057 --></p>
<div class="printfooter">
<h5>รับข้อมูลจาก (Reference) : </h5>
<p>จาก WikiBall : <a href="http://wiki.memoball.info/index.php/PHP_multithreading_and_Parallel_programming_using_cURL">http://wiki.memoball.info/index.php/PHP_multithreading_and_Parallel_programming_using_cURL</a></div>
<div id='catlinks' class='catlinks'>
<div id="mw-normal-catlinks"><a href="http://wiki.memoball.info//index.php/%E0%B8%9E%E0%B8%B4%E0%B9%80%E0%B8%A8%E0%B8%A9:Categories" title="พิเศษ:Categories">หมวดหมู่</a>:&#32;<span dir='ltr'><a href="http://wiki.memoball.info//index.php?title=%E0%B8%AB%E0%B8%A1%E0%B8%A7%E0%B8%94%E0%B8%AB%E0%B8%A1%E0%B8%B9%E0%B9%88:PHP&amp;action=edit&amp;redlink=1" class="new" title="หมวดหมู่:PHP (ยังไม่ได้สร้าง)">PHP</a></span></div>
</div>
<p>			<!-- end content --></p>
<div class="visualClear"></div>
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.memoball.info/05/php-%e0%b8%81%e0%b9%87%e0%b8%aa%e0%b8%b2%e0%b8%a1%e0%b8%b2%e0%b8%a3%e0%b8%96%e0%b8%97%e0%b8%b3-multithreadingparrallel-programing-%e0%b9%84%e0%b8%94%e0%b9%89/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>แจ้งเตือน Firebug แบบ Gmail</title>
		<link>http://www.memoball.info/05/%e0%b9%81%e0%b8%88%e0%b9%89%e0%b8%87%e0%b9%80%e0%b8%95%e0%b8%b7%e0%b8%ad%e0%b8%99-firebug-%e0%b9%81%e0%b8%9a%e0%b8%9a-gmail/</link>
		<comments>http://www.memoball.info/05/%e0%b9%81%e0%b8%88%e0%b9%89%e0%b8%87%e0%b9%80%e0%b8%95%e0%b8%b7%e0%b8%ad%e0%b8%99-firebug-%e0%b9%81%e0%b8%9a%e0%b8%9a-gmail/#comments</comments>
		<pubDate>Fri, 22 May 2009 02:34:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Application]]></category>
		<category><![CDATA[Web application]]></category>

		<guid isPermaLink="false">http://memoball.nabzer.com/?p=286</guid>
		<description><![CDATA[สำหรับนักพัฒนาเวปไซต์ที่อยากรู้อยากเห็นทั้งหลาย (รวมทั้งผมด้วย) คงเคยใช้ firebug ไปลองแกะหน้าของ gmail ดูว่ามันทำยังไงมันถึงได้เร็วขนาดนี้ แล้วก็จะเห็นแจ้งเตือนว่า firebug ทำให้การใช้งานของท่านช้าลงนะ วันนี้เลยเอาวิธีทำแจ้งเตือนแบบนี้มาเก็บไว้ให้ดูเล่นๆ กัน


จาก WikiBall


			
			
 How to

&#60;script type=&#34;text/javascript&#34;&#62;
if( window.console &#38;&#38; window.console.firebug )
    document.getElementsByTagName('body')[0].innerHTML +=
           &#34;&#60;div onclick=\&#34;this.style.display = 'none'\&#34; &#34;+
           &#34;style='position:absolute; top:0; width:100%; padding: 5px [...]]]></description>
			<content:encoded><![CDATA[<p>สำหรับนักพัฒนาเวปไซต์ที่อยากรู้อยากเห็นทั้งหลาย (รวมทั้งผมด้วย) คงเคยใช้ firebug ไปลองแกะหน้าของ gmail ดูว่ามันทำยังไงมันถึงได้เร็วขนาดนี้ แล้วก็จะเห็นแจ้งเตือนว่า firebug ทำให้การใช้งานของท่านช้าลงนะ วันนี้เลยเอาวิธีทำแจ้งเตือนแบบนี้มาเก็บไว้ให้ดูเล่นๆ กัน<br />
<span id="more-286"></span></p>
<div id="bodyContent">
<h3 id="siteSub"><a href="http://wiki.memoball.info/index.php/Block_Firebug">จาก WikiBall</a></h3>
<div id="contentSub"></div>
<div id="jump-to-nav"></div>
<p>			<!-- start content --><br />
			<a name="How_to" href="http://wiki.memoball.info/"></a><br />
<h2> <span class="mw-headline">How to</span></h2>
<pre name="code" class="javascript">
&lt;script type=&quot;text/javascript&quot;&gt;
if( window.console &amp;&amp; window.console.firebug )
    document.getElementsByTagName('body')[0].innerHTML +=
           &quot;&lt;div onclick=\&quot;this.style.display = 'none'\&quot; &quot;+
           &quot;style='position:absolute; top:0; width:100%; padding: 5px 0; background: #ff7; border-bottom: 1px solid #770; font-weight: bold; text-align: center;'&gt;&quot;+
           &quot;Firebug can make this web page slow, we suggest you disable it for this web page. Click to close this warning.&lt;/div&gt;&quot;;
&lt;/script&gt;
</pre>
<p>เพียงแค่เพิ่ม script ด้านบน ก็สามารถแจ้งเตือนผู้ใช้ได้แล้วว่าท่านกำลังเปิด firebug อยู่ ซึ่งอาจทำให้การดูเวปไซต์ของท่านนั้นช้าลง เหมือนตัวอย่างเช่น gmail นั่นเอง
</p>
<p><a name="Reference" href="http://wiki.memoball.info/"></a><br />
<h2> <span class="mw-headline">Reference</span></h2>
<ul>
<li><a href="http://www.unwrongest.com/blog/if-firebug-slows-down-your-web-page-make-a-suggestion/" class="external free" title="http://www.unwrongest.com/blog/if-firebug-slows-down-your-web-page-make-a-suggestion/" rel="nofollow">http://www.unwrongest.com/blog/if-firebug-slows-down-your-web-page-make-a-suggestion/</a>
</li>
<li><a href="http://blog.dkferguson.com/index.cfm/2009/3/31/Block-Firebug-on-your-site/" class="external free" title="http://blog.dkferguson.com/index.cfm/2009/3/31/Block-Firebug-on-your-site/" rel="nofollow">http://blog.dkferguson.com/index.cfm/2009/3/31/Block-Firebug-on-your-site/</a>
</li>
</ul>
<p><!--<br />
NewPP limit report<br />
Preprocessor node count: 6/1000000<br />
Post-expand include size: 0/2097152 bytes<br />
Template argument size: 0/2097152 bytes<br />
Expensive parser function count: 0/100<br />
--></p>
<p><!-- Saved in parser cache with key memoball_wiki:pcache:idhash:54-0!1!0!!th!2!edit=0 and timestamp 20090825115814 --></p>
<div class="printfooter">
<h5>รับข้อมูลจาก (Reference) : </h5>
<p>จาก WikiBall : <a href="http://wiki.memoball.info/index.php/Block_Firebug">http://wiki.memoball.info/index.php/Block_Firebug</a></div>
<p>						<!-- end content --></p>
<div class="visualClear"></div>
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.memoball.info/05/%e0%b9%81%e0%b8%88%e0%b9%89%e0%b8%87%e0%b9%80%e0%b8%95%e0%b8%b7%e0%b8%ad%e0%b8%99-firebug-%e0%b9%81%e0%b8%9a%e0%b8%9a-gmail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PNG Image Optimization</title>
		<link>http://www.memoball.info/05/png-image-optimization/</link>
		<comments>http://www.memoball.info/05/png-image-optimization/#comments</comments>
		<pubDate>Wed, 20 May 2009 14:48:19 +0000</pubDate>
		<dc:creator>spnball</dc:creator>
				<category><![CDATA[Graphics]]></category>
		<category><![CDATA[Web Application]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[Web application]]></category>

		<guid isPermaLink="false">http://memoball.nabzer.com/?p=282</guid>
		<description><![CDATA[การทำให้ขนาดของรูปภาพมีขนาดเล็กลง เป็นส่วนหนึ่งที่จะทำให้เวปไซต์ของเราโหลดไวขึ้น อีกทั้งใช้แบนวิธที่น้อยลงทำให้เซอร์เวอร์ของเราใช้งานได้อย่างมีประสิทธิภาพเพิ่มมากขึ้น ซึ่งการทำให้ไฟล์รูปแบบ PNG มีขนาดน้อยลงมีวิธีทำดังต่อไปนี้


จาก WikiBall


			




เนื้อหา


1 Optimize ด้วย OptiPNG หรือ pngcrush

1.1 PNGcrush
1.2 Optipng


2 Optimize with Smush.it
3 reference




 if (window.showTocToggle) { var tocShowText = "แสดง"; var tocHideText = "ซ่อน"; showTocToggle(); } 

  Optimize ด้วย OptiPNG หรือ pngcrush 

 PNGcrush
pngcrush เป็นโปรแกรมที่มีอยู่แล้วใน ubuntu synapticสามารถใช้ apt-get เอามาลงได้เลย

$ pngcrush -rem allb -brute -reduce original.png optimized.png
โดยพารามิเตอร์ต่างๆ มีความหมายดังต่อไปนี้


 -rem allb [...]]]></description>
			<content:encoded><![CDATA[<p>การทำให้ขนาดของรูปภาพมีขนาดเล็กลง เป็นส่วนหนึ่งที่จะทำให้เวปไซต์ของเราโหลดไวขึ้น อีกทั้งใช้แบนวิธที่น้อยลงทำให้เซอร์เวอร์ของเราใช้งานได้อย่างมีประสิทธิภาพเพิ่มมากขึ้น ซึ่งการทำให้ไฟล์รูปแบบ PNG มีขนาดน้อยลงมีวิธีทำดังต่อไปนี้<br />
<span id="more-282"></span></p>
<div id="bodyContent">
<h3 id="siteSub"><a href="http://wiki.memoball.info/index.php/PNG_Image_Optimization">จาก WikiBall</a></h3>
<div id="contentSub"></div>
<div id="jump-to-nav"></div>
<p>			<!-- start content --></p>
<table id="toc" class="toc" summary="เนื้อหา">
<tr>
<td>
<div id="toctitle">
<h2>เนื้อหา</h2>
</div>
<ul>
<li class="toclevel-1"><a href="./#Optimize_.E0.B8.94.E0.B9.89.E0.B8.A7.E0.B8.A2_OptiPNG_.E0.B8.AB.E0.B8.A3.E0.B8.B7.E0.B8.AD_pngcrush" ref="toc"><span class="tocnumber">1</span> <span class="toctext">Optimize ด้วย OptiPNG หรือ pngcrush</span></a>
<ul>
<li class="toclevel-2"><a href="./#PNGcrush" ref="toc"><span class="tocnumber">1.1</span> <span class="toctext">PNGcrush</span></a></li>
<li class="toclevel-2"><a href="./#Optipng" ref="toc"><span class="tocnumber">1.2</span> <span class="toctext">Optipng</span></a></li>
</ul>
</li>
<li class="toclevel-1"><a href="./#Optimize_with_Smush.it" ref="toc"><span class="tocnumber">2</span> <span class="toctext">Optimize with Smush.it</span></a></li>
<li class="toclevel-1"><a href="./#reference" ref="toc"><span class="tocnumber">3</span> <span class="toctext">reference</span></a></li>
</ul>
</td>
</tr>
</table>
<p><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "แสดง"; var tocHideText = "ซ่อน"; showTocToggle(); } </script><br />
<a name="Optimize_.E0.B8.94.E0.B9.89.E0.B8.A7.E0.B8.A2_OptiPNG_.E0.B8.AB.E0.B8.A3.E0.B8.B7.E0.B8.AD_pngcrush" href="http://wiki.memoball.info/"></a><br />
<h2> <span class="mw-headline"> Optimize ด้วย OptiPNG หรือ pngcrush </span></h2>
<p><a name="PNGcrush" href="http://wiki.memoball.info/"></a><br />
<h3> <span class="mw-headline">PNGcrush</span></h3>
<p>pngcrush เป็นโปรแกรมที่มีอยู่แล้วใน ubuntu synapticสามารถใช้ apt-get เอามาลงได้เลย
</p>
<pre>$ pngcrush -rem allb -brute -reduce original.png optimized.png</pre>
<p>โดยพารามิเตอร์ต่างๆ มีความหมายดังต่อไปนี้
</p>
<ul>
<li> <b>-rem allb</b> &#8212; remove all extraneous data. Except transparency and gamma; to remove everything except transparency, try<i> -rem alla</i>
</li>
<li> <b>-brute</b> &#8212; attempt all optimization methods. Requires more processing time and may not improve optimization by much.
</li>
<li> <b>-reduce</b> &#8212; eliminate unused colors and reduce bit-depth. ถ้าเป็นไปได้
</li>
</ul>
<p><a name="Optipng" href="http://wiki.memoball.info/"></a><br />
<h3> <span class="mw-headline">Optipng</span></h3>
<pre>$ optipng -o7 org.png</pre>
<ul>
<li> <b>-o7</b> — optimize ระดับสูงสุด โดยเริ่มจากระดับที่ 0 &#8211; 7
</li>
</ul>
<p><a name="Optimize_with_Smush.it" href="http://wiki.memoball.info/"></a><br />
<h2> <span class="mw-headline"> Optimize with Smush.it </span></h2>
<p>ย่อรูปด้วยโปรแกรม smush.it ซึ่งเป็นโปรแกรมสำหรับ Firefox<br />
[<a href="http://smush.it" class="external autonumber" title="http://smush.it" rel="nofollow">[1]</a>]
</p>
<p><a name="reference" href="http://wiki.memoball.info/"></a><br />
<h2> <span class="mw-headline"> reference </span></h2>
<ul>
<li> <a href="http://perishablepress.com/press/2009/05/17/png-image-optimization/" class="external free" title="http://perishablepress.com/press/2009/05/17/png-image-optimization/" rel="nofollow">http://perishablepress.com/press/2009/05/17/png-image-optimization/</a>
</li>
<li> <a href="http://www.dzone.com/" class="external free" title="http://www.dzone.com/" rel="nofollow">http://www.dzone.com/</a>
</li>
</ul>
<p><!--<br />
NewPP limit report<br />
Preprocessor node count: 12/1000000<br />
Post-expand include size: 0/2097152 bytes<br />
Template argument size: 0/2097152 bytes<br />
Expensive parser function count: 0/100<br />
--></p>
<p><!-- Saved in parser cache with key memoball_wiki:pcache:idhash:52-0!1!0!!th!2!edit=0 and timestamp 20090825195504 --></p>
<div class="printfooter">
<h5>รับข้อมูลจาก (Reference) : </h5>
<p>จาก WikiBall : <a href="http://wiki.memoball.info/index.php/PNG_Image_Optimization">http://wiki.memoball.info/index.php/PNG_Image_Optimization</a></div>
<div id='catlinks' class='catlinks'>
<div id="mw-normal-catlinks"><a href="http://wiki.memoball.info//index.php/%E0%B8%9E%E0%B8%B4%E0%B9%80%E0%B8%A8%E0%B8%A9:Categories" title="พิเศษ:Categories">หมวดหมู่</a>:&#32;<span dir='ltr'><a href="http://wiki.memoball.info//index.php?title=%E0%B8%AB%E0%B8%A1%E0%B8%A7%E0%B8%94%E0%B8%AB%E0%B8%A1%E0%B8%B9%E0%B9%88:PHP&amp;action=edit&amp;redlink=1" class="new" title="หมวดหมู่:PHP (ยังไม่ได้สร้าง)">PHP</a></span> | <span dir='ltr'><a href="http://wiki.memoball.info//index.php?title=%E0%B8%AB%E0%B8%A1%E0%B8%A7%E0%B8%94%E0%B8%AB%E0%B8%A1%E0%B8%B9%E0%B9%88:Web_developer&amp;action=edit&amp;redlink=1" class="new" title="หมวดหมู่:Web developer (ยังไม่ได้สร้าง)">Web developer</a></span></div>
</div>
<p>			<!-- end content --></p>
<div class="visualClear"></div>
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.memoball.info/05/png-image-optimization/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
