<?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: Smeet J Thakkar</title>
    <description>The latest articles on DEV Community by Smeet J Thakkar (@smeet_j).</description>
    <link>https://dev.to/smeet_j</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%2F328228%2F764a215c-a25b-4a30-97ca-c1045582fa14.JPG</url>
      <title>DEV Community: Smeet J Thakkar</title>
      <link>https://dev.to/smeet_j</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/smeet_j"/>
    <language>en</language>
    <item>
      <title>Connecting to MongoDB via macOS terminal using atlas cli and mongosh</title>
      <dc:creator>Smeet J Thakkar</dc:creator>
      <pubDate>Sun, 11 Dec 2022 13:54:39 +0000</pubDate>
      <link>https://dev.to/smeet_j/connecting-to-mongodb-via-macos-terminal-using-atlas-cli-and-mongosh-4801</link>
      <guid>https://dev.to/smeet_j/connecting-to-mongodb-via-macos-terminal-using-atlas-cli-and-mongosh-4801</guid>
      <description>&lt;p&gt;As a beginner and newbie to coding, mongo happens to be the first database service I am exploring and the learning journey has been great by far. In order to learn any new tool, framework or service - it is crucial their documentation is clear enough so you can find your way through it. While mongo team does a great job at it, I had to comb through a few documents to find "how I can connect to the mongoDB cluster without leaving my terminal". To make this easier for anyone who is a lazy ass like myself, here are the steps I followed:&lt;/p&gt;

&lt;p&gt;Pre-requisites:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install/Update atlas-cli and mongosh. If you haven't already, please refer: &lt;a href="https://www.mongodb.com/docs/atlas/cli/stable/install-atlas-cli/"&gt;https://www.mongodb.com/docs/atlas/cli/stable/install-atlas-cli/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;You already have a mongoDB cluster created&lt;/li&gt;
&lt;li&gt;Your ip is whitelisted to access the cluster&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Step 1: Creating a profile&lt;/p&gt;

&lt;p&gt;&lt;code&gt;atlas config init&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This initiates the profile creation process. All values are optional. If you do not enter the public/private keys or profile name - they keys are auto-generated and profile is set to default.&lt;/li&gt;
&lt;li&gt;I would suggest add the profile name to a preferred short username. The reason being, it can be used as a flag for other cli commands.&lt;/li&gt;
&lt;li&gt;Most importantly, store the details in a secure place especially the dbuser and dbpassword. You'll be frequently needing this information. &lt;/li&gt;
&lt;li&gt;At any point, you can run a spotlight search for finding the config.toml file. This is where your profile related details are stored.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Step 2: Use atlas to authenticate your profile&lt;/p&gt;

&lt;p&gt;&lt;code&gt;atlas auth login&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Once your profile is created, you can use the stored credentials to access your mongoDB cluster at any given point.&lt;/li&gt;
&lt;li&gt;The general syntax is &lt;code&gt;atlas &amp;lt;command&amp;gt; --profile --profileName&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;When you run this command, a browser window opens up to asking for a one-time activation code. &lt;/li&gt;
&lt;li&gt;I know, I know. This is the only time you've to leave your terminal.&lt;/li&gt;
&lt;li&gt;Paste the authentication code from your terminal into the browser and you're all set.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Step 3: Retrieve your SRV connection string &lt;/p&gt;

&lt;p&gt;&lt;code&gt;atlas clusters connectionStrings describe &amp;lt;clusterName&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;this command returns a standard connection string which will look something like mongodb+srv://clusterName.mongodb.net&lt;/li&gt;
&lt;li&gt;Copy this URL to the clipboard&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Step 4 &amp;amp; the final one: Run mongosh&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mongosh &amp;lt;connectionString&amp;gt; --username &amp;lt;dbUser&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To break it down: mongosh - this is for your mongoDB shell. &lt;/li&gt;
&lt;li&gt; is the string you were able to fetch during Step 3&lt;/li&gt;
&lt;li&gt;dbUser is the username you must have saved during step 1 and it needs to be added with the flag --username&lt;/li&gt;
&lt;li&gt;Once you run it, the terminal prompts for a password. This is the database password from Step 1. Enter and TADA!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I am confident there are better and shorter ways to connect to your cluster. If I come across any such solution, I'll definitely share it with everyone. In case you know it already, I am all ears! &lt;/p&gt;

</description>
      <category>database</category>
      <category>mongodb</category>
      <category>macos</category>
      <category>beginners</category>
    </item>
    <item>
      <title>CSS Basics Layout Fundamentals: Block, Inline &amp; Inline Block</title>
      <dc:creator>Smeet J Thakkar</dc:creator>
      <pubDate>Thu, 07 May 2020 15:26:51 +0000</pubDate>
      <link>https://dev.to/smeet_j/css-basics-layout-fundamentals-block-inline-inline-block-464h</link>
      <guid>https://dev.to/smeet_j/css-basics-layout-fundamentals-block-inline-inline-block-464h</guid>
      <description>&lt;p&gt;Each HTML element has a default display property, primarily: "block" or "inline" or "none". The catch is you can override the behaviour of these elements by interchanging their values or simply assigning it another value such as inline-block, flex, grid, block etc. Well, if you were to apply display: block; to an already existing block element, you'll notice no change obviously; just an additional line of code. Here, we are going to look at three of these values: block, inline and inline-block.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Attributes&lt;/th&gt;
&lt;th&gt;block&lt;/th&gt;
&lt;th&gt;inline&lt;/th&gt;
&lt;th&gt;Inline-block &lt;br&gt; (inline+block)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Width, Height, Margins&lt;/td&gt;
&lt;td&gt;✔️&lt;/td&gt;
&lt;td&gt;✘&lt;/td&gt;
&lt;td&gt;✔️&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Full-width, Line-Breaks&lt;/td&gt;
&lt;td&gt;✔️&lt;/td&gt;
&lt;td&gt;✘&lt;/td&gt;
&lt;td&gt;✘&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Padding&lt;/td&gt;
&lt;td&gt;✔️&lt;/td&gt;
&lt;td&gt;✔️&lt;/td&gt;
&lt;td&gt;✔️&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Example Elements:&lt;/td&gt;
&lt;td&gt;Headings (h1-h6) &lt;br&gt; sections &lt;br&gt; forms &lt;br&gt; footer &lt;br&gt; ul/ol &lt;br&gt; div&lt;/td&gt;
&lt;td&gt;anchor &lt;br&gt; span &lt;br&gt; img &lt;br&gt; Strong &lt;br&gt; label&lt;/td&gt;
&lt;td&gt;← can be any of these. &lt;br&gt; Apply display: inline-block. &lt;br&gt; Most general use-case can be &lt;br&gt; site navigation.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;TL:DR;&lt;/p&gt;

&lt;p&gt;The above table describes, at any given point, which attributes you can apply to what elements. Trust me, knowing this is extremely important especially for setting the foundation for your future CSS exploration phase.&lt;/p&gt;

&lt;h3&gt;
  
  
  Let us walk through an example to dig deeper:
&lt;/h3&gt;

&lt;p&gt;Block-level Element:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Let’s create a container using &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;. I've assigned it a class. If you're yet to explore this topic, think of classes as a nickname.&lt;/li&gt;
&lt;li&gt;Add a few paragraphs inside the &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; container.&lt;/li&gt;
&lt;li&gt;Lastly, let's give our container and paragraphs some border and background.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"head"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;
    I am a paragraph, a block element. I cover full-width of 
    the page just like my container, div. "See my borders".
  &lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;
    I am an &lt;span class="nt"&gt;&amp;lt;span&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"span-1"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;inline span element&lt;span class="nt"&gt;&amp;lt;/span&amp;gt;&lt;/span&gt; 
    inside a block element. They allow me to get some space on 
    the right/left but not top/bottom :(
  &lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;
    Here comes the best of both worlds, inline-block. 
    The &lt;span class="nt"&gt;&amp;lt;span&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;span-2&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;inline-block&lt;span class="nt"&gt;&amp;lt;/span&amp;gt;&lt;/span&gt; 
    to the rescue. 
  &lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;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 css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.head&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#f1425d&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#fff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;280px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.head&lt;/span&gt; &lt;span class="nt"&gt;p&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="m"&gt;#39ff14&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inline Elements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Look at the second &amp;amp; third paragraph in the above code. Did you notice something?&lt;/li&gt;
&lt;li&gt;Yes! An inline span element is embedded inside the &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; tags.&lt;/li&gt;
&lt;li&gt;Let's add some styles to make them stand out.&lt;/li&gt;
&lt;li&gt;Try giving span-1 some margin on the top, you'll notice nothing happens. If it were to happen, that'd be technically break the flow of the layout, no?
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.span-1&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;.span-2&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;white&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* oh common, I am an inline element */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.span-1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;margin-top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/*nothing happens*/&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5px&lt;/span&gt; &lt;span class="m"&gt;30px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inline-Block Elements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Did you see how they behaved? No line-breaks or respect for margins.&lt;/li&gt;
&lt;li&gt;Let's change the display property for span-2 and try giving it some margins. Tada!
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.span-2&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;inline-block&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* check this out */&lt;/span&gt;
  &lt;span class="nl"&gt;margin-top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;margin-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Additional: Same element but different display values:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Let's try giving different display properties to the same tag, in this case, headings and give them some background + borders to be able to see the difference.&lt;/li&gt;
&lt;li&gt;You'll see h1 still occupies the full-width but h2?
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;I am another block-level element just stretching out.&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;Am a smaller heading yet a block element. 
But, you can override my behaviour by changing the display property.&lt;span class="nt"&gt;&amp;lt;/h2&amp;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 css"&gt;&lt;code&gt;&lt;span class="nt"&gt;h1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="no"&gt;red&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin-top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;h2&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="no"&gt;purple&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;margin-top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Now, I can't make this happen. */&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;inline&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* but you can fit another element (img?) next to me! */&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="c"&gt;/* why? but why? told you won't work :p */&lt;/span&gt;
  &lt;span class="n"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;500px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* okay, bye! */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I've posted the final code &lt;a href="https://codepen.io/smeett/pen/ZEbrPbz"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Thank you for taking the time out to read this post, hopefully you find this helpful.&lt;/p&gt;

</description>
      <category>todayilearned</category>
      <category>beginners</category>
      <category>codenewbie</category>
    </item>
  </channel>
</rss>
