<?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>Forem: Ninan Kara</title>
    <description>The latest articles on Forem by Ninan Kara (@ninankara).</description>
    <link>https://forem.com/ninankara</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%2F242395%2F7dd52f40-1512-4d6b-9bb1-5242a05e73a7.jpeg</url>
      <title>Forem: Ninan Kara</title>
      <link>https://forem.com/ninankara</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/ninankara"/>
    <language>en</language>
    <item>
      <title>Day 5: CORS Setting for REST API in ReactJS</title>
      <dc:creator>Ninan Kara</dc:creator>
      <pubDate>Tue, 20 Oct 2020 08:09:36 +0000</pubDate>
      <link>https://forem.com/ninankara/day-5-cors-setting-for-rest-api-in-reactjs-4j2l</link>
      <guid>https://forem.com/ninankara/day-5-cors-setting-for-rest-api-in-reactjs-4j2l</guid>
      <description>&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;Please note that this solution is only applied for REST API that is developed using Spring framework, such as Spring Boot.&lt;/p&gt;

&lt;h2&gt;
  
  
  Dev Environment
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;React JS&lt;/li&gt;
&lt;li&gt;Spring Boot&lt;/li&gt;
&lt;li&gt;Axios&lt;/li&gt;
&lt;li&gt;Heroku&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Problem
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I have problem when calling REST API, deployed in Heroku, from localhost of my ReactJS web application. &lt;/p&gt;

&lt;h2&gt;
  
  
  Solution
&lt;/h2&gt;

&lt;p&gt;Simply add annotation in the controller backend. Please refer to reference below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@CrossOrigin(origins = "http://localhost:3000/", maxAge = 3600)
@RestController

.....

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Actually I took the wrong approaches when looking for solution. If you simply copy paste the error from browser, the result will bring you to another solution. Some said to add certain value in header of the request data, some said to create cors proxy, etc.&lt;/p&gt;

&lt;p&gt;That is not wrong, but not applicable for my problem. Honestly I've tried everything I found, but nothing works. Then suddenly I got a light bulb. The other solution said that other than client side, if you developed your REST API, then it is more simpler to add the cors setting from backend side. Then I searched the solution for Spring Boot :)&lt;/p&gt;

&lt;p&gt;Its another story if we consume the available api. Then it might be more complicated.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.baeldung.com/spring-cors"&gt;Tutorial&lt;/a&gt;&lt;/p&gt;

</description>
      <category>springboot</category>
      <category>react</category>
      <category>heroku</category>
    </item>
    <item>
      <title>React #2: Custom CSS</title>
      <dc:creator>Ninan Kara</dc:creator>
      <pubDate>Sun, 11 Oct 2020 07:36:30 +0000</pubDate>
      <link>https://forem.com/ninankara/react-2-custom-css-35ao</link>
      <guid>https://forem.com/ninankara/react-2-custom-css-35ao</guid>
      <description>&lt;h1&gt;
  
  
  Objectives
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;create custom bulma's css&lt;/li&gt;
&lt;li&gt;create home banner with header&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Steps
&lt;/h1&gt;

&lt;p&gt;Honestly, the guideline in the official documentation is confusing me. Probably because I am not familiar with the package manager. So I tried it based on what I am understanding. &lt;/p&gt;

&lt;h3&gt;
  
  
  Create folder for the custom style file
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;create new folder under &lt;code&gt;src&lt;/code&gt; folder, named &lt;code&gt;styles&lt;/code&gt; or anything&lt;/li&gt;
&lt;li&gt;create new folder under &lt;code&gt;styles&lt;/code&gt; folder, named &lt;code&gt;sass&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;create new file named &lt;code&gt;index.scss&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;add following script in the file
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@charset "utf-8";
@import "../../../node_modules/bulma/bulma.sass";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;make sure to locate the &lt;code&gt;bulma.sass&lt;/code&gt; correctly. since I created the &lt;code&gt;index.scss&lt;/code&gt; under the &lt;code&gt;src&lt;/code&gt; folder, then I defined it as script above.&lt;/p&gt;

&lt;h3&gt;
  
  
  Add scripts to package.json
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;add following script to existing package.json
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"scripts": {
  "css-build": "node-sass --omit-source-map-url src/styles/sass/index.scss src/styles/css/index.css",
....
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;define the url to your own preferences. this is to create css file based on scss file that I created previously.&lt;/p&gt;

&lt;h3&gt;
  
  
  Build the css
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;in the terminal, run following script
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm run css-build -- --watch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is to build the css file. After you run this script, there will be new css file created under the defined folder.&lt;br&gt;
The &lt;code&gt;--watch&lt;/code&gt; attribute is for real-time preview whenever we modified the scss file.&lt;/p&gt;

&lt;h3&gt;
  
  
  Import the css to the project
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;import the css into &lt;code&gt;index.js&lt;/code&gt;
delete the original &lt;code&gt;import bulma&lt;/code&gt; from the file, because it will be overlapped.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Start the react project
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;open new terminal and run &lt;code&gt;npm start&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Modify the scss file
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;custom the bulma attribute
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@charset "utf-8";

// Import a Google Font
@import url('https://fonts.googleapis.com/css?family=Nunito:400,700');

// Set your brand colors
$purple: #8A4D76;
$pink: #FA7C91;
$brown: #757763;
$beige-light: #D0D1CD;
$beige-lighter: #EFF0EB;
$azalea: #FBC2C2;

// Update Bulma's global variables
$family-sans-serif: "Nunito",
sans-serif;
$grey-dark: $brown;
$grey-light: $beige-light;
$primary: $azalea;
$link: $purple;

// $widescreen-enabled: false;
// $fullhd-enabled: false;

// Update some of Bulma's component variables
$body-background-color: $beige-lighter;
$control-border-width: 2px;
$input-border-color: transparent;
$input-shadow: none;
$footer-color: true;
$footer-padding: 1rem;

// Import only what you need from Bulma
@import "../../../node_modules/bulma/sass/utilities/_all.sass";
@import "../../../node_modules/bulma/sass/base/_all.sass";
@import "../../../node_modules/bulma/sass/elements/button.sass";
@import "../../../node_modules/bulma/sass/elements/container.sass";
@import "../../../node_modules/bulma/sass/elements/title.sass";
@import "../../../node_modules/bulma/sass/form/_all.sass";
@import "../../../node_modules/bulma/sass/components/navbar.sass";
@import "../../../node_modules/bulma/sass/layout/hero.sass";
@import "../../../node_modules/bulma/sass/layout/section.sass";
@import "../../../node_modules/bulma/sass/layout/footer.sass";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;when you save the file, the new custom style will be applied directly.&lt;/p&gt;

&lt;h3&gt;
  
  
  Add Header and Footer File
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;create &lt;code&gt;Header.jsx&lt;/code&gt; and &lt;code&gt;Footer.jsx&lt;/code&gt; under the &lt;code&gt;component&lt;/code&gt; folder.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react';
// import 'bulma';

class Header extends React.Component{
    render(){
        return(
            &amp;lt;nav class="navbar is-primary is-fixed-top"&amp;gt;
                &amp;lt;div class="navbar-menu"&amp;gt;
                    &amp;lt;div class="navbar-end"&amp;gt;
                        &amp;lt;div class="navbar-item"&amp;gt;
                            &amp;lt;div class="buttons"&amp;gt;
                                &amp;lt;a class="button is-light"&amp;gt;
                                &amp;lt;span class="icon"&amp;gt;
                                    &amp;lt;i class="fab fa-twitter"&amp;gt;&amp;lt;/i&amp;gt;
                                &amp;lt;/span&amp;gt;
                                &amp;lt;span&amp;gt;&amp;lt;strong&amp;gt;Tweet&amp;lt;/strong&amp;gt;&amp;lt;/span&amp;gt;
                                &amp;lt;/a&amp;gt;
                            &amp;lt;/div&amp;gt;
                        &amp;lt;/div&amp;gt;
                    &amp;lt;/div&amp;gt;
                &amp;lt;/div&amp;gt;
            &amp;lt;/nav&amp;gt;
        );
    }
}
export default Header;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from "react";

class Footer extends React.Component{
    render(){
        return(
            &amp;lt;footer class="footer is-primary"&amp;gt;
                  &amp;lt;div class="content"&amp;gt;
                      &amp;lt;p&amp;gt;Created by Me&amp;lt;/p&amp;gt;&amp;lt;/div&amp;gt;  
            &amp;lt;/footer&amp;gt;
        );
    }
}
export default Footer;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Modify the Banner.jsx file
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;add the Header and Footer component
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div&amp;gt;
        &amp;lt;Header/&amp;gt;
        &amp;lt;section class="hero is-white is-fullheight"&amp;gt;

        &amp;lt;div class="hero-body is-primary"&amp;gt;
          &amp;lt;div class="container has-text-centered"&amp;gt;
            &amp;lt;h1 class="title"&amp;gt;Hello, Bulma!&amp;lt;/h1&amp;gt;
            &amp;lt;h2 class="subtitle"&amp;gt;This is react app feat. Bulma&amp;lt;/h2&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;

      &amp;lt;/section&amp;gt;
      &amp;lt;Footer /&amp;gt;
      &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--z_CKBvoT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/7wjctuz4ii7zplkavd66.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--z_CKBvoT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/7wjctuz4ii7zplkavd66.png" alt="custom css"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Notes
&lt;/h1&gt;

&lt;p&gt;import only required library is nice if you know what you want from the library, otherwise import the complete library would be more convenient. It happened to me a lot. I keep losing some class from Bulma, and keep adding it one by one which is troublesome.&lt;br&gt;
Please note that to apply the customisation, put the import script after you declare all the customisation variables.&lt;/p&gt;

&lt;h1&gt;
  
  
  Link
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://bulma.io/documentation/customize/with-node-sass/"&gt;Custom Bulma&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>bulma</category>
    </item>
    <item>
      <title>React #1: Hello, Bulma</title>
      <dc:creator>Ninan Kara</dc:creator>
      <pubDate>Sat, 10 Oct 2020 13:00:36 +0000</pubDate>
      <link>https://forem.com/ninankara/react-1-hello-bulma-4o7b</link>
      <guid>https://forem.com/ninankara/react-1-hello-bulma-4o7b</guid>
      <description>&lt;h1&gt;
  
  
  Objectives
&lt;/h1&gt;

&lt;p&gt;Create hello world page with ReactJS and Bulma.&lt;/p&gt;

&lt;h1&gt;
  
  
  Prerequisites
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;Have npm package installed&lt;/li&gt;
&lt;li&gt;Have IDE (for me Visual Code)&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Steps
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Generate react project with CRA (create-react-app) tool
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx create-react-app my-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;run &lt;code&gt;npm start&lt;/code&gt; to check whether the boilerplate is installed correctly. &lt;/p&gt;

&lt;h3&gt;
  
  
  Install Bulma package
&lt;/h3&gt;



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

&lt;/div&gt;



&lt;p&gt;instal node-saas&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 node-sass
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Delete/ clean CRA boilerplate
&lt;/h3&gt;

&lt;p&gt;delete every file under &lt;code&gt;/src/&lt;/code&gt; file except &lt;code&gt;index.js&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Import Bulma and FontAwesome library
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;First, open &lt;code&gt;index.js&lt;/code&gt;, delete unused import header.&lt;/li&gt;
&lt;li&gt;Second, open &lt;code&gt;index.html&lt;/code&gt; under &lt;code&gt;/public/&lt;/code&gt; folder, add
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.1/css/all.css" integrity="sha384-5sAR7xN1Nv6T6+dT2mhtzEpVJvfS3NScPQTrOxhwjIuvcA67KV2R5Jz6kr4abQsz" crossorigin="anonymous"&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Hello, Bulma!
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;create new folder named &lt;code&gt;component&lt;/code&gt; under &lt;code&gt;/src/&lt;/code&gt; folder&lt;/li&gt;
&lt;li&gt;create new file, &lt;code&gt;Banner.jsx&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;add following script
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from "react";
import "bulma";

class Banner extends React.Component {
  render() {
    return (
      &amp;lt;section class="hero is-primary is-fullheight"&amp;gt;
        &amp;lt;div class="hero-body"&amp;gt;
          &amp;lt;div class="container has-text-centered"&amp;gt;
            &amp;lt;h1 class="title"&amp;gt;Hello, Bulma!&amp;lt;/h1&amp;gt;
            &amp;lt;h2 class="subtitle"&amp;gt;This is react app feat. Bulma&amp;lt;/h2&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/section&amp;gt;
    );
  }
}

export default Banner;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;render the banner by defining its component in &lt;code&gt;index.js&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from "react";
import ReactDOM from "react-dom";
import "bulma";
import Banner from "./component/Banner";

ReactDOM.render(&amp;lt;Banner /&amp;gt;, document.getElementById("root"));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4R0ckpid--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/n6q65008rplzwr6aojqi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4R0ckpid--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/n6q65008rplzwr6aojqi.png" alt="banner"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Link
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://bulma.io/"&gt;Bulma&lt;/a&gt;&lt;br&gt;
&lt;a href="https://reactjs.org/docs/create-a-new-react-app.html"&gt;CRA Boilerplate&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/ninankara/reactjourney"&gt;Project Github&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>bulma</category>
    </item>
    <item>
      <title>Day 4: Push existing project to existing Git repo</title>
      <dc:creator>Ninan Kara</dc:creator>
      <pubDate>Fri, 25 Sep 2020 07:34:31 +0000</pubDate>
      <link>https://forem.com/ninankara/day-4-push-existing-project-to-existing-git-repo-3n0n</link>
      <guid>https://forem.com/ninankara/day-4-push-existing-project-to-existing-git-repo-3n0n</guid>
      <description>&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;Which one is first? Create new project in local? Create repository in local? or create repository in cloud first? Whatever the sequence, the process of connecting our project to git might be different. Honestly it is easier to generate repository in cloud first (Github, Gitlab, etc), then clone it to local. And modify the project afterward. But, sometimes I forgot. I create the project first, and also generate the repository in cloud.&lt;/p&gt;

&lt;p&gt;So, how to connect existing project to existing repository?&lt;br&gt;
Here it is.&lt;/p&gt;
&lt;h2&gt;
  
  
  Step-by-step
&lt;/h2&gt;

&lt;p&gt;Note: I use VSCode and Gitlab&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git init
git add .
git commit -m "initial commit"
git remote add origin your-git.git
git remote -v //to confirm
git branch --set-upstream-to=origin/master master
git pull --allow-unrelated-histories
git push
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Voila.. its connected now :)&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Previously, I always delete the local project, then clone the cloud repo to local. This is okay, but what if the project is already big? You may not want to redo it from scratch. Another way is to push directly and create new project in cloud, but I am too lazy to delete the old one and create the new one. Because I want to reserve the project name (so I need to delete the old one).&lt;/p&gt;

&lt;p&gt;So, for now one, if I forgot to clone the repo first, I prefer this way to connect both. And wrote it here, since I keep forgetting stuffs :)&lt;/p&gt;

</description>
      <category>git</category>
    </item>
    <item>
      <title>Day 3: Auto Generate TOC Github Markdown</title>
      <dc:creator>Ninan Kara</dc:creator>
      <pubDate>Fri, 07 Aug 2020 06:59:49 +0000</pubDate>
      <link>https://forem.com/ninankara/day-3-auto-generate-github-markdown-2o08</link>
      <guid>https://forem.com/ninankara/day-3-auto-generate-github-markdown-2o08</guid>
      <description>&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;After hiatus, I decided to continue my random note of my programming experience. Recently I am exploring markdown for filling wiki document in Github. I am used to write in Gitlab, and recently move to Github. I found something interesting when generating the table contents in the md document.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tools Used
&lt;/h2&gt;

&lt;p&gt;I am using: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;VS Code&lt;/li&gt;
&lt;li&gt;Github&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Auto Generate TOC
&lt;/h2&gt;

&lt;p&gt;Honestly I don't know anything about this auto feature. I just have habit to create TOC in every wiki document. I didn't find this feature in Gitlab. So I am curious whether this is Github feature, or VS Code feature. &lt;/p&gt;

&lt;p&gt;Following is the step I did to generate the TOC. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create Wiki page document for my Github project. Click the &lt;code&gt;wiki&lt;/code&gt; tab in the project repository.&lt;/li&gt;
&lt;li&gt;Clone the wiki repository to your local repository.&lt;/li&gt;
&lt;li&gt;Create heading with &lt;code&gt;#&lt;/code&gt; for &lt;code&gt;h1&lt;/code&gt;, &lt;code&gt;##&lt;/code&gt; for &lt;code&gt;h2&lt;/code&gt;, and so on.&lt;/li&gt;
&lt;li&gt;Move to the beginning of the markdown document.&lt;/li&gt;
&lt;li&gt;Type &lt;code&gt;Table of Contents&lt;/code&gt; with &lt;code&gt;h1&lt;/code&gt; format. Enter.&lt;/li&gt;
&lt;li&gt;Type &lt;code&gt;-&lt;/code&gt; to start the list. And type the first section with internal link, &lt;code&gt;- [Example](#example)&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Click Enter.&lt;/li&gt;
&lt;li&gt;Save your document.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Voila!! Your TOC will be generated automatically based on heading level you've created.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--B-ctGpvX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/32h1fmw8cb9lyndp08p1.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--B-ctGpvX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/32h1fmw8cb9lyndp08p1.JPG" alt="Table of Content Github Wiki"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;See the &lt;code&gt;up to date&lt;/code&gt; part? If you update the structure, it will be updated automatically too once you save the document.&lt;br&gt;
I don't know about others, but I really like this auto feature :D&lt;/p&gt;

</description>
      <category>github</category>
      <category>markdown</category>
    </item>
    <item>
      <title>Creating Github Pages with Jekyll</title>
      <dc:creator>Ninan Kara</dc:creator>
      <pubDate>Wed, 29 Jul 2020 05:47:31 +0000</pubDate>
      <link>https://forem.com/ninankara/creating-github-pages-with-jekyll-21m5</link>
      <guid>https://forem.com/ninankara/creating-github-pages-with-jekyll-21m5</guid>
      <description>&lt;h1&gt;
  
  
  Intro
&lt;/h1&gt;

&lt;p&gt;The reason I wrote this is because the official documentation didn't work smoothly. Just in case I forgot the step, I decided to write it here for my own documentation.&lt;/p&gt;

&lt;h1&gt;
  
  
  Step-by-step
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;Create public repository in Github with following name &lt;code&gt;username.github.io&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Clone it to your local repository&lt;/li&gt;
&lt;li&gt;Install &lt;a href="https://rubyinstaller.org/downloads/"&gt;RubyInstaller&lt;/a&gt; , and follow the step till complete&lt;/li&gt;
&lt;li&gt;(Optinal) If the installer doesn't automatically run, run following command &lt;code&gt;ridk install&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;If you are not sure, install no 1 and 3&lt;/li&gt;
&lt;li&gt;Install Jekyll by run following command &lt;code&gt;gem install jekyll bundler&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Check whether Jekyll is completely installed by run &lt;code&gt;jekyll -v&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Jekyll installation complete, now setting the Github pages&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open your local repository&lt;/li&gt;
&lt;li&gt;Go up one folder by run &lt;code&gt;cd ..&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;jekyll new username.github.io --force&lt;/code&gt; to install jekyll in Github pages&lt;/li&gt;
&lt;li&gt;Open &lt;code&gt;Gemfile&lt;/code&gt; file&lt;/li&gt;
&lt;li&gt;Remove or comment following line &lt;code&gt;gem "jekyll", "~&amp;gt; 4.1.1"&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Add following line &lt;code&gt;gem "github-pages", group: :jekyll_plugins&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Update the version of other plugins, by referring &lt;a href="https://pages.github.com/versions/"&gt;Github Dependency Documentation&lt;/a&gt; . As for me, I updated the version of &lt;code&gt;jekyll-feed&lt;/code&gt; version. Save your work.&lt;/li&gt;
&lt;li&gt;Go to command prompt and run &lt;code&gt;bundle update&lt;/code&gt; following update to command&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Configuration done!&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Now commit your local repository and push it to Github.&lt;/li&gt;
&lt;li&gt;Run your pages.&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>github</category>
      <category>jekyll</category>
    </item>
    <item>
      <title>Flutter #1 : Bottom Navigation Bar Template</title>
      <dc:creator>Ninan Kara</dc:creator>
      <pubDate>Fri, 26 Jun 2020 02:09:12 +0000</pubDate>
      <link>https://forem.com/ninankara/flutter-1-bottom-navigation-bar-template-509m</link>
      <guid>https://forem.com/ninankara/flutter-1-bottom-navigation-bar-template-509m</guid>
      <description>&lt;h1&gt;
  
  
  Background
&lt;/h1&gt;

&lt;p&gt;Recently I am learning about creating front end design with Flutter. The language used is Dart. Anyway I created this post because I realized that I always use this structure whenever I make a new app. The design is simple. One page with tab navigation bar. &lt;/p&gt;

&lt;p&gt;Since I do not touch Flutter everyday, I keep forgetting how to make this kind of UI. I made this base template, so that I can only care about adding the service and other logics to the app.&lt;/p&gt;

&lt;h1&gt;
  
  
  Github
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://github.com/ninankara/myTemplateRepo/tree/master/flutter_btmnavbar"&gt;Source code&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Preview
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4D8fyXwO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fhyahj2d2r80zcrb4u4l.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4D8fyXwO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fhyahj2d2r80zcrb4u4l.jpg" alt="Bottom Navigation Bar"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>dart</category>
      <category>mobile</category>
      <category>ux</category>
    </item>
    <item>
      <title>Day 2: Java Validation</title>
      <dc:creator>Ninan Kara</dc:creator>
      <pubDate>Tue, 15 Oct 2019 02:32:46 +0000</pubDate>
      <link>https://forem.com/ninankara/day-2-java-validation-2fgc</link>
      <guid>https://forem.com/ninankara/day-2-java-validation-2fgc</guid>
      <description>&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;Recently, I focus on building a REST API using Spring Boot, Java and Swagger.&lt;br&gt;
We all know that REST API involves Request and Response parameter in it. I was amazed at how Java provides validation to prevent repeatable line of code. &lt;br&gt;
Before annotation era, we always do the validation using &lt;code&gt;if else&lt;/code&gt; instruction. If this field is null then throw exception, if A is null then B becomes mandatory, and so on. Imagine you create hundreds API involves hundreds field parameters? &lt;/p&gt;

&lt;h2&gt;
  
  
  Validation annotation
&lt;/h2&gt;

&lt;p&gt;So, Java gives you a solution. You can put validation annotation attached with field. If you create custom validation, you can put it also in class level. I will note down the basic one. Following are the common annotation used for field validation on Request parameters.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;@ NotBlank -&amp;gt; validates that value is not null. can be used in any type of field. usually String type&lt;/li&gt;
&lt;li&gt;@ Size -&amp;gt; validates size/length of value. Usually applied for integer type. It has attribute min and max&lt;/li&gt;
&lt;li&gt;@ Pattern -&amp;gt; to validate pattern using regex. I used this one a lot. It is very convenience to use other than comparing String with equals method. The challenge is creating the regex itself. &lt;a href="//regex101.com"&gt;You can simulate it here&lt;/a&gt; before use it. Probably I will write about this part in separate post.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Custom Validation
&lt;/h2&gt;

&lt;p&gt;If your requirement getting complicated, and no basic annotation can accommodate it, you may create your own validation. &lt;a href="https://stackoverflow.com/questions/2781771/how-can-i-validate-two-or-more-fields-in-combination"&gt;This post is a good start&lt;/a&gt; . &lt;br&gt;
I will share one of my custom validation later :D&lt;/p&gt;

&lt;h2&gt;
  
  
  Some example
&lt;/h2&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nd"&gt;@Pattern&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;regexp&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"^[0-9]*$"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="nd"&gt;@NotBlank&lt;/span&gt;
&lt;span class="nd"&gt;@Size&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;myNumber&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="nd"&gt;@MyCustomValidation&lt;/span&gt;
&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;myCode&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



</description>
      <category>java</category>
      <category>regex</category>
    </item>
    <item>
      <title>Day 1: Javadoc</title>
      <dc:creator>Ninan Kara</dc:creator>
      <pubDate>Fri, 04 Oct 2019 01:53:28 +0000</pubDate>
      <link>https://forem.com/ninankara/day-1-javadoc-5d79</link>
      <guid>https://forem.com/ninankara/day-1-javadoc-5d79</guid>
      <description>&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;I have heard about Javadoc since the first time I touched Java like 5 years ago. But I realized that I still didn't understand what Javadoc is until I wrote this note. At first I thought that Javadoc is a Java documentation that can be printed or exported as PDF. Yeah, a documentation about the program. Automatically generated. Well, I was not 100% wrong. But something that I missed was, how to create or leave a good Javadoc. &lt;/p&gt;

&lt;p&gt;Usually a developer will leave comment and explain briefly about a line of code. Like in Java, we use "//" or "/** */" character to leave a comment. Well, that is not a Javadoc I found recently. It is beyond that. haha sorry for my inexperience :)&lt;/p&gt;

&lt;h2&gt;
  
  
  Javadoc
&lt;/h2&gt;

&lt;p&gt;When we call method from other class, there will be a small pop up windows appears explaining what the method is about. That small pop up windows what they call JAVADOC~&lt;/p&gt;

&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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fevu1n1tj8fxlkznhlbet.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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fevu1n1tj8fxlkznhlbet.png" alt="javadoc"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I really didn't understand until I found my own brief explanation about the method came out. And realized that is the right way to generate/ write comment to become a Javadoc.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to write a good Javadoc
&lt;/h2&gt;

&lt;p&gt;Writing documentation is important. Explain about the method/class or anything very briefly. So that, the next programmer who will read your code will understand what you are trying to write.&lt;/p&gt;

&lt;p&gt;Above the method, start with /** to open a block comment section. This comment section can apply html and markdown tag. So make it pretty ;)&lt;/p&gt;

&lt;p&gt;Always include &lt;a class="mentioned-user" href="https://dev.to/param"&gt;@param&lt;/a&gt;, @return, @throws in the Javadocs. It's important when calling this method, and have no idea how to use the method. &lt;/p&gt;

&lt;p&gt;I learned that a &lt;a class="mentioned-user" href="https://dev.to/param"&gt;@param&lt;/a&gt; has to be followed by explanation about the param itself. for example :&lt;br&gt;
&lt;a class="mentioned-user" href="https://dev.to/param"&gt;@param&lt;/a&gt;  firstNumb the first number&lt;br&gt;
&lt;a class="mentioned-user" href="https://dev.to/param"&gt;@param&lt;/a&gt;  secndNumb the second number&lt;/p&gt;

&lt;p&gt;something like that. complete it with noun. for the detail of how to write a good Javadoc, please refer to reference below~&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#styleguide" rel="noopener noreferrer"&gt;Oracle&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>java</category>
    </item>
    <item>
      <title>Intro</title>
      <dc:creator>Ninan Kara</dc:creator>
      <pubDate>Fri, 04 Oct 2019 01:50:45 +0000</pubDate>
      <link>https://forem.com/ninankara/100-days-of-programming-s-notes-4k2h</link>
      <guid>https://forem.com/ninankara/100-days-of-programming-s-notes-4k2h</guid>
      <description>&lt;h1&gt;
  
  
  100 days of Programming's Notes
&lt;/h1&gt;

&lt;p&gt;I want to challenge myself to leave small notes every times I've learned about something in this post. It will be a small things, but at least I thought it was important notes to remember. &lt;/p&gt;

&lt;p&gt;It could be anything. Probably java, javascript, java, or devOps, etc. :)&lt;/p&gt;

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