<?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>NAzT&#039;s Blog &#187; Javascript</title> <atom:link href="http://www.together.in.th/category/programming-2/javascript-programming-2/feed/" rel="self" type="application/rss+xml" /><link>http://www.together.in.th</link> <description>technology, misc</description> <lastBuildDate>Sat, 17 Dec 2011 14:00:31 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=</generator> <atom:link rel="hub" href="http://superfeedr.com/hubbub"/> <item><title>การสร้างโลกใบใหม่ใน JavaScript</title><link>http://www.together.in.th/javascript-call-function-immediately-create-new-scope/</link> <comments>http://www.together.in.th/javascript-call-function-immediately-create-new-scope/#comments</comments> <pubDate>Sat, 17 Dec 2011 02:25:54 +0000</pubDate> <dc:creator>NAzT</dc:creator> <category><![CDATA[Javascript]]></category> <category><![CDATA[javascript]]></category> <category><![CDATA[scope]]></category> <guid
isPermaLink="false">http://www.together.in.th/?p=3937</guid> <description><![CDATA[วันนี้มาพูดถึง Scope ใน JavaScript แบบเบาๆกันหน่อย เรื่องScope ใน JavaScript มีรายละเอียดให้เราได้เคลิบเคลิ้มกันอีกนาน ซึ่งการสร้าง Scope ใน JavaScript สามารถทำได้ด้วยโค้ดแบบนี้ครับ ถ้าเราไม่สร้าง scope ใหม่แล้วประกาศตัวแปรตรงๆเลย มันจะเป็น global (windows) โอกาสที่ตัวแปรจะไปชนกันกับของคนอื่นก็จะมีเยอะกว่า เพราะใน JavaScript ถึงจะประกาศตัวแปรด้านล่างก็เห็นทั้งไฟล์อยู่ดี แต่ถ้าเราสร้างโลกของเราแล้วก็จะมั่นใจมากขึ้นว่าตัวแปรของเราจะไม่ตีกับใคร เราอาจจะได้เจอโค้ดลักษณะนี้ จากตัวอย่างคือสร้างโลกและส่งตัวแปร jQuery เข้าไปให้สิงอยู่ในตัวแปร $ ซึ่งเป็น local variable แล้วในโลกนั้นก็เรียก $ แทน jQuery ได้อย่างสบายใจไม่ต้องกลัวไปตีกับคนอื่น่ เรื่องที่เกี่ยวข้องพฤษภาคม 10, 2011 -- ว่ากันเรื่อง Javascript scope ตอนที่ 2 [object, this, window, var]พฤษภาคม 7, 2011 -- ว่ากันเรื่อง [...]]]></description> <wfw:commentRss>http://www.together.in.th/javascript-call-function-immediately-create-new-scope/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>ตัวแปร this ใน javascript ทำงานยังไง (เกี่ยวกับ Function Invocation Pattern)</title><link>http://www.together.in.th/this-in-javascript-how-it-work-function-invocation-pattern/</link> <comments>http://www.together.in.th/this-in-javascript-how-it-work-function-invocation-pattern/#comments</comments> <pubDate>Tue, 13 Sep 2011 12:21:06 +0000</pubDate> <dc:creator>NAzT</dc:creator> <category><![CDATA[Javascript]]></category> <category><![CDATA[Apply Invocation Pattern]]></category> <category><![CDATA[Constructor Invocation Pattern]]></category> <category><![CDATA[Function Invocation Pattern]]></category> <category><![CDATA[invocation pattern]]></category> <category><![CDATA[javascript]]></category> <category><![CDATA[Method Invocation Pattern]]></category> <category><![CDATA[this]]></category> <guid
isPermaLink="false">http://www.together.in.th/?p=3875</guid> <description><![CDATA[ถ้าพูดถึงตัวแปร this ในโลกของการเขียนโปรแกรมแบบ Object Oriented ผมจะตีความตัวแปร this ว่ามันจะต้องหมายถึงตัว object นั้นๆ ที่กำลังทำงานอยู่ เป็นแน่แท้&#8230;.. แต่มันไม่ใช่แบบนั้นใน javascript น่ะสิ!! …. อ้าวอ้าว ยังไง ตอบมาให้เคลียร์เลย คือหยั่งงี้ครับ&#8230; เพราะว่าตัวแปร this ใน javascript มันจะหมายถึง Object อะไรนั้นมันขึ้นอยู่กับวิธีการเรียกใช้ฟังก์ชั่น (invocation pattern) ซึ่งมีด้วยกัน 4 แบบ ดังนี้ Method Invocation Pattern Function Invocation Pattern Constructor Invocation Pattern Apply Invocation Pattern ขยายความดังนี้นะครับ Method Invocation Pattern เป็นการเรียก Function ที่อยู่ในObject หรือที่เรียกว่า Method นั่นเอง [...]]]></description> <wfw:commentRss>http://www.together.in.th/this-in-javascript-how-it-work-function-invocation-pattern/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>JSONP request ใน jQuery และ ExtJS</title><link>http://www.together.in.th/jsonp-request-%e0%b9%83%e0%b8%99-jquery-%e0%b9%81%e0%b8%a5%e0%b8%b0-extjs/</link> <comments>http://www.together.in.th/jsonp-request-%e0%b9%83%e0%b8%99-jquery-%e0%b9%81%e0%b8%a5%e0%b8%b0-extjs/#comments</comments> <pubDate>Sun, 21 Aug 2011 08:48:17 +0000</pubDate> <dc:creator>NAzT</dc:creator> <category><![CDATA[Javascript]]></category> <category><![CDATA[extjs]]></category> <category><![CDATA[foreach]]></category> <category><![CDATA[iterate]]></category> <category><![CDATA[jquery]]></category> <category><![CDATA[jsonp]]></category> <guid
isPermaLink="false">http://www.together.in.th/?p=3866</guid> <description><![CDATA[jsonp request ใน jQuery jsonp request ใน ExtJS forEach: jquery ใช้ jQuery.each ส่วน extjs ใช้ Ext.iterate เรื่องที่เกี่ยวข้องกรกฎาคม 1, 2011 -- jQuery Tip: การ break; ออกจาก jQuery.each [ forEach ]กุมภาพันธ์ 24, 2011 -- ดูกล้อง CCTV ทั่วกรุงเทพ ด้วย Traffy API [Wrapper/Proxy] + jQuery + JSONPพฤษภาคม 8, 2011 -- ตัดคำภาษาไทยด้วย javascript [ตัดคำทาง service]กุมภาพันธ์ 24, 2011 -- มาดูป้ายจราจรอัจฉริยะทั่วกรุงเทพและลองใช้ API [...]]]></description> <wfw:commentRss>http://www.together.in.th/jsonp-request-%e0%b9%83%e0%b8%99-jquery-%e0%b9%81%e0%b8%a5%e0%b8%b0-extjs/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Javascript สั้นๆ ตอน Array ปลอมๆ [แล้วจะรู้ได้ยังไงว่าเป็น Array หรือ Object]</title><link>http://www.together.in.th/javascript-how-to-distinguish-array-and-object-phony-array/</link> <comments>http://www.together.in.th/javascript-how-to-distinguish-array-and-object-phony-array/#comments</comments> <pubDate>Sat, 23 Jul 2011 11:02:33 +0000</pubDate> <dc:creator>NAzT</dc:creator> <category><![CDATA[Javascript]]></category> <category><![CDATA[array]]></category> <category><![CDATA[awful]]></category> <category><![CDATA[awful part]]></category> <category><![CDATA[javascript]]></category> <category><![CDATA[object]]></category> <category><![CDATA[object as array]]></category> <category><![CDATA[phony array]]></category> <guid
isPermaLink="false">http://www.together.in.th/?p=3852</guid> <description><![CDATA[ใน JavaScript ไม่มีข้อมูลที่เป็น Array จริงๆ Array ที่มีอยู่มัน array แบบหลอกๆ จริงแล้วมันเป็น object ที่มี key เป็นตัวเลข, มี method เกี่ยวกับ array, และมี property length ถ้าเราพึ่งคำสั่ง typeof อย่างเดียวเราก็จะเจ็บอีกตามเคย กล่าวคือถ้าเราสั่ง typeof [] และ typeof {} มันจะบอกว่า เป็น object ทั้งคู่! แบบนี้ แล้วเราจะรู้ได้ยังไงว่ามันเป็น array รึเปล่า ตรวจสอบได้หลายวิธีนะครับ เช็ค constructor ก็ได้ if (my_value &#38;&#38; typeof my_value === 'object' &#38;&#38; my_value.constructor === Array) { } [...]]]></description> <wfw:commentRss>http://www.together.in.th/javascript-how-to-distinguish-array-and-object-phony-array/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>มาทำโปรเจ็ค JavaScript แบบใช้ TDD กันไหมครับ .. แบบหัดๆ</title><link>http://www.together.in.th/coding-with-javascript-with-jasmine-tdd-string-template-replacement/</link> <comments>http://www.together.in.th/coding-with-javascript-with-jasmine-tdd-string-template-replacement/#comments</comments> <pubDate>Fri, 22 Jul 2011 06:50:01 +0000</pubDate> <dc:creator>NAzT</dc:creator> <category><![CDATA[Javascript]]></category> <category><![CDATA[TDD]]></category> <category><![CDATA[github]]></category> <category><![CDATA[jasmine]]></category> <category><![CDATA[javascript]]></category> <category><![CDATA[jscoverage]]></category> <category><![CDATA[string template]]></category> <category><![CDATA[tdd]]></category> <category><![CDATA[test driven development]]></category> <guid
isPermaLink="false">http://www.together.in.th/?p=3814</guid> <description><![CDATA[พอดีผมไปหา code เก่า&#8230; แล้วเจอ code ที่เขียนแบบนี้ var graph_url = '/' + pageId + '/members/' + uid; ปวดตับมาก code แม่งดูโคตรยากเลย ต่อ string กันกระจาย&#8230; ก็เลยคิดว่าถ้าเราเขียนฟังก์ชั่นทำ string template แบบนี้ str_parse("/${0}/members/${1}", [pageId, uid]); ก็คงจะดีไม่น้อย ได้ใช้บ่อยแน่นอน (ลอกมาจาก facebook api ของ facebook ในส่วนของ FQL) แล้วก็จะเขียนด้วย TDD/BDD เพราะว่าจะได้ฝึกหัดการเขียนโปรแกรมแบบ TDD ไปในตัว และสร้างความสนิทสนมกับ Jasmine ด้วย [Jasmine เป็น behavior-driven framework] เข้าเรื่องกันเลยดีกว่า&#8230; โครงสร้าง โครงสร้างของโปรเจ็คที่เราใช้ Jasmine จะเป็นแบบนี้ [...]]]></description> <wfw:commentRss>http://www.together.in.th/coding-with-javascript-with-jasmine-tdd-string-template-replacement/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Javascript สั้นๆ ตอน parseInt ใช้ไม่ดี เจ็บ!</title><link>http://www.together.in.th/javascript-awful-parts-parseint-with-radix/</link> <comments>http://www.together.in.th/javascript-awful-parts-parseint-with-radix/#comments</comments> <pubDate>Wed, 20 Jul 2011 15:10:10 +0000</pubDate> <dc:creator>NAzT</dc:creator> <category><![CDATA[Javascript]]></category> <category><![CDATA[awful part]]></category> <category><![CDATA[javascript]]></category> <category><![CDATA[parseInt]]></category> <category><![CDATA[radix]]></category> <guid
isPermaLink="false">http://www.together.in.th/?p=3809</guid> <description><![CDATA[JavaScript มีฟังก์ชั่น parseInt เพื่อเปลี่ยน String อย่างเช่น &#8220;8&#8243; ให้เป็น ตัวเลข 8 แต่ถ้าเป็นตัวหนังสือแล้วใช้ operator + มันจะเอา String ไปต่อกัน เพราะ context มันเป็น string แต่ถ้าใช้ไม่ดีเนี่ย&#8230;​ เราจะเจ็บ แบบนี้ ลองสั่ง parseInt(&#8220;08&#8243;) ดูจะได้ 0 เพราะว่าถ้า parseInt เจอ 0 นำหน้าตัวเลขเมื่อไร JavaScript จะคิดว่าอยู่ในโลกของฐาน 8 อาจจะทำให้เราเกิดอาการน้ำตาตกในได้ ถ้าหาบั๊กไม่เจอ วิธีแก้ไขก็คือ ใช้แบบกำหนด radix เข้าไปเพื่อบอกฐานด้วยเช่น parseInt(&#8220;08&#8243;, 10); ภาพประกอบ &#160; credit:  JavaScript The Good Parts เรื่องที่เกี่ยวข้องกรกฎาคม 23, 2011 -- Javascript [...]]]></description> <wfw:commentRss>http://www.together.in.th/javascript-awful-parts-parseint-with-radix/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Javascript สั้นๆ ตอน Semicolon Insertion [Awful Parts]</title><link>http://www.together.in.th/javascript-awful-part-semi-colon-auto-insertion/</link> <comments>http://www.together.in.th/javascript-awful-part-semi-colon-auto-insertion/#comments</comments> <pubDate>Sun, 17 Jul 2011 13:07:25 +0000</pubDate> <dc:creator>NAzT</dc:creator> <category><![CDATA[Javascript]]></category> <category><![CDATA[awful]]></category> <category><![CDATA[awful part]]></category> <category><![CDATA[javascript]]></category> <category><![CDATA[semicolon]]></category> <guid
isPermaLink="false">http://www.together.in.th/?p=3800</guid> <description><![CDATA[JavaScript มีกระบวนการที่คอยแก้ไขโปรแกรมที่มีข้อผิดพลาดโดยการใส่ ; (semi colon) ซึ่งกระบวนการนี้ก็อันตรายไม่ใช่เล่น ลองดูตัวอย่าง return statement นี้ครับ กระบวนการแทรก ; (semi colon) จะทำงานเมื่อสิ้นสุดบรรทัดที่ไม่มี semi colon ใน case นี้ก็ จะกลายเป็น ลองดูผลลัพธ์ จาก function a เมื่อเรียกฟังก์ชั่น a จะได้ undefined แทนที่จะเป็น Object { status: true } serious error กันเลยทีเดียว ตัวอย่างนี้เป็น awful part จากหนังสือ javacript good parts. คร้าบ เรื่องที่เกี่ยวข้องกรกฎาคม 23, 2011 -- Javascript สั้นๆ ตอน Array ปลอมๆ [...]]]></description> <wfw:commentRss>http://www.together.in.th/javascript-awful-part-semi-colon-auto-insertion/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>jQuery Tip: การ break; ออกจาก jQuery.each [ forEach ]</title><link>http://www.together.in.th/jquery-tip-%e0%b8%81%e0%b8%b2%e0%b8%a3-break-%e0%b8%ad%e0%b8%ad%e0%b8%81%e0%b8%88%e0%b8%b2%e0%b8%81-jquery-each-foreach/</link> <comments>http://www.together.in.th/jquery-tip-%e0%b8%81%e0%b8%b2%e0%b8%a3-break-%e0%b8%ad%e0%b8%ad%e0%b8%81%e0%b8%88%e0%b8%b2%e0%b8%81-jquery-each-foreach/#comments</comments> <pubDate>Fri, 01 Jul 2011 02:58:36 +0000</pubDate> <dc:creator>NAzT</dc:creator> <category><![CDATA[Javascript]]></category> <category><![CDATA[jQuery]]></category> <category><![CDATA[each]]></category> <category><![CDATA[foreach]]></category> <category><![CDATA[jquery]]></category> <guid
isPermaLink="false">http://www.together.in.th/?p=3787</guid> <description><![CDATA[ใน jQuery.each(); เราใช้ break เพื่อออกจาก loop แบบ for / for in ไม่ได้ ทางออกสำหรับการ break Loop jQuery.each ก็คือ&#8230; ให้ return false; ซะ ถ้าเป็นค่าอื่นๆเค้าจะทำต่อไปเรื่อยๆจ้า We can break the $.each() loop at a particular iteration by making the callback function return false. Returning non-false is the same as a continue statement in a for loop; it will skip [...]]]></description> <wfw:commentRss>http://www.together.in.th/jquery-tip-%e0%b8%81%e0%b8%b2%e0%b8%a3-break-%e0%b8%ad%e0%b8%ad%e0%b8%81%e0%b8%88%e0%b8%b2%e0%b8%81-jquery-each-foreach/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>BDD framework สำหรับ javascript</title><link>http://www.together.in.th/bdd-framework-%e0%b8%aa%e0%b8%b3%e0%b8%ab%e0%b8%a3%e0%b8%b1%e0%b8%9a-javascript/</link> <comments>http://www.together.in.th/bdd-framework-%e0%b8%aa%e0%b8%b3%e0%b8%ab%e0%b8%a3%e0%b8%b1%e0%b8%9a-javascript/#comments</comments> <pubDate>Fri, 01 Jul 2011 01:35:44 +0000</pubDate> <dc:creator>NAzT</dc:creator> <category><![CDATA[Javascript]]></category> <category><![CDATA[Testing]]></category> <category><![CDATA[bbehavior-driven]]></category> <category><![CDATA[bdd]]></category> <category><![CDATA[framework]]></category> <category><![CDATA[javascript]]></category> <category><![CDATA[test]]></category> <category><![CDATA[test console]]></category> <guid
isPermaLink="false">http://www.together.in.th/?p=3781</guid> <description><![CDATA[หลังจากที่ลองใช้ yui3 เป็น test framework แต่ไม่โดนเพราะมันต้องต่อเน็ต เลยไปลองตัวอื่นดู&#8230; ลองใช้ qunit ก็ยังไม่โดน เลยกะว่าจะใช้ jsunit ซะหน่อย แต่คนทำท่านว่า ไม่ทำต่อแล้วนะ เราใช้และพัฒนา jasmine อยู่&#8230; เลยลองเสีย! jasmine เป็น behavior-driven development framework เอาไว้เทส javascript เหมือนกับน้อง yui ลักษณะโค้ดที่จะเทสเป็นแบบนี้ ผลลัพธ์เป็นแบบนี้ ชอบมาก หล่อสวยกว่า yui3 และท่าเยอะมาก ลองดู presentation ข้างล่าง Sweet-scented Script Specs View more presentations from Michael Hines source code ที่ผมเทสอยู่ที่ https://github.com/NAzT/jasmine-bdd สนใจ jasmine เชิญที่ https://github.com/pivotal/jasmine เรื่องที่เกี่ยวข้องธันวาคม [...]]]></description> <wfw:commentRss>http://www.together.in.th/bdd-framework-%e0%b8%aa%e0%b8%b3%e0%b8%ab%e0%b8%a3%e0%b8%b1%e0%b8%9a-javascript/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>ทำ attribute แบบ private ใน javascript</title><link>http://www.together.in.th/%e0%b8%97%e0%b8%b3-attribute-%e0%b9%81%e0%b8%9a%e0%b8%9a-private-%e0%b9%83%e0%b8%99-javascript/</link> <comments>http://www.together.in.th/%e0%b8%97%e0%b8%b3-attribute-%e0%b9%81%e0%b8%9a%e0%b8%9a-private-%e0%b9%83%e0%b8%99-javascript/#comments</comments> <pubDate>Thu, 30 Jun 2011 20:04:33 +0000</pubDate> <dc:creator>NAzT</dc:creator> <category><![CDATA[Javascript]]></category> <category><![CDATA[javasript]]></category> <category><![CDATA[oop]]></category> <category><![CDATA[private]]></category> <guid
isPermaLink="false">http://www.together.in.th/?p=3773</guid> <description><![CDATA[บางทีเราอาจจะเข้าใจผิดว่า javascript ไม่มี attribute แบบ private. แต่เราสร้างได้ แบบนี้. &#160; &#160; พอทำ ทำงานเขียน code ลักษณะนี้พอดี และ เมา Random Postsมีนาคม 22, 2010 -- github กับ rsa public/private key (git push)พฤศจิกายน 13, 2010 -- สร้าง Rails Application เทียบกับ Grails Applicationพฤศจิกายน 12, 2010 -- กูเกิ้นสะตอเหรด (Google Storage) &#8212; Store your data in Google&#8217;s cloud มกราคม 4, 2011 -- โดนไวรัส [...]]]></description> <wfw:commentRss>http://www.together.in.th/%e0%b8%97%e0%b8%b3-attribute-%e0%b9%81%e0%b8%9a%e0%b8%9a-private-%e0%b9%83%e0%b8%99-javascript/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
