<?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: Shubham Singh</title>
    <description>The latest articles on DEV Community by Shubham Singh (@imshubh17).</description>
    <link>https://dev.to/imshubh17</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%2F420377%2F1807a695-92c2-4b7e-9f91-d9ddb139d9d2.jpeg</url>
      <title>DEV Community: Shubham Singh</title>
      <link>https://dev.to/imshubh17</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/imshubh17"/>
    <language>en</language>
    <item>
      <title>Roadmap to becoming a proficient Go (Golang) developer</title>
      <dc:creator>Shubham Singh</dc:creator>
      <pubDate>Tue, 23 Jan 2024 15:33:54 +0000</pubDate>
      <link>https://dev.to/imshubh17/roadmap-to-becoming-a-proficient-go-golang-developer-3h3l</link>
      <guid>https://dev.to/imshubh17/roadmap-to-becoming-a-proficient-go-golang-developer-3h3l</guid>
      <description>&lt;h2&gt;
  
  
  Step 1: Understand the Basics
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1.1 Learn Go Fundamentals
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Familiarize yourself with the basic syntax, data types, control structures, and functions in Go.&lt;/li&gt;
&lt;li&gt;Understand Go's concurrency model, goroutines, and channels.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  1.2 Official Go Documentation
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Read the &lt;a href="https://golang.org/doc/"&gt;official Go documentation&lt;/a&gt; for a comprehensive understanding of the language.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 2: Setup Your Development Environment
&lt;/h2&gt;

&lt;h3&gt;
  
  
  2.1 Install Go
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Download and install the latest version of Go from the &lt;a href="https://golang.org/dl/"&gt;official website&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2.2 IDE/Editor
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Choose an IDE or text editor for Go development. Popular choices include Visual Studio Code, GoLang, and Atom.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 3: Build Practical Projects
&lt;/h2&gt;

&lt;h3&gt;
  
  
  3.1 Hands-on Coding
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Start coding small projects to apply your knowledge.&lt;/li&gt;
&lt;li&gt;Use GitHub to find and contribute to open-source Go projects.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3.2 Web Development
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Learn web development with Go using frameworks like Gin or Echo.&lt;/li&gt;
&lt;li&gt;Build RESTful APIs and understand routing, middleware, and templating.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3.3 Database Interaction
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Learn how to interact with databases using the &lt;code&gt;database/sql&lt;/code&gt; package.&lt;/li&gt;
&lt;li&gt;Explore ORM libraries like Gorm.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 4: Advanced Concepts
&lt;/h2&gt;

&lt;h3&gt;
  
  
  4.1 Concurrency and Parallelism
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Dive deeper into goroutines, channels, and concurrency patterns.&lt;/li&gt;
&lt;li&gt;Understand how to write concurrent code effectively.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4.2 Testing
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Learn about testing in Go using the &lt;code&gt;testing&lt;/code&gt; package.&lt;/li&gt;
&lt;li&gt;Write unit tests, integration tests, and benchmark tests.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4.3 Error Handling
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Understand Go's error handling mechanisms and best practices.&lt;/li&gt;
&lt;li&gt;Explore the use of &lt;code&gt;defer&lt;/code&gt; for resource cleanup.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 5: Explore Go Ecosystem
&lt;/h2&gt;

&lt;h3&gt;
  
  
  5.1 Dependency Management
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Learn about Go modules for dependency management.&lt;/li&gt;
&lt;li&gt;Understand tools like &lt;code&gt;go mod&lt;/code&gt; and &lt;code&gt;dep&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5.2 Explore Go Packages
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Explore popular Go packages for various domains like networking, authentication, and more.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 6: Contribute to Open Source
&lt;/h2&gt;

&lt;h3&gt;
  
  
  6.1 GitHub Contributions
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Contribute to open-source Go projects on GitHub.&lt;/li&gt;
&lt;li&gt;Learn from experienced developers and receive feedback on your code.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 7: Stay Updated
&lt;/h2&gt;

&lt;h3&gt;
  
  
  7.1 Follow Go Blogs and News
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Stay updated with the latest developments in the Go community by following blogs, forums, and news sources.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  7.2 Books and Courses
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Read Go-related books and take online courses to deepen your understanding.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 8: Networking and Community
&lt;/h2&gt;

&lt;h3&gt;
  
  
  8.1 Join Go Communities
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Participate in Go meetups, forums, and online communities to connect with other developers.&lt;/li&gt;
&lt;li&gt;Attend conferences and workshops to stay engaged with the community.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 9: Build a Portfolio
&lt;/h2&gt;

&lt;h3&gt;
  
  
  9.1 Create a GitHub Portfolio
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Showcase your projects on GitHub.&lt;/li&gt;
&lt;li&gt;Include a variety of projects to demonstrate your skills in different areas of Go development.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 10: Continuous Learning
&lt;/h2&gt;

&lt;h3&gt;
  
  
  10.1 Explore Advanced Topics
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;As you become more comfortable with the basics, explore advanced topics such as reflection, optimization, and low-level programming in Go.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  10.2 Experiment and Innovate
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Don't be afraid to experiment with new ideas and technologies within the Go ecosystem.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Remember that becoming proficient in any programming language is an ongoing process. Stay curious, practice consistently, and keep challenging yourself with new projects and problems.&lt;/p&gt;

</description>
      <category>go</category>
      <category>backend</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Getting Started With Popular Express framework</title>
      <dc:creator>Shubham Singh</dc:creator>
      <pubDate>Thu, 10 Jun 2021 09:26:26 +0000</pubDate>
      <link>https://dev.to/imshubh17/getting-started-with-popular-express-framework-3o52</link>
      <guid>https://dev.to/imshubh17/getting-started-with-popular-express-framework-3o52</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;A huge portion of the Internet’s data travels over HTTP/HTTPS through request-response cycles between clients and servers.&lt;br&gt;
Express is a powerful but flexible Javascript framework for creating web servers and APIs. It can be used for everything from simple static file servers to JSON APIs to full production servers.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ol&gt;
&lt;li&gt;Starting A Server 
Express is a Node module, so in order to use it, we will need to import it into our program file. To create a server, the imported express function must be invoked.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const express = require('express');
const app = express();

const PORT = 4001;
app.listen(PORT, () =&amp;gt; {
  console.log(`Server is listening on port ${PORT}`);
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;In this example, our app.listen() call will start a server listening on port 4001, and once the server is started it will log 'Server is listening on port 4001'&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ol&gt;
&lt;li&gt;Writing Your First Route
&amp;gt; Once the Express server is listening, it can respond to any and all requests. 
&amp;gt; For example, if your server receives a GET request at ‘/about’, we will use a route to define the appropriate functionality for that HTTP verb (GET) and path (/about).
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Open a call to `app.get()` below:
app.get('/expressions',(req,res, next)=&amp;gt;{
   // Here we would send back the moods array in response
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Inside app.js, create a route handler to handle a GET request to '/expressions'. For now, give it a req, res, next callback. For now, log the req object inside the callback. Verify that the route works and logs the request by starting your server and clicking the Refresh Expressions button which will send a GET /expressions request.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ol&gt;
&lt;li&gt;Sending A Response
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;app.get('/expressions', (req, res, next) =&amp;gt; {
  res.send(expressions);
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>javascript</category>
      <category>express</category>
      <category>node</category>
      <category>backend</category>
    </item>
    <item>
      <title>Starting Publish Articles on Data Science </title>
      <dc:creator>Shubham Singh</dc:creator>
      <pubDate>Wed, 26 May 2021 14:03:08 +0000</pubDate>
      <link>https://dev.to/imshubh17/starting-to-post-articles-on-data-science-3g2h</link>
      <guid>https://dev.to/imshubh17/starting-to-post-articles-on-data-science-3g2h</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--s8bQLUKq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2epmown3apbdw1fiq49d.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--s8bQLUKq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2epmown3apbdw1fiq49d.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Announcement : From this post I am starting series related Data Science.
&lt;/h3&gt;

&lt;p&gt;I am starting learning path program of Data science from &lt;a href="https://www.codecademy.com/paths/data-science"&gt;codecademy&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;New Post Coming Soon...&lt;/p&gt;

</description>
      <category>datascience</category>
      <category>python</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Getting Started With React Native!</title>
      <dc:creator>Shubham Singh</dc:creator>
      <pubDate>Wed, 26 May 2021 09:12:10 +0000</pubDate>
      <link>https://dev.to/imshubh17/getting-started-with-react-native-14c2</link>
      <guid>https://dev.to/imshubh17/getting-started-with-react-native-14c2</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nlK0UfvM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gwolasbain5qdcgzkl9w.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nlK0UfvM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gwolasbain5qdcgzkl9w.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What is React Native?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;React Native is a library built with the same API as React. It uses the same declarative UI paradigm but renders directly to native components. You can write your app once in React and run it on multiple native platforms, like Android and iOS.&lt;/li&gt;
&lt;li&gt;While “native” is part of the name, it’s not pure native app development: Expo and React Native still use JavaScript to run your app. Instead of rendering this JavaScript with a web engine, they use the actual native components from the platform.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Render a Component
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;All apps in React Native are made out of components. These components are small reusable pieces of your app, all working together. Each of these components usually has a single responsibility. It can vary from rendering styled text, or rendering other pre-styled components to create a form.&lt;/p&gt;

&lt;p&gt;Just like normal React, your app all descends from a single component. This component renders all other components in your app, from screens to simple text. Instead of rendering this component to DOM, Expo and React Native renders it for you using a concept called the entry point.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Basic Block of Code
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;App.js&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react';
import { Text } from 'react-native';

const App = () =&amp;gt; (
  &amp;lt;Text style={{ margin: 64 }}&amp;gt;
    Welcome to React Native!
  &amp;lt;/Text&amp;gt;
);

export default App;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Native Rendering
&lt;/h3&gt;

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

&lt;blockquote&gt;
&lt;p&gt;In our previous example, we used the  component to render text. There are a few other components like  which ship with React Native; we call these core components. React Native knows how to render these on a specific platform because they are tied to a native component counterpart.&lt;br&gt;
The diagram demonstrates the relationship between React code, the JS thread, the UI thread, and the native application. From left to right, it describes how a React button is rendered to a native button component.&lt;br&gt;
Here is a copy of the text included in the diagram:&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;React: The React-like JavaScript code developers write for their React Native apps&lt;/li&gt;
&lt;li&gt;JS Thread: The app code is converted into a single JS bundle or file. React Native executes this code in a special thread to determine what it needs to render or invoke.&lt;/li&gt;
&lt;li&gt;UI Thread: This thread receives actions to run natively. It can include rendering native components, like a . It can also return data, requested by the JS thread, like sensor data.&lt;/li&gt;
&lt;li&gt;Native: The native operating system actually renders the native component for a  on the phone.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Summery
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt; React Native is a library that uses React for mobile app development to create performant apps with JavaScript.&lt;/li&gt;
&lt;li&gt; Expo is a platform for universal React apps that contains React Native and helps you iterate fast, without any native platform knowledge.&lt;/li&gt;
&lt;li&gt; Components in React Native have a native component counterpart that is rendered on the native platform.&lt;/li&gt;
&lt;li&gt; Expo and React Native runs your React JavaScript in the actual app, in a different thread from the UI to keep your app running smoothly.&lt;/li&gt;
&lt;li&gt; Just like React, Expo and React Native uses the entry point of your app to render it on different native platforms.&lt;/li&gt;
&lt;li&gt; Because different native platforms aren’t identical, some components behave differently on some platforms.&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Create Drawing Board using Canvas with simple clean code</title>
      <dc:creator>Shubham Singh</dc:creator>
      <pubDate>Fri, 12 Feb 2021 07:33:43 +0000</pubDate>
      <link>https://dev.to/imshubh17/create-drawing-board-using-canvas-with-simple-clean-code-5dc7</link>
      <guid>https://dev.to/imshubh17/create-drawing-board-using-canvas-with-simple-clean-code-5dc7</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--23nJ5wZ3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ncw81yukq92xngdbldi0.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--23nJ5wZ3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ncw81yukq92xngdbldi0.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Source Code
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
  &amp;lt;meta charset="utf-8"&amp;gt;
  &amp;lt;meta name="viewport" content="width=device-width"&amp;gt;
  &amp;lt;title&amp;gt;JS Bin&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
  &amp;lt;style&amp;gt;
    * {
        margin : 0;
        padding: 0;
        box-sizing: borger-box
      }

    #canvas {
        border: 2px solid black;
        }
  &amp;lt;/style&amp;gt;
&amp;lt;body&amp;gt;
  &amp;lt;canvas id="canvas"&amp;gt;&amp;lt;/canvas&amp;gt;

&amp;lt;script&amp;gt;
window.addEventListener('load',()=&amp;gt;{
  console.log("document loaded");

  const canvas = document.querySelector('#canvas');
  const ctx = canvas.getContext("2d");

  //resizing
  canvas.height = window.innerHeight;
  canvas.width = window.innerWidth;

  //variables
  let painting = false;

  //methods
  function startPosition(e){
    painting =true;
    console.log("in progress...");

    //when click only
    draw(e)
  }

  function finishedPosition(){
    painting =false;
    console.log("end paint");

    //after start from new position
    ctx.beginPath();
  }

  function draw(e){
    if(!painting) return;

    //style
    ctx.lineWidth = 10;
    ctx.lineCap = "round";

    ctx.lineTo(e.clientX, e.clientY);
    ctx.stroke(); 

  }

  //listener
  canvas.addEventListener('mousedown',startPosition);  
  canvas.addEventListener('mouseup',finishedPosition);  
  canvas.addEventListener('mousemove',draw);  
})
&amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>html</category>
      <category>css</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Build a Number Guess Application in C# .NET</title>
      <dc:creator>Shubham Singh</dc:creator>
      <pubDate>Wed, 09 Dec 2020 14:59:35 +0000</pubDate>
      <link>https://dev.to/imshubh17/build-a-number-guess-application-in-c-net-3d8m</link>
      <guid>https://dev.to/imshubh17/build-a-number-guess-application-in-c-net-3d8m</guid>
      <description>&lt;h2&gt;
  
  
  &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3Zb7Xreu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/pkpe9y62p9rg7res0tsu.JPG" alt="Alt Text"&gt;
&lt;/h2&gt;

&lt;h1&gt;
  
  
  Simple Game Build to start with C# in VS
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;using System;

namespace NumberGusser
{
    //Main Class 
    class Program
    {
        //Entry Point Method
        static void Main(string[] args)
        {
            // set app variable
            string m_appName = "Number Guesser";
            string m_appVersion = "1.0.0";
            string m_appAuthor = "@imshubh17";

            //change text color for app info
            Console.ForegroundColor = ConsoleColor.Green;

            //write out app info
            Console.WriteLine("{0}: Version {1}, by {2}", m_appName, m_appVersion, m_appAuthor);

            //change text color to original
            Console.ResetColor();

            //ask user name
            Console.WriteLine("What is your name?");

            // get user name
            string userName = Console.ReadLine();

            Console.WriteLine("Hello {0}, Let's Play a GAME...", userName);
            //set Score
            int i_totalScore = 10;
            int i_initialScore = 11;

            //set correct Number
            int i_correctNumber = 7;

            //init guess var
            int i_guess = 0;

            //Ask User to guess number
            Console.WriteLine("Guess a number between 1 to 10");           

            //result 
            while (i_guess != i_correctNumber)
            {
                string userGuessInput = Console.ReadLine();
                i_guess = int.Parse(userGuessInput);
                i_initialScore--;
            }

            //print result
            Console.WriteLine("{0} Your Score: {1}/{2}", userName, i_initialScore, i_totalScore);
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Functional Programming with JavaScript</title>
      <dc:creator>Shubham Singh</dc:creator>
      <pubDate>Mon, 06 Jul 2020 06:50:54 +0000</pubDate>
      <link>https://dev.to/imshubh17/functional-programming-with-javascript-1d10</link>
      <guid>https://dev.to/imshubh17/functional-programming-with-javascript-1d10</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_jCN3NYA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/pgn8pue2mgh8mkfwb761.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_jCN3NYA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/pgn8pue2mgh8mkfwb761.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;p&gt;Functional programming is a clean, robust alternative to the more typical procedural style of programming.&lt;/p&gt;

&lt;h3&gt;
  
  
  First-class functions
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Examples
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// define function
var line = console.log
// call function
line("Hello and welcome to the course!")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Higher-order functions
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Examples
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const DEBUG_MODE_ENABLED = true
var debug

// define function at debug variable
if (DEBUG_MODE_ENABLED) {
  debug = printDebugMessage
} else {
  debug = doNothing
}

// call function
debug("Some debug message")

// two functions
function printDebugMessage(message) {
  console.log("DEBUG: " + message)
}
function doNothing() { }

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

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//define function
function ifElse(condition, func1, func2) {
  if (condition) {
    func1()
  } else {
    func2()
  }
}

var x = 1
// call function
ifElse(x === 1, function() {
  console.log("x is 1")
}, function() {
  console.log("x is not 1")
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  private variables
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function createCounter() {
  var count = 0
  return {
    increment: function() {
      count += 1
    },
    currentValue: function() {
      return count
    }
  }
}

var myCounter = createCounter()

console.log(myCounter.currentValue())

myCounter.increment()
myCounter.increment()

console.log(myCounter.currentValue())
console.log(myCounter.currentValue())

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Array functions
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Mapping
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var _ = require("lodash")

var numbers = [ 1, 2, 3, 4, 5 ]
var numbersCubed = _.map(numbers, function(element) {
  return element * element * element
})

console.log(numbersCubed)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Filtering
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var _ = require("lodash")

var numbers = [ 1, 2, 3, 4, 5 ]
var evensFromNumbers = _.filter(numbers, function(element) {
  return element % 2 === 0
})

console.log(evensFromNumbers)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var _ = require("lodash")

var employees = [
  { name: "John",  salary: 50000  },
  { name: "Susan", salary: 60000  },
  { name: "Greg",  salary: 100000 },
  { name: "Mary",  salary: 120000 }
]

var dueForARaise = _.filter(employees, function(employee) {
  return employee.salary &amp;lt; 70000
})

console.log(dueForARaise)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Every/some
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var _ = require("lodash")

var numbers = [ 3, 5, 7, 9, 11, 13 ]

var arrayContainsEven = _.some(numbers, function(element) {
  return element % 2 === 0
})

var arrayIsAllEven = _.every(numbers, function(element) {
  return element % 2 === 0
})

console.log("Array contains even?: " + arrayContainsEven)
console.log("Array is all even?: " + arrayIsAllEven)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Reduce
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var _ = require("lodash")

var shoppingList = [
  { name: "Eggs",    price: 4.99 },
  { name: "Milk",    price: 3.99 },
  { name: "Bananas", price: 2.79 },
  { name: "Beer",    price: 6.99 }
]

var totalCost = _.reduce(shoppingList, function(acc, item) {
  return acc + item.price
}, 0)

console.log(totalCost)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  combine map, filter, reduce
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var _ = require("lodash")

var employees = [
  { name: "John",   salary: 60000,  age: 27, gender: 'M' },
  { name: "Mary",   salary: 110000, age: 50, gender: 'F' },
  { name: "Susan",  salary: 50000,  age: 21, gender: 'F' },
  { name: "Greg",   salary: 100000, age: 45, gender: 'M' },
  { name: "Jerry",  salary: 90000,  age: 39, gender: 'M' },
  { name: "Barb",   salary: 95000,  age: 36, gender: 'F' }
]

var males = _.filter(employees, function(employee) {
  return employee.gender === 'M'
})
var maleAges = _.map(males, function(male) {
  return male.age
})
var maleAgeTotal = _.reduce(maleAges, function(acc, age) {
  return acc + age
})
var maleAgeAverage = maleAgeTotal / males.length

console.log("Average male age: " + maleAgeAverage)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Callbacks with arguments
&lt;/h3&gt;

&lt;h4&gt;
  
  
  pass arguments example
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function add(x, y, z) {
  return x + y + z
}

function partiallyApply(func, x, y) {
  return function(z) {
    return func(x, y, z)
  }
}

var add5and2 = partiallyApply(add, 5, 2)

console.log(add5and2(3))
console.log(add(5, 2, 3))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  recursive function example
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function loop(i) {
  console.log("i is " + i)
  if (i &amp;lt; 10) {
    loop(i + 1)
  }
}

loop(0)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Flask QuickSheet</title>
      <dc:creator>Shubham Singh</dc:creator>
      <pubDate>Tue, 30 Jun 2020 06:25:32 +0000</pubDate>
      <link>https://dev.to/imshubh17/flask-quicksheet-2ppn</link>
      <guid>https://dev.to/imshubh17/flask-quicksheet-2ppn</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HaYcV1Pf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/qsr7rgy3qqcnauwv6r3c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HaYcV1Pf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/qsr7rgy3qqcnauwv6r3c.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Setup Environment
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ python -m venv venv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To activate&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ source venv/Scripts/activate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To Deactivate&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ deactivate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Or
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ pip install pipenv

$ pipenv install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;activate&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ pipenv shell
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;deactivate&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ exit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Package install
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ pipenv install package-name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Install Flask and Setup
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$pip install flask
$pip install python-dotenv
$touch .flaskenv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  In file .flaskenv :
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FLASK_ENV=development
FLASK_APP=main.py 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Or
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ set FLASK_APP=main
$ set FLASK_ENV=development
$ flask run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Note&lt;/em&gt; : command prompt use “set” and in bash shell use “export”&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;em&gt;Install the dependencies&lt;/em&gt;:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ pip install –r requirements.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Basic Structure
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;Main.py&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 flask import Flask
app = Flask(__name__)
@app.route("/")
@app.route("/index")
def index():
    return "&amp;lt;h1&amp;gt;Hello Earth!!&amp;lt;/h1&amp;gt;"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;*Run Application *&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ flask run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Flask app  Configration
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Config.py&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;import os
class Config(object):
    SECRET_KY = os.environ.get('SECRET_KEY') or "secret_string"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;main.py&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 config import Config
app.config.from_object(Config)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  MongoDB Configration and modeling
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;Main.py&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 flask_mongoengine import MongoEngine
db = MongoEngine()
db.init_app(app)
class Course(db.Document):
    course_id   =   db.StringField( max_length=10, unique=True )
    credits     =   db.IntField()
    term        =   db.StringField( max_length=25 )
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;em&gt;Postgresql&lt;/em&gt;
&lt;/h3&gt;

&lt;h5&gt;
  
  
  setup your database in &lt;em&gt;config.py&lt;/em&gt;:
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SQLALCHEMY_DATABASE_URI = 'postgresql://username:password@localhost:5432/databaseName'
SQLALCHEMY_TRACK_MODIFICATIONS = False
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  For Database create at PostgreSQL using &lt;em&gt;psql&lt;/em&gt; shell
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;postgres-# CREATE DATABASE learninghub;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can check the available database list using \l&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;postgres-# \l
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;command to connect/select a desired database&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;postgres=# \c learninghub;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;model.py&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;class User(db.Model):
    __tablename__ = 'user'
    user_id = db.Column(db.Integer, primary_key=True)
    first_name = db.Column(db.String(), nullable=False)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Database Migration
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;Main.py&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 flask_migrate import Migrate
db = SQLAlchemy(app)
migrate = Migrate(app, db)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create Migration&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  $  flask db init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can then generate an initial migration&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  $ flask db migrate -m "Initial migration."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then you can apply the migration to the database:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  $ flask db upgrade

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  POST request
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Main.py&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;@app.route("/enrollment", methods=["GET","POST"])
def enrollment():
    id = request.form.get('courseID')
    term = request.form.get('term')
    return render_template("enrollment.html", enrollment=True, data={"id":id,"term":term})  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;html page&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;&amp;lt;form action="{{url_for('enrollment')}}" method="POST"&amp;gt;
                        &amp;lt;input type="hidden" name="courseID" value="{{data['courseID']}}"&amp;gt;
                        &amp;lt;input type="hidden" name="term" value="{{data['term']}}"&amp;gt;
                    &amp;lt;button&amp;gt;Enroll&amp;lt;/button&amp;gt;
                &amp;lt;/form&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  GET  request
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;id = request.args.get('courseID')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Templates rander
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from flask import render_template
return render_template('home.html')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Redirect page
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from flask import redirect, url_for
return redirect(url_for('function_name'))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Flash message
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Main.py&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 flask import flash
flash('welcome to home!!!')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;html page&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;&amp;lt;div&amp;gt;
{% for message in get_flashed_messages() %}
&amp;lt;h2&amp;gt;{{ message }}&amp;lt;/h2&amp;gt;
{% endfor %}
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  File Upload
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Main.py&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 werkzeug.utils import secure_filename
import os
if  request.method =='POST':
    f = request.files['file']
    name = secure_filename(f.filename)
    f.save(os.path.join(os.getcwd(),name))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;html page&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;&amp;lt;form action="upload", method="post", enctype="multipart/form-data"&amp;gt;
    &amp;lt;input type="file" name="file"&amp;gt;
    &amp;lt;input type="submit"&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Page not found error handle
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@app.errorhandler(404)
def page(error):
    return "page not available, please try other url",404
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>python</category>
      <category>flask</category>
      <category>webdev</category>
      <category>restapi</category>
    </item>
  </channel>
</rss>
