<?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: Rajesh Sharma</title>
    <description>The latest articles on DEV Community by Rajesh Sharma (@webdevraj).</description>
    <link>https://dev.to/webdevraj</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%2F58571%2F91b7cca4-84c8-4d1f-8944-47828005c134.jpg</url>
      <title>DEV Community: Rajesh Sharma</title>
      <link>https://dev.to/webdevraj</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/webdevraj"/>
    <language>en</language>
    <item>
      <title>How to create a choropleth Map or Geographic HeatMap in React</title>
      <dc:creator>Rajesh Sharma</dc:creator>
      <pubDate>Sat, 15 Dec 2018 17:54:55 +0000</pubDate>
      <link>https://dev.to/webdevraj/how-to-create-a-choropleth-map-or-geographic-heatmap-in-react-23bm</link>
      <guid>https://dev.to/webdevraj/how-to-create-a-choropleth-map-or-geographic-heatmap-in-react-23bm</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HUgzGuN1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/mpqts5lv196bfx8zj08a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HUgzGuN1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/mpqts5lv196bfx8zj08a.png" width="427" height="454"&gt;&lt;/a&gt;A Choropleth Map is a thematic map in which areas are shaded or patterned in proportion to the measurement of the statistical variable being displayed on the map, such as population density or per-capita income.In this guide we’ll be creating a Choropleth map of Canada, But it can be used as a guide to create a similar map of any country. We’ll be using Datamap for this purpose. I am assuming that you are familiar with React.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;h4&gt;Create a new project using create-react-app&lt;/h4&gt; &lt;code&gt;$ create-react-app map-example&lt;/code&gt;&lt;p&gt;Go inside the project folder and start the development server -&lt;/p&gt;
&lt;code&gt;$ cd map-example&lt;br&gt; $ yarn start &lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h4&gt;Install datamaps using yarn or npm&lt;/h4&gt;
&lt;p&gt;Datamaps is intended to provide some data visualizations based on geographical data. It’s SVG-based, can scale to any screen size, and includes everything inside of 1 script file. It heavily relies on the amazing D3.js library.&lt;/p&gt;
&lt;code&gt;$ yarn add datamaps&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h4&gt;Get the topoJson file of the country for which the map has to be created&lt;/h4&gt;
&lt;p&gt;The topoJson file contains the geometric data to plot the map of the country. To get the TopoJson file of a specific country, follow these steps:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt; Go to &lt;a href="https://github.com/markmarkoh/datamaps/tree/master/dist" rel="noopener noreferrer"&gt;https://github.com/markmarkoh/datamaps/tree/master/dist&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Find the datamaps.{xyz}.js file for the country xyz. xyz is the 3 character code for any country. Since we are creating a map for Canada, we’ll find the file named datamaps.can.js in the above repository (“can” is the 3 character code for Canada).&lt;/li&gt;
&lt;li&gt; Copy the contents of the file and paste it in the browser console (You can open the console by pressing F12 in the browser).&lt;/li&gt;
&lt;li&gt;
&lt;p&gt; Execute the following code after running the above code in the browser.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt; &lt;code&gt;copy(Datamap.prototype.canTopo);&lt;/code&gt; &lt;/p&gt;

&lt;p&gt; It will copy the data returned by Datamap.prototype.canTopo function to the clipboard. (You can replace “can” with any other country code if you are creating the map for another country).&lt;/p&gt;


&lt;/li&gt;

&lt;li&gt; Create a new file named Canada.topo.json inside the src/components directory in the project folder.&lt;/li&gt;

&lt;li&gt; Paste the contents copied from the browser console. If the state codes contains dot(.) in the topo json, then you need to remove the dot from the code e.g, if your state code is CA.AL, remove CA. part to get 2-digit ISO code AL. If the states code are already in 2-digit ISO or do’t have dot(.) then don’t do any modification follow next steps. Objects country name in {xyz}.topo.json should be same as we have declared in the Datamap scope. e.g, for Canada, in canada.topo.json we have &lt;code&gt;{“type”:”Topology”, &lt;br&gt; “objects”:{“can”:{“type”:”GeometryCollection”}}}&lt;/code&gt;&lt;p&gt; and we have provided scope as ‘canada’ in the map component in next step. So this case ‘can’ in canada.topo.json must be as ‘canada’ i.e.&lt;/p&gt; &lt;code&gt; {“type”:”Topology”,&lt;br&gt; “objects”:{“canada”:{“type”:”GeometryCollection”}}} &lt;/code&gt;
&lt;/li&gt;

&lt;/ul&gt;

&lt;/li&gt;

&lt;li&gt;

&lt;h4&gt; Create the ChoroplethMap component&lt;/h4&gt;

&lt;p&gt; This will be the component which will render the choropleth map (or geographic heatmap) in the DOM. &lt;br&gt; Create a new file named ChoroplethMap.js inside src/components directory in the project folder. &lt;br&gt; The contents of the file should be as below -&lt;/p&gt; 
    &lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt; Now, we’ll walk through the code above - Starting with the usual react stuff, we have imported all the required packages as well as the topo json fiile.&lt;/p&gt;

&lt;p&gt; Inside the componentDidMount lifecycle method, we have configured and rendered the choropleth Choropleth map using datemaps and d3.&lt;/p&gt;

&lt;p&gt; We have transformed the data coming as the props to the format that Datamaps expects it to be in by finding the minimum and the maximum value from the data and then generating the colour palette using d3 scale. After that, we have created the map using new Datamap() and passing all the configurations and the data to plot the map.&lt;/p&gt;

&lt;p&gt; Note that we have overridden the setProjection method to define the properties of the map like the center and the scale.The center of the map varies according to the country.&lt;/p&gt;

&lt;p&gt; We have set [-106.3468, 68.1304] to locate center point for Canada in the world map. That means Latitude = -106.3468 E and Longitude = 68.1304 N. Remember Latitude and Longitude are always East and North. For western countries, Latitude are in West so make it convert as Negative of East. e.g 102.3421 W ==&amp;gt; -102.3421 E.&lt;/p&gt;

&lt;p&gt; After that, we have rendered a div with the id=”choropleth_map”, which is used by Datamap to render the map.&lt;/p&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;h4&gt; Import and render the ChoroplethMap component in App.js&lt;/h4&gt;

&lt;p&gt;Now inside App.js component, we have to import the ChoroplethMap component that we created in the above steps and render it inside a div so that the App component looks like below -&lt;/p&gt; &lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
 &lt;p&gt; We have defined some sample data in the state and passed it to the map component as props. Also, we have set the height and width of the container div through inline styles. This is important as the map component has the height and width set to 100% of the parent element.&lt;/p&gt;

&lt;p&gt;Now run &lt;code&gt;$ react start&lt;/code&gt; in the terminal and test the app.&lt;/p&gt;

&lt;p&gt;You can clone and test the project from the following repository on github -&lt;/p&gt; &lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--A9-wwsHG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/WebDevRaj" rel="noopener noreferrer"&gt;
        WebDevRaj
      &lt;/a&gt; / &lt;a href="https://github.com/WebDevRaj/choropleth-map" rel="noopener noreferrer"&gt;
        choropleth-map
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      A chloropleth map or Geographic heatmap created in react using datamaps.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;p&gt;This project was bootstrapped with &lt;a href="https://github.com/facebook/create-react-app" rel="noopener noreferrer"&gt;Create React App&lt;/a&gt;.&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Available Scripts&lt;/h2&gt;
&lt;/div&gt;

&lt;p&gt;In the project directory, you can run:&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;&lt;code&gt;npm start&lt;/code&gt;&lt;/h3&gt;
&lt;/div&gt;

&lt;p&gt;Runs the app in the development mode.&lt;br&gt;
Open &lt;a href="http://localhost:3000" rel="nofollow noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt; to view it in the browser.&lt;/p&gt;

&lt;p&gt;The page will reload if you make edits.&lt;br&gt;
You will also see any lint errors in the console.&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;&lt;code&gt;npm test&lt;/code&gt;&lt;/h3&gt;
&lt;/div&gt;

&lt;p&gt;Launches the test runner in the interactive watch mode.&lt;br&gt;
See the section about &lt;a href="https://facebook.github.io/create-react-app/docs/running-tests" rel="nofollow noopener noreferrer"&gt;running tests&lt;/a&gt; for more information.&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;&lt;code&gt;npm run build&lt;/code&gt;&lt;/h3&gt;

&lt;/div&gt;

&lt;p&gt;Builds the app for production to the &lt;code&gt;build&lt;/code&gt; folder.&lt;br&gt;
It correctly bundles React in production mode and optimizes the build for the best performance.&lt;/p&gt;

&lt;p&gt;The build is minified and the filenames include the hashes.&lt;br&gt;
Your app is ready to be deployed!&lt;/p&gt;

&lt;p&gt;See the section about &lt;a href="https://facebook.github.io/create-react-app/docs/deployment" rel="nofollow noopener noreferrer"&gt;deployment&lt;/a&gt; for more information.&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;&lt;code&gt;npm run eject&lt;/code&gt;&lt;/h3&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Note: this is a one-way operation. Once you &lt;code&gt;eject&lt;/code&gt;, you can’t go back!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you aren’t satisfied with the build tool…&lt;/p&gt;
&lt;/div&gt;


&lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/WebDevRaj/choropleth-map" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;

&lt;/li&gt;

&lt;/ol&gt;References : 

&lt;ul&gt;
    &lt;li&gt; &lt;a href="https://www.npmjs.com/package/datamaps" rel="noopener noreferrer"&gt;npm/datamaps&lt;/a&gt;
&lt;/li&gt;
 &lt;li&gt;&lt;a href="https://www.wikipedia.org/" rel="noopener noreferrer"&gt;Wikipedia&lt;/a&gt;&lt;/li&gt; &lt;p&gt;Originally published on medium - &lt;a href="https://medium.com/@WebDevRaj/how-to-create-a-choropleth-map-or-a-geographic-heatmap-in-react-9965ddf7a87f" rel="noopener noreferrer"&gt; How to create a choropleth Map or a Geographic HeatMap in React &lt;/a&gt;&lt;/p&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>heatmap</category>
      <category>choropleth</category>
    </item>
    <item>
      <title>Deploy a React app on heroku the right way</title>
      <dc:creator>Rajesh Sharma</dc:creator>
      <pubDate>Wed, 17 Oct 2018 17:30:14 +0000</pubDate>
      <link>https://dev.to/webdevraj/deploy-a-react-app-on-heroku-the-right-way-5efo</link>
      <guid>https://dev.to/webdevraj/deploy-a-react-app-on-heroku-the-right-way-5efo</guid>
      <description>

&lt;p&gt;Deploying a react app on heroku is the easiest task when we talk about deployment. However, if you miss some important steps, you might break the react-router’s functionality or deploy a development build to production.&lt;/p&gt;

&lt;p&gt;So let’s look into the process of deploying a react app on heroku the right way, so that we get a production optimised build and react-router’s functionality intact.&lt;/p&gt;

&lt;p&gt;I use create-react-app for generating the boilerplate code for a react app and assume that you’re using the same.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The very first step is to create a project using create-react-app and update                 the code as required.
&lt;code&gt;&lt;br&gt;
$ create-react-app MyAwesomeApp&lt;br&gt;
$ cd MyAwesomeApp
&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Next, we have to initialise a git repository inside the project folder.
&lt;code&gt;&lt;br&gt;
$ git init
&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Sign up on heroku if you haven’t already.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Install heroku CLI&lt;/p&gt;

&lt;p&gt;&lt;a href="https://devcenter.heroku.com/articles/heroku-cli"&gt;https://devcenter.heroku.com/articles/heroku-cli&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Login in heroku CLI using your email and password.&lt;br&gt;
&lt;code&gt;&lt;br&gt;&lt;br&gt;
$ heroku login&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a new heroku app while using the create-react-app buildpack. This     buildpack deploys a React UI as a static web site. It also uses the production     build of React app for deployment.&lt;br&gt;
&lt;code&gt;&lt;br&gt;&lt;br&gt;
$ heroku create MY-AWESOME-APP --buildpack &lt;a href="https://github.com/mars/create-react-app-buildpack.git"&gt;https://github.com/mars/create-react-app-buildpack.git&lt;/a&gt;&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add a new file in the root of your project directory and name it static.json.     Put the following code into it.&lt;br&gt;
&lt;code&gt;&lt;br&gt;&lt;br&gt;
{&lt;br&gt;
  "root": "build/",&lt;br&gt;
  "clean_urls": false,&lt;br&gt;
  "routes": {&lt;br&gt;
    "/**": "index.html"&lt;br&gt;
  }&lt;br&gt;
}&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now commit all the changes and push the code to heroku master.&lt;br&gt;
&lt;code&gt;&lt;br&gt;&lt;br&gt;
$ git add .&lt;br&gt;&lt;br&gt;
$ git commit -m "initial commit"&lt;br&gt;&lt;br&gt;
$ git push heroku master&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can check the deployment using &lt;code&gt;$ heroku open&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Checkout &lt;a href="https://github.com/mars/create-react-app-buildpack"&gt;create-react-app-buildpack&lt;/a&gt; and &lt;a href="https://devcenter.heroku.com/articles/git"&gt;Heroku&lt;/a&gt; for more details.&lt;/p&gt;

&lt;p&gt;Original Post : &lt;a href="https://medium.com/@WebDevRaj/deploy-a-react-app-on-heroku-the-right-way-e17333d29169"&gt;https://medium.com/@WebDevRaj/deploy-a-react-app-on-heroku-the-right-way-e17333d29169&lt;/a&gt;&lt;/p&gt;


</description>
      <category>heroku</category>
      <category>react</category>
      <category>deployment</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How I landed my first developer Job</title>
      <dc:creator>Rajesh Sharma</dc:creator>
      <pubDate>Tue, 26 Jun 2018 09:09:40 +0000</pubDate>
      <link>https://dev.to/webdevraj/how-i-landed-my-first-developer-job-3imf</link>
      <guid>https://dev.to/webdevraj/how-i-landed-my-first-developer-job-3imf</guid>
      <description>&lt;p&gt;I would like to share my short story on how I landed my first Job as a Front-End Developer. &lt;/p&gt;

&lt;p&gt;A little background about my education: I was always interested in the tech since I was in school and learned C++ during last years of school. I finished my schooling in 2014 and got admission in an average Private engineering college. During first 2 years of my college, I didn't focus on learning much except a 2 months training in Java. However, I had a good understanding of core concepts of programming.&lt;/p&gt;

&lt;p&gt;In the third year, I decided to learn web development. After taking few short courses on HTML and CSS I started "The web Developer Bootcamp" by Colt Steele. It was such a nice course that made my interest in Web development. I learned about HTML, CSS, JavaScript, jQuery, Bootstrap, NodeJS, ExpressJS etc. After that, I took few more courses on Angular and Java.&lt;/p&gt;

&lt;p&gt;At the end of my third year, I applied for a number of Internships but didn't get selected for any. But I still kept applying.&lt;/p&gt;

&lt;p&gt;During the final year of my college, I appeared for a few interviews for internship, I got rejected in most of them initially, but after a few months, I started getting positive feedback and finally cleared 3 interviews for unpaid internships. But I needed some monetary rewards as well to keep myself motivated and during one of the interviews, after I cleared all the rounds, the HR told me that I won't get any stipend as I was from a tier 3 college. That hit me very hard so I decided to move to NCR, a place with better opportunities. I appeared for 4 interviews on a single day, failed in 3 but cleared the last one. It was in a small startup for a profile of Web Developer Intern with a some stipend as well. &lt;/p&gt;

&lt;p&gt;The internship started in February. In the initial 2 weeks, I learned about some Java frameworks like Struts, Spring &amp;amp; Hibernate and then Angular. I worked on a few bug fixes and enhancements in a Big Enterprise Java Application. Most of the work was repetitive and kind of boring, so I kept looking for better opportunities.&lt;/p&gt;

&lt;p&gt;After a few more failed interviews, I cleared an interview for a front-end developer intern profile at another startup with almost double stipend and ReactJs as the main technology. I left the previous company and joined the new one.&lt;/p&gt;

&lt;p&gt;In the new company, I learned ReactJs and started working on a project. Finally, after 2 months, I got a PPO and got a full-time Front-End Developer role with a good enough salary package according to my skills and experience. I am happy with my current Job and a lot more is left to achieve.&lt;/p&gt;

</description>
      <category>developer</category>
      <category>react</category>
      <category>frontend</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
