<?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: eddiejpot</title>
    <description>The latest articles on DEV Community by eddiejpot (@eddiejpot).</description>
    <link>https://dev.to/eddiejpot</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%2F628651%2Fe9cd923f-f240-48bc-ad88-75a2810efe19.png</url>
      <title>DEV Community: eddiejpot</title>
      <link>https://dev.to/eddiejpot</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/eddiejpot"/>
    <language>en</language>
    <item>
      <title>Java Script Truthy/Falsy &amp; Logical Operators</title>
      <dc:creator>eddiejpot</dc:creator>
      <pubDate>Wed, 01 Dec 2021 04:22:57 +0000</pubDate>
      <link>https://dev.to/eddiejpot/java-script-truthyfalsy-logical-operators-1o3h</link>
      <guid>https://dev.to/eddiejpot/java-script-truthyfalsy-logical-operators-1o3h</guid>
      <description>&lt;h2&gt;
  
  
  Falsy Values
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;code&gt;null&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;undefined&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;&lt;code&gt;NaN&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;0&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;""&lt;/code&gt; empty quotes&lt;/li&gt;
&lt;li&gt;false&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &amp;amp;&amp;amp; and ||
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&amp;amp;&amp;amp;&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Returns the first falsy value&lt;/li&gt;
&lt;li&gt;If none found, it will return the last truthy value&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;||&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Returns the first truthy value&lt;/li&gt;
&lt;li&gt;If none found, it will return the last falsy value
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// both are truthy
truthy1 &amp;amp;&amp;amp; truthy2; // truthy2
truthy1 || truthy2; // truthy1

// both are falsy
falsy1 &amp;amp;&amp;amp; falsy2; // falsy1
falsy1 || falsy2; // falsy2

// 1st truthy, 2nd falsy
truthy1 &amp;amp;&amp;amp; falsy1; // falsy1
truthy1 || falsy1; // truthy1

// 1st falsy, 2nd truthy
falsy1 &amp;amp;&amp;amp; truthy1; // falsy1
falsy1 || truthy1; // truthy1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>PostgreSQL: Drop a database that has a hyphen in the name</title>
      <dc:creator>eddiejpot</dc:creator>
      <pubDate>Fri, 28 May 2021 01:24:10 +0000</pubDate>
      <link>https://dev.to/eddiejpot/postgresql-drop-a-database-that-has-a-hyphen-in-the-name-4gln</link>
      <guid>https://dev.to/eddiejpot/postgresql-drop-a-database-that-has-a-hyphen-in-the-name-4gln</guid>
      <description>&lt;p&gt;Normally to drop a database in psql (postgresql) , we can just type&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DROP DATABASE dbname;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If we want to drop a database called "db-name". we have to escape the database name which contains the hyphen by using double quotation marks.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DROP DATABASE "db-name";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Resource link here &lt;a href="https://stackoverflow.com/questions/3942759/whats-the-escape-sequence-for-hyphen-in-postgresql"&gt;here&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to kill a process on localhost port on Ubuntu &amp; Windows</title>
      <dc:creator>eddiejpot</dc:creator>
      <pubDate>Wed, 19 May 2021 15:04:49 +0000</pubDate>
      <link>https://dev.to/eddiejpot/how-to-kill-the-process-on-localhost-port-on-ubuntu-3bjm</link>
      <guid>https://dev.to/eddiejpot/how-to-kill-the-process-on-localhost-port-on-ubuntu-3bjm</guid>
      <description>&lt;p&gt;We'll be using port number 3000 as the example&lt;/p&gt;

&lt;h1&gt;
  
  
  Ubuntu
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Option 1:
&lt;/h3&gt;

&lt;p&gt;Step One: &lt;br&gt;
Get the process id&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo netstat -lpn |grep :3000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
 ​&lt;br&gt;
You will get an output similar to this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tcp6  0  0 :::3000    :::*    LISTEN    1234/node
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step Two: &lt;br&gt;
Now that you have the process id - which is 1234 ​in this example&lt;br&gt;
Kill the process using the code below&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kill -p 1234  OR  kill -9 1234
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
 ​&lt;/p&gt;
&lt;h3&gt;
  
  
  Option 2:
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fuser -k 3000/tcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;&lt;br&gt;
 ​&lt;/p&gt;
&lt;h1&gt;
  
  
  Windows
&lt;/h1&gt;

&lt;p&gt;Step One&lt;br&gt;
Open up cmd.exe (we may need to run it as an administrator, but this isn't always necessary). Run the below command:&lt;br&gt;
&lt;code&gt;netstat -ano | findstr :&amp;lt;PORT&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;netstat -ano | findstr :3000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
 ​&lt;br&gt;
The arrow shows the PID (process identifier). Locate the PID of the process that's using the port you want.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ffqFa5Su--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/re8h58cyjd6bgq4ftagh.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ffqFa5Su--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/re8h58cyjd6bgq4ftagh.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step Two&lt;br&gt;
&lt;code&gt;taskkill /PID &amp;lt;PID&amp;gt; /F&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;taskkill /PID 4692 /F
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
 ​&lt;/p&gt;

&lt;p&gt;Step Three&lt;br&gt;
You can check if the operation was successful by re-running the command in "Step 1". You shouldn't see any more search results for that port number.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Where to store SSH key (For Windows) 🔑</title>
      <dc:creator>eddiejpot</dc:creator>
      <pubDate>Mon, 10 May 2021 06:19:26 +0000</pubDate>
      <link>https://dev.to/eddiejpot/where-to-store-ssh-key-for-windows-3462</link>
      <guid>https://dev.to/eddiejpot/where-to-store-ssh-key-for-windows-3462</guid>
      <description>&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Windows Subsystem for Linux (WSL) is installed&lt;/li&gt;
&lt;li&gt;For this example we will use the Ubuntu Linux distro/distribution.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bootcamp.rocketacademy.co/course-logistics/required-hardware-and-software#windows" rel="noopener noreferrer"&gt;Visit this link to rocket academy to find out more about WSL&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Step 1: Understand how to access Linux On Windows&lt;br&gt;&lt;br&gt;
&lt;/h1&gt;

&lt;h4&gt;
  
  
  Method 1: Using the file explorer&lt;br&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Type &lt;code&gt;\\wsl$\&lt;/code&gt; into the file explorer. This will direct you to the location of the Ubuntu folder.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxj9pniw925dvoylfkq08.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxj9pniw925dvoylfkq08.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Navigate to your linux folder. &lt;code&gt;Ubuntu -&amp;gt; Home -&amp;gt; &amp;lt;LINUX USERNAME&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2xp4e3sdn2np9277r713.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2xp4e3sdn2np9277r713.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Method 2: Using the WSL terminal
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# This command navigates to the linux folder

cd ~/
&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;# This command lists the files that are in the linux folder

ls -a ~
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Step 2:  Create .ssh folder (this is where we'll put the ssh key)
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;Notes: If this is your first time accessing this folder, you probably do not have a folder for ssh files and will have to create your own.&lt;/em&gt; &lt;br&gt;&lt;br&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Method 1: Using the file explorer
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Create a folder in your linux folder and name it ".ssh"
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk6y5nzxv2pn8vujddnyh.jpg" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;li&gt;Done! Now you can put the key pairs in this folder&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Method 2: Using the WSL terminal
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# 1. Check if you have a .ssh folder. If you don't have an ssh folder it'll return "No such file or directory"

ls ~/.ssh
&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;# 2. Create a folder called .ssh 

mkdir ~/.ssh
&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;# 3. Copy any key pairs you need into this folder
# Note: You have to be in the same directory as the file you want to copy
# syntax: cp &amp;lt;FILENAME&amp;gt; ~/.ssh

cp my-aws-ec2-keypair.pem ~/.ssh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>linx</category>
      <category>windows</category>
      <category>wsl</category>
      <category>ssh</category>
    </item>
  </channel>
</rss>
