<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: nicha</title>
    <description>The latest articles on DEV Community by nicha (@chestnut).</description>
    <link>https://dev.to/chestnut</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F556639%2F9d17ca1e-048c-4589-aadb-aacefe6ff543.jpg</url>
      <title>DEV Community: nicha</title>
      <link>https://dev.to/chestnut</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/chestnut"/>
    <language>en</language>
    <item>
      <title>[Neetcode] When to buy and sell stock</title>
      <dc:creator>nicha</dc:creator>
      <pubDate>Thu, 24 Jul 2025 09:53:06 +0000</pubDate>
      <link>https://dev.to/chestnut/neetcode-when-to-buy-and-sell-stock-2hak</link>
      <guid>https://dev.to/chestnut/neetcode-when-to-buy-and-sell-stock-2hak</guid>
      <description>&lt;p&gt;This is my first article in the &lt;strong&gt;Neetcode&lt;/strong&gt; practice series. In this series, I'll be jotting down my approach to problems and how I pick up better habits along the way.&lt;/p&gt;

&lt;p&gt;So, let's dive in!&lt;/p&gt;

&lt;p&gt;This problem is here:&lt;br&gt;
&lt;a href="https://neetcode.io/problems/buy-and-sell-crypto?list=blind75" rel="noopener noreferrer"&gt;https://neetcode.io/problems/buy-and-sell-crypto?list=blind75&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Essentially, the goal is to determine the lowest price to buy a stock and the highest price to sell it at to maximise profit.&lt;/p&gt;


&lt;h2&gt;
  
  
  Bruteforce
&lt;/h2&gt;

&lt;p&gt;The most straightforward way to tackle this is to loop through every possible "buy" price, then check every "sell" price after it, calculating the profit each time to find the maximum.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Solution&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;maxProfit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;prices&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;List&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;max_profit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;enumerate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prices&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;j&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prices&lt;/span&gt;&lt;span class="p"&gt;)):&lt;/span&gt;
                &lt;span class="n"&gt;profit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;prices&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;j&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;
                &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;profit&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;max_profit&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="n"&gt;max_profit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;profit&lt;/span&gt; 

        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;max_profit&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The outer loop picks a buy price. The inner loop then scans all the prices after the &lt;code&gt;buy&lt;/code&gt; price to find a &lt;code&gt;sell&lt;/code&gt; price. We calculate the profit for each pair and update max_profit if a better one is found.&lt;/p&gt;

&lt;p&gt;This setup involves a nested for loop, resulting in a time complexity of O(n^2) – not ideal for large lists.&lt;/p&gt;




&lt;h2&gt;
  
  
  A Better Approach
&lt;/h2&gt;

&lt;p&gt;If I step back and think about it, we only need to go through the prices once. We can keep track of the lowest &lt;code&gt;buy&lt;/code&gt; price we've seen so far and, as we iterate, continually update our max_profit with the current sell price minus that lowest buy price. If we encounter a price lower than our current buy, that becomes our new buy price, because it opens up the possibility of even greater future profits.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Solution&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;maxProfit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;prices&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;List&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;max_profit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
        &lt;span class="n"&gt;buy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;prices&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;sell_price&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;prices&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;max_profit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_profit&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sell_price&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;buy&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

            &lt;span class="c1"&gt;# If the current 'sell_price' is lower than our 'buy' price,
&lt;/span&gt;            &lt;span class="c1"&gt;# it means we found a new, better (lower) potential buy point.
&lt;/span&gt;            &lt;span class="c1"&gt;# So, we update our 'buy' price.
&lt;/span&gt;            &lt;span class="n"&gt;buy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;buy&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sell_price&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;max_profit&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this code, we start to &lt;code&gt;buy&lt;/code&gt; from the very first price. As we loop through prices (treating each &lt;code&gt;sell_price&lt;/code&gt; as a potential sell point):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;We calculate the &lt;code&gt;profit&lt;/code&gt; we'd make if we bought at our buy price and sold at the sell price.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We update max_profit to be the higher of its current value or current profit.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Crucially, we then check if sell_price is lower than our current buy price. If it is, then the &lt;code&gt;sell_price&lt;/code&gt; becomes our new buy price, because buying at that point would give us a better starting position for future profits.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This single loop means our time complexity is significantly more efficient, at O(N).&lt;/p&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8u9b214w91rjv0gok847.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8u9b214w91rjv0gok847.jpg" alt="Keep Going" width="800" height="533"&gt;&lt;/a&gt;&lt;br&gt;
If you're on the same journey of practising LeetCode, let's do this together!&lt;/p&gt;

&lt;p&gt;For a bit of extra motivation, I want to share some wise words from the author of this Anki deck: &lt;a href="https://ankiweb.net/shared/info/1941530701" rel="noopener noreferrer"&gt;https://ankiweb.net/shared/info/1941530701&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Getting good at DSA is not about having a strong intuition or being good at puzzle solving. If I ask you some dumb math like 2+2, you instantly know the answer is 4. This is because you have spent years and years using and testing your basic arithmetic skills. If you ask a 2 year old what 2 + 2 is, they'll likely tell you their favorite color is yellow. The 2 year old is not dumb, they just don't have enough exposure to arithmetic concepts yet. Learning DSA is similar.&lt;/p&gt;

&lt;p&gt;If it takes you 1 hour to solve an easy, it doesn't mean you're stupid. It means you're wasting your time. Limit how much time you spend with each problem to maximum 5 minutes, before looking at the answer. Then use spaced repetition to revisit problems you've already learned how to solved in the future. If you limit the amount of time you spend on each problem, you will solve 10 times more problems an hour. You will have exposure to all the tools you need to solve almost any problem on leetcode in a month. You will be able to solve most new problems in less than 5 minutes, which gives you plenty of time to solve similar problems in a room full of strangers for 4 hours straight.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We got this! Until we meet again, Happy coding :)&lt;/p&gt;

</description>
      <category>leetcode</category>
    </item>
    <item>
      <title>[Discord] Send message through Bot</title>
      <dc:creator>nicha</dc:creator>
      <pubDate>Thu, 10 Aug 2023 14:57:58 +0000</pubDate>
      <link>https://dev.to/chestnut/discord-send-message-through-bot-26b4</link>
      <guid>https://dev.to/chestnut/discord-send-message-through-bot-26b4</guid>
      <description>&lt;p&gt;I am a newbie to Discord. Recently, my friend and I started a discord channel for a live talk session to interview people and share our experiences with interested people.&lt;/p&gt;

&lt;p&gt;When sending a message, I'm thinking about a way to send a message through a bot instead of using my account, so my friend taught me a way to do that. And today, you will know it too!!&lt;br&gt;
&lt;/p&gt;

&lt;br&gt;
First of all, you have to be an admin of that server. Then, visit the server setting &amp;gt; integration &amp;gt; webhook.

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh7oeih99uyde4tf5zhyu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh7oeih99uyde4tf5zhyu.png" alt="Webhook-setting"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then, click "New Webhook" and choose the channel that you want to send message to&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnq3psmo0a1uu9ilrxpx8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnq3psmo0a1uu9ilrxpx8.png" alt="Create-webhook"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Later on, click on the button "Copy Webhook URL" to copy the webhook URL&lt;/p&gt;

&lt;p&gt;Lastly, you can send a message by inputting it into the curl.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl --location --request POST '{YOUR_WEBHOOK_URL}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "content": "{YOUR_MESSAGE}",
    "username": "{SENDER_NAME}",
    "avatar_url": "{PICTURE_URL}"
}
'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Please feel free to share interesting bot and command in discord with me 👾&lt;/p&gt;

</description>
      <category>discord</category>
      <category>beginners</category>
      <category>curl</category>
    </item>
    <item>
      <title>50th Percentile is Median NOT mean</title>
      <dc:creator>nicha</dc:creator>
      <pubDate>Wed, 19 Oct 2022 15:45:26 +0000</pubDate>
      <link>https://dev.to/chestnut/50th-percentile-is-median-not-mean-34bm</link>
      <guid>https://dev.to/chestnut/50th-percentile-is-median-not-mean-34bm</guid>
      <description>&lt;p&gt;I was confused whether 50th Percentile is Mean or Median. So, I will noted down right here that it is &lt;strong&gt;MEDIAN&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Imagine that there are 9 people in a room. Some are children, teenagers, and adults&lt;/p&gt;

&lt;p&gt;These are their age sort in ascending.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;5, 10, 15, 20, 25, 30, 35, 40, 45
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From the dataset above:&lt;br&gt;
&lt;strong&gt;Median&lt;/strong&gt; = 25&lt;br&gt;
&lt;strong&gt;Mean&lt;/strong&gt; = 25&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Calculate median:
Median position = (n+1)/2 
with n = 9 the median position is 5, which is 25

Calculate mean:
(5+10+15+20+25+30+35+40+45)/9 = 25
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case, the mean and median is equal due to the age is &lt;strong&gt;symmetrically&lt;/strong&gt; distributed&lt;/p&gt;




&lt;p&gt;On the other hand, if the people in the room is mostly young, those young kids will make the group look younger.&lt;/p&gt;

&lt;p&gt;Although the middle person is 20, the majority is so young that the mean goes down.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1,2,3,4,5,20,21,22,30
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Median&lt;/strong&gt; = 20&lt;br&gt;
&lt;strong&gt;Mean&lt;/strong&gt; = 12&lt;/p&gt;

&lt;p&gt;And when majority of the group is older, the mean will rise and become higher&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;18,19,23,30,43,60,65,70,90
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Median&lt;/strong&gt; = 43&lt;br&gt;
&lt;strong&gt;Mean&lt;/strong&gt; = 46.44&lt;/p&gt;




&lt;br&gt;&lt;br&gt;
Reference:&lt;br&gt;&lt;br&gt;
&lt;a href="https://allthingsstatistics.com/miscellaneous/does-50th-percentile-mean-average/"&gt;Does 50th Percentile mean Average?&lt;/a&gt;

</description>
    </item>
    <item>
      <title>Encoding, Encryption, Hash</title>
      <dc:creator>nicha</dc:creator>
      <pubDate>Tue, 26 Apr 2022 12:43:50 +0000</pubDate>
      <link>https://dev.to/chestnut/encoding-encryption-hash-4oe</link>
      <guid>https://dev.to/chestnut/encoding-encryption-hash-4oe</guid>
      <description>&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Encoding&lt;br&gt;
Use to change the format of the code to different format for &lt;strong&gt;usability&lt;/strong&gt;. The encoding technique is public, so any one who know how to read can get the information.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Encryption&lt;br&gt;
Use for security purpose. We can &lt;strong&gt;encrypt&lt;/strong&gt; the data using key to make it unreadable by people who don't have the key. If we want to read the data, we need to &lt;strong&gt;decrypt&lt;/strong&gt; it using the key.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Hash&lt;br&gt;
Use to check the integrity of the data. By hashing the same data, it will always yield the same result. However, we cannot transform the hash data back to the original one.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
    </item>
    <item>
      <title>Go Doc</title>
      <dc:creator>nicha</dc:creator>
      <pubDate>Sun, 09 May 2021 10:46:30 +0000</pubDate>
      <link>https://dev.to/chestnut/go-doc-47nc</link>
      <guid>https://dev.to/chestnut/go-doc-47nc</guid>
      <description>&lt;h4&gt;
  
  
  Go help developers generate documents by using godoc
&lt;/h4&gt;

&lt;p&gt;Reference: &lt;a href="https://golang.org/doc/effective_go"&gt;https://golang.org/doc/effective_go&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;


&lt;p&gt;Generating godoc is fairly easy. The developer just put the comment on top of the file before the package clause, then the doc will be generated automatically.&lt;/p&gt;
&lt;h4&gt;
  
  
  There are two types of comment - block comment, and line comment
&lt;/h4&gt;

&lt;p&gt;1.Block comment &lt;code&gt;/* */&lt;/code&gt; use for several lines of comment&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/*
Package regexp implements a simple library for regular expressions.

The syntax of the regular expressions accepted is:

    regexp:
        concatenation { '|' concatenation }
    concatenation:
        { closure }
    closure:
        term [ '*' | '+' | '?' ]
    term:
        '^'
        '$'
        '.'
        character
        '[' [ '^' ] character-ranges ']'
        '(' regexp ')'
*/
package regexp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2.Line comment &lt;code&gt;//&lt;/code&gt; use for a simple comment&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Package path implements utility routines for
// manipulating slash-separated filename paths.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;b&gt;For multi-file packages, the package comment only needs to be present in one file. &lt;/b&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What should be in the comment?
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Package introduction&lt;/li&gt;
&lt;li&gt;Package explanation as a whole&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Other than that you could comment on top of functions, interfaces or type, etc. to add further explanation&lt;/p&gt;

&lt;h2&gt;
  
  
  How to see godoc locally
&lt;/h2&gt;

&lt;p&gt;A. cd into the package then run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;go doc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will show the doc in the terminal&lt;br&gt;
&lt;/p&gt;

&lt;br&gt;
B. If you want to see it on the local web

&lt;p&gt;1.Make sure you have the &lt;code&gt;go.mod&lt;/code&gt; file in the root directory&lt;br&gt;
if you don't have it yet run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;go mod init example/path
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2.run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;godoc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;then it will run on localhost:6060&lt;/p&gt;

&lt;p&gt;if you want to, you can specify your own port&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;godoc -http=localhost:8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>go</category>
    </item>
    <item>
      <title>Week1: NPM &amp; Package-lock.json</title>
      <dc:creator>nicha</dc:creator>
      <pubDate>Fri, 23 Apr 2021 02:10:37 +0000</pubDate>
      <link>https://dev.to/chestnut/week1-npm-package-lock-json-4a7a</link>
      <guid>https://dev.to/chestnut/week1-npm-package-lock-json-4a7a</guid>
      <description>&lt;h3&gt;
  
  
  How to install npm
&lt;/h3&gt;

&lt;p&gt;When you install nodejs you will get npm along with it&lt;br&gt;
&lt;a href="https://nodejs.org/en/download/"&gt;https://nodejs.org/en/download/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To check node and npm version&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;node -v
npm -v
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  NPM stands for Node Package Manager
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;it is a package manager for Javascript&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  The uses of npm are
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;It is an online repository for the publishing of open-source Node.js projects&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;FOR EXAMPLE:&lt;br&gt;
if you want to import the testing framework you can just install it by&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install --save-dev jest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;It is a command-line utility for package installation, version management, and dependency management.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;FOR EXAMPLE:&lt;br&gt;
if you have module &lt;code&gt;@jest/core&lt;/code&gt;, you can update to the latest version by&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install @jest/core@latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you install the library, it will store in &lt;code&gt;node_modules&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Normally, &lt;code&gt;node_modules&lt;/code&gt; gonna be a big folder, so you do not push it into git. &lt;/p&gt;

&lt;p&gt;It is recommended to have &lt;code&gt;package.json&lt;/code&gt; and &lt;code&gt;package-lock.json&lt;/code&gt;, to help you know those libraries and their versions&lt;/p&gt;

&lt;p&gt;To create a package.json file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Package.json - list the version of its dependencies (library we install), and also other project information such as name, version, author, script, etc.&lt;/p&gt;

&lt;p&gt;Package-lock.json - list solely about the dependencies in depth&lt;/p&gt;

&lt;p&gt;Now when you want to install those libraries, npm can get the info from &lt;code&gt;package-lock.json&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To install dependencies just run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Also keep in mind that:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;You can have only &lt;code&gt;package.json&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;But you can not have only &lt;code&gt;package-lock.json&lt;/code&gt; file&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;package-lock.json&lt;/code&gt; have to come with &lt;code&gt;package.json&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;** And both files need to be stored in git&lt;/p&gt;

&lt;p&gt;Reference:&lt;br&gt;
&lt;a href="https://nodejs.org/en/knowledge/getting-started/npm/what-is-npm/"&gt;https://nodejs.org/en/knowledge/getting-started/npm/what-is-npm/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://stackoverflow.com/questions/45052520/do-i-need-both-package-lock-json-and-package-json#:%7E:text=No.-,The%20package.,to%20a%20specific%20version%20number"&gt;https://stackoverflow.com/questions/45052520/do-i-need-both-package-lock-json-and-package-json#:~:text=No.-,The%20package.,to%20a%20specific%20version%20number&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>npm</category>
    </item>
    <item>
      <title>WEEK1: GIT Conventional Commit</title>
      <dc:creator>nicha</dc:creator>
      <pubDate>Thu, 22 Apr 2021 15:03:58 +0000</pubDate>
      <link>https://dev.to/chestnut/week1-git-conventional-commit-22ff</link>
      <guid>https://dev.to/chestnut/week1-git-conventional-commit-22ff</guid>
      <description>&lt;p&gt;This will provide a set of rule to make your commit easier to read&lt;br&gt;
&lt;a href="https://www.conventionalcommits.org/en/v1.0.0/"&gt;https://www.conventionalcommits.org/en/v1.0.0/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://gist.github.com/qoomon/5dfcdf8eec66a051ecd85625518cfd13"&gt;https://gist.github.com/qoomon/5dfcdf8eec66a051ecd85625518cfd13&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To summarize:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;feat&lt;/code&gt; - use when a new feature is added&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;fix&lt;/code&gt; - fix a bug&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;refactor&lt;/code&gt; - rewrite/restructure code (no behavior changes)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;perf&lt;/code&gt; - improve performance&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;style&lt;/code&gt; - style of the file eg. white spaces, formatting, semicolon&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;test&lt;/code&gt; - add test or update test&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;docs&lt;/code&gt; - format the document not code&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;build&lt;/code&gt; - build component eg. project version, dependencies&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ops&lt;/code&gt; - infrastructure&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;chore&lt;/code&gt; - other miscellaneous commits eg. update .gitignore&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;NOTE:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use present tense&lt;/li&gt;
&lt;li&gt;Don't capitalize the first letter&lt;/li&gt;
&lt;li&gt;No dot at the end&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docs: correct spelling of CHANGELOG
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Can also add scope like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;feat(lang): add polish language
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>WEEK 0: Create Vue3</title>
      <dc:creator>nicha</dc:creator>
      <pubDate>Sun, 18 Apr 2021 04:37:43 +0000</pubDate>
      <link>https://dev.to/chestnut/week-0-first-commit-28bk</link>
      <guid>https://dev.to/chestnut/week-0-first-commit-28bk</guid>
      <description>&lt;p&gt;Create folder frontend and get inside&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir frontend
cd frontend
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create new vue project&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;vue create to-do-list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>WEEK 0: First Commit</title>
      <dc:creator>nicha</dc:creator>
      <pubDate>Sat, 17 Apr 2021 13:54:32 +0000</pubDate>
      <link>https://dev.to/chestnut/week-0-first-commit-3o0n</link>
      <guid>https://dev.to/chestnut/week-0-first-commit-3o0n</guid>
      <description>&lt;h3&gt;
  
  
  Welcome to my first blog :)
&lt;/h3&gt;

&lt;p&gt;From now on I would like to commit to writing a post at least once a week.&lt;/p&gt;

&lt;p&gt;These are topics I would like to start study with.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Docker&lt;/li&gt;
&lt;li&gt;Vue3&lt;/li&gt;
&lt;li&gt;Golang&lt;/li&gt;
&lt;li&gt;Kafka&lt;/li&gt;
&lt;li&gt;RabbitMQ&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I will try to sum up what I study each week, and let see how much I could learn in a year.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
