<?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: Nirmal Patel</title>
    <description>The latest articles on DEV Community by Nirmal Patel (@nirmaljpatel).</description>
    <link>https://dev.to/nirmaljpatel</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%2F140003%2F76de7911-6eee-463b-8bb9-18edd8da049f.jpeg</url>
      <title>DEV Community: Nirmal Patel</title>
      <link>https://dev.to/nirmaljpatel</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nirmaljpatel"/>
    <language>en</language>
    <item>
      <title>UTF-8</title>
      <dc:creator>Nirmal Patel</dc:creator>
      <pubDate>Wed, 05 Aug 2020 18:59:43 +0000</pubDate>
      <link>https://dev.to/nirmaljpatel/utf-8-1cp1</link>
      <guid>https://dev.to/nirmaljpatel/utf-8-1cp1</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;UTF-8 is a &lt;em&gt;multi-byte&lt;/em&gt; &lt;em&gt;variable-width&lt;/em&gt; &lt;strong&gt;character encoding scheme&lt;/strong&gt; for saving &lt;strong&gt;Unicode codepoints&lt;/strong&gt; - which allow displaying almost all characters from  international languages.&lt;br&gt;
UTF-8 uses 1-byte to store codepoints 0-127. So English text looks exactly the same as they look in ASCII.  &lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  ASCII
&lt;/h1&gt;

&lt;p&gt;represents every character using a number between 32 and 127. Space was 32, the letter “A” was 65, etc. This could conveniently be stored in 7 bits.&lt;/p&gt;

&lt;p&gt;Using 7 bits gives 128 possible values from 0000000 to 1111111, so ASCII has enough room for all lower case and upper case Latin letters, along with each numerical digit, common punctuation marks, spaces, tabs and other control characters.&lt;/p&gt;

&lt;h1&gt;
  
  
  ANSI
&lt;/h1&gt;

&lt;p&gt;below 128, same as ASCII, but there were lots of different ways to handle the characters from 128 and up, depending on where you lived. These different systems were called &lt;em&gt;code pages&lt;/em&gt;. For example in Israel, DOS used a code page called 862, while Greek users used 737.&lt;/p&gt;

&lt;h1&gt;
  
  
  Unicode
&lt;/h1&gt;

&lt;p&gt;a single character set that included every reasonable writing system on the planet.&lt;/p&gt;

&lt;p&gt;Characters are represented as CodePoints&lt;/p&gt;

&lt;p&gt;Every platonic letter in every alphabet is assigned a magic number by the Unicode consortium which is written like: U+0639. &lt;br&gt;
This magic number is called a code point. &lt;br&gt;
The U+ means “Unicode” and the numbers are hexadecimal.&lt;/p&gt;

&lt;h1&gt;
  
  
  UTF-8
&lt;/h1&gt;

&lt;h2&gt;
  
  
  (8-bit Unicode Transformation Format)
&lt;/h2&gt;

&lt;p&gt;UTF-8 is a system for storing strings of Unicode code points, those magic U+ numbers, in memory using 8 bit bytes. &lt;/p&gt;

&lt;p&gt;In UTF-8, every code point from 0-127 is stored in a single byte. This has the neat side effect that English text looks exactly the same in UTF-8 as it did in ASCII.&lt;/p&gt;

&lt;p&gt;Code points 128 and above are stored using 2, 3, in fact, up to 6 bytes.&lt;/p&gt;

&lt;p&gt;UTF-8 is therefore a multi-byte variable-width encoding. Multi-byte because a single character like Я takes more than one byte to specify it. &lt;br&gt;
Variable-width because some characters like H take only 1 byte and some up to 4.&lt;/p&gt;

&lt;p&gt;UTF-8 is universal and covers Latin characters as well as Cyrillic, Arabic, Japanese...&lt;/p&gt;

&lt;p&gt;References used:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/"&gt;https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.smashingmagazine.com/2012/06/all-about-unicode-utf8-character-sets/"&gt;https://www.smashingmagazine.com/2012/06/all-about-unicode-utf8-character-sets/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>cheatsheet</category>
      <category>webdev</category>
      <category>basics</category>
    </item>
    <item>
      <title>Joining multiple Strings into one comma-separated String</title>
      <dc:creator>Nirmal Patel</dc:creator>
      <pubDate>Wed, 22 Jul 2020 17:02:49 +0000</pubDate>
      <link>https://dev.to/nirmaljpatel/joining-multiple-strings-into-one-comma-separated-string-3mg</link>
      <guid>https://dev.to/nirmaljpatel/joining-multiple-strings-into-one-comma-separated-string-3mg</guid>
      <description>&lt;p&gt;One of the mobile apps I work on displays the user's address.&lt;/p&gt;

&lt;p&gt;The API returns the address split across multiple fields in the following format:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let address = {
    addressLine1: 'xxx',
    addressLine2: 'yyy',
    city: 'zzz',
    state: 'AA',
    zipcode: 'ddddd'
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The caveat here is that one or more fields could be null/blank depending on what data was entered by the user at time of creating the address. &lt;/p&gt;

&lt;p&gt;However, when displaying on the screen we want to ignore any blanks and show a consistent comma-separated string.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let array = [
    address.addressLine1,
    address.addressLine2,
    address.city,
    address.state,
    address.zipcode
];

return array.filter(function(val) {
    return val;
}).join(', ');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;.filter()&lt;/code&gt; removes any falsy strings - both blanks, nulls.&lt;br&gt;
&lt;code&gt;.join()&lt;/code&gt; takes care of adding a &lt;code&gt;,&lt;/code&gt; only when needed to join multiple strings.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Adobe XD Tips &amp; Tricks</title>
      <dc:creator>Nirmal Patel</dc:creator>
      <pubDate>Sat, 28 Sep 2019 16:04:20 +0000</pubDate>
      <link>https://dev.to/nirmaljpatel/adobe-xd-tips-tricks-2ceo</link>
      <guid>https://dev.to/nirmaljpatel/adobe-xd-tips-tricks-2ceo</guid>
      <description>&lt;p&gt;&lt;strong&gt;Duplicate Objects&lt;/strong&gt;&lt;br&gt;
Select the object(s) you want to duplicate.&lt;br&gt;
Hold down the Alt key and drag the cursor to create duplicates of the selection.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Drawing Circles &amp;amp; Squares&lt;/strong&gt;&lt;br&gt;
Hold down Shift key while dragging the cursor to draw circles and squares.&lt;/p&gt;

</description>
      <category>adobe</category>
      <category>xd</category>
      <category>ux</category>
    </item>
    <item>
      <title>VSCode Tasks - Specifying custom PATH</title>
      <dc:creator>Nirmal Patel</dc:creator>
      <pubDate>Fri, 12 Jul 2019 15:26:35 +0000</pubDate>
      <link>https://dev.to/nirmaljpatel/vscode-tasks-specifying-custom-path-25ep</link>
      <guid>https://dev.to/nirmaljpatel/vscode-tasks-specifying-custom-path-25ep</guid>
      <description>&lt;p&gt;macOS Catalina opts for zsh as the default shell in place of bash. &lt;br&gt;
This shift had me running into a weird issue with my custom VSCode Tasks where the tasks were throwing a &lt;code&gt;zsh:1: command not found&lt;/code&gt; error.&lt;/p&gt;

&lt;p&gt;I set default login shell to zsh for my macOS user and set up VSCode to use zsh as the default shell for integrated terminal.&lt;/p&gt;

&lt;p&gt;Tried adding &lt;code&gt;export PATH=$PATH:&amp;lt;mypath&amp;gt;&lt;/code&gt; to my &lt;code&gt;~/.zshrc&lt;/code&gt; but that didnt help either.&lt;/p&gt;

&lt;p&gt;Ultimately I ended up specifying the PATH as a custom env variable in the VSCode task options&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"tasks": [
    {
        "label": "Project Name",
        "type": "shell",
        "command": "appc ti project id -o text --no-banner",
        "options": {
            "env": {
                "PATH": "&amp;lt;mypath&amp;gt;:${env:PATH}"
            }
        }
    }
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>vscode</category>
      <category>tasks</category>
      <category>zsh</category>
      <category>path</category>
    </item>
  </channel>
</rss>
