<?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: Narendra Kumar Vadapalli</title>
    <description>The latest articles on DEV Community by Narendra Kumar Vadapalli (@narenandu).</description>
    <link>https://dev.to/narenandu</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%2F248025%2F742eb6df-1e20-4473-82fc-2bab74c4b609.jpg</url>
      <title>DEV Community: Narendra Kumar Vadapalli</title>
      <link>https://dev.to/narenandu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/narenandu"/>
    <language>en</language>
    <item>
      <title>Productive Taskbar Settings missing in Windows 11</title>
      <dc:creator>Narendra Kumar Vadapalli</dc:creator>
      <pubDate>Tue, 06 Jul 2021 20:54:24 +0000</pubDate>
      <link>https://dev.to/narenandu/productive-taskbar-settings-missing-in-windows-11-25ab</link>
      <guid>https://dev.to/narenandu/productive-taskbar-settings-missing-in-windows-11-25ab</guid>
      <description>&lt;h2&gt;
  
  
  Ungroup the Icons in Taskbar
&lt;/h2&gt;

&lt;p&gt;If you are a person who likes to see all your open windows in the taskbar, with their titles for one click navigation, you would relate to my pain.&lt;/p&gt;

&lt;p&gt;There used to be the option called &lt;code&gt;Combine Taskbar Buttons&lt;/code&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yWXPkgs7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zm4vvoam5eohq2uelxe4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yWXPkgs7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zm4vvoam5eohq2uelxe4.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now in Windows 11, its gone !&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--b8QhOmyc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vgutboy53b2avrhw7g06.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--b8QhOmyc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vgutboy53b2avrhw7g06.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This makes it super hard to navigate directly to your inteded window with a glance and click :(&lt;/p&gt;

&lt;h2&gt;
  
  
  Position the Taskbar
&lt;/h2&gt;

&lt;p&gt;Also there used to be the option of &lt;code&gt;Taskbar Location on Screen&lt;/code&gt; which goes missing&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6H3PjGGv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fn9ps8er9yt4mbyx4npp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6H3PjGGv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fn9ps8er9yt4mbyx4npp.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--b8QhOmyc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vgutboy53b2avrhw7g06.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--b8QhOmyc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vgutboy53b2avrhw7g06.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is a real productivity tool for many developers who rely on the left/right positioning to get more real estate for individual window titles, again for quicker navigation.&lt;/p&gt;




&lt;p&gt;Not sure what the logic behind this is, but please bring these settings back Microsoft !&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>windows</category>
      <category>settings</category>
      <category>taskbar</category>
    </item>
    <item>
      <title>Adding Google Analytics to personal website</title>
      <dc:creator>Narendra Kumar Vadapalli</dc:creator>
      <pubDate>Thu, 18 Mar 2021 00:48:57 +0000</pubDate>
      <link>https://dev.to/narenandu/adding-google-analytics-to-personal-website-2np0</link>
      <guid>https://dev.to/narenandu/adding-google-analytics-to-personal-website-2np0</guid>
      <description>&lt;p&gt;&lt;a href="https://www.narenvadapalli.com/blog/google-analytics-to-personal-website/" rel="noopener noreferrer"&gt;Click here for Original Post&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Setting up Google Analytics Account
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Go to &lt;a href="https://www.google.com/analytics/" rel="noopener noreferrer"&gt;Google Analytics home page&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Sign in with your google account (otherwise &lt;code&gt;Sign Up&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click on the &lt;code&gt;Admin&lt;/code&gt; icon on the left pane&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%2Fid1tibzt9ps0mx01ajaw.png" 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%2Fid1tibzt9ps0mx01ajaw.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create an account for the website by providing the details for the property to measure, which in this case is my personal website&lt;/p&gt;
&lt;h4&gt;
  
  
  step 1
&lt;/h4&gt;

&lt;p&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%2F30x6tpv5m4ffb121v5ot.png" 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%2F30x6tpv5m4ffb121v5ot.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  step 2
&lt;/h4&gt;

&lt;p&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%2Fqcnfl0ic4dqt01wj3vbv.png" 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%2Fqcnfl0ic4dqt01wj3vbv.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  step 3
&lt;/h4&gt;

&lt;p&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%2Ffq7r3dottism4a7pie0p.png" 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%2Ffq7r3dottism4a7pie0p.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Getting the Tracking ID for the property to Measure
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Tracking ID&lt;/code&gt; is the identifier that will be given in the &lt;code&gt;gatsby&lt;/code&gt; config of my personal website under the gatsby google analytics plugin&lt;/li&gt;
&lt;li&gt;Following will help you find the same
&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%2Fwfe5ezylpuke2iuojjb3.png" alt="Alt Text"&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%2Fwqid6tptenq9y2p02hdw.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;li&gt;Take a note of the &lt;code&gt;Tracking ID&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Adding the gatsby plugin
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Need to install the plugin &lt;code&gt;gatsby-plugin-google-analytics&lt;/code&gt; (Ref: &lt;a href="https://www.gatsbyjs.com/plugins/gatsby-plugin-google-analytics/" rel="noopener noreferrer"&gt;https://www.gatsbyjs.com/plugins/gatsby-plugin-google-analytics/&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Run the command in your local dev environemtn &lt;code&gt;npm install gatsby-plugin-google-analytics&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Add the following block to &lt;code&gt;gatsby-config.js&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        {
            resolve: `gatsby-plugin-google-analytics`,
            options: {
                trackingId: process.env.GATSBY_GOOGLE_ANALYTICS_TRACKING_ID || "none"
            }
        }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;GATSBY_GOOGLE_ANALYTICS_TRACKING_ID&lt;/code&gt; is an enviornment variable that needs to be added to the deployment environment, to not expose the Tracking ID to public&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Setting Env Variable in AWS Amplify
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Deployment environment
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;My personal website has been setup to be hosted and deployed via A&lt;a href="https://aws.amazon.com/amplify/" rel="noopener noreferrer"&gt;AWS Amplify&lt;/a&gt;

&lt;ul&gt;
&lt;li&gt;Has the advantage of automatic provisioning of the AWS resources&lt;/li&gt;
&lt;li&gt;CI/CD built in&lt;/li&gt;
&lt;li&gt;Automatic Depoloyment when code is merged to &lt;code&gt;master&lt;/code&gt; branch on a connected github repository&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h4&gt;
  
  
  Amplify Console - Environment Variables
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Login in to Amplify Console: &lt;a href="https://console.aws.amazon.com/console/home" rel="noopener noreferrer"&gt;https://console.aws.amazon.com/console/home&lt;/a&gt; with AWS credentials&lt;/li&gt;
&lt;li&gt;Select the app (website deployment) and under &lt;code&gt;App Settings&lt;/code&gt; check for &lt;code&gt;Environment Variables&lt;/code&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%2F5jbpnva2z1qvvcdpm8tf.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;li&gt;Click on &lt;code&gt;Manage Variables&lt;/code&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%2Fb50yhi550nagoeq4nz39.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;li&gt;Click on &lt;code&gt;Add Variable&lt;/code&gt;. Add &lt;code&gt;GATSBY_GOOGLE_ANALYTICS_TRACKING_ID&lt;/code&gt; as the &lt;code&gt;Variable&lt;/code&gt; and under &lt;code&gt;Value&lt;/code&gt; paste the &lt;code&gt;Tracking ID&lt;/code&gt; copied from Google Analytics
&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%2F670stv3r1eayfvak2swa.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;li&gt;Once Saved, environment variables list should show the value
&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%2Fwb8b3atl7i5e6sj8asek.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;That's it !&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Once Setup, Google Analytics will now start tracking the metrics in Real Time (eg: Active Users). Analytics has a lot of potential in tailoring the content to the target audience&lt;/p&gt;

&lt;p&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%2F8whas8lcxs1jlovpwe3e.png" 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%2F8whas8lcxs1jlovpwe3e.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>google</category>
      <category>analytics</category>
      <category>data</category>
    </item>
    <item>
      <title>Running a react app on Local Kubernetes cluster on Windows 10</title>
      <dc:creator>Narendra Kumar Vadapalli</dc:creator>
      <pubDate>Thu, 18 Mar 2021 00:43:05 +0000</pubDate>
      <link>https://dev.to/narenandu/running-a-react-app-on-local-kubernetes-cluster-on-windows-10-3mi6</link>
      <guid>https://dev.to/narenandu/running-a-react-app-on-local-kubernetes-cluster-on-windows-10-3mi6</guid>
      <description>&lt;p&gt;&lt;a href="https://www.narenvadapalli.com/blog/running-react-app-on-local-k8s-on-windows/" rel="noopener noreferrer"&gt;Click here for Original Post&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Prerequisites
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;a href="https://desktop.docker.com/win/stable/Docker%20Desktop%20Installer.exe" rel="noopener noreferrer"&gt;Docker Desktop&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://docs.docker.com/docker-for-windows/wsl/#develop-with-docker-and-wsl-2" rel="noopener noreferrer"&gt;WSL2 backend&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Won't be covering the installation process of &lt;a href="https://desktop.docker.com/win/stable/Docker%20Desktop%20Installer.exe" rel="noopener noreferrer"&gt;Docker Desktop&lt;/a&gt; and enabling the &lt;a href="https://docs.docker.com/docker-for-windows/wsl/#develop-with-docker-and-wsl-2" rel="noopener noreferrer"&gt;WSL2 backend&lt;/a&gt; here in this blog. Assumption is that readers can figure out the process from the given resources on their own. I might cover those topics in detail if there is enough demand in future blogs.&lt;/p&gt;

&lt;p&gt;Make sure you are running &lt;code&gt;Linux Containers Backend&lt;/code&gt; in Docker Desktop after installing it.&lt;/p&gt;

&lt;h4&gt;
  
  
  minikube start
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://minikube.sigs.k8s.io/docs/" rel="noopener noreferrer"&gt;minikube&lt;/a&gt; setups up a local kubernetes cluster for development on local host (in this case windows).&lt;/p&gt;

&lt;p&gt;Since we will be using a local docker image and bypassing the need to push to a docker registry and then specifying the same during deployment on kubernetes, &lt;code&gt;--insecure-registry=10.0.0.0/24&lt;/code&gt; is used.&lt;/p&gt;

&lt;p&gt;Why &lt;code&gt;10.0.0.0/24&lt;/code&gt;? Checkout&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;a href="https://www.freecodecamp.org/news/production-fullstack-react-express/" rel="noopener noreferrer"&gt;CIDR notation and subnets&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://minikube.sigs.k8s.io/docs/handbook/registry/#enabling-insecure-registries" rel="noopener noreferrer"&gt;Minikube enabling insecure registries&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Run the following command to start the local kubernetes cluster in a powershell (preferably admin powershell)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;minikube start --insecure-registry="10.0.0.0/24"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sample Output&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;❯ minikube start --insecure-registry="10.0.0.0/24"

* minikube v1.18.1 on Microsoft Windows 10 Pro 10.0.21332 Build 21332
* Using the docker driver based on existing profile
* Starting control plane node minikube in cluster minikube
* Restarting existing docker container for "minikube" ...
* Preparing Kubernetes v1.20.2 on Docker 20.10.3 ...
* Verifying Kubernetes components...
  - Using image kubernetesui/dashboard:v2.1.0
  - Using image kubernetesui/metrics-scraper:v1.0.4
  - Using image gcr.io/k8s-minikube/storage-provisioner:v4
* Enabled addons: storage-provisioner, dashboard, default-storageclass
* Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Create React app
&lt;/h4&gt;

&lt;p&gt;Make sure that &lt;code&gt;node&lt;/code&gt; and &lt;code&gt;npm&lt;/code&gt; are installed in the windows environment&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;❯ node -v
v15.11.0

❯ npm -v
7.6.3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then use &lt;code&gt;npx create-react-app test-react-app&lt;/code&gt; to create a test react application&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;❯ npx create-react-app test-react-app
Need to install the following packages:
  create-react-app
Ok to proceed? (y) y

Creating a new React app in D:\work\test-react-app.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...

yarn add v1.22.4
[1/4] Resolving packages...
[2/4] Fetching packages...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Finally check to see that app is running as expected&lt;/strong&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%2Fqqoa3xowxkxd6xr7409x.png" 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%2Fqqoa3xowxkxd6xr7409x.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  Configure minikube docker local environment
&lt;/h4&gt;

&lt;p&gt;Run the following command to set the local configuration for making the development iteration easier by using the local docker images.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;&lt;br&gt;
This stays local to your powershell terminal in which we run the following command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;amp; minikube -p minikube docker-env | Invoke-Expression
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For anyone curious, Run &lt;code&gt;minikube docker-env&lt;/code&gt; to see the actual commands that are getting run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;❯ minikube docker-env
$Env:DOCKER_TLS_VERIFY = "1"
$Env:DOCKER_HOST = "tcp://127.0.0.1:52175"
$Env:DOCKER_CERT_PATH = "C:\Users\Naren\.minikube\certs"
$Env:MINIKUBE_ACTIVE_DOCKERD = "minikube"
# To point your shell to minikube's docker-daemon, run:
# &amp;amp; minikube -p minikube docker-env | Invoke-Expression
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Dockerize the react application
&lt;/h4&gt;

&lt;p&gt;Simplest way to create a docker image of a react app is to add the following files to the root of the application folder (repository in case of git)&lt;/p&gt;

&lt;p&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%2Fylxj0iuhwl059smtoqb5.png" 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%2Fylxj0iuhwl059smtoqb5.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Dockerfile&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM node:10-alpine as build-step

RUN mkdir /app
WORKDIR /app
COPY package.json /app
RUN npm install
COPY . /app
RUN npm run build

FROM nginx:1.17.1-alpine
COPY --from=build-step /app/build /usr/share/nginx/html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;.dockerignore&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/node_modules
/build
.git
*.md
.gitignore
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Docker Build the image
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker build -t test-react-app .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Check for the built image
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;❯ docker images test-react-app
REPOSITORY       TAG       IMAGE ID       CREATED              SIZE
test-react-app   latest    e81a494ead2b   About a minute ago   21.1MB
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Kubernetes deployment
&lt;/h4&gt;

&lt;p&gt;A &lt;code&gt;deployment&lt;/code&gt; and &lt;code&gt;service&lt;/code&gt; resources are required for deploying the react app on to the kubernetes cluster. We can combine both specifications in to single &lt;code&gt;yaml&lt;/code&gt; file by separating them with &lt;code&gt;---&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Observe the &lt;code&gt;imagePullPolicy&lt;/code&gt; attribute marked as Never indicating that don’t look at docker registry for pulling the &lt;code&gt;image&lt;/code&gt; called &lt;code&gt;test-react-app&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;  Also we will be using the simplest &lt;code&gt;service&lt;/code&gt; called &lt;code&gt;NodePort&lt;/code&gt; to map the node’s port in kubernetes cluster to applications port&lt;/li&gt;
&lt;/ul&gt;

&lt;p&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%2Fpa4mv6tm8hvhucpx00ob.png" 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%2Fpa4mv6tm8hvhucpx00ob.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;deployment.yaml&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kind: Deployment
apiVersion: apps/v1
metadata:
  name: test-react-app
spec:
  replicas: 1
  selector:
    matchLabels:
      app: test-react-app
  template:
    metadata:
      labels:
        app: test-react-app
    spec:
      containers:
        - name: test-react-app
          image: test-react-app
          imagePullPolicy: Never
          ports:
            - containerPort: 80
      restartPolicy: Always

---

kind: Service
apiVersion: v1
metadata:
  name: test-react-app
spec:
  type: NodePort
  ports:
    - port: 80
      targetPort: 80
      protocol: TCP
      nodePort: 32000
  selector:
    app: test-react-app

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Deploy
&lt;/h5&gt;

&lt;p&gt;We use &lt;code&gt;kubectl apply -f &amp;lt;yaml&amp;gt;&lt;/code&gt; to deploy both the &lt;em&gt;deployment&lt;/em&gt; and &lt;em&gt;service&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f .\deployment.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sample Output&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;❯ kubectl apply -f .\deployment.yaml
deployment.apps/test-react-app created
service/test-react-app created
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Check the pods running
&lt;/h5&gt;

&lt;p&gt;Verify that there are pods running using &lt;code&gt;kubectl get pods&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;❯ kubectl get pods
NAME                             READY   STATUS    RESTARTS   AGE
test-react-app-9bf9cbcdb-h9zvj   1/1     Running   0          12s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Access the react app
&lt;/h4&gt;

&lt;h5&gt;
  
  
  Finding the Service URL
&lt;/h5&gt;

&lt;p&gt;We use &lt;code&gt;minikube&lt;/code&gt; to find out the service URL for the deployed react application&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;minikube service test-react-app --url
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sample Output&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;❯ minikube service test-react-app --url
🏃  Starting tunnel for service test-react-app.
|-----------|----------------|-------------|------------------------|
| NAMESPACE |      NAME      | TARGET PORT |          URL           |
|-----------|----------------|-------------|------------------------|
| default   | test-react-app |             | http://127.0.0.1:62352 |
|-----------|----------------|-------------|------------------------|
http://127.0.0.1:62352
❗  Because you are using a Docker driver on windows, the terminal needs to be open to run it.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Open the app in Browser
&lt;/h5&gt;

&lt;p&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%2Fuufprcdamztsrngaltym.png" 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%2Fuufprcdamztsrngaltym.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  Local Kubernetes Dashboard
&lt;/h4&gt;

&lt;p&gt;All the while we can see the effects of running any &lt;code&gt;kubectl&lt;/code&gt; commands in the kubernetes local dashboard&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;minikube dashboard
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sample Output&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;❯ minikube dashboard
🔌  Enabling dashboard ...
    ▪ Using image kubernetesui/dashboard:v2.1.0
    ▪ Using image kubernetesui/metrics-scraper:v1.0.4
🤔  Verifying dashboard health ...
🚀  Launching proxy ...
🤔  Verifying proxy health ...
🎉  Opening http://127.0.0.1:56135/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/ in your default browser...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;will open the dashboard in a new tab&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%2Fcd1l0l9fe0qufegkf4ym.png" 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%2Fcd1l0l9fe0qufegkf4ym.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h4&gt;
  
  
  Cleanup
&lt;/h4&gt;

&lt;p&gt;Cleanup the &lt;code&gt;deployment&lt;/code&gt; and &lt;code&gt;service&lt;/code&gt; using the following command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl delete -f .\deployment.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Close down &lt;code&gt;minikube&lt;/code&gt; (local k8s cluster) and delete&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;minikube stop
minikube delete
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>kubernetes</category>
      <category>react</category>
      <category>windows</category>
      <category>devops</category>
    </item>
    <item>
      <title>Gatsby site hosted on AWS Amplify redirecting to homepage always</title>
      <dc:creator>Narendra Kumar Vadapalli</dc:creator>
      <pubDate>Fri, 06 Nov 2020 22:47:25 +0000</pubDate>
      <link>https://dev.to/narenandu/gatsby-site-hosted-on-aws-amplify-redirecting-to-homepage-always-foo</link>
      <guid>https://dev.to/narenandu/gatsby-site-hosted-on-aws-amplify-redirecting-to-homepage-always-foo</guid>
      <description>&lt;p&gt;&lt;a href="https://www.narenvadapalli.com/blog/gatsby-site-redirecting-to-homepage-aws-amplify/" rel="noopener noreferrer"&gt;Click here for Original Post&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Problem Statement
&lt;/h2&gt;

&lt;p&gt;After connecting the app for continuous deployment by attaching the branch on my github repository (For those interested, details here: &lt;a href="https://www.narenvadapalli.com/blog/connecting-aws-amplify-for-deployment/" rel="noopener noreferrer"&gt;Connecting to AWS Amplify for deployment&lt;/a&gt;), any specific url provided was always getting redirected to my home page (&lt;code&gt;./index.html&lt;/code&gt;)&lt;/p&gt;

&lt;h2&gt;
  
  
  Rewrites and Redirects
&lt;/h2&gt;

&lt;p&gt;You Need to sign in to AWS account by clicking on on &lt;a href="https://aws.amazon.com/amplify/" rel="noopener noreferrer"&gt;https://aws.amazon.com/amplify/&lt;/a&gt;. Once the credentials are provided. Click on &lt;code&gt;Rewrites and redirects&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Default entries
&lt;/h3&gt;

&lt;p&gt;There were 3 default entries and was suspecting one of them was causing this issue, but wasn't certain.&lt;/p&gt;

&lt;p&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%2Fi%2F73u8oxkodm3bjdoj14ih.png" 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%2Fi%2F73u8oxkodm3bjdoj14ih.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[
    {
        "source": "https://narenvadapalli.com",
        "target": "https://www.narenvadapalli.com",
        "status": "302",
        "condition": null
    },
    {
        "source": "/&amp;lt;*&amp;gt;",
        "target": "/index.html",
        "status": "404-200",
        "condition": null
    },
    {
        "source": "&amp;lt;/^[^.]+$|\\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|ttf|map|json)$)([^.]+$)/&amp;gt;",
        "target": "/index.html",
        "status": "200",
        "condition": null
    }
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Approach
&lt;/h3&gt;

&lt;p&gt;I could have spent time and understood the redirects by studying the regex closely, but even simpler was to remove one by one (starting with the most suspected) and trying.&lt;/p&gt;

&lt;h4&gt;
  
  
  Attempt 1
&lt;/h4&gt;

&lt;p&gt;First removed the second entry which felt like it was grabbing all the entries after my website's url.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    {
        "source": "/&amp;lt;*&amp;gt;",
        "target": "/index.html",
        "status": "404-200",
        "condition": null
    },
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;which didn't help and pages were still getting redirected&lt;/p&gt;

&lt;h4&gt;
  
  
  Attempt 2
&lt;/h4&gt;

&lt;p&gt;Removed the last entry&lt;/p&gt;

&lt;p&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%2Fi%2Ftrux4panzeyp5uzhh9lu.png" 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%2Fi%2Ftrux4panzeyp5uzhh9lu.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    {
        "source": "&amp;lt;/^[^.]+$|\\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|ttf|map|json)$)([^.]+$)/&amp;gt;",
        "target": "/index.html",
        "status": "200",
        "condition": null
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and saved the updated entries&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%2Fi%2F7ptuc8zjgqzbqbk1n8hy.png" 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%2Fi%2F7ptuc8zjgqzbqbk1n8hy.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and suddenly the specific urls were sticking without redirection to my homepage ( &lt;code&gt;./index.html&lt;/code&gt;)&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;So found the culprit&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Bonus research
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  As per &lt;a href="https://moz.com/learn/seo/redirection" rel="noopener noreferrer"&gt;https://moz.com/learn/seo/redirection&lt;/a&gt;, seems like &lt;code&gt;301&lt;/code&gt; redirection is preferred in terms for Search Engine Optimization (&lt;code&gt;SEO&lt;/code&gt;) rather than &lt;code&gt;302&lt;/code&gt; for the redirection of URL with and without &lt;code&gt;www&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;  The second rule there was to catch any urls that point to an invalid/non-existing page. So I had a &lt;code&gt;404.html&lt;/code&gt; in my static website and was to redirect to that page, rather than my homepage ( ./index.html`)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&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%2Fi%2Ffy1if3munnqprehflkcv.png" 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%2Fi%2Ffy1if3munnqprehflkcv.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So finally the working combination of &lt;code&gt;Rewrites and Redirects&lt;/code&gt; is&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
[&lt;br&gt;
    {&lt;br&gt;
        "source": "https://narenvadapalli.com",&lt;br&gt;
        "target": "https://www.narenvadapalli.com",&lt;br&gt;
        "status": "301",&lt;br&gt;
        "condition": null&lt;br&gt;
    },&lt;br&gt;
    {&lt;br&gt;
        "source": "/&amp;lt;*&amp;gt;",&lt;br&gt;
        "target": "/index.html",&lt;br&gt;
        "status": "404-200",&lt;br&gt;
        "condition": null&lt;br&gt;
    }&lt;br&gt;
]&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Steps to open the bulk edit text editor
&lt;/h2&gt;

&lt;p&gt;Follow the steps to get to the bulk edits text editor&lt;/p&gt;

&lt;h4&gt;
  
  
  Edit button
&lt;/h4&gt;

&lt;p&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%2Fi%2F73u8oxkodm3bjdoj14ih.png" 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%2Fi%2F73u8oxkodm3bjdoj14ih.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Open Text Editor button
&lt;/h4&gt;

&lt;p&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%2Fi%2Fq6l1h7ave80qm0qb0w15.png" 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%2Fi%2Fq6l1h7ave80qm0qb0w15.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Text editor
&lt;/h4&gt;

&lt;p&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%2Fi%2Fzfsycialqdiifx8acabx.png" 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%2Fi%2Fzfsycialqdiifx8acabx.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>gatsby</category>
      <category>javascript</category>
      <category>aws</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Provision and Deploy webapp using AWS Amplify</title>
      <dc:creator>Narendra Kumar Vadapalli</dc:creator>
      <pubDate>Fri, 06 Nov 2020 22:44:42 +0000</pubDate>
      <link>https://dev.to/narenandu/provision-and-deploy-webapp-using-aws-amplify-2a9h</link>
      <guid>https://dev.to/narenandu/provision-and-deploy-webapp-using-aws-amplify-2a9h</guid>
      <description>&lt;p&gt;&lt;a href="https://www.narenvadapalli.com/blog/connecting-aws-amplify-for-deployment/" rel="noopener noreferrer"&gt;Click here for Original Post&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  AWS Amplify Console
&lt;/h2&gt;

&lt;p&gt;You Need to sign in to AWS account by clicking on on &lt;a href="https://aws.amazon.com/amplify/" rel="noopener noreferrer"&gt;https://aws.amazon.com/amplify/&lt;/a&gt;. Once the credentials are provided, should see welcome screen like the following&lt;/p&gt;

&lt;p&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%2Fi%2Fdmnumw3q5bsr3baufn8x.png" 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%2Fi%2Fdmnumw3q5bsr3baufn8x.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Connecting Github (source code)
&lt;/h2&gt;

&lt;p&gt;Since the code for my website is already hosted on &lt;a href="https://github.com/narenandu/narenvadapalli_dot_com" rel="noopener noreferrer"&gt;github&lt;/a&gt;, we choose &lt;code&gt;From your existing code&lt;/code&gt; option as shown and &lt;code&gt;Github&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%2Fi%2F5w0dmlj1ylassnlspp0c.png" 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%2Fi%2F5w0dmlj1ylassnlspp0c.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Choose the repo
&lt;/h3&gt;

&lt;p&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%2Fi%2F0eb6tmpfe1um91kj39mp.png" 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%2Fi%2F0eb6tmpfe1um91kj39mp.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Choose the branch
&lt;/h3&gt;

&lt;p&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%2Fi%2Fl0a2odjc2hy9tv9megua.png" 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%2Fi%2Fl0a2odjc2hy9tv9megua.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Adding in the custom environment variables
&lt;/h2&gt;

&lt;p&gt;Once we hit the &lt;code&gt;Next&lt;/code&gt; button, there will be App Settings and under &lt;code&gt;Advanced Settings&lt;/code&gt;, there is a provision to add the custom env vars that we want to secure from exposing them in source code. I have &lt;code&gt;Google Analytics&lt;/code&gt; connected to my website to track the insights in to the audience. More details here: &lt;a href="https://www.narenvadapalli.com/blog/google-analytics-to-personal-website/" rel="noopener noreferrer"&gt;Adding Google Analytics to personal website&lt;/a&gt;&lt;/p&gt;

&lt;p&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%2Fi%2Fwcny5s99gi33l1bfiiw1.png" 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%2Fi%2Fwcny5s99gi33l1bfiiw1.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Connecting the deployment to custom domain
&lt;/h2&gt;

&lt;p&gt;As per &lt;a href="https://docs.aws.amazon.com/amplify/latest/userguide/custom-domains.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/amplify/latest/userguide/custom-domains.html&lt;/a&gt;, by default the deployment happens at the custom url in the following format&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://branch-name.d1m7bkiki6tdw1.amplifyapp.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This step enables us to connect any custom domain to the deployment process. This step will take time as it has to issue SSL certificates and then verify the ownership, finally propagates the DNS records&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%2Fi%2Fkjbh4i7luxg8kvx38wzh.png" 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%2Fi%2Fkjbh4i7luxg8kvx38wzh.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Domain Activation
&lt;/h2&gt;

&lt;p&gt;If the SSL certificate issued successfully and the ownership is verified, Domain will be activated&lt;/p&gt;

&lt;p&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%2Fi%2F8luc09kbqiazdgeqdlyn.png" 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%2Fi%2F8luc09kbqiazdgeqdlyn.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Potential Issue
&lt;/h2&gt;

&lt;p&gt;SSL Configuration step could just be not moving forward and stuck for more than 1 hour&lt;/p&gt;

&lt;p&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%2Fi%2F1ka0l9rn3i8wcw3c967k.png" 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%2Fi%2F1ka0l9rn3i8wcw3c967k.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Fix
&lt;/h3&gt;

&lt;p&gt;Just delete the custom domain and restart the process&lt;/p&gt;

&lt;p&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%2Fi%2Fpqknmciuygan8g1p9o19.png" 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%2Fi%2Fpqknmciuygan8g1p9o19.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>amplify</category>
      <category>cloud</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Commute Times to Work -&gt; Killer</title>
      <dc:creator>Narendra Kumar Vadapalli</dc:creator>
      <pubDate>Thu, 09 Jan 2020 17:44:29 +0000</pubDate>
      <link>https://dev.to/narenandu/commute-times-to-work-killer-1efg</link>
      <guid>https://dev.to/narenandu/commute-times-to-work-killer-1efg</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fxg9NQ9T--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/dska25p9iyg27tzf13ff.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fxg9NQ9T--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/dska25p9iyg27tzf13ff.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Received an email from Google and it was slightly depressing to see how much time we spend just traveling to work in an year. &lt;/p&gt;

&lt;p&gt;Close to 23 days in an year ! That's incredibly wasted amount of time which could have been well spent even on a vacation to refresh/replenish your energy.&lt;/p&gt;

&lt;p&gt;Imagine how many software skills, you could achieve in 3 weeks of time  !?&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>commutetime</category>
      <category>travel</category>
      <category>work</category>
    </item>
    <item>
      <title>Profiling and visualization tools in Python</title>
      <dc:creator>Narendra Kumar Vadapalli</dc:creator>
      <pubDate>Thu, 17 Oct 2019 03:42:45 +0000</pubDate>
      <link>https://dev.to/narenandu/profiling-and-visualization-tools-in-python-376h</link>
      <guid>https://dev.to/narenandu/profiling-and-visualization-tools-in-python-376h</guid>
      <description>&lt;p&gt;&lt;a href="https://www.narenvadapalli.com/blog/profiling-visualization-tools-in-python-part-1/"&gt;Click here for Original Post&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Which part of the my python code is taking time ?
&lt;/h2&gt;

&lt;p&gt;Sounds like a familiar question asked!&lt;/p&gt;

&lt;p&gt;Well, I have that question pop up quite often, especially when dealing with legacy code bases and unfamiliar code. This is my effort in helping shed light on exploring an answer to the question&lt;/p&gt;




&lt;h3&gt;
  
  
  Setup
&lt;/h3&gt;

&lt;p&gt;Consider the following simple piece of code in a file called &lt;code&gt;test.py&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;print_method&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"hello world"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;test_print_method&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;xrange&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;print_method&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;test_print_method&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you execute the code using &lt;code&gt;python&lt;/code&gt; executable, following output of &lt;code&gt;hello world&lt;/code&gt; is printed 6 times&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;python test.py
hello world
hello world
hello world
hello world
hello world
hello world
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Probing Parameters
&lt;/h3&gt;

&lt;p&gt;Let’s look in to different tools which we could use to determine&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Code path&lt;/li&gt;
&lt;li&gt;Number of calls and&lt;/li&gt;
&lt;li&gt;Which method took the most time !&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Disclaimer&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This blog has been created after executing the commands on a Linux distro. If on a different platform, I assume one knows how to get to the required (or similar) software packages&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  Basis for profiling
&lt;/h3&gt;

&lt;p&gt;We basically rely on &lt;code&gt;profile&lt;/code&gt; module, more specifically &lt;code&gt;cProfile&lt;/code&gt; module to generate the data needed for different visualization tools. (&lt;a href="https://docs.python.org/2/library/profile.html#module-profile"&gt;https://docs.python.org/2/library/profile.html#module-profile&lt;/a&gt;)&lt;br&gt;
Easiest way to run &lt;code&gt;cProfile&lt;/code&gt; on a python code is to run it as a module with &lt;code&gt;python&lt;/code&gt; executable by passing the actual script as an argument to &lt;code&gt;cProfile&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Example&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python &lt;span class="nt"&gt;-m&lt;/span&gt; cProfile test.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Along with the expected output of &lt;code&gt;hello world&lt;/code&gt; lines ,we see additional information about the time it took to execute each method.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;python &lt;span class="nt"&gt;-m&lt;/span&gt; cProfile test.py
hello world
hello world
hello world
hello world
hello world
hello world
         12 &lt;span class="k"&gt;function &lt;/span&gt;calls &lt;span class="k"&gt;in &lt;/span&gt;0.000 seconds
Ordered by: standard name
ncalls  tottime  percall  cumtime  percall filename:lineno&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="k"&gt;function&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
        1    0.000    0.000    0.000    0.000 test.py:1&lt;span class="o"&gt;(&lt;/span&gt;&amp;lt;module&amp;gt;&lt;span class="o"&gt;)&lt;/span&gt;
        6    0.000    0.000    0.000    0.000 test.py:1&lt;span class="o"&gt;(&lt;/span&gt;print_method&lt;span class="o"&gt;)&lt;/span&gt;
        3    0.000    0.000    0.000    0.000 test.py:5&lt;span class="o"&gt;(&lt;/span&gt;test_print_method&lt;span class="o"&gt;)&lt;/span&gt;
        1    0.000    0.000    0.000    0.000 &lt;span class="o"&gt;{&lt;/span&gt;method &lt;span class="s1"&gt;'disable'&lt;/span&gt; of &lt;span class="s1"&gt;'_lsprof.Profiler'&lt;/span&gt; objects&lt;span class="o"&gt;}&lt;/span&gt;
        1    0.000    0.000    0.000    0.000 &lt;span class="o"&gt;{&lt;/span&gt;range&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output might not be super digestible instantly at the first glance. Lets dive into different visualization tools available which can make the timing information more perceivable. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A picture is worth a thousand words&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  &lt;a href="https://github.com/jrfonseca/gprof2dot"&gt;gprof2dot&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;My favorite one among all the available tools is &lt;a href="https://github.com/jrfonseca/gprof2dot"&gt;gprof2dot&lt;/a&gt;&lt;a href="https://github.com/jrfonseca/gprof2dot"&gt;https://github.com/jrfonseca/gprof2dot&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Install &lt;code&gt;gprof2dot&lt;/code&gt;
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;gprof2dot &lt;span class="nt"&gt;--user&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Generate .pstats file
&lt;/h4&gt;

&lt;p&gt;Execute the &lt;code&gt;test.py&lt;/code&gt; script this time with the timing information being directed to an external output file, rather than standard console output. Observe the &lt;code&gt;-o&lt;/code&gt; flag with the output filename being &lt;code&gt;test.pstats&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python &lt;span class="nt"&gt;-m&lt;/span&gt; cProfile &lt;span class="nt"&gt;-o&lt;/span&gt; test.pstats test.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Visualize profiling information
&lt;/h4&gt;

&lt;p&gt;Assuming you have &lt;code&gt;dot&lt;/code&gt; and &lt;code&gt;eog&lt;/code&gt; installed, run the following command in the terminal where the profiling output file &lt;code&gt;test.pstats&lt;/code&gt; is located&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gprof2dot &lt;span class="nt"&gt;-f&lt;/span&gt; pstats test.pstats | dot &lt;span class="nt"&gt;-Tpng&lt;/span&gt; &lt;span class="nt"&gt;-o&lt;/span&gt; output.png &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; eog output.png
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Bingo, you get a window which shows something like the following&lt;/p&gt;

&lt;p&gt;&lt;em&gt;gprof2dot output&lt;/em&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7CVpqJEG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/czuqt29frcs2d9aevp9u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7CVpqJEG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/czuqt29frcs2d9aevp9u.png" alt="gprof2dot output"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  Analysis
&lt;/h4&gt;

&lt;p&gt;Above graph shows you that &lt;code&gt;91.67%&lt;/code&gt; was spent in &lt;code&gt;test_print_method&lt;/code&gt; and the same method was called 3 times (&lt;code&gt;3x&lt;/code&gt;) , which in turn calls &lt;code&gt;print_method&lt;/code&gt; (overall &lt;em&gt;6&lt;/em&gt; times).&lt;/p&gt;

&lt;p&gt;Other method calls like &lt;code&gt;range&lt;/code&gt; is a tiny amount of total execution time, but it is also visible in the graph&lt;/p&gt;

&lt;p&gt;This was a simple python code. This method works equally well with complex code. Pasting a sample image from gprof2dot’s &lt;a href="https://github.com/jrfonseca/gprof2dot/blob/master/sample.png"&gt;github repo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;gprof2dot sample output&lt;/em&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hKq-OyxQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/sg6eho2dx9pc78oxo4ut.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hKq-OyxQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/sg6eho2dx9pc78oxo4ut.png" alt="gprof2dot sample output"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h3&gt;
  
  
  &lt;a href="https://jiffyclub.github.io/snakeviz/#snakeviz"&gt;SnakeViz&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://jiffyclub.github.io/snakeviz/#snakeviz"&gt;SnakeViz&lt;/a&gt; is a browser based visualization tool. It needs the output in a &lt;code&gt;.profile&lt;/code&gt; format, rather than &lt;code&gt;.pstats&lt;/code&gt; when the profiling output is generated using &lt;code&gt;cProfile&lt;/code&gt; module&lt;/p&gt;
&lt;h4&gt;
  
  
  Install &lt;code&gt;snakeviz&lt;/code&gt;
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;snakeviz &lt;span class="nt"&gt;--user&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  Generate .profile file
&lt;/h4&gt;

&lt;p&gt;Execute the &lt;code&gt;test.py&lt;/code&gt; script this time with the timing information being redirected using &lt;code&gt;-o&lt;/code&gt; flag to output file named &lt;code&gt;test.profile&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python &lt;span class="nt"&gt;-m&lt;/span&gt; cProfile &lt;span class="nt"&gt;-o&lt;/span&gt; test.profile test.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Visualize profiling information
&lt;/h4&gt;

&lt;p&gt;Run the following command in the terminal where the profiling output file &lt;code&gt;test.profile&lt;/code&gt; is located&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;snakeviz test.profile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Analysis
&lt;/h4&gt;

&lt;p&gt;There will be some information printed in the console when the command is run &lt;em&gt;and&lt;/em&gt; a new window which pops in a browser session&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;snakeviz test.profile 
snakeviz web server started on 127.0.0.1:8080&lt;span class="p"&gt;;&lt;/span&gt; enter Ctrl-C to &lt;span class="nb"&gt;exit
&lt;/span&gt;http://127.0.0.1:8080/snakeviz/%2Ftmp%2Ftest.profile
START /usr/bin/google-chrome-stable &lt;span class="s2"&gt;"http://127.0.0.1:8080/snakeviz/%2Ftmp%2Ftest.profile"&lt;/span&gt;
Opening &lt;span class="k"&gt;in &lt;/span&gt;existing browser session.
WARNING:tornado.access:404 GET /images/sort_both.png &lt;span class="o"&gt;(&lt;/span&gt;127.0.0.1&lt;span class="o"&gt;)&lt;/span&gt; 1.04ms
WARNING:tornado.access:404 GET /images/sort_desc.png &lt;span class="o"&gt;(&lt;/span&gt;127.0.0.1&lt;span class="o"&gt;)&lt;/span&gt; 0.49ms
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Snakeviz icicle visulaization&lt;/em&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---bxlm7mM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/j2xjbbhg6s9ci0wvy1wg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---bxlm7mM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/j2xjbbhg6s9ci0wvy1wg.png" alt="Snakeviz icicle visulaization"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Snakeviz suburst visulaization&lt;/em&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bzOPAi63--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/qz913b4i7kv8leyinjje.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bzOPAi63--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/qz913b4i7kv8leyinjje.png" alt="Snakeviz suburst visulaization"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h3&gt;
  
  
  &lt;a href="http://pycallgraph.slowchop.com/en/master/"&gt;PyCallGraph&lt;/a&gt;
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;This seems to be an abandoned project, but hey ! still works.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h4&gt;
  
  
  Install &lt;code&gt;pycallgraph&lt;/code&gt;
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;pycallgraph &lt;span class="nt"&gt;--user&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  Generate png visualization file
&lt;/h4&gt;

&lt;p&gt;Execute the script using &lt;code&gt;pycallgraph&lt;/code&gt; executable, rather than going via python executable.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Disclaimer&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="http://pycallgraph.slowchop.com/en/master/"&gt;The following examples specify graphviz as the outputter, so it’s required to be installed&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;


&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pycallgraph graphviz &lt;span class="nt"&gt;--&lt;/span&gt; ./test.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Visualize profiling information
&lt;/h4&gt;

&lt;p&gt;Above command generates a &lt;code&gt;pycallgraph.png&lt;/code&gt; image. Open the image using any image viewer. Using &lt;code&gt;eog&lt;/code&gt; as an example on my host&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;eog pycallgraph.png
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;pycallgraph png&lt;/em&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4Kaoxyou--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/vlu3wxm3vuvsf48fytyv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4Kaoxyou--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/vlu3wxm3vuvsf48fytyv.png" alt="pycallgraph png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Shows the timing and number of calls information.&lt;/p&gt;




&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;I still believe &lt;a href="https://github.com/jrfonseca/gprof2dot"&gt;gprof2dot&lt;/a&gt; does a better job at giving &lt;code&gt;%&lt;/code&gt; and eye tracks naturally the flow in the graph much easier than other visualization methods.&lt;/p&gt;

</description>
      <category>python</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
