<?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: Krishankant Ray</title>
    <description>The latest articles on DEV Community by Krishankant Ray (@krishankantray).</description>
    <link>https://dev.to/krishankantray</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%2F276615%2Ff093d33c-93f2-4679-b0ce-478f4edfd272.jpeg</url>
      <title>DEV Community: Krishankant Ray</title>
      <link>https://dev.to/krishankantray</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/krishankantray"/>
    <language>en</language>
    <item>
      <title>CSV to SQL import using Node, Express and React</title>
      <dc:creator>Krishankant Ray</dc:creator>
      <pubDate>Sun, 19 Apr 2020 13:44:14 +0000</pubDate>
      <link>https://dev.to/krishankantray/csv-to-sql-import-using-node-express-and-react-3g6f</link>
      <guid>https://dev.to/krishankantray/csv-to-sql-import-using-node-express-and-react-3g6f</guid>
      <description>&lt;h1&gt;
  
  
  CSV to SQL import
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://suspicious-carson-2627ba.netlify.app/"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3o6BYkX---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/krishankantray/temp/master/visit_button.JPG" alt="N|Solid"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Github : &lt;a href="https://github.com/krishankantray/csv-to-sql-import-client"&gt;Front-End Part&lt;/a&gt;&lt;br&gt;
              &lt;a href="https://github.com/krishankantray/csv-to-sql-import-server"&gt;Back-End Part&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  &lt;strong&gt;What is this app all about ?&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;This app allows users to import a .csv file and save it in MySQL. The .csv file needs to be in a specified format, something like  this .&lt;br&gt;
Once the data is saved we can see and delete the table data on the front-end.&lt;/p&gt;
&lt;h4&gt;
  
  
  &lt;strong&gt;Whats there on back-end and front-end ?&lt;/strong&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Back-End :&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;NodeJS&lt;/li&gt;
&lt;li&gt;ExpressJS&lt;/li&gt;
&lt;li&gt;MySQL&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Front-End :&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;ReactJS&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is the SQL table structure :&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Field&lt;/th&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;id&lt;/td&gt;
&lt;td&gt;int(11)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;level_col&lt;/td&gt;
&lt;td&gt;varchar(255)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;cvss&lt;/td&gt;
&lt;td&gt;varchar(255)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;title&lt;/td&gt;
&lt;td&gt;varchar(255)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;vulnerability&lt;/td&gt;
&lt;td&gt;varchar(255)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;solution&lt;/td&gt;
&lt;td&gt;varchar(255)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;reference_col&lt;/td&gt;
&lt;td&gt;varchar(255)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;h4&gt;
  
  
  &lt;strong&gt;Where is it deployed ?&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Client side app ( React app ) is deployed on &lt;a href="https://www.netlify.com/"&gt;Netlify&lt;/a&gt;&lt;br&gt;
Server side app ( Node app ) is deployed on &lt;a href="https://www.heroku.com/"&gt;Heroku&lt;/a&gt;&lt;br&gt;
MySQL database is deployed on Remote &lt;a href="https://remotemysql.com/"&gt;Mysql&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  How to run it locally ?
&lt;/h4&gt;

&lt;p&gt;To run it locally we need to clone two git repositories, one for the server and other for the client ( front-end).&lt;/p&gt;
&lt;h5&gt;
  
  
  To clone the client repo :
&lt;/h5&gt;



&lt;p&gt;&lt;code&gt;git clone https://github.com/krishankantray/csv-to-sql-import-client.git&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;h5&gt;
  
  
  To clone the server repo :
&lt;/h5&gt;



&lt;p&gt;&lt;code&gt;git clone https://github.com/krishankantray/csv-to-sql-import-server.git&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;The above git setup is for online server auto deployment on &lt;strong&gt;Heroku&lt;/strong&gt; and &lt;strong&gt;Netlify&lt;/strong&gt; .&lt;br&gt;
We need to make some changes in it to run it locally.&lt;/p&gt;
&lt;h5&gt;
  
  
  First we setup the server locally  :
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;Open the directory :

&lt;code&gt;csv-to-sql-import-server&lt;/code&gt;

,  in any vscode or any other editor.
- If you have a local MySql db then do replace the details in the

&lt;code&gt;app&amp;gt;&amp;gt;config&amp;gt;&amp;gt;db.config.js&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you don't have a local MySql db then leave it as it is.&lt;/p&gt;

&lt;p&gt;Now, open terminal ( &lt;em&gt;in the directory&lt;/em&gt; : csv-to-sql-import-server ):&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm install&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;p&gt;&lt;code&gt;npm start&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;It should print in terminal :&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;Server is running on port 9000.&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;( Make sure there is nothing previously running on port 9000, if there is then change the &amp;gt;port from line 25 of server.js )&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;To test if all APIs are working, open postman and use following APIs&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GET call for obtaining all the records, url should be :

&lt;code&gt;http://localhost:9000/customers/&lt;/code&gt;

.&lt;/li&gt;
&lt;/ul&gt;

&lt;ul&gt;
&lt;li&gt;GET call for single records by id, for eg :

&lt;code&gt;http://localhost:9000/customers/963&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;ul&gt;
&lt;li&gt;POST call for bulk create records  :

&lt;code&gt;http://localhost:9000/bulkcreate&lt;/code&gt;

This call needs a body to be passed&lt;/li&gt;
&lt;/ul&gt;

&lt;ul&gt;
&lt;li&gt;POST call for single create records

&lt;code&gt;http://localhost:9000/customers&lt;/code&gt;

This call needs a body to be passed&lt;/li&gt;
&lt;/ul&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;DELETE call for all records deletion&lt;br&gt;
&lt;br&gt;
&lt;code&gt;http://localhost:9000/customers&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;DELETE call for records deletion&lt;br&gt;
&lt;br&gt;
&lt;code&gt;http://localhost:9000/customers/963&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;PUT call to update a single record&lt;br&gt;
&lt;br&gt;
&lt;code&gt;http://localhost:9000/customers/963&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  Now, we will configure the local front-end ( React app ) :
&lt;/h5&gt;

&lt;p&gt;We only need to make some changes in App.js within src directory. &lt;br&gt;
Just change the line 35 , 69 and 97, i.e we need to change the URL of all the fetch calls from Apps.js.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;For Example :&lt;/em&gt; &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;35 : Before  &lt;a href="https://csv-to-sql-import.herokuapp.com/bulkcreate"&gt;https://csv-to-sql-import.herokuapp.com/bulkcreate&lt;/a&gt;&lt;br&gt;
35 : After     http:localhost:9000/bulkcreate&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Similarly for line 69 and  97 , just replace this part of URL - &lt;br&gt;
&lt;a href="https://csv-to-sql-import.herokuapp.com"&gt;https://csv-to-sql-import.herokuapp.com&lt;/a&gt;&lt;br&gt;
with &lt;br&gt;
http:localhost:9000&lt;/p&gt;

&lt;p&gt;and rest of the part of url remains same. &lt;/p&gt;

</description>
      <category>react</category>
      <category>node</category>
      <category>express</category>
      <category>sql</category>
    </item>
    <item>
      <title>Keeping continuity in Competitve Programming</title>
      <dc:creator>Krishankant Ray</dc:creator>
      <pubDate>Sat, 21 Dec 2019 09:30:57 +0000</pubDate>
      <link>https://dev.to/krishankantray/keeping-continuity-in-competitve-programming-1oie</link>
      <guid>https://dev.to/krishankantray/keeping-continuity-in-competitve-programming-1oie</guid>
      <description>&lt;p&gt;Most of people start competitive programming in college mostly to end up landing into a good job. Probably because hiring process of almost all companies are mostly same i.e. they ask problems similar to the one in CP. &lt;/p&gt;

&lt;p&gt;Like everyone, I also started CP in college during end of my second year ( my graduation was of 4 years ). I got to know about codechef from my college notice board ( some of my seniors posted an article about CP on the notice board). &lt;br&gt;
I was a bit curious about codechef, so, in the evening when I came back to hostel room, I started searching about codechef and similar platforms. I ended up reading several articles on quora and eventually landed up on HackerRank.&lt;br&gt;
I was not a very hard core problem solver and I used to solve very fewer questions initially. But slowly as I kept on learning new algorithms and c++ in more depth. &lt;br&gt;
So, by the time placements season came andcompanies started visiting our colleges, I had solved around 200+ problems on HackerRank and 90+ problems on codechef. I was able to clear almost all the service based companies like Infosys, Wipro and Cognizant. But could not clear Directi exam ( Directi is the company behind codechef ). I ended up joining a job as an Application Support Engineer( I don't know why they named it engineer, although there is nothing to engineer in a support role ), in a US based comapany which makes event management softwares. &lt;br&gt;
Also, I was able to clear Amazon's coding round but didn't appear for the interview, probably because of lack of confidence and motivation. Once you start doing a job you won't be that much motivated to prepare for an interview. It might happen due to lack of time and hectic life. But still some people manage to overcome these things, but I am not one of them. &lt;br&gt;
And while doing a job its extremely difficult to maintain motivation to do CP even on weekends. It just doesn't feels like those college days when solving a problem used to give fun and happeness. &lt;/p&gt;

&lt;p&gt;I wrote this article because I thought there must many people like me, who would be thinking that only they are not able to do CP while in a job, then probably I should tell them that it's not true, there are many. &lt;/p&gt;

&lt;p&gt;Thanks for reading till end. &lt;/p&gt;

</description>
      <category>cpp</category>
      <category>computerscience</category>
    </item>
  </channel>
</rss>
