<?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 Sutean Rutjanalard on Medium]]></title>
        <description><![CDATA[Stories by Sutean Rutjanalard on Medium]]></description>
        <link>https://medium.com/@mossila?source=rss-a1721c5fad24------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*56j759B33xeRsVGu.jpg</url>
            <title>Stories by Sutean Rutjanalard on Medium</title>
            <link>https://medium.com/@mossila?source=rss-a1721c5fad24------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 03:07:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mossila/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[ทดสอบ Youtube Content]]></title>
            <link>https://medium.com/@mossila/%E0%B8%97%E0%B8%94%E0%B8%AA%E0%B8%AD%E0%B8%9A-youtube-content-8a287e58226e?source=rss-a1721c5fad24------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a287e58226e</guid>
            <dc:creator><![CDATA[Sutean Rutjanalard]]></dc:creator>
            <pubDate>Fri, 28 Jun 2024 08:04:48 GMT</pubDate>
            <atom:updated>2024-06-28T08:04:48.948Z</atom:updated>
            <content:encoded><![CDATA[<iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FhbcGx4MGUMg%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DhbcGx4MGUMg&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FhbcGx4MGUMg%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/10e15b155898292404906da771d31fba/href">https://medium.com/media/10e15b155898292404906da771d31fba/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a287e58226e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[เขียน React + Route ด้วย TypeScript]]></title>
            <link>https://medium.com/@mossila/%E0%B9%80%E0%B8%82%E0%B8%B5%E0%B8%A2%E0%B8%99-react-route-%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2-typescript-e7dc70885122?source=rss-a1721c5fad24------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7dc70885122</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[router]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Sutean Rutjanalard]]></dc:creator>
            <pubDate>Sun, 10 Nov 2019 10:10:47 GMT</pubDate>
            <atom:updated>2019-11-10T10:10:47.867Z</atom:updated>
            <content:encoded><![CDATA[<p>Update 10/Nov/2019</p><p>Prerequisite <br>- node, npm, create-react-app, yarn <br>- Optional — <a href="https://medium.com/@mossila/%E0%B8%AA%E0%B8%A3%E0%B9%89%E0%B8%B2%E0%B8%87-react-typescript-dev-environment-%E0%B8%9A%E0%B8%99-ubuntu-18-40-b8599f9e50dc">เตรียมบน Ubuntu</a></p><ol><li>เริ่มต้นด้วย Basic Tool ที่ใช้ในการ Setup Project ง่ายๆ <a href="https://github.com/facebook/create-react-app">create-react-app</a></li></ol><pre>npx create-react-app basic-web --typescript<br>cd basic-web<br>yarn<br>yarn add <a href="http://twitter.com/types/react-router-dom">@types/react-router-dom</a><br>yarn start</pre><p>2. แก้ไขไฟล์ index.tsx ด้วยการเพิ่ม BrowserRouter เพื่อเป็นตัวช่วยในการ Route ไป Component ต่างๆ ใน WebApp ของเรา</p><pre>import React from &quot;react&quot;;<br>import ReactDOM from &quot;react-dom&quot;;<br>import &quot;./index.css&quot;;<br>import App from &quot;./App&quot;;<br>import * as serviceWorker from &quot;./serviceWorker&quot;;<br>import { BrowserRouter } from &quot;react-router-dom&quot;;</pre><pre>ReactDOM.render(<br>  &lt;BrowserRouter&gt;<br>    &lt;App /&gt;<br>  &lt;/BrowserRouter&gt;,<br>  document.getElementById(&quot;root&quot;)<br>);</pre><pre>// If you want your app to work offline and load faster, you can change<br>// unregister() to register() below. Note this comes with some pitfalls.<br>// Learn more about service workers: <a href="https://bit.ly/CRA-PWA">https://bit.ly/CRA-PWA</a><br>serviceWorker.unregister();</pre><p>3. แก้ไข App.tsx</p><pre>import React from &quot;react&quot;;<br>import &quot;./App.css&quot;;<br>import {<br>  Switch,<br>  Route,<br>  Link,<br>  useRouteMatch,<br>  useParams<br>} from &quot;react-router-dom&quot;;<br>const App: React.FC = () =&gt; {<br>  return (<br>    &lt;div&gt;<br>      &lt;ul&gt;<br>        &lt;li&gt;<br>          &lt;Link to=&quot;/&quot;&gt;Home&lt;/Link&gt;<br>        &lt;/li&gt;<br>        &lt;li&gt;<br>          &lt;Link to=&quot;/about&quot;&gt;About&lt;/Link&gt;<br>        &lt;/li&gt;<br>      &lt;/ul&gt;</pre><pre>       &lt;Switch&gt;<br>        &lt;Route path=&quot;/about&quot;&gt;<br>          &lt;About /&gt;<br>        &lt;/Route&gt;<br>        &lt;Route path=&quot;/&quot;&gt;<br>          &lt;Home /&gt;<br>        &lt;/Route&gt;<br>      &lt;/Switch&gt;<br>    &lt;/div&gt;<br>  );<br>};<br>function Home() {<br>  return &lt;h2&gt;Home&lt;/h2&gt;;<br>}</pre><pre>function About() {<br>  return &lt;h2&gt;About&lt;/h2&gt;;<br>}<br>export default App;</pre><p>เมื่อรัน yarn start แล้วเปิดไปที่ localhost:3000 จะเห็นว่ามี Link ที่เราสามารถกดเพื่อสลับไปมาระหว่าง component ได้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/378/1*GVaFZpm05bq5MBLtAxhclw.png" /></figure><p>อ่านต่อที่ <a href="https://reacttraining.com/react-router/web/guides/quick-start">https://reacttraining.com/react-router/web/guides/quick-start</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7dc70885122" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[สร้าง React + TypeScript Dev Environment บน Ubuntu 18.40]]></title>
            <link>https://medium.com/@mossila/%E0%B8%AA%E0%B8%A3%E0%B9%89%E0%B8%B2%E0%B8%87-react-typescript-dev-environment-%E0%B8%9A%E0%B8%99-ubuntu-18-40-b8599f9e50dc?source=rss-a1721c5fad24------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8599f9e50dc</guid>
            <dc:creator><![CDATA[Sutean Rutjanalard]]></dc:creator>
            <pubDate>Sun, 10 Nov 2019 09:13:34 GMT</pubDate>
            <atom:updated>2019-11-10T09:13:34.376Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*nhzMheEpF7XND20VzDCT7g.png" /></figure><h4>เปิด Terminal แล้วทำการ install packages ต่อไปนี้</h4><pre>sudo apt install git<br>sudo app install npm <br>sudo apt install curl<br>curl -sL <a href="https://deb.nodesource.com/setup_10.x">https://deb.nodesource.com/setup_10.x</a> -o nodesource_setup.sh<br>sudo bash nodesource_setup.sh<br>sudo apt-get install -y nodejs<br>sudo npm install -g create-react-app</pre><p>เพียงเท่านี้ก็ก็มี Environment ที่พร้อมสำหรับที่จะพัฒนา React website บน Ubuntu 18.04 แล้ว</p><h4>ทำไมถึงเลือก 18.04</h4><p>เพราะว่า 19.10 ยังมีหลายอย่างที่ไม่ Compatible กันเช่นพวก node version ต่างๆ แต่ว่า 18.04 LTS ก็คือ Long term support ที่มีการ Support ยาวๆ แล้วมี stable update ออกมาเรื่อยๆ อยู่แล้วไม่จำเป็นต้อง Upgrade ไปเวอร์ชันล่าสุดเสมอไปครับ</p><h3>Software อื่นๆ</h3><h4>Visual Studio Code</h4><p>สามารถติดตั้งจาก Ubuntu Software ได้เลย</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*LDa2_yNhD1SbqXyGeKA6sQ.png" /></figure><h4>GitHub Desktop</h4><p>Download package .deb จาก fork ของ shiftkey <a href="https://github.com/shiftkey/desktop/releases">https://github.com/shiftkey/desktop/releases</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*hAKuqOMG3bsE3RiWY501JQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8599f9e50dc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git Delete branch]]></title>
            <link>https://medium.com/@mossila/git-delete-branch-1b6b196347b4?source=rss-a1721c5fad24------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b6b196347b4</guid>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Sutean Rutjanalard]]></dc:creator>
            <pubDate>Wed, 03 Oct 2018 09:32:25 GMT</pubDate>
            <atom:updated>2020-09-08T04:32:58.005Z</atom:updated>
            <content:encoded><![CDATA[<ol><li>List all branches</li></ol><p>git branch</p><p>2. List all remote/local branch</p><p>git branch -a</p><p>3. Delete remote and delete local.</p><blockquote>$ git push --delete &lt;remote_name&gt; &lt;branch_name&gt;<br>$ git branch -d &lt;branch_name&gt;</blockquote><p>4. Filter and delete</p><pre>git branch | grep &lt;filter&gt; | xargs git branch -d</pre><p>5. Filter and delete the remote branch</p><pre>git branch | grep &lt;filter&gt; | xargs git push --delete origin</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b6b196347b4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Running Go behind IIS]]></title>
            <link>https://medium.com/@mossila/running-go-behind-iis-ce1a610116df?source=rss-a1721c5fad24------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce1a610116df</guid>
            <category><![CDATA[isis]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[aspnetcore]]></category>
            <dc:creator><![CDATA[Sutean Rutjanalard]]></dc:creator>
            <pubDate>Mon, 01 Oct 2018 03:18:53 GMT</pubDate>
            <atom:updated>2019-05-27T02:24:32.766Z</atom:updated>
            <content:encoded><![CDATA[<p>Since 2014 there was <a href="http://www.wadewegner.com/2014/12/4-simple-steps-to-run-go-language-in-azure-websites/">4 simple steps to run Go Language in Azure Website</a> but now its outdated. By <a href="https://github.com/aspnet/IISIntegration/issues/105">HttpPlatformHandler has been replaced by ASP.NET Core Module</a>. But anyway I’m forced to run Go on Windows Server. So here is how.</p><ol><li>Start with simple go program that can serve as Http Service.</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7d0e61eaa68f40b6ad0148a4438e9fc0/href">https://medium.com/media/7d0e61eaa68f40b6ad0148a4438e9fc0/href</a></iframe><p>Point is getting the right environment variable from ANCM call ASPNETCORE_PORT</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/0*BrkL5UALcBlLfLkz" /></figure><p>So the the port :1234 on this picture is ASPNETCORE_PORT on your environment variable, you can find more environment variable that set by ANCM from <a href="https://github.com/aspnet/IISIntegration/blob/e225a7ba09f899b7be8fc85c299a5389690235ee/src/Microsoft.AspNetCore.Server.IISIntegration/WebHostBuilderIISExtensions.cs">here</a>.</p><p>2. Create web.config to Host on IIS.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7ee411ccdb3fbeafcc250941222588b6/href">https://medium.com/media/7ee411ccdb3fbeafcc250941222588b6/href</a></iframe><p>It’s simple as normal asp.net core exe application.</p><p>3. To run on IIS, Create Application pool with No Managed Code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/302/1*6pLBqjDSZnb_F5rWKxkJmA.png" /></figure><p>And config Physical path to web.config and our .exe file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*058K7oQqnn6LtYc8RMA8zw.png" /></figure><p>Then Start, and go to <a href="http://localhost/">http://localhost</a>:&lt;your setup port&gt;(for this setup just <a href="http://localhost/">http://localhost</a>). <br>That’s all.</p><p>The problem that I can not run on HttpPlatformHandler, because I have to use SSE to service clients but the HttpPlatformHandler itself have 8k buffer so that the SSE message can not sent to client instantly but Update version of HttpPlatformHandler (ASP.NET Core Mudule) already fix that problem but it’s have internal change so the same config on HttpPlatformHandler can not use with ASP.NET Core Mudule.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce1a610116df" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ให้ vim เปลี่ยน tab เป็น space]]></title>
            <link>https://medium.com/@mossila/%E0%B9%83%E0%B8%AB%E0%B9%89-vim-%E0%B9%80%E0%B8%9B%E0%B8%A5%E0%B8%B5%E0%B9%88%E0%B8%A2%E0%B8%99-tab-%E0%B9%80%E0%B8%9B%E0%B9%87%E0%B8%99-space-882ab85698d6?source=rss-a1721c5fad24------2</link>
            <guid isPermaLink="false">https://medium.com/p/882ab85698d6</guid>
            <category><![CDATA[vim]]></category>
            <dc:creator><![CDATA[Sutean Rutjanalard]]></dc:creator>
            <pubDate>Tue, 25 Jul 2017 09:36:22 GMT</pubDate>
            <atom:updated>2017-07-25T09:36:22.305Z</atom:updated>
            <content:encoded><![CDATA[<p>เพิ่ม config นี้เข้าไปใน .vim</p><pre>set tabstop=2 #จำนวน space <br>set shiftwidth=2 #ตอน reindent ด้วย &lt;&lt; หรือ &gt;&gt;<br>set expandtab #เปลี่ยน tab เป็น space</pre><p>ถ้าต้องการเปลี่ยน file เดิมไปตาม settings ใหม่นี้</p><pre>:retab</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=882ab85698d6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tree command นี้เจ๋ง]]></title>
            <link>https://medium.com/@mossila/tree-command-%E0%B8%99%E0%B8%B5%E0%B9%89%E0%B9%80%E0%B8%88%E0%B9%8B%E0%B8%87-feb89796099?source=rss-a1721c5fad24------2</link>
            <guid isPermaLink="false">https://medium.com/p/feb89796099</guid>
            <category><![CDATA[macos]]></category>
            <category><![CDATA[bash]]></category>
            <dc:creator><![CDATA[Sutean Rutjanalard]]></dc:creator>
            <pubDate>Tue, 25 Jul 2017 09:24:56 GMT</pubDate>
            <atom:updated>2017-07-25T09:24:56.777Z</atom:updated>
            <content:encoded><![CDATA[<p>มันเป็น command ที่บน Mac เราสามารถ install ได้โดย</p><pre>brew install tree</pre><p>จากนั้นสิ่งที่มันทำให้คือ list directory ปัจจุบันออกมาในรูปแบบของ tree แบบนี้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/468/1*SwNjp5b5Rjpc-yGz2iLsbw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=feb89796099" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ออกจากงานแล้วไปไหน]]></title>
            <link>https://medium.com/@mossila/%E0%B8%AD%E0%B8%AD%E0%B8%81%E0%B8%88%E0%B8%B2%E0%B8%81%E0%B8%87%E0%B8%B2%E0%B8%99%E0%B9%81%E0%B8%A5%E0%B9%89%E0%B8%A7%E0%B9%84%E0%B8%9B%E0%B9%84%E0%B8%AB%E0%B8%99-cfaef95dfa04?source=rss-a1721c5fad24------2</link>
            <guid isPermaLink="false">https://medium.com/p/cfaef95dfa04</guid>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[ลาออก]]></category>
            <category><![CDATA[สำนักจัดหางาน]]></category>
            <category><![CDATA[เงินชดเชย]]></category>
            <dc:creator><![CDATA[Sutean Rutjanalard]]></dc:creator>
            <pubDate>Wed, 22 Jun 2016 16:17:32 GMT</pubDate>
            <atom:updated>2016-06-23T02:19:10.208Z</atom:updated>
            <content:encoded><![CDATA[<p>ผ่านมาซักพักแล้วที่ผมได้ออกจากงานที่เก่าที่ทำมาเป็นเวลานาน ผ่านอะไรมาก็มากในช่วงเวลาดังกล่าว ขอสรุปเรื่องที่อาจจะเป็นประโยชน์สำหรับหลายๆ คนเมื่อออกจากงานอาจจะทำอะไรไม่ถูกอาจจะได้ใช้เป็นประโยชน์ครับ</p><h4>1. ตั้งสติ</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*53GamZq-Jom3GOryr7wl-Q.png" /></figure><p>สำคัญมากเลย สำหรับคนที่เพิ่งออกจากงานมาใหม่ๆ ไม่ว่าจะด้วยสาเหตุอะไรก็ตาม ทะเลาะกับหัวหน้า โดนไล่ออก ย้ายที่อยู่ หรือว่าได้งานใหม่แต่ยังไม่กล้าลาออก ขั้นแรกขอให้ตั้งสติกับตัวเองก่อน, ถ้าเกิดว่าออกแบบกระทันหัน แบบไหนก็ตามขอให้ตั้งสติก่อน งานที่เราทำอยู่ไม่ใช่ทุกสิ่งของชีวิต แต่ว่าก็เป็นแหล่งรายได้เลี้ยงปากเลี้ยงท้องเราหรือคนในครอบครัวของเรา เพราะงั้นอย่าทิ้งตัวจมดิ่งอยู่กับความเครียด ความเศร้าหรือความกดดันต่างๆ ให้พยายามก้าวออกมาจากจุดนั้นให้ได้ ถ้าได้งานใหม่ก็ลองคิด +/- ให้ดีๆ ว่าที่ใหม่ดีกว่าจริงๆ หรือเปล่า ถ้าดีกว่าจริงก็อย่าลังเลที่จะเดินไปบอกหัวหน้า ว่าเรากำลังจะไปมีอนาคตที่ดีกว่า หัวหน้าไม่ใช่คนที่ไม่เคยผ่านเรื่องพนักงานลาออก เราไม่ใช่คนที่ลาออกคนแรกแน่นอน แต่ว่าสิ่งที่ทำให้เราลำบากใจคือ เราลาออกเป็นครั้งแรกเท่านั้น แต่ถ้ามีงานที่ดีรองรับอยู่แล้วก็ลุยเลยครับ หัวหน้าที่เห็นเราได้ดีอาจจะยินดีกับเราด้วยซ้ำ(ขึ้นอยู่กับหัวหน้าของคุณอีกอยู่ดีครับ)</p><h4>2. ไปสำนักจัดหางาน</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tzv_RO9IEDdKzBeDQ_YFig.jpeg" /></figure><p>ไปหางานหรือ? เปล่าครับ ไปขอรับผลประโยชน์ทดแทนในกรณีว่างงานซึ่งคนส่วนใหญ่ไม่ไปกันทั้งๆ ที่จริงๆ แล้วส่วนนี้จะช่วยเรื่องรายจ่ายช่วงที่เราหางานอยู่ หรือเปลี่ยนงานได้พอสมควรเลยครับ</p><p>รายละเอียด <a href="http://www.sso.go.th/wpr/category.jsp?cat=874">http://www.sso.go.th/wpr/category.jsp?cat=874</a></p><p>โดยย่อ</p><ol><li>ต้องไปยื่นเรื่องภายใน 30 วัน</li><li>จ่ายเงินสมทบประกันสังคมมาแล้ว 6 เดือนขึ้นไป</li><li>ไปยื่นเรื่องที่<strong>สำนักจัดหางาน</strong>นะ ไม่ใช่<strong>ประกันสังคม</strong></li><li>ไปรายงานตัวเดือนละครั้ง(ใช้เวลาไม่ถึง 10 นาที)</li></ol><p><strong>กรณีโดนไล่ออก</strong> ได้เงินชดเชย 50% จากเงินเดือน แต่เงินเดือนสูงสุดไม่เกิน 15,000 เป็นเวลา 6 เดือน<br>เช่นเงินเดือน 20,000 ก็คิดแค่ 15,000 ได้ 7,500</p><p><strong>กรณีลาออก</strong> ได้เงินชดเชย 30% จากเงินเดือน แต่เงินเดือนสูงสุดไม่เกิน 15,000 เป็นเวลา 3 เดือน<br>เช่นเงินเดือน 20,000 ก็คิดแค่ 15,000 ได้ 4,500</p><p><strong>เอกสารที่จำเป็น</strong></p><ol><li>รูป 1 นิ้ว 1 รูป</li><li>บัตรประจำตัวประชาชนตัวจริง, พร้อมสำเนา</li><li>สำเนาหน้าสมุดบัญชี (KTB, SCB, KBANK, BBL,TMB,CIMB,ธนชาต,อิสลาม,กรุงศรีฯ)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*toZZSsbMTg2lWspLmenUzA.jpeg" /></figure><p>ไปกรอกเอกสารและฟังคำแนะนำนิดหน่อยที่ สำนักจัดหางาน ก็เป็นอันเรียบร้อย เราลาออกแล้วได้งานใหม่แล้วก็ไปยื่นได้ครับ เพราะว่าการได้งานใหม่ไม่ใช่ว่าจะได้รับเป็นพนักงานประจำเลย เราก็ยังต้องผ่านช่วงทดลองงานไปก่อนครับ ซึ่งช่วงดังกล่าวยังไม่ถือว่าเราได้งาน 100% ครับ ผมเปลี่ยนงานมาหลายครั้งแล้วก็เพิ่งมารู้เนี่ยแหละครับ</p><h4>3. ดูเงินในกระเป๋าว่าพอหรือเปล่า</h4><p>ใช่ครับได้เงินชดเชยมามันแค่พอช่วยได้ครับ ถ้าเงินสำรองไม่มีก็จบครับ ต้องดิ้นครับ สมัครงานร่อนใบสมัครมันเข้าไปครับ บริษัทเลือกเรา เราก็เลือกบริษัทครับ ได้ที่เหมาะสมในเวลาอันสมควรก็ไปเริ่มงานใหม่ทันที ไม่ว่าจะเป็นงานอิสระหรือว่างานประจำ ขอให้ทุกคนโชคดี มีความสุขในสิ่งที่ทำ ดังคำกล่าวที่ว่า</p><blockquote>เงินไม่ใช่ความสุขที่แท้จริง แต่ความไม่มีเงินคือความทุกข์ที่แท้จริง</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*H88XQgxPq4io3totJ5XWWQ.png" /></figure><blockquote>ปล.ใครชอบให้กดไลค์ ใครกดแชร์ขอให้รวย</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cfaef95dfa04" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Command สำหรับผู้ที่มีเนื้อที่ SSD/HDD เหลือน้อย]]></title>
            <link>https://medium.com/@mossila/command-%E0%B8%AA%E0%B8%B3%E0%B8%AB%E0%B8%A3%E0%B8%B1%E0%B8%9A%E0%B8%9C%E0%B8%B9%E0%B9%89%E0%B8%97%E0%B8%B5%E0%B9%88%E0%B8%A1%E0%B8%B5%E0%B9%80%E0%B8%99%E0%B8%B7%E0%B9%89%E0%B8%AD%E0%B8%97%E0%B8%B5%E0%B9%88-ssd-hdd-%E0%B9%80%E0%B8%AB%E0%B8%A5%E0%B8%B7%E0%B8%AD%E0%B8%99%E0%B9%89%E0%B8%AD%E0%B8%A2-c1c9cf122b78?source=rss-a1721c5fad24------2</link>
            <guid isPermaLink="false">https://medium.com/p/c1c9cf122b78</guid>
            <category><![CDATA[bash]]></category>
            <category><![CDATA[os-x]]></category>
            <category><![CDATA[disk-usage]]></category>
            <dc:creator><![CDATA[Sutean Rutjanalard]]></dc:creator>
            <pubDate>Sat, 28 May 2016 09:35:03 GMT</pubDate>
            <atom:updated>2016-05-28T09:38:39.196Z</atom:updated>
            <content:encoded><![CDATA[<p>สำหรับบน Mac ลง util เพิ่มก่อน</p><pre>brew install coreutils</pre><p>จากนั้นเปิด .bash_profile ขึ้นมา</p><pre>open .bash_profile</pre><p>แล้วเพิ่มบรรทัดนี้เข้าไปเป็นบรรทัดสุดท้าย</p><pre>alias usage=&quot;du -hs * | gsort -h&quot;</pre><p>บันทึกไฟล์</p><pre>source .bash_profile</pre><p>จากนั้น cd เข้าไปใน directory ที่คาดว่ามีไฟล์ใหญ่ๆ อยู่ จากนั้นก็แค่พิมพ์</p><pre>usage</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/554/1*8jPYrxSB5Y5CCG0AkDTXqw.png" /><figcaption>`usage` example</figcaption></figure><p>เท่านี้ก็จะเห็นแล้วว่า dir ไหนใช้เนื้อที่ไปเท่าไหร่โดยเรียงตาม size ด้วย</p><p>ถ้าเป็น linux ให้แทนบรรทัด alias ด้วยแบบนี้แทน</p><pre>alias usage=&quot;du -hs * | sort -h&quot;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c1c9cf122b78" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optional ใน Swift ตอนที่ 2]]></title>
            <link>https://medium.com/@mossila/optional-%E0%B9%83%E0%B8%99-swift-%E0%B8%95%E0%B8%AD%E0%B8%99%E0%B8%97%E0%B8%B5%E0%B9%88-2-2a9ed700cc55?source=rss-a1721c5fad24------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a9ed700cc55</guid>
            <category><![CDATA[optionals]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Sutean Rutjanalard]]></dc:creator>
            <pubDate>Tue, 26 Apr 2016 10:03:13 GMT</pubDate>
            <atom:updated>2016-04-26T10:04:11.931Z</atom:updated>
            <content:encoded><![CDATA[<p>เนื่องจากวิธีการใช้ Optional มีเยอะมากเลยของมาต่อในตอนที่ 2 นะ<br><a href="https://medium.com/@mossila/optional-%E0%B9%83%E0%B8%99-swift-5d2633c357f3#.gpqd1lc3r">ตอนที่ 1</a></p><p>เนื่องจาก Optional คือตัวแปรที่มีโอกาสเป็น nil ได้ ถ้าเป็นในกรณีที่เราไม่มั่นใจว่าตัวแปรนั้นเป็น nil หรือเปล่าก็ต้องใช้วิธีการต่างๆ เพื่อตรวจสอบว่าตัวแปรที่เราจะใช้ต่อไปนี้เป็น nil หรือเปล่าเพื่อที่จะใช้ต่อไป</p><h4>If let unwrap</h4><p>control flow ที่สุดจะคุ้นเคย if สามารถใช้ในการตรวจสอบค่า nil ของ optional ได้<br>แบบ if ทั้วๆ ไปที่เรารู้จัก</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/97777a843fe47204ccc895a2b97779c9/href">https://medium.com/media/97777a843fe47204ccc895a2b97779c9/href</a></iframe><p>แต่ Swift มี syntax sugar พิเศษสำหรับกรณีนี้ คือ if let ก็คือถ้าเกิดเราสามารถ unwrap ได้สำเร็จก็นำค่าไปใส่ตัวแปรที่อยู่หลัง let เลย</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d92f7e10a947354b57197d3ce90d128b/href">https://medium.com/media/d92f7e10a947354b57197d3ce90d128b/href</a></iframe><p>ในกรณีนี้จะถือว่าตัวแปรที่ต่อจาก let เป็นตัวแปรใหม่ใน scope นี้ (จากตัวอย่าง internalFirstname) แต่ว่า swift สามารถให้เราใช้ชื่อตัวแปรเดียวกับตัวแปรที่ส่งเข้ามาได้เช่น let lastname = lastname ซึ่งตัวแปรที่เราใช้จะอ้างอิงถึงก็คือตัวที่อยู่ต่อจาก let ซึ่งเป็น String ที่ unwrap เรียบร้อยแล้ว ซึ่งโดยทั่วไปแล้วเราจะใช้ชื่อเดียวกันไปเลยมากกว่า แบบนี้</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e05639ff9340b32ecdc5bcf14ac18bad/href">https://medium.com/media/e05639ff9340b32ecdc5bcf14ac18bad/href</a></iframe><p>และถ้าเรามีหลายๆ ตัวแปรที่ต้อง check &amp; unwrap หลายๆ ตัวพร้อมกันก็สามารถทำต่อๆ กันได้ด้วยเครื่องหมาย `,`</p><h4>guard let</h4><p>guard เป็น control flow ที่มีลักษณะคล้าย if มาก แต่มีการทำงานที่เหมาะสมกับการทำงานแบบในกรณีข้างต้นมากกว่า ก็คือการเอาของที่ไม่ต้องการออกก่อนที่จะเริ่มทำงาน</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/46d1fe06eca345d5117799e1fa1e30b1/href">https://medium.com/media/46d1fe06eca345d5117799e1fa1e30b1/href</a></iframe><p>โดยถ้า guard ทำงานสำเร็จก็จะข้าม else ลงมาข้างล่าง แล้วเราก็จะสามารถนำตัวแปรที่ unwrap สำเร็จแล้วมาใช้งานต่อได้เลย ซึ่งเป็นการทำงานที่ดูต่อเนื่องและเป็นธรรมชาติมากกว่าที่เราจะใช้ if ซึ่งมีโอกาสที่จะทำให้เกิดพีรามิดได้ง่ายๆ เลย</p><p>เช่นเพิ่มเงื่อนไขว่าให้รับค่า age ที่ไม่น้อยกว่า 0 เข้ามาถ้าทำด้วย if อาจจะกลายเป็น</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/10d2d997b40d822042a84469fa6b8ed9/href">https://medium.com/media/10d2d997b40d822042a84469fa6b8ed9/href</a></iframe><p>ถ้าเกิด case ซับซ้อนกว่านี้พีระมิดจะลึกขนาดไหนแต่ถ้าเขียนแบบเดียวกันด้วย guard ก็จะได้แบบนี้</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5d598113c40a27392b210f28f6886783/href">https://medium.com/media/5d598113c40a27392b210f28f6886783/href</a></iframe><p>ทำไปตามลำดับและ return Person ออกไปในตอนสุดท้าย ไม่ได้บอกว่า guard ดีกว่าเสมอนะเพราะว่า</p><p>guard จำเป็นต้องออกจากการทำงานใน scope ข้างนอกเสมอ คือจำเป็นต้องทำอย่างใดอย่างหนึ่งต่อไปนี้เมื่อจบ else ใน guard เสมอ<br>- return เพื่อออกจาก func <br>- break เพื่อออกจาก loop <br>- continue เพื่อไป loop รอบต่อไป <br>- throw เพื่อ raise exception</p><p>ก็คือไม่สามารถตก else แล้วทำงานต่อได้เลยต้องออกเท่านั้น</p><h4>Optional Chaining</h4><p>เป็นการแกะ Optional ต่อๆ กันออกมา นึกออกมั้ยเวลาที่ตัวแปรตัวนึงเป็น Optional แล้วสิ่งที่เชื่อมต่อจากมันก็เป็น optional เช่นกัน เช่น</p><pre>person.firstSon?.school?.name</pre><p>ซึ่งก็เหมือนกับการใช้เครื่องหมาย ? และ ! ในตอนที่ 1 ก็คือถ้าใช้ ? ถ้า firstSon เป็น nil ก็จะทำให้การทำงานต่อจากนั้นเป็น nil ทั้งหมด แต่ถ้าใช้ ! ก็จะ crash ถ้าเกิดมี nil เกิดขึ้นมาในส่วนไหนก็ตามในบรรทัดข้างบน</p><p>Optional chaining ก็สามารถใช้ได้กับ guard let และ if let ได้เช่นกัน</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8513465cab6d60775b3b0a0b0c44a9a8/href">https://medium.com/media/8513465cab6d60775b3b0a0b0c44a9a8/href</a></iframe><h4>Defaulting</h4><p>ถ้าเกิดว่าค่าของตัวแปรเป็นค่าท่าเราไม่พึงประสงค์ และเราต้องการมันกลายเป็นค่าอื่น swift ก็มี syntax sugar ง่ายๆ ไว้ให้ใช้แค่นี้เลยครับ</p><pre>nameLabel.text = person.name ?? &quot;no name&quot;</pre><p>ก็คือถ้าแกะค่า person.name สำเร็จก็ให้ค่าไปเลยแต่ถ้าได้ nil ก็ให้ใช้ค่าหลัง ?? ไปแทนแค่นี้เลย</p><h4>as?</h4><p>as? คือ type casting ที่เราไม่แน่ใจว่ามันจะเป็น type นั้นหรือเปล่าถ้า cast ไม่ได้ก็จะเป็น nil เช่น</p><pre>segue.destinationViewController as? PersonViewController</pre><p>แต่ถ้าเรามั่นใจมากว่าเป็น type นั้นแน่นอน ก็ใช้ as! ก็ได้ แน่นอนว่าถ้า cast ไม่สำเร็จก็ crash นั่นเอง</p><blockquote>บางที่เราก็ต้องการให้มันพังตอนนี้ดีกว่าไปทำงานผิดบนมือลูกค้า</blockquote><p>และถ้าเป็นในกรณีของ Primative type เราก็สามารถใช้ as แทน as! ในการ cast ได้</p><h4>Using it together</h4><p>ทั้งหมดทั้งมวลนี้เราสามารถนำมันมาใช้ร่วมกันได้อย่างมีประสิทธิภาพก็จะช่วยทั้งป้องกัน error และได้ code ที่สวยงามด้วยเช่นกัน</p><pre>let array = defaults.objectForKey(&quot;SavedArray&quot;) as? [String] ?? [String]()</pre><p>สุดท้ายนี้การจะใช้มันให้ได้ดีก็ไม่มีอะไรมากนอกจาก ทำเยอะๆ ฝึกเยอะๆ <br>สวัสดี</p><p>credit <br><a href="https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/OptionalChaining.html">OptionalChaining</a><br><a href="https://www.natashatherobot.com/swift-guard-better-than-if/">swift-guard-better-than-if</a><br><a href="http://web.stanford.edu/class/cs193p/cgi-bin/drupal/">cs193p</a><br><a href="https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Statements.html#//apple_ref/swift/grammar/if-statement">guard-statement</a><br><a href="http://www.touch-code-magazine.com/swift-optionals-use-let/">When to use if let, when ? and !, when as? and as</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a9ed700cc55" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>