Web Ofebia contentshttp://web.ofebia.com/feeds/atom2012-02-05T15:24:09Zweb.ofebiaweb.ofebia@gmail.comhttp://web.ofebia.comการทำ multiple backgrounds ด้วย CSS3 เพื่อทำให้สามารถใช้รูปภาพเป็นพื้นหลังได้หลายๆรูป2012-02-05T15:24:09Z2012-02-05T15:24:09Zaclairhttp://member.ofebia.com/home/aclair/images/aclair.jpgtag:web.ofebia.com,2012-02-05:/contents/title/การทำ-multiple-backgrounds-ด้วย-CSS3-เพื่อทำให้สามารถใช้รูปภาพเป็นพื้นหลังได้หลายๆรูป<p>ปัจจุบันนี้ CSS3 กำลังเป็นที่นิยมเพิ่มขึ้นในหมู่นักพัฒนาเว็บไซต์ เนื่องด้วยความสามารถใหม่ที่ CSS3 สามารถทำได้นั้น ทำให้ผู้ ที่พัฒนาเว็บไซต์นั้นสามารถเพิ่มลูกเล่น หรือทำงานต่างๆที่ต้องอาศัยความพยายามมากได้ง่ายขึ้น</p> <p>วันนี้เลยเอาเรื่องการทำ <a title="CSS3 Background By w3.org" href="http://dev.w3.org/csswg/css3-background/#layering" target="_blank">Multiple Backgrounds</a> ซึ่งเป็นการเขียนกำหนดค่าให้กับตัว background โดยความสามารถของเจ้า <a title="CSS3 Syntax" href="http://web.ofebia.com/contents/title/%E0%B8%A3%E0%B8%A7%E0%B8%A1-CSS3-Syntax" target="_blank">CSS3</a> ตรงส่วนนี้คือ สามารถทำให้หนึ่ง element มีพื้นหลังที่เป็นรูปภาพได้หลายอัน ดูวิธีทำตามตัวอย่างข้างล่าง</p> <p><span style="text-decoration: underline;"><strong>CSS3</strong></span></p> <pre class="prettyprint lang-css"><p>.background:url(background-1.png) center 90% no-repeat,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; url(background-2.jpg) top left no-repeat;</p></pre> <p><span style="text-decoration: underline;"><strong>ผลลัพธ์ </strong></span></p> <p><img title="ทดสอบการใช้ multiple backgrounds ของ css3" src="http://web.ofebia.com/home/aclair/images/20090910131034/css3-multiple-backgrounds-sample.jpg" alt="ทดสอบการใช้ multiple backgrounds ของ css3" /></p> <p>จากโค้ด <a title="CSS3 Syntax" href="http://web.ofebia.com/contents/title/%E0%B8%A3%E0%B8%A7%E0%B8%A1-CSS3-Syntax" target="_blank">CSS3</a> จะเห็นว่าใช้โค้ดเดิมก็คือ background แต่ใช้ comma เพื่อแยกค่าของทั้ง 2 รูปออกจากกัน โดยจะเรียงลำดับตามไปเรื่อยๆ ถ้ามีหลายรูปก็ใช้ comma กั้น เพื่อจะกำหนดค่าของพื้นหลังอันใหม่ โดยการเขียนโค้ดจะเรียงลำดับตามรูป ภาพพื้นหลังที่อยู่หน้าสุดไปยังพื้นหลังที่อยู่หลังสุด จากรูปจะเห็นว่าโลโก้ favicon ของ web.ofebia จะอยู่หน้าสุด ซึ่งในโค้ดของคลาส background ก็ต้องเขียนไว้เป็นอันดับแรก นั่นก็คือ background-1.png และเมื่อกำหนดค่าหมดแล้วก็คั่นด้วย comma เพื่อที่จะกำหนดค่าพื้นหลังอันที่สอง และอื่นๆต่อไป</p> <p><span style="text-decoration: underline;"><strong>ตัวอย่างโค้ดที่ใช้ทำรูปผลลัพธ์</strong></span></p> <p><span style="text-decoration: underline;"><strong>HTML</strong></span></p> <pre class="prettyprint lang-html"><p>&lt;div class="background"&gt;<br />&lt;p&gt;ทดสอบการใช้ Multiple Backgrounds ของ CSS3&lt;/p&gt;<br />&lt;/div&gt;</p></pre> <p><span style="text-decoration: underline;"><strong>CSS3 </strong></span></p> <pre class="prettyprint lang-css"><p>.background{ <br />width:580px; <br />height:330px; <br />padding:0; <br />margin:0; <br />background:url(background-1.png) center 90% no- repeat, <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; url(background-2.jpg) top left no-repeat; <br />}</p> <p>.background p{ <br />margin:0; <br />padding:30px 0 0 0; <br />text-align:center; <br />color:#fff; <br />font:bold 16px/18px Tahoma, Geneva, sans-serif; <br />}</p></pre> <p><strong>Browser ที่สามารถแสดงผลได้ ได้แก่</strong> IE9+, Firefox 3.6+, Chrome 4+, Safari 3.1+, Opera 10.5+</p> <p>ขอบคุณพื้นหลัง <a title="Typographic Background By Parkzizz" href="http://web.ofebia.com/contents/view/260.htm" target="_blank">Typographic Background</a> ของ parkzizz ^^</p>cc-byhttp://web.ofebia.com/home/aclair/images/20090910131034/css3-multiple-backgrounds-sample.jpg81CSS3 Click Chart2012-02-05T14:04:57Z2012-02-05T14:04:57Zaclairhttp://member.ofebia.com/home/aclair/images/aclair.jpgtag:web.ofebia.com,2012-02-05:/contents/view/314.htmเว็บไซต์ที่สอนเกี่ยวกับตัว Systax ของ CSS3 ที่น่าสนใจมากเว็บไซต์หนึ่ง ซึ่งตัวเว็บไซต์เองก็ใช้งานง่ายและวิธิการสอนก็ไม่ยาก มีตัวอย่างและโคดให้ดูทำให้สามารถเข้าใจการทำงานของ CSS3 ได้ง่ายดายpublic63สร้างสุริยุปราคาในอวกาศด้วย Photoshop2012-02-04T14:21:48Z2012-02-04T14:21:48Zparkzzhttp://member.ofebia.com/home/parkzz/images/parkzz.pngtag:web.ofebia.com,2012-02-04:/contents/title/Create-a-Solar-Eclipse-in-Space<p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;">สวัสดี วันนี้มีวิธีสร้างสุริยุปราคาในอวกาศด้วย Photoshop มาฝาก</span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;">1. สร้างเอกสารใหม่ กำหนดสี Foreground เป็น #500000 และสี Background เป็นสีดำ #000000 จากนั้นให้ไปที่ <strong>Filter &gt; Render &gt; Clouds</strong> จะได้ดังรูป</span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><img style="display: block; margin-left: auto; margin-right: auto;" title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090704101650/Create-a-Solar-Eclipse-in-Space-Step-1.jpg" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="500" height="500" /></span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;">2. เลือก <strong>Edit in Quick Mask Mode</strong> (Q)&nbsp;<img title="Edit in Quick Mask Mode" src="http://web.ofebia.com/home/parkzz/images/20090726143137/Edit_in_Quick_Mask_Mode.gif" alt="Edit in Quick Mask Mode" width="17" height="13" />&nbsp; แล้วเลือกเครื่องมือ <strong>Gradient</strong>&nbsp;<img title="Gradient Tool" src="http://web.ofebia.com/home/parkzz/images/20090726143137/Gradient_Tool.gif" alt="Gradient Tool" width="25" height="19" /> แบบ Linear Gradient โดยลากจากด้านล่างไปด้านบน จะได้ดังรูป</span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><img style="display: block; margin-left: auto; margin-right: auto;" title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090704101650/Create-a-Solar-Eclipse-in-Space-Step-2-1.jpg" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="500" height="500" /></span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;">จากนั้นเลือกกลับสู่ <strong>Standard Mode</strong> (Q)&nbsp;<img title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090726143137/Edit_in_Standard_Mode.gif" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="25" height="20" /> จะเห็นว่ามี Selection ด้านล่างของรูป</span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><img style="display: block; margin-left: auto; margin-right: auto;" title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090704101650/Create-a-Solar-Eclipse-in-Space-Step-2-2.jpg" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="500" height="500" /></span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;">3. ต่อไปจะเปลี่ยนสีให้กับส่วนที่เลือกไว้ โดยไปที่ <strong>Image &gt; Adjustment &gt; Hue/Saturation</strong> กำหนดให้ Edit = Master, Hue = -155, Saturation = -30, Lightness = -10 ดังรูป</span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><img style="display: block; margin-left: auto; margin-right: auto;" title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090704101650/Create-a-Solar-Eclipse-in-Space-Step-3-1.jpg" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="405" height="285" /></span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;">จะได้ดังรูป</span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><img style="display: block; margin-left: auto; margin-right: auto;" title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090704101650/Create-a-Solar-Eclipse-in-Space-Step-3-2.jpg" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="500" height="500" /></span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;">กดปุ่ม Ctrl + D เพื่อยกเลิก Selection</span></p> <p><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;">4. สร้าง Layer ใหม่ และเติมสีดำลงไป จากนั้นให้ไปที่ <strong>Filter &gt; Noise &gt; Add Noise</strong> กำหนดค่า Amount = 26%, Distribution = Gaussian และเลือก Monochromatic ดังรูป</span></p> <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><img style="display: block; margin-left: auto; margin-right: auto;" title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090704101650/Create-a-Solar-Eclipse-in-Space-Step-4-1.jpg" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="316" height="393" /></span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;">เปลี่ยน Layer style เป็น Screen จากนั้นไปที่ <strong>Image &gt; Adjustment &gt; Levels</strong> กำหนดค่าดังรูป</span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><img style="display: block; margin-left: auto; margin-right: auto;" title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090704101650/Create-a-Solar-Eclipse-in-Space-Step-4-2.jpg" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="399" height="305" /></span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;">จะได้ดังรูป</span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><img style="display: block; margin-left: auto; margin-right: auto;" title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090704101650/Create-a-Solar-Eclipse-in-Space-Step-4-3.jpg" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="500" height="500" /></span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;">5. ต่อไปให้เลือกเครื่องมือ <strong>Eraser Tool</strong>&nbsp;<img title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090726143137/Eraser_Tool.gif" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="25" height="19" /> เลือกหัวแปรงแบบนุ่ม แล้วนำมาลบลงบนชิ้นงานเป็นหย่อมๆ จะได้ดังรูป</span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><img style="display: block; margin-left: auto; margin-right: auto;" title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090704101650/Create-a-Solar-Eclipse-in-Space-Step-5-1.jpg" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="500" height="500" /></span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;">6. ได้อวกาศแล้ว คราวนี้มาสร้างสุริยุปราคากันบ้าง เริ่มจากให้ดาวน์โหลดรูปพื้นผิวของแมกมา เพื่อนำมาสร้างเป็นดวงอาทิตย์ เมื่อได้ภาพมาแล้ว ให้ลากเข้ามายังชิ้นงานของเรา ดังรูป</span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><img style="display: block; margin-left: auto; margin-right: auto;" title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090704101650/Create-a-Solar-Eclipse-in-Space-Step-6-1.jpg" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="500" height="500" /></span><br /><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;">ใช้เครื่องมือ <strong>Elliptical Marquee</strong>&nbsp;<img title="Elliptical Marquee Tool" src="http://web.ofebia.com/home/parkzz/images/20090726143137/Elliptical_Marquee_Tool.png" alt="Elliptical Marquee Tool" width="25" height="19" /> สร้างครึ่งวงกลม ที่พื้นผิวของแมกมา จะได้ดังรูป</span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><img style="display: block; margin-left: auto; margin-right: auto;" title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090704101650/Create-a-Solar-Eclipse-in-Space-Step-6-2.jpg" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="500" height="500" /></span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;">จากนั้นให้ไปที่ <strong>Select &gt; Inverse</strong> เพื่อเลือกในส่วนที่ตรงกันข้ามกับที่เลือกไว้ แล้วกดปุ่ม Delete จะได้ดังรูป</span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><img style="display: block; margin-left: auto; margin-right: auto;" title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090704101650/Create-a-Solar-Eclipse-in-Space-Step-6-3.jpg" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="500" height="500" /></span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;">กดปุ่ม Ctrl + D เพื่อยกเลิก Selection ต่อไปให้คัดลอก Layer ดวงอาทิตย์ โดยกดปุ่ม Ctrl + J เสร็จแล้วกลับไปเลือก Layer ดวงอาทิตย์ต้นฉบับ แล้วไปที่ <strong>Filter &gt; Blur &gt; Gaussian Blur</strong> ให้ตั้งค่า Radius = 14.1 pixels ดังรูป</span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><img style="display: block; margin-left: auto; margin-right: auto;" title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090704101650/Create-a-Solar-Eclipse-in-Space-Step-6-4.jpg" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="316" height="305" /></span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;">จะได้ดังรูป</span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><img style="display: block; margin-left: auto; margin-right: auto;" title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090704101650/Create-a-Solar-Eclipse-in-Space-Step-6-5.jpg" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="500" height="300" /></span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;">ต่อไปให้กำหนดค่า Layer Style โดยคลิกเลือกที่ <strong>Color Overlay</strong> แล้วตั้งค่าดังรูป</span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><img style="display: block; margin-left: auto; margin-right: auto;" title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090704101650/Create-a-Solar-Eclipse-in-Space-Step-6-6.jpg" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="594" height="416" /></span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;">จะได้ดังรูป</span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><img style="display: block; margin-left: auto; margin-right: auto;" title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090704101650/Create-a-Solar-Eclipse-in-Space-Step-6-7.jpg" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="500" height="300" /></span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;">ต่อมาให้ใช้เครื่องมือ Smudge&nbsp;<img title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090726143137/Smudge-Tool.jpg" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="25" height="19" /> ลากเป็นเส้น ๆ เพื่อสร้างเป็นลำแสงของดวงอาทิตย์ จะได้ดังรูป</span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><img style="display: block; margin-left: auto; margin-right: auto;" title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090704101650/Create-a-Solar-Eclipse-in-Space-Step-6-8.jpg" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="500" height="300" /></span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;">7. ขั้นตอนต่อไปให้กลับไปที่ Layer ของดวงอาทิตย์ที่ได้คัดลอกไว้ ให้กดปุ่ม Ctrl + คลิกที่ Thumbnail ของ Layer จะได้ Selection ขึ้นมา ดังรูป</span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><img style="display: block; margin-left: auto; margin-right: auto;" title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090704101650/Create-a-Solar-Eclipse-in-Space-Step-7-1.jpg" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="500" height="300" /></span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;">จากนั้นไปที่ <strong>Filter &gt; Distort &gt; Spherize</strong> ตั้งค่าตามรูปด้านล่าง</span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><img style="display: block; margin-left: auto; margin-right: auto;" title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090704101650/Create-a-Solar-Eclipse-in-Space-Step-7-2.jpg" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="359" height="332" /></span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;">กดปุ่ม Ctrl + D เพื่อยกเลิก Selection จะได้ดังรูป</span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><img style="display: block; margin-left: auto; margin-right: auto;" title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090704101650/Create-a-Solar-Eclipse-in-Space-Step-7-3.jpg" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="500" height="300" /></span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;">8. กำหนดค่า Layer Style เริ่มจาก <strong>Inner Shadow</strong> ตั้งค่าดังรูป</span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><img style="display: block; margin-left: auto; margin-right: auto;" title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090704101650/Create-a-Solar-Eclipse-in-Space-Step-8-1.jpg" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="594" height="416" /></span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><strong>Outer Glow</strong></span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><img title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090704101650/Create-a-Solar-Eclipse-in-Space-Step-8-2.jpg" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="594" height="416" /></span><br /><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><strong>Inner Glow</strong></span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><img style="display: block; margin-left: auto; margin-right: auto;" title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090704101650/Create-a-Solar-Eclipse-in-Space-Step-8-3.jpg" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="594" height="416" /></span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><strong>Color Overlay</strong></span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><img style="display: block; margin-left: auto; margin-right: auto;" title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090704101650/Create-a-Solar-Eclipse-in-Space-Step-8-4.jpg" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="594" height="416" /></span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;">จะได้ดังรูป</span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><img style="display: block; margin-left: auto; margin-right: auto;" title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090704101650/Create-a-Solar-Eclipse-in-Space-Step-8-5.jpg" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="500" height="300" /></span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;">9. ขั้นตอนต่อไป ให้สร้าง Layer ใหม่ ใช้เครื่องมือ <strong>Elliptical Marquee</strong>&nbsp;<img title="Elliptical Marquee Tool" src="http://web.ofebia.com/home/parkzz/images/20090726143137/Elliptical_Marquee_Tool.png" alt="Elliptical Marquee Tool" width="25" height="19" /> เพื่อสร้างรูปครึ่งวงกลมและเติมสีดำลงไปดังรูปด้านล่าง</span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><img style="display: block; margin-left: auto; margin-right: auto;" title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090704101650/Create-a-Solar-Eclipse-in-Space-Step-9-1.jpg" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="500" height="300" /></span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;">กดปุ่ม Ctrl + D เพื่อยกเลิก Selection แล้วไปที่ <strong>Filter &gt; Blur &gt; Gaussian Blur</strong> ตั้งค่า Radius = 14.1 pixels ดังรูป</span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><img style="display: block; margin-left: auto; margin-right: auto;" title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090704101650/Create-a-Solar-Eclipse-in-Space-Step-9-2.jpg" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="316" height="305" /></span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;">จะได้ </span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><img style="display: block; margin-left: auto; margin-right: auto;" title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090704101650/Create-a-Solar-Eclipse-in-Space-Step-9-3.jpg" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="500" height="300" /></span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;">10. ขั้นตอนสุดท้าย ให้สร้าง Layer ใหม่ เติมสีดำลงไป แล้วเปลี่ยน Layer Mode เป็นแบบ Screen จากนั้นไปที่ <strong>Filter &gt; Render &gt; Lens Flare</strong> กำหนดค่า Brightness = 100% ค่า Lens Type = 50-300mm Zoom และกำหนดตำแหน่ง Flare Center ดังรูป </span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><img style="display: block; margin-left: auto; margin-right: auto;" title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090704101650/Create-a-Solar-Eclipse-in-Space-Step-10-1.jpg" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="316" height="426" /></span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;">เสร็จแล้ว</span><br /><br /><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: small;"><img style="display: block; margin-left: auto; margin-right: auto;" title="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" src="http://web.ofebia.com/home/parkzz/images/20090704101650/Create-a-Solar-Eclipse-in-Space-Step-10-2.jpg" alt="สร้างสุริยุปราคาในอวกาศด้วย Photoshop" width="500" height="500" /></span><br /><br /></p>cc-by_ndhttp://web.ofebia.com/home/parkzz/images/20090704101650/Create-a-Solar-Eclipse-in-Space-Finish.jpg104ทดสอบ HTML5 Web Storage2012-01-30T22:04:39Z2012-01-30T22:04:39Zsdayuhttp://member.ofebia.com/home/sdayu/images/sdayu.jpgtag:web.ofebia.com,2012-01-30:/contents/title/ทดสอบ-HTML5-Web-Storage<p>การใช้งาน HTML 5 หากไม่ได้ทดสอบคุณสมบัติสำคัญในส่วนของการจัดเก็บข้อมูล คงจะใช้งาน HTML5 ได้ไม่เต็มที่ จาก W3School มีเอกสารเรื่อง<a title="HTML5 Web Storage" href="http://www.w3schools.com/html5/html5_webstorage.asp" target="_blank">&nbsp;HTML5 Web Storage</a>&nbsp;สอนการใช้งาน&nbsp;localStorage Object และ sessionStorage Object ให้ได้ทดลองทำตาม โดยที่&nbsp;localStorage Object นั้นเป็นการเก็บข้อมูลคล้ายกับคุกกี้ที่เรารู้จักกันดี แต่สามารถเก็บข้อมูลที่มีขนาดใหญ่กว่าคุกกี้ได้ และสามารถใช้งานค่าต่างๆ ร่วมกันจากหลายๆ แท็บได้ภายใต้เบราว์เซอร์เดียวกัน ส่วน&nbsp;sessionStorage จะสามารถเก็บข้อมูลได้จนกว่าจะปิดเบราว์เซอร์นั้นๆ และข้อมูลจะไม่สูญหายไปในขณะที่เรารีเฟรชเบราว์เซอร์&nbsp;</p> <p>การใช้งาน web storage เราสามารถใช้งานได้จากผ่านอ็อบเจกต์&nbsp;localStorage และ sessionStorage โดยที่เราสามารถกำหนดค่าลงไปในอ็อบเจกต์ทั้งสองได้ทันที แต่ข้อมูลที่เก็บไว้ในทั้งสองอ็อบเจกต์นี้เป็นสตริงเท่านั้น</p> <p>ทดลองใช้งานโดยใช้ตัวตัวอย่างจาก w3school มาปรับปรุง</p> <pre class="prettyprint lang-js">&lt;!DOCTYPE html&gt;<br />&lt;html&gt;<br />&nbsp; &nbsp; &lt;head&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;title&gt;Test Object Storing&lt;/title&gt;<br />&nbsp; &nbsp; &lt;/head&gt;<br />&nbsp; &nbsp; &lt;body&gt;<br /> &lt;script type="text/javascript"&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (sessionStorage.pagecount) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span>&nbsp; &nbsp;&nbsp;</span>sessionStorage.pagecount = Number(sessionStorage.pagecount) +1;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span> </span>}<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;else {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span>&nbsp; &nbsp;&nbsp;</span>sessionStorage.pagecount=1;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;}<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;document.write("&lt;p&gt;Refresh: "+sessionStorage.pagecount+" time(s) this session.&lt;p&gt;");<br /> <br /> if (Number(sessionStorage.pagecount) == 1) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span> </span>if(localStorage.getItem("pagehistory")) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span>&nbsp; &nbsp;&nbsp;</span>var count = 0;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;var pageHistory = JSON.parse(localStorage.getItem("pagehistory"));<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (obj in pageHistory)&nbsp;<span> <br /></span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ++count;<br /><br /><span> </span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;++count;<span> <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span>var date = new Date();<span> <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span>var data = {"count":"1", "open":date.toString(), "last":date.toString()};&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;pageHistory[count.toString()] = data;<span> <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span>localStorage.setItem("pagehistory", JSON.stringify(pageHistory));<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;sessionStorage.currentIndex = count;<span> <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>}<span> <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>else{<span> <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span>var date = new Date();<span> <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span>var data = {"1":{"count":"1", "open":date.toString(), "last":date.toString()}};<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;localStorage.setItem("pagehistory", JSON.stringify(data));<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;sessionStorage.currentIndex = 1;<span> <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>}<span> <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>}<span> <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>else {<span> <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>var date = new Date();<span> <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>var pageHistory = JSON.parse(localStorage.getItem("pagehistory"));<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pageHistory[sessionStorage.currentIndex]["count"] = sessionStorage.pagecount;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pageHistory[sessionStorage.currentIndex]["last"] = date.toString();<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;localStorage.setItem("pagehistory", JSON.stringify(pageHistory));<span> <br /></span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br /><span> </span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; document.write("&lt;p&gt;&lt;strong&gt;Page History&lt;/strong&gt;&lt;/p&gt;");<span> <br /></span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; document.write("&lt;ul&gt;");<span> <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span>var pageHistory = JSON.parse(localStorage.getItem("pagehistory"));<span> <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span>for (obj in pageHistory) {<span> <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span>index = obj.toString();<span> <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span>document.write("&lt;li&gt;Open: " + index<span> </span>+ " Refresh: &lt;span style='width:50px; display:inline-block; text-align:right;'&gt;"&nbsp;<span> <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span>+ pageHistory[index]["count"] + "&lt;/span&gt; time(s). Open: "<span> <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span>+ pageHistory[index]["open"] + " Last:" + pageHistory[index]["last"] + " &lt;/li&gt;");<span> <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>}<span> </span><br /><span> </span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; document.write("&lt;/ul&gt;");<br /><br /><span> </span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; function clear_memory() {<span> <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span>localStorage.removeItem("pagehistory");<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;sessionStorage.removeItem("pagecount");<span> <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span>location.reload(true);<span> <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>}<span> <br />&nbsp; &nbsp; &nbsp; &nbsp; </span>&lt;/script&gt;&nbsp;<br /><br /><span> </span>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&lt;p&gt;Refresh the page to see the counter increase.&lt;/p&gt;<br /><span> </span>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&lt;p&gt;Close the browser window, and try again, and what the counter.&lt;/p&gt;<span> <br /></span>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&lt;button onclick="javascript:location.reload(true);"&gt;Refresh&lt;/button&gt;<span> <br /></span>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&lt;button onclick="clear_memory()"&gt;Clear&lt;/button&gt;<span> <br /></span>&nbsp; &nbsp; &lt;/body&gt;<br />&lt;/html&gt;</pre> <p>ทดสอบเปิดดู แล้วกดรีเฟรชสักสองสามครั้งหลังจากนั้นปิดเบราว์เซอร์แล้วเปิดใหม่ดู จะเห็นว่าการนับหน้ามีการเปลี่ยนแปลงไป</p> <p>เนื่องจากออบเจ็กต์ทั้งสองเก็บข้อมูลในรูปแบบสตริง ในตัวอย่างจึงใช้งาน JSON เป็นรูปแบบในการเก็บข้อมูล โดยที่ทุกครั้งที่มีการจัดเก็บข้อมูลจะแปลงออบเจ็กต์ Javascript ให้อยู่ในรู JSON ผ่าน&nbsp;JSON.stringify และแปลงกลับมาเป็นออบเจ็กต์ Javascript ด้วย&nbsp;&nbsp;JSON.parse แล้วจึงใช้งานได้ตามปรกติ จากตัวอย่างเว็บเพจจะบันทึกข้อมูลการรีเฟรชเอาไว้ว่าทำไปกี่ครั้ง เมื่อเราปิดเบราว์เซอร์แล้วเปิดใหม่ เว็บเพจจะบันทึกข้อมูลลงไปใหม่ว่าหน้าที่เปิดใหม่นี้รีเฟรชไปแล้วกี่ครั้ง ไปเรื่อยๆ จนกว่าเราะสั่งล้างข้อมูล</p>cc-by90html5demos.com: HTML 5 Demos and Examples2012-01-09T21:55:46Z2012-01-09T21:55:46Zsdayuhttp://member.ofebia.com/home/sdayu/images/sdayu.jpgtag:web.ofebia.com,2012-01-09:/contents/title/html5demos.com-HTML-5-Demos-and-Examples<p>การพัฒนาเว็บไซต์ด้วย HTML 5 กำลังได้รับความนิยมจากนักพัฒนาเว็บไซต์ อีกทั้งมีความสามารถด้านมัลติมีเดียหลากหลายแม้กระทั้งสามารถพัฒนาเกมส์ที่สามารถทำงานอยู่บนเว็บบราวเซอร์ได้อย่างน่าอัศจรรย์ มีหลายเว็บไซท์ที่แนะนำการใช้งาน หรือนำเสนอกรอบการทำงานในแบบเฉพาะของตัวเอง แต่ในบทความนี้จะแนะนำเว็บไซท์หนึ่งชื่อว่า&nbsp;<a href="http://html5demos.com/">http://html5demos.com</a>&nbsp;</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" title="html5demos.com" src="../../home/sdayu/images/20090717173449/html5demos-com.png" alt="รูปจากเว็บไซท์ html5demos.com" width="500" /></p> <p>เว็บไซท์นี้พัฒนาโดยคุณ&nbsp;Bruce Lawson และคุณ Remy Sharp ภายใต้สัญญาอนุญาต&nbsp;<a href="http://creativecommons.org/licenses/by-sa/2.0/uk/">ครีเอทีฟคอมมอนส์&nbsp;CC BY-SA 2.0</a>&nbsp;ภายในเว็บไซท์ประกอบไปด้วยตัวอย่างการใช้งาน HTML 5 ในรูปแบบต่างๆ มากมาย อีกทั้งโค้ดที่อยู่ภายในเว็บไซต์จะเป็นการใช้งาน HTML 5 โดยไม่ผ่านไลบรารี่เพิ่มเติม ช่วยให้เราเห็นตัวอย่างการเขียนโค้ด HTML 5 แบบดั้งเดิม ง่ายต่อการเรียนรู้ของผู้เริ่มต้น นอกจากนี้ยังแบ่งโค้ดที่เขียนขึ้นให้เลือกดูได้ตามเว็บบราวเซอร์ที่ต้องการ ซึ่งมีทั้ง FireFox IE Opera Safari และ Google Chrome ตัวอย่างที่มีให้ครอบคลุมเกือบทุกคุณสมบัติของ HTML 5&nbsp;</p> <p>หากใครสนใจ HTML 5 เว็บไซต์นี้ไม่ควรพลาดครับ</p>cc-byhttp://web.ofebia.com/home/sdayu/images/20090717173449/html5demos-com.png110Free and Premium Photoshop Brushes2012-01-04T11:23:56Z2012-01-04T11:23:56Zparkzzhttp://member.ofebia.com/home/parkzz/images/parkzz.pngtag:web.ofebia.com,2012-01-04:/contents/title/free-and-premium-photoshop-brushes<p>แนะนำเว็บสำหรับโหลด Brushe สำหรับ Photoshop มีทั้งแบบฟรี และเสียเงินซื้อ ลองแวะเข้าไปชมกันได้ที่ <a title="brushlovers" href="http://www.brushlovers.com" target="_blank"><strong>brushlovers</strong></a></p> <div id="_mcePaste" class="mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow: hidden;"> <h1 class="home-h1" style="display: inline;">Brushe</h1> </div>cc-byhttp://web.ofebia.com/home/parkzz/images/20090912110401/brushlovers.jpg130วิธีทำให้รูปภาพและบทความอยู่ด้วยกันภายใต้ div เดียวกัน2012-01-03T12:56:11Z2012-01-03T12:56:11Zaclairhttp://member.ofebia.com/home/aclair/images/aclair.jpgtag:web.ofebia.com,2012-01-03:/contents/title/วิธีทำให้รูปภาพและบทความอยู่ด้วยกันภายใต้-div-เดียวกัน<p>ช่วงนี้การสร้างเว็บไซต์ด้วย CSS กำลังได้รับความนิยมมาก และเดียวนี้ก็มี CSS3 และ HTML5 ก็กำลังมาแรงในหมู่นักพัฒนาเว็บไซต์ ช่วงนี้เว็บไซต์ web.ofebia ของกลุ่มเรากำลังเปลี่ยนหน้า html ใหม่ให้เป็นโคด HTML5 ทั้งหมด และเปลี่ยนรูปร่างหน้าเว็บไซต์ใหม่คล้ายๆกับรูปแบบของบล็อก</p> <p>ซึ่งต้องการให้แสดงรูปภาพกับบทความอยู่ภายใต้ div เดียวกัน เหมือนกับรูปแบบบล็อกในเว็บไซต์สำเร็จรูปอย่างพวก CMS ต่างๆ ถ้าใครเคยใช้น่าจะรู้ว่ารูปร่างเป็นอย่างไร ช่วงนี้ก็ลืมเกี่ยวกับ CSS ไปเยอะแล้ว เลยไปรื้อความรู้มาใหม่ และก็เอามาแบ่งปันให้คนที่สนใจอยากที่จะรู้และนำไปใช้มาให้ทราบกัน ซึ่งวิธีทำก็ง่ายมากและไม่ยุ่งยากด้วย</p> <p><strong><span style="text-decoration: underline;">HTML</span></strong></p> <pre class="prettyprint lang-html"><p>&lt;div class="entry"&gt;<br />&nbsp;&nbsp;&nbsp; &lt;img src="#" alt="Test" /&gt;<br />&nbsp;&nbsp;&nbsp; &lt;p&gt;ข้อความในบทความ 1&lt;/p&gt;<br />&nbsp;&nbsp;&nbsp; &lt;p&gt;ข้อความในบทความ 2&lt;/p&gt;<br />&lt;/div&gt;</p> </pre> <p><strong><span style="text-decoration: underline;">CSS</span></strong></p> <pre class="prettyprint lang-css"><p>.entry{&nbsp;&nbsp;&nbsp; width:600px;<br />height:auto;<br />padding:0;<br />margin:0;<br />float:left;<br />display:block;<br />text-align:justify;<br />}<br /><br />.entry img{<br />width:100px;<br />height:100px;<br />padding:1px;<br />margin:0 10px 0 0;<br />float:left;<br />border:1px solid #ccc;<br />}<br /><br />.entry p{<br />padding:0;<br />margin:0 0 5px 0;<br />text-align:left;<br />display:block;<br />}</p> </pre> <p><span style="text-decoration: underline;"><strong>ผลลัพธ์ดังรูป</strong></span></p> <p><img title="วิธีทำให้รูปภาพและบทความอยู่ด้วยกันภายใต้ div เดียวกัน" src="/home/aclair/images/20090910131034/entrybox-1.jpg" alt="วิธีทำให้รูปภาพและบทความอยู่ด้วยกันภายใต้ div เดียวกัน" width="600" height="159" /></p> <p>ต่อจากนั้นถ้าอยากได้อะไรเพิ่มเติมก็สามารถเพิ่มโคดไปได้เพื่อปรับให้ได้รูปร่างตามที่ต้องการ และเหมาะสมกับหน้าเว็บไซต์ของตนเองได้</p> <p><img title="วิธีทำให้รูปภาพและบทความอยู่ด้วยกันภายใต้ div เดียวกัน" src="/home/aclair/images/20090910131034/entrybox-2.jpg" alt="วิธีทำให้รูปภาพและบทความอยู่ด้วยกันภายใต้ div เดียวกัน" width="600" height="269" /></p> <p>รู้สึกว่ากล่องบทความจะค้นๆ นะ เหมือนกับเว็บไซต์อะไรแล้ว สงสัยจะอ่านเว็บไซต์นั้นมากไป ^^</p>cc-byhttp://web.ofebia.com/home/aclair/images/20090910131034/entrybox-1.jpg157วิธีการทำให้โคด HTML5 สามารถแสดงผลบน IE ได้2011-12-22T14:34:45Z2011-12-22T14:34:45Zjakizdoohttp://member.ofebia.com/home/jakizdoo/images/jakizdoo.jpgtag:web.ofebia.com,2011-12-22:/contents/title/วิธีการทำให้โคด-HTML5-สามารถแสดงผลบน-ie-ได้<p>ถ้าใครเคยเขียนโคด <a title="HTML5 คืออะไร" href="title/html5-%E0%B8%84%E0%B8%B7%E0%B8%AD%E0%B8%AD%E0%B8%B0%E0%B9%84%E0%B8%A3" target="_blank">HTML5</a> ก็จะรู้ว่าคำสั่งบางตัว หรืออาจจะหลายๆตัวไม่สามารถใช้งานได้ หรือไม่แสดงผลเวลาเปิดกับ IE ตอนนี้เว็บไซต์ที่กลุ่มของข้าพเจ้าพัฒนาอยู่นั้นก็กำลังจะเปลี่ยนมาใช้ <a title="HTML5 คืออะไร" href="title/html5-%E0%B8%84%E0%B8%B7%E0%B8%AD%E0%B8%AD%E0%B8%B0%E0%B9%84%E0%B8%A3" target="_blank">HTML5</a> กันหมดแล้ว ถ้าเป็น Firefox กับ Chrome ก็ไม่มีปัญหาอะไรมากหรอก แต่เจ้า IE นี่สิ เป็นปัญหา เลยนำวิธีทำให้ HTML5 แสดงผลบน IE ได้มาเสนอให้กับผู้ที่สนใจ ^^</p> <p>1. ดาวน์โหลดไฟล์ <a title="hack html5 for ie" href="http://html5shim.googlecode.com/svn/trunk/html5.js" target="_blank">html5.js</a> ไปใส่ไว้ในโฟลเดอร์ที่เก็บงานเอาไว้</p> <p>2. นำเอาประโยคข้างล่างไปใส่ไว้ภายใต้ tag ของ &lt;head&gt;</p> <p>&lt;!--[if lt IE 9]&gt;<br />&lt;script src="http://html5shim.googlecode.com/svn/trunk/html5.js"&gt;&lt;/script&gt;<br />&lt;![endif]--&gt;</p> <p>3. ลองทดสอบเปิดกับ IE ดูว่าได้ผลอย่างไร และอย่าลืมกด Allow ActiveX ด้วยนะ (ตัว IE ที่ผู้เขียนใช้เปิดทดสอบคือ IE8 จ๊ะ)</p> <p><span style="text-decoration: underline;"><strong>ภาพก่อนใช้โคดทำให้ html5 สามารถแสดงผลได้บน IE</strong></span></p> <p><img title="เว็บไซต์ wowflight Thailand ก่อนใช้ hack html5 " src="../../home/jakizdoo/images/20100801111224/wowflightthailand-before-hack-html5.jpg" alt="เว็บไซต์ wowflight Thailand ก่อนใช้ hack html5 " width="600" height="334" /></p> <p><strong><span style="text-decoration: underline;">ภาพหลังใช้โคดทำให้ html5 สามารถแสดงผลได้บน IE</span></strong></p> <p><img title="เว็บไซต์ wowflight Thailand หลังใช้ hack html5 " src="../../home/jakizdoo/images/20100801111224/wowflightthailand-hack-html5.jpg" alt="เว็บไซต์ wowflight Thailand หลังใช้ hack html5 " width="600" height="327" /></p>cc-by230สร้างเครื่องคอมพิวเตอร์เสมือนด้วย KVM2011-12-19T13:41:29Z2011-12-19T13:41:29Zsdayuhttp://member.ofebia.com/home/sdayu/images/sdayu.jpgtag:web.ofebia.com,2011-12-19:/contents/title/สร้างเครื่องคอมพิวเตอร์เสมือนด้วย-KVM<p>กระแสคลาวด์คอมพิวติง (Cloud Computing) กำลังมาแรงในช่วงนี้วันนี้เนื่องจากเป็นเทคโนโลยีที่นำมาประยุกต์ใช้กับอุปกรณ์เครื่องที่อย่างสมาร์ทโฟนกันมาก เทคโนโลยีหนึ่งที่ถือได้ว่าเป็นเทคโนโลยีที่ผลักดันคลาวด์คอมพิวติงให้เป็นรูปเป็นร่างได้นั้นก็คือเทคนิคเครื่องคอมพิวเตอร์เสมือน (virtual machine) นั้นเอง สำหรับในบทความนี้จึงอยากเสนอวิธีการสร้างเครื่องเสมือนด้วย <a href="http://www.linux-kvm.org/">KVM</a>&nbsp; (Kernel-based Virtual Machine) ให้รู้จักกัน</p> <p>หากท่านทั้งหลายรู้จัก <a href="https://www.virtualbox.org/">VirtualBox</a> หรือ <a href="http://www.vmware.com/">VMware</a>&nbsp;แล้ว ก็บอกได้เลยว่า KVM ก็เป็นซอฟท์แวร์ตระกูลนั้นเหมือนกัน เรามาทดลองสร้างอิมเมจสำหรับ KVM กันเลยดีกว่า อย่างแรกเลยคือติดตั้งเพกเกจ kvm และดาวน์โหลดอิมเมจสำหรับติดตั้งระบบปฎิบัตการมาเก็บไว้ก่อน (ในตัวอย่างจะเป็นกาารติดตั้งระบบปฏิบัติการ linux โดยใช้ debian)</p> <pre class="prettyprint lang-sh">$ sudo aptitude install kvm</pre> <p>เริ่มการติดตั้งกันเลย ในขั้นแรกต้องสร้างอิมเมจขึ้นมาก่อน</p> <pre class="prettyprint lang-sh">$ kvm-img create -f raw <strong>debian-test.img <span style="color: #ff0000;">5G</span></strong><br />W: /usr/bin/kvm-img: this binary is deprecated, use qemu-img instead<br />Formatting 'debian-test.img', fmt=raw size=5368709120&nbsp;</pre> <p>debian-test.img เป็นชื่ออิมเมจที่ต้องการ 5G จะเป็นขนาดอิมเมจที่ต้องการ(ขนาดอาร์ดดิสก์) หลังจากนั้นเริมการติดตั้งด้วยคำสั่ง</p> <pre class="prettyprint lang-sh">$ kvm -m 512 -cdrom debian-testing-amd64-businesscard.iso \<br />-drive file=debian-test.img,if=scsi,index=0 -boot once=d -net nic -net user<br /></pre> <p>จากคำสั่งด้านบนเป็นการสร้างเครื่องสมือนขึ้นมาโดยให้มีขนาดหน่วยความจำเป็น 512 (-m 512) cdrom เปิดที่ไฟล์ (-cdrom&nbsp;debian-testing-amd64-businesscard.iso) ฮาร์ดิสก์คือ debian-test.img ซึ่งเป็นอิมเมจที่เราสร้างไว้ก่อนหน้านี้ ซึ่งก็มีออฟชันต่างๆ ดังแสดง&nbsp;่สนการ boot .sh boot จาก cd (-boot&nbsp;once=d ตัวอักษร d หมายถึง cdrom ตังอักษร c หมายถึงฮาร์ดดิสก์ลูกแรก นอกจากนี้ยังสามารถ boot ผ่านเน็ทเวิร์กได้เช่นกัน) ส่วนเน็ทเวิร์กก็ใช้แบบ nic หรือ networ interface card ใน user mode เมื่อรันคำสั่งได้จะปรากฎหน้าต่างให้เราได้ติดตั้งเหมือนการติดตั้งปรกติ</p> <p><img title="KVM debian installation" src="../../home/sdayu/images/20090717173449/kvm-install-debian.png" alt="" width="500" /></p> <p>เราก็สรามารถติดตั้งระบบปฏิบัติการได้ตามปรกติ หากเราคลิกที่หน้าต่างแล้วเมาส์หายไป ไม่ต้องตกใจ เนื่องจากเมาส์ของเราได้ถูก หน้าต่างติดตั้งยึดเอาไปแล้ว เราสามารถเอาเมส์กลับมาได้โดยกดปุ่ม Ctrl + Alt ที่หน้าต่างติดตั้ง เมาส์ก็จะกลับคืนมาเอง เมื่อติดตั้งเสร็จแล้วก็ทดลองใช้งานดูโดยใช้คำสั่ง</p> <pre class="prettyprint lang-sh">$ kvm -m 512 debian-test.img -boot once=d -net nic -net user</pre> <p>หากติดตั้งไม่ผิดพลาด เราก็จะได้เครื่องเสมือนที่พร้อมใช้งานได้ทันที หากต้องการติดตั้งโปรแกรมเพิ่มเติมหรือปรับแต่งค่าอะไรเพิ่มเติมก็สามารถทำงานได้ตามปรกติ</p>cc-byhttp://web.ofebia.com/home/sdayu/images/20090704203656/kvmbanner-logo.png138WowFlightThailand2011-12-02T11:34:31Z2011-12-02T11:34:31Zjakizdoohttp://member.ofebia.com/home/jakizdoo/images/jakizdoo.jpgtag:web.ofebia.com,2011-12-02:/contents/view/306.htmเว็บไซต์ใช้สำหรับค้นหา และเปรียบเทียบราคาตั๋วเครื่องบินภายในประเทศไทยpublic156วาดวงกลมแบบสุ่มอัตโนมัติบน HTML52011-10-31T20:54:15Z2011-10-31T20:54:15Zsdayuhttp://member.ofebia.com/home/sdayu/images/sdayu.jpgtag:web.ofebia.com,2011-10-31:/contents/title/วาดวงกลมแบบสุ่มอัตโนมัติบน-HTML5<p>หลังจากเรียนรู้การใช้งาน canvas เบื้องต้นกันไปแล้วใน&nbsp;<a href="title/%E0%B8%A3%E0%B8%B9%E0%B9%89%E0%B8%88%E0%B8%B1%E0%B8%81-Canvas-%E0%B8%A0%E0%B8%B2%E0%B8%9E%E0%B8%81%E0%B8%A3%E0%B8%B2%E0%B8%9F%E0%B8%9F%E0%B8%B4%E0%B8%81%E0%B8%89%E0%B8%9A%E0%B8%B1%E0%B8%9A-HTML5">รู้จัก Canvas ภาพกราฟฟิกฉบับ HTML5</a>&nbsp;และมีตัวอย่างเล็กๆ น้อย โดยการวาดวงกลมแบบสุ่มแต่ต้องกดปุ่มอยู่ สำรับบทความนี้จึงเสนอการวาดวงกลมแบบสุ่มโดยอัตโนมัติกันบ้าง ตัวอย่างของโคดมีดังด้านล่าง</p> <pre class="prettyprint lang-html">&lt;!DOCTYPE html&gt;<br />&lt;html&gt;<br />&lt;body onload="init()"&gt;<br />&nbsp; &nbsp; &lt;canvas id="myCanvas" width="300" height="300" style="border:1px solid #c3c3c3;"&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; Your browser does not support the canvas element.&nbsp; &nbsp; <br /> &lt;/canvas&gt;<br />&nbsp; &nbsp;&nbsp;&lt;script type="text/javascript"&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; var cxt;<br />&nbsp; &nbsp; &nbsp; &nbsp; var animate;<br />&nbsp; &nbsp; &nbsp; &nbsp; <br /> function drawCircle(){<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cxt.fillStyle="#FF0000";<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var x = Math.floor(Math.random()*1000) % 300;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var y = Math.floor(Math.random()*1000) % 300;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var r = 0;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while(r &lt; 3){<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; r = Math.floor(Math.random()*11) % 15;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cxt.beginPath();<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cxt.arc(x,y,r,0,Math.PI*2,true);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cxt.closePath();<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cxt.fill();<br />&nbsp; &nbsp; &nbsp; &nbsp;}<br />&nbsp; &nbsp; &nbsp; &nbsp;<br /> function stop() {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; clearInterval(animate);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var b = document.getElementById("action_button");<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b.value = "start";<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b.innerText = "Start";<br />&nbsp; &nbsp; &nbsp; &nbsp;}<br />&nbsp; &nbsp; &nbsp; &nbsp;<br /> function reset() {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stop();<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;var c = document.getElementById("myCanvas");<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cxt = c.getContext("2d");<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cxt.clearRect(0, 0, 300, 300);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; start();<br />&nbsp; &nbsp; &nbsp; &nbsp;}<br />&nbsp; &nbsp; &nbsp; &nbsp;<br /> function start() {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; animate = setInterval(drawCircle, 200);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var b = document.getElementById("action_button");<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b.value = "stop";<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b.innerText = "Stop";<br />&nbsp; &nbsp; &nbsp; &nbsp;}<br /><br />&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;function action_handler(){<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var b = document.getElementById("action_button");<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (b.value == "start")<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; start();<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stop();<br />&nbsp; &nbsp; &nbsp; &nbsp;}<br />&nbsp; &nbsp; &nbsp; &nbsp;<br /> function init() {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var c = document.getElementById("myCanvas");<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cxt = c.getContext("2d");<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; start();<br />&nbsp; &nbsp; &nbsp; &nbsp;}<br />&nbsp; &nbsp; <br /> &lt;/script&gt;<br />&nbsp; &nbsp; &lt;br /&gt;<br />&nbsp; &nbsp; &lt;button type="button" id="action_button" value="stop" onclick="action_handler()" /&gt;<br />&nbsp; &nbsp; &lt;button type="button" id="reset" name="Reset" onclick="reset()"&gt;Reset&lt;/button&gt;<br />&lt;/body&gt;<br />&lt;/html&gt;<br /></pre> <p>จากโคดด้านบนเราก็จะได้ผลลัพธ์ดั่งรูปด้านล่าง คือ เมื่อเปิดหน้าเว็บขึ้นมา จะมีการสุ่มวาดวงกลมขึ้นมาโดยอัตโนมัติ เมื่อเรากดปุ่ม Stop หน้าเว็บจะหยุดวาดวงกลม และปุ่ม Stop จะถูกเปลี่ยนเป็นปุ่ม Start หากเรากดปุ่ม Start หน้าเว็บจะสุ่มวาดวงกลมต่อ หากเรากดปุ่ม Reset แทน หน้าเว็บจะล้างภาพใหม่ทั้งหมดจากนั้นจะเริ่มวาดวงกลมแบบสุ่มใหม่ ดังรูป</p> <p><img src="../../home/sdayu/images/20090717173449/random_circle.png" alt="" width="315" height="338" /></p> <p>สิ่งที่ทำให้เกิดการเคลื่อนไหวในการวาดภาพไม่ได้มีสิ่งอื่นไดเลยนองจากฟังก์ชัน setInterval ที่ถูกเรียกใช้ในฟังก์ชัน start() นั้นเองซึ่งฟังก์ชันนี้ก็มีอยู่เดิมแล้วใน&nbsp;่JavaScript ปรกติ ซึ่งฟังก์ชันนี้จะเรียกฟังก์ชัน drawCircle ทุกๆ 200 ms นั้นเอง</p>cc-byhttp://web.ofebia.com/home/sdayu/images/20090717173449/random_circle.png240รู้จัก Canvas ภาพกราฟฟิกฉบับ HTML52011-10-08T20:28:03Z2011-10-08T20:28:03Zsdayuhttp://member.ofebia.com/home/sdayu/images/sdayu.jpgtag:web.ofebia.com,2011-10-08:/contents/title/รู้จัก-Canvas-ภาพกราฟฟิกฉบับ-HTML5<p><a href="http://en.wikipedia.org/wiki/Canvas_element">Canvas element</a>&nbsp;เป็นอีลีเมนท์หนึ่งของ HTML5 เราสามารถใช้ JavaScript เพื่อวาดรูปลงไปในเว็บเพจได้ canvas ทำให้เราสามารถสร้าง application ที่สามารถใช้งานแทน Flash กันได้เลยทีเดียว มีคนใช้ canvas ในการสร้างเกมส์ด้วย</p> <p>การเรียนรู้การใช้งาน canvas นั้นไม่ยากสามารถศึกษาได้จาก&nbsp;<a href="http://www.w3schools.com/html5/html5_canvas.asp">HTML5 Canvas</a>&nbsp;แต่การจะวาดรูปให้สวยงามนั้นเราต้องรู้จักฟังก์ชันของ JavaScript ด้วย มีเว็บไซต์ที่สอนการใช้งาน canvas อยู่เว็บไซต์หนีงที่คิดว่าน่าจะมีประโยชน์นั้นคือ&nbsp;<a href="http://www.html5canvastutorials.com/">http://www.html5canvastutorials.com</a>&nbsp;ได้รวบรวม กรณีศึกษาเกี่ยวกับ canvas ไว้มากมายทดลองใช้งานดูนะครับ&nbsp;</p> <p>สำหรับวันนี้ขอแนะนำวิธีทำง่ายๆ สักหนึ่งวิธีนะครับ จาก <a href="http://www.w3schools.com/html5/tryit.asp?filename=tryhtml5_canvas_circle">Example - Circle</a>&nbsp;</p> <p>โคดตัวอย่างคือ</p> <pre class="prettyprint lang-html">&lt;!DOCTYPE html&gt;<br />&lt;html&gt;<br />&lt;body&gt;<br />&lt;canvas id="myCanvas" width="200" height="100" <br /> style="border:1px solid #c3c3c3;"&gt;<br />&nbsp; &nbsp; Your browser does not support the canvas element.<br />&lt;/canvas&gt;<br />&lt;script type="text/javascript"&gt;<br />&nbsp; &nbsp; var c=document.getElementById("myCanvas");<br />&nbsp; &nbsp; var cxt=c.getContext("2d");<br />&nbsp; &nbsp; cxt.fillStyle="#FF0000";<br />&nbsp; &nbsp; cxt.beginPath();<br />&nbsp; &nbsp; cxt.arc(70,18,15,0,Math.PI*2,true);<br />&nbsp; &nbsp; cxt.closePath();<br />&nbsp; &nbsp; cxt.fill();<br />&lt;/script&gt;<br />&lt;/body&gt;<br />&lt;/html&gt;</pre> <p>จะได้รูปตัวอย่างดังนี้</p> <p><img src="../../home/sdayu/images/20090717173449/html5-circle-example.png" alt="" width="212" height="114" /></p> <p>ทดลองใส่ความคิดสร้างสรรค์ลงไปเล็กน้อย</p> <pre class="prettyprint lang-html">&lt;!DOCTYPE html&gt;<br />&lt;html&gt;<br />&lt;body onload="drawCircle()"&gt;<br />&nbsp; &nbsp; &lt;canvas id="myCanvas" width="300" height="300"&nbsp;<br /> style="border:1px solid #c3c3c3;"&gt;<br /> &nbsp; &nbsp; &nbsp; Your browser does not support the canvas element.<br /> &lt;/canvas&gt;<br /> <br /> &lt;script type="text/javascript"&gt;<br /> function drawCircle(){<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var c=document.getElementById("myCanvas");<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var cxt=c.getContext("2d");<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cxt.fillStyle="#FF0000";<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var x = Math.floor(Math.random()*1000) % 300;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var y = Math.floor(Math.random()*1000) % 300;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var r = 0;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while(r &lt; 3){<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; r = Math.floor(Math.random()*11) % 15;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cxt.beginPath();<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cxt.arc(x,y,r,0,Math.PI*2,true);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cxt.closePath();<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cxt.fill();<br />&nbsp; &nbsp; &nbsp; &nbsp;}<br />&nbsp; &nbsp; &lt;/script&gt;<br />&nbsp; &nbsp; &lt;br /&gt;<br />&nbsp; &nbsp; &lt;button type="button" onclick="drawCircle()"&gt;Draw Circle&lt;/button&gt;<br />&lt;/body&gt;<br />&lt;/html&gt;</pre> <p>เราก็จะได้รูปดังข้างล่าง</p> <p><img src="../../home/sdayu/images/20090717173449/html5-example-circle-random-1.png" alt="" width="319" height="346" /></p> <p>คลิกปุ่ม Draw Circle สัก 5 ครั้ง</p> <p><img src="../../home/sdayu/images/20090717173449/html5-example-circle-random-2.png" alt="" width="316" height="342" /></p> <p>กดสัก 20 ครั้ง</p> <p><img src="../../home/sdayu/images/20090717173449/html5-example-circle-random-3.png" alt="" width="320" height="342" /></p> <p>นี่เป็นตัวอย่างเล็กๆ น้อย หากอยากดูอะไรเพิ่มเติมฉบับภาษาไทยสามารถดูได้ที่&nbsp;<a href="http://www.html5.in.th/">http://www.html5.in.th</a></p>cc-byhttp://web.ofebia.com/home/sdayu/images/20090717173449/html5-example-circle-random-3.png418Html5CanvasTutorials2011-10-08T20:06:24Z2011-10-08T20:06:24Zsdayuhttp://member.ofebia.com/home/sdayu/images/sdayu.jpgtag:web.ofebia.com,2011-10-08:/contents/view/303.htmเว็บไซต์สอนการใช้งาน canvaspublic182กลุ่มผู้ใช้งาน MongoDB ในสยามประเทศ 2011-10-08T18:02:32Z2011-10-08T18:02:32Zsdayuhttp://member.ofebia.com/home/sdayu/images/sdayu.jpgtag:web.ofebia.com,2011-10-08:/contents/view/302.htmชุมชนผู้ใช้งาน MongoDB ในสยามประเทศ พึ่งเริ่มก่อตั้งได้ไม่นานแต่น่าจะมีประโยชน์สำหรับผู้ใช้งานนะครับpublic191สัญญาอนุญาตสำหรับการเผยแพร่2011-10-08T17:23:13Z2011-10-08T17:23:13Zsdayuhttp://member.ofebia.com/home/sdayu/images/sdayu.jpgtag:web.ofebia.com,2011-10-08:/contents/title/license<p>ทีมงาน Ofebia สนับสนุนให้มีการเผยแพร่ข้อมูลตาม<a href="http://creativecommons.org/licenses/by/3.0/th/">สัญญาอนุญาตครีเอทีฟคอมมอนส์</a>&nbsp;ทั้งนี้แต่ละบทความเจ้าของจะเป็นผู้กำหนด ซึ่งอาจจะแตกต่างกันไปตามวัตถุประสงค์ของแต่ละบทความ กรุณาใช้งานให้ถูกต้องตามวัตถุประสงค์ของแต่ละบทความเพื่อแสดงความเคารพและให้เกียรติเจ้าของบทความด้วย</p>cc-by177เรื่องราวของ Web.Ofebia2011-10-08T16:56:48Z2011-10-08T16:56:48Zsdayuhttp://member.ofebia.com/home/sdayu/images/sdayu.jpgtag:web.ofebia.com,2011-10-08:/contents/title/history<p><strong>ประวัติและที่มา</strong></p> <p><a href="../">Web.Ofebia</a>&nbsp;เป็นหนึ่งในเครือเว็บไซต์&nbsp;<a href="http://www.ofebia.com/">Ofebia.com</a>&nbsp;เป็นแหล่งรวบรวมข้อมูลเกี่ยวกับการทำเว็บไซต์ เกิดขึ้นเนื่องจากสมาชิกต้องการมีเว็บไซต์ที่รวบรวมข้อมูลต่างๆ ในการพัฒนาเว็บไซต์ที่เกิดจากประสบการณ์ของตัวผู้เขียนเอง โดยมีทีมงานดังนี้ <a title="sdayu blog" href="../../blog/sdayu">sdayu</a>&nbsp;<a title="jakizdoo" href="../../blog/jakizdoo">jakizdoo</a>&nbsp;<a title="parkzz blog" href="../../blog/parkzz">parkzz</a>&nbsp;<a title="tanit blog" href="../../blog/tanit">tanit</a>&nbsp;และ <a title="jirarak blog" href="../../blog/jirarak">jirarak</a>&nbsp;</p> <p>ใหนๆ ก็อยากมีเว็บไซต์แล้วจึงอยากจะพัฒนาเว็บไซตืขึ้นเองแทนการใช้งาน CMS โดยที่ครั้งแรกที่พัฒนาโดยใช้ JAVA เปลี่ยนเป็น PHP แล้วเปลี่ยนมาเป็น Python ตามลำดับ ผู้พัฒนาแบ่งงานออกเป็น sdayu tanit และ jirarak เป็นคนเขียนโปรแกรม parkzz ออกแบบ jakizdoo สร้าง CSS และ layout</p> <p><strong>ลำดับเวลา</strong></p> <ul> <li>2551 <ul> <li>18 พ.ย. 2551 - จดโดเมน</li> </ul> </li> <li>2552 <ul> <li>1 ม.ค. 2552 - ออนไลน์เว็บไซต์ครั้งแรก โดยใช้บริการเว็บโฮสติงของ&nbsp;&nbsp;JaideeHosting.com โดยพัฒนาเว็บไซต์โดยใช้ spring และ&nbsp;้hibernate และฐานข้อมูล Mysql ออกแบบกราฟฟิกเว็บไซต์โดย parkzz และพัฒนาโครงสร้างหน้าเว็บด้วย CSS โดย jakizdoo ใช้ชื่อว่า Alpha H 0.1</li> <li>20 มี.ค. 2552 - เปลี่ยนการพัฒนาจาก JAVA มาเป็น PHP โดยใช้ Codeigniter เนื่องจาก หาโฮสติงที่ให้บริการ JAVA ลำบากและมีราคาแพง โดยมี tanit เป็นผู้พัฒนาหลัก</li> <li>18 พ.ค. 2552 แยกส่วนการจัดการสมาชิกไปไว้ที่ Member.Ofebia เนื่องจากต้องการให้สมาชิกสามารถใช้งานเว็บไซต์ในเครือได้ง่ายโดยไม่ต้องสมัครสมาชิกใหม่หลายครั้งโดยใช้เว็บเซอร์วิส</li> <li>4 ต.ค. 2552 - เปลี่ยนมาใช้บริการเว็บโฮสติง clnox.com</li> </ul> </li> <li>2553 <ul> <li>24 &nbsp;พฤศจิกายน 2553 - เปลี่ยนการพัฒนาเว็บไซต์ด้วยภาษา PHP มาเป็น Python ด้วย Pylons Framework โดยใช้ชื่อโปรเจ็กว่า Makalee และเปลี่ยนโฮสติงมาใช้งาน VPS ของ webbynode.com โดย sdayu</li> </ul> </li> <li>2554 <ul> <li>26 เมษายน 2554&nbsp;เปลี่ยนการใช้งาน VPS เป็นบริการของ virpus.com</li> <li>5 มิถุนายน 2554 - เปลี่ยนการพัฒนาจาก&nbsp;Pylons Framework มาเป็น Pyramid&nbsp;Framework เนื่องจากทีมงาน&nbsp;Pylons Framework ประกาศพัฒนา&nbsp;Pyramid&nbsp;Framework แทน</li> <li>26&nbsp;มิถุนายน 2554 - เปลี่ยนฐานข้อมูลจาก Mysql มาเป็น PostgreSQL</li> </ul> </li> </ul>cc-by190ติดต่อเรา2011-10-08T16:11:35Z2011-10-08T16:11:35Zsdayuhttp://member.ofebia.com/home/sdayu/images/sdayu.jpgtag:web.ofebia.com,2011-10-08:/contents/title/contact<p>หากท่านมีปัญหาในการใช้งาน หรือมีข้อเสนอแนะอันเป็นประโยชน์ต่อการพัฒนาเว็บท่านสามารถติดต่อได้ที่ web.ofebia@gmail.com</p>cc-by216เกี่ยวกับ Web.Ofebia2011-10-08T13:52:58Z2011-10-08T13:52:58Zsdayuhttp://member.ofebia.com/home/sdayu/images/sdayu.jpgtag:web.ofebia.com,2011-10-08:/contents/title/about<p><a href="../../">Web.Ofebia</a> เป็นหนึ่งในเครือเว็บไซต์ <a href="http://www.ofebia.com/">Ofebia.com</a> เป็นแหล่งรวบรวมข้อมูลเกี่ยวกับการทำเว็บไซต์ มีทั้ง การแสดงวิธีทำ บทความความรู้ รวบรวมเว็บไซต์ที่มีประโยชน์สำหรับการทำเว็บไซต์ โดยแบ่งออกเป็นสี่เรื่องหลักคือ</p> <ul> <li><a title="Graphic Tutorial" href="list/Tutorial/Graphic.htm">Graphic design</a></li> <li><a title="WebDesign Tutorial" href="list/Tutorial/WebDesign.htm">Web design และ Web user interface</a></li> <li><a title="Programming Tutorial" href="list/Tutorial/Programming.htm">Web programing</a></li> <li><a title="Server and ์Network Tutorial" href="list/Tutorial/server-network.htm">Server และ Networking</a></li> </ul> <p><a href="../../">Web.Ofebia</a> แบ่งบทความต่างๆ ออกเป็นสามระดับคือ พื้นฐาน ระดับกลาง และขั้นสูง เพื่อให้เหมาะสมกับผู้อ่านในระดับต่างๆ&nbsp;</p>cc-by216การจัดเรียงลำดับข้อมูลภาษาไทยบนฐานข้อมูล PostgreSQL2011-10-01T23:50:52Z2011-10-01T23:50:52Zsdayuhttp://member.ofebia.com/home/sdayu/images/sdayu.jpgtag:web.ofebia.com,2011-10-01:/contents/title/การจัดเรียงลำดับข้อมูลภาษาไทยบนฐานข้อมูล-PostgreSQL<p>หลังจากเริ่มใช้งานฐานข้อมูล PostgreSQL การใช้งานฐานข้อมูลที่ใช้กันบ่อยๆ คือการจัดเรียงข้อมูล (sorting) แต่ปัญหาหนึ่งที่เจอคือ การจะจัดเรียงข้อมูลบนฐานข้อมูล PostgreSQL ได้นั้น ในขั้นตอนที่เริ่มสร้างฐานข้อมูลจะต้องระบุ Encoding Collation และ Character Type ให้ถูกต้องกับภาษาที่จะจัดเรียงด้วย ในที่นี่เราต้องการจัดเรียงภาษาไทยในชุดของ UTF-8 ดังนั้น Encoding ที่ต้องการคือ th_TH.UTF-8 แต่หากเป็นเซิร์ฟเวอร์โดยปรกติแล้วจะไม่มีการปรับแต่ง locales นี้ไว้ จึงไม่สามารถสร้างฐานข้อมูลที่พารามิเตอร์ดังกล่าวได้ แต่ก่อนที่เราจะเริ่มสร้างฐานข้อมูลได้เราต้องปรับแต่ง locales ก่อนโดยวิธีการปรับแต่งบน Debian มีดังนี้</p> <pre># dpkg-reconfigure locales</pre> <p>โปรแกรมจะเริ่มเข้าสู้หน้าต่างปรับดังรูปด้านล่าง</p> <p><img title="locale configuration 1" src="../../home/sdayu/images/20090717173449/locales-1.png" alt="locale configuration 1" width="500" height="330" /></p> <p>หากต้องการติดตั้งภาษาไทยตามรหัสของ UTF-8 ก็สามารถเลือก th_TH.UTF-8 หรือหากต้องการ Encoding แบบเดิมของภาษาไทยก็ให้เลือก th_TH หรือ TIS-620 นั้นเอง เราสามารถเลือก Encoding ได้โดยเลือนเคอร์เซอร์ไปยังบรรทัดที่ต้องการแล้วกดปุ่ม Space จะปรากฏเครื่องหมาย '*' แสดงว่าได้เลือกเรียบร้อยแล้ว หากไม่ต้องการก็ให้กดปุ่ม Space อีกครั้งเครื่องหมาย '*' ก็จะหายไป ตอบตกลงโดยกดปุ่ม แท็บ ให้เคอร์เซอร์เลื่อนไปยังปุ่ม &lt;Ok&gt; แล้วกดปุ่ม Enter เพื่อไปยังขั้นตอนต่อไป</p> <p><img title="locale configuration 2" src="../../home/sdayu/images/20090717173449/locales-2.png" alt="locale configuration 2" width="500" height="330" /></p> <p>โปรแกรมจะถามว่าจะเลือกภาษาใดเป็นภาษาปริยาย สามารถเลือกได้ตามต้องการ จากนั้นโปรแกรมจะเริ่มปรับแต่งค่า</p> <pre>Generating locales (this might take a while)...&nbsp; <br />&nbsp; en_US.UTF-8... done&nbsp; <br />&nbsp; th_TH.TIS-620... done<br />&nbsp; th_TH.UTF-8... done<br />Generation complete.</pre> <p>เป็นอันเสร็จเรียบร้อย จากนั้นเริ่มสร้างฐานข้อมูลจะแสดงให้ดูบน phpPgAdmin</p> <p><img title="locales configuration 3" src="../../home/sdayu/images/20090717173449/locales-3.png" alt="locales configuration 3" width="500" height="305" /></p> <p>เพียงเท่านี้เราก็สามารถจัดเรียงข้อมูลภาษาไทยได้แล้ว</p>cc-by226ตรวจสอบพื้นที่บนฮาร์ดดิสก์ด้ว du และ df2011-07-31T11:49:54Z2011-07-31T11:49:54Zsdayuhttp://member.ofebia.com/home/sdayu/images/sdayu.jpgtag:web.ofebia.com,2011-07-31:/contents/title/ตรวจสอบพื้นที่บนฮาร์ดดิสก์ด้ว-du-และ-df<p>การบริหารพื้นที่เก็บข้อมูลบนฮาร์ดดิสก์ หากเราใช้ GUI tool ทั่วไปอาจจะกระทำได้ง่ายเพียงแค่คลิก สำหรับเครื่องเซิร์ฟเวอร์แล้วการติดตั้งสภาพแวดล้อมแบบ GUI นั้นไม่เป็นที่นิยมนัก อีกทั้งยังสิ้นเปลืองทรัพยากรโดยไม่จำเป็น สำหรับบทความนี้จะแนะนำคำสั่งสำหรับการตรวจสอบพื้นที่บนฮาร์ดดิสก์สองคำสั่งด้วยกันคือ du และ df โดยที่ทั้งสองคำสั่งมีนิยามดังต่อไปนี้</p> <ul> <li>du - estimate file space usage</li> <li>df - report file system disk space usage</li> </ul> <p>สรุปง่ายๆ ว่า df ไว้ดูพื้นที่ว่าง du ไว้ดูว่าแต่ละไฟล์ใช้ข้อมูลไปเท่าไหร่ ทั้งสองมีออฟชันหลายออฟชันด้วยกันแต่ที่อยากแนะนำคือ h หรือ&nbsp;human-readable นั้นคือแสดงผลให้มนุษย์อ่านได้ง่าย ดังเช่น&nbsp;1K 234M 2G เป็นต้น</p> <p>ทดลองให้งาน df</p> <pre>$ df -hFilesystem &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Size &nbsp;Used Avail Use% Mounted on<br />/dev/sda1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;21G &nbsp;5.7G &nbsp; 14G &nbsp;30% /<br />tmpfs &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5.0M &nbsp; &nbsp; 0 &nbsp;5.0M &nbsp; 0% /lib/init/rw<br />tmpfs &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 397M &nbsp;664K &nbsp;396M &nbsp; 1% /run<br />udev &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2.0G &nbsp; &nbsp; 0 &nbsp;2.0G &nbsp; 0% /dev<br />tmpfs &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 794M &nbsp;1.5M &nbsp;792M &nbsp; 1% /run/shm<br />/dev/sda2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 266G &nbsp;198G &nbsp; 55G &nbsp;79% /home<br /></pre> <p>โปรแกรมจะบอกว่าฮาร์ดดิสก์ในแต่ละส่วนใช้ไปเท่าไหร่เหลือให้ใช้งานอีกเท่าไหร่ ส่วนต่อมาคือ du จะบอกว่าในไดเรกทอรีปัจจุบันและลึกลงไปแต่ละไดเร็กทอรีมีไฟล์รวมขนาดเท่าไหร่เช่น</p> <pre>$ du -h<br />36K<span> </span>./Makalee.egg-info<br />48K<span> </span>./makalee/templates/welcome<br />20K<span> </span>./makalee/templates/showcase<br />32K<span> </span>./makalee/templates/image_album<br />84K<span> </span>./makalee/templates/content<br />40K<span> </span>./makalee/templates/bookmark<br />32K<span> </span>./makalee/templates/base<br />12K<span> </span>./makalee/templates/account<br />20K<span> </span>./makalee/templates/tag<br />292K<span> </span>./makalee/templates<br />76K<span> </span>./makalee/view<br />36K<span> </span>./makalee/model/form<br />60K<span> </span>./makalee/model<br />12K<span> </span>./makalee/lib/auth/ofebia<br />24K<span> </span>./makalee/lib/auth<br />24K<span> </span>./makalee/lib/ofebia<br />56K<span> </span>./makalee/lib<br />504K<span> </span>./makalee<br />572K<span> </span>.<br /></pre> <p>นอกจากนี้เรายังสามารถระบุได้ว่าต้องการให้แสดงลึกลงไปกี่ลำดับชั้นเช่น</p> <pre>$ du -h --max-depth=2<br />36K<span> </span>./Makalee.egg-info<br />292K<span> </span>./makalee/templates<br />76K<span> </span>./makalee/view<br />60K<span> </span>./makalee/model<br />56K<span> </span>./makalee/lib<br />504K<span> </span>./makalee<br />572K<span> </span>.<br /></pre> <p>หรือต้องการแค่ดูขนาดอย่างเดียวก็สามารถทำได้</p> <pre>$ du -hs<br />572K<span> </span>.<br /></pre> <p>เวลาที่มีการแก้ไขครั้งสุดท้าย</p> <pre>$ du --time<br />36<span> </span>2011-07-02 07:38<span> </span>./Makalee.egg-info<br />48<span> </span>2011-07-02 07:38<span> </span>./makalee/templates/welcome<br />20<span> </span>2011-07-02 07:38<span> </span>./makalee/templates/showcase<br />32<span> </span>2011-07-02 07:38<span> </span>./makalee/templates/image_album<br />84<span> </span>2011-07-02 07:38<span> </span>./makalee/templates/content<br />40<span> </span>2011-07-02 07:38<span> </span>./makalee/templates/bookmark<br />32<span> </span>2011-07-02 07:38<span> </span>./makalee/templates/base<br />12<span> </span>2011-07-02 07:38<span> </span>./makalee/templates/account<br />20<span> </span>2011-07-02 07:38<span> </span>./makalee/templates/tag<br />292<span> </span>2011-07-02 07:38<span> </span>./makalee/templates<br />76<span> </span>2011-07-31 04:44<span> </span>./makalee/view<br />36<span> </span>2011-07-02 07:38<span> </span>./makalee/model/form<br />60<span> </span>2011-07-02 07:38<span> </span>./makalee/model<br />12<span> </span>2011-07-02 07:38<span> </span>./makalee/lib/auth/ofebia<br />24<span> </span>2011-07-02 07:38<span> </span>./makalee/lib/auth<br />24<span> </span>2011-07-02 07:38<span> </span>./makalee/lib/ofebia<br />56<span> </span>2011-07-02 07:38<span> </span>./makalee/lib<br />504<span> </span>2011-07-31 04:44<span> </span>./makalee<br />572<span> </span>2011-07-31 04:44<span> </span>.</pre> <p>นอกจากนี้ยังมีแีกหลายออฟชันที่น่าสนใจสามารถทดสอบได้ด้วยตัวเองครับ</p>cc-by227