<?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: Razielini</title>
    <description>The latest articles on DEV Community by Razielini (@razielini).</description>
    <link>https://dev.to/razielini</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%2F343586%2F542bb504-44b1-44f8-9d41-cd2bb3f0d26a.png</url>
      <title>DEV Community: Razielini</title>
      <link>https://dev.to/razielini</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/razielini"/>
    <language>en</language>
    <item>
      <title>Solve a problem is only a start</title>
      <dc:creator>Razielini</dc:creator>
      <pubDate>Sat, 06 Feb 2021 22:59:45 +0000</pubDate>
      <link>https://dev.to/razielini/solve-a-problem-is-only-a-start-2je4</link>
      <guid>https://dev.to/razielini/solve-a-problem-is-only-a-start-2je4</guid>
      <description>&lt;p&gt;In the lasts few weeks, I have been solving some challenges at &lt;strong&gt;&lt;a href="https://www.hackerrank.com/"&gt;HackerRank&lt;/a&gt;&lt;/strong&gt;, starting with the basics, in my mind I do not need to solve these challenges because there are so basic, and &lt;strong&gt;I'm right for the wrongs reasons&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It's not only about bringing the right solution and pass the tests, the way you solve the problem is important. Some of these simple challenges could have a hidden complexity depends on the solution you bring.&lt;/p&gt;

&lt;p&gt;For example, the challenge &lt;strong&gt;&lt;a href="https://www.hackerrank.com/challenges/find-digits/problem"&gt;Find Digits&lt;/a&gt;&lt;/strong&gt; if you are interested to take some minutes reading, and try to solve it, I'm pretty sure not take higher than 10 minutes to solve, is basically there are free points in the platform.&lt;/p&gt;

&lt;p&gt;If you solved the last challenge, maybe your solution was to transform the number to some type of iterable object, later iterate the object and evaluate every digit, its correct, it's a viable solution and even an optimal solution in a lot of cases.&lt;/p&gt;

&lt;p&gt;But I'm sure is the most common solution you can find, another solution more uncommon o slightly complex is a solution with a Mathematical focus, for example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;findDigits&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;copyN&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;while&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;copyN&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;
    &lt;span class="nx"&gt;n&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;parseInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;result&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;This code is the solution for the same problem, with some advantages like better portability between languages and performance.&lt;/p&gt;

&lt;p&gt;This is what I was talking about at the start of the post when I said 'im right but for the wrong reasons', exist a lot of ways to solve a problem and all solutions can work, but some are better than others, and in some cases, we don't looking for because we don't know they exist.&lt;/p&gt;

&lt;p&gt;As a software developer, I consider it very important to feel uncomfortable when things work well, I must try to improve the solution at least for a hobby.&lt;/p&gt;

&lt;p&gt;If you have some years as a software developer and don't solve the challenge, I think you must start immediately with some easiest challenges, this is good to improve your logic and very common on job interviews, this can give you the advantage to get that role you are looking for or negotiate a better salary.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>thoughts</category>
      <category>hackerrank</category>
    </item>
    <item>
      <title>Resolver un problema es solo un inicio</title>
      <dc:creator>Razielini</dc:creator>
      <pubDate>Fri, 05 Feb 2021 02:26:56 +0000</pubDate>
      <link>https://dev.to/razielini/resolver-un-problema-es-solo-un-inicio-264e</link>
      <guid>https://dev.to/razielini/resolver-un-problema-es-solo-un-inicio-264e</guid>
      <description>&lt;p&gt;Estas últimas semanas he estado resolviendo algunos retos de &lt;strong&gt;&lt;a href="https://www.hackerrank.com/"&gt;HackerRank&lt;/a&gt;&lt;/strong&gt;, comenzando con lo básico, en teoría no necesito resolverlos porque son básicos y no representan una dificultad significativa y tengo razón, pero &lt;strong&gt;tengo razon por las razones equivocadas&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;No se trata solo de solucionar el problema y que pase las pruebas, también importa el cómo lo solucionas. Algunos de estos sencillos ejercicios, podrían tener una complejidad oculta dependiendo de la solución que pienses.&lt;/p&gt;

&lt;p&gt;Por ejemplo el reto de &lt;strong&gt;&lt;a href="https://www.hackerrank.com/challenges/find-digits/problem"&gt;Find Digits&lt;/a&gt;&lt;/strong&gt;, si te interesa tomate unos minutos en revisarlo e intenta resolverlo, estoy aseguro que no te tomara más de 10 minutos, básicamente son puntos gratis en la plataforma.&lt;/p&gt;

&lt;p&gt;Si intentaste resolverlo y tu solución fue convertir el número en algún tipo de objeto iterable, para después iterarlo y evaluar cada uno de los dígitos, es correcto, es una solución viable e incluso optima en la mayoría de los casos.&lt;/p&gt;

&lt;p&gt;Pero seguramente es la solución más común que te vas a encontrar, otra solución menos común o ligeramente más complicada, es la que tiene un acercamiento matemático, por ejemplo:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;findDigits&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;copyN&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;while&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;copyN&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;
    &lt;span class="nx"&gt;n&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;parseInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;result&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;Soluciona el mismo problema, con algunas ventajas extras como mayor portabilidad entre lenguajes y mejor rendimiento.&lt;/p&gt;

&lt;p&gt;A esto me refería al inicio cuando dije &lt;strong&gt;'tengo razón por las razones equivocadas'&lt;/strong&gt;, existen muchas manera de solucionar un problema y todas pueden funcionar, pero hay mejores soluciones y en ocasiones ni siquiera las buscamos porque no sabemos que existen.&lt;/p&gt;

&lt;p&gt;Como desarrollador de software considero importante el incomodarme a mí mismo cuando algo funciona y creo dominarlo, debería de intentar mejorarlo, al menos por hobby.&lt;/p&gt;

&lt;p&gt;Si llevas un par de años como desarrollador y &lt;strong&gt;no pudiste resolver el reto&lt;/strong&gt;, deberías de comenzar inmediatamente con algunos más sencillos, esto es bueno para mejorar la lógica y muy común en entrevistas laborales, puede marcar una diferencia en obtener ese puesto que deseas o poder negociar tu salario.&lt;/p&gt;

</description>
      <category>retos</category>
      <category>javascript</category>
      <category>programming</category>
      <category>spanish</category>
    </item>
    <item>
      <title>Using node-config</title>
      <dc:creator>Razielini</dc:creator>
      <pubDate>Sat, 12 Dec 2020 21:47:57 +0000</pubDate>
      <link>https://dev.to/razielini/using-node-config-5c5p</link>
      <guid>https://dev.to/razielini/using-node-config-5c5p</guid>
      <description>&lt;h1&gt;
  
  
  Tutorial about node-config.
&lt;/h1&gt;

&lt;p&gt;Hi! I'm Razielini, and I want to share a package for node I discover some weeks ago, which has been very useful for me.&lt;/p&gt;

&lt;p&gt;The package is &lt;a href="https://www.npmjs.com/package/config"&gt;node-config&lt;/a&gt;, created by &lt;a href="https://github.com/lorenwest"&gt;Loren West&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;This package takes the setup level to your next level and is very easy to use and understand.&lt;/p&gt;

&lt;h1&gt;
  
  
  Installation
&lt;/h1&gt;

&lt;p&gt;The installation is very simple as usual.&lt;/p&gt;

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

&lt;/div&gt;
&lt;h2&gt;
  
  
  Create files
&lt;/h2&gt;

&lt;p&gt;Later, create the config files.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    $ mkdir config
    $ vi config/default.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    {
         // Customer module configs
         "Customer":  {
             "dbConfig":  {
             "host":  "localhost",
             "port":  5984,
             "dbName":  "customers"
             },
             "credit":  {
                 "initialLimit":  100,
                 // Set low for development
                 "initialDays":  1
             }
         }
     }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Use config in your code
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   const  config  =  require('config');
    //...
    const  dbConfig  =  config.get('Customer.dbConfig');

    db.connect(dbConfig,  ...);

    if  (config.has('optionalFeature.detail'))  {
         const  detail  =  config.get('optionalFeature.detail');
         //...
     }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is where you can start to notice a difference, the package gives you a method to extract information from the config file as if were any object.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;config.get('Customer.dbConfig')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Can validate if exist a property before to use&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;config.has('optionalFeature.detail')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And has many other functions like set variables en execution time, override your config with other config files, or even import automatically the values of the variables in a .env file.&lt;/p&gt;

&lt;p&gt;You can check the  &lt;a href="https://github.com/lorenwest/node-config/wiki"&gt;Wiki page&lt;/a&gt; with the full documentation of this package.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
