<?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: Dragos Vecerdea</title>
    <description>The latest articles on DEV Community by Dragos Vecerdea (@dragosv99).</description>
    <link>https://dev.to/dragosv99</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%2F536536%2F953829df-ed6c-4a4b-acf6-fdd11f3e1bfd.jpeg</url>
      <title>DEV Community: Dragos Vecerdea</title>
      <link>https://dev.to/dragosv99</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dragosv99"/>
    <language>en</language>
    <item>
      <title>How I got to understand binary search</title>
      <dc:creator>Dragos Vecerdea</dc:creator>
      <pubDate>Wed, 09 Dec 2020 00:39:30 +0000</pubDate>
      <link>https://dev.to/dragosv99/how-i-finally-understand-binary-search-1b6h</link>
      <guid>https://dev.to/dragosv99/how-i-finally-understand-binary-search-1b6h</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--G-otLl7---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/ctlibrary.org/wp-content/uploads/2015/11/foradults.jpg%3Fresize%3D560%252C337%26ssl%3D1" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--G-otLl7---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/ctlibrary.org/wp-content/uploads/2015/11/foradults.jpg%3Fresize%3D560%252C337%26ssl%3D1" alt="Photo of a book"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Not long ago, while interviewing for an internship position, I was asked one of the most abstract and surprising technical questions I have ever been asked in an interview:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;' How would you teach a 7-year-old child binary search?'&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Alongside the obvious purpose of verifying my ability to articulate complex ideas using simple words, the question made me reflect on something else: all the great &lt;a href="https://en.wikipedia.org/wiki/Eureka_(word)"&gt;Eureka!&lt;/a&gt; moments I had so far when understanding a concept that seconds before seemed so hard to comprehend. &lt;/p&gt;

&lt;p&gt;I asked myself further, what do those moments have in common? Where does the talent of transforming simple words into complex ideas live?&lt;/p&gt;

&lt;p&gt;I suddenly remembered myself, how I was thought binary search, by a very talented schoolmate, almost a decade ago. She grabbed a thick book, I recall... and asked me how I would find page 256 in it. At first, the question did seem odd, as I used to find a page in a book by picking a place to open it at and then turning pages from there. She then opened it to the half and showed me the page number: 273. The things were already starting to fall into place. She then followed her plan to the end by opening the book to the half between the first page and the 273rd page. It was by that moment, that the idea behind binary search was in my mind and nothing could have blurred it anymore. Not only that it made sense but it felt real and all around me.&lt;/p&gt;

&lt;p&gt;Since the interview, I happen to ask myself more often, how would I explain a hard technical concept to someone outside my field of research?&lt;/p&gt;

&lt;p&gt;Too often, we get blocked behind the walls of technical words, missing the beauty of simplicity. Feel free to share your own &lt;a href="https://en.wikipedia.org/wiki/Eureka_(word)"&gt;Eureka!&lt;/a&gt; moments and tell us a story about finally understanding a difficult topic and what do you think made it possible. Was it a person, a place, a good example or something else? &lt;/p&gt;

</description>
      <category>programming</category>
      <category>algorithms</category>
      <category>interview</category>
      <category>teaching</category>
    </item>
    <item>
      <title>Build your own Javascript CLI in 90 seconds</title>
      <dc:creator>Dragos Vecerdea</dc:creator>
      <pubDate>Tue, 08 Dec 2020 22:15:25 +0000</pubDate>
      <link>https://dev.to/dragosv99/javascript-cli-in-90-seconds-kb6</link>
      <guid>https://dev.to/dragosv99/javascript-cli-in-90-seconds-kb6</guid>
      <description>&lt;p&gt;Writing your own CLI (command line interface) can be really great as it allows you to automate any task you may want to and run it right from your Terminal. &lt;/p&gt;

&lt;p&gt;Wait no more and get started with your first CLI:&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 0 - Create your project directory
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir myproject &amp;amp;&amp;amp; cd myproject
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 1 - Initialize your project
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2 - Create the entry point to your CLI
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;touch index.js &amp;amp;&amp;amp; open ./index.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3 - Add to index.js a &lt;a href="https://en.wikipedia.org/wiki/Shebang_(Unix)"&gt;shebang&lt;/a&gt; and the CLI's logic
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="o"&gt;!/&lt;/span&gt;&lt;span class="n"&gt;usr&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;bin&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt; &lt;span class="n"&gt;node&lt;/span&gt;

&lt;span class="n"&gt;console&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;log&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="n"&gt;hello&lt;/span&gt; &lt;span class="n"&gt;world&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 4 - Add index.js to project's executables
&lt;/h3&gt;

&lt;p&gt;Add to package.json the following field:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"bin" :  {
  "myproject" : "./index.js"
},
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 5 - &lt;a href="https://docs.npmjs.com/cli/v6/commands/npm-link"&gt;Symlink&lt;/a&gt; your project
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm link
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 6 - Your CLI should be now up and running!
&lt;/h3&gt;

&lt;p&gt;In your Terminal, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;myproject
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I hope you had fun, and since this is your first encounter with a CLI, that you are still excited and eager for more.&lt;/p&gt;

&lt;p&gt;As said before, automating your own tasks using command-line scripts can be a great way to try new skills and experiment with new node modules. So far, we have just programmed a simple script but this skill can enable the use of more sophisticated ones.  &lt;/p&gt;

&lt;p&gt;Stay tuned for the next post, when we explore more complex options for creating a great CLI. Until next, I recommend you to check this great &lt;a href="https://www.npmjs.com/package/commander"&gt;node module&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>shell</category>
      <category>cli</category>
    </item>
  </channel>
</rss>
