<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Lakshgupta</title>
    <description>The latest articles on DEV Community by Lakshgupta (@lakshg1).</description>
    <link>https://dev.to/lakshg1</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%2F524311%2Fe894526a-298e-4f5f-bff0-d50d5b533936.jpg</url>
      <title>DEV Community: Lakshgupta</title>
      <link>https://dev.to/lakshg1</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lakshg1"/>
    <language>en</language>
    <item>
      <title>React States &amp; Virtual DOM</title>
      <dc:creator>Lakshgupta</dc:creator>
      <pubDate>Sun, 11 Jun 2023 19:40:28 +0000</pubDate>
      <link>https://dev.to/lakshg1/react-states-virtual-dom-28j1</link>
      <guid>https://dev.to/lakshg1/react-states-virtual-dom-28j1</guid>
      <description>&lt;p&gt;&lt;code&gt;In React, the virtual DOM (Document Object Model) is an abstraction of the actual DOM. It is a lightweight representation of the UI components and their structure.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;When there is a state change in a React component, React creates a new virtual DOM tree. It then compares the new virtual DOM tree with the previous one to identify the minimal set of changes needed to update the actual DOM efficiently. This process is known as "reconciliation."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Here's a step-by-step overview of how state updates and reconciliation occur in React:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;State Update: When the state of a component changes, either through user interaction or other triggers, the component re-renders. During re-rendering, a new virtual DOM tree is created for the component, reflecting the updated state.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Diffing: React then performs a diffing algorithm to compare the new virtual DOM tree with the previous one. It analyzes the differences between the two trees, identifying the minimal set of changes required to update the actual DOM.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Update: Once the differences are identified, React applies the necessary updates to the actual DOM to reflect the changes. It selectively updates only the parts of the DOM that have changed, optimizing performance.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;By using the virtual DOM, React minimizes the number of actual DOM manipulations, which can be expensive in terms of performance.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;React's diffing algorithm efficiently determines which parts of the UI need to be updated, reducing the overhead of rendering and improving the overall user experience.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>"Defer" Keyword in Golang</title>
      <dc:creator>Lakshgupta</dc:creator>
      <pubDate>Sat, 10 Jun 2023 20:10:35 +0000</pubDate>
      <link>https://dev.to/lakshg1/defer-keyword-in-golang-12j6</link>
      <guid>https://dev.to/lakshg1/defer-keyword-in-golang-12j6</guid>
      <description>&lt;p&gt;&lt;code&gt;Most of the Developers are switching to the recently developed Golang tech by Google in 2009 because of its code efficiency and less execution time as it is a compiled language.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Will talk about an important keyword used in Golang "Defer" in this article..&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Defer is used for some bytes of code if a prior cleanup is required for the function created in Golang before its return.&lt;br&gt;
With the help of "defer" keyword, we can have optimized code promoting more robust and reliable code.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Defer makes the statement fall at a position in stack that the code after the keyword just takes execution just before the function is returned.&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
Defer Keyword contributes to enhance the code in following ways:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cleanup of Code&lt;/li&gt;
&lt;li&gt;To lock the opened results &lt;/li&gt;
&lt;li&gt;Close opened files to make code reliable.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Refer the code for the same &amp;amp; understand the steps of execution by the summary below :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package main

import (
    "fmt"
    "os"
)

func main() {
    file := createFile("example.txt")
    defer closeFile(file)

    writeToFile(file, "Hello, Golang!")
}

func createFile(filename string) *os.File {
    fmt.Println("Creating file:", filename)
    file, err := os.Create(filename)
    if err != nil {
        panic(err)
    }
    return file
}

func writeToFile(file *os.File, message string) {
    fmt.Println("Writing to file:", message)
    _, err := file.WriteString(message)
    if err != nil {
        panic(err)
    }
}

func closeFile(file *os.File) {
    fmt.Println("Closing file")
    err := file.Close()
    if err != nil {
        panic(err)
    }
}

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

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;In this piece of Code because of we using defer keyword the function just before returning closes the opened file and hence make no mistake &amp;amp; no misplace of any data.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Defer is a keyword defined its use in the Golang Documentation.&lt;br&gt;
Refer to the documentation to understand more and learn implementation: &lt;br&gt;
&lt;a href="https://go.dev/tour/flowcontrol/12" rel="noopener noreferrer"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>go</category>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Ansible and Python</title>
      <dc:creator>Lakshgupta</dc:creator>
      <pubDate>Fri, 03 Mar 2023 18:32:03 +0000</pubDate>
      <link>https://dev.to/lakshg1/ansible-and-python-2ilc</link>
      <guid>https://dev.to/lakshg1/ansible-and-python-2ilc</guid>
      <description>&lt;ul&gt;
&lt;li&gt;Firstly, Ansible is written in the Python programming language and has a quite minimal learning curve. &lt;/li&gt;
&lt;li&gt;Ansible setup is pretty simple and functionality it provides is widely used in the IT services automation.&lt;/li&gt;
&lt;li&gt;Python is the preferred language to use to develop as it is quite compatible and easy to sync with ansible.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Ansible with Python:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Ansible Playbooks:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Simple yml formatted files which helps the developers to define a streamline flow of tasks to be achieved while performing a job. These Playbooks can be referred to as automated bots which helps us perform for example shell commands, python scripting and many more additional features.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code&gt;Basic Programming language add ons are present to like storing data in variables and modifying the same. Can be reused, recyclable for other used cases. Sometimes separate tasks are created and included like classes in C++.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Action Plugins:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;To talk about in a nutshell, these are basically python scripts itself just that some extra functionality and classes are added to integrate them with the playbooks. Action Plugins act as a programming soldier that inputs data declared by the playbook and modify the data for the used case as programmed by us. We can return the data to the playbook such that further tasks can be performed on that data. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code&gt;Mainly purpose is to automate the manual steps and reduce vulnerabilities.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ansible Tower:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Ansible Tower can be called as a hub of the ansible playbooks which makes the playbooks easier to maintain, run and debug while development. Tower is an open source tool which can be altered as per the requirements by the organizations. Tower provides too many functionalities like scheduling the playbooks and automating them, add separate projects directly and easily as its UI is clean and easy to use. After a basic understanding debugging is easy to execute and trustworthy process is cultivated for a long term.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code&gt;Ansible Tower is the Manager of the Ansible Playbooks which assists the developers on more than what I offered in this article.&lt;br&gt;
Will create a detailed article on this though. Checkout for more.&lt;/code&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Why Django? - MVT Model</title>
      <dc:creator>Lakshgupta</dc:creator>
      <pubDate>Thu, 02 Mar 2023 18:34:02 +0000</pubDate>
      <link>https://dev.to/lakshg1/why-django-mvt-model-5f51</link>
      <guid>https://dev.to/lakshg1/why-django-mvt-model-5f51</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Django is a framework easy to adopt with the frontend where python settling the backend of a fullstack website. Easy designs add ups with the help of HTML, CSS, JS. Django is easy to integrate at both the frontends and backends..&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Other than the basics, Django follows the MVT Model at its core:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Models:
&lt;/h2&gt;

&lt;p&gt;Defined as an entities to work with while crating the website. Basically call it a entities of the flow we create of a software.&lt;br&gt;
Blueprints are declared before hand withe the help of Django Models.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Eg:&lt;/em&gt; Created a user based website where employees interacted with the website. Roles were of a Employee and a Employer. Models were defined before hand and for the ease of further development some day.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Views:
&lt;/h2&gt;

&lt;p&gt;Defined as the work which will be done with certain entities. Views can be called as functions in layman's language. Certain sections are associated with these views and provides the user full functionality with much more ease. Views are triggered upon interaction with the users.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Eg:&lt;/em&gt; Employee Log-in Log-out will count as a view. Certain groups of UI will trigger such functionalities which is declared in the views itself.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Templates:
&lt;/h2&gt;

&lt;p&gt;Defined as the different page styles or basic html pages in layman's language. Templates comprises of the html formatted tags with the add of jquery based functionalities triggering and the css styling. Certain Views trigger the separate templates defined within this frame.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Eg:&lt;/em&gt; Separate Log-in page for employee and employer for separate user experience and separate functionalities defined before hand with the models defined.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>productivity</category>
      <category>productdesign</category>
      <category>showcase</category>
    </item>
    <item>
      <title>Python Django User Interface</title>
      <dc:creator>Lakshgupta</dc:creator>
      <pubDate>Wed, 01 Mar 2023 09:19:02 +0000</pubDate>
      <link>https://dev.to/lakshg1/python-django-user-interface-b87</link>
      <guid>https://dev.to/lakshg1/python-django-user-interface-b87</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;To make use of Mongo database collections and to omit command line interface interactions, planned to create a user interface based on Python Django tech stack.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Developed a UI which has a MongoDB based data extraction&lt;br&gt;
mechanism.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Button Based UI which is easily accessible over internal platform and preferably less functionalities than the Mongo Atlas to enjoy the comfort of less information.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;CRUD operations can be performed onto the UI which is deployed into production via internal servers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Integrated Role Based Access Control &lt;strong&gt;(RBAC)&lt;/strong&gt; Mechansism in user creation model of Mongo UI.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Worked on Real time IDE creation and developed UI Frontend design taking all the requirements under consideration.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Converted the conventional update of data to streamline&lt;br&gt;
flow via Django based UI. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Reduced the human intervention and execution time and automated the workflow.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>APIs - Brahmastra for Developers</title>
      <dc:creator>Lakshgupta</dc:creator>
      <pubDate>Tue, 28 Feb 2023 11:25:28 +0000</pubDate>
      <link>https://dev.to/lakshg1/apis-brahmastra-for-developers-44go</link>
      <guid>https://dev.to/lakshg1/apis-brahmastra-for-developers-44go</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;APIs, or Application Programming Interfaces&lt;/strong&gt;, were introduced to enable different software applications to communicate with each other easily and efficiently. APIs provide a way for developers to access data or functionality from a remote server or application without having to know the inner workings of that application or server.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Before APIs, developers would need to develop custom integrations or use more manual methods like screen scraping to access data from another application. This was time-consuming, error-prone, and often required significant technical expertise.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;With APIs, developers can access data and functionality through a standardized interface, allowing them to build integrations and applications more quickly and easily. This has enabled the development of many new software applications and services, as well as the integration of existing applications and services to create new, innovative solutions.&lt;/p&gt;

&lt;p&gt;In addition, APIs have helped to facilitate the growth of cloud computing and software as a service (SaaS) models, allowing applications and services to be hosted remotely and accessed through APIs. This has enabled greater flexibility, scalability, and cost savings for both developers and end-users.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>api</category>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Static vs Dynamic Data Typed Languages</title>
      <dc:creator>Lakshgupta</dc:creator>
      <pubDate>Mon, 27 Feb 2023 07:59:37 +0000</pubDate>
      <link>https://dev.to/lakshg1/static-vs-dynamic-data-typed-languages-2mn7</link>
      <guid>https://dev.to/lakshg1/static-vs-dynamic-data-typed-languages-2mn7</guid>
      <description>&lt;h2&gt;
  
  
  Static Data type Languages:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Variables are judged at compile time.&lt;/li&gt;
&lt;li&gt;Explicitly type declarations are required before hand.&lt;/li&gt;
&lt;li&gt;Values are static types which can't be altered once set.&lt;/li&gt;
&lt;li&gt;Produces more optimized code with the compile time performance check.&lt;/li&gt;
&lt;li&gt;C , C++ , JAVA , GO
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;string language_type;
language_type = "static"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;del&gt;language_type = 1&lt;/del&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Dynamic Data type Languages:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Variables are evaluated at runtime.&lt;/li&gt;
&lt;li&gt;No need to declare the data type before hand.&lt;/li&gt;
&lt;li&gt;Values are dynamic and can be altered with their types.&lt;/li&gt;
&lt;li&gt;Reduces extra efforts but in the end is less optimized as the code is prone to runtime errors.&lt;/li&gt;
&lt;li&gt;PHP , Perl , Python , JavaScript
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var language_type;
language_type = "dynamic"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;language_type = true&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>programming</category>
      <category>python</category>
      <category>javascript</category>
      <category>java</category>
    </item>
  </channel>
</rss>
