<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Araiva Viruskizz on Medium]]></title>
        <description><![CDATA[Stories by Araiva Viruskizz on Medium]]></description>
        <link>https://medium.com/@viruskizz?source=rss-4d083c033912------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*sPmsQB2H58NqjQr86UxgFQ.png</url>
            <title>Stories by Araiva Viruskizz on Medium</title>
            <link>https://medium.com/@viruskizz?source=rss-4d083c033912------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 00:32:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@viruskizz/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[42Bangkok, common of Galactic]]></title>
            <link>https://viruskizz.medium.com/42bangkok-common-of-galactic-429f8462017a?source=rss-4d083c033912------2</link>
            <guid isPermaLink="false">https://medium.com/p/429f8462017a</guid>
            <category><![CDATA[42-bangkok]]></category>
            <category><![CDATA[common-core]]></category>
            <dc:creator><![CDATA[Araiva Viruskizz]]></dc:creator>
            <pubDate>Sat, 29 Jun 2024 18:21:00 GMT</pubDate>
            <atom:updated>2024-08-20T14:59:16.864Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0qQDzlwzIxFn9TV-Hjx9SA.jpeg" /><figcaption>42Bangkok common core completion certificate</figcaption></figure><h3>บทสรุป 2 ปี ของ common core</h3><p>หลังจากเริ่มเรียน 42Bangkok ตั้งแต่ 14 กุมภาพันธ์ 2022 ก็ผ่านระดับพื้นฐานของ 42 แล้ว ซึ่งได้ส่งโปรเจคตัวสุดท้าย ในตอนปีใหม่ วันที่ 1 มกราคม 2024 เป็นระยะเวลาเกือบ 2 ปี ซึ่งมันทั้งสนุก และท้าทายมากใน ช่วงเวลาสั้นๆ นี้</p><h3>Common Core คืออะไร ?</h3><p>Common Core คือ <strong>หลักสูตรระดับพื้นฐานของ </strong><a href="https://www.42network.org/42-schools/"><strong>สถาบัน 42</strong></a> ซึ่ง Cadet หรือ ผู้เรียนทุกคนจำเป็นต้องผ่านทุกคน ก่อนที่จะเลือกเรียนวิชาถนัด หรือ วิชาที่อยากจะเรียนได้ คล้ายๆกับ นักศึกษาชั้นปีที่ 1 ที่เรียนวิชาบังคับ นั่นแหละ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HJYqwcgKvbO7fJkifMI-kA.jpeg" /><figcaption>Holy Graph</figcaption></figure><p>ในระบบของ 42 จะมี Learning Path แนวทางการเรียนแต่ละแขนง และการไต่ระดับ โดยวงกลม คือ โปรเจคที่สามารถเรียนได้ สำหรับโปรเจคที่รายล้อมอยู่ตรงกลาง เป็นชั้นๆ เหมือน กาแลคซี นั่น คือ Common Core วิชาแก่นหลักที่ทุกคนต้องผ่าน</p><h3>Rank</h3><p>การเรียน ทุกคนจะเริ่มจาก Rank 0 ไปจนถึง Rank 6 โดยจำเป็นเรียนทุกโปรเจคที่อยู่ในระดับนั้น กรณีเป็นโปรเจคประเภทเดียวกัน สามารถเลือกทำเพียง 1 อันได้ โดยดูจาก วงกลมที่ชิดกัน</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ONefsJ-AvNrehOLIN3SSNg.jpeg" /><figcaption>Common Core</figcaption></figure><p>นอกจากจะต้องทำ โปรเจคให้ครบในระดับนั้นๆ และ จำเป็นต้อง สอบให้ผ่าน จึงจะปลดล็อค โปรเจคใน Rank ต่อไปได้</p><blockquote>โปรเจค common coreเรียนอะไรกันบ้าง ??</blockquote><ul><li><strong>C-Libary<br></strong>เริ่มต้นเขียน function พื้นฐานทั้งหมดที่จำเป็นและสร้าง Lib ของตนเอง ด้วย ภาษา C</li><li><strong>VM &amp; Linux<br></strong>การตั้งค่าเครื่อง VM<strong> </strong>ติดตั้ง package ต่าง เพื่อให้สามารถใช้งานเว็ปไซต์ขั้นพื้นฐาน ได้ ซึ่งทำให้เราเรียนรู้คำสั่งต่างๆ บน Linux</li><li><strong>Memory Management<br></strong>เขียน function เพื่ออ่านไฟล์ทีละบรรทัด ทำให้เราเรียนรู้การจัดการ memory ของ ram คือ ห้าม leak ห้าม malloc เกิน เหมือนจะง่ายแต่ยากพอควรเลยทีเดียว</li><li><strong>ft_printf<br></strong>เขียน function printf ของตัวเอง ให้เหมือนกับต้นฉบับ ทำให้เราเรียนรู้หลักการแสดง output ของโปรแกรมอย่างละเอียด และ ยังเป็นการบ่งบอกถึง สไตล์ของที่นี่ นั่นคือ <em>ถ้าของเขาไม่ได้ดั่งใจ ก็เขียนเอง</em></li><li><strong>Signal<br></strong>เขียนการส่งข้อมูลไปมา ระหว่าง 2 โปรแกรม ในรูปแบบ signal ทำให้เราได้รู้ถึงการทำงาน process ของคอมพิวเตอร์</li><li><strong>Sorting Algorithm</strong><br>เขียนโปรแกรมเรียงตัวเลข ให้ได้จำนวนครั้งให้น้อยที่สุด ยิ่งใช้จำนวนครั้งน้อย ยิ่งได้คะแนนมาก หากใช้มากเกินไปถือว่าสอบตก ทำให้ฝึกการคิด Algorithm ต่างๆ ถือแม้สุดท้ายต้องอ้างอิงตาม Algorithm ที่ทั่วโลกใช้กันก็เถอะ</li><li><strong>Graphic Program<br></strong>เขียน Game 2D หรือ สร้างเส้นภาพ 3 มิติอย่างง่าย ทำให้เรียนรู้เบื้องหลังการ render ภาพของคอมพิวเตอร์อย่างละเอียดทีละ pixel กันทีเดียว</li><li><strong>Thread &amp; Process</strong><br>เขียนโปรแกรมที่สามารถทำงานคู่ขนานกัน และบริหารจัดการ Thread และ Process ของโปรแกรม โดยโปรแกรมต้องทำงานได้ไว ตามเงื่อนไข</li><li><strong>Own Shell</strong><br>เขียน Shell Program ของตัวเอง ทำให้เรียนรู้เบื้องหลังทำงานของ Shell บน Linux</li><li><strong>Raytracing</strong><br>เขียนโปรแกรมแสดงรูปภาพ แสง และ เงา แบบ 3 มิติ ทำให้เราได้รู้เบื้องหลังของภาพที่แสดงผลในเกมต่างๆ ได้ชัดเจน แจ่มแจ้ง แต่สนุก ส่วนตัว ชอบโปรเจคอันนี้มาก</li><li><strong>CPP</strong><br>เรียนรู้ภาษา CPP ซึ่งเป็นหลักๆ คือ การเขียนแบบ Object Oriented Programming</li><li><strong>Network</strong><br>เรียนรู้พื้นฐาน WLan network การกำหนด ip range ต่างๆ</li><li><strong>Docker Container</strong><br>Deploy Web สำเร็จรูปด้วย Docker แบบว่า ใช้ multi container ด้วยนะ ทำให้ได้เรียนรู้ Docker อย่างละเอียดถี่ยิบ</li><li><strong>Web Server</strong><br>เขียน Web Server ของตนเองขึ้นมา ใกล้เคียงกับ Apache หรือ Nginx เลยทีเดียว ทำให้ได้เรียนรู้การสื่อสารของ Website ตั้งแต่ Client ไปยัง Server และกลับไปยัง Client เลยล่ะ</li><li><strong>Modern Web Application<br></strong>เขียน Web Application ที่ทันสมัยในรูปแบบปัจจุบัน โดยมีทั้ง Frontend Backend และ Database โดยสามารถสื่อสารเชื่อมกันแบบ real time ได้</li></ul><p>แต่ละโปรเจคนั้น ลึก ละเอียด และเน้นการลงมือทำจริง ผ่านการเรียนรู้ตัวเอง และ การแลกเปลี่ยนกับเพื่อนๆ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4565KCm1Rjy30MjwAk5bEg.png" /><figcaption>Evaluated Transcendence</figcaption></figure><h3>Leveling</h3><p>นอกจากระบบ Rank แล้ว ยังมีระดับ Level ของแต่ละคน ซึ่งระบบนี้ก็เหมือนกับการเล่นเกมนั่นแหละ เมื่อเราส่งโปรเจคก็ได้ EXP มา ซึ่งแต่ละโปรเจค จะได้ EXP ไม่เท่ากัน ยิ่งยากใช้เวลามาก ก็จะได้ EXP มา และนอกจากนั้น เมื่อ Level ของตนเองสูงขึ้น ก็จำเป็นต้องใช้ EXP ในการอัพเลเวลสูงขึ้นเช่นกัน โดยมีวิธีคำนวณอย่างง่ายๆ ประมาณนี้</p><pre>Earned EXP = Project EXP Base * Project Score</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3S7meYnOdnpX7jg1M6UiUA.png" /><figcaption>Level History</figcaption></figure><p>โดย Level สูงสุดของการเรียนรู้ คือ 21 ซึ่งไม่ง่ายแน่นอน อย่างปัจจุบันผมเองอยู่ที่ เลเวล 11.42 เพราะหลังๆ แต่ละ Level จะใช้ EXP เยอะมากๆ</p><blockquote>ทำไมเรียนตั้ง 2 ปี</blockquote><p>การเรียนที่ 42 นั้น แต่ละคนมีความสามารถ มีเวลา ที่ไม่เท่ากัน ดังนั้นแต่ละคน จะเรียน จบ Common Core ได้ต่างความเร็ว แต่สูงสุด จะไม่เกิน 2 ปี โดยประมาณ ซึ่งจะมีระบบ ที่เรียกว่า Pacing System คอยกำหนดเป้าหมายการเรียนให้เราในแต่ละ Rank ว่าเราต้องส่ง โปรเจค ให้ทันเมื่อไหร่ เหมือน Deadline น้่นแหละ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6z9zMA8wOFlfn0USAuC-jg.png" /><figcaption>Pacing System</figcaption></figure><p>และแน่นอน ถ้าเราไม่สามารถทำเสร็จทัน Milestone นั่น คือ เราก็ต้อง บอกลาที่นี่ไป เก็บกระเป๋าออกจากบ้าน 42 แต่ก็ไม่ง่ายขนาดนั้น เพราะ สังคมการเรียนรู้แห่งนี้พร้อมสนับสนุนการเรียนอยู่เสมอ ทั้งเพื่อนๆ และ สตาฟ</p><h3>What I learned in 42 Style</h3><p>42 เป็นการเรียนรู้ในรูปแบบ <a href="https://www.linkedin.com/pulse/push-vs-pull-learning-gus-prestera">Pull Base</a> ซึ่งผู้เรียนแต่ละคนจำเป็นต้องหาความรู้ด้วยตัวเอง ตามสไตล์ของตนเอง ตาม Concept การเรียนรู้</p><blockquote>No classes, No teacher, No tuition</blockquote><p>ผลที่ได้จากการประบวนการเรียนรู้</p><h4>42 System</h4><ul><li>Time management</li></ul><h4>Project</h4><ul><li><strong>Project Strucuture</strong> การเรียนเน้นที่การทำ project เป็นหลักการวางโครงสร้างของ source code จึงเป็นสิ่งจำเป็น</li><li><strong>Git Management </strong>หลายๆโปรเจคต้องร่วมกับเพื่อนในทีมจึงต้องบริหาร code version และส่วนการทำงานร่วมกันให้ดี</li></ul><h4>RTFM</h4><ul><li>เนื้อหาของโปรเจคส่วนใหญ่จะลึก และหาการเรียนรู้ได้ยากบน internet และ youtube ดังนั้น ส่วนใหญ่จำเป็นต้องอ่าน document ของ source code เป็นหลัก <strong>เป็นการฝึกทักษะ การอ่าน document</strong> ได้ดีมากๆ</li></ul><h4>Moulinette</h4><ul><li><strong>Code Tester</strong> การเขียนโปรแกรมจะถูกโปรแกรมทดสอบในหลายๆ use case ทั้ง edge case, overflow case, null case, perfomance test และอื่นๆ</li><li><strong>Code beutify</strong> การเขียนต้องเป็นระเบียบเรียบร้อยตาม format 42 คือ 25 code line per function and 5 function per file</li><li><strong>Memory management</strong> ระบบจะตรวจ memory leaks ดังนั้นการเขียนจำเป็นต้องจัดการเรื่อง ram ให้ดี</li></ul><h4>Evaluation</h4><ul><li>Peer Exchange</li><li>Internation discussion</li></ul><h3>Community</h3><p>42 เป็นสังคม ระบบ แห่งการเรียนรู้อย่างสนุกสนานจริงๆ เพราะ นอกจากเรียนแล้วยังมีกิจกรรมอื่นๆ ให้ทำกันอีกเพียบ หมายกับ โรงเรียน และ มหาลัย นั่นแหละ</p><p>ยกตัวอย่างเช่น การไปเยี่ยมชมบริษัททางเทคโนโลยีต่างๆ การแข่งขัน Hackathon การเรียนรู้ภายใน และอื่นๆ อีกเพียบ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aMQdMt_rGONyVnhl" /></figure><p>42 เป็นสังคมระดับโลก และ นานาชาติ แห่งหนึ่ง คือ ทั้งเพื่อนชาวไทย และเพื่อนชาวต่างชาติที่ตั้งใจบินมาอยู่เมืองไทย เพื่อเรียน 42Bangkok อย่างบริษัทที่เข้ามาเยี่ยมชม ก็มีทั้งต่างชาติ กิจกรรมระหว่างโรงเรียน ซึ่งเป็นระดับเอเซีย หรือ ระดับโลก เราก็สามารถเข้าร่วมได้ เช่นกัน</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ypBNdvN27SMEusAJ" /></figure><p>ใครสนใจไปตามที่ Page ได้ <a href="https://www.facebook.com/42Bangkok">42 Bangkok — FACEBOOK</a></p><h3>สรุป</h3><p>เมื่อเรียนจบ Common Core แล้ว รู้สึกได้เลยว่า มีความรู้และความสามารถที่แน่นจริงๆ เพราะได้ลงมือปฏิบัติหลายโปรเจคอย่างลึกมากๆ ทำให้สามารถทำงานได้เลยทันที</p><p>ทั้งหมดทั้งมวล 42 เป็นสถาบันที่มุ่งเน้นสร้างนักพัฒนาจริงๆ ใครไม่มีพื้นฐาน แต่มีพลังใจที่อยากเป็น ก็สามารถเข้ามาเรียนรู้ได้โดยไม่ต้องเสียค่าใช้จ่ายใดๆ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-3SMrrkMJK0Gy0cM" /></figure><p>ส่วนใครสนใจเข้ามาเรียนที่นี่ เข้าสมัครผ่านทางเว็ปไซต์ ได้เลย <br><a href="https://www.42bangkok.com/th/">42Bangkok Free Programming School — ไทย — 42Bangkok</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=429f8462017a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Eorzea Cafe in OSAKA]]></title>
            <link>https://viruskizz.medium.com/eorzea-cafe-in-osaka-60d55b371673?source=rss-4d083c033912------2</link>
            <guid isPermaLink="false">https://medium.com/p/60d55b371673</guid>
            <category><![CDATA[final-fantasy]]></category>
            <category><![CDATA[osaka]]></category>
            <category><![CDATA[travel]]></category>
            <category><![CDATA[final-fantasy-xiv-online]]></category>
            <dc:creator><![CDATA[Araiva Viruskizz]]></dc:creator>
            <pubDate>Sun, 17 Sep 2023 16:20:58 GMT</pubDate>
            <atom:updated>2023-09-17T16:55:06.241Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lBLdL0Yyp-dN9YjtUppV3g.png" /></figure><h3>~เกริ่นนำ~</h3><p>ตัวผมเองได้มีโอกาสได้เดินทางไปยังประเทศญี่ปุ่น ถึงถือว่าเป็นแหล่งสำคัญของเหล่าเกมเมอร์และเหล่าอนิเมะ และที่แน่นอน แฟนพันธุ์แท้ไฟนอลแฟนตาซี อย่างผม ต้องไม่พลาดแน่นอนกับการไปเยี่ยมชมสถานที่สำคัญของเกมนี้ ซึ่งจะมีอยู่ 2 แบบ 3 แห่ง ในญี่ปุ่น</p><ol><li>Square Enix Cafe</li></ol><ul><li><strong>Artnia</strong>, Shinjuku Tokyo Japan</li></ul><p>2. Final Fantasy XIV Cafe</p><ul><li><strong>Eorzea Cafe</strong>, Akihabara Tokyo Japan</li><li><strong>Eorzea Cafe</strong>, Namba Osaka Japan</li></ul><blockquote>เนื้อหลักจะเน้นไปที่ Eorzea Cafe สาขา Osaka</blockquote><h3>Artnia</h3><p>Artnia เป็น Square Enix Shop ที่รวมสิ้นค้าของเกมทั้งหมดที่เกี่ยวข้องกับบริษัท ไม่ว่าจะเป็น</p><ul><li>Final Fantasy Series</li><li>Dragon Quest Series</li><li>Nier Series</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iMp8gjsNmw6Z9YAp0l71BA.jpeg" /><figcaption>มุมขายของ</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j2iBF05iOEYceUZM9BJNhA.jpeg" /><figcaption>มุมขายทุกอย่าง</figcaption></figure><p>มุม Showcase พวก figure</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_J1H3vWNd0XeOvv2c13idA.png" /><figcaption>Gallery (ภาพเก่า)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kbN5ipvWhcHwgGUwNLUgLA.jpeg" /><figcaption>ตู้โชว์ Figure</figcaption></figure><p>และนอกจากสินค้า ยังมีให้บริการ อาหาร ขนม เครื่องดื่ม เหมือนคาเฟ่ แต่ไม่ใหญ่มากนัก</p><h4>สถานที่</h4><p>อาคารทรงรี ตั้งอยู่ตรงข้ามตึก Square Enix ย่าน Shinjuku เมือง Tokyo</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ND24J0ZCqIzDlGd-9ujXYw.jpeg" /></figure><h4>Map</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.google.com%2Fmaps%2Fembed%2Fv1%2Fplace%3Fcenter%3D35.6961015%252C139.7064338%26key%3DAIzaSyD9HrlRuI1Ani0-MTZ7pvzxwxi4pgW0BCY%26zoom%3D17%26q%3DARTNIA%2BSquare%2BEnix&amp;display_name=Google+Maps&amp;url=https%3A%2F%2Fwww.google.com%2Fmaps%2Fplace%2FARTNIA%2BSquare%2BEnix%2F%4035.6961015%2C139.7064338%2C17z%2Fdata%3D%214m6%213m5%211s0x60188cdef211be59%3A0x7081629f0c2249f9%218m2%213d35.6961015%214d139.7090087%2116s%252Fg%252F1hm48lhj8%3Fentry%3Dtts&amp;image=http%3A%2F%2Fmaps-api-ssl.google.com%2Fmaps%2Fapi%2Fstaticmap%3Fcenter%3D35.6961015%2C139.7064338%26zoom%3D15%26size%3D250x250%26sensor%3Dfalse&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=google" width="600" height="450" frameborder="0" scrolling="no"><a href="https://medium.com/media/5a03674b66f5605bda9c6c9ce84f30cb/href">https://medium.com/media/5a03674b66f5605bda9c6c9ce84f30cb/href</a></iframe><h3>Eorzea Cafe, Tokyo</h3><p>เป็นร้านอาหาร ตกแต่งสไตล์ Final Fantasy XIV โดยเฉพาะ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vOtLxZMQccsBSs-MAUxgqA.jpeg" /><figcaption>ด้านหน้าทางเข้า Eorzea Cafe, Tokyo</figcaption></figure><p><em>ดูคนค่อนข้างเยอะ เลยไม่เข้าไปด้านใน จึงถ่ายมาเฉพาะด้านหน้า</em></p><h4>สถานที่</h4><p>อยู่ภายในตึก Pasela Resorts ชั้น 2F (ขึ้นผ่านบันได) อยู่ในย่าน Akihabara เมือง Tokyo ซึ่งอาคารนี้ตั้งอยู่ห่างไกลศูนย์กลางอยู่นะ แทบจะขอบๆเลย เดินไกลนิดนึง</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vXhmfvEMmKuPSDgKEZPcFA.jpeg" /><figcaption>ป้ายหน้าอาคาร</figcaption></figure><h4>Map</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.google.com%2Fmaps%2Fembed%2Fv1%2Fplace%3Fcenter%3D35.6977396%252C139.7677349%26key%3DAIzaSyD9HrlRuI1Ani0-MTZ7pvzxwxi4pgW0BCY%26zoom%3D17%26q%3DFinal%2BFantasy%2BEorzea%2BCafe&amp;display_name=Google+Maps&amp;url=https%3A%2F%2Fwww.google.com%2Fmaps%2Fplace%2FFinal%2BFantasy%2BEorzea%2BCafe%2F%4035.6977396%2C139.7677349%2C17z%2Fdata%3D%213m1%215s0x60188c1d20d78039%3A0xe317f8c51dcba47a%214m6%213m5%211s0x60188c1d274dca55%3A0xc654aa077e7d82e9%218m2%213d35.6977571%214d139.7703742%2116s%252Fg%252F11b6_vfl10%3Fentry%3Dtts&amp;image=http%3A%2F%2Fmaps-api-ssl.google.com%2Fmaps%2Fapi%2Fstaticmap%3Fcenter%3D35.6977396%2C139.7677349%26zoom%3D15%26size%3D250x250%26sensor%3Dfalse&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=google" width="600" height="450" frameborder="0" scrolling="no"><a href="https://medium.com/media/4ba1f8e9ce2f4dc1860f5ded7bf93f57/href">https://medium.com/media/4ba1f8e9ce2f4dc1860f5ded7bf93f57/href</a></iframe><blockquote>…เข้าสู่เนื้อหาหลัก…</blockquote><h3>Eorzea Cafe, Osaka</h3><p>เป็นร้านอาหาร ตกแต่งสไตล์ Final Fantasy XIV โดยเฉพาะ ซึ่งตั้งอยู่ภายในตึก Pasela Resort ชั้น 5 ใจกลางถนนโดทงโบริ ถนนท่องเที่ยวหลักของ Namba Osaka ซึ่งใครๆก็ต้องมาที่นี่ ซึ่งเป็นแหล่งช็อปปิ้งของ Osaka และยังมี Landmark อย่างป้าย Glico ที่ใครๆก็มาถ่ายกัน</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8cnskSMLJQXJ8ybU.jpg" /><figcaption>Pasela Resorts</figcaption></figure><h4>Map</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.google.com%2Fmaps%2Fembed%2Fv1%2Fplace%3Fcenter%3D34.6685144%252C135.5015237%26key%3DAIzaSyD9HrlRuI1Ani0-MTZ7pvzxwxi4pgW0BCY%26zoom%3D17%26q%3DEorzea%2BCafe%2Bin%2BOsaka&amp;display_name=Google+Maps&amp;url=https%3A%2F%2Fwww.google.com%2Fmaps%2Fplace%2FEorzea%2BCafe%2Bin%2BOsaka%2F%4034.6685144%2C135.5015237%2C17z%2Fdata%3D%213m1%214b1%214m6%213m5%211s0x6000e715212f96ff%3A0xfcdd59bde2f60fb0%218m2%213d34.6685144%214d135.5040986%2116s%252Fg%252F11f25gz4fl%3Fentry%3Dtts&amp;image=http%3A%2F%2Fmaps-api-ssl.google.com%2Fmaps%2Fapi%2Fstaticmap%3Fcenter%3D34.6685144%2C135.5015237%26zoom%3D15%26size%3D250x250%26sensor%3Dfalse&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=google" width="600" height="450" frameborder="0" scrolling="no"><a href="https://medium.com/media/248aedac9da062ff085ba668e024ac28/href">https://medium.com/media/248aedac9da062ff085ba668e024ac28/href</a></iframe><h4>การเข้า Cafe</h4><p>พอเราถึงชั้น 5 จะเจอประตูทางเข้าใหญ่ๆ แบบนี้ พร้อมป้ายร้านสวยเท่</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T9Uu9yzkG7KugEGizIGO5g.jpeg" /><figcaption>ประตูทางเข้า Eorzea Cafe</figcaption></figure><p>แน่นอนครับ อะไรๆ ใน Japan มันไม่ฟรี คุณต้องเสียค่าเข้า 700 Yen ต่อคน แต่จะได้รับของสะสม เป็นที่ระลึกด้วย ในแต่ละครั้งที่เข้าคาเฟ่</p><p><strong>ของที่ได้รับมีดังนี้</strong></p><ul><li>กระดาษรองแก้ว เลือกลายตามอาชีพ 1 ชิ้น</li><li>กระดาษรองแก้ว ลายพิเศษ แบบสุ่ม 1 ชิ้น (ห่อฟรอย)</li><li>แผ่นแม่เหล็กลายพิเศษ แบบสุ่ม 1 ชิ้น</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-nchwOIGCRRIOlmi.jpg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5Wgao5lxQL16PlRh.jpg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*am4kgy1pCPNu9l3U.jpg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CY9eQMXVERteLN0x.jpg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1RZb5I6ql3uB5HfG.jpg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q-Wzaib7CvLyWLMhjhtZzQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qvzrEpD67pvBhi_m6hL2zg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JqFNRX3BY8TkQ1DNRp07dg.jpeg" /></figure><h4>บรรยากาศ</h4><p>บรรยากาศภายในร้านสุดคลาสสิค อลังการงานสร้างจริงๆ ทั้งการจัดวางโต้ะ การจัดแสงสวยงาม อีกทั้งยังมีจอใหญ่ยัก เปิดวีดีโอในเกม ให้เราได้ชมกันตลอดเวลา</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wllIS-Ex9dv3RbytZY0ukg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7CDfXUHKSUZnG34mKK1JiA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-CCQ4UOacMbsdJHNADXPww.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D482Ly7P_JVQGEgPpT3PeA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JcsFeZwFKsnABpzwXg-sKg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mjmCCalY_x2KzsAp86EkUw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pea6KtY5YYbayXJxPR1wcw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G-wJQMRAk_uFYMdfZtLgLw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wc5G8DmkMXB8mp7yLx9nIw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jZ6nrWCkk_YQ1r2siSNDcA.jpeg" /><figcaption>บรรยากาศภายในร้าน</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FAd3zZuSgyFA%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DAd3zZuSgyFA&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FAd3zZuSgyFA%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/2d0f4cb4e6d482f5ad9a600ced36052b/href">https://medium.com/media/2d0f4cb4e6d482f5ad9a600ced36052b/href</a></iframe><h4>การสั่งอาหาร</h4><p>เราจะได้ บิลมา 1 ใบ พร้อม QRCODE ให้เรา Scan แล้วเลือกสั่งเมนูออนไลน์ ซึ่งราคาอาหาร ถือว่าไม่แพงมาก เมื่อเทียบกับร้านคาเฟ่อื่นๆ</p><p><a href="https://www.pasela.co.jp/paselabo_shop/ff_eorzea/osaka-menu/">ファイナルファンタジーエオルゼアカフェのグランドメニュー in OSAKAのグランドメニュー | リゾート複合型エンターテインメント施設のパセラリゾーツ</a></p><p>นอกจากนี้ ทุกๆ 1 order หรือ 1 อาหารที่คุณสั่ง จะได้รับ Stamp 1 ดวง เมื่อสะสมครบ 50 ดวง จะได้รับแผ่นหินอาชีพสุดพิเศษ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*md7GwgVKgQLBRgwZ.jpg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kC7TxeR8gfxI77c6.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EiISLZ29UlSlRDCG.PNG" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3Om-1H2Q0HAGTaouwFy02A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-a6Tn6FMLyBUXpm6.jpg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8-2h_TSm8XVJAEyr.jpg" /></figure><h4>หน้าตาขนมหวาน</h4><p>เมนูที่สั่งเป็น แพนเค้กพิเศษครบรอบ 10 ปี Final Fantasy 14 และ น้ำหวานแบบ White Mage และของหวานบางชิ้นจะมีอุปกรณ์พิเศษติดมาด้วย ซึ่งอันนั้นเป็นของประดับกินไม่ได้ และ ห้ามเอากลับบ้านด้วยนะ ~~</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cJ2cURasEM9LCMY1X8zzHg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qpOwP7Huv8isLLGlDmpZow.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B18VwViCLegl1AMTYUGr3g.jpeg" /><figcaption>แนะนำเก็บกระดาษรองกลับบ้านจะดีกว่า</figcaption></figure><h4><strong>มุมขายของ และ ตู้โชว์</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WCPnfRwipi6hhpdR.jpg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eGJiW5_cWpyw47OQ.jpg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kD6kyFVDffsSQYmQ.jpg" /></figure><h4><strong>Social Board</strong></h4><p>ไว้แปะโน๊ต แบ่งปันข้อความ ให้กับเพื่อนๆ คนอื่นๆ ที่เข้ามายังคาเฟ่ ได้ด้วย</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9YXS2o5OeFnAsRNT8fDHZg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WvM7oMNZKwBo5Uq9.jpg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H9UodMugRG262rb1gebBfw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cT4k9EPRmAG7ZZ24JoTVEA.png" /></figure><h4><strong>มุม องค์หญิง “<em>Nanamo Ul Namo”</em></strong></h4><p>มาแล้วแวะไปสักการะ องค์หญิงท่าน ซักหน่อย</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D482Ly7P_JVQGEgPpT3PeA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LtLphAgNxkB-3XRjzFs0qA.jpeg" /></figure><h4><strong>ห้องน้ำ</strong></h4><p>ยิ่งกว่าห้องน้ำนะบอกเลย มีอุปกรณ์แต่งตัวครบครัน</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pDlbqQ7K57AmLVvU.jpg" /></figure><p><strong>ของตกแต่งอื่น</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eSFAeqBuPvtXJv9L.jpg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*twDq19fWWnnowol_i5SClA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l_sFIVuVTjDqn_AbQ0lghQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YSR1J8gYkEhrzU2Iz_eG7g.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vqll-jcmBbFPemoGbn5TAA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k6ka9qmcc6YemZGCx_4z_g.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rAde3OoemZ6ZqyjM5C6J7g.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wc5G8DmkMXB8mp7yLx9nIw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3AuYq-0e93tTb5YwURKxyg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RrSbtZZaUdkrSX-4ap3hGg.jpeg" /></figure><blockquote>โดยรวม Eorzea Cafe in Osaka มันดีงามมากๆ ใครมาเที่ยว Osaka แล้วอย่าลืมมาแวะกันนะครับ</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60d55b371673" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Handling massive scale with DynamoDB]]></title>
            <link>https://viruskizz.medium.com/handling-massive-scale-with-dynamodb-330fb2a96652?source=rss-4d083c033912------2</link>
            <guid isPermaLink="false">https://medium.com/p/330fb2a96652</guid>
            <category><![CDATA[dynamodb]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Araiva Viruskizz]]></dc:creator>
            <pubDate>Mon, 16 Jan 2023 17:37:17 GMT</pubDate>
            <atom:updated>2023-01-17T05:00:26.158Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zrysHYRvIUdzZ6u7.png" /><figcaption><a href="https://aws.amazon.com/dynamodb/">Fast NoSQL Key-Value Database — Amazon DynamoDB — Amazon Web Services</a></figcaption></figure><h3>AWS DynamoDB</h3><p>คือ ฐานข้อมูลแบบ NOSQL ซึ่งให้บริการอยู่บน AWS สามารถรองรับ Workload ได้มาก ในระดับ milliseconds. อย่างไรก็ตาม การที่จะรองรับ request ได้จำนวนมากนั้น จำเป็นต้องมีการออกแบบ และ การใช้งานที่เหมาะสม</p><h3>Match Your Workload to the Right Database</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T4GaIug60dP1rPrYg7Pefg.png" /><figcaption><a href="https://www.youtube.com/watch?v=hwnNbLXN4vA">(476) AWS re:Invent 2018: Building with AWS Databases: Match Your Workload to the Right Database (DAT301)</a></figcaption></figure><h3>Handling Massive Request</h3><p>การจัดการการเรียกใช้งาน DynamoDB จำนวนมาก</p><ol><li>Database Design</li><li>Database Configuration</li><li>Database Operation</li></ol><h3>Database Design</h3><ul><li>NOSQL design, less relationship schema</li><li>No Ordering Partition Key</li><li>Sort-key design</li><li>Hierarchy Design Schema</li><li>Local Secondary Index</li><li>Global Secondary Index</li></ul><h4>NOSQL database design</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fcPJJGuHVj1EVgmyNfDrSg.png" /><figcaption>DynamoDB Table</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xhJNIDFhO7SlCUI0py1EvQ.png" /><figcaption><a href="https://youtu.be/HaEPXoXVf2k?t=833">Partition Sort Key</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kJ3rVKBhlOJAhSPwuRxg3Q.png" /><figcaption>Bad Design</figcaption></figure><h4>Sort-key design</h4><p>ใช้ข้อได้เปรียบของ Sort Key เข้ามาช่วยในการ Query ทำให้ลดการใช้งาน Filter ซึ่งช้า และกินทรัพยากรมากกว่า</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xgJyENnKzzY9UhdKcgeQvw.png" /><figcaption>Not good approach</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_yPvN_cfuP6Cuw1ghCxjAA.png" /><figcaption>Use sort key approach</figcaption></figure><h4>Secondary Index</h4><p>สามารถ Query โดยอ้างอิง Attribute อื่นเป็น partition key ได้</p><ul><li>Local Secondary Index<br>ใช้ทดแทน sort key หลัก ในการค้นหา query ได้</li><li>Global Secondary Index<br>ใช้ทดแทน partition key และ sort key ในการ query หรือ scan ได้</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qd7pOieo9fmG_tQFvROUqQ.png" /><figcaption><a href="https://youtu.be/HaEPXoXVf2k?t=3087">Global Secondary Index</a></figcaption></figure><h3>Database Configuration</h3><ul><li>Scaling RCU and WCU in the right time</li><li>On-demand capacity mode</li><li>DynamoDB stream for triggering an event</li><li>DynamoDB Infrequent Access for save 60% of your normal billing</li><li>Applied DynamoDB Accelerator (DAX) for caching</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nrOIfQzqvP_kKmDXR7wgyw.png" /><figcaption>Scaling</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I2vruI1CpSXepmIqY1lgpw.png" /><figcaption>DynamoDB Stream</figcaption></figure><h3>Database Operation</h3><ul><li>Batch or Transactional Operation</li><li>Arithmetic on update is choice</li><li>Avoiding scan operation</li><li>Parallel Scan for massive read</li></ul><h4>Batch or Transactional Operation</h4><p>สำหรับ การใช้งานหลาย request</p><pre>// Not good operation for multiple items<br>array.foreach(el =&gt; {<br>  await dynamodbClient.get({el.pkey, el.skey});<br>});</pre><pre>// BatchGet for multiple items<br>dynamodb.batchGet({<br>  RequestItems: {<br>    &quot;table&quot;: array.map({el.pkey, el.skey}) <br>  }<br>});</pre><h4><strong>Batch vs Transaction</strong></h4><p><strong>Batch</strong></p><ul><li><strong><em>Asynchronous Request</em></strong></li><li>ทำงานได้รวดเร็ว</li><li>ข้อเสีย ไม่การันตีความสำเร็จของ Request</li></ul><p><strong>Transaction</strong></p><ul><li><strong><em>Synchronous Request</em></strong></li><li>ทำงานได้ช้ากว่า Batch</li><li>ใช้ RCU และ WCU มากกว่า Batch</li><li>แพงกว่า Batch</li><li>ข้อดี ทุก request ต้องทำงานสำเร็จ</li></ul><h4>Arithmetic on update is choice.</h4><p>ใช้ Update operation แทนการ GetItem และ PutItem</p><p><strong>ตัวอย่าง</strong></p><p>ต้องการลดจำนวนทั้งหมด Mlik กรณีถูกขายไป 1 ชิ้น</p><ol><li>GetItem และแก้ไขข้อมูล แล้ว PutItem เพื่ออัพเดท</li></ol><pre>// Use Get and Put Item<br>const milk = await dynamodbClient.get({<br>  TableName: &#39;product&#39; , <br>  Item: {pkey: &#39;milk&#39;}<br>}).promise();<br>const newMlik = { ...product.Item, total: product.Item.amount - 1 };<br><br>await dynamodbClient.put({<br>  TableName: &#39;product&#39;,<br>  Item: newMilk<br>}).promise();</pre><p>2. Update Item โดยใช้ Arithmetic Function</p><pre>await documentClient.update({<br>  TableName: &#39;product&#39;,<br>  Key: { pkey : &#39;milk&#39; },<br>  UpdateExpression: &#39;set #amount = #amount - :a&#39;,<br>  ConditionExpression: &#39;#amount &gt; :MIN&#39;,<br>  ExpressionAttributeNames: {&#39;#amount&#39; : &#39;amount&#39;},<br>  ExpressionAttributeValues: {<br>    &#39;:a&#39; : 1,<br>    &#39;:MIN&#39;: 0,<br>  }<br>}).promise();</pre><h4>Scanning</h4><p>การ Scan partition Key จะใช้ทรัพยากรณ์จำนวนมาก และค่อนข้างช้า ดังนั้นควรหลีกเลี่ยง และใช้งานเท่าที่จำเป็น กรณีต้องการ Scan พร้อมๆกัน ในปริมาณมากๆ สามารถใช้งาน Parallel Scan ได้ ซึ่งเหมาะกับ Table ขนาดใหญ่</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/0*a8dR7ZBLfLl2jAUC.png" /><figcaption>parallel scan</figcaption></figure><h3>Key Takeaway</h3><ol><li>Database Design</li><li>Database Configuration</li><li>Database Operation</li></ol><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FyNOVamgIXGQ%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DyNOVamgIXGQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FyNOVamgIXGQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e3d3254fe3af90735bf0dd90e8ab471e/href">https://medium.com/media/e3d3254fe3af90735bf0dd90e8ab471e/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FHaEPXoXVf2k%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DHaEPXoXVf2k&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FHaEPXoXVf2k%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/95ca79f45f26e9f7c77537072d88b78f/href">https://medium.com/media/95ca79f45f26e9f7c77537072d88b78f/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=330fb2a96652" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My year review 2022]]></title>
            <link>https://viruskizz.medium.com/my-year-review-2022-55a024debe4d?source=rss-4d083c033912------2</link>
            <guid isPermaLink="false">https://medium.com/p/55a024debe4d</guid>
            <category><![CDATA[year-in-review]]></category>
            <dc:creator><![CDATA[Araiva Viruskizz]]></dc:creator>
            <pubDate>Tue, 03 Jan 2023 16:15:57 GMT</pubDate>
            <atom:updated>2023-01-16T12:56:57.031Z</atom:updated>
            <content:encoded><![CDATA[<p>รีวิว ปี 2022 ของตัวเราเอง</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-59-VVwGM07avpOmqekY7Q.png" /><figcaption>coverage</figcaption></figure><h3>My Goal 2022</h3><ul><li>ตั้งใจพัฒนาทักษะทางด้านเขียนโปรแกรมของตัวเองให้มากขึ้น</li><li>ค้นหาประสบการณ์ในระบบสูง (Alway goal)</li></ul><h3>Achievement</h3><h4>Hard Skill</h4><ul><li>สกิลการเขียนโปรแกรมเติบโตขึ้น พอสมควร ได้เรียน ภาษา C ได้แลกเปลี่ยนประสบการณ์การเขียนโปรแกรม กับ คนอื่นๆ</li><li>ได้ศึกษา การทำ Animation บน JS</li><li>ได้กลับมา เขียน code หนักๆ ก็้ปีนี้ รู้สึกท้าทายและสนุกมาก</li><li><a href="https://github.com/viruskizz/viruskizz/tree/main/code-performance">viruskizz/code-performance at main · viruskizz/viruskizz (github.com)</a></li></ul><h4>Soft Skill</h4><ul><li>มีความอดทนต่อบุคคลได้มากขึ้น</li><li>ได้พบปะเพื่อนที่หลากหลาย</li></ul><h4>Moral</h4><ul><li>สั่งสมบุญได้มากขึ้น ได้อย่างเต็มที่</li></ul><h3>To my dear</h3><h4>Coach</h4><ul><li>ทุกๆคนรอบตัว คือ ครูของเรา</li></ul><h4>Sorry</h4><ul><li>ขอโทษไปยังเพื่อนๆ พี่น้องๆ ทุกคน อาจจะโหดร้ายใจไปหน่อย อาจจะใจร้อนไปหน่อย</li></ul><h4>Thank you</h4><ul><li>ขอบคุณทุกๆ โดยน้องๆ ที่คอยสอนพี่ๆ ให้ได้เรียนรู้ และ สะท้อนตัวเอง</li><li>ขอบคุณ 42Bangkok</li><li>ขอบคุณ อาจารย์ชัยยันต์ ที่ให้โอกาส ได้เป็น อาจารย์สอนวิชาพิเศษ ในนาม ม.ลาดกระบัง</li></ul><h4>in short</h4><blockquote>ปีที่หนักหน่วงสุดปีนึง แต่ก็สำเร็จได้อย่างน่าพอใจ</blockquote><h3>Moment of year</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/0*71qOYc4zVEL0SxpJ.png" /><figcaption><a href="https://wakatime.com/a-look-back-at-2022/4871f715-f781-4d1e-886c-72bdd622739c/vupzfqqmob">my code performance</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DhC_m7ICTsb2qvYhcbTYCg.jpeg" /><figcaption>Volunteer Merit</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jjPBrXSB2Abs4BzG8EV5DQ.png" /><figcaption>Cool Teammate</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FI4O5CVvwgFI%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DI4O5CVvwgFI&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FI4O5CVvwgFI%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/771e27783d4dc6148ec70b9100c01f55/href">https://medium.com/media/771e27783d4dc6148ec70b9100c01f55/href</a></iframe><h3>Next year Goal 2023</h3><p>เป้าหมายของตัวเองในปี 2023</p><h4>Hard Skill</h4><ul><li>เรียนรู้โครงสร้าง Architect ในแบบ Enterprise</li></ul><h4>Soft Skill</h4><ul><li>อยากจะใจเย็นลงกว่าเดิม</li><li>ดูแลสุขภาพให้มากขึ้น นอนไวกว่าเดิม</li></ul><h4>Moral</h4><ul><li>มีความสุข มีโมเม้น ได้พักผ่อน ให้กับตัวเอง</li><li>นั่งสมาธิ ให้มากขึ้น</li></ul><h3>My year Picture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DES4hTr0uRx3U9i0.png" /><figcaption>Keep clam and smile</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hi2XPqCdRrntQTc0WuUOuA.png" /><figcaption>Chill out moment</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=55a024debe4d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[my 42Bangkok Experience]]></title>
            <link>https://viruskizz.medium.com/my-42bangkok-experience-a481b611fec8?source=rss-4d083c033912------2</link>
            <guid isPermaLink="false">https://medium.com/p/a481b611fec8</guid>
            <category><![CDATA[piscine-c]]></category>
            <category><![CDATA[experience]]></category>
            <category><![CDATA[42-bangkok]]></category>
            <dc:creator><![CDATA[Araiva Viruskizz]]></dc:creator>
            <pubDate>Sat, 18 Dec 2021 15:22:26 GMT</pubDate>
            <atom:updated>2021-12-18T17:18:58.229Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KzwqjD1ZDZRiYiN5pOL69g.png" /><figcaption>42bangkok-piscine-cover</figcaption></figure><h3><strong>จบลงแล้วกับ 42 Bangkok Piscine #2</strong></h3><blockquote>แบ่งเล่าประสบการณ์ และ บันทึกความทรงจำดีๆ ลงในนี้</blockquote><h4>Registration and Pre-Test</h4><p>..เริ่มต้นกับการสมัคร บน <a href="https://www.42bangkok.com/">https://www.42bangkok.com/</a> ซึ่งเป็นการเล่นเลื่อนจรวดไปตามช่องให้ได้จุดสิ้นสุด ตามเงื่อนไข เหมือนใน <a href="https://code.org/">https://code.org/</a> เอาจริงผมทำได้ประมาณ 4–5 ข้อเนี่ยละ แต่ก็ผ่านรอบคัดเลือกอันแรกมาได้ Waiting List</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c7IRMPZcv1PxLJ7057-hgQ.png" /><figcaption>42 pre-registration game</figcaption></figure><h4>Waiting List</h4><p>…การรอคอยเข้าร่วม Piscine แคมป์ 1 เดือนที่ล่ำลือกันว่าโหด ผมกดต่อคิวที่รอบ 2 ไว้ เป็น Wait List 41 คือ มันเต็ม ต้องรอโอกาสจากคนที่คิวไปแล้วยกเลิก ถึงจะมีสิทธิ์ รอไปเรื่อยๆ จนวันสุดท้าย เราก็ได้รับอีเมลล์วันที่อาทิตย์ที่ 21 พฤศจิกายน (ก่อนงานวันเดียว) ให้ เข้าร่วมได้พรุ่งนี้ช่วงบ่าย</p><blockquote>มาไม่ทันตั้งตัว แต่ก้ต้องพร้อมทุกความเปลี่ยนแปลง</blockquote><h4>Start Point</h4><p>…ในรุ่นนี้ เริ่มต้นประมาน 60 คน มีทั้งคนที่เรียนสายตรงมา และ คนที่ไม่ได้เรียนสายนี้มา ส่วนตัวเราเอง มีประสบการณ์ด้านนี้มา แต่ก็เป็นประสบการณ์ที่ผ่านการศึกษาด้วยตัวเอง สำหรับ ภาษา C นั้น ก็ไม่มีความรู้อะไรเลย นับว่าเป็น 0 เลยก็ว่าได้</p><h4>Getting Started</h4><p>…การเข้าร่วมทีหลัง และกระทันหัน วันแรกกับการเรียนรู้ระบบการเรียนใน 42 ที่เยอะมหาศาล ไม่ว่าจะเป็น</p><p>— Guacamole เครื่องมือหลักสำหรับงานนี้ เป็นเหมือน Online Terminal ที่จะทำให้เราสามารถเข้าไปยัง Server ได้</p><p>— <a href="https://42.fr/">https://42.fr/</a> เว็ปไซต์สำหรับลงทะเบียนเนื้อหากิจกรรมต่างๆ และจำเป็นที่จะต้องมีกลุ่ม Village ที่ช่วยกันรู้ แต่เราก้สามารถเรียนกันข้าม Village ได้</p><p>— Peer-2-Peer รูปแบบการเรียนที่เน้นผู้เรียนเป็นหลัก เรียนรู้จากกันและกัน โดยใช้โปรเจคเป็นตัวชี้วัด โยการส่งงาน 1 ครั้ง จำเป็นต้องขอให้เพื่อนตรวจ 2 คน ซึ่งจะเสีย 2 point evaluate และ จำเป็นที่เราจะต้องไปตรวจคนอื่นซึ่งจะได้มา คนละ 1 point เช่นกัน</p><p>— Moulinette ตัวบอทตรวจการบ้าน บอกเลย ตัวนี้ คือที่สุด ละเอียดทุกตัวอักษรแม้กระทั่งการเคาะบรรทัด ถ้าคุณผ่านมันไปได้คุณจะได้คะแนน (sequence point)</p><p>— Norminette รูปแบบ code style ตามกำหนด การเคาะบรรทัด การย่อหน้า จำนวนแถว ความยาว ต้องตามที่กำหนดเท่านั้น ถึงจะผ่านได้</p><blockquote>วันแรก ถึงกับ Ram สมองเต็มกันเลยทีเดียว</blockquote><h4>Leveling System</h4><p>เป็นระบบนึงที่ผมชื่นชอบ รู้สึกได้เห็นชัดเจนถึงความสามารถของเราในแต่ละด้าน เป็นแนวค่าประสบการณ์</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FLvDSgVRMwMiT18-ByTKbQ.png" /><figcaption>Skill-Graph</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5XjSjZl3tJOPnOZFUmAuFQ.png" /><figcaption>leveling-histories</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kHNGBbrCYiGFc5eG3JkQzg.png" /><figcaption>leveling-histories-list</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*heHXhB6N6aQY7URu" /><figcaption><a href="https://github.com/viruskizz/42bangkok-piscinec-scripts">viruskizz/42bangkok-piscinec-scripts: Utility for 42Bangkok Scripts (github.com)</a></figcaption></figure><h4>My Support</h4><p>…วันแรกหลายๆ คนต้องเรียนกับการใช้งาน Git เพื่อส่งงาน ซึ่งหลายคนไม่ค่อยคล่อง ดูทรงแล้วทุกคนน่าจะลำบาก เราเลยอาสาเปิด session แนะนำการใช้ Git ขึ้น ความยาวกว่า 2 ชม. เพื่อให้ทุกๆคน สามารถส่งงานได้</p><blockquote>คอแห้ง แต่ก็ดีใจที่ทุกทำได้</blockquote><p>….เกี่ยวกับการเรียนภาษา C และการตรวจการบ้าน เนื่องจากว่า การส่งการบ้านทุกคนจะไม่มีการส่ง main.c ของตัวเองขึ้นไป และการตรวจการบ้าน จำเป็นต้องใช้ main.c เพื่อทดสอบ code ของเพื่อน รวมถึงการเขียน Test case ที่ครบถ้วนเพื่อตรวจสอบผลลัพธ์ตามโจทย์</p><blockquote>อ้าวจะตรวจกันยังไง จะพิมพ์กันหน้างานหรือ นั่นละประเด็น อีกทั้งการทดสอบต้องครอบคลุมพอที่จะสู้กับ มูมู่ ถึงจะผ่านได้</blockquote><p>จึงมีเทพผู้นำที่ช่วยอัพโหลด main.c สำหรับทดสอบ code ในแต่ละขอในแต่ละบท (แนะนำให้ทุกคนทำของตัวเองด้วย เพื่อการฝึกฝน) ผมเองก็มีไอเดียที่จะทำ Automate test ด้วย shell script โดยใช้ความรู้จากบทเรียน Shell เพื่อช่วยอำนวยความสะดวกให้กับ ตนเอง และ ทุกๆคน โดยสามารถทดสอบทุกข้อเพียงคลิ้กเดียว</p><h4>The war of coding camp</h4><p>มัน คือ สงคราม แต่มันก็มีความสนุกซ่อนอยู่</p><ol><li>การสู้ที่เราต้องต่อสู้กับตัวเรา ซึ่งมันเป็นสิ่งที่สำคัญอันดับแรกและสำคัญที่สุดในการผ่าน Piscine ทั้งความไม่เข้าใจในเนื้อหาที่เรียน การจัดการเวลาชีวิตของตัวเราเอง การที่เราต้องเข้าสังคมให้มากขึ้น การปรับตัวให้เข้ากับที่ใหม่ ปรับตัวเข้ากับระบบ และอีกหลายๆอย่าง</li><li>การต่อสู้กับโปรแกรม เราต้องเขียนโปรแกรมตามโจทย์ที่ได้รับมา ให้ถูกต้องแปะๆ ต่อสู้กับ Norm ที่ต้อง Code ต้องสวยตามระเบียบ การต่อสู้กับ Moulinette ที่เราเหมือนตาบอด ต้องเสี่ยงในการโดนตรวจในครั้งแรกๆ มันก็สนุกดีลุ้นๆ</li><li>ต่อสู้กับเวลาที่บีบคั้น และมีไม่มาก แถมโจทย์ยังยากอีก อย่างโปรเจค Rush ที่เป็นงานกลุ่มที่จำเป็นต้องทำร่วมกัน 4 – 5 คน ในวันเสาร์อาทิตย์ การเรียนในแต่ละบทเพื่อให้มีความรู้เพียงพอไปสอบวันศุกร์ท้ายสัปดาห์ และที่โหดหินที่สุด คือ BSQ งานคู่ที่มีเวลาเพียง 3 วัน แต่ยากและเงื่อนไขมหาศาล บอกเลยคุณต้องพิมพ์โค้ดกันทั้งวัน ถึงจะเสร็จทัน</li></ol><blockquote>มัน คือ ความท้าทาย ที่ลงตัว</blockquote><h4>The Finale</h4><p>…ในวันท้ายๆ ประชากรใน รุ่น 2 เริ่มหายกันไปเรื่อยๆ เกิดเหตุการณ์ขาดแคลน Evaluate Point อยากส่งแต่ไม่มีคะแนนพอที่จะส่ง เพราะคนเหลือน้อย แต่ก็ผ่านมาได้เพราะ Staff ช่วยเหลือ</p><p>…วันสอบสุดท้ายที่ยาวนาน กว่า 8 ชม. ตั้งแต่ 10.00 – 18.00 น. คือ ต้องกินข้าวไป เขียน Code ไป เป็นการสอบที่มาราธอน มากๆ แต่สุดท้ายก็ผ่านมาได้ ตัวเราเองทำได้ 11 ข้อ รวม 66 คะแนน</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uw7fWWJRqYndf6TKmIwokQ.png" /><figcaption>piscine-c-final-exam</figcaption></figure><h4>My Feeling</h4><p>…มันเป็นความรู้สึกที่ปะปนไปหมด ทั้งความสนุก ความเหนื่อยล้า ความท้าทาย กิจกรรมนี้ทำให้ผมรู้สึกเหมือนกลับไปฝึกเรียนเขียน code ใหม่สมัยก่อน ได้พบกันเพื่อนดีๆ ในที่นี้ ที่ช่วยกันเรียน ช่วยให้คำแนะนำกัน เขียน code กันทั้งวัน ทั้งคืน คิดโจทย์จนหัวหมุน กลับเอาไปนอนคิดต่อ บางคืนก็นอนไม่หลับ เพราะสมองมันไม่หยุดคิด เกือบ 1 เดือนที่นอนน้อยมาก เขียน code หนักมาก แต่มันเป็นประสบการณ์ที่ดี ที่หาได้ยาก</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ea27upwKCn8DPgAkk4QoEA.png" /><figcaption>our piscine team</figcaption></figure><h4>PS.</h4><p>สุดท้าย ก็ขอขอบคุณเพื่อนๆทุกคน นะครับ ที่ช่วยกันทั้งให้กำลัง ทั้งแบ่งปันความรู้ จนพวกเราเกือบทั้งหมดผ่านกันมาได้จนถึงวันสุดท้าย</p><h4><em>Resource:</em></h4><p>Github: <a href="https://github.com/viruskizz/42bangkok-piscinec-scripts">viruskizz/42bangkok-piscinec-scripts: Utility for 42Bangkok Scripts (github.com)</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a481b611fec8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NestJS Mongoose: How to populated schema]]></title>
            <link>https://viruskizz.medium.com/nestjs-mongoose-how-to-populated-schema-de469ab778dc?source=rss-4d083c033912------2</link>
            <guid isPermaLink="false">https://medium.com/p/de469ab778dc</guid>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[mongoose]]></category>
            <category><![CDATA[nestjs]]></category>
            <dc:creator><![CDATA[Araiva Viruskizz]]></dc:creator>
            <pubDate>Sun, 30 Aug 2020 07:33:26 GMT</pubDate>
            <atom:updated>2020-08-30T07:33:26.206Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*B3ZicH7wr4fuSio0BEUkSQ.png" /><figcaption>reference schema nestjs/mongoose</figcaption></figure><p>การใช้งาน MongoDB บน NestJS จำเป็นต้องติดตั้ง <a href="https://github.com/nestjs/mongoose">NestJS/Mongoose</a> เข้าไปใน project และตั้งค่าต่างๆ ตาม <a href="https://docs.nestjs.com/techniques/mongodb">Document</a> การกำหนด Schema และการใช้งานพื้นฐาน อ่านได้ตามคู่มือได้เลย</p><p>ในที่นี้เราจะมากล่าวถึงการทำ Schema ที่ซับซ้อนยิ่งขึ้น คือ การผูกข้อมูลเชิงสัมพันธ์</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/384/1*59bXs05VzcETR7D9sK-VQw.png" /><figcaption>1-n relationship</figcaption></figure><p>กรณีcollection มีการอ้างอิงข้อมูลในรูปแบบ one-to-many แล้ว จำเป็นต้องทำ reference model และการเรียก populate ข้อมูลใน document เพิ่มเติมดังต่อไปนี้</p><p>ประกาศ Schema ของ Field นั้นเป็น ObjectId และ Reference ชื่อ collection ให้ถูกต้อง</p><p><strong>การ import artists Schema ใน Feature Module</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NYnisRE-oSoaRNs2fPiAxg.png" /></figure><p><strong>การประกาศ Track Schema Type ใน Track</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wV5bjhq2ufS_VNtcCa1Pgw.png" /><figcaption>track.schema.ts</figcaption></figure><p><strong>การเรียกใช้แบบ artist แบบ populated reference ใน service</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wMTl3kEh3Rib9MDPdS7b8A.png" /><figcaption>track.service.ts</figcaption></figure><p>เมื่อทดลองเรียกผ่าน postman ก็จะได้ผลลัพธ์แบบนี้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Sqk-dsiQBqpCyst0QqJKw.png" /><figcaption>result-postman</figcaption></figure><p>จะเห็นว่าที่ artist_info จะมีข้อมูลของ Artist เข้ามาด้วย ซึ่งข้อมูลที่ถูกเก็บอยู่ในฐานข้อมูลจะถูกเก็บเพียง id เท่านั้น</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D9A_SpTKe8GiC9AeRpxzBw.png" /><figcaption>mongodb-document</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de469ab778dc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Observable]]></title>
            <link>https://viruskizz.medium.com/observable-a3853bc0f1b3?source=rss-4d083c033912------2</link>
            <guid isPermaLink="false">https://medium.com/p/a3853bc0f1b3</guid>
            <category><![CDATA[observables]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[reactive-programming]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Araiva Viruskizz]]></dc:creator>
            <pubDate>Sun, 05 Jul 2020 09:59:24 GMT</pubDate>
            <atom:updated>2020-07-06T02:36:48.943Z</atom:updated>
            <content:encoded><![CDATA[<h3>Observable Basic</h3><p>พื้นฐาน Observable อย่างง่าย</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jG8od0VuxmYkUGm3.png" /></figure><p>ซึ่งโปรเจคนี้ จะอธิบายเกี่ยวกับ แสดงรายชื่อผู้ใช้ในลิสทางซ้ายมือ ที่เก็บอยู่ในรูปแบบของ array ซึ่งอยู่บน show-list.component เมื่อผู้ใช้คลิ้กเลือก จะแสดงผลที่หน้าต่างทางขวามือที่เก็บอยู่ในรูปแบบของ object ซึ่งอยู่บน show-detail.component และ มีตัวเลขแสดงผล ลำดับของผู้ใช้ที่ถูกเลือก อยู่ในหน้าต่างด้านล่างสามารถ ซึ่งอยู่บน selector.component ดูตัวอย่าง code ได้บน Github</p><p><a href="https://github.com/viruskizz/angular-observable-basic">Code Demo</a></p><h3>Simply Application Structure</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6jsJk74dL6lxYdmO.png" /><figcaption>application structure</figcaption></figure><p>การทำงานระหว่าง component จะเรียกผ่าน database.service โดย show-list.component จะดึงค่า array จาก service และเมื่อผู้ใช้ กดที่ list จะนำไปเปลี่ยน currentIndex ที่อยู่ใน data.service เพื่อให้อีก component หนึ่งแสดงผล profile ที่ได้กดเลือก</p><h3>File: show-list.component.ts</h3><pre>export class ShowListComponent implements OnInit {<br>  list: Profile[] | any[];<br>  <br>  constructor(private databaseService: DatabaseService) { }  </pre><pre>  ngOnInit(): void {<br>    this.list = this.databaseService.getList();<br>  }<br>  <br>  onSelect(index) {<br>    this.databaseService.setCurrentIndex(index);<br>  }<br>  <br>  sumPoint = (scores: Score[]) =&gt; scores.reduce((total, cur) =&gt; total + cur.point, 0);<br>}</pre><h3>File: show-detail.component.ts</h3><pre>export class ShowListComponent implements OnInit {<br>  list: Profile[] | any[];<br>  <br>  constructor(private databaseService: DatabaseService) { }  <br><br>  ngOnInit(): void {<br>    this.list = this.databaseService.getList();<br>  }<br>  <br>  onSelect(index) {<br>    this.databaseService.setCurrentIndex(index);<br>  }<br>  <br>  sumPoint = (scores: Score[]) =&gt; scores.reduce((total, cur) =&gt; total + cur.point, 0);<br>}</pre><h3>File: data.service.ts</h3><pre>import {data} from &#39;../db/profiles&#39;;<br>export class DatabaseService {<br>  private readonly db: Profile[] = data;<br>  private currentIndex = 0;<br>  <br>  constructor() {}<br>  <br>  getList(): Profile[] {<br>    return this.db;<br>  }</pre><pre>  setCurrentIndex(index: number): void {<br>    this.currentIndex = index;<br>  }<br>  <br>  getProfile(): Profile {<br>    return this.db[this.currentIndex];<br>  }<br>}</pre><h3>ผลลัพธ์ที่เกิดขึ้น</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9vzA6PxhWDCu0z_f.gif" /><figcaption>observable with database service</figcaption></figure><p>เมื่อคลิ้กที่รายชื่อ profile ทางขวามือกลับไม่เปลี่ยนไปตาม currentIndex เมื่อเรา console.log() ค่าของ currentIndex ใน database.service จะเห็นว่า ค่า currentIndex ได้เปลี่ยนแล้ว แต่ show-detail กลับยังไม่แสดงผล profile คนใหม่ขึ้นมา</p><h3>สาเหตุของปัญหา</h3><p>โดยปกติทั่วไปของ ตัวแปร (variable) จะสามารถรับค่าได้เพียงแค่ครั้งเดียว แต่เมื่อค่าของตัวแปรมีการเปลี่ยนแปลงใน บรรเดิม จะไม่ถูกเปลี่ยนแปลงในหน้า Interface หรือ Console เพราะว่า Program ได้รัน code ผ่านบรรทัดนั้นไปเสียแล้ว คล้ายๆกับตัวอย่างด้านล่าง</p><pre>let index = 0<br>setTimeout(() =&gt; {index = 1}, 2000);<br>console.log(index); // &lt;&lt;= อยากให้แสดงผล index = 1 ด้วยเมื่อค่า index เปลี่ยนแปลง</pre><p>ดังนั้นถ้าเราอยากให้ตัวแปร profile สามารถเปลี่ยนแปลงค่าได้ เรามีความจำเป็นที่จะต้องสร้างตัวแปรนั้นให้อยู่ในรูปแบบของ Observable เสียก่อน</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BifWC7-frzc9oHWo.png" /><figcaption>observable concept</figcaption></figure><p>โดยหลักการทำงาน คือ มีตัวแปรชนิด Subject ที่สามารถสร้าง event ของค่าที่เปลี่ยนแปลงได้เป็น Stream Line ของ Value ที่เกิดขึ้นในแต่ละช่วงเวลา เหมือนดังรูปตัวอย่างที่เรามักเห็นการบ่อยตามคู่มือ rxjs</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/60/0*a1yTBja7uU7a4e1D" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*JmHA52WeGstOoUX4.png" /><figcaption>stream line example</figcaption></figure><p>จุดสีแสดงถึง ค่าของตัวแปร ที่เปลี่ยนแปลงไปในแต่ละช่วงเวลา และเมื่อมีการเปลี่ยนแปลงตัวแปร <strong><em>Observer</em></strong> ที่กำลังมองดูการเปลี่ยนอยู่ก็สามารถเห็นการเปลี่ยนแปลง และแสดงผลลัพธ์ผ่านการ subscribe ได้</p><blockquote><em>Subscribe ก็คล้ายๆกับ เราเป็นคนดู Youtube อยู่แล้ว ติดตามช่องต่างๆไว้ (subscribe)เมื่อมีการอัพเดทข้อมูลใหม่ๆที่ช่องนั้นเราก็จะได้รับข่าวสารทันที</em></blockquote><p>เราจะปรับโครงสร้าง application ปัจจุบันของเรา ให้รองรับการเปลี่ยนแปลงค่าของตัวแปรที่จะเกิดขึ้นในที่ต่างๆของ Application ตาม concept ของ observable</p><h3>Application with Observable</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2IU_4Tk-9NVjsGPs.png" /></figure><p>โดยเราจะสร้าง Subject อยู่ใน profile.service แทน database.service และเชื่อม component ต่างๆผ่าน profile.service</p><h3>File: profile.service.ts</h3><pre>import {data} from &#39;../db/profiles&#39;;export class ProfileService {  </pre><pre>public profiles$ = new BehaviorSubject&lt;Profile[]&gt;([]);<br>  public profile$ = new Subject&lt;Profile&gt;();<br>  public currentIndex$ = new Subject&lt;number&gt;();<br>  <br>  constructor() {<br>    this.profiles$.next(data);<br>  }</pre><pre>  getList(): Profile[] {<br>    return this.profiles$.getValue();<br>  }<br>  <br>  setCurrentIndex(index: number): void {<br>    this.currentIndex$.next(index);<br>    const selectProfile = this.profiles$.value[index];<br>    this.profile$.next(selectProfile);<br>  }<br>}</pre><p>ปรับเปลี่ยน File component เล็กน้อย</p><h3>File: show-list.component.ts</h3><pre>export class ShowListComponent implements OnInit {  list: Profile[] | any[];<br>  <br>   constructor(private profileService: ProfileService) { }  <br>   <br>   ngOnInit(): void {<br>     this.list = this.profileService.getList();<br>   }<br>  <br>  onSelect(index) {<br>    this.profileService.setCurrentIndex(index);<br>  }<br>  <br>  sumPoint = (scores: Score[]) =&gt; scores.reduce((total, cur) =&gt; total + cur.point, 0);<br>}</pre><h3>File: show-detail.component.ts</h3><pre>export class ShowDetailComponent implements OnInit {<br>  profile: Profile;<br>  profileAsync: Observable&lt;Profile&gt;;<br>  <br>  constructor(public profileService: ProfileService) { }  <br>  <br>  ngOnInit(): void {<br>    this.profileService.profile$.subscribe(profile =&gt; {<br>      this.profile = profile;<br>    });<br>    this.profileAsync = this.profileService.profile$;<br>  }<br>}</pre><h3>ผลลัพธ์ที่เกิดขึ้น</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BaiXVr686nVR_Cub.gif" /><figcaption>observable with profile service</figcaption></figure><p>จะเห็นได้ว่าเมื่อกดรายการทางซ้ายมือแล้ว profile detail ทางขวามือ ก็จะเปลี่ยนแปลงตามด้วย</p><p>สำหรับ โปรเจคนี้ก็เป็นตัวอย่างง่ายๆ สำหรับการเริ่มใช้งาน Subject และ Observable หวังว่าเพื่อนๆจะเข้าใจมากขึ้นครับ สามารถอ่านและศึกษาข้อมูลเพิ่มเติมได้ตามแหล่งเนื้อหาด้านล่างที่ได้รวบรวมไว้ได้เลย</p><h3>Resources</h3><ul><li><a href="https://medium.com/@benlesh/on-the-subject-of-subjects-in-rxjs-2b08b7198b93">On The Subject Of Subjects (in RxJS)</a></li><li><a href="https://netbasal.com/when-to-unsubscribe-in-angular-d61c6b21bad3">When to Unsubscribe in Angular</a></li><li><a href="https://medium.com/@tonkla/4-%E0%B8%A7%E0%B8%B4%E0%B8%98%E0%B8%B5%E0%B9%80%E0%B8%A5%E0%B9%88%E0%B8%99%E0%B8%81%E0%B8%B1%E0%B8%9A-asynchronous-%E0%B9%83%E0%B8%99-javascript-45bcedce0b31">4 วิธีเล่นกับ Asynchronous Function ใน JavaScript</a></li><li><a href="https://www.youtube.com/watch?v=jgWnccjXR4I">Callbacks vs Promises vs RxJs Observables vs async/ await</a></li><li><a href="https://www.youtube.com/watch?v=T9wOu11uU6U&amp;list=PL55RiY5tL51pHpagYcrN9ubNLVXF8rGVi&amp;index=1">RxJS — What and Why?</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a3853bc0f1b3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>