<?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: nparekh1979</title>
    <description>The latest articles on DEV Community by nparekh1979 (@nparekh1979).</description>
    <link>https://dev.to/nparekh1979</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%2F622728%2F7cd58250-6ebb-4716-96d5-2ba6f07facbc.png</url>
      <title>DEV Community: nparekh1979</title>
      <link>https://dev.to/nparekh1979</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nparekh1979"/>
    <language>en</language>
    <item>
      <title>Reset the WordPress administrator email address and password via SSH client.</title>
      <dc:creator>nparekh1979</dc:creator>
      <pubDate>Sat, 26 Oct 2024 16:03:31 +0000</pubDate>
      <link>https://dev.to/nparekh1979/reset-the-wordpress-administrator-email-address-and-password-via-ssh-client-59i8</link>
      <guid>https://dev.to/nparekh1979/reset-the-wordpress-administrator-email-address-and-password-via-ssh-client-59i8</guid>
      <description>&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;I created an instance on AWS. &lt;/p&gt;

&lt;p&gt;I then installed Bitnami wordpress on that instance. &lt;/p&gt;

&lt;p&gt;I bought a domain name and set up a website. &lt;/p&gt;

&lt;p&gt;However after the initial setup, I went to travel &lt;/p&gt;

&lt;p&gt;When I came back and tried to login to the wordpress dashboard using the login &amp;amp; password, that I had saved, it did not work&lt;/p&gt;

&lt;p&gt;Now I am stuck as the email, login &amp;amp; password that I had saved, are not working &lt;/p&gt;

&lt;p&gt;So I connected to the Putty Terminal and used the following command: sudo cat /home/bitnami/bitnami_credentials&lt;/p&gt;

&lt;p&gt;I get the username &amp;amp; password but it does not help me login&lt;/p&gt;

&lt;p&gt;I stopped, started and restarted services on the Bitnami stack through putty terminal &lt;/p&gt;

&lt;p&gt;I even reset the Mariadb root password and tried to login on my dashboard on wordpress&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;Am I doing anything wrong?&lt;/p&gt;

&lt;p&gt;Pls help. &lt;/p&gt;

</description>
      <category>aws</category>
      <category>putty</category>
      <category>mariadb</category>
      <category>wordpress</category>
    </item>
    <item>
      <title>Cannot understand this Javascript NaN practice problem. Please help in explaining it.</title>
      <dc:creator>nparekh1979</dc:creator>
      <pubDate>Thu, 10 Jun 2021 18:32:51 +0000</pubDate>
      <link>https://dev.to/nparekh1979/cannot-understand-this-javascript-nan-practice-problem-please-help-in-explaining-it-5hh4</link>
      <guid>https://dev.to/nparekh1979/cannot-understand-this-javascript-nan-practice-problem-please-help-in-explaining-it-5hh4</guid>
      <description>&lt;p&gt;Question: &lt;/p&gt;

&lt;p&gt;Write a function parseFirstInt that takes a string and returns the first integer present in the string. If the string does not contain an integer, you should get NaN.&lt;/p&gt;

&lt;p&gt;Example: parseFirstInt('No. 10') should return 10 and parseFirstInt('Babylon') should return NaN.&lt;/p&gt;

&lt;p&gt;Answer: &lt;/p&gt;

&lt;p&gt;function parseFirstInt(input) {&lt;br&gt;
  let inputToParse = input;&lt;br&gt;
  for (let i = 0; i &amp;lt; input.length; i++) {&lt;br&gt;
    let firstInt = parseInt(inputToParse);&lt;br&gt;
    if (!Number.isNaN(firstInt)) {&lt;br&gt;
      return firstInt;&lt;br&gt;
    }&lt;br&gt;
    inputToParse = inputToParse.substr(1);&lt;br&gt;
  }&lt;br&gt;
  return NaN;&lt;br&gt;
};&lt;/p&gt;

&lt;p&gt;Explanation: &lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;we declare a function 'parseFirstInt' &lt;br&gt;
it has 1 parameter 'input' &lt;br&gt;
we declare a variable 'inputToParse' &lt;br&gt;
we initialize it with a value of the input string&lt;br&gt;
we use a 'for loop' to loop over the elements of the input string&lt;br&gt;
we then declare another variable inside the 'for loop' which is 'firstInt'&lt;br&gt;
we initialize its value with the output we get when we run the parseInt method on variable 'inputToParse'  and store them in the firstInt variable&lt;br&gt;
we then open an if else statement &lt;br&gt;
our condition is plain &amp;amp; simple&lt;br&gt;
if value of 'firstInt' is NaN then we want it to exit the loop and return NaN&lt;br&gt;
if value of 'firstInt' is not NaN then we want it to execute the block of code in the if / else loop &lt;br&gt;
we keep checking for the first integer by using the loop &lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;
&lt;br&gt;
&lt;/blockquote&gt;

&lt;p&gt;----------------stopped understanding from here----------------&lt;/p&gt;

</description>
      <category>javascript</category>
    </item>
    <item>
      <title>Greatest Common Divisor - Javascript Problem
</title>
      <dc:creator>nparekh1979</dc:creator>
      <pubDate>Sun, 30 May 2021 16:31:12 +0000</pubDate>
      <link>https://dev.to/nparekh1979/greatest-common-divisor-javascript-problem-4pia</link>
      <guid>https://dev.to/nparekh1979/greatest-common-divisor-javascript-problem-4pia</guid>
      <description>&lt;p&gt;I am stuck explaining a solution to myself and I need help.&lt;/p&gt;

&lt;p&gt;Question: &lt;/p&gt;

&lt;p&gt;Write a function gcd that takes two natural numbers and calculates their gcd.&lt;br&gt;
Example: gcd (6, 15) should return 3.&lt;/p&gt;

&lt;p&gt;Answer:&lt;/p&gt;

&lt;p&gt;function gcd (a,b) {&lt;/p&gt;

&lt;p&gt;if ((typeof a !== 'number') || (typeof b !== 'number'))&lt;br&gt;
return false; &lt;/p&gt;

&lt;p&gt;a = Math.abs(a); &lt;br&gt;
b = Math.abs(b); &lt;/p&gt;

&lt;p&gt;while (b) {&lt;br&gt;
let c = b; &lt;br&gt;
b = a % b; &lt;br&gt;
a = c; &lt;br&gt;
}&lt;br&gt;
return a;&lt;/p&gt;

&lt;p&gt;};&lt;/p&gt;

&lt;p&gt;Explanation:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;we declare a function 'gcd'&lt;br&gt;
it has 2 parameters: 'a' and 'b'&lt;br&gt;
we first open an if statement to check if our condition is true&lt;br&gt;
we want to know if typeof a or typeof b is not a number&lt;br&gt;
if our condition is true, meaning if typeof a &amp;amp; typeof b are not a number and a string, boolean or any other data type, then we return false and end the function &lt;br&gt;
if our condition is false, which it is, as both (typeof a and typeof b) are numbers then we want to execute the following code&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;we want to convert our two parameters 'a' &amp;amp; 'b' to absolute positive values&lt;br&gt;
we do that by using Math.abs(a) and Math.abs(b)&lt;br&gt;
we initialize the variable a &amp;amp; b by the output we get from using the Math.abs method on a &amp;amp; b&lt;br&gt;
we then open a while statement&lt;br&gt;
this while loop will loop through a block of code as long as a specified condition is true&lt;br&gt;
if the specified condition is false then the statement after the while loop will be executed&lt;br&gt;
our condition is to check if b is a truthy or falsy value&lt;br&gt;
if it is true then we want to run the block of code &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;we create a temporary variable 'c'&lt;br&gt;
we initialize it with the value of 'b'&lt;br&gt;
we then use the modulo / remainder operator by dividing a by b&lt;br&gt;
we store the result in b&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;
&lt;br&gt;
&lt;/blockquote&gt;
&lt;br&gt;
&lt;/blockquote&gt;

&lt;p&gt;Help: I need assistance understanding as I am blank from this point onwards.&lt;/p&gt;

&lt;p&gt;Thank you in advance !!&lt;/p&gt;

</description>
      <category>javascript</category>
    </item>
    <item>
      <title>Understanding While Loop</title>
      <dc:creator>nparekh1979</dc:creator>
      <pubDate>Thu, 27 May 2021 18:23:31 +0000</pubDate>
      <link>https://dev.to/nparekh1979/understanding-while-loop-3gdh</link>
      <guid>https://dev.to/nparekh1979/understanding-while-loop-3gdh</guid>
      <description>&lt;p&gt;I am trying to understand what exactly happens when I use the 'while loop' to execute a code multiple times. &lt;/p&gt;

&lt;p&gt;I was solving a problem on JSHero.net and I found it confusing so I tried explaining the solution to myself in order to get a clear understanding. &lt;/p&gt;

&lt;p&gt;Please study the question, the answer and the simple explanation and let me know if I have understood it correctly.&lt;/p&gt;

&lt;p&gt;Stay Safe !!&lt;/p&gt;

&lt;p&gt;Question: &lt;/p&gt;

&lt;p&gt;Write a function spaces that takes a natural number n and returns a string of n spaces.&lt;br&gt;
Example: spaces(1) should return ' '.&lt;/p&gt;

&lt;p&gt;Answer: &lt;/p&gt;

&lt;p&gt;function spaces (num) {&lt;/p&gt;

&lt;p&gt;let mySpaces = '';&lt;/p&gt;

&lt;p&gt;while (num-- &amp;gt; 0)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mySpaces += ' '; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;return mySpaces;&lt;/p&gt;

&lt;p&gt;};&lt;/p&gt;

&lt;p&gt;Explanation: &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;declare a function spaces&lt;br&gt;
it has 1 parameter 'num'&lt;br&gt;
declare a variable mySpaces&lt;br&gt;
initialize it with an empty string&lt;br&gt;
we use a while loop as we need to repeat an action multiple times&lt;br&gt;
in this case we need to add blank spaces to a string &lt;br&gt;
our '''empty spaces string''' will be stored in the variable mySpaces&lt;br&gt;
blank spaces will be equal to the 'num' parameter, which is fed when the function 'spaces' is called&lt;br&gt;
while loops have: a condition and a code (loop body) &lt;br&gt;
our condition is to ensure that the code should execute as long as the num is greater than 0&lt;br&gt;
our condition is (num-- &amp;gt; 0)&lt;br&gt;
our code is: mySpaces += ''&lt;br&gt;
so if our function is called with the following parameter then how would this while loop work&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;spaces (3)&lt;br&gt;
first it will check if 3 &amp;gt; 0; which it is and it will execute the code&lt;br&gt;
mySpaces = mySpaces + ' '; the result in variable mySpace will now be ' ' (1 space)&lt;br&gt;
then since we have used the num as a counter (num--), the loop will reduce 1 from 3 = 2&lt;br&gt;
it will check if 2 &amp;gt; 0; which it is and it will execute the code&lt;br&gt;
mySpaces = mySpaces + ' '; the result in variable mySpace will now be '  ' (2 spaces)&lt;br&gt;
then since we have used the num as a counter (num--), the loop will reduce 1 from 2 = 1&lt;br&gt;
it will check if 1 &amp;gt; 0; which it is and it will execute the code&lt;br&gt;
mySpaces = mySpaces + ' '; the result in variable mySpace will now be '   ' (3 spaces)&lt;br&gt;
then since we have used the num as a counter (num--), the loop will reduce 1 from 1 = 0&lt;br&gt;
it will check if 0 &amp;gt; 0; which it is not and it will only execute the code after the while loop&lt;br&gt;
we return the mySpaces variable which will give us the final result&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

</description>
      <category>javascript</category>
    </item>
    <item>
      <title>Issue with Else If Statement</title>
      <dc:creator>nparekh1979</dc:creator>
      <pubDate>Wed, 19 May 2021 07:20:26 +0000</pubDate>
      <link>https://dev.to/nparekh1979/issue-with-else-if-statement-5aj5</link>
      <guid>https://dev.to/nparekh1979/issue-with-else-if-statement-5aj5</guid>
      <description>&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;I am stuck trying to understand a Javascript solution. Please can you help dumb it down for me if possible:&lt;/p&gt;

&lt;p&gt;Question:&lt;/p&gt;

&lt;p&gt;Write a function addWithSurcharge that adds two amounts with surcharge. For each amount less than or equal to 10, the surcharge is 1. For each amount greater than 10 and less than or equal to 20, the surcharge is 2. For each amount greater than 20, the surcharge is 3.&lt;/p&gt;

&lt;p&gt;Example: addWithSurcharge(10, 30) should return 44.&lt;/p&gt;

&lt;p&gt;Answer:&lt;/p&gt;

&lt;p&gt;function addWithSurcharge (a,b) {&lt;/p&gt;

&lt;p&gt;let sum = a + b;&lt;/p&gt;

&lt;p&gt;if ( sum &amp;lt; 10) {&lt;/p&gt;

&lt;p&gt;return sum += 2}&lt;/p&gt;

&lt;p&gt;else if (sum &amp;gt; 10 &amp;amp;&amp;amp; sum &amp;lt;= 20) {&lt;/p&gt;

&lt;p&gt;return sum += 2}&lt;/p&gt;

&lt;p&gt;else if (sum &amp;gt; 20 &amp;amp;&amp;amp; sum &amp;lt; 30) {&lt;/p&gt;

&lt;p&gt;return sum += 3}&lt;/p&gt;

&lt;p&gt;else if (sum &amp;gt;= 30 &amp;amp;&amp;amp; sum &amp;lt; 40) {&lt;/p&gt;

&lt;p&gt;return sum += 4}&lt;/p&gt;

&lt;p&gt;else if (sum &amp;gt; 40) {&lt;/p&gt;

&lt;p&gt;return sum += 5}&lt;/p&gt;

&lt;p&gt;};&lt;/p&gt;

&lt;p&gt;————————————————————————-&lt;/p&gt;

&lt;p&gt;I simply do not understand why this works.&lt;/p&gt;

&lt;p&gt;FYI: I am a beginner&lt;/p&gt;

&lt;p&gt;Thanks in advance&lt;/p&gt;

</description>
      <category>javascript</category>
    </item>
  </channel>
</rss>
