<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ashish Pandey on Medium]]></title>
        <description><![CDATA[Stories by Ashish Pandey on Medium]]></description>
        <link>https://medium.com/@kingofthepirates?source=rss-cab76b872735------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*uOUw2tTc3wJ0lkoBfTSQoA.jpeg</url>
            <title>Stories by Ashish Pandey on Medium</title>
            <link>https://medium.com/@kingofthepirates?source=rss-cab76b872735------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 23:22:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kingofthepirates/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Let’s create joke generator using python and tkinter]]></title>
            <link>https://medium.com/@kingofthepirates/lets-create-joke-generator-using-python-and-tkinter-c32926393562?source=rss-cab76b872735------2</link>
            <guid isPermaLink="false">https://medium.com/p/c32926393562</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[tkinter]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[gui]]></category>
            <category><![CDATA[developer]]></category>
            <dc:creator><![CDATA[Ashish Pandey]]></dc:creator>
            <pubDate>Thu, 19 Jan 2023 05:10:34 GMT</pubDate>
            <atom:updated>2023-01-19T06:21:15.022Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, we will be going through a Python script that creates a simple graphical user interface (GUI) application for generating jokes. The application uses the Tkinter library to create the GUI and the requests and json libraries to fetch jokes from a public API called the JokeAPI (<a href="https://jokeapi.dev/">https://jokeapi.dev/</a>).</p><p>The script starts by importing the necessary libraries:</p><pre>import tkinter as tk<br>import requests<br>import json</pre><p>Tkinter is a built-in Python library for creating GUI applications, while requests and json are commonly used for making HTTP requests and parsing JSON data, respectively.</p><p>The script then defines a function called “fetch_joke()”, which is responsible for fetching the jokes from the JokeAPI. This function uses the requests library to make a GET request to the JokeAPI, and then uses the json library to parse the response and extract the joke. Depending on the type of joke received, it will either display the ‘joke’ or the ‘setup’ and ‘delivery’ in the label.</p><pre>def fetch_joke():<br>    url = &quot;https://jokeapi.dev/joke/Any&quot;<br>    response = requests.get(url)<br>    joke = json.loads(response.text)<br>    if &#39;joke&#39; in joke:<br>        label.config(text=joke[&#39;joke&#39;])<br>    else:<br>        label.config(text=joke[&#39;setup&#39;] + &#39;\n&#39; + joke[&#39;delivery&#39;])</pre><p>Next, the script creates the main window of the application using Tkinter’s Tk() class and sets the title of the window to “Joke Generator”.</p><pre>root = tk.Tk()<br>root.title(&quot;Joke Generator&quot;)</pre><p>The script then creates a button widget using Tkinter’s Button() class, sets the text of the button to “Generate Joke”, and assigns the fetch_joke() function as the button’s command. The button is placed in the center of the window using the place() method.</p><pre>button = tk.Button(root, text=&quot;Generate Joke&quot;, command=fetch_joke)<br>button.place(relx=.5, rely=.2, anchor=&quot;c&quot;)</pre><p>A label widget is also created using Tkinter’s Label() class, and is placed in the center of the window as well. This label is used to display the joke generated by the fetch_joke() function. The script then generates a random joke at the beginning and starts the event loop, which allows the application to respond to user input.Copy code</p><pre>label = tk.Label(root, text=&quot;&quot;, font=(&quot;Cursive&quot;, 18))<br>label.place(relx=.5, rely=.5, anchor=&quot;c&quot;)<br><br><br>fetch_joke()<br>root.mainloop()</pre><p>In summary, this script creates a simple GUI application that fetches a joke from the JokeAPI and displays it in a label widget. When the user clicks the “Generate Joke” button, a new joke is fetched and displayed in the label. The Tkinter library is used to create the GUI elements, while the requests and json libraries are used to fetch and parse the joke data from the JokeAPI.</p><pre>import tkinter as tk<br>import requests<br>import json<br><br>def fetch_joke():<br>    url = &quot;https://jokeapi.dev/joke/Any&quot;<br>response = requests.get(url)<br>joke = json.loads(response.text)<br>if &#39;joke&#39; in joke:<br>label.config(text=joke[&#39;joke&#39;])<br>else:<br>label.config(text=joke[&#39;setup&#39;] + &#39;\n&#39; + joke[&#39;delivery&#39;])<br><br>root = tk.Tk()<br>root.title(&quot;Joke Generator&quot;)<br><br>button = tk.Button(root, text=&quot;Generate Joke&quot;, command=fetch_joke)<br>button.place(relx=.5, rely=.2, anchor=&quot;c&quot;)<br><br>label = tk.Label(root, text=&quot;&quot;, font=(&quot;Cursive&quot;, 18))<br>label.place(relx=.5, rely=.5, anchor=&quot;c&quot;)<br><br>fetch_joke()<br>root.mainloop()</pre><p>Output:</p><figure><img alt="Joke generator using python" src="https://cdn-images-1.medium.com/max/1024/1*3OXWlAnlidn63T0CRqrr2g.png" /></figure><p>This script can be run in any python environment and it will generate a GUI window with a button and a label, when the button is pressed it will fetch a joke from the JokeAPI and display it on the label.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c32926393562" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Let’s create a chatbot using Python and tkinter.]]></title>
            <link>https://medium.com/@kingofthepirates/lets-create-a-chatbot-using-python-and-tkinter-7edf42d2a20f?source=rss-cab76b872735------2</link>
            <guid isPermaLink="false">https://medium.com/p/7edf42d2a20f</guid>
            <category><![CDATA[tkinter]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[chatbots]]></category>
            <dc:creator><![CDATA[Ashish Pandey]]></dc:creator>
            <pubDate>Mon, 16 Jan 2023 07:31:38 GMT</pubDate>
            <atom:updated>2023-01-16T08:33:22.150Z</atom:updated>
            <content:encoded><![CDATA[<h3>Let’s create a chatbot using Python and tkinter. A simple chatbot even a noob in programming can make.</h3><p>Hey guys, have you ever wanted to create your own chatbot? Well, look no further because with just a few lines of Python code, you too can have your very own chatbot.</p><p>The code I have provided here is a simple chatbot using the Tkinter library in Python. Tkinter is a built-in library that allows for easy creation of graphical user interfaces (GUIs) in Python.</p><p>First, we import the Tkinter library and the datetime library. The datetime library is used to get the current time, which we will use later in the code.</p><p>Next, we define a function called “on_submit”, which is called whenever the user submits their input. In this function, we first get the user’s input and insert it into the output field with a “User:” label. We also have several “if” and “elif” statements that check the user’s input and respond accordingly. For example, if the user inputs “hi”, the chatbot will respond with “Hello, how can I help you?”. If the user inputs “time”, the chatbot will respond with the current time. If the user inputs “bye”, the chatbot will respond with “Goodbye, have a nice day!”.</p><p>The rest of the code sets up the GUI for the chatbot, including the input and output fields, labels, and buttons. The output field is also configured with different colors for the user’s input and the chatbot’s response.</p><p>Overall, this code is a great starting point for creating your own chatbot and experimenting with different responses and functionality. So go ahead and give it a try!</p><pre>import tkinter as tk<br>import datetime<br><br>def on_submit(event=None):<br>    user_input = input_field.get()<br>    output_field.config(state=&#39;normal&#39;)<br>    output_field.insert(&#39;end&#39;, &#39;User: &#39; + user_input + &#39;\n&#39;, &#39;red&#39;)<br>    if user_input == &#39;hi&#39;:<br>        output_field.insert(&#39;end&#39;, &#39;Hello, how can I help you?\n&#39;, &#39;blue&#39;)<br>    elif user_input == &#39;how are you&#39;:<br>        output_field.insert(&#39;end&#39;, &#39;I am Okay. How about you?\n&#39;, &#39;blue&#39;)<br>    elif user_input == &#39;how old are you&#39;:<br>        output_field.insert(&#39;end&#39;, &#39;My creator just brought me to life in front of you. I am not much older than 10 minutes.\n&#39;, &#39;blue&#39;)<br>    elif user_input == &#39;what time is it&#39;:<br>        now = datetime.datetime.now()<br>        output_field.insert(&#39;end&#39;, &quot;It&#39;s &quot;+ now.strftime(&quot;%H:%M:%S %p&quot;)+&#39;\n&#39;, &#39;blue&#39;)<br>    elif user_input == &#39;bye&#39;:<br>        output_field.insert(&#39;end&#39;, &#39;Goodbye, have a nice day!\n&#39;, &#39;blue&#39;)<br>    else:<br>        output_field.insert(&#39;end&#39;, &#39;I am sorry, I do not understand.\n&#39;, &#39;blue&#39;)<br>    input_field.delete(0, &#39;end&#39;)<br>    output_field.config(state=&#39;disabled&#39;)<br><br>root = tk.Tk()<br>root.title(&quot;Chatbot&quot;)<br><br>output_frame = tk.Frame(root)<br>output_frame.pack(side=&#39;top&#39;, fill=&#39;both&#39;, expand=True)<br><br>output_label = tk.Label(output_frame, text=&quot;Chatbot:&quot;)<br>output_label.pack(side=&#39;left&#39;, padx=5, pady=5)<br><br>output_field = tk.Text(output_frame)<br>output_field.pack(side=&#39;left&#39;, fill=&#39;both&#39;, expand=True, padx=5, pady=5)<br>output_field.config(state=&#39;disabled&#39;)<br>output_field.tag_config(&#39;blue&#39;, foreground=&#39;blue&#39;)<br>output_field.tag_config(&#39;red&#39;, foreground=&#39;red&#39;)<br>output_field.config(font=(&quot;Futura&quot;, 16))<br><br>input_frame = tk.Frame(root)<br>input_frame.pack(side=&#39;bottom&#39;, fill=&#39;x&#39;)<br><br>input_label = tk.Label(input_frame, text=&quot;User:&quot;)<br>input_label.pack(side=&#39;left&#39;, padx=5, pady=5)<br><br>input_field = tk.Entry(input_frame, width=150)<br>input_field.pack(side=&#39;left&#39;, padx=5, pady=5)<br>input_field.bind(&quot;&lt;Return&gt;&quot;, on_submit)<br><br>submit_button = tk.Button(input_frame, text=&quot;Submit&quot;, command=on_submit)<br>submit_button.pack(side=&#39;left&#39;)<br><br>root.mainloop()</pre><p>output:</p><figure><img alt="chatbot using python and tkinter" src="https://cdn-images-1.medium.com/max/1024/1*BiXeoqK8NtGamjOZOUVgaA.png" /><figcaption>Chatbot using python and tkinter</figcaption></figure><p>The above code will open a GUI for the chatbot, where users can input their message and receive a response from the chatbot. Feel free to experiment with different responses, and even add new functionality to the chatbot. You can also change the appearance of the GUI by playing around with the Tkinter library. And that’s it, a simple yet functional chatbot built with python and Tkinter Library.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7edf42d2a20f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Let’s Create a Face Detector: A Step-by-Step Guide Using OpenCV]]></title>
            <link>https://medium.com/@kingofthepirates/lets-create-a-face-detector-a-step-by-step-guide-using-opencv-ef5ab918d6bc?source=rss-cab76b872735------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef5ab918d6bc</guid>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[pytho]]></category>
            <category><![CDATA[opencv]]></category>
            <dc:creator><![CDATA[Ashish Pandey]]></dc:creator>
            <pubDate>Sun, 15 Jan 2023 09:51:14 GMT</pubDate>
            <atom:updated>2023-01-15T09:51:14.593Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, We’ll be diving into the world of computer vision and image processing by using a popular library in Python called OpenCV. OpenCV is a powerful library that allows us to perform various image and video processing tasks, and it has a lot of pre-trained models that can be used for various tasks such as object detection, face detection, and more.</p><figure><img alt="Artiflicial intelligence" src="https://cdn-images-1.medium.com/max/1024/0*pNOYdE3jJPxE-M3A" /><figcaption>Photo by <a href="https://unsplash.com/@possessedphotography?utm_source=medium&amp;utm_medium=referral">Possessed Photography</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>To install opencv , do this :</p><pre>pip install opencv-python</pre><p>One of the most popular pre-trained models in OpenCV is the Haar cascade classifier for face detection. This classifier is trained to detect faces in images, and it’s a very powerful tool that can be used for a wide range of applications, such as security cameras, photo tagging, and more.</p><p>Here’s an example of how to use the Haar cascade classifier for face detection in Python:</p><pre>import cv2<br><br># Load the cascade classifier<br>#download this here https://raw.githubusercontent.com/opencv/opencv/4.x/data/haarcascades/haarcascade_frontalface_default.xml just go there and ctrl + s<br>face_cascade = cv2.CascadeClassifier(&quot;haarcascade_frontalface_default.xml&quot;) <br><br># Read the input image<br>img = cv2.imread(&quot;input.jpg&quot;)<br><br># Convert into grayscale<br>gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)<br><br># Detect faces<br>faces = face_cascade.detectMultiScale(gray, scaleFactor=1.1, minNeighbors=5)<br><br># Draw rectangle around the faces<br>for (x, y, w, h) in faces:<br>    cv2.rectangle(img, (x, y), (x+w, y+h), (0, 0, 255), 2)<br><br># Save the output image<br>cv2.imwrite(&quot;output.jpg&quot;, img)</pre><p>output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*ECxwMRmyHpCv5Jwf.png" /></figure><figure><img alt="image face detection in python using opencv" src="https://cdn-images-1.medium.com/max/880/0*fX3f04bfbrKqm-16.png" /></figure><p>The first step is to import the OpenCV library, and then we load the cascade classifier using the cv2.CascadeClassifier() function. We then read the input image using the cv2.imread() function, and convert it to grayscale using the cv2.cvtColor() function.</p><p>Next, we use the face_cascade.detectMultiScale() function to detect faces in the image. This function takes in the grayscale image as well as some parameters such as the scale factor and the minimum number of neighbors.</p><p>Finally, we draw rectangles around the detected faces using the cv2.rectangle() function, and save the output image using the cv2.imwrite() function.</p><p>In this way, we can use the Haar cascade classifier to detect faces in images. With OpenCV, you can do a lot more things like object detection, image stitching, and more.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef5ab918d6bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Let’s built an image generator using openai Dall-e and flask python]]></title>
            <link>https://medium.com/@kingofthepirates/lets-built-an-image-generator-using-openai-dall-e-and-flask-python-d473d46972ac?source=rss-cab76b872735------2</link>
            <guid isPermaLink="false">https://medium.com/p/d473d46972ac</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[openai]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Ashish Pandey]]></dc:creator>
            <pubDate>Sat, 14 Jan 2023 15:53:37 GMT</pubDate>
            <atom:updated>2023-01-14T15:53:37.761Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, I will show you how to use the OpenAI Image Generator in a web application built with the Flask framework. The OpenAI Image Generator is a deep learning model that can generate images from text prompts, making it a powerful tool for creating custom images for various purposes such as website backgrounds, illustrations, or even creating data sets for machine learning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SkrPnMXgI2rF1ZoO" /><figcaption>Photo by <a href="https://unsplash.com/@ninjason?utm_source=medium&amp;utm_medium=referral">Jason Leung</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The first step is to install the necessary libraries. You will need to install Flask, the web framework we will be using to build the application and openai, the python library that provides access to the OpenAI API. You can install them by running the following command:</p><pre>pip install flask openai</pre><p>Next, you will need to create a new Flask application and define a route for it. The following code sets up a basic Flask application and defines a single route that generates an image when accessed.</p><pre>from flask import Flask, render_template<br>import openai<br><br>app = Flask(__name__)<br><br># Authenticate with the OpenAI API<br>openai.api_key = &quot;Your_openai_api_key&quot; #get it here https://beta.openai.com/account/api-keys<br><br>@app.route(&#39;/&#39;)<br>def generate_image():<br>    # Specify the image prompt<br>    prompt = &quot;cat swimming in a river&quot;<br><br>    # Generate the image<br>    response = openai.Image.create(prompt=prompt, n=1, size=&quot;256x256&quot;)<br><br>    # Get the URL of the generated image<br>    image_url = response[&#39;data&#39;][0][&#39;url&#39;]<br><br>    return render_template(&#39;image.html&#39;, image_url=image_url)<br><br>if __name__ == &#39;__main__&#39;:<br>    app.run(debug=True)</pre><p>The first step is to authenticate with the OpenAI API by setting the api_key. This is a unique key that is generated when you create an account on the OpenAI website. The @app.route(‘/’) decorator is used to define the default route for the web application. When this route is accessed, the generate_image() function is called.</p><p>This function first specifies the image prompt, which is a text description of the image that the model should generate. In this example, the prompt is “cat swimming in a river”. The openai.Image.create() method is then called, passing in the prompt and other parameters such as n and size. The n parameter specifies the number of images to generate and the size parameter specifies the size of the generated images.</p><p>The response from the API is a JSON object that contains the URL of the generated image. The image_url is extracted from the response and passed to the render_template() function. This function renders the image.html template and passes the image_url to it.</p><p>Create a templates folder in the root directory and create a image.html file inside it and paste the following code. The image.html template is a simple HTML file that displays the generated image using an img tag. The src attribute of the tag is set to the image_url, so the browser will load the image from that URL.</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>  &lt;head&gt;<br>    &lt;title&gt;Generated Image&lt;/title&gt;<br>  &lt;/head&gt;<br>  &lt;body&gt;<br>    &lt;img src=&quot;{{ image_url }}&quot; alt=&quot;Generated Image&quot; /&gt;<br>  &lt;/body&gt;<br>&lt;/html&gt;</pre><p>Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0Nijmnt-NhIgdY4muS4-OQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d473d46972ac" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Solving the “Remote Origin Already Exists” Error: A Guide to Changing, Removing, and Renaming Git…]]></title>
            <link>https://medium.com/@kingofthepirates/solving-the-remote-origin-already-exists-error-a-guide-to-changing-removing-and-renaming-git-2da6fe4853f7?source=rss-cab76b872735------2</link>
            <guid isPermaLink="false">https://medium.com/p/2da6fe4853f7</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[error]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Ashish Pandey]]></dc:creator>
            <pubDate>Sat, 14 Jan 2023 12:57:06 GMT</pubDate>
            <atom:updated>2023-01-14T12:57:06.213Z</atom:updated>
            <content:encoded><![CDATA[<h3>Solving the “Remote Origin Already Exists” Error: A Guide to Changing, Removing, and Renaming Git Remotes</h3><p>Are you tired of encountering the dreaded “Remote Origin Already Exists” error when trying to push your code to GitHub? Fear not, for we have the solution to your problem!</p><p>First, let’s take a look at what causes this error. Essentially, it occurs when you try to set a new remote origin for a repository that already has one. So, how do we fix it?</p><p>Method 1: Change the remote URL</p><p>The easiest way to fix this error is to simply change the remote URL to something different. You can do this using the following command:</p><pre>git remote set-url origin [NEW URL]</pre><p>For example, if your new URL is “<a href="https://github.com/newusername/newrepo.git">https://github.com/newusername/newrepo.git</a>&quot;, you would run the following command</p><pre>git remote set-url origin https://github.com/newusername/newrepo.git</pre><p>Method 2: Remove the existing remote origin</p><p>If you don’t want to keep the existing remote origin, you can remove it with the following command:</p><pre>git remote remove origin</pre><p>Then, you can set a new remote origin with the following command:</p><pre>git remote add origin [NEW URL]</pre><p>For example, if your new URL is “<a href="https://github.com/newusername/newrepo.git">https://github.com/newusername/newrepo.git</a>&quot;, you would run the following command:</p><pre>git remote add origin https://github.com/newusername/newrepo.git</pre><p>Method 3: Rename the existing remote origin</p><p>If you want to keep the existing remote origin but just want to give it a different name, you can use the following comman</p><pre>git remote rename origin [NEW NAME]</pre><p>For example, if you want to rename the remote origin to “upstream”, you would run the following command:</p><pre>git remote rename origin upstream</pre><p>And just like that, you’ve solved the “Remote Origin Already Exists” error! Now, you can push your code to GitHub without a problem. Just remember to always double check your remote origin before pushing to avoid this error in the future.</p><p>Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2da6fe4853f7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Error Be Gone! A Comprehensive Guide on How to Solve the CORS ‘Access-Control-Allow-Origin’ Error]]></title>
            <link>https://medium.com/@kingofthepirates/error-be-gone-a-comprehensive-guide-on-how-to-solve-the-cors-access-control-allow-origin-error-9eead85c8141?source=rss-cab76b872735------2</link>
            <guid isPermaLink="false">https://medium.com/p/9eead85c8141</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[cors]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Ashish Pandey]]></dc:creator>
            <pubDate>Sat, 14 Jan 2023 07:19:59 GMT</pubDate>
            <atom:updated>2023-01-14T07:19:59.919Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*4uwUirhmPqZRBPh7tRdxsQ.png" /><figcaption>CORS error solve</figcaption></figure><p>If you’re seeing this error message, it means that the browser is blocking a request made from your website to a different domain due to a missing “Access-Control-Allow-Origin” header.</p><p>But don’t worry, there are several ways to fix this issue. Here are a few methods:</p><ol><li>Add the “Access-Control-Allow-Origin” header to the server response. In Node.js, you can do this by using the cors package:</li></ol><pre>const express = require(&#39;express&#39;)<br>const cors = require(&#39;cors&#39;)<br>const app = express()<br><br>app.use(cors())</pre><p>2. Use a proxy server to make the request. This way, the request will appear to be coming from the same domain as the server and avoid the CORS error</p><pre>const express = require(&#39;express&#39;)<br>const axios = require(&#39;axios&#39;)<br>const app = express()<br><br>app.get(&#39;/data&#39;, (req, res) =&gt; {<br>  axios.get(&#39;https://other-domain.com/data&#39;)<br>    .then(response =&gt; res.send(response.data))<br>    .catch(error =&gt; res.send(error))<br>})</pre><p>3. Use the JSONP technique. This method works by creating a script tag on the client side that points to the external resource and appending a callback function to the URL. This way, the browser will treat the response as a script rather than a resource, bypassing the CORS policy.</p><pre>&lt;script&gt;<br>  function handleResponse(data) {<br>    // do something with the data<br>  }<br>&lt;/script&gt;<br>&lt;script src=&quot;https://other-domain.com/data?callback=handleResponse&quot;&gt;&lt;/script&gt;</pre><p>4. Disable CORS altogether (Not recommended). This can be achieved by installing a browser extension like “Allow-Control-Allow-Origin: *” that allows you to disable CORS. However, this is not a recommended solution as it can leave your website vulnerable to attacks.</p><p>In conclusion, CORS errors can be a real pain, but with the right approach, they can be easily fixed. Just remember to always use the “Access-Control-Allow-Origin” header, use a proxy server, or JSONP, or disable CORS altogether. And always keep in mind security first.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9eead85c8141" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating Secure Passwords with Python and Tkinter: The “Password Generator” Code]]></title>
            <link>https://towardsdev.com/creating-secure-passwords-with-python-and-tkinter-the-password-generator-code-4b800f43ff68?source=rss-cab76b872735------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b800f43ff68</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[passwords]]></category>
            <category><![CDATA[tkinter]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Ashish Pandey]]></dc:creator>
            <pubDate>Fri, 13 Jan 2023 12:43:30 GMT</pubDate>
            <atom:updated>2023-01-18T21:24:49.158Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey guys, are you tired of coming up with new and creative passwords for all of your online accounts? Well, have no fear! The “Password Generator” is here to save the day.</p><p>code:</p><pre>import tkinter as tk<br>import random<br>import clipboard<br><br>def generate_password():<br>    length = length_var.get()<br>    include_capital_letters = capital_letters_var.get()<br>    include_special_symbols = special_symbols_var.get()<br>    include_numbers = numbers_var.get()<br>    include_small_letters = small_letters_var.get()<br><br>    password = &quot;&quot;<br>    for i in range(length):<br>        if include_capital_letters and random.random() &gt; 0.5:<br>            password += chr(random.randint(65, 90))<br>        elif include_small_letters and random.random() &gt; 0.5:<br>            password += chr(random.randint(97, 122))<br>        elif include_special_symbols and random.random() &gt; 0.5:<br>            password += chr(random.randint(33, 47))<br>        elif include_numbers and random.random() &gt; 0.5:<br>            password += chr(random.randint(48, 57))<br>        else:<br>            password += chr(random.randint(97, 122))<br><br>    password_entry.delete(0, tk.END)<br>    password_entry.insert(0, password)<br><br>def copy_password():<br>    clipboard.copy(password_entry.get())<br><br>root = tk.Tk()<br>root.title(&quot;Password Generator&quot;)<br>root.configure(bg=&#39;aqua&#39;)<br><br>length_var = tk.IntVar()<br>length_var.set(8) <br><br>capital_letters_var = tk.BooleanVar()<br>capital_letters_var.set(True)<br><br>small_letters_var = tk.BooleanVar()<br>small_letters_var.set(True)<br><br>special_symbols_var = tk.BooleanVar()<br>special_symbols_var.set(True)<br><br>numbers_var = tk.BooleanVar()<br>numbers_var.set(True)<br><br>length_label = tk.Label(root, text=&quot;Length:&quot;, font=(&quot;Helvetica&quot;, 20), bg=&#39;aqua&#39;)<br>length_label.pack()<br><br>length_entry = tk.Entry(root, textvariable=length_var, font=(&quot;Helvetica&quot;, 20))<br>length_entry.pack()<br><br>capital_letters_checkbox = tk.Checkbutton(root, text=&quot;Include capital letters&quot;, variable=capital_letters_var, font=(&quot;Helvetica&quot;, 20), bg=&#39;aqua&#39;)<br>capital_letters_checkbox.pack()<br><br>small_letters_checkbox = tk.Checkbutton(root, text=&quot;Include small letters&quot;, variable=small_letters_var, font=(&quot;Helvetica&quot;, 20), bg=&#39;aqua&#39;)<br>small_letters_checkbox.pack()<br><br>special_symbols_checkbox = tk.Checkbutton(root, text=&quot;Include special symbols&quot;, variable=special_symbols_var, font=(&quot;Helvetica&quot;, 20), bg=&#39;aqua&#39;)<br>special_symbols_checkbox.pack()<br><br>numbers_checkbox = tk.Checkbutton(root, text=&quot;Include numbers&quot;, variable=numbers_var, font=(&quot;Helvetica&quot;, 20), bg=&#39;aqua&#39;)<br>numbers_checkbox.pack()<br><br>generate_button = tk.Button(root, text=&quot;Generate Password&quot;, command=generate_password, font=(&quot;Helvetica&quot;, 20), bg=&#39;aqua&#39;)<br>generate_button.pack()<br><br>password_entry = tk.Entry(root, font=(&quot;Helvetica&quot;, 20), bg=&#39;aqua&#39;)<br>password_entry.pack()<br><br>copy_button = tk.Button(root, text=&quot;Copy to Clipboard&quot;, command=copy_password, font=(&quot;Helvetica&quot;, 20), bg=&#39;aqua&#39;)<br>copy_button.pack()<br><br>root.mainloop()</pre><p>output:</p><figure><img alt="password generator using python" src="https://cdn-images-1.medium.com/max/880/0*VuK6E9RV6JvA2re2.png" /></figure><p>This handy dandy piece of code, written in the powerful programming language Python, uses the Tkinter library to create a user-friendly interface that allows you to customize the length and character set of your new password.</p><p>But wait, there’s more! Not only does this bad boy generate a brand new, never-before-used password for you, it also has the capability to copy it straight to your clipboard. That’s right, no more manually selecting, copying, and pasting. This code does it all for you.</p><p>But don’t just take our word for it. Try it out for yourself and see the magic happen.</p><p>So don’t waste another second using “password123” or “qwerty” as your go-to password. Let the “Password Generator” handle it and sit back and relax, knowing that your online accounts are safe and secure.</p><p>In short, this code is a simple password generator with a graphical user interface which allows the user to choose the length of password and also the types of characters (capital letters, small letters, special symbols, numbers) to include in the password and copy the password to clipboard.</p><p>This code uses the Tkinter library to create a graphical user interface (GUI) for the user to interact with. The user can select the desired length of the password, and whether or not to include capital letters, small letters, special symbols, and numbers in the password.</p><p>The generate_password() function is responsible for creating the password based on the user’s selections. It uses a for loop to iterate through the desired length of the password, and within the loop, it uses a series of if/elif statements and the random module to determine which type of character (capital letter, small letter, special symbol, or number) to add to the password.</p><p>The copy_password() function is used to copy the generated password to the clipboard, so the user can easily paste it into the desired account.</p><p>Overall, this code is a simple, yet effective way to generate a secure password with the added convenience of being able to copy it to the clipboard. So, next time you need a new password, give this code a try!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b800f43ff68" width="1" height="1" alt=""><hr><p><a href="https://towardsdev.com/creating-secure-passwords-with-python-and-tkinter-the-password-generator-code-4b800f43ff68">Creating Secure Passwords with Python and Tkinter: The “Password Generator” Code</a> was originally published in <a href="https://towardsdev.com/">Towards Dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Let’s see wifi password using python]]></title>
            <link>https://towardsdev.com/lets-see-wifi-password-using-python-b5420ef6f0c7?source=rss-cab76b872735------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5420ef6f0c7</guid>
            <category><![CDATA[wifi]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Ashish Pandey]]></dc:creator>
            <pubDate>Fri, 13 Jan 2023 10:49:10 GMT</pubDate>
            <atom:updated>2023-01-13T12:48:46.741Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey guys, welcome to the world of Python and wifi hacking… just kidding! In this article, we will be taking a look at a Python script that can be used to view the Wi-Fi password for a network you are currently connected to.</p><figure><img alt="wifi password using python" src="https://cdn-images-1.medium.com/max/1024/0*npbTOHCMpeaUsgq-" /><figcaption>Photo by <a href="https://unsplash.com/@jado_tornado?utm_source=medium&amp;utm_medium=referral">Jadon Kelly</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The script uses the subprocess module to run the command netsh wlan show profile [network name] key=clear. This command retrieves information about the specified network and the stdout=subprocess.PIPE redirects the output to a variable.</p><p>The output is then decoded and stored in the output variable. After that, the script splits the output into a list of lines, and iterates through each line. If a line contains the string “Key Content”, the script extracts the wifi password from the line and prints it.</p><p>Here’s the full script for your reference:</p><pre>import subprocess<br><br>network_name = &quot;Your_Network_Name&quot;<br><br>result = subprocess.run([&#39;netsh&#39;, &#39;wlan&#39;, &#39;show&#39;, &#39;profile&#39;, network_name, &#39;key=clear&#39;], stdout=subprocess.PIPE)<br>output = result.stdout.decode()<br><br>for line in output.split(&#39;\n&#39;):<br>    if &quot;Key Content&quot; in line:<br>        print(line.split(&quot;:&quot;)[1].strip())</pre><p>As you can see, this script is quite simple and straightforward. You just need to replace “Get your own wifi” with the name of the network you want to retrieve the password for.</p><p>And that’s it, folks! With this script, you’ll be able to hack into your own wifi network and retrieve the password in case you forget it!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5420ef6f0c7" width="1" height="1" alt=""><hr><p><a href="https://towardsdev.com/lets-see-wifi-password-using-python-b5420ef6f0c7">Let’s see wifi password using python</a> was originally published in <a href="https://towardsdev.com/">Towards Dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using OpenWeatherMap API and Tkinter to create a graphical weather app]]></title>
            <link>https://towardsdev.com/creating-a-gui-weather-app-with-tkinter-and-openweathermap-api-55cf6ea92edd?source=rss-cab76b872735------2</link>
            <guid isPermaLink="false">https://medium.com/p/55cf6ea92edd</guid>
            <category><![CDATA[gui]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[tkinter]]></category>
            <dc:creator><![CDATA[Ashish Pandey]]></dc:creator>
            <pubDate>Thu, 12 Jan 2023 15:32:50 GMT</pubDate>
            <atom:updated>2023-01-16T18:27:56.049Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey guys, This short article provides a sample Python code that uses the Tkinter library to create a graphical user interface (GUI) for a weather app. The app allows users to enter a city name and retrieve weather information for that city from the OpenWeatherMap API. The GUI includes a background gradient image, a text entry field for the city name, and a button to retrieve the weather information.</p><p>Hey guys, This short article provides a sample Python code that uses the Tkinter library to create a graphical user interface (GUI) for a weather app. The app allows users to enter a city name and retrieve weather information for that city from the OpenWeatherMap API. The GUI includes a background gradient image, a text entry field for the city name, and a button to retrieve the weather information.</p><p>code:</p><pre>import tkinter as tk<br>from tkinter import messagebox<br>import requests<br>from PIL import Image, ImageTk</pre><pre>def get_weather():<br>    city = city_entry.get()<br>    api_key = &quot;your api key&quot; #go to openweather <br>    url = f&quot;https://api.openweathermap.org/data/2.5/weather?q={city}&amp;appid={api_key}&quot;</pre><pre>    # Show loading state<br>    weather_label.config(text=&quot;Loading...&quot;)<br>    icon_label.config(image=&#39;&#39;)</pre><pre>    response = requests.get(url)<br>    weather_data = response.json()<br>    if &quot;message&quot; in weather_data:<br>        messagebox.showerror(&quot;Error&quot;, weather_data[&quot;message&quot;])<br>    else:<br>        weather_text = f&quot;City: {city}\n&quot;<br>        weather_text += f&quot;Temperature: {weather_data[&#39;main&#39;][&#39;temp&#39;]}°F\n&quot;<br>        weather_text += f&quot;Pressure: {weather_data[&#39;main&#39;][&#39;pressure&#39;]} hPa\n&quot;<br>        weather_text += f&quot;Humidity: {weather_data[&#39;main&#39;][&#39;humidity&#39;]}%\n&quot;<br>        weather_text += f&quot;Min Temp: {weather_data[&#39;main&#39;][&#39;temp_min&#39;]}°F\n&quot;<br>        weather_text += f&quot;Max Temp: {weather_data[&#39;main&#39;][&#39;temp_max&#39;]}°F\n&quot;<br>        weather_text += f&quot;Wind Speed: {weather_data[&#39;wind&#39;][&#39;speed&#39;]} m/s\n&quot;<br>        weather_text += f&quot;Description: {weather_data[&#39;weather&#39;][0][&#39;description&#39;]}\n&quot;<br>        weather_text += f&quot;Sunrise: {weather_data[&#39;sys&#39;][&#39;sunrise&#39;]}\n&quot;<br>        weather_text += f&quot;Sunset: {weather_data[&#39;sys&#39;][&#39;sunset&#39;]}\n&quot;<br>        weather_label.config(text=weather_text)</pre><pre>        #update icon<br>        icon_name = weather_data[&#39;weather&#39;][0][&#39;icon&#39;]<br>        icon_url = f&quot;@2x.png&quot;&gt;http://openweathermap.org/img/wn/{icon_name}@2x.png&quot;<br>        icon_data = requests.get(icon_url)<br>        with open(&quot;icon.png&quot;, &quot;wb&quot;) as f:<br>           f.write(icon_data.content)<br>        icon_image = ImageTk.PhotoImage(Image.open(&quot;icon.png&quot;))<br>        icon_label.config(image=icon_image)<br>        icon_label.image = icon_image<br></pre><pre>root = tk.Tk()<br>root.title(&quot;Weather App&quot;)<br></pre><pre># Create gradient image<br>gradient = Image.new(&quot;RGBA&quot;, (1, root.winfo_height()), &quot;#8EC5FC&quot;)<br>pixels = gradient.load()<br>for y in range(gradient.size[1]):<br>    color = int(y / gradient.size[1] * 255), 140, 255<br>    for x in range(gradient.size[0]):<br>        pixels[x, y] = color<br>gradient = gradient.resize((root.winfo_width(), root.winfo_height()))<br>gradient = ImageTk.PhotoImage(gradient)<br></pre><pre>#Set gradient image as background<br>bg_label = tk.Label(root, image=gradient)<br>bg_label.place(relx=0, rely=0, relheight=1, relwidth=1)</pre><pre># Frame<br>frame = tk.Frame(root, bg=&#39;#80c1ff&#39;, bd=5)<br>frame.place(relx=0.5, rely=0.1, relwidth=0.75, relheight=0.1, anchor=&#39;n&#39;)</pre><pre># Entry<br>city_entry = tk.Entry(frame, font=(&quot;Courier&quot;, 14))<br>city_entry.place(relwidth=0.65, relheight=1)<br>city_entry.insert(0, &quot;Washington D.C.&quot;)</pre><pre># Get Weather button<br>get_weather_button = tk.Button(frame, text=&quot;Get Weather&quot;, font=(&quot;Courier&quot;, 12), command=get_weather)<br>get_weather_button.place(relx=0.7, relwidth=0.3, relheight=1)</pre><pre># Weather label<br>weather_frame = tk.Frame(root, bg=&#39;#80c1ff&#39;, bd=10)<br>weather_frame.place(relx=0.5, rely=0.3, relwidth=0.75, relheight=0.5, anchor=&#39;n&#39;)<br>weather_label = tk.Label(weather_frame, font=(&quot;Courier&quot;, 14), justify=&#39;left&#39;, bd=5)<br>weather_label.place(relwidth=1, relheight=1)</pre><pre># Weather icon<br>icon_frame = tk.Frame(weather_frame, bg=&#39;#80c1ff&#39;)<br>icon_label = tk.Label(icon_frame)<br>icon_label.place(relx=0.5, rely=0.5, anchor=&#39;center&#39;)<br>icon_frame.place(relx=0.8, rely=0.3, relwidth=0.2, relheight=0.4, anchor=&#39;n&#39;)</pre><pre>root.mainloop()</pre><p>output:</p><figure><img alt="weather app using python" src="https://cdn-images-1.medium.com/max/880/0*avaOqRQ-YnSDcxmR.PNG" /></figure><p>The code starts by importing the necessary libraries, including Tkinter, messagebox, requests, and PIL. The get_weather() function is defined next, which is called when the user clicks the “Get Weather” button. The function first retrieves the city name from the text entry field and constructs the URL for the OpenWeatherMap API request. It then sends the request and retrieves the weather data in the form of a JSON object.</p><p>If the response includes an error message, the code shows an error message dialog box. Otherwise, it parses the JSON data to extract the weather information and displays it in a label on the GUI. The code also retrieves the weather icon from the OpenWeatherMap API and displays it on the GUI.</p><p>The remaining code creates the GUI elements, including the background gradient image, frame, entry field, and buttons. The resulting weather app provides a simple and easy-to-use interface for retrieving weather information for a given city.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=55cf6ea92edd" width="1" height="1" alt=""><hr><p><a href="https://towardsdev.com/creating-a-gui-weather-app-with-tkinter-and-openweathermap-api-55cf6ea92edd">Using OpenWeatherMap API and Tkinter to create a graphical weather app</a> was originally published in <a href="https://towardsdev.com/">Towards Dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Chatgpt Designing ChatGPT’s Matrix-inspired Interface]]></title>
            <link>https://towardsdev.com/chatgptdesigning-chatgpts-matrix-inspired-interface-b99626d860bf?source=rss-cab76b872735------2</link>
            <guid isPermaLink="false">https://medium.com/p/b99626d860bf</guid>
            <category><![CDATA[matrix]]></category>
            <category><![CDATA[interfaces]]></category>
            <category><![CDATA[simulation]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[design]]></category>
            <dc:creator><![CDATA[Ashish Pandey]]></dc:creator>
            <pubDate>Thu, 12 Jan 2023 07:34:35 GMT</pubDate>
            <atom:updated>2023-01-12T13:06:20.064Z</atom:updated>
            <content:encoded><![CDATA[<p>Do You want your chatgpt to look like like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*Pr1ZmJlMzDRa5h98.png" /></figure><p>then follow this link: <a href="https://github.com/Pandeyashish17/ChatGPT-Matrix-Style">https://github.com/Pandeyashish17/ChatGPT-Matrix-Style</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b99626d860bf" width="1" height="1" alt=""><hr><p><a href="https://towardsdev.com/chatgptdesigning-chatgpts-matrix-inspired-interface-b99626d860bf">Chatgpt Designing ChatGPT’s Matrix-inspired Interface</a> was originally published in <a href="https://towardsdev.com/">Towards Dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>