<?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: dwivedialind</title>
    <description>The latest articles on Forem by dwivedialind (@dwivedialind).</description>
    <link>https://forem.com/dwivedialind</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%2F756917%2Fb0168da2-fc27-45e3-93f8-189352c00a4c.png</url>
      <title>Forem: dwivedialind</title>
      <link>https://forem.com/dwivedialind</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/dwivedialind"/>
    <language>en</language>
    <item>
      <title>File locking vs Row Level Locking</title>
      <dc:creator>dwivedialind</dc:creator>
      <pubDate>Mon, 17 Jun 2024 15:34:03 +0000</pubDate>
      <link>https://forem.com/dwivedialind/file-locking-vs-row-level-locking-2d93</link>
      <guid>https://forem.com/dwivedialind/file-locking-vs-row-level-locking-2d93</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for &lt;a href="https://dev.to/challenges/cs"&gt;DEV Computer Science Challenge v24.06.12: One Byte Explainer&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Explainer
&lt;/h2&gt;

&lt;p&gt;Have you ever wondered how can multiple users perform DML operations on same table at the same time? Because of row level locking in RDBMS. In RDBMS every row is a file instead of table as a file.&lt;br&gt;
Rows inside a table is scattered (fragmented) all over the DB server HD, to speed up &lt;strong&gt;&lt;em&gt;INSERT&lt;/em&gt;&lt;/strong&gt; statement.&lt;/p&gt;

&lt;h2&gt;
  
  
  Additional Context
&lt;/h2&gt;

&lt;p&gt;Consider a multi-user environment, if multiple users are inserting rows simultaneously into the same table, and if MySQL were to store the rows sequentially then it would be really slow.&lt;br&gt;
That's why when you insert a row into the table, wherever it finds the free space it will store the row there.&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>cschallenge</category>
      <category>computerscience</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Git</title>
      <dc:creator>dwivedialind</dc:creator>
      <pubDate>Sun, 16 Jun 2024 11:25:33 +0000</pubDate>
      <link>https://forem.com/dwivedialind/git-odo</link>
      <guid>https://forem.com/dwivedialind/git-odo</guid>
      <description>&lt;h2&gt;
  
  
  Source Code Management(SCM)
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Version Control System(VCS):
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;VCS/SCM/Revision Control System(RCS) are software tools for keeping track of changes to code over time&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Developers can collaborate on different projects, separating their tasks through branches.&lt;/li&gt;
&lt;li&gt;Look back to earlier versions for comparing and fixing the mistakes if needed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Version&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Copy of document taken at a specific time&lt;/li&gt;
&lt;li&gt;records

&lt;ul&gt;
&lt;li&gt;author&lt;/li&gt;
&lt;li&gt;time stamp&lt;/li&gt;
&lt;li&gt;changes&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  Benefits of Using VCS
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Long-term change history&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Changes made by developers over the years, can be seen in history.&lt;/li&gt;
&lt;li&gt;Allows going back to previous version for analyzing bugs and fixing problems.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Branching and Merging&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;(&lt;strong&gt;Branching&lt;/strong&gt;)No interference with each other's work.&lt;/li&gt;
&lt;li&gt;(&lt;strong&gt;Merging&lt;/strong&gt;)Brings the work together and seeing if there are conflicts between those works.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Traceability&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Trace each change and connect to project management or bug-tracking software.&lt;/li&gt;
&lt;li&gt;Commits on message helps describing purpose of the change.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Synchronization

&lt;ul&gt;
&lt;li&gt;fetch up-to-date codes from repository&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Backup and Restore

&lt;ul&gt;
&lt;li&gt;Files are saved at any time&lt;/li&gt;
&lt;li&gt;Restored from last saved one&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Undoing

&lt;ul&gt;
&lt;li&gt;Can undo last known version and last one created long time ago.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Types of VCS
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Local Version Control System&lt;/li&gt;
&lt;li&gt;Centralized Version Control System&lt;/li&gt;
&lt;li&gt;Distributed Version Control System&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Local VCS
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Source Safe is one of obsolete Source Control System&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Prevent data loss from modifications to the actual file content.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Avoid confusing directories&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Directory Proliferation: Without VCS, you might create multiple directories to save different versions of your project. This become difficult to manage and remember which version is which.&lt;/li&gt;
&lt;li&gt;Misplacement: Misplace files in wrong directory or forget which directory contains latest version of your files.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Prevent Accidental Overwrites and Misfiled Copies&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Overwriting Files: While manually copy files to create a new version, might overwrite existing files accidentally, losing important changes.&lt;/li&gt;
&lt;li&gt;Wrong Copies: Accidentally copy files to the wrong location, causing confusion about which files are most recent or which ones are correct.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Limitations:

&lt;ul&gt;
&lt;li&gt;Individual Use&lt;/li&gt;
&lt;li&gt;No Collaboration&lt;/li&gt;
&lt;li&gt;Single Point of Failure&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Centralized VCS
&lt;/h3&gt;

&lt;p&gt;All versions of project stored in a single central repository(server).&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Central Repository

&lt;ul&gt;
&lt;li&gt;All files and version at one central location&lt;/li&gt;
&lt;li&gt;Acts as the &lt;strong&gt;single source of truth&lt;/strong&gt; for the project.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Client-Server Model

&lt;ul&gt;
&lt;li&gt;Users get files from and send changes to central server.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;How it Works:

&lt;ul&gt;
&lt;li&gt;Checkout: User gets a copy of project from central repository.&lt;/li&gt;
&lt;li&gt;Edit: Users make changes to local copy.&lt;/li&gt;
&lt;li&gt;Commit: Changes sent back to central repository.&lt;/li&gt;
&lt;li&gt;Update: Users get latest changes from central repository.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Benefits

&lt;ul&gt;
&lt;li&gt;Centralized Management&lt;/li&gt;
&lt;li&gt;Simplified Access Control&lt;/li&gt;
&lt;li&gt;Collaborative&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Challenges

&lt;ul&gt;
&lt;li&gt;Single Point of failure&lt;/li&gt;
&lt;li&gt;Scalability Issues: Performance can suffer with large teams or projects.&lt;/li&gt;
&lt;li&gt;Network Dependency: Requires network connection to interact with central repository.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;SubVersion, PerForce, CVS(Concurrent Version System)&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Distributed VCS
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Local Repository:

&lt;ul&gt;
&lt;li&gt;Every user has a complete copy of the entire repository, including all history.&lt;/li&gt;
&lt;li&gt;Users can commit changes to their own local repositories without needing network access.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Peer-to-Peer Model:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Users can share changes directly with each other or synchronize with a central server if needed.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;No Single Point of Failure:

&lt;ul&gt;
&lt;li&gt;Each user's local repository is a complete backup of the project.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Git, Mercurial, Bazaar or Darcs&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Git
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Designed and Developed by Linus Trovalds for Linux Kernel development&lt;/li&gt;
&lt;li&gt;Free software distributed under the terms of the GNU General Public License version 2&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Characteristics:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Strong support for non-linear development &lt;strong&gt;[Branches]&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Distributed Development&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Compatibility with existent systems and protocols&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Efficient handling of large projects&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;cryptographic authentication of history&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Toolkit-based design&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Pluggable merge strategies&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Advantages
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Free and open source&lt;/li&gt;
&lt;li&gt;Fast and Small&lt;/li&gt;
&lt;li&gt;Implicit backup&lt;/li&gt;
&lt;li&gt;Security&lt;/li&gt;
&lt;li&gt;No need of powerful hardware&lt;/li&gt;
&lt;li&gt;Easier Branching&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Git Workflow
&lt;/h3&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%2Fi.imgur.com%2Fk4xNwE2.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%2Fi.imgur.com%2Fk4xNwE2.png" alt="gitWorkflow"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;git init&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Initialize a new empty Git repository or to reinitialize an existing one&lt;/li&gt;
&lt;li&gt;Repository is a directory which contains the working directory along with metadata in &lt;code&gt;.git&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Get the current status of repository(working directory+ staging area)&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; git status
&lt;span class="c"&gt;# Get the status with short style&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; git status &lt;span class="nt"&gt;-s&lt;/span&gt;
?? file.js
&lt;span class="c"&gt;# status will be represented in two characters&lt;/span&gt;
&lt;span class="c"&gt;# 1. status of file against the staging area&lt;/span&gt;
&lt;span class="c"&gt;# 2. status of file against the working directory&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;?? -&amp;gt; The file is untracked (the file is not known to the repository or the repository has not yet created any version of this file)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;Staging Area&lt;/em&gt;&lt;/strong&gt;
A temporary collection before you add your file to the repository.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# To add file from working directory to staging area&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; git add &amp;lt;file_name&amp;gt;

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; git status &lt;span class="nt"&gt;-s&lt;/span&gt;
A  file.js
&lt;span class="c"&gt;# the changes to file are added to the staging area&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;git commit&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Committed snapshots are considered safe versions of a project because Git asks before changing them.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# commit the changes to the repository&lt;/span&gt;
&lt;span class="c"&gt;# - any version in repository will contain&lt;/span&gt;
&lt;span class="c"&gt;#       - author(user who has committed the changes)&lt;/span&gt;
&lt;span class="c"&gt;#       - date and time of commit&lt;/span&gt;
&lt;span class="c"&gt;#       - message used while committing the changes&lt;/span&gt;
&lt;span class="c"&gt;#       - actual changes (added and deleted lines/files)&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &amp;lt;commit_message&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;git log&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;shows committed snapshots&lt;/li&gt;
&lt;li&gt;only works on the committed history
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; git log &lt;span class="nt"&gt;--oneline&lt;/span&gt; &lt;span class="nt"&gt;--color&lt;/span&gt; &lt;span class="nt"&gt;--graph&lt;/span&gt;

&lt;span class="c"&gt;# --oneline: show only one line description&lt;/span&gt;
&lt;span class="c"&gt;# --color: show colors while showing the logs&lt;/span&gt;
&lt;span class="c"&gt;# --graph: show the branch graph&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;git status&lt;/em&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Modify the file.js&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; git status &lt;span class="nt"&gt;-s&lt;/span&gt;
&lt;span class="c"&gt;# _M: the file is modified and present in working directory&lt;/span&gt;

&lt;span class="c"&gt;# add all the changes in the current directory to staging area&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; git add &lt;span class="nb"&gt;.&lt;/span&gt;

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; git status &lt;span class="nt"&gt;-s&lt;/span&gt;
&lt;span class="c"&gt;# M_: the file is modified and present in staging area&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;git diff&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;gets the difference of current version of file with last recorded version&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;*git checkout&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;if the last recorded version in staging area, then &lt;strong&gt;git checkout&lt;/strong&gt; will restore to that version.&lt;/li&gt;
&lt;li&gt;else to last committed snapshot
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#remove all the changes by replacing last recorded version with current version. You cannot retrieve the changes&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; git checkout file.js

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

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;git reset&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;if changes are staged &lt;strong&gt;git checkout&lt;/strong&gt; won't work&lt;/li&gt;
&lt;li&gt;Unstage the changes
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# remove the changes from staging area and move them back to working directory&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; git reset

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

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# unstage the changes and remove them immediately&lt;/span&gt;
&lt;span class="c"&gt;# (along with all the changes in the working directory)&lt;/span&gt;
&lt;span class="c"&gt;# Note: please execute this command on your own risk&lt;/span&gt;

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; git reset &lt;span class="nt"&gt;--hard&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Git Internals
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;- git repository &lt;span class="o"&gt;(&lt;/span&gt;.git directory&lt;span class="o"&gt;)&lt;/span&gt;
    - HEAD
    - config
    - description
    - hooks
    - info
    - objects
        - on commit, git creates the objects&lt;span class="o"&gt;(&lt;/span&gt;files&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="k"&gt;in &lt;/span&gt;this directory
        - there are 4 types of objects
            - commit object
                - created per commit
                - it contains the information
                    - tree object &lt;span class="nb"&gt;id&lt;/span&gt;
                    - author
                    - committer
                    - commit message
            - tree object
                - created per commit per directory
                - it contains the information
                    - 100644: the entry is pointing to a file
                    - blob: &lt;span class="nb"&gt;type &lt;/span&gt;of object
                    - blob object &lt;span class="nb"&gt;id&lt;/span&gt;: the &lt;span class="nb"&gt;id &lt;/span&gt;of blob object
                    - file name: the name of the file which is having the contents stored &lt;span class="k"&gt;in &lt;/span&gt;the blob file
            - blob object
                - created per file
                - it contains the contents of a file &lt;span class="k"&gt;in &lt;/span&gt;encrypted format &lt;span class="o"&gt;(&lt;/span&gt; use git cat-file &lt;span class="nb"&gt;command &lt;/span&gt;to &lt;span class="nb"&gt;read &lt;/span&gt;the contents&lt;span class="o"&gt;)&lt;/span&gt;
    - refs
        - heads
            - points to latest commit &lt;span class="nb"&gt;id&lt;/span&gt;
        - tags
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;id's here are in the form of hash value&lt;/em&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# get the contents of internal object&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; git cat-file &lt;span class="nt"&gt;-p&lt;/span&gt; &amp;lt;object-id&amp;gt;
&lt;span class="c"&gt;# object-id: &amp;lt;dir_name&amp;gt;+hash&lt;/span&gt;
&lt;span class="c"&gt;# git cat-file -t 6b3a&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;if two files have same content then blob object will be same for them&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;After making changes to file and commit, the commit object contains &lt;code&gt;parentId&lt;/code&gt; which is the previous version of &lt;code&gt;objectId&lt;/code&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Git Branching
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;A way to write code without affecting the rest of your team.&lt;/li&gt;
&lt;li&gt;Generally used for feature development.&lt;/li&gt;
&lt;li&gt;Once confirmed, can merge the branch in the master branch and release the build to customers.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Branch is a &lt;code&gt;file&lt;/code&gt; under &lt;strong&gt;&lt;em&gt;.git/refs/heads&lt;/em&gt;&lt;/strong&gt; with branch name, which stores latest commit id.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Default branch name is either &lt;strong&gt;&lt;em&gt;main or master&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;git branch&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Get list of branches
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# create a branch&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; git branch &amp;lt;branch_name&amp;gt;
&lt;span class="c"&gt;# main and another created branch would point to same commit id&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# to switch to branch&lt;/span&gt;
&lt;span class="c"&gt;# git checkout &amp;lt;branchname&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; git branch b1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# create a new branch and checkout immediately&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; git checkout &lt;span class="nt"&gt;-b&lt;/span&gt; b2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Merging
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Merge new_branch in main
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# merge b1 in main&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; git checkout main
&lt;span class="c"&gt;# show branch name&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; git status
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; git merge b1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Delete a branch
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# delete a branch&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; git branch &lt;span class="nt"&gt;-d&lt;/span&gt; &amp;lt;branch_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; git push origin &lt;span class="nt"&gt;--delete&lt;/span&gt; &amp;lt;branch_name&amp;gt;
&lt;span class="c"&gt;#deletes a branch from a remote repository after pushing any unpushed commits.&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;4.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; git log &lt;span class="nt"&gt;--graph&lt;/span&gt; &lt;span class="nt"&gt;--oneline&lt;/span&gt; &lt;span class="nt"&gt;--all&lt;/span&gt; &lt;span class="nt"&gt;--decorate&lt;/span&gt;

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

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Checkout to commit id
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; git checkout &amp;lt;commit_id&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>webdev</category>
      <category>git</category>
      <category>github</category>
    </item>
    <item>
      <title>Database1</title>
      <dc:creator>dwivedialind</dc:creator>
      <pubDate>Sun, 16 Jun 2024 06:03:11 +0000</pubDate>
      <link>https://forem.com/dwivedialind/database1-5h91</link>
      <guid>https://forem.com/dwivedialind/database1-5h91</guid>
      <description>&lt;h2&gt;
  
  
  Database Concepts
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;MySQL v5.7 (RDBMS)&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Oracle 11g(ORDBMS)&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;MongoDB (NoSQL DBMS)&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;DBMS(&lt;strong&gt;Database Management System&lt;/strong&gt;): Software that helps to manage data
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Various DBMS available
MSExcel, FoxBASE, FoxPro, DataEase, DataFlex, Clipper, DB Vista etc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Some Important Definitions
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;RDBMS: Relational Database Management System&lt;/li&gt;
&lt;li&gt;ORDBMS: Object Relational DBMS (RDBMS+OODBMS)&lt;/li&gt;
&lt;li&gt;OODBMS: Object Oriented DBMS&lt;/li&gt;
&lt;li&gt;Database: Collection of Large amounts of data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;ANSI definition of DBMS&lt;/em&gt;&lt;/strong&gt; : collection of programs that allows you to perform CRUD operations of data.&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;Computer&lt;/em&gt;&lt;/strong&gt;: Processing(work done by computer) raw data to meaningful data/ processed data/ information.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  DBMS vs RDBMS
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Difference in Nomenclature&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Field - attribute/column&lt;/li&gt;
&lt;li&gt;Record - tuple/row/entity&lt;/li&gt;
&lt;li&gt;File - table/relation&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Relationship between two file is maintained programmatically.&lt;br&gt;
vs&lt;br&gt;
Relationship between 2 tables can be specified at the time of table creation using constraint.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;More Programming&lt;br&gt;
vs&lt;br&gt;
Less Programming&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;More time required for s/w development&lt;br&gt;
vs&lt;br&gt;
Less time require for s/w development&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;Let's take an example of Server with Employee data is located in Delhi and Client in Pune,&lt;br&gt;
Now In DBMS to access Employees with Salary &amp;gt; $1000, we have to copy files to Pune then after processing, send the data back to Delhi (Server location)&lt;br&gt;
vs&lt;br&gt;
In RDBMS we can process data on server only.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;High Network Traffic&lt;br&gt;
vs&lt;br&gt;
Low Network Traffic&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Slow &amp;amp; expensive&lt;br&gt;
vs&lt;br&gt;
Faster (in terms of network speed) and cheaper (in terms of hardware cost, network cost, infrastructure cost)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Processing on Client Machine&lt;br&gt;
vs&lt;br&gt;
Processing on Server Machine(&lt;strong&gt;Client-Server Architecture&lt;/strong&gt;)&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;Most of the RDBMS Support Client-Server Architecture. (exception is MS Access-&amp;gt;&lt;strong&gt;local Database on same machine&lt;/strong&gt;)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ol&gt;
&lt;li&gt;File level Locking(&lt;strong&gt;not suitable for multi-user&lt;/strong&gt;)
vs
Row level Locking(internally table is not a file, internally every row is a file)&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;Suppose there is a Server located in Delhi, with &lt;strong&gt;&lt;em&gt;Pune&lt;/em&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;em&gt;Hyderabad&lt;/em&gt;&lt;/strong&gt; as client, now in DBMS is &lt;strong&gt;&lt;em&gt;Pune&lt;/em&gt;&lt;/strong&gt; tries to update any table in Server then that table is locked for &lt;strong&gt;&lt;em&gt;Hyderabad&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
vs&lt;br&gt;
In RDBMS only row is locked .&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Distributed databases not supported&lt;br&gt;
vs&lt;br&gt;
Most of the RDBMS support Distributed Databases (&lt;strong&gt;Banking system is an example of Distributed Databases&lt;/strong&gt;)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;No security (of data)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;DBMS is dependent of OS for security&lt;/li&gt;
&lt;li&gt;DBMS allows access to the data through the OS&lt;/li&gt;
&lt;li&gt;Security is not a built-in feature of DBMS
vs
Multiple Levels of Security&lt;/li&gt;
&lt;li&gt;Logging in Security (MySQL database username and password)&lt;/li&gt;
&lt;li&gt;Command level Security (permission to issue MySQL commands)

&lt;ul&gt;
&lt;li&gt;create table, create function, create user, etc&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Object level Security (access to table and objects of other users)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&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%2Fi.imgur.com%2Fmm9QaKO.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%2Fi.imgur.com%2Fmm9QaKO.png" alt="HowServerOSDifferentFromClientOS"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Various RDMBS available:

&lt;ul&gt;
&lt;li&gt;Informix (fastest in terms of processing speed)&lt;/li&gt;
&lt;li&gt;Oracle (most popular RDBMS)&lt;/li&gt;
&lt;li&gt;works on 113 OS&lt;/li&gt;
&lt;li&gt;63% of world commercial DB market in Client-Server Environment&lt;/li&gt;
&lt;li&gt;86% of world commercial DB market in the Internet Environment&lt;/li&gt;
&lt;li&gt;Sybase (Good RDBMS)&lt;/li&gt;
&lt;li&gt;MS SQL Server&lt;/li&gt;
&lt;li&gt;Only works with Windows OS&lt;/li&gt;
&lt;li&gt;MS Access (Single User)&lt;/li&gt;
&lt;li&gt;DB2 (MainFrame Computer from IBM)&lt;/li&gt;
&lt;li&gt;Postgres (Open source)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;_ Our Focus will be on MySQL _&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  MySQL
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Launched by Swedish company in 1995.&lt;/li&gt;
&lt;li&gt;MySQL is a open-source RDBMS (most widely used open-source RDBMS).&lt;/li&gt;
&lt;li&gt;Part of &lt;strong&gt;*LAMP&lt;/strong&gt; open-source web-development.&lt;/li&gt;
&lt;li&gt;Sun Microsystems acquired MySQL in 2008&lt;/li&gt;
&lt;li&gt;Oracle Corporation acquired Sun Microsystems in 2010.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;L - Linux
A - Apache Web Server
M - MySQL
P - Perl, Python or PHP
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Various S/W development tools from MySQL
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;MySQL Command Line Client (client S/W)

&lt;ul&gt;
&lt;li&gt;Used for running SQL commands&lt;/li&gt;
&lt;li&gt;Character based (text based)&lt;/li&gt;
&lt;li&gt;Interface with database&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;MySQL Workbench (client S/W)

&lt;ul&gt;
&lt;li&gt;Used for running SQL commands&lt;/li&gt;
&lt;li&gt;GUI based interface with database&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;MySQL Pl

&lt;ul&gt;
&lt;li&gt;MySQL Programming Language&lt;/li&gt;
&lt;li&gt;Used for database Programming&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;MySQL Connectors

&lt;ul&gt;
&lt;li&gt;for database connectivity (JDBC, ODBC, Python, C, C++ etc)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;MySQL for Excel

&lt;ul&gt;
&lt;li&gt;import, export, and edit MySQL data using MS Excel&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;MySQL Notifier

&lt;ul&gt;
&lt;li&gt;Start-up and Shutdown the MySQL database&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;MySQL Enterprise Backup

&lt;ul&gt;
&lt;li&gt;export and import of table data&lt;/li&gt;
&lt;li&gt;used to take backups and restore from the backups&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;MySQL Enterprise High Availability

&lt;ul&gt;
&lt;li&gt;for replication (also know as data mirroring) concept of standby database&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;MySQL Enterprise Encryption

&lt;ul&gt;
&lt;li&gt;used to encrypt table data&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;MySQL Enterprise Manager

&lt;ul&gt;
&lt;li&gt;for performance monitoring, and performance tuning&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;MySQL Query Analyzer

&lt;ul&gt;
&lt;li&gt;for query tuning&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  SQL
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Structured Query Language&lt;/li&gt;
&lt;li&gt;Commonly pronounced as "Sequel"&lt;/li&gt;
&lt;li&gt;conforms to ANSI standards (e.g 1 character = 1 Byte)&lt;/li&gt;
&lt;li&gt;Conforms to ISO standards (for QA)&lt;/li&gt;
&lt;li&gt;Common for all RDBMS(hence also known as RDBMS)&lt;/li&gt;
&lt;li&gt;Initially founded by IBM (1975-77)&lt;/li&gt;
&lt;li&gt;Initially known as RQBE (Relational Query by Example)&lt;/li&gt;
&lt;li&gt;IBM gave RQBE free of cost to ANSI&lt;/li&gt;
&lt;li&gt;ANSI renamed RQBE to SQL (Now, controlled by ANSI6)&lt;/li&gt;
&lt;li&gt;In 2005, source code of SQL was rewritten in Java(100%)&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;Every row in Table is a file, Table is not a file which helps us achieve row-level locking.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  Divisions of SQL
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;DDL (Data Definition Language): Create, Drop, Alter&lt;/li&gt;
&lt;li&gt;DML (Data Manipulation Language): Insert, Update, Delete&lt;/li&gt;
&lt;li&gt;DCL (Data Control Language): Grant, Revoke&lt;/li&gt;
&lt;li&gt;DQL (Data Query Language): Select
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Extra &lt;span class="k"&gt;in &lt;/span&gt;Oracle RDBMS and MySQL
1. DTL/TCL &lt;span class="o"&gt;(&lt;/span&gt;Data Transaction Language&lt;span class="o"&gt;)&lt;/span&gt;/&lt;span class="o"&gt;(&lt;/span&gt;Transaction Control Language&lt;span class="o"&gt;)&lt;/span&gt;
    Commit, Rollback, Savepoint
2. DDL
    Rename, Truncate

Extra &lt;span class="k"&gt;in &lt;/span&gt;Oracle RDBMS only:
1. DML
    &lt;span class="o"&gt;(&lt;/span&gt;Merge, Upsert&lt;span class="o"&gt;(&lt;/span&gt;Update+Insert&lt;span class="o"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Rules for Table Names, columns names and variable names&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Oracle: Max 30 characters MySQL: Max 64 characters&lt;/li&gt;
&lt;li&gt;A-Z, a-z, 0-9 allowed&lt;/li&gt;
&lt;li&gt;Has to begin with an alphabet&lt;/li&gt;
&lt;li&gt;Special characters, $, #, _ allowed&lt;/li&gt;
&lt;li&gt;In MySQL to use reserved characters such as &lt;code&gt;#&lt;/code&gt; int tableName and column Name, enclose it in backquotes(`&lt;code&gt;).
&lt;/code&gt;EMP#`&lt;/li&gt;
&lt;li&gt;134 reserved words not allowed&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;Under Linux &amp;amp; Unix, table_name and column_name are case-sensitive. But in Windows &amp;amp; macos are not case-sensitive&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>beginners</category>
      <category>learning</category>
      <category>database</category>
      <category>sql</category>
    </item>
  </channel>
</rss>
