<?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: Michal Gornicki</title>
    <description>The latest articles on Forem by Michal Gornicki (@m1ner).</description>
    <link>https://forem.com/m1ner</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%2F400702%2F0530cb90-ea28-46bf-95ff-48d10d2a9731.jpg</url>
      <title>Forem: Michal Gornicki</title>
      <link>https://forem.com/m1ner</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/m1ner"/>
    <language>en</language>
    <item>
      <title>Event driven API documentation made simple (Client-Side Rendering).</title>
      <dc:creator>Michal Gornicki</dc:creator>
      <pubDate>Sat, 30 Jul 2022 17:24:45 +0000</pubDate>
      <link>https://forem.com/m1ner/event-driven-api-documentation-made-simple-client-side-rendering-5141</link>
      <guid>https://forem.com/m1ner/event-driven-api-documentation-made-simple-client-side-rendering-5141</guid>
      <description>&lt;p&gt;📢 &lt;em&gt;Original article is available on my &lt;a href="https://michals-corner.vercel.app/blog/event-driven-documentation" rel="noopener noreferrer"&gt;website&lt;/a&gt; where you can also find my Internship Journal.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;This post is a bit different from the other articles.&lt;/p&gt;

&lt;p&gt;In my previous posts, I have written for absolute beginners, but this one is for developers looking to automate and formalize documentation generation for event-driven projects.&lt;/p&gt;

&lt;p&gt;This guide is directed toward folks looking for instructions on how to generate documentation using their AsyncAPI files. Event-driven APIs are not the same as the synchronous APIs you usually document with OpenAPI or GraphQL. Many people use AsyncAPI now, and it is time to provide the community with a guide that shows what options the community has to render documentation on the client-side.&lt;/p&gt;

&lt;p&gt;Oh, if you are still not sure about Client-Side Rendering or Server-Side Rendering, then you can read all about it here 👉 &lt;a href="https://michals-corner.vercel.app/blog/website-rendering-for-beginners" rel="noopener noreferrer"&gt;Website rendering for beginners&lt;/a&gt; (shameless plug 😉).&lt;/p&gt;

&lt;p&gt;I will cover the usage for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;React&lt;/li&gt;
&lt;li&gt;Vue&lt;/li&gt;
&lt;li&gt;Web Components&lt;/li&gt;
&lt;li&gt;Standalone Bundle&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All examples will use this same AsyncAPI sample file 👇&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "asyncapi": "2.2.0",
  "info": {
    "title": "Account Service",
    "version": "1.0.0",
    "description": "This service is in charge of processing user signups"
  },
  "channels": {
    "user/signedup": {
      "subscribe": {
        "message": {
          "$ref": "#/components/messages/UserSignedUp"
        }
      }
    }
  },
  "components": {
    "messages": {
      "UserSignedUp": {
        "payload": {
          "type": "object",
          "properties": {
            "displayName": {
              "type": "string",
              "description": "Name of the user"
            },
            "email": {
              "type": "string",
              "format": "email",
              "description": "Email of the user"
            }
          }
        }
      }
    }
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the expected look of the generated document 👇&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0gzt9kscrae8mki1hkhk.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%2F0gzt9kscrae8mki1hkhk.png" alt="document-template"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;All usage examples from this article are available to check on &lt;a href="https://github.com/m1ner79/asyncapi-docs-rendering-examples" rel="noopener noreferrer"&gt;asyncapi-docs-rendering-examples&lt;/a&gt; repository.&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;a&gt;&lt;/a&gt;React
&lt;/h3&gt;

&lt;p&gt;If you wish to render documentation from your AsyncAPI file in React application, then you need to use &lt;a href="https://github.com/asyncapi/asyncapi-react" rel="noopener noreferrer"&gt;AsyncAPI React component&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;1️⃣ To install the React AsyncAPI component run the command &lt;code&gt;npm install --save @asyncapi/react-component@next&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;2️⃣ Now, create &lt;strong&gt;index.js&lt;/strong&gt; file and type in:&lt;br&gt;
&lt;/p&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 AsyncApiComponent from "@asyncapi/react-component";
import "@asyncapi/react-component/styles/default.min.css";

import { specMock } from "./testDoc";

const rootElement = document.getElementById("root");
ReactDOM.render(&amp;lt;AsyncApiComponent schema={specMock} /&amp;gt;, rootElement);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;React AsyncAPI component&lt;/strong&gt; is imported on the &lt;strong&gt;line 4&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If you are happy with AsyncAPI styling then you need to import their CSS pattern with &lt;code&gt;import "@asyncapi/react-component/styles/default.min.css";&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;On the &lt;strong&gt;line 7&lt;/strong&gt; is where AsyncAPI sample file is imported.&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;a&gt;&lt;/a&gt;Vue
&lt;/h3&gt;

&lt;p&gt;If you wish to generate documentation from your AsyncAPI file in Vue application, then you need to use &lt;a href="https://github.com/asyncapi/asyncapi-react/blob/next/docs/usage/vue.md" rel="noopener noreferrer"&gt;AsyncApiStandalone bundle&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;1️⃣ React AsyncAPI component is required here as well, so again you need to run &lt;code&gt;npm install --save @asyncapi/react-component@next&lt;/code&gt; command.&lt;/p&gt;

&lt;p&gt;2️⃣ In your &lt;strong&gt;App.vue&lt;/strong&gt; just add this code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;template&amp;gt;
  &amp;lt;div ref="asyncapi"&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;/template&amp;gt;

&amp;lt;script&amp;gt;
import AsyncApiStandalone from '@asyncapi/react-component/browser/standalone';

// AsyncAPI specification, fetched or pasted.
const schema =
'{"asyncapi":"2.4.0","info":{"title":"Account Service","version":"1.0.0","description":"This service is in charge of processing user signups"},"channels":{"user/signedup":{"subscribe":{"message":{"$ref":"#/components/messages/UserSignedUp"}}}},"components":{"messages":{"UserSignedUp":{"payload":{"type":"object","properties":{"displayName":{"type":"string","description":"Name of the user"},"email":{"type":"string","format":"email","description":"Email of the user"}}}}}}}';

const config = {}; // Configuration for component. This same as for normal React component.

export default {
  name: 'AsyncApiComponent',
  props: {
    msg: String
  },
  mounted() {
    const container = this.$refs.asyncapi;
    AsyncApiStandalone.render({ schema, config }, container);
  }
}
&amp;lt;/script&amp;gt;

&amp;lt;style scope src="@/assets/asyncapi.min.css"&amp;gt;&amp;lt;/style&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see on &lt;strong&gt;line 6&lt;/strong&gt;, you need to import AsyncApiStandalone bundle with &lt;code&gt;import AsyncApiStandalone from '@asyncapi/react-component/browser/standalone';&lt;/code&gt; command.&lt;/p&gt;

&lt;p&gt;3️⃣ There is one more thing to do. If you like AsyncAPI styling then you need to go to 👉 &lt;code&gt;node_modules/@asyncapi/react-component/style/default.min.css&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Copy that file and then paste it into your &lt;em&gt;&lt;strong&gt;assets&lt;/strong&gt;&lt;/em&gt; folder.&lt;br&gt;
I renamed mine &lt;strong&gt;asyncapi.min.css&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;You can import this in your &lt;strong&gt;main.js&lt;/strong&gt; file with &lt;code&gt;import './assets/asyncapi.min.css'&lt;/code&gt; or, as I did, add it at the end of &lt;strong&gt;App.vue&lt;/strong&gt; file with &lt;code&gt;&amp;lt;style scope src="@/assets/asyncapi.min.css"&amp;gt;&amp;lt;/style&amp;gt;&lt;/code&gt;.&lt;/p&gt;


&lt;h3&gt;
  
  
  &lt;a&gt;&lt;/a&gt;Web Components
&lt;/h3&gt;

&lt;p&gt;To generate documentation from your AsyncAPI file, you can use it as an element of an HTML webpage or as a web component in any other web framework you choose. You can do this by implementing &lt;a href="https://github.com/asyncapi/asyncapi-react/blob/next/docs/usage/web-component.md" rel="noopener noreferrer"&gt;web-react-components&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;1️⃣ Just create a &lt;strong&gt;.html&lt;/strong&gt; file then copy and paste this code 👇&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;script src="https://unpkg.com/@asyncapi/web-component@1.0.0-next.39/lib/asyncapi-web-component.js" defer&amp;gt;&amp;lt;/script&amp;gt;

&amp;lt;asyncapi-component
  schema='{"asyncapi":"2.4.0","info":{"title":"Account Service","version":"1.0.0","description":"This service is in charge of processing user signups"},"channels":{"user/signedup":{"subscribe":{"message":{"$ref":"#/components/messages/UserSignedUp"}}}},"components":{"messages":{"UserSignedUp":{"payload":{"type":"object","properties":{"displayName":{"type":"string","description":"Name of the user"},"email":{"type":"string","format":"email","description":"Email of the user"}}}}}}}'

  config='{"show": {"sidebar": false}}'

  cssImportPath="https://unpkg.com/@asyncapi/react-component@1.0.0-next.39/styles/default.min.css"&amp;gt;
&amp;lt;/asyncapi-component&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2️⃣ If you need support for old browsers then you need to add this script as well &lt;code&gt;&amp;lt;script src="https://unpkg.com/@webcomponents/webcomponentsjs@2.5.0/webcomponents-bundle.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That is it! 🤯 Just awesome!&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;a&gt;&lt;/a&gt;Standalone Bundle
&lt;/h3&gt;

&lt;p&gt;If you want to render documentation from your AsyncAPI file without the use of any framework but with just an HTML webpage then you will need the &lt;a href="https://github.com/asyncapi/asyncapi-react/blob/next/docs/usage/standalone-bundle.md" rel="noopener noreferrer"&gt;Standalone bundle&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;1️⃣ All you need is just a basic HTML template.&lt;/p&gt;

&lt;p&gt;2️⃣ In the &lt;strong&gt;head&lt;/strong&gt; element enter &lt;code&gt;&amp;lt;link rel="stylesheet" href="https://unpkg.com/@asyncapi/react-component@1.0.0-next.39/styles/default.min.css"&amp;gt;&lt;/code&gt; to get AsyncAPI document styling.&lt;/p&gt;

&lt;p&gt;3️⃣ In the &lt;strong&gt;body&lt;/strong&gt; element type in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; &amp;lt;div id="asyncapi"&amp;gt;&amp;lt;/div&amp;gt;

    &amp;lt;script src="https://unpkg.com/@asyncapi/react-component@1.0.0-next.39/browser/standalone/index.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script&amp;gt;
        AsyncApiStandalone.render({
            schema: '{"asyncapi":"2.4.0","info":{"title":"Account Service","version":"1.0.0","description":"This service is in charge of processing user signups"},"channels":{"user/signedup":{"subscribe":{"message":{"$ref":"#/components/messages/UserSignedUp"}}}},"components":{"messages":{"UserSignedUp":{"payload":{"type":"object","properties":{"displayName":{"type":"string","description":"Name of the user"},"email":{"type":"string","format":"email","description":"Email of the user"}}}}}}}'
            ,
            config: {
                show: {
                    sidebar: false,
                }
            },
        }, document.getElementById('asyncapi'));
    &amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;&amp;lt;script src="https://unpkg.com/@asyncapi/react-component@1.0.0-next.39/browser/standalone/index.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/code&gt; fetches everything required from the bundle.&lt;/p&gt;

&lt;p&gt;I almost forgot. &lt;/p&gt;

&lt;p&gt;There is one more way to configure the AsyncAPI component.&lt;br&gt;
You can do it through &lt;strong&gt;config&lt;/strong&gt; props, this same as for normal React component. &lt;/p&gt;

&lt;p&gt;My &lt;strong&gt;Web Component&lt;/strong&gt; and &lt;strong&gt;Standalone Bundle&lt;/strong&gt; usage examples have &lt;code&gt;config='{"show": {"sidebar": false}}&lt;/code&gt; which turns a sidebar off, but if you change it to &lt;em&gt;&lt;strong&gt;true&lt;/strong&gt;&lt;/em&gt; then your rendered document will have a sidebar.&lt;/p&gt;

&lt;p&gt;This was only a sample of what could be done. AsyncAPI can do a lot more. Check &lt;a href="https://www.asyncapi.com/docs/tutorials/getting-started/asyncapi-documents" rel="noopener noreferrer"&gt;AsyncAPI documentation&lt;/a&gt; for more information on how to generate docs.&lt;/p&gt;

&lt;p&gt;I hope that you liked this quick guide through AsyncAPI Client-Side documents generation.&lt;/p&gt;

&lt;p&gt;As usual, if you find any mistakes, don't go mad in the comments section. Just let me know and together we can fix it so this article can be even better.&lt;/p&gt;

</description>
      <category>eventdriven</category>
      <category>asyncapi</category>
      <category>documentation</category>
      <category>guide</category>
    </item>
    <item>
      <title>Website rendering for beginners.</title>
      <dc:creator>Michal Gornicki</dc:creator>
      <pubDate>Thu, 16 Jun 2022 21:45:46 +0000</pubDate>
      <link>https://forem.com/m1ner/website-rendering-for-beginners-44kk</link>
      <guid>https://forem.com/m1ner/website-rendering-for-beginners-44kk</guid>
      <description>&lt;p&gt;📢 &lt;em&gt;Original article is available on my &lt;a href="https://michals-corner.vercel.app/blog/website-rendering-for-beginners" rel="noopener noreferrer"&gt;website&lt;/a&gt; where you can also find my Internship Journal.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;I decided to write an article about website rendering because this topic is not as easy as it may seem. &lt;/p&gt;

&lt;p&gt;For all the people who have worked in this environment for some time, this subject may be as easy as pie, but if you are a beginner, it may be confusing or intimidating even. &lt;/p&gt;

&lt;p&gt;I will try to explain everything as simple as possible. I will not dive too deep because the sole purpose behind this post is to give you a general idea of how rendering works. &lt;/p&gt;

&lt;p&gt;If after reading you  feel that this was interesting, and you wish to go into more details, then I will provide some extra links at the bottom 👇&lt;/p&gt;




&lt;p&gt;What are the rendering types:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Server-side Rendering&lt;/li&gt;
&lt;li&gt;Client-side Rendering&lt;/li&gt;
&lt;li&gt;Build-level Rendering&lt;/li&gt;
&lt;li&gt;Dynamic SSR&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;First, let me explain what the rendering is.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkh4ynzt9c6eu1qchvu7i.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%2Fkh4ynzt9c6eu1qchvu7i.png" alt="diagram"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, a browser requests an HTML document from a server. Then a server returns a formatted HTML text file.&lt;/p&gt;

&lt;p&gt;Within that file, there is the whole information about the elements (CSS, JavaScript, images, videos, etc.) required to create a visual representation with which you can interact in the browser.&lt;/p&gt;

&lt;p&gt;Rendering is combining all that information to create a website. The way you are rendering the website means what way are all these elements fetched.&lt;/p&gt;

&lt;p&gt;Website rendering affects how a page is indexed, which impacts Search Engine Optimization (SEO).&lt;/p&gt;

&lt;p&gt;I will not cover indexing or SEO in great detail here. As I mentioned, I will add links at the end of the article.&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;a&gt;&lt;/a&gt;Server-side Rendering (SSR)
&lt;/h3&gt;

&lt;p&gt;Server-side rendering means that when you are visiting a website, all the website's content is processed and rendered on the server. &lt;/p&gt;

&lt;p&gt;1️⃣ First, through your browser, you are sending a request to access a website. &lt;/p&gt;

&lt;p&gt;2️⃣ Next, all necessary files (HTML, CSS, JavaScript) are prepared and compiled. &lt;/p&gt;

&lt;p&gt;3️⃣ A fully rendered webpage is delivered to your browser. &lt;/p&gt;

&lt;p&gt;Something like that 👇 &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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fewzg1qx04st930roc2w3.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%2Fewzg1qx04st930roc2w3.png" alt="Server-side rendering diagram"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When would you use SSR?&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;If your website doesn't have many users, it has a simple User Interface (UI), maybe a few pages, small dynamic data, and minor interactivity. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SSR pros:&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It is Search Engine Optimization friendly, which means that a search engine such as Google can crawl each page on a website successfully, analyse the content efficiently, and index it in their databases. All this has then an impact on how high your website will appear on the search engine results page (we all want that &lt;strong&gt;#️1&lt;/strong&gt; page 🤑😉). &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Faster initial page load time, which also impacts your SEO because Google prioritizes the ones that load faster. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;SSR cons:&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It can be very expensive. When your website increases the number of visitors, with each user accessing a new page, it has to send a server request every time. As a result, the server must deal with high memory usage and high processing power, which will have an impact on the hosting price 🤷‍♂️.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  &lt;a&gt;&lt;/a&gt;Client-side Rendering (CSR)
&lt;/h3&gt;

&lt;p&gt;Client-side rendering means that when you are visiting a website, all the website content is downloaded, compiled and rendered in your browser. &lt;/p&gt;

&lt;p&gt;1️⃣ First step is the same as in SSR, through your browser, you are sending a request to access a website. &lt;/p&gt;

&lt;p&gt;2️⃣ Then, the server sends an HTML text file. &lt;/p&gt;

&lt;p&gt;3️⃣ After that, the browser will download all static content required by the HTML file and JavaScript. &lt;/p&gt;

&lt;p&gt;4️⃣ The JavaScript framework of choice (React, Angular or Vue.js) takes control and starts fetching and processing data within the browser. &lt;/p&gt;

&lt;p&gt;5️⃣ Lastly, you can view a website of your choice in your browser. &lt;/p&gt;

&lt;p&gt;Take a look here 👇 &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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F74168e5bl1t5dlf7wk4e.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%2F74168e5bl1t5dlf7wk4e.png" alt="Client-side Rendering diagram"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When would you use CSR?&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;If SEO is not a priority, your website has many visitors and depends on dynamic content and complex UI (or both). &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CSR pros:&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;allows creating a website with complex user interactions. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;although the initial load can be slow, but after that, we can see fast website rendering. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;CSR cons:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;as mentioned above, it can be slow when loading for the first time. It depends on many variables like a visitor's internet connection speed, or is the device used to access that website is an old computer or tablet (old machines might not be powerful enough to handle it). &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;if Search Engine Optimization is important to you, then you probably need to stay away. SEO for the website will be negatively affected because the content is not rendered until the browser is loaded. I know that they are ways around it, but apparently, these are complicated(hence expensive).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  &lt;a&gt;&lt;/a&gt;Build-level Rendering(BLR)
&lt;/h3&gt;

&lt;p&gt;Before I can explain how Build-level Rendering works, I need to address what is CI/CD. &lt;/p&gt;

&lt;p&gt;CI/CD stands for Continuous Integration, Continuous Delivery and Continuous Deployment; it is often referred to as a "CI/CD pipeline". &lt;/p&gt;

&lt;p&gt;"How it works?" - you may ask. Most simply, this is a modern approach to product development. It is continuous automation of integration, testing, delivery and deployment phases in the life cycle of a website/application. &lt;/p&gt;

&lt;p&gt;1️⃣ A developer works on a local environment. Code some changes to a website and run some tests (&lt;code&gt;npm run dev&lt;/code&gt;). Once everything went ok, the code is pushed onto a shared branch. &lt;/p&gt;

&lt;p&gt;2️⃣ At the Continuous Integration stage, a code is validated by automatically &lt;strong&gt;building&lt;/strong&gt; an application and running different automated &lt;strong&gt;tests&lt;/strong&gt;. If these changes break the app, then CI makes it easier to locate and fix these bugs. If all unit and integration tests were successful, then the code is merged into the release branch. &lt;/p&gt;

&lt;p&gt;3️⃣ The Continuous Delivery is the part that interests us from the perspective of the Build-level Rendering. In the cloned production environment (an environment imitating your end product) all components are automatically tested and once everything is good, the code changes are deployed to production. The release branch can be deleted once it merges with the production. &lt;/p&gt;

&lt;p&gt;4️⃣ Here is the last stage of CI/CD pipeline. During the Continuous Deployment stage, if all automated tests are completed, then all changes are applied to a website/application.&lt;/p&gt;

&lt;p&gt;Some would say that Build-level Rendering takes place now, but I think that the whole "hard work" is done at the previous step. If any tests fail now, that would be more likely down to the development environment not being set up correctly (if you think of other reasons, please let me know in the comments below 👇). &lt;/p&gt;

&lt;p&gt;In short, the CI/CD pipeline (steps 2-4) is very good and necessary because it allows you as a developer to get continuous feedback across all stages. This is an agile way of developing an application (Chris, my lecturer, would be very proud 😉). &lt;/p&gt;

&lt;p&gt;5️⃣ Unlike in SSR where everything is compiled on the severer (once a user requests a website), BLR delivers a ready product to a server where it waits for a user to request it. &lt;/p&gt;

&lt;p&gt;It looks like that 👇 &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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3y8mfak7xwtzfgg7tokx.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%2F3y8mfak7xwtzfgg7tokx.png" alt="Build-level Rendering"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When would you use BLR?&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;It would have this same application as Server-side Rendering. &lt;/p&gt;

&lt;p&gt;Pros and Cons would be similar to SSR. I would add another potential con - if you decide to go with this way of building an application, just make sure that your CI/CD pipeline is set up correctly. It requires creating a high level of automation and continuous monitoring which can be costly at the beginning, but once it is set up correctly then it should work like a charm.&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;a&gt;&lt;/a&gt;Dynamic SSR
&lt;/h3&gt;

&lt;p&gt;Dynamic SSR is trying to combine SSR and CSR together. The goal is to provide solutions which would allow the creation of SEO-friendly, fast-loading, dynamic websites with loads of visitors with minimal performance impact. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;"In a nutshell, dynamic rendering is the principle of sending normal, Client-side Rendered content to users, and sending fully Server-side Rendered content to search engines and to other crawlers that need it."&lt;/em&gt; (John Mueller at Google I/O 2018 event) &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;1️⃣ Just like on other occasions, through your browser, you are sending a request to access a website. &lt;/p&gt;

&lt;p&gt;2️⃣ Next, initial HTML load and minimal JavaScript is sent to your browser and separate one to a renderer. This allows you to see the website in your browser (the website is not yet interactive). &lt;/p&gt;

&lt;p&gt;3️⃣ Initial load sent to the renderer is now compiled into a formatted HTML text file. &lt;/p&gt;

&lt;p&gt;4️⃣ Web crawlers (like Googlebot, Bingbot, DuckDuckBot) "digest" the website's content and then index it. This is what helps to improve Search Engine Optimization and user experience. Crawler focuses on the information best known to it, and you as a user can see a website on your screen. &lt;/p&gt;

&lt;p&gt;5️⃣ Lastly, JavaScript downloads and runs all necessary code to make a website fully interactive. &lt;/p&gt;

&lt;p&gt;Obviously, all the above steps take seconds to complete. &lt;/p&gt;

&lt;p&gt;Here is a visual representation 👇 &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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0vycenrwyrcs7j997j30.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%2F0vycenrwyrcs7j997j30.png" alt="Dynamic SSR"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When would you use Dynamic SSR?&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;A large website with very demanding, dynamic JavaScript content.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dynamic SSR pros:&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;it enables crawling and indexing of content without executing JavaScript. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;SEO-friendly website with all interactive components that need JavaScript. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Dynamic SSR cons:&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;like with the SSR, it can be expensive. Now the website not only has to handle every visitor's traffic but crawl bots as well, and we know that this will put an extra burden on the server, hence the hosting price hike.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  &lt;a&gt;&lt;/a&gt;Something extra
&lt;/h3&gt;

&lt;p&gt;The idea behind my article was to simplify website rendering for  beginners, but if you feel that you need to dive deep into the  nitty-gritty, then here are some other sources:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://medium.com/jspoint/how-the-browser-renders-a-web-page-dom-cssom-and-rendering-df10531c9969" rel="noopener noreferrer"&gt;"deep dive into DOM and CSSOM to understand how the browser renders a   webpage"&lt;/a&gt;  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://moz.com/beginners-guide-to-seo" rel="noopener noreferrer"&gt;The Beginner's Guide to SEO&lt;/a&gt;  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;an interesting clip on how to &lt;a href="https://www.youtube.com/watch?v=PFwUbgvpdaQ&amp;amp;t=1255s" rel="noopener noreferrer"&gt;deliver search-friendly  JavaScript-powered  websites&lt;/a&gt;  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.keycdn.com/blog/web-crawlers" rel="noopener noreferrer"&gt;web crawlers&lt;/a&gt;  &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I hope that you have enjoyed this article and I managed to make the  website rendering a little less overwhelming.    &lt;/p&gt;

&lt;p&gt;If you notice any mistakes on my part, please let me know in the  comments section below 👇 then I will address them, and together we can  make this article even better.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>tutorial</category>
      <category>beginners</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>How to configure Next.js, Tailwind CSS starter blog.</title>
      <dc:creator>Michal Gornicki</dc:creator>
      <pubDate>Tue, 24 May 2022 19:01:09 +0000</pubDate>
      <link>https://forem.com/m1ner/how-to-configure-nextjs-tailwind-css-starter-blog-386b</link>
      <guid>https://forem.com/m1ner/how-to-configure-nextjs-tailwind-css-starter-blog-386b</guid>
      <description>&lt;p&gt;📢 &lt;em&gt;Original article is available on my &lt;a href="https://michals-corner.vercel.app/blog/blog-update-followup"&gt;website&lt;/a&gt; where you can also find my Internship Journal.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;After I wrote my article on &lt;a href="https://michals-corner.vercel.app/blog/blog-update"&gt;How to make your blog feature-rich with Next.js, Tailwind CSS and Vercel&lt;/a&gt; I realised that some beginners might have troubles with configuration.&lt;/p&gt;

&lt;p&gt;In this article, I will explain the changes which I made when I created my new website.&lt;/p&gt;




&lt;p&gt;This is what I changed so far:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;data/siteMetadata.js&lt;/li&gt;
&lt;li&gt;data/authors/default.md&lt;/li&gt;
&lt;li&gt;data/projectsData.js&lt;/li&gt;
&lt;li&gt;components/comments/Giscus.js&lt;/li&gt;
&lt;li&gt;data/blog&lt;/li&gt;
&lt;li&gt;public/static&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  &lt;a&gt;&lt;/a&gt;data/siteMetadata.js
&lt;/h3&gt;

&lt;p&gt;Information about the site that should be modified to meet your needs. In this file I have only changed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;title:&lt;/em&gt; - this is the title of your page, it is what you will see in the tab&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GdpP5xiG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6xb74aarfyt9kjghau2g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GdpP5xiG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6xb74aarfyt9kjghau2g.png" alt="title" width="288" height="89"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;author:&lt;/em&gt; - put in your name&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;headerTitle:&lt;/em&gt; - your page name&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---RyVO-N_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xaspxwwfi3x183vwckfd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---RyVO-N_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xaspxwwfi3x183vwckfd.png" alt="name" width="482" height="100"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;description:&lt;/em&gt; - describe your website, put in something "catchy"😎&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ekevHOCw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/chnyxn35cyibwy21hyrf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ekevHOCw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/chnyxn35cyibwy21hyrf.png" alt="description" width="880" height="121"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;siteUrl:&lt;/em&gt; - your website address&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;siteRepo:&lt;/em&gt; - update the link to this project's repository on GitHub&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;siteLogo:&lt;/em&gt; - if you have a logo, update it here&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;image:&lt;/em&gt; - update the link to your picture here&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;email:&lt;/em&gt; - update your email (I don't have the newsletter switched on yet)&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;github:&lt;/em&gt; - showcase all of your GitHub repositories&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;linkedin:&lt;/em&gt; - put in the link to your LinkedIn profile page&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I commented out other social media links but you do whatever you think is the best for you.&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;a&gt;&lt;/a&gt;data/authors/default.md
&lt;/h3&gt;

&lt;p&gt;This is your "About" page so it is important to change it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QJCskyNt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m5eadr1fqpn29cpdea7k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QJCskyNt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m5eadr1fqpn29cpdea7k.png" alt="about" width="880" height="505"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;a&gt;&lt;/a&gt;data/projectsData.js
&lt;/h3&gt;

&lt;p&gt;Styled cards are generated using data from the projectsData file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nxtE6QtT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u4k54f8ri0kbfbt3lt31.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nxtE6QtT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u4k54f8ri0kbfbt3lt31.png" alt="projects" width="880" height="523"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;a&gt;&lt;/a&gt;components/comments/Giscus.js
&lt;/h3&gt;

&lt;p&gt;Before you can activate the comments system on your website, you need to generate a script with your specific information.&lt;/p&gt;

&lt;p&gt;1️⃣ Go to the giscus &lt;a href="https://giscus.app/"&gt;website&lt;/a&gt; then click on &lt;strong&gt;giscus app&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---4HDaShw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3wt2x1j3m29kxbiq73g6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---4HDaShw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3wt2x1j3m29kxbiq73g6.png" alt="website" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You should see this 👇&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--t5iqRTzX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qf31aczs87yzpmcn8ezd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--t5iqRTzX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qf31aczs87yzpmcn8ezd.png" alt="install" width="880" height="326"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2️⃣ Click &lt;em&gt;Install&lt;/em&gt; then select &lt;strong&gt;Only select repositories&lt;/strong&gt; and pick your project repo.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0ccxJ3vG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/29hpt87t25w8fmou9xs4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0ccxJ3vG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/29hpt87t25w8fmou9xs4.png" alt="config install" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3️⃣ Again, click &lt;em&gt;Install&lt;/em&gt;. This should add giscus to your account.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SFfxbbdX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lpw98mfqlegysl86kf7e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SFfxbbdX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lpw98mfqlegysl86kf7e.png" alt="giscus installed" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;4️⃣ Now you need to activate discussions. Go to &lt;em&gt;Settings&lt;/em&gt; in your repository.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--e-jw4RTL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rokt3xcht3dpu8ekcgf5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--e-jw4RTL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rokt3xcht3dpu8ekcgf5.png" alt="settings" width="880" height="127"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Scroll to &lt;em&gt;Features&lt;/em&gt; and tick the box for &lt;strong&gt;Discussions&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--N2tf5GVU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yxxpzzr2rka45ndl7n7s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--N2tf5GVU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yxxpzzr2rka45ndl7n7s.png" alt="discussions" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;5️⃣ Go back to &lt;a href="https://giscus.app/"&gt;https://giscus.app/&lt;/a&gt; and scroll to &lt;em&gt;Configuration&lt;/em&gt;. Here are some things you need to do:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Choose the language giscus will be displayed in.&lt;/li&gt;
&lt;li&gt;Test if your repository meets all three highlighted criteria ( I would recommend to type in the details of your repository because Copy/Paste creates an error).&lt;/li&gt;
&lt;li&gt;In &lt;em&gt;Page ↔️ Discussions Mapping&lt;/em&gt; I selected &lt;strong&gt;Discussion title contains page URL&lt;/strong&gt; but you select whatever you think is the best option for you.&lt;/li&gt;
&lt;li&gt;In &lt;em&gt;Discussion Category&lt;/em&gt; select from the drop-down menu a category where the new discussions will be created. If you want your own custom category then you need to:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Go back to your project repository and click on &lt;strong&gt;Dicussions&lt;/strong&gt; and then the pen icon.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--037VeILa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v96cg7nzy770xvsj2o8d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--037VeILa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v96cg7nzy770xvsj2o8d.png" alt="custom category" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now you should be able to add your custom category name, select discussion format and then click &lt;strong&gt;Create&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Y2ZdqUjK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5g47kqf77j9sh5e0cfig.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Y2ZdqUjK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5g47kqf77j9sh5e0cfig.png" alt="create category" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go back to giscus main page, scroll to &lt;em&gt;Discussion Category&lt;/em&gt;
and your custom category should be there for you to select.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;I did not change anything in section &lt;em&gt;Features&lt;/em&gt; and &lt;em&gt;Theme&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;In &lt;em&gt;Enable giscus&lt;/em&gt; you can see there was a script generated.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;6️⃣ Now, go to your project folder, open your favourite editor and go to &lt;code&gt;components/comments/Giscus.js&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;7️⃣ Update all the data in that file (mine starts on line 33) with the data from the generated script.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--U5MGJaaT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/76zx6naj739u6jm0ybmg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--U5MGJaaT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/76zx6naj739u6jm0ybmg.png" alt="giscus config" width="556" height="279"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;8️⃣ Now, save that file, push it to your repository and voila - you have comments on your website.&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;a&gt;&lt;/a&gt;data/blog
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;title:&lt;/em&gt; - here goes the name of your post, it is required.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;date:&lt;/em&gt; - it is self-explanatory, also required.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;tags:&lt;/em&gt;- this is a required field. If you don't want to use tags then you can leave it as an empty array, like this 👉 &lt;code&gt;['']&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;draft:&lt;/em&gt; - this is an optional but handy feature. Let's say that you are in the middle of writing a post but you don't want it to appear on your website. All you need to do is to type in &lt;code&gt;draft: true&lt;/code&gt; and this post will remain invisible. Type in &lt;code&gt;false&lt;/code&gt; if you want the blog to be visible.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;summary:&lt;/em&gt; - another optional feature. You will use it to give brief information on what is the blog about.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  &lt;a&gt;&lt;/a&gt;public/static
&lt;/h3&gt;

&lt;p&gt;Here you will store your images and favicons.&lt;/p&gt;

&lt;p&gt;If you already have a logo but don't have the favicons, here is what I did.&lt;/p&gt;

&lt;p&gt;First, I &lt;a href="https://www.remove.bg/"&gt;removed background&lt;/a&gt; from my logo.&lt;/p&gt;

&lt;p&gt;Next, I used the updated logo to &lt;a href="https://realfavicongenerator.net/"&gt;generate favicons&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Now all you need to do is to replace existing favicons with your design.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>tutorial</category>
      <category>webdev</category>
      <category>blog</category>
    </item>
    <item>
      <title>How to make your blog feature-rich with Next.js, Tailwind CSS and Vercel.</title>
      <dc:creator>Michal Gornicki</dc:creator>
      <pubDate>Wed, 18 May 2022 16:41:17 +0000</pubDate>
      <link>https://forem.com/m1ner/how-to-make-your-blog-feature-rich-with-nextjs-tailwind-css-and-vercel-3i0g</link>
      <guid>https://forem.com/m1ner/how-to-make-your-blog-feature-rich-with-nextjs-tailwind-css-and-vercel-3i0g</guid>
      <description>&lt;p&gt;📢 &lt;em&gt;Original article is available on my &lt;a href="https://michals-corner.vercel.app/blog/blog-update" rel="noopener noreferrer"&gt;website&lt;/a&gt; where you can also find my Internship Journal.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;A few weeks ago I set up my first blog with the use of &lt;a href="https://dev.to/m1ner/how-to-use-github-pages-to-host-a-blog-4ofd"&gt;GitHub Pages and Markdown&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It was not that complicated and did not require any coding knowledge. &lt;/p&gt;

&lt;p&gt;Today I decided to "pimp my blog"😀. I want it to look a bit better than it already looks but also add more features and maybe separate articles from the internship journal and also maybe add a bit about myself.&lt;/p&gt;

&lt;p&gt;‼️&lt;em&gt;First of all. This blog transformation would not be possible without Timothy who created this amazing starter blog 👏. It comes pre-configured with the latest technologies (Next.js, Tailwind CSS), it is highly customizable and not very difficult to configure. The original repository is available &lt;a href="https://github.com/timlrx/tailwind-nextjs-starter-blog" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/em&gt; ‼️&lt;/p&gt;

&lt;p&gt;This is not going to be as easy as last time but I will try to create a simple tutorial so you will be able to do it yourself.&lt;/p&gt;

&lt;p&gt;Just to let you know, I am using Pop!_OS so if you are using MacOS or Windows then you may have to look for another tutorial 🤷‍♂️. If you are using other Linux distributions then you should be fine(there might be some differences in the command line but I am not expecting anything major).&lt;/p&gt;

&lt;p&gt;Also, you need to run these commands:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;sudo apt install build-essential&lt;/code&gt;&lt;br&gt;
&lt;code&gt;sudo apt install libssl-dev&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We don't need to get into details now but these packages may be required at some stage during this or future projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  Last but not least, you need a GitHub account. It is essential.
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Here are the steps I did to complete my website transformation:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Downloading and installing Node.js&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Starting my "new look" site&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Push everything to GitHub&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Deploying to Vercel&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  &lt;a&gt;&lt;/a&gt;Downloading and installing Node.js
&lt;/h3&gt;

&lt;p&gt;What is &lt;a href="https://nodejs.org/en/" rel="noopener noreferrer"&gt;Node.js&lt;/a&gt;? It is the back-end JavaScript runtime environment. We will also need  &lt;strong&gt;npm&lt;/strong&gt; which is the world's largest software registry and the default package manager for JavaScript. More information about npm is available &lt;a href="https://docs.npmjs.com/about-npm" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;1️⃣First of all check if you need to install Node.js. Open your terminal and type: &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;node -v&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you have it then you will see this(you may have a different version number)👇&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnt36ow3te86fco98ns1r.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%2Fnt36ow3te86fco98ns1r.png" alt="node version"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you don't have it then you will see &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;command 'node' not found...&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;After reading a few articles it looks like the best way to install Node.js is through nvm (node version manager) because it allows to quickly install and use different node versions for different projects.&lt;/p&gt;

&lt;p&gt;2️⃣Open your terminal and type👇&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you don't have curl, install the utility by running the command: &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;sudo apt install curl&lt;/code&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;(curl is used in command lines or scripts to transfer data).&lt;/p&gt;

&lt;p&gt;Close your terminal and open, then type this &lt;code&gt;nvm --v&lt;/code&gt;. If everything worked ok then you should see something like this👇&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb17bl2yt416wvlu3202r.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%2Fb17bl2yt416wvlu3202r.png" alt="nvm install"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's install the latest long term support Node.js with the following command👇&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Now, verify if everything is installed. Type these commands:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;node -v&lt;/code&gt;&lt;br&gt;
&lt;code&gt;npm -v&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1havnv4cuz7wi6rvmmoy.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%2F1havnv4cuz7wi6rvmmoy.png" alt="verifying installation"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you run into any issues, please check this 👉 &lt;a href="https://github.com/nvm-sh/nvm" rel="noopener noreferrer"&gt;very detailed source&lt;/a&gt;.&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;a&gt;&lt;/a&gt;Starting my "new look" site.
&lt;/h3&gt;

&lt;p&gt;1️⃣You need to create a new empty folder(name it whatever you like). If you will try to run the command from step2️⃣ in the directory where you have an existing git project then you will see this message &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;! destination directory is not empty, aborting. Use --force to override&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;2️⃣Open console in your new folder and type 👉&lt;code&gt;npx degit https://github.com/timlrx/tailwind-nextjs-starter-blog.git&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;More likely you will see this message👇&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqjv983rsgsuzvwmusycy.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%2Fqjv983rsgsuzvwmusycy.png" alt="degit installation"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Don't worry, just hit "y" and it will install it. &lt;strong&gt;degit&lt;/strong&gt; makes copies of git repositories, it is like a clone in GitHub.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgzh4s822lz7q1q6eu15z.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%2Fgzh4s822lz7q1q6eu15z.png" alt="GitHub"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you successfully installed degit, run the step2️⃣ command once again and you should see 👉 &lt;code&gt;&amp;gt; cloned timlrx/tailwind-nextjs-starter-blog#HEAD&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;3️⃣Open your favourite editor (I am using Visual Studio Code) and access the cloned folder.&lt;/p&gt;

&lt;p&gt;Here are some files that you need to edit:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;data/siteMetadata.js&lt;/code&gt; - here you personalize your site related information.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;next.config.js&lt;/code&gt; - here you modify the content security policy if you want to use any analytics provider or a commenting solution other than giscus (visitors leave comments and reactions on your website via GitHub).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you are a beginner like myself, I would recommend staying away from that one for a time being. Just leave it be 😉.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;data/authors/default.md&lt;/code&gt; -here you put your info, this will be your "About" page.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;projectsData.js&lt;/code&gt; - if you have any projects completed that you would like to show then you need to edit this file as well.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;headerNavLinks.js&lt;/code&gt; - here you customize the navigation links.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;data/blog&lt;/code&gt; - here you put in your blog posts. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;public/static&lt;/code&gt; - here you keep your images and favicons. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;4️⃣Once you are happy with your changes then you need to run this command 👉 &lt;code&gt;npm install&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;5️⃣Now enter &lt;code&gt;npm run dev&lt;/code&gt;. This will create a build directory with a production build of your app and also will highlight any issues which may potentially cause your app to break.&lt;/p&gt;

&lt;p&gt;I had to resolve the chaining issue in file &lt;code&gt;components/comments/Giscus.js&lt;/code&gt; and on line 31 I removed all "?"(no, I am not that advanced, I managed to fix it with help of my mentor👏).&lt;/p&gt;

&lt;p&gt;6️⃣After you are happy that all issues were resolved🤞, you need to open this address &lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt; in your browser to see if the website looks like you wished.&lt;/p&gt;

&lt;p&gt;This is mine at the moment👇&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%2Fysa8a9nuvulwkqbjhpz7.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%2Fysa8a9nuvulwkqbjhpz7.png" alt="new look"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h3&gt;
  
  
  &lt;a&gt;&lt;/a&gt; Push everything to GitHub.
&lt;/h3&gt;

&lt;p&gt;So far everything happened locally, on my laptop. Now it is the time to send everything to my GitHub.&lt;/p&gt;

&lt;p&gt;This is the first time where I created a project before having the repository.&lt;/p&gt;

&lt;p&gt;I usually clone repositories with HTTPS and then I need to create a token to securely communicate with GitHub but this time I decided to try SSH(Secure Shell). Not only because it is considered more secure but entering the secure token before each push was getting on my nerves.&lt;/p&gt;

&lt;p&gt;1️⃣First, open a terminal and generate a new SSH key. Follow these instructions 👉 &lt;a href="https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#generating-a-new-ssh-key" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;⚠️&lt;em&gt;You need to remember the password that you created in step 1️⃣ because you will need it in the future(each time PC reboots you will need to enter it).&lt;/em&gt;⚠️&lt;/p&gt;

&lt;p&gt;To copy that key, go to your &lt;strong&gt;Home&lt;/strong&gt; directory and in settings, tick the box to show hidden files.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh3mumk4tnz4g7kssnwt6.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%2Fh3mumk4tnz4g7kssnwt6.png" alt="hidden files"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Locate your .ssh folder and then open .pub file and copy your key.&lt;/p&gt;

&lt;p&gt;2️⃣Next, you need to add your key to your GitHub account as per instructions in this 👉 &lt;a href="https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account" rel="noopener noreferrer"&gt;document&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;3️⃣Go to the folder where you keep your project and open the terminal. Add your SSH key to the ssh-agent. This is explained 👉&lt;a href="https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#adding-your-ssh-key-to-the-ssh-agent" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;4️⃣Now, please follow this great tutorial on &lt;a href="https://www.digitalocean.com/community/tutorials/how-to-push-an-existing-project-to-github" rel="noopener noreferrer"&gt;How to Push an Existing Project to GitHub&lt;/a&gt;. To push your repository to GitHub, you will need these commands👇.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git init
git add .
git commit -m 'some comment'
git remote add origin git@github.com:your-GitHub-name/new-project.git
git push --set-upstream origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I really recommend going through the tutorial first(unless you know what you are doing).&lt;/p&gt;

&lt;p&gt;5️⃣All files should be now uploaded to your GitHub repository.&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;a&gt;&lt;/a&gt; Deploying to Vercel.
&lt;/h3&gt;

&lt;p&gt;Vercel is another company offering website hosting, and it is maybe even easier to deploy your website than with GitHub Pages. Again, personal opinion.&lt;/p&gt;

&lt;p&gt;1️⃣Go to their &lt;a href="https://vercel.com/" rel="noopener noreferrer"&gt;website&lt;/a&gt; and click "Start Deploying" and then pick the option to sign in with your GitHub.&lt;/p&gt;

&lt;p&gt;2️⃣After successful sign in you should see this 👇&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft8cr2wxs5mr5wdbd09mh.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%2Ft8cr2wxs5mr5wdbd09mh.png" alt="vercel"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3️⃣Click on "Select a Git Namespace" and then "Add GitHub Account".&lt;/p&gt;

&lt;p&gt;Select your account and then tick "Only select repositories"  which will allow you to pick the one with the project.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj46jg1984d9pnclf1urm.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%2Fj46jg1984d9pnclf1urm.png" alt="vercel setup"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now click "Install"(you will need to enter your GitHub password).&lt;/p&gt;

&lt;p&gt;4️⃣Once successful, you should see this 👇&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd7r8wju0kudeoputbo7o.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%2Fd7r8wju0kudeoputbo7o.png" alt="import to vercel"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click "Import".&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdubulac22eoahpy5obj6.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%2Fdubulac22eoahpy5obj6.png" alt="almost done"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Change "Project Name" to the name of your website. This is important because it will become a part of your domain name i.e. &lt;em&gt;"your-website-name.vercel.app"&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Now, click "Deploy".&lt;/p&gt;

&lt;p&gt;It will take a minute which (if you are lucky😉) should finish with your website deployed.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flu539dn3my56pmbfs21p.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%2Flu539dn3my56pmbfs21p.png" alt="deployed website"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Clicking on the image will take you to your website.&lt;/p&gt;

&lt;p&gt;That's... The best luck scenario. If you managed it without any issues then go and get yourself some Lotto tickets😉. &lt;/p&gt;

&lt;p&gt;More likely you will encounter some errors or issues. That's ok. Investigating these problems will increase your knowledge because you will need to read more material/documentation.&lt;/p&gt;

&lt;p&gt;I understand that this might be frustrating. Believe me, &lt;strong&gt;I KNOW&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;Once you pass this stage where you want to smash your laptop with the hammer and you will make this project work, I can guarantee you that you will feel amazing.&lt;/p&gt;

&lt;p&gt;If after deployment some things don't work yet, don't worry. It is your ongoing project. Who knows, maybe with time, you will select a different blog to clone or you will build your own from scratch. &lt;/p&gt;

&lt;p&gt;Keep your chin up and don't give up 💪.&lt;/p&gt;

&lt;p&gt;As always, please share your comments👇. I am still learning so if you notice something wrong with the article, please let me know and together we will improve it🤝.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>tutorial</category>
      <category>webdev</category>
      <category>blog</category>
    </item>
    <item>
      <title>Increasing visibility of my articles.</title>
      <dc:creator>Michal Gornicki</dc:creator>
      <pubDate>Tue, 19 Apr 2022 20:44:27 +0000</pubDate>
      <link>https://forem.com/m1ner/increasing-visibility-of-my-articles-1bmd</link>
      <guid>https://forem.com/m1ner/increasing-visibility-of-my-articles-1bmd</guid>
      <description>&lt;p&gt;📢 &lt;em&gt;Original article is available on my &lt;a href="https://michals-corner.vercel.app/blog/visibility"&gt;website&lt;/a&gt; where you can also find my Internship Journal.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;In this article, I will share my experience and opinion on how I went about increasing the visibility of my blog.&lt;/p&gt;

&lt;p&gt;What I describe here are my personal views which may be different to yours, but that's ok. No need to get angry. You are more than welcome to leave your opinion in the comment section below.&lt;/p&gt;

&lt;p&gt;After I posted my first internship blog on &lt;a href="https://dev.to/m1ner/how-to-use-github-pages-to-host-a-blog-4ofd"&gt;How to use GitHub Pages and Markdown to host a website&lt;/a&gt; I went on LinkedIn to promote it.&lt;/p&gt;

&lt;p&gt;It was very straightforward. I clicked on &lt;em&gt;Start a post&lt;/em&gt;, wrote an introduction, pasted the link to the blog, added hashtags and hit &lt;em&gt;Post&lt;/em&gt;. Quite easy.&lt;/p&gt;

&lt;p&gt;I used hashtags to reach an audience other than just my followers so this can lead to greater engagement. I use only four hashtags.&lt;/p&gt;

&lt;p&gt;I read a few articles and some pointed out that tags are important but plastering your post with them makes it look "spammy". That may put off the audience. So I decided to use a maximum of four (if you think that this is a bad idea, please let me know 👇).&lt;/p&gt;

&lt;p&gt;I had an exactly similar experience with Twitter. Ease of use, very straightforward. &lt;/p&gt;

&lt;p&gt;I will post on LinkedIn my main blogs and maybe 🤔 weekly internship updates.&lt;/p&gt;

&lt;p&gt;I am planning to use Twitter for daily updates. Not only I will be sharing my blogs when they are ready but I will add my &lt;a href="https://m1ner79.github.io/"&gt;internship journal&lt;/a&gt; news.&lt;/p&gt;

&lt;p&gt;My tag "strategy" on Twitter - I am using #100DaysOfCode. This tag refers to a challenge to code a minimum of an hour every day for the next 100 days. More of it 👉 &lt;a href="https://www.100daysofcode.com/"&gt;here&lt;/a&gt; . Whenever I tweet with this hashtag there are bots that present my content to loads of readers(bots are automated Twitter accounts, programmed to perform tasks such as tweet and retweet content for specific goals on a large scale).&lt;/p&gt;

&lt;p&gt;Both of these platforms allow me to analyse how my post or tweet performs. All I need to do is to click on post/tweet and then below the content I can see this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1TJUcbva--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zca7max6glpllq8jdhdm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1TJUcbva--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zca7max6glpllq8jdhdm.png" alt="Image description" width="880" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When I click on the highlighted content then:&lt;br&gt;
LinkedIn provides me with something like this 👇&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BJh25kxW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/okt1qwtlcxhys9wqzpar.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BJh25kxW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/okt1qwtlcxhys9wqzpar.png" alt="Image description" width="880" height="550"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and Twitter with something like this 👇&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kbvkL8FB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vxmmaxt5e8b2mwdwovk0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kbvkL8FB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vxmmaxt5e8b2mwdwovk0.png" alt="Image description" width="586" height="552"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see there is plenty of information that can be very useful to verify if I am reaching the right people or do I need to change something to achieve my goals.&lt;/p&gt;

&lt;p&gt;I decided to explore other options and I focused on two platforms that were new to me: Reddit and Hacker News.&lt;/p&gt;

&lt;p&gt;Signing up for them wasn't an issue, posting either, but everything after that was not as intuitive as Twitter or LinkedIn. &lt;/p&gt;

&lt;p&gt;I shared my blog at around this same time and pretty much immediately both were taken down 🤷‍♂️.&lt;/p&gt;

&lt;p&gt;On Reddit, I have received this 👇&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TsPTNnRI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zd720rww9g869lp2uet2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TsPTNnRI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zd720rww9g869lp2uet2.png" alt="Image description" width="709" height="319"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When I was trying to re-post it, it was getting blocked. Eventually, I managed to post it but when I checked recently there was no engagement.&lt;/p&gt;

&lt;p&gt;On Hacker News, I couldn't figure out why my post was taken down so I am assuming that it is for similar reasons as on Reddit.&lt;/p&gt;

&lt;p&gt;I must admit that both platforms are not that intuitive, especially Hacker News. I guess because it is new to me, I need some time to get used to it. &lt;/p&gt;

&lt;p&gt;There are a few other things that I observed over the last few days. Mainly, when writing a blog don't try to be perfect 🤷‍♂️. Up until now, I was trying to be perfect. I was chopping and changing and what I end up with is delay after delay.&lt;/p&gt;

&lt;p&gt;Write it down. Run it through Grammarly and then read it out loud. If it makes sense - post it. If you will try to make it perfect you will never finish. If there are any content issues then don't worry, readers will let you know in the comments section.&lt;/p&gt;

&lt;p&gt;Another, very important thing. Make sure that your software auto-saves your work. I was testing a new application for markdown and my laptop froze. &lt;/p&gt;

&lt;p&gt;I thought, no worries. Well... I lost everything because the document didn't recover. You can imagine that there was a lot of 😡🤬🤬🤬😡.&lt;/p&gt;

&lt;p&gt;Aha, if you are blogging for a living I have a newfound respect for you. There is so much to do apart from writing a blog. I didn't even mention Search Engine Optimisation.&lt;/p&gt;

&lt;p&gt;As usual, thank you for your time and please let me know what you think in the comments below.&lt;/p&gt;

</description>
      <category>blog</category>
      <category>beginners</category>
      <category>learning</category>
      <category>devjournal</category>
    </item>
    <item>
      <title>How to use GitHub Pages and Markdown to host a website.</title>
      <dc:creator>Michal Gornicki</dc:creator>
      <pubDate>Mon, 11 Apr 2022 21:50:51 +0000</pubDate>
      <link>https://forem.com/m1ner/how-to-use-github-pages-to-host-a-blog-4ofd</link>
      <guid>https://forem.com/m1ner/how-to-use-github-pages-to-host-a-blog-4ofd</guid>
      <description>&lt;p&gt;📢 &lt;em&gt;Original article is available on my &lt;a href="https://michals-corner.vercel.app/blog/githubpages_markdown" rel="noopener noreferrer"&gt;website&lt;/a&gt; where you can also find my Internship Journal.&lt;/em&gt;&lt;/p&gt;




&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;GitHub Pages is a static site hosting service that takes HTML, CSS, and JavaScript files straight from a repository on GitHub,optionally runs the files through a build process, and publishes a website.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;If you are a seasoned programmer or tech guru then this post may not be for you. Although you are still welcome to read it as you may find some issues with this tutorial and I am open to corrections.&lt;/p&gt;

&lt;p&gt;I will try to write it as simple (like myself) as possible so even people who are not tech-savvy will be able to follow and start blogging or just publish a website.&lt;/p&gt;

&lt;p&gt;Here is the summary of what you will find in this post:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What you need before you can follow this tutorial&lt;/li&gt;
&lt;li&gt;Creating a new repository&lt;/li&gt;
&lt;li&gt;Setting up your website&lt;/li&gt;
&lt;li&gt;Working on your website/blog&lt;/li&gt;
&lt;li&gt;Sources required to master Git, GitHub and Markdown&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  &lt;a&gt;&lt;/a&gt;What you need
&lt;/h3&gt;

&lt;p&gt;Most important. Before you start you need to have a GitHub account.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is GitHub?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Briefly, it is a platform offering internet hosting for software development and version control. You are going to store your code here and you will be able to collaborate with whoever you wish and track and control changes.&lt;/p&gt;

&lt;p&gt;I will not cover here how to open a GitHub account. There are many tutorials available on YouTube or just search on Google.&lt;br&gt;
I would recommend just diving right in as the process is not that complicated. Just go to &lt;a href="https://github.com" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; click "Sign up for GitHub" and follow the instructions. They are straightforward.&lt;/p&gt;

&lt;p&gt;I am assuming that you already have an account and you are logged in.&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;a&gt;&lt;/a&gt;Creating a new repository
&lt;/h3&gt;

&lt;p&gt;1️⃣ On the top right-hand side click on your avatar and then click &lt;em&gt;"Your repositories"&lt;/em&gt;. &lt;/p&gt;

&lt;p&gt;Depending if you are just starting fresh, you may see just info that "&lt;em&gt;your profile name&lt;/em&gt; doesn’t have any public repositories yet." or the list of your existing repositories. &lt;br&gt;
2️⃣ Most important is that you need to click on &lt;em&gt;"New"&lt;/em&gt;. &lt;/p&gt;

&lt;p&gt;Now you should see this 👇&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu8t1kchg8yn8bkutz41n.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%2Fu8t1kchg8yn8bkutz41n.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your repository name should be the same as the owner followed by github.io so like &lt;strong&gt;m1ner79&lt;/strong&gt; is an owner so the repository is &lt;strong&gt;m1ner79.github.io&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A description is optional so you can leave it blank, also leave the selection at Public.&lt;/p&gt;

&lt;p&gt;3️⃣ Next, you need to tick &lt;em&gt;"Add a README file"&lt;/em&gt; - here is where you will be creating your website content.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;"Add .gitignore"&lt;/em&gt; is not required at this stage because .gitignore creates a list of files that do not need to be tracked. This can be added at any moment and depending on how complicated your blog is, might not be necessary at all.&lt;/p&gt;

&lt;p&gt;4️⃣ Tick &lt;em&gt;"Choose a license"&lt;/em&gt; because it will help future collaborators what they can and can't do with your code. You can't go wrong with "MIT License" so select it and click &lt;em&gt;"Create repository"&lt;/em&gt; &lt;strong&gt;(Before you are going to follow my advice, please have a look 👉 &lt;a href="https://dev.to/kbeirne/comment/1ngbp"&gt;here&lt;/a&gt; where Kevin makes a valid observation)&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;You should see this 👇&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsd1ezuqxl7047ntv73qk.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%2Fsd1ezuqxl7047ntv73qk.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We are almost there. I know, it is &lt;strong&gt;THAT&lt;/strong&gt; easy.&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;a&gt;&lt;/a&gt;Setting up your website
&lt;/h3&gt;

&lt;p&gt;1️⃣ Now, as you can see on the screenshot below, click &lt;em&gt;"Settings"&lt;/em&gt; and then on the left select &lt;em&gt;"Pages"&lt;/em&gt; (highlighted in green).&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqumso5c39u31frzx1dhq.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%2Fqumso5c39u31frzx1dhq.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After you do that you will be advised where is your website "Your site is published at...".&lt;/p&gt;

&lt;p&gt;2️⃣ Source(red highlight) should be set to &lt;em&gt;"main"&lt;/em&gt; and &lt;em&gt;"/root"&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;3️⃣ Now the best part. Click on &lt;em&gt;"Choose a theme"&lt;/em&gt; (on my screenshot, it says &lt;em&gt;"Change theme"&lt;/em&gt; because I already selected the theme).&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F00byw5en2mp0lf211l2m.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%2F00byw5en2mp0lf211l2m.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the top each square represents a theme and below you will see what your website will look like when you select it.&lt;/p&gt;

&lt;p&gt;4️⃣ Once you are happy with your theme, click on &lt;em&gt;"Select theme"&lt;/em&gt; and that's it. You will be presented with a page full of markdown language like this 👇&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyuabs1zxtui1xpo5iv69.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%2Fyuabs1zxtui1xpo5iv69.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;5️⃣ Don't worry, just scroll to the bottom and click &lt;em&gt;"Commit new file"&lt;/em&gt;.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0f1p3v4zaw94a2d6l7wt.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%2F0f1p3v4zaw94a2d6l7wt.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now you should see an extra file in your repository.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvizs5n8ty2ypg1wnzhno.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%2Fvizs5n8ty2ypg1wnzhno.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Yours might be different because you may selected another theme.&lt;/p&gt;

&lt;p&gt;Now starts the best part. &lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;a&gt;&lt;/a&gt;Working on your website/blog
&lt;/h3&gt;

&lt;p&gt;Depending on your needs there are two ways to write your blog. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Option one:&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;1️⃣ Click on README.md file and then on the pencil, like on the highlighted picture below.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpxh20ifmvb9liwvfbtpf.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%2Fpxh20ifmvb9liwvfbtpf.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2️⃣ All you need to do now is remove everything and start writing your blog. In the end, make sure to commit your changes.That will amend your file and new content will appear on your website.&lt;/p&gt;

&lt;p&gt;Option one has also another way of editing your code ("another way" is marked with*️⃣). &lt;/p&gt;

&lt;p&gt;*️⃣1️⃣ If you have your repository open and you are on your laptop /desktop(it will work with other devices too), all you need to do is just hit "."&lt;/p&gt;

&lt;p&gt;This will open Visual Studio Code in your browser and you can start editing right away.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6mopon1135t300j0kx7a.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%2F6mopon1135t300j0kx7a.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;*️⃣2️⃣ After you will make your changes, you will notice that the source control icon indicates a number of changes. Click on it and then on the top you will see a space where you will enter a message.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuplpmtof1nd1hfake29l.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%2Fuplpmtof1nd1hfake29l.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;*️⃣3️⃣ This message needs to make sense. Just assume that there might be someone else reading that comment so give them a chance to understand what you did i.e. "add a folder for images" or "update xyz file".&lt;/p&gt;

&lt;p&gt;*️⃣4️⃣ Now click the tick and your changes are pushed to your repository. &lt;/p&gt;

&lt;p&gt;Give it a few seconds and your changes should be visible when clicking on your GitHub Pages address.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Option two:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A bit more complex and I am doing that(because I like a challenge 😉).&lt;/p&gt;

&lt;p&gt;1️⃣ You need to create a folder on your local machine where you are going to keep all files required for your blog. Open a terminal. &lt;/p&gt;

&lt;p&gt;2️⃣ Now, in your repository, click &lt;em&gt;"Code"&lt;/em&gt; and copy that highlighted link.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flhz8ujbwqs7wbofc2vxc.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%2Flhz8ujbwqs7wbofc2vxc.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3️⃣ Go back to your terminal and type in "git clone &lt;em&gt;your link goes here&lt;/em&gt;"&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3xn60g47u5oc9i1bwn0y.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%2F3xn60g47u5oc9i1bwn0y.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This will download all files into your folder. You can now use your favourite editor to work on your blog.&lt;/p&gt;

&lt;p&gt;4️⃣ After you have done all changes you need to push these to your repository. &lt;/p&gt;

&lt;p&gt;I will not cover how to do it here, instead, I will share some links to the tutorials I have used myself to get better with Git and GitHub.&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;a&gt;&lt;/a&gt;Hone your Git, GitHub and Markdown skills
&lt;/h3&gt;

&lt;p&gt;This is a very good tutorial from well known freecodecamp.com 👉 &lt;a href="https://www.freecodecamp.org/news/a-beginners-guide-to-git-how-to-create-your-first-github-project-c3ff53f56861/" rel="noopener noreferrer"&gt;How to Start and Create your First Repository&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you prefer YouTube then try this one 👉 &lt;a href="https://youtu.be/8Dd7KRpKeaE" rel="noopener noreferrer"&gt;Git and GitHub explained for beginners&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Also, I know that I said it is easy to start writing your blog but you need to get some of the basics for the markdown language so your website will render the way you wanted.&lt;/p&gt;

&lt;p&gt;Here is a great source 👉 &lt;a href="https://www.markdownguide.org/basic-syntax/" rel="noopener noreferrer"&gt;Markdown Guide&lt;/a&gt; and if you like emojis then this is a must 👉 &lt;a href="https://emojipedia.org" rel="noopener noreferrer"&gt;Emojipedia&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;That would be all. Please let me know what you think about this post.&lt;/p&gt;

&lt;p&gt;Oh, and if you wish to check my internship journal (shameless plug) then click here 👉 &lt;a href="https://m1ner79.github.io/" rel="noopener noreferrer"&gt;Internship Journal&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Thank you for your time, bye!&lt;/p&gt;

</description>
      <category>github</category>
      <category>blogging</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Thread Synchronization within Linux Operating System.</title>
      <dc:creator>Michal Gornicki</dc:creator>
      <pubDate>Tue, 01 Mar 2022 22:41:55 +0000</pubDate>
      <link>https://forem.com/m1ner/thread-synchronization-within-linux-operating-system-5437</link>
      <guid>https://forem.com/m1ner/thread-synchronization-within-linux-operating-system-5437</guid>
      <description>&lt;p&gt;This short article is about thread synchronization. It will examine the matter under the following headings: Race Condition, Mutex Locks, Critical Section Problem, Solutions to Critical Section Problem, and Deadlock &amp;amp; Starvation. &lt;/p&gt;

&lt;h2&gt;
  
  
  Race Condition
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;“A thread is a flow of execution through the process code, with its program counter..., system registers which hold its current working variables, and a stack which contains the execution history[1]”.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A race condition can be defined as the behavior of an electronic, software or another system, in which the output depends on the sequence or timing of uncontrollable events.This term refers to the idea of two signals competing to influence the output first. When events do not occur in the order intended by the programmer, it becomes a bug.&lt;/p&gt;

&lt;p&gt;A critical section is where shared variable scan be accessed. A race condition may occur inside a critical section. In a critical section of code, multiple threads execute the code concurrently, and the sequence in which each thread executes the code can make a significant difference to the result[2].&lt;/p&gt;

&lt;p&gt;Semaphore is a signalling mechanism of an integer variable that is shared between threads and used to solve the critical section problem and to accomplish process synchronization in the multiprocessing environment.Semaphore enables multiple processes to be managed with simple integer values.Semaphore uses two atomic operations: wait() and signal() for process synchronization.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mutex Locks
&lt;/h2&gt;

&lt;p&gt;Mutex lock is a simplified version of semaphore. It is a shared variable that can be in one of two states: unlocked or locked.If a process or thread needs access to the critical region, it calls mutex lock. &lt;/p&gt;

&lt;p&gt;If the mutex is unlocked the call succeeds and the calling thread is free to enter the critical region.If the mutex is locked, the calling thread is blocked until the thread in the critical region is finished and calls mutex unlock. When multiple threads are blocked on the mutex, one of them is selected randomly and allowed to acquire the lock[3].&lt;/p&gt;

&lt;p&gt;There is some vagueness between binary semaphore and mutex. The use cases of mutex and semaphore are different. Because of their implementation similarity, mutex would be referred to as a binary semaphore.&lt;/p&gt;

&lt;p&gt;Mutex is a locking mechanism created to synchronize access to a resource. Only one task can obtain the mutex which means that only that process can release the lock (mutex).&lt;/p&gt;

&lt;p&gt;Semaphore is a signalling mechanism; an interrupt is activated upon which an interrupt service routine (ISR) signals the call processing task to wake up[4].&lt;/p&gt;

&lt;h2&gt;
  
  
  Critical Section Problem
&lt;/h2&gt;

&lt;p&gt;A critical section is a part of the code where shared data can be manipulated and a possible race condition may occur. The critical section problem is to create a procedure where processes can synchronize their activities to jointly share data.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NPifmCIW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u6bb3uie7usqys47tjq1.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NPifmCIW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u6bb3uie7usqys47tjq1.jpg" alt="Image description" width="755" height="229"&gt;&lt;/a&gt;&lt;br&gt;
Following conditions are required to deal with critical section problem:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Mutual exclusion–only one process is active inside the critical section.&lt;/li&gt;
&lt;li&gt;Progress–programs will jointly decide which process will get inside a critical section.&lt;/li&gt;
&lt;li&gt;Bounded waiting–how long a program must wait before it can get inside critical section[5].&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Race Condition, mutex lock and critical section problem which were discussed in above paragraphs are demonstrated and explained below.&lt;/p&gt;

&lt;p&gt;This program will show what is happening when mutex lock is not used.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TblfGH0b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/isjnm5ofyoyqcizn7w0b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TblfGH0b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/isjnm5ofyoyqcizn7w0b.png" alt="Image description" width="763" height="603"&gt;&lt;/a&gt;&lt;br&gt;
As per Figure 2.2,we can see that race condition starts when both threads t1 and t2 race towards the shared variable “x”. Both threads entering now the critical section of the code at line 15. &lt;br&gt;
Without the lock,both treads can write in the accumulated register at the same time which will affect the result. &lt;/p&gt;

&lt;p&gt;This behavior is noticeable in Figure 2.3 below.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hOBZJWbd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kp3jhx8n5hfdjhjsrfge.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hOBZJWbd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kp3jhx8n5hfdjhjsrfge.png" alt="Image description" width="743" height="751"&gt;&lt;/a&gt;&lt;br&gt;
Figure above shows that not a single result is this same and is far from the expected outcome of 2000000. The result depends on which thread gets to the shared variable first (line 7, Figure 2.2) and then which is going to be executed first.&lt;br&gt;
Highlighted in yellow is the moment when two threads entered the critical section at the same time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Solutions to Critical Section Problem
&lt;/h2&gt;

&lt;p&gt;There are two types of solutions to the critical section problem:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hardware solutions&lt;/li&gt;
&lt;li&gt;Software solutions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hardware solutions are using memory barriers, compare-and-swap operations, and atomic variables[5].&lt;/p&gt;

&lt;p&gt;A memory barrier is a type of instruction that makes a central processing unit (CPU) or compiler enforce an ordering constraint on memory operations issued before and after the barrier instruction[6].&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Compare and swap operation compares the value of a variable with an expected value, and if the values are equal then swaps the value of the variable for a new value[7].”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The atomic operation takes place when two operations running in parallel, a processor reads and writes a location during the same data transmission, and until this operation is completed, another input/output process cannot perform memory reading or writing tasks[8].&lt;/p&gt;

&lt;p&gt;Software solutions are using mutex locks, semaphores, monitors, and condition variables.The code below demonstrates the use of mutex locks to address the critical section problem.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--soIhKQ2n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1im0bt0z8hsct2kra005.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--soIhKQ2n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1im0bt0z8hsct2kra005.png" alt="Image description" width="763" height="703"&gt;&lt;/a&gt;&lt;br&gt;
The code in Figure 2.4is almost the same as in Figure 2.2 with one significant difference – mutex lock. &lt;br&gt;
Mutex lock() was introduced just before threads can enter the critical section (line 15 of the code) and then mutex unlock() was added at the end of the critical section.&lt;/p&gt;

&lt;p&gt;This means that threads t1 and t2 still racing for that shared variable (line 11) but then whichever thread gets first into the critical section then it locks it and no other thread can be executed until that first one unlocks the critical section.&lt;/p&gt;

&lt;p&gt;Figure 2.5 below show the considerable impact of the mutex locks.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WD8uICxT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qhel0avqx4ikmyzz3nb4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WD8uICxT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qhel0avqx4ikmyzz3nb4.png" alt="Image description" width="755" height="754"&gt;&lt;/a&gt; &lt;br&gt;
Figure 2.5 shows that all results are the same and with the expected outcome of 2000000. Thread synchronization took place by the use of mutex.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deadlock &amp;amp; Starvation
&lt;/h2&gt;

&lt;p&gt;Deadlock and starvation are conditions where processes demanding a resource have been deferred for a long time but there are differences between these conditions.&lt;/p&gt;

&lt;p&gt;Deadlock takes place when several processes hold a resource and wait to acquire a resource that is held by some other processes.&lt;br&gt;
Figure 2.6 illustrates the deadlock situation.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--as-jy8gJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ins2ays914cv9gut5208.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--as-jy8gJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ins2ays914cv9gut5208.png" alt="Image description" width="692" height="563"&gt;&lt;/a&gt;&lt;br&gt;
Four conditions are required for the deadlock to take place:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Mutual exclusion–one process at a time can use a resource,and if another process needs to access the same resource, then it must wait until the other process releases it.&lt;/li&gt;
&lt;li&gt;Hold and Wait–a process must hold a resource and wait to obtain another resource that is held by another process.&lt;/li&gt;
&lt;li&gt;No Preemption–a process that holds the resources must release them voluntarily when it has completed its task.&lt;/li&gt;
&lt;li&gt;Circular wait–a process must circularly wait for resources as per Figure 2.6.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Starvation happens when processes with high priorities constantly use resources, which prevents low priority processes from obtaining them or when a process is never given the resources it requires for execution because of faulty resource allocation judgments[9].&lt;/p&gt;

&lt;p&gt;I hope that you have enjoyed this post, please let me know what you think about it in the comments section below.&lt;/p&gt;

&lt;p&gt;If you wish to study thread synchronization in depth then here are the sources I used to create this post:&lt;/p&gt;

&lt;p&gt;[1] Tutorialspoint.com. n.d. Operating System - Multi-Threading. [online] Available at:&lt;a href="https://www.tutorialspoint.com/operating_system/os_multi_threading.htm"&gt;https://www.tutorialspoint.com/operating_system/os_multi_threading.htm&lt;/a&gt; [Accessed 3 December 2021].&lt;br&gt;
[2] Barnes, R., 2018. Race Condition, Critical Section and Semaphore. [online]Tutorialspoint.com. Available at: 
section-and-semaphore&amp;gt; [Accessed 15 November 2021].&lt;br&gt;
[3] Tanenbaum, A.S. and Bos, H., 2015. Modern operating systems. 4th ed. Pearson, pp.135,pp850.&lt;br&gt;
[4] GeeksforGeeks. 2021. Mutex vs Semaphore - GeeksforGeeks. [online] Available at:&lt;a href="https://www.geeksforgeeks.org/mutex-vs-semaphore/"&gt;https://www.geeksforgeeks.org/mutex-vs-semaphore/&lt;/a&gt; [Accessed 6 December 2021].&lt;br&gt;
[5] Silberschatz, A., Galvin, P. and Gagne, G., 2018. Operating system concepts. 10th ed.&lt;br&gt;
Hoboken, N.J.: Wiley, pp.55, pp.106-110, pp.287.&lt;br&gt;
[6] En.wikipedia.org. n.d. Memory barrier - Wikipedia. [online] Available at:
lso%20known,and%20after%20the%20barrier%20instruction.&amp;gt; [Accessed 20 November 2021].&lt;br&gt;
[7] Jenkov, J., 2021. [online] Tutorials.jenkov.com. Available at:&lt;a href="http://tutorials.jenkov.com/java-concurrency/compare-and-swap.html"&gt;http://tutorials.jenkov.com/java-concurrency/compare-and-swap.html&lt;/a&gt; [Accessed 20 November 2021].&lt;br&gt;
[8] Techopedia.com. 2011. What is an Atomic Operation? - Definition from Techopedia.[online] Available at: &lt;a href="https://www.techopedia.com/definition/3466/atomic-operation"&gt;https://www.techopedia.com/definition/3466/atomic-operation&lt;/a&gt;[Accessed 20 November 2021].&lt;br&gt;
[9] &lt;a href="http://www.javatpoint.com"&gt;www.javatpoint.com&lt;/a&gt;. n.d. Difference between Deadlock and Starvation - javatpoint.[online] Available at: &lt;a href="https://www.javatpoint.com/deadlock-vs-starvation"&gt;https://www.javatpoint.com/deadlock-vs-starvation&lt;/a&gt; [Accessed 21 November 2021].&lt;/p&gt;

&lt;p&gt;Header picture thanks to the &lt;a href="https://pixabay.com/images/id-4854847/"&gt;https://pixabay.com/images/id-4854847/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>thread</category>
      <category>synchronisation</category>
      <category>mutex</category>
    </item>
    <item>
      <title>Processes within the Linux Operating System.</title>
      <dc:creator>Michal Gornicki</dc:creator>
      <pubDate>Mon, 31 Jan 2022 16:02:02 +0000</pubDate>
      <link>https://forem.com/m1ner/processes-within-the-linux-operating-system-1c52</link>
      <guid>https://forem.com/m1ner/processes-within-the-linux-operating-system-1c52</guid>
      <description>&lt;p&gt;This post will explore the following topics: Process Management, Process Creation, Process Scheduling, and Process Destruction.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Process Management&lt;/strong&gt;
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;"Process management includes creating and deleting processes and providing mechanisms for processes to communicate and synchronize with each other"[1].&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A process is a running program (active entity). The execution of processes must be sequential, a program counter specifies the next instruction to execute and the associated resources. A single process cannot execute its instructions in parallel. Once an executable file has been loaded into memory, a program becomes a process[1].&lt;/p&gt;

&lt;p&gt;The memory layout of a process is typically represented by multiple sections and is shown in Figure 1.1.&lt;/p&gt;

&lt;p&gt;These sections include:&lt;br&gt;
• &lt;strong&gt;Text section&lt;/strong&gt; — the executable code&lt;br&gt;
• &lt;strong&gt;Data section&lt;/strong&gt; — global variables&lt;br&gt;
• &lt;strong&gt;Heap section&lt;/strong&gt; — when the program is running, memory is dynamically allocated&lt;br&gt;
• &lt;strong&gt;Stack section&lt;/strong&gt; — this is temporary data storage when using functions (such as function parameters, return addresses, and local variables)&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zDiugSIw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1bq6kgigddd5pqmlv03h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zDiugSIw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1bq6kgigddd5pqmlv03h.png" alt="Image description" width="471" height="263"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Processes change their states as they execute. The state of a process is partly defined by the activity of that process. The following are possible states for a process as shown in Figure 1.2:&lt;/p&gt;

&lt;p&gt;• &lt;strong&gt;New&lt;/strong&gt; – a process is created&lt;br&gt;
• &lt;strong&gt;Running&lt;/strong&gt; – instructions are executed&lt;br&gt;
• &lt;strong&gt;Waiting&lt;/strong&gt;– a process is waiting for some event to occur (such as an Input/Output (I/O) completion or reception of a signal)&lt;br&gt;
• &lt;strong&gt;Ready&lt;/strong&gt;– a process is waiting to be allocated to a processor&lt;br&gt;
• &lt;strong&gt;Terminated&lt;/strong&gt;– a process is finished&lt;/p&gt;

&lt;p&gt;All operating systems have the same states they represent, but their names may vary.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iaSl5f8H--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/74lyupgwgkg3pn6nbj4r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iaSl5f8H--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/74lyupgwgkg3pn6nbj4r.png" alt="Image description" width="437" height="248"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Every process in the operating system is represented by a Process Control Block (PCB)—also called a task control block. Each process has a process ID (PID).&lt;/p&gt;

&lt;p&gt;There are many pieces of information related to a specific process, among which are these:&lt;/p&gt;

&lt;p&gt;• &lt;strong&gt;Process state&lt;/strong&gt; – i.e., new, ready, running, waiting, halted, etc.&lt;/p&gt;

&lt;p&gt;• &lt;strong&gt;Program counter&lt;/strong&gt; – it specifies the address of the next instruction to be executed for a process. This state must be saved during an interruption for a process to continue correctly.&lt;/p&gt;

&lt;p&gt;• &lt;strong&gt;Central Processing Unit (CPU) registers&lt;/strong&gt; – depending on the computer architecture, registers differ in number and type, i.e.: accumulators, index registers, stack pointers. Just like the program counter, this state information must be saved during&lt;br&gt;
an interrupt occurs, otherwise, a process will not continue correctly when it is rescheduled to run.&lt;/p&gt;

&lt;p&gt;• &lt;strong&gt;CPU-scheduling&lt;/strong&gt; – process priority information, scheduling queues and schedule parameters can be found here.&lt;/p&gt;

&lt;p&gt;• &lt;strong&gt;Memory-management&lt;/strong&gt; – depending on the memory, which is used by OS, here we can find information about limit registers and the page tables, the segment tables, or the value of the base.&lt;/p&gt;

&lt;p&gt;• &lt;strong&gt;Accounting&lt;/strong&gt; – here is information about real-time CPU usage, time constraints, process numbers, etc.&lt;/p&gt;

&lt;p&gt;• &lt;strong&gt;I/O status&lt;/strong&gt; – information about I/O devices assigned to the process, a list of open files, etc.&lt;/p&gt;

&lt;p&gt;In summary, a PCB as shown in Figure 1.3, is the source of information needed to start or restart a process.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SAkW9YPr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y412p7o9mn94s581nonz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SAkW9YPr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y412p7o9mn94s581nonz.png" alt="Image description" width="439" height="270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Process management in Linux OS views each single-threaded process, or every thread within a multithreaded process or the kernel—as a distinct task. &lt;br&gt;
A process is then exemplified via two key elements, the process control block and the additional information describing the user address space. &lt;br&gt;
PCB is always in memory, but the latter data can be paged in and out of memory[2]. &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Process Creation&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Process creation is replicating the Process Control Block by using fork() system call. Process creation is called the parent process whereas the created process is called the child process.&lt;br&gt;
The parent process can have many children, but the child process can only have one parent. &lt;br&gt;
Parent and child processes share all resources but, they have distinct address spaces.&lt;br&gt;
Figure 1.4 represents process creation using fork().&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eVxmA6f---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pqfbm7evxatigbpk73hf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eVxmA6f---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pqfbm7evxatigbpk73hf.png" alt="Image description" width="523" height="154"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;System call fork() creates a new process, then exec() system call replaces process memory with a new program. The parent calls the wait() process while it waits for the child to terminate[3].&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Process Scheduling&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Often there are multiple processes requiring access to the CPU at this same time. The objective of the process scheduler is to maximize the use of a microprocessor by deciding which of the processes in the queue must be executed next. &lt;br&gt;
The scheduler maintains the queues of processes:&lt;/p&gt;

&lt;p&gt;• &lt;strong&gt;Ready queue&lt;/strong&gt; – all processes in main memory, ready and waiting to execute.&lt;br&gt;
• &lt;strong&gt;Wait queue&lt;/strong&gt; – processes waiting for an event (i.e., I/O).&lt;/p&gt;

&lt;p&gt;The ready queue can be implemented as a first-in, first-out (FIFO) queue, a priority queue, a tree, or just an unordered linked list.&lt;/p&gt;

&lt;p&gt;Types of schedulers:&lt;/p&gt;

&lt;p&gt;• &lt;strong&gt;Long term(job scheduler)&lt;/strong&gt; – it picks processes from the ready queue and loads them into memory for execution.&lt;/p&gt;

&lt;p&gt;• &lt;strong&gt;Medium-term(swapping)&lt;/strong&gt; – it removes processes from the memory which reduces the degree of multiprogramming.&lt;/p&gt;

&lt;p&gt;• &lt;strong&gt;Short term(CPU scheduler)&lt;/strong&gt; – it picks the process ready to be executed next and allocates CPU.&lt;/p&gt;

&lt;p&gt;The context switch in OS is an integral part of multitasking. It saves and restores the state of the CPU in the Process Control Block so that the process can be continued from the same point later stage. Context switch allows many processes to share a single CPU.&lt;/p&gt;

&lt;p&gt;A Process Scheduler plans various processes to be allocated to the CPU based on scheduling algorithms. &lt;br&gt;
These algorithms are either &lt;em&gt;non-preemptive&lt;/em&gt; (once a process enters the running state, it can’t be preempted up until it finishes its assigned time) or &lt;em&gt;preemptive&lt;/em&gt; (is based on priority where a scheduler may preempt a low priority running process at any moment when a high priority process arrives at a ready state).&lt;/p&gt;

&lt;p&gt;Process scheduling algorithms:&lt;/p&gt;

&lt;p&gt;• &lt;strong&gt;First-Come, First-Served (FCFS) Scheduling&lt;/strong&gt; – this is a non-preemptive, pre-emptive scheduling algorithm and it is based on FIFO (First In First Out) queue. Due to high wait time, this algorithm has very poor performance.&lt;/p&gt;

&lt;p&gt;• &lt;strong&gt;Shortest-Job-Next (SJN) Scheduling&lt;/strong&gt; – this is a non-preemptive, pre-emptive scheduling algorithm. Gives a minimum average waiting time for a given set of processes but it requires knowing CPU time in advance.&lt;/p&gt;

&lt;p&gt;• &lt;strong&gt;Priority Scheduling&lt;/strong&gt; – this is a non-preemptive algorithm. Processes are given a priority and the process with the highest will be executed first and then next after that. Priority requirements can be based on memory, time etc.&lt;/p&gt;

&lt;p&gt;• &lt;strong&gt;Shortest Remaining Time(SRT)&lt;/strong&gt; – this is a preemptive scheduling algorithm. Processors are assigned to the jobs next to completion, however, they can be preempted by a newer job with a shorter completion time. Same as the SJN algorithm, it requires CPU time to be known.&lt;/p&gt;

&lt;p&gt;• &lt;strong&gt;Round Robin(RR) Scheduling&lt;/strong&gt; – this is a preemptive scheduling algorithm. Each process is given a set time to execute. Once a process is executed for that length of time then it is preempted and the next process is executed for its given time.&lt;/p&gt;

&lt;p&gt;• &lt;strong&gt;Multiple-Level Queues Scheduling&lt;/strong&gt; – each queue is the combination of existing algorithms with similar characteristics. Each queue has its priorities assigned[4].&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Process Destruction&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A process is destroyed when the execution of code, which was expected to run, terminates.&lt;br&gt;
The process will expire voluntarily or involuntarily.&lt;/p&gt;

&lt;p&gt;Voluntarily:&lt;br&gt;
• &lt;strong&gt;Normal exit&lt;/strong&gt; – process terminates because it has completed its task.&lt;br&gt;
• &lt;strong&gt;Error exit&lt;/strong&gt; – process finds a serious error.&lt;/p&gt;

&lt;p&gt;Involuntary:&lt;br&gt;
• &lt;strong&gt;Fatal error&lt;/strong&gt; – termination caused by a program bug.&lt;br&gt;
• &lt;strong&gt;Killed by another process&lt;/strong&gt; – process runs a system call telling the operating system to terminate other processes as well.&lt;/p&gt;

&lt;p&gt;I hope that you have enjoyed this post, please let me know in the comments section.&lt;/p&gt;

&lt;p&gt;Here are the sources I used to create this post:&lt;/p&gt;

&lt;p&gt;[1] Silberschatz, A., Galvin, P. and Gagne, G., 2018. Operating system concepts. 10th ed. Hoboken, N.J.: Wiley, pp.55, pp.106-110, pp.287.&lt;br&gt;
[2] Tanenbaum, A.S. and Bos, H., 2015. Modern operating systems. 4th ed. Pearson, pp.135,pp850.&lt;br&gt;
[3] Meador, D., 2018. Process Creation vs Process Termination in Operating System. [online] &lt;br&gt;
Tutorialspoint.com. Available at: &lt;a href="https://www.tutorialspoint.com/process-creation-vs%02process-termination-in-operating-system"&gt;https://www.tutorialspoint.com/process-creation-vsprocess-termination-in-operating-system&lt;/a&gt;&lt;br&gt;
[4] Tutorialspoint.com. Operating System - Process Scheduling. [online] Available at: &lt;a href="https://www.tutorialspoint.com/operating_system/os_process_scheduling.htm"&gt;https://www.tutorialspoint.com/operating_system/os_process_scheduling.htm&lt;/a&gt;&lt;/p&gt;

</description>
      <category>memory</category>
      <category>schedulers</category>
      <category>algorithms</category>
      <category>linux</category>
    </item>
  </channel>
</rss>
