<?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: Shanker</title>
    <description>The latest articles on Forem by Shanker (@sn04).</description>
    <link>https://forem.com/sn04</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%2F561099%2F27ff0dbb-5812-4c79-8a16-967573cdc8fd.jpg</url>
      <title>Forem: Shanker</title>
      <link>https://forem.com/sn04</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/sn04"/>
    <language>en</language>
    <item>
      <title>Understanding ASCII / Unicode character encoding format</title>
      <dc:creator>Shanker</dc:creator>
      <pubDate>Wed, 29 Dec 2021 05:16:41 +0000</pubDate>
      <link>https://forem.com/sn04/understanding-ascii-unicode-character-encoding-format-4758</link>
      <guid>https://forem.com/sn04/understanding-ascii-unicode-character-encoding-format-4758</guid>
      <description>&lt;p&gt;Computer stores everything in binary format. The process of converting a value into binary is called Encoding and the the process of converting value from binary is called Decoding.&lt;/p&gt;

&lt;p&gt;value --&amp;gt; binary  ::     Encoding &lt;/p&gt;

&lt;p&gt;binary --&amp;gt; value   ::    Decoding&lt;/p&gt;

&lt;p&gt;for example:&lt;/p&gt;

&lt;p&gt;A number 12 is stored in its binary format as below.&lt;/p&gt;

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

&lt;/div&gt;

&lt;p&gt;but how are the characters are stored? If we want to store a character 'a' what formatting should be used ? It easiest way is to map the characters to number and store the binary format of that number.&lt;/p&gt;

&lt;p&gt;So, the character 'a' is represented as number 97 is stored as 1100001. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ASCII:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In ASCII encoding format, 128 unique characters are identified and mapped with numbers (mostly English). One byte is used to represent all the characters. It uses 7 bits to represent numeric value 0 to 127 (total 128 characters).  The most significant bit is a vacant bit. &lt;/p&gt;

&lt;p&gt;The vacant bit can be used for other characters not represented in ASCII table. Different regional languages used the vacant to represent their characters which caused ambiguity when documents are shared between both the parties.&lt;/p&gt;

&lt;p&gt;for example: &lt;/p&gt;

&lt;p&gt;Value 129 used to represent 'Va' character in devnagiri in India while same value to represent 'Xi' in Mandarin.&lt;/p&gt;

&lt;p&gt;ASCII Table.   Dec  = Decimal Value.    Char = Character&lt;/p&gt;

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

&lt;p&gt;To deal with these issue a new encoding scheme was invented to map all the characters in the world. This set of mapping is known as unicode.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Unicode:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In unicode every character is represented in codepoint. Most used formats utf-32, utf-16, utf-8. UTF stands for Unicode Transformation Format.  &lt;/p&gt;

&lt;p&gt;** UTF-32:**&lt;/p&gt;

&lt;p&gt;In UTF-32, 32 bits are used to represent a codepoints. The 32 bits are fixed length. So a character 'a' that uses 1 byte in ASCII, now uses 4 bytes in UTF-32 format. Hence an ASCII document of 1KB would take 4KB storage space if stored in UTF-32 format, leading to more storage requirement. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;UTF-16:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In UTF-16, either 16 bits or 32 bits are used to represent the codepoints. The length can be varying between 16 or 32 bits. So a character 'a` that took 4 bytes in UTF-32 format now takes 2 bytes if stored in UTF-16 format. &lt;/p&gt;

&lt;p&gt;If a character codepoint requires more than 16 bits then that character codepoint is stored using 4 bytes.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;UTF-8&lt;/strong&gt; is a variable-width character encoding used for transferring data over the network. It uses one to four one-byte or 8-bit of code points. The code points represent a character. The first 128 characters of Unicode, which also corresponds to one-to-one with ASCII is represented using 1 byte in UTF-8 format.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;UTF-8&lt;/strong&gt; has variable width, that is it can use 1 byte or upto 4 bytes to encode a character. It can encoding all 1112064 valid code points character in Unicode.&lt;/p&gt;

&lt;p&gt;For 1 byte encoding, it uses 7 bits. The most significant bit is set to 0. &lt;/p&gt;

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

&lt;p&gt;For 2 bytes encoding, it uses 11 bits. 3 bits of MSB of leading byte is set to 110 followed by MSB of continuation byte is set to 10.&lt;/p&gt;

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

&lt;p&gt;For 3 bytes encoding, it uses 15 bits. 4 bits of MSB of leading byte is set to 1110 followed by MSB of continuation byte-1 is set to 110 and MSB of continuation byte-2 to 10&lt;/p&gt;

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

&lt;p&gt;For 4 bytes encoding, it uses 18 bits. 5 bits of MSB of leading byte is set to 11110 followed by MSB of continuation byte-1 is set to 1110, MSB of continuation byte-2 to 110, MSB of continuation byte-3 to 10.&lt;/p&gt;

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

&lt;p&gt;Max length for utf-8 can go upto 6 bytes in future. &lt;/p&gt;

&lt;p&gt;Thank you folks. Please do check my other articles on &lt;a href="https://softwareengineeringcrunch.blogspot.com"&gt;https://softwareengineeringcrunch.blogspot.com&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;If you like my article, you can support me by buying me a coffee -&amp;gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.buymeacoffee.com/sn04"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Rb9xKs4G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" width="545" height="153"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>100daysofcode</category>
    </item>
    <item>
      <title>Java 8 for beginners - Part 1</title>
      <dc:creator>Shanker</dc:creator>
      <pubDate>Wed, 01 Dec 2021 07:50:59 +0000</pubDate>
      <link>https://forem.com/sn04/java-8-for-beginners-part-1-3bcb</link>
      <guid>https://forem.com/sn04/java-8-for-beginners-part-1-3bcb</guid>
      <description>&lt;ol&gt;
&lt;li&gt;&lt;a href="https://dev.to/sn04/java-8-for-beginners-part-1-3bcb"&gt;Java 8 for beginners - Part 1&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Introduction
&lt;/h4&gt;

&lt;p&gt;JAVA 8 is a major feature release of Java programming language. It was initially released on 18 March 2014. Java 8 provides support for functional programming, new JavaScript engine, new APIs for date time manipulation, new streaming API, etc.&lt;/p&gt;

&lt;p&gt;Below are some of the new features in Java 8 :&lt;/p&gt;

&lt;p&gt;1) Lambda expression − Adds functional processing capability to Java.&lt;/p&gt;

&lt;p&gt;2) Method references − Referencing functions by their names instead of invoking them directly. Using functions as parameter.&lt;/p&gt;

&lt;p&gt;3) Default method − Interface to have default method implementation.&lt;/p&gt;

&lt;p&gt;4) New tools − New compiler tools and utilities are added like ‘jdeps’ to figure out dependencies.&lt;/p&gt;

&lt;p&gt;5) Stream API − New stream API to facilitate pipeline processing.&lt;/p&gt;

&lt;p&gt;6) Date Time API − Improved date time API.&lt;/p&gt;

&lt;p&gt;7) Optional − Emphasis on best practices to handle null values properly.&lt;/p&gt;

&lt;p&gt;8) Nashorn, JavaScript Engine − A Java-based engine to execute JavaScript code.&lt;/p&gt;

&lt;p&gt;Check out below program to sort names in Java 7 vs Java 8 to understand how lambda help us write a clean and elegant code in java.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;java.util.ArrayList&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;java.util.Collections&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;java.util.Comparator&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;java.util.List&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Main&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;List&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;names1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ArrayList&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;();&lt;/span&gt;
        &lt;span class="n"&gt;names1&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Sam "&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="n"&gt;names1&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"James "&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="n"&gt;names1&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Wilson "&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="n"&gt;names1&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Edward "&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="n"&gt;names1&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Ramesh "&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

        &lt;span class="nc"&gt;List&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;names2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ArrayList&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;();&lt;/span&gt;
        &lt;span class="n"&gt;names2&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Sam "&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="n"&gt;names2&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"James "&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="n"&gt;names2&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Wilson "&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="n"&gt;names2&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Edward "&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="n"&gt;names2&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Ramesh "&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

        &lt;span class="nc"&gt;Main&lt;/span&gt; &lt;span class="n"&gt;tester&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Main&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Sort using Java 7 syntax: "&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

        &lt;span class="n"&gt;tester&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;sortByJava7&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;names1&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;names1&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Sort using Java 8 syntax: "&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

        &lt;span class="n"&gt;tester&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;sortByJava8&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;names2&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;names2&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;//sort by java 7&lt;/span&gt;
    &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;sortByJava7&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;List&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;names&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;Collections&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;sort&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;names&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Comparator&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="nd"&gt;@Override&lt;/span&gt;
            &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;compare&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;s1&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;s2&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
                &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;s1&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;compareTo&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s2&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
            &lt;span class="o"&gt;}&lt;/span&gt;
        &lt;span class="o"&gt;});&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;//sort by java 8&lt;/span&gt;
    &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;sortByJava8&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;List&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;names&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;Collections&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;sort&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;names&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s1&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;s2&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;s1&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;compareTo&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s2&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

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

&lt;/div&gt;



&lt;h4&gt;
  
  
  Output :
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Sort using Java 7 syntax: 
[Edward , James , Ramesh , Sam , Wilson ]
Sort using Java 8 syntax: 
[Edward , James , Ramesh , Sam , Wilson ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thank you folks. Please do check my other articles on &lt;a href="https://softwareengineeringcrunch.blogspot.com"&gt;https://softwareengineeringcrunch.blogspot.com&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;If you like my article, you can support me by buying me a coffee -&amp;gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.buymeacoffee.com/sn04"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Rb9xKs4G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" width="545" height="153"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>beginners</category>
      <category>programming</category>
      <category>100daysofcode</category>
    </item>
    <item>
      <title>Ruby gem explained</title>
      <dc:creator>Shanker</dc:creator>
      <pubDate>Sat, 30 Oct 2021 18:00:22 +0000</pubDate>
      <link>https://forem.com/sn04/ruby-gem-explained-1imi</link>
      <guid>https://forem.com/sn04/ruby-gem-explained-1imi</guid>
      <description>&lt;h4&gt;
  
  
  What is a Ruby Gem?
&lt;/h4&gt;

&lt;p&gt;Gems are open source libraries just like jar packages in java or modules in Go, the gem contains contain Ruby code. This helps in modularization of the code. A gem can be used by a developer in their own program, without writing that piece of code.&lt;/p&gt;

&lt;p&gt;You can check the different gems at &lt;a href="https://rubygems.org/"&gt;https://rubygems.org/&lt;/a&gt;. Below are some of the popular gems:&lt;/p&gt;

&lt;p&gt;Bundler — Provides a consistent environment for Ruby projects by tracking and installing the exact gems and versions that are needed. &lt;/p&gt;

&lt;p&gt;RSpec — A testing framework that supports BDD for Ruby.&lt;/p&gt;

&lt;p&gt;Devise — Devise works with authentication. Website that needs to user log-in’s, Devise handles sign in, sign up, reset password, etc.&lt;/p&gt;

&lt;p&gt;JSON — Provides an API for parsing JSON from text.&lt;/p&gt;

&lt;p&gt;Nokogiri — Provides HTML, XML, SAX, and Reader parsers with XPath and CSS selector support.&lt;/p&gt;

&lt;p&gt;Rails — Rails is a fullstack web application development framework.&lt;/p&gt;

&lt;h4&gt;
  
  
  Install Gems
&lt;/h4&gt;

&lt;p&gt;To Install gems locally you can run the command:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gem install [gem_name]&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;The gem install command fetches the code, downloads it to your computer, and installs the gem and any necessary dependencies and builds documentation for the installed gems.&lt;/p&gt;

&lt;p&gt;To see all gems installed locally run the command&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gem list&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Thank you folks. Please do check my other articles on &lt;a href="https://softwareengineeringcrunch.blogspot.com"&gt;https://softwareengineeringcrunch.blogspot.com&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;If you like my article, you can support me by buying me a coffee -&amp;gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.buymeacoffee.com/sn04"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Rb9xKs4G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" width="545" height="153"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ruby</category>
      <category>rails</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Common handy git commands</title>
      <dc:creator>Shanker</dc:creator>
      <pubDate>Fri, 09 Jul 2021 09:55:37 +0000</pubDate>
      <link>https://forem.com/sn04/common-handy-git-commands-2nlj</link>
      <guid>https://forem.com/sn04/common-handy-git-commands-2nlj</guid>
      <description>&lt;p&gt;In this article I'll explain the commonly used git commands every developer, DevOps engineer should know.&lt;/p&gt;

&lt;h4&gt;
  
  
  git config
&lt;/h4&gt;

&lt;p&gt;Git config commands gives you the information about your git configurations. It can be used to setup initial configs when you install git. &lt;/p&gt;

&lt;p&gt;Usage:&lt;/p&gt;

&lt;p&gt;list all the configuration for the git&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="nv"&gt;$ &lt;/span&gt;git config &lt;span class="nt"&gt;-l&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Setup global username&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="nv"&gt;$ &lt;/span&gt;git config &lt;span class="nt"&gt;--global&lt;/span&gt; user.name &lt;span class="s2"&gt;"Your name"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Setup global email&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="nv"&gt;$ &lt;/span&gt;git config &lt;span class="nt"&gt;--global&lt;/span&gt; user.email &lt;span class="s2"&gt;"Your email"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  git version
&lt;/h4&gt;

&lt;p&gt;Displays the version of the git you are working on. &lt;/p&gt;

&lt;p&gt;Usage:&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="nv"&gt;$ &lt;/span&gt;git version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  git init
&lt;/h4&gt;

&lt;p&gt;This command use to initialise git in a new project. Once the git is initialised for a project you can add source code to track the commits. &lt;/p&gt;

&lt;p&gt;Usage:&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="nv"&gt;$ &lt;/span&gt;git init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use init with repository name will create a new project with git initialized for it.&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="nv"&gt;$ &lt;/span&gt;git init &amp;lt;repo name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  git clone
&lt;/h4&gt;

&lt;p&gt;The git clone command will use an existing remote repository to copy. &lt;/p&gt;

&lt;p&gt;The only difference between the git init and git clone is, Git clone makes a copy on an existing remote repository. The git clone command internally uses the git init command first and then checks out all its contents.&lt;/p&gt;

&lt;p&gt;Usage:&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="nv"&gt;$ &lt;/span&gt;git clone &amp;lt;your project URL&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  git add
&lt;/h4&gt;

&lt;p&gt;Git add command adds all the new code files or modified files into your repository's staging area. &lt;/p&gt;

&lt;p&gt;Usage:&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="nv"&gt;$ &lt;/span&gt;git add file_name &lt;span class="o"&gt;(&lt;/span&gt;adds a single file to the staging area&lt;span class="o"&gt;)&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="nv"&gt;$ &lt;/span&gt;git add &lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;adds all the modified and new files to the staging area&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  git commit
&lt;/h4&gt;

&lt;p&gt;Git commit command adds your changes from staging area to your local repository.&lt;/p&gt;

&lt;p&gt;Usage:&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="nv"&gt;$ &lt;/span&gt;git commit &lt;span class="nt"&gt;-m&lt;/span&gt; “commit message”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  git status
&lt;/h4&gt;

&lt;p&gt;Status command allows you to see the current branch and how many files are added/modified. &lt;/p&gt;

&lt;p&gt;Usage:&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="nv"&gt;$ &lt;/span&gt;git status 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  git branch
&lt;/h4&gt;

&lt;p&gt;When you work on multiple branches in your Git repository. Git branch command allows you to manage your branches. Git branch lists all the branches in your local repository.&lt;/p&gt;

&lt;p&gt;Usage:&lt;/p&gt;

&lt;p&gt;list all branches&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="nv"&gt;$ &lt;/span&gt;git branch 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;create a new branch&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="nv"&gt;$ &lt;/span&gt;git branch &amp;lt;branch_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;delete a branch:&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="nv"&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;h4&gt;
  
  
  git checkout
&lt;/h4&gt;

&lt;p&gt;Checkout command is used to switch between branches. &lt;/p&gt;

&lt;p&gt;Usage:&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="nv"&gt;$ &lt;/span&gt;git checkout &amp;lt;branch_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;you can also create and checkout to a new branch in a single command&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="nv"&gt;$ &lt;/span&gt;git checkout &lt;span class="nt"&gt;-b&lt;/span&gt; &amp;lt;your_new_branch_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  git log
&lt;/h4&gt;

&lt;p&gt;Git log command helps to see the history of previous commits.&lt;/p&gt;

&lt;p&gt;Usage:&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="nv"&gt;$ &lt;/span&gt;git log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To see git logs in one line&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="nv"&gt;$ &lt;/span&gt;git log &lt;span class="nt"&gt;--oneline&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  git remote
&lt;/h4&gt;

&lt;p&gt;Git remote command is used to connect your local repository with the remote repository.&lt;/p&gt;

&lt;p&gt;Usage:&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="nv"&gt;$ &lt;/span&gt;git remote add &amp;lt;url&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  git push
&lt;/h4&gt;

&lt;p&gt;Push command is used to push your local changes to the remote repository.&lt;/p&gt;

&lt;p&gt;Usage:&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="nv"&gt;$ &lt;/span&gt;git push origin &amp;lt;your_branch_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Git push should have origin and upstream set up before you push code to remote repository.&lt;/p&gt;

&lt;p&gt;Usage:&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="nv"&gt;$ &lt;/span&gt;git push &lt;span class="nt"&gt;--set-upstream&lt;/span&gt; origin &amp;lt;branch_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  git fetch
&lt;/h4&gt;

&lt;p&gt;Fetch command downloads all information for commits, refs, etc. You can review before applying those changes in your local repository.&lt;/p&gt;

&lt;p&gt;Usage:&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="nv"&gt;$ &lt;/span&gt;git fetch 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  git pull
&lt;/h4&gt;

&lt;p&gt;Git pull command updates your local repository with the latest content from remote repository.&lt;/p&gt;

&lt;p&gt;Usage:&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="nv"&gt;$ &lt;/span&gt;git pull &amp;lt;remote_url&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  git stash
&lt;/h4&gt;

&lt;p&gt;Stash command temporarily stores your modified files.&lt;/p&gt;

&lt;p&gt;Usage:&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="nv"&gt;$ &lt;/span&gt;git stash 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can view all of your stashes&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="nv"&gt;$ &lt;/span&gt;git stash list 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;if you need a apply a stash to a branch. Below apply stash{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="nv"&gt;$ &lt;/span&gt;git stash&lt;span class="o"&gt;{&lt;/span&gt;3&lt;span class="o"&gt;}&lt;/span&gt; apply 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  git shortlog
&lt;/h4&gt;

&lt;p&gt;The shortlog command gives you a short summary from the Git log command. It displays who worked on what by grouping authors with their commits.&lt;/p&gt;

&lt;p&gt;Usage:&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="nv"&gt;$ &lt;/span&gt;git shortlog  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  git show
&lt;/h4&gt;

&lt;p&gt;Show command git show display details about a specific commit.&lt;/p&gt;

&lt;p&gt;Usage:&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="nv"&gt;$ &lt;/span&gt;git show &amp;lt;your_commit_hash&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  git rm
&lt;/h4&gt;

&lt;p&gt;rm command deletes files from your code, it deletes tracked files from the index and the working directory.&lt;/p&gt;

&lt;p&gt;Usage:&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="nv"&gt;$ &lt;/span&gt;git &lt;span class="nb"&gt;rm&lt;/span&gt; &amp;lt;your_file_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  git merge
&lt;/h4&gt;

&lt;p&gt;merge helps to integrate changes from different branches into the current branch. &lt;/p&gt;

&lt;p&gt;Usage:&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="nv"&gt;$ &lt;/span&gt;git merge &amp;lt;diff_branch_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  git rebase
&lt;/h4&gt;

&lt;p&gt;Git rebase similar to the git merge command. It integrates changes from different branches into the current branch.&lt;/p&gt;

&lt;p&gt;The only difference is &lt;code&gt;git rebase&lt;/code&gt; command rewrites the commit history.&lt;/p&gt;

&lt;p&gt;Usage:&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="nv"&gt;$ &lt;/span&gt;git rebase &amp;lt;branch_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  git bisect
&lt;/h4&gt;

&lt;p&gt;bisect command helps to find bad commits. &lt;/p&gt;

&lt;p&gt;Usage:&lt;/p&gt;

&lt;p&gt;to start the git bisect&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="nv"&gt;$ &lt;/span&gt;git bisect start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;let git bisect know about a good commit&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="nv"&gt;$ &lt;/span&gt;git bisect good a123 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;let git bisect know about a bad commit&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="nv"&gt;$ &lt;/span&gt;git bisect bad z123
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  git cherry-pick
&lt;/h4&gt;

&lt;p&gt;Git cherry-pick command allows to pick any commit from any branch and apply it to any other branch. It doesn’t modify the commit history of a repository, new commits are applied to the commit history.&lt;/p&gt;

&lt;p&gt;Usage:&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="nv"&gt;$ &lt;/span&gt;git cherry-pick &amp;lt;commit-hash&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  git archive
&lt;/h4&gt;

&lt;p&gt;Git archive command combines multiple files into a single file. It is useful to create a zip of a repository.&lt;/p&gt;

&lt;p&gt;Usage:&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="nv"&gt;$ &lt;/span&gt;git archive &lt;span class="nt"&gt;--format&lt;/span&gt; zip HEAD &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; archive-HEAD.zip
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  git pull --rebase
&lt;/h4&gt;

&lt;p&gt;When you need to do a rebase instead of merge when using &lt;code&gt;git pull&lt;/code&gt; command.&lt;/p&gt;

&lt;p&gt;Usage:&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="nv"&gt;$ &lt;/span&gt;git pull &lt;span class="nt"&gt;--rebase&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  git blame
&lt;/h4&gt;

&lt;p&gt;blame is used to examine a file line by line and to determine who made the changes to a file.&lt;/p&gt;

&lt;p&gt;Usage:&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="nv"&gt;$ &lt;/span&gt;git blame &amp;lt;your_file_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  git tag
&lt;/h4&gt;

&lt;p&gt;tag command is used to manage the release. &lt;/p&gt;

&lt;p&gt;Usage;&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="nv"&gt;$ &lt;/span&gt;git tag &lt;span class="nt"&gt;-a&lt;/span&gt; v1.0.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  git verify-commit
&lt;/h4&gt;

&lt;p&gt;git verify-commit command checks the gpg signature. GPG or “GNU Privacy Guard” is the tool used in sign files and contains their signatures.&lt;/p&gt;

&lt;p&gt;Usage:&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="nv"&gt;$ &lt;/span&gt;git verify-commit &amp;lt;commit&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  git verify-tag
&lt;/h4&gt;

&lt;p&gt;Just like &lt;code&gt;verify-commit&lt;/code&gt;, you can confirm a tag.&lt;/p&gt;

&lt;p&gt;Usage:&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="nv"&gt;$ &lt;/span&gt;git verify-tag &amp;lt;tag&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  git diff
&lt;/h4&gt;

&lt;p&gt;diff command is used to compare two git files or branches before you commit or push. &lt;/p&gt;

&lt;p&gt;Usage:&lt;/p&gt;

&lt;p&gt;to compare the working directory with the local repo:&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="nv"&gt;$ &lt;/span&gt;git diff HEAD &amp;lt;filename&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to compare two branches:&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="nv"&gt;$ &lt;/span&gt;git diff &amp;lt;&lt;span class="nb"&gt;source &lt;/span&gt;branch&amp;gt; &amp;lt;target branch&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  git citool
&lt;/h4&gt;

&lt;p&gt;Git citool is a graphic tool alternative of the Git commit.&lt;/p&gt;

&lt;p&gt;Usage:&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="nv"&gt;$ &lt;/span&gt;git citool
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  git mv
&lt;/h4&gt;

&lt;p&gt;mv command is used to rename a git file.&lt;/p&gt;

&lt;p&gt;Usage:&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="nv"&gt;$ &lt;/span&gt;git &lt;span class="nb"&gt;mv&lt;/span&gt; &amp;lt;old-file-name&amp;gt; &amp;lt;new-file-name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  git clean
&lt;/h4&gt;

&lt;p&gt;clean command is used to remove/delete all the untracked files from your working directory. To remove tracked files you can use the &lt;code&gt;git reset&lt;/code&gt; command.&lt;/p&gt;

&lt;p&gt;Usage:&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="nv"&gt;$ &lt;/span&gt;git clean
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  git help
&lt;/h4&gt;

&lt;p&gt;To get more information or help on any of the git command, you can use git help.&lt;/p&gt;

&lt;p&gt;Usage:&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="nv"&gt;$ &lt;/span&gt;git &lt;span class="nb"&gt;help&lt;/span&gt; &amp;lt;git_command&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  git whatchanged
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;git whatchanged&lt;/code&gt; command is same as git log but in a raw format. &lt;/p&gt;

&lt;p&gt;Usage:&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="nv"&gt;$ &lt;/span&gt;git whatchanged
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thank you folks. Please do check my other articles on &lt;a href="https://softwareengineeringcrunch.blogspot.com" rel="noopener noreferrer"&gt;https://softwareengineeringcrunch.blogspot.com&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;If you like my article, you can support me by buying me a coffee -&amp;gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.buymeacoffee.com/sn04" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.buymeacoffee.com%2Fbuttons%2Fv2%2Fdefault-yellow.png" alt="Buy Me A Coffee"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>git</category>
      <category>devops</category>
      <category>developers</category>
      <category>github</category>
    </item>
    <item>
      <title>Five untold skills of a software engineer</title>
      <dc:creator>Shanker</dc:creator>
      <pubDate>Wed, 24 Mar 2021 12:02:50 +0000</pubDate>
      <link>https://forem.com/sn04/five-untold-skills-of-a-software-engineer-3o3j</link>
      <guid>https://forem.com/sn04/five-untold-skills-of-a-software-engineer-3o3j</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6zrKj24S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jt8lrrqjqqbqgjp3av11.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6zrKj24S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jt8lrrqjqqbqgjp3av11.png" alt="Alt Text" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Today there are multiple programming languages, frameworks, libraries and innovative technologies. They either get popular or fade away. But today I’m going to talk about few of the top untold skills in tech industry that don’t fade away with time.&lt;/p&gt;

&lt;p&gt;1) Communication skills — Communication is by far one of the important skill to possess. It is very important for you to articulate your problems/ideas/solutions when you work in teams. It allows others to visualize the subject you are see. You ability to communicate the problems/ideas/solutions can lead to better understanding amongst others and the overall productivity of the team.&lt;/p&gt;

&lt;p&gt;2) Ability to find solutions — As a software engineer we often spend time on stackoverflow looking solutions to our problem. Your ability to reference similar type problem on stackoverflow and connect it to your problem to get your solution is very important. I have often seen junior developers unable to connect the dots to their problem with similar related problems online. Eventually end up impacting the delivery of the product.&lt;/p&gt;

&lt;p&gt;3) Being humble — Be humble to very one around you. Your team, house cleaning staff, support staff everyone has a role to play and cumulatively you are trying to achieve your deliverable goals. It is important to be humble.&lt;/p&gt;

&lt;p&gt;4) Asking help — In tech if you are asking for some help, is often perceived as incompetency and can lead to imposter syndrome. On the other side don’t be a leech and ask for help without even trying once. That is way more bad. Striking a perfect balance is important, knowing when you really need help and when you just need more time to figure out.&lt;/p&gt;

&lt;p&gt;5) Documentation — Last but not the least, have the ability to document well. Sometimes we have see great technologies being sidelined because of poor documentation. Poor documentation can make a good technology difficult understand. New adopters, hobbyists, enthusiasts may start to avoid the technology for the same reason.&lt;/p&gt;

&lt;p&gt;Above are five skills I feel every software engineer should know. Do let me know in the comments section which other skills you feel are important but less spoken skills needed as a software engineer.&lt;/p&gt;

&lt;p&gt;Thank you folks. Please do check my other articles on &lt;a href="https://softwareengineeringcrunch.blogspot.com"&gt;https://softwareengineeringcrunch.blogspot.com&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;If you like my article, you can support me by buying me a coffee -&amp;gt;&lt;br&gt;
 &lt;a href="https://www.buymeacoffee.com/sn04"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Rb9xKs4G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" width="545" height="153"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>skills</category>
      <category>technology</category>
      <category>software</category>
      <category>engineering</category>
    </item>
    <item>
      <title>Telepresence</title>
      <dc:creator>Shanker</dc:creator>
      <pubDate>Wed, 20 Jan 2021 10:43:31 +0000</pubDate>
      <link>https://forem.com/sn04/telepresence-eka</link>
      <guid>https://forem.com/sn04/telepresence-eka</guid>
      <description>&lt;p&gt;&lt;b&gt;What is it?&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Allows you to run a service on your local machine while also connecting other services on the remote Kubernetes cluster.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Why is it?&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;It is difficult to test and debug a service in a complex microservice architected applications from you local machine.&lt;/p&gt;

&lt;p&gt;For a developer with a machine 16 Gigs of RAM, it is difficult to spin up docker compose or minikube to run all the applications on a local machine. You might just end up heating 🔥 the system.&lt;/p&gt;

&lt;p&gt;Often, to complete feature testing we need good amount of traffic hence we deploy the application on a cluster environment with good amount of traffic, named as staging cluster.&lt;/p&gt;

&lt;p&gt;From the time you commit the code to it be available on the cluster, it goes through below phases :&lt;/p&gt;

&lt;p&gt;1) Compile - to compile and run all the test cases it takes on an average 1-2 mins&lt;/p&gt;

&lt;p&gt;2) Build - to build the image it takes on an average 1 min&lt;/p&gt;

&lt;p&gt;3) Push - to delete the existing pod and create a new pod with fresh code takes on an average 2-3 mins&lt;/p&gt;

&lt;p&gt;So by the time the code it available on cluster, the developer slips a good 4-6 mins on every change made to the code which is to be tested on cluster.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;How does it?&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Fundamentally, It replaces your pod running in the cluster with a two way network proxy. Essentially swapping out the pod in the cluster with your local development.&lt;/p&gt;

&lt;p&gt;Any traffic routed to the service will now be proxied from the kubernetes cluster to the local machine.&lt;/p&gt;

&lt;p&gt;Which means your machine is now part of the cluster and is serving the live traffic from the cluster environment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HVQ-7DVk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/tgwfkp022f0tsrhu5ogg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HVQ-7DVk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/tgwfkp022f0tsrhu5ogg.png" alt="Alt Text" width="880" height="498"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Telepresence proxies the environment variables and volumes and TCP connections to your machine. It intercepts DNS so DNS calls and TCP traffic are routed to the cluster through the proxy from your local machine.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Advantage?&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Saves individual developer time by quick allowing them to testing their changes with the cluster services.&lt;/p&gt;

&lt;p&gt;Helps the developers to locally test/debug and change the service.&lt;/p&gt;

&lt;p&gt;It allows to make your local deployment be part of the cluster easily.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Installing telepresence&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;OS X &lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;brew cask install osxfuse&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;brew install datawire/blackbird/telepresence&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Ubuntu 16.04 or later&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;curl -s https://packagecloud.io/install/repositories/datawireio/telepresence/script.deb.sh | sudo bash&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;sudo apt install --no-install-recommends telepresence&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Windows&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Install Windows Subsystem for Linux&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Start the BASH.exe program&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Install Telepresence by following the Ubuntu instructions above&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To verify you can simply open the terminal and run the telepresence command :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ey-j5CVN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/6ms235bc8l7khya9hrkc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ey-j5CVN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/6ms235bc8l7khya9hrkc.png" alt="Alt Text" width="880" height="355"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And btw ... its not a penguin ... its a bird. 😉&lt;/p&gt;

&lt;p&gt;link for reference -&amp;gt; &lt;a href="https://www.telepresence.io"&gt;https://www.telepresence.io&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thank you folks. Please do check my other articles on &lt;a href="https://softwareengineeringcrunch.blogspot.com"&gt;https://softwareengineeringcrunch.blogspot.com&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;If you like my article, you can support me by buying me a coffee -&amp;gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.buymeacoffee.com/sn04"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Rb9xKs4G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" width="545" height="153"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>telepresence</category>
      <category>kubernetes</category>
      <category>docker</category>
      <category>microservices</category>
    </item>
  </channel>
</rss>
