<?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 Parvez Alam on Medium]]></title>
        <description><![CDATA[Stories by Parvez Alam on Medium]]></description>
        <link>https://medium.com/@parvez1487?source=rss-853b1db2fffc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Gm3pBOfkP8AuAkocHtSogg.png</url>
            <title>Stories by Parvez Alam on Medium</title>
            <link>https://medium.com/@parvez1487?source=rss-853b1db2fffc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 06:02:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@parvez1487/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[Implementing Computed Properties in Vue.js]]></title>
            <link>https://parvez1487.medium.com/implementing-computed-properties-in-vue-js-997bd3a5679b?source=rss-853b1db2fffc------2</link>
            <guid isPermaLink="false">https://medium.com/p/997bd3a5679b</guid>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[computed]]></category>
            <dc:creator><![CDATA[Parvez Alam]]></dc:creator>
            <pubDate>Sun, 10 Mar 2024 11:17:30 GMT</pubDate>
            <atom:updated>2024-03-10T11:32:46.453Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-BT6wi7cfHbxAgmO.jpg" /></figure><p>This tutorial helps to understand <strong>vuejs computed with examples</strong>. The vuejs computed offer you a clear method for extracting new data from attributes that already exist, so you can maintain organized and effective templates.</p><h3>What’s vuejs computed</h3><p>Properties that are derived from one or more other properties in Vue.js are called computed properties. <a href="https://vuejs.org/guide/essentials/computed.html">vue computed</a> has inbuilt computed() method that takes a getter function, and the returned value is a computed ref.<br>if you attempt to assign a new value to a computed property, you will receive a runtime warning. A computed property automatically tracks its reactive dependencies.</p><h3>Usage of Computed Properties</h3><p>You can use Vuejs computed properties where you need to derive or transform data based on other reactive data properties. The following are common use cases for computed properties:</p><ul><li>Formatting data for display (e.g., date formatting, currency formatting).</li><li>Filtering or sorting lists based on certain criteria.</li><li>Performing calculations based on input data.</li><li>Conditionally rendering elements based on data state.</li></ul><blockquote><em>Checkout Other vuejs tutorials:</em></blockquote><h3>Simple Example of vuejs computed</h3><p>Let’s create an example of an employee module in a Vue.js application where we utilize computed properties to calculate the monthly salary of an employee based on their hourly wage and the number of hours worked.</p><h3>Non-Computed Approach</h3><p>In this approach, we will calculate the total salary of an employee without using computed properties. Instead, we will manually update the total salary whenever individual salary components change.</p><pre>&lt;!DOCTYPE html&gt; &lt;html lang=&quot;en&quot;&gt; &lt;head&gt; &lt;meta charset=&quot;UTF-8&quot;&gt; &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt; &lt;title&gt;Employee Module without Vue.js Computed&lt;/title&gt; &lt;!-- Include Vue.js library --&gt; &lt;script src=&quot;https://cdn.jsdelivr.net/npm/vue@2&quot;&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id=&quot;app&quot;&gt; &lt;h1&gt;Employee Module&lt;/h1&gt; &lt;!-- Employee Form --&gt; &lt;form @submit.prevent=&quot;calculateSalary&quot;&gt; &lt;label for=&quot;name&quot;&gt;Employee Name:&lt;/label&gt; &lt;input type=&quot;text&quot; id=&quot;name&quot; v-model=&quot;employee.name&quot; required&gt;&lt;br&gt;&lt;br&gt; &lt;label for=&quot;hourlyWage&quot;&gt;Hourly Wage:&lt;/label&gt; &lt;input type=&quot;number&quot; id=&quot;hourlyWage&quot; v-model.number=&quot;employee.hourlyWage&quot; required&gt;&lt;br&gt;&lt;br&gt; &lt;label for=&quot;hoursWorked&quot;&gt;Hours Worked:&lt;/label&gt; &lt;input type=&quot;number&quot; id=&quot;hoursWorked&quot; v-model.number=&quot;employee.hoursWorked&quot; required&gt;&lt;br&gt;&lt;br&gt; &lt;button type=&quot;submit&quot;&gt;Calculate Salary&lt;/button&gt; &lt;/form&gt; &lt;!-- Display Salary --&gt; &lt;div v-if=&quot;employee.monthlySalary !== null&quot;&gt; &lt;h2&gt;Employee Information&lt;/h2&gt; &lt;p&gt;Name: {{ employee.name }}&lt;/p&gt; &lt;p&gt;Hourly Wage: ${{ employee.hourlyWage }}&lt;/p&gt; &lt;p&gt;Hours Worked: {{ employee.hoursWorked }}&lt;/p&gt; &lt;h2&gt;Monthly Salary&lt;/h2&gt; &lt;p&gt;${{ employee.monthlySalary }}&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;script&gt; new Vue({ el: &#39;#app&#39;, data: { employee: { name: &#39;&#39;, hourlyWage: 0, hoursWorked: 0, monthlySalary: null } }, methods: { calculateSalary() { // Calculate monthly salary based on hourly wage and hours worked this.employee.monthlySalary = this.employee.hourlyWage * this.employee.hoursWorked * 4; // Assuming 4 weeks in a month } } }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt;</pre><h3>Vuejs Computed Approach</h3><p>We will use computed properties to automatically calculate the total salary whenever any of the salary components change.</p><pre>&lt;!DOCTYPE html&gt; &lt;html lang=&quot;en&quot;&gt; &lt;head&gt; &lt;meta charset=&quot;UTF-8&quot;&gt; &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt; &lt;title&gt;Employee Module with Vue.js Computed&lt;/title&gt; &lt;!-- Include Vue.js library --&gt; &lt;script src=&quot;https://cdn.jsdelivr.net/npm/vue@2&quot;&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id=&quot;app&quot;&gt; &lt;h1&gt;Employee Module&lt;/h1&gt; &lt;!-- Employee Form --&gt; &lt;form @submit.prevent=&quot;calculateSalary&quot;&gt; &lt;label for=&quot;name&quot;&gt;Employee Name:&lt;/label&gt; &lt;input type=&quot;text&quot; id=&quot;name&quot; v-model=&quot;employee.name&quot; required&gt;&lt;br&gt;&lt;br&gt; &lt;label for=&quot;hourlyWage&quot;&gt;Hourly Wage:&lt;/label&gt; &lt;input type=&quot;number&quot; id=&quot;hourlyWage&quot; v-model.number=&quot;employee.hourlyWage&quot; required&gt;&lt;br&gt;&lt;br&gt; &lt;label for=&quot;hoursWorked&quot;&gt;Hours Worked:&lt;/label&gt; &lt;input type=&quot;number&quot; id=&quot;hoursWorked&quot; v-model.number=&quot;employee.hoursWorked&quot; required&gt;&lt;br&gt;&lt;br&gt; &lt;button type=&quot;submit&quot;&gt;Calculate Salary&lt;/button&gt; &lt;/form&gt; &lt;!-- Display Salary --&gt; &lt;div v-if=&quot;employee.monthlySalary !== null&quot;&gt; &lt;h2&gt;Employee Information&lt;/h2&gt; &lt;p&gt;Name: {{ employee.name }}&lt;/p&gt; &lt;p&gt;Hourly Wage: ${{ employee.hourlyWage }}&lt;/p&gt; &lt;p&gt;Hours Worked: {{ employee.hoursWorked }}&lt;/p&gt; &lt;h2&gt;Monthly Salary&lt;/h2&gt; &lt;p&gt;${{ employee.monthlySalary }}&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;script&gt; new Vue({ el: &#39;#app&#39;, data: { employee: { name: &#39;&#39;, hourlyWage: 0, hoursWorked: 0, monthlySalary: null } }, methods: { calculateSalary() { // Calculate monthly salary based on hourly wage and hours worked this.employee.monthlySalary = this.employee.hourlyWage * this.employee.hoursWorked * 4; // Assuming 4 weeks in a month } }, computed: { // Computed property to check if all required fields are filled isFormValid() { return this.employee.name !== &#39;&#39; &amp;&amp; this.employee.hourlyWage &gt; 0 &amp;&amp; this.employee.hoursWorked &gt; 0; } } }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt;</pre><p><strong>in the above code:</strong></p><p><strong>Step 1:</strong> The user fills out a form with the employee’s name, hourly wage, and hours worked.<br><strong>Step 2:</strong> The calculateSalary method is triggered upon submission of the form. It computes the monthly salary by multiplying the hourly wage by the number of hours worked, based on a monthly assumption of four weeks.<br><strong>Step 3:</strong> The calculated monthly salary is displayed below the form.<br><strong>Step 4:</strong> We have computed the property isFormValid which checks if all required fields are filled. This computed property could be used for form validation or enabling/disabling the submit button based on the form’s validity.</p><h3>Conclusion</h3><p>Computed properties in Vue.js are an important feature that makes working with data easier and improves responsiveness in Vue.js apps. You can use compute properties to format data, perform calculations, or conditionally render elements</p><p><em>Originally published at </em><a href="https://www.js-tutorials.com/vue-js-tutorial/implementing-computed-properties-in-vue-js/"><em>https://www.js-tutorials.com</em></a><em> on March 10, 2024.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=997bd3a5679b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Utilizing Unsplash API for Image Search in Python — pythonpip.com]]></title>
            <link>https://parvez1487.medium.com/utilizing-unsplash-api-for-image-search-in-python-pythonpip-com-95f2d54cf026?source=rss-853b1db2fffc------2</link>
            <guid isPermaLink="false">https://medium.com/p/95f2d54cf026</guid>
            <category><![CDATA[ｐｙｔｈｏｎ]]></category>
            <category><![CDATA[python-programming]]></category>
            <dc:creator><![CDATA[Parvez Alam]]></dc:creator>
            <pubDate>Sat, 09 Mar 2024 17:00:02 GMT</pubDate>
            <atom:updated>2024-03-09T17:02:49.499Z</atom:updated>
            <content:encoded><![CDATA[<h3>Utilizing Unsplash API for Image Search in Python — pythonpip.com</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7A4Gxd2qYB4fK2SB.jpg" /></figure><p>in this Python article, We’ll discuss creating an Image Search App with Python and Unsplash API. This is a very common functionality in any web application. that provides functionality to search an image from a image library.</p><p>An image search application provides users with the ability to find images based on various criteria such as keywords, image content, or even web links to images.</p><h3>Pre-Requisite:</h3><h3>Image Search with Python &amp; Flask</h3><p>Let’s create a user-friendly interface for searching images by keyword and implement the image search functionality using the Unsplash API with Python and Flask.</p><h3>Create Project and Module Installation</h3><p>Create a sample Python project &#39;image-search-using-python&#39;, which will hold all our project files:</p><pre>$ mkdir image-search-using-python</pre><p>navigate to image-search-using-python</p><pre>$ cd image-search-python-flask</pre><p>Let’s install the required modules for our application. we’ll install the Flask micro-framework by using the following command:</p><h3>Create Flask Application</h3><p>Create a Python file named &quot;app.py&quot; for our project and import the required modules:</p><pre>from flask import Flask, render_template, request, redirect, url_for import sys import os import requests configure flaask aapp and run it on defualt port: app = Flask(__name__) app.secret_key = &#39;1234567890&#39; if __name__ == &#39;__main__&#39;: app.run()</pre><h3>Create Image Search Form UI:</h3><p>Next, create a template file for our Flask application. Within a <strong>“templates”</strong> directory in our project, create an &quot;index.html&quot; template file. Construct a search form allowing users to input keywords:</p><pre>&lt;!DOCTYPE html&gt; &lt;html lang=&quot;en&quot;&gt; &lt;head&gt; &lt;meta charset=&quot;UTF-8&quot;&gt; &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt; &lt;title&gt;Image Search App Python&lt;/title&gt; &lt;link rel=&quot;stylesheet&quot; href=&quot;https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css&quot;&gt; &lt;/head&gt; &lt;body&gt; &lt;div class=&quot;container&quot;&gt; &lt;div class=&quot;row&quot;&gt; &lt;div class=&quot;col-md-6 mx-auto&quot;&gt;&lt;br&gt; &lt;h1&gt;Image Search App Python&lt;/h1&gt;&lt;br&gt; &lt;form method=&quot;POST&quot; class=&quot;&quot;&gt; {% if message %} &lt;div class=&quot;alert alert-warning&quot;&gt;{{ message }}&lt;/div&gt; {% endif %} &lt;div class=&quot;form-group&quot;&gt; &lt;label&gt;Enter Keyword : &lt;/label&gt;&lt;br /&gt; &lt;input type=&quot;text&quot; value=&quot;{{ searchQuery }}&quot; class=&quot;form-control&quot; name=&quot;searchQuery&quot; placeholder=&quot;enter keywords ...&quot;&gt; &lt;/div&gt; &lt;br&gt; &lt;button type=&quot;submit&quot; class=&quot;btn btn-primary&quot;&gt;Search&lt;/button&gt; &lt;/form&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt;</pre><h3>Image Search with Unsplash API</h3><p>Now, I’ll create the &quot;index()&quot; method in &quot;app.py&quot; file to facilitate image searches based on user-inputted keywords. Once the form has been submitted, We retrieve the keyword and make a request to the Unsplash API to search for images:</p><pre>@app.route(&#39;/&#39;, methods=[&#39;GET&#39;, &#39;POST&#39;]) def index(): searchResult = &#39;&#39; message = &#39;&#39; searchQuery = &#39;&#39; clientId = &#39;your_client_id_here&#39; # Replace with your actual client ID if request.method == &#39;POST&#39;: searchQuery = str(request.form.get(&#39;searchQuery&#39;, &#39;&#39;)) if searchQuery: apiUrl = &#39;https://api.unsplash.com/search/photos&#39; params = {&#39;query&#39;: searchQuery, &#39;client_id&#39;: clientId} response = requests.get(apiUrl, params=params, allow_redirects=True) searchResult = response.json() else: message = &#39;Please enter search keyword&#39; return render_template(&#39;index.html&#39;, message=message, searchQuery=searchQuery, searchResult=searchResult)</pre><p>Make sure to replace &#39;your_client_id_here&#39; with your actual obtained from Unsplash API</p><h3>Display Image Search Result:</h3><p>Finally, in the index.html template file, display the search results:</p><pre>&lt;!-- Image Search Results Section --&gt; &lt;main&gt; &lt;section id=&quot;imgs&quot; class=&quot;pt-5&quot;&gt; &lt;div class=&quot;container&quot;&gt; &lt;div class=&quot;row g-4&quot; id=&quot;inputResults&quot;&gt; {% if searchResult %} {% for image in searchResult.results %} &lt;div class=&quot;col-md-6 col-lg-4&quot;&gt; &lt;div class=&quot;card searchImg&quot;&gt; &lt;div id=&quot;cardImg&quot;&gt; &lt;img src=&quot;{{ image.urls.small }}&quot; class=&quot;card-img-top&quot; alt=&quot;&quot;&gt; &lt;/div&gt; &lt;div class=&quot;card-body&quot;&gt; &lt;a href=&quot;{{ image.links.html }}&quot; class=&quot;card-text&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;View Image&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; {% endfor %} {% endif %} &lt;/div&gt; &lt;/div&gt; &lt;/section&gt; &lt;/main&gt;</pre><p>The above code will display image search results accordingly.</p><h3>Conclusion</h3><p>We have created an awesome tool to search images based on inputted search keywords By Flask and Unsplash API. We have also created ui to display filtered images in the container. You can use this functionality in any place of application where do you need to insert images or manage the image library.</p><p><em>Originally published at </em><a href="https://www.pythonpip.com/python-tutorials/utilizing-unsplash-api-for-image-search-in-python/"><em>https://www.pythonpip.com</em></a><em> on March 9, 2024.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95f2d54cf026" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is the Purpose of php_eol in PHP? — Phpflow.com]]></title>
            <link>https://parvez1487.medium.com/what-is-the-purpose-of-php-eol-in-php-phpflow-com-36fb5d07cbee?source=rss-853b1db2fffc------2</link>
            <guid isPermaLink="false">https://medium.com/p/36fb5d07cbee</guid>
            <category><![CDATA[php]]></category>
            <dc:creator><![CDATA[Parvez Alam]]></dc:creator>
            <pubDate>Sun, 03 Mar 2024 07:14:53 GMT</pubDate>
            <atom:updated>2024-03-03T07:19:14.807Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is the Purpose of php_eol in PHP? — Phpflow.com</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fIVz2XCcm1t8Rt42.jpg" /></figure><p>in this quick PHP tutorial, We’ll discuss php_eol with examples. <a href="https://www.php.net/manual/en/reserved.constants.php#constant.php-eol">PHP_EOL</a> is a predefined constant in PHP and represents an end-of-line character. It helps in dealing with text file I/O operations in PHP.</p><p>Linux and macOS represent the end-of-line marker by the newline character (\n), whereas Windows environments are represented by a combination of two characters a newline (\r\n).</p><blockquote><em>Also checkout other related tutorials,</em></blockquote><p><a href="https://www.phpflow.com/php/php-merging-two-arrays-using-array_merge/">Merge Two Array or Multiple Array in PHP</a><br><a href="https://www.phpflow.com/php/how-to-convert-xml-to-associative-array/">How To Convert XML To Associative Array in PHP</a></p><ul><li>Unix-based systems (e.g., <strong>Linux</strong>, <strong>macOS</strong>) typically use the newline character (\n) to represent the end of a line.</li><li>Windows uses a combination of newline (\r\n) sequence.</li><li>Classic Mac OS (pre-OS X) historically used only the carriage return (\r) character.</li></ul><p><a href="https://www.phpflow.com/php/remove-duplicates-from-multidimensional-array/">Remove Duplicates From Multidimensional Array</a><br><a href="https://www.phpflow.com/php/how-to-convert-xsd-into-array-using-php/">How To Convert XSD into Array Using PHP</a></p><p>There are the following end-line characters used by the platform:</p><h3>Writing to Files:</h3><p>Let’s write a file that has two dummy lines and will use <strong>PHP_EOL</strong>, The <strong>PHP_EOL</strong> will add end-of-line marker based on the Operating system where the script is running.</p><pre>$file = fopen(&#39;phpflow.txt&#39;, &#39;w&#39;); fwrite($file, &#39;Line 1&#39; . PHP_EOL); fwrite($file, &#39;Line 2&#39; . PHP_EOL); fclose($file);</pre><p>The above code will write two lines of text to a file named &#39;phpflow.txt&#39;.</p><h3>Concatenating Strings</h3><p>We can also use PHP_EOL constant to concatenate <strong>‘Hello’</strong> and <strong>‘World’</strong> with the appropriate line break between them.</p><pre>$message = &#39;Hello&#39; . PHP_EOL . &#39;World&#39;; echo $message;</pre><h3>PHP_EOL with Heredoc or Nowdoc Syntax:</h3><p>We can also use php_eol constant with heredoc and newdoc.</p><pre>$text = &lt;&lt;&lt;EOT This is a multiline string. It spans multiple lines. And ends here. EOT; echo $text . PHP_EOL;</pre><h3>Conclusion</h3><p>We have discussed different scenarios to apply <strong>PHP_EOL</strong> with PHP application. You can add an end-line marker into your string into a text regardless of platform. You can create strings/file by using php_eol and it’ll apply end-of-line characters based on PHP platform environment. It helps to write cross-platform code that helps end-of-line endings.</p><p><em>Originally published at </em><a href="https://www.phpflow.com/php/what-is-the-purpose-of-php_eol-in-php/"><em>https://www.phpflow.com</em></a><em> on March 3, 2024.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=36fb5d07cbee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Can I Generate QR Codes with Python & Flask? — pythonpip.com]]></title>
            <link>https://parvez1487.medium.com/how-can-i-generate-qr-codes-with-python-flask-pythonpip-com-7a7bdc4a4df1?source=rss-853b1db2fffc------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a7bdc4a4df1</guid>
            <category><![CDATA[python-programming]]></category>
            <dc:creator><![CDATA[Parvez Alam]]></dc:creator>
            <pubDate>Sun, 03 Mar 2024 01:41:03 GMT</pubDate>
            <atom:updated>2024-03-03T01:41:22.874Z</atom:updated>
            <content:encoded><![CDATA[<h3>How Can I Generate QR Codes with Python &amp; Flask? — pythonpip.com</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JxHGa2ZYaieWlMSl.jpg" /></figure><p>in this tutorial, We’ll explore <strong>how to generate QR code Using Python</strong>. I am using Flask framework to create UI. We’ll walk through the steps to build a QR code generator using Python and Flask.</p><p>Python is a popular and widely used programming language known for its simplicity and readability. Flask, a lightweight Python web framework, developers can create web apps quickly and effectively.</p><h3>What is a QR Code</h3><p>The Quick Response (QR) codes have become an integral part of our daily lives. We utilize QR codes for various purposes such as making payments, redeeming offers, downloading apps, and booking tickets</p><h3>QR Code Generate Using Python</h3><p>Let’s develop a project to generate custom QR codes using Python and flask.</p><h3>Setting Up the Environment</h3><p>Create a project directory named generate-qrcode-python and install the necessary modules by running the following command:</p><pre>pip install Flask pip install qrcode</pre><p>The above command will install <strong>qrcode</strong> Python module, which is used to generate QR codes, also installed Flask, which is a micro-framework for web applications.</p><h3>Create Flask Application</h3><p>We’ll then develop the primary Flask application. Import the necessary modules and define the Flask application in a file called app.py. We’ll configure a process to manage form submissions and generate an HTML template that will provide the user interface for the QR code generator.</p><pre>from flask import Flask, render_template, request from main import generateQRCode app = Flask(__name__) @app.route(&#39;/&#39;, methods=[&#39;GET&#39;, &#39;POST&#39;]) def index(): generatedCode = &#39;&#39; message = &#39;&#39; if request.method == &#39;POST&#39;: qrSt = str(request.form[&#39;qrSt&#39;]) if qrSt: generatedCode = generateQRCode(qrSt) else: message = &#39;Please enter text to generate code&#39; return render_template(&#39;index.html&#39;, message=message, generatedCode=generatedCode) if __name__ == &#39;__main__&#39;: app.run()</pre><h3>Create a QR Code Generator Function</h3><p>Now, let’s create a separate file named main.py to implement the QR code generation functionality. We’ll use the <strong>qrcode</strong> module to generate the QR code image and convert it to a base64-encoded string for displaying in the browser.</p><pre>import qrcode from io import BytesIO import base64 def generateQRCode(text: str, img_name: str = &#39;QRCode.png&#39;) -&gt; any: code = qrcode.QRCode( version=1, box_size=10, border=4 ) code.add_data(text) code.make(fit=True) img = code.make_image(fill_color=&#39;black&#39;, back_color=&#39;white&#39;) buffer = BytesIO() img.save(buffer, format=&quot;PNG&quot;) qrCode = f&quot;data:image/png;base64,{base64.b64encode(buffer.getvalue()).decode()}&quot; return qrCode</pre><h3>Creating the HTML Template</h3><p>Finally, let’s create an HTML template named index.html to display the user interface for our QR code generator. This template includes a form for entering text to be encoded into a QR code and displays the <strong>generated QR code</strong> image.</p><pre>&lt;!DOCTYPE html&gt; &lt;html lang=&quot;en&quot;&gt; &lt;head&gt; &lt;meta charset=&quot;UTF-8&quot;&gt; &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt; &lt;title&gt;QR Code Generator&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;div class=&quot;container&quot;&gt; &lt;div class=&quot;row&quot;&gt; &lt;div class=&quot;col-md-6 mx-auto&quot;&gt;&lt;br&gt; &lt;h1&gt;QR Code Generator&lt;/h1&gt;&lt;br&gt; &lt;form method=&quot;POST&quot; class=&quot;&quot;&gt; {% if message %} &lt;div class=&quot;alert alert-warning&quot;&gt;{{ message }}&lt;/div&gt; {% endif %} &lt;div class=&quot;form-group&quot;&gt; &lt;label&gt;Enter Text to Generate QR Code:&lt;/label&gt;&lt;br /&gt; &lt;input type=&quot;text&quot; class=&quot;form-control&quot; name=&quot;codeText&quot; placeholder=&quot;Enter text here...&quot;&gt; &lt;/div&gt; &lt;br&gt; &lt;button type=&quot;submit&quot; class=&quot;btn btn-primary&quot;&gt;Generate QR Code&lt;/button&gt; &lt;/form&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class=&quot;container mt-5&quot;&gt; &lt;div class=&quot;row justify-content-center&quot;&gt; &lt;div class=&quot;col-md-6&quot;&gt; {% if generatedCode %} &lt;div class=&quot;qr-code-container text-center p-4 rounded border bg-light&quot;&gt; &lt;div class=&quot;alert alert-primary alert-dismissible fade show mb-3 text-center&quot; role=&quot;alert&quot;&gt; You can download the image by clicking on it. &lt;/div&gt; &lt;a href=&quot;{{ generatedCode }}&quot; download=&quot;qrcode.png&quot;&gt; &lt;img src=&quot;{{ generatedCode }}&quot; alt=&quot;QR Code&quot; class=&quot;img-fluid rounded&quot;&gt; &lt;/a&gt; &lt;/div&gt; {% endif %} &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt;</pre><h3>Conclusion</h3><p>Hurry! You’ve successfully built a QR code generator using Python and Flask. You’ve learned how to create a simple yet powerful script for generating custom QR codes in this article by using Python’s QR code module and Flask’s web framework.</p><p><em>Originally published at </em><a href="https://www.pythonpip.com/python-tutorials/how-can-i-generate-qr-codes-with-python-flask/"><em>https://www.pythonpip.com</em></a><em> on March 3, 2024.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a7bdc4a4df1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Laravel Table Relationship Methods With Example — Phpflow.com]]></title>
            <link>https://parvez1487.medium.com/laravel-table-relationship-methods-with-example-phpflow-com-aea87ce132e5?source=rss-853b1db2fffc------2</link>
            <guid isPermaLink="false">https://medium.com/p/aea87ce132e5</guid>
            <category><![CDATA[laravel]]></category>
            <dc:creator><![CDATA[Parvez Alam]]></dc:creator>
            <pubDate>Thu, 29 Feb 2024 05:18:06 GMT</pubDate>
            <atom:updated>2024-02-29T05:23:45.658Z</atom:updated>
            <content:encoded><![CDATA[<h3>Laravel Table Relationship Methods With Example — Phpflow.com</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XOExmkTP07_2R2ie.jpg" /></figure><p>This Laravel tutorial helps to understand table Relationships using Elequonte ORM. We’ll explore laravel table Relationships usage and best practices with examples.</p><h3>Understanding Laravel Table Relationships</h3><p>There are the following types of table relationships supported by Laravel:</p><ul><li>One-to-One</li><li>One-to-Many</li><li>Many-to-One (Inverse of One-to-Many)</li><li>Many-to-Many</li></ul><p>Let’s assume you have an <strong>“employees”</strong> and a <strong>“departments”</strong> table, and you want to perform a join operation using Laravel’s Eloquent ORM. Define the relationship between Employee and Department models:</p><pre>namespace App\Models; use Illuminate\Database\Eloquent\Model; class Employee extends Model { public function department() { return $this-&gt;belongsTo(Department::class); } } class Department extends Model { public function employees() { return $this-&gt;hasMany(Employee::class); } }</pre><h3>One-to-One Relationship</h3><p>This relationship associated each record in one table with exactly one record in another table.</p><pre>class Employee extends Model { public function department() { return $this-&gt;hasOne(Department::class); } } class Department extends Model { public function employee() { return $this-&gt;belongsTo(Employee::class); } }</pre><h3>One-to-Many Relationship:</h3><p>A one-to-many relationship signifies that each record in one table can be associated with multiple records in another table.</p><pre>class Department extends Model { public function employees() { return $this-&gt;hasMany(Employee::class); } } class Employee extends Model { public function department() { return $this-&gt;belongsTo(Department::class); } }</pre><h3>Many-to-Many Relationship:</h3><p>A many-to-many relationship associates each record in one table with multiple records in another table, and vice versa.</p><pre>class Employee extends Model { public function departments() { return $this-&gt;belongsToMany(Department::class); } } class Department extends Model { public function employees() { return $this-&gt;belongsToMany(Employee::class); } }</pre><p>Employees may belong to multiple departments, and departments may have multiple employees.</p><h3>Conclusion</h3><p>The table relationship methods provide a powerful mechanism for managing data associations between database tables. You can define different associations between tables and use the power of Laravel’s Eloquent ORM.</p><p><em>Originally published at </em><a href="https://www.phpflow.com/laravel/laravel-table-relationship-methods-with-example/"><em>https://www.phpflow.com</em></a><em> on February 29, 2024.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aea87ce132e5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Convert Python Datetime to String? — pythonpip.com]]></title>
            <link>https://parvez1487.medium.com/how-to-convert-python-datetime-to-string-pythonpip-com-965f5f6662b0?source=rss-853b1db2fffc------2</link>
            <guid isPermaLink="false">https://medium.com/p/965f5f6662b0</guid>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Parvez Alam]]></dc:creator>
            <pubDate>Mon, 26 Feb 2024 17:04:01 GMT</pubDate>
            <atom:updated>2024-02-26T17:21:52.531Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to Convert Python Datetime to String? — pythonpip.com</h3><p>in this python tutorial, I’ll explore ways to convert DateTime object to string. I have already shared an tutorial <a href="https://www.pythonpip.com/python-tutorials/convert-string-to-datetime-in-python/">Convert string to DateTime in Python</a>.</p><p>We’ll use the strftime() method to convert <strong>Datetime</strong> into string in Python. This method is part of Python datetime module, it provides classes for manipulating dates and times.</p><h3>Convert datetime object to a string</h3><p>The Python datetime module includes strftime() method to convert a datetime object to a string. This method allows you to specify the format of the output string.</p><pre>from datetime import datetime # Assuming you have a datetime object dt = datetime.now() # Convert datetime to string date_string = dt.strftime(&quot;%Y-%m-%d %H:%M:%S&quot;) print(&quot;Datetime to string:&quot;, date_string)</pre><p>The strftime() method are having the following parameters:</p><ul><li>%Y represents the year (four digits)</li><li>%m represents the month (zero-padded)</li><li>%d represents the day of the month (zero-padded)</li><li>%H represents the hour (24-hour clock, zero-padded)</li><li>%M represents the minute (zero-padded)</li><li>%S represents the second (zero-padded)</li></ul><h3>Datetime object to a string in Python</h3><p>Python provides the <strong>pytz</strong> library for timezone support. You can use <strong>pytz</strong> with datetime objects to represent timezones and perform conversions between different timezones.</p><pre>import pytz from datetime import datetime dt = datetime.now(pytz.timezone(&#39;America/New_York&#39;)) date_string = dt.strftime(&quot;%Y-%m-%d %H:%M:%S %Z&quot;) print(&quot;Datetime with timezone to string:&quot;, date_string)</pre><p>%Z represents the timezone name.</p><h3>Conver DateTime object to a string Using the arrow</h3><p>Arrow library provides a format() method, that can be used to convert an Arrow object to a string with a specified format.</p><pre>import arrow dt = arrow.now() date_string = dt.format(&quot;YYYY-MM-DD HH:mm:ss&quot;)</pre><h3>Convert Datetime object to a string Using dateutil</h3><p>The dateutil library provides the parser.parse() function, which can parse a wide range of date and time formats and return a datetime object. You can then use the strftime() method to convert the datetime object to a string.</p><pre>from dateutil import parser date_string = &quot;2024-02-26 15:30:00&quot; parsed_datetime = parser.parse(date_string) formatted_string = parsed_datetime.strftime(&quot;%Y-%m-%d %H:%M:%S&quot;)</pre><h3>Conclusion</h3><p>We have learned different ways to convert datetime objects to strings. We have explored strftime() method, along with other libraries like <strong>pytz</strong>, <strong>dateutil</strong>, and <strong>Arrow</strong>, that are used to convert DateTime objects into strings.</p><p><em>Originally published at </em><a href="https://www.pythonpip.com/python-tutorials/how-to-convert-python-datetime-to-string/"><em>https://www.pythonpip.com</em></a><em> on February 26, 2024.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=965f5f6662b0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What Are Vue.js Watchers and How Do They Work?]]></title>
            <link>https://parvez1487.medium.com/what-are-vue-js-watchers-and-how-do-they-work-cdec24f11d68?source=rss-853b1db2fffc------2</link>
            <guid isPermaLink="false">https://medium.com/p/cdec24f11d68</guid>
            <category><![CDATA[vue]]></category>
            <dc:creator><![CDATA[Parvez Alam]]></dc:creator>
            <pubDate>Sun, 25 Feb 2024 04:28:27 GMT</pubDate>
            <atom:updated>2024-02-25T04:31:47.196Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/560/0*eLqjrbpiAncrH5OQ.png" /></figure><p>in this tutorial, We’ll explore Vue.js watchers with examples. I will cover here syntax, usage, benefits, and advanced techniques to use it. The watch function is used to trigger a callback whenever a piece of reactive state changes.</p><h3>What is a Vue.js Watcher</h3><p>A watcher is a useful feature that allows us to monitor an application state and trigger actions based on these changes. You can also access the old value as well as the new value that it has changed to.</p><p><strong>Syntax:</strong></p><pre>watch: { propertyName(newVal, oldVal) { // Custom logic to execute when propertyName changes } }</pre><p><strong>Parameters are:</strong></p><ul><li><strong>propertyName</strong>: The name of the property being watched.</li><li><strong>newVal</strong>: The new value of the property.</li><li><strong>oldVal</strong>: The previous value of the property.</li></ul><h3>Simple Watchers</h3><pre>watch: { counter(newVal, oldVal) { console.log(&#39;Counter changed from&#39;, oldVal, &#39;to&#39;, newVal); } }</pre><p>Let’s take another example to define a variable and watch properties value:</p><pre>import { ref, watch } from &quot;vue&quot;; const message = ref(&quot;Hello Vue!&quot;); watch(message, (newValue, oldValue) =&gt; { // do something with newValue and oldValue. });</pre><p>in the above code, I have imported ref and watch from the base library, Also defined message variable and call watch method. We are able to access its new value or previous value and perform any preferred action once the message value changes.</p><h3>Deep Watcher</h3><p>The simple vue.js watcher does not support nested object properties, You can achieve this by using an optional <strong>deep</strong> property in our watcher to <strong>true</strong>.</p><pre>watch: { &#39;obj.prop&#39;: { handler(newVal, oldVal) { console.log(&#39;obj.prop changed from&#39;, oldVal, &#39;to&#39;, newVal); }, deep: true } }</pre><p><strong>The working example:</strong></p><pre>export default { data() { return { employee: [ { id: 1, name: &quot;Adam&quot;, }, { id: 2, name: &quot;Same&quot;, }, ], }; }, watch: { someData(newValue, oldValue) { console.log(&quot;someData changed!&quot;); }, deep: true, }, };</pre><p>in the above code, The watcher method will be triggered when a nested property changes.</p><h3>Immediate Watcher</h3><p>The watchers are not activated immediately unless the value you are watching has changed. The immediate watcher helps to trigger on initial data and then repeats the process if the data changes.</p><pre>watch: { dataProp: { handler(newVal, oldVal) { console.log(&#39;dataProp changed from&#39;, oldVal, &#39;to&#39;, newVal); }, immediate: true } }</pre><h3>Conclusion</h3><p>The watchers help to perform action based on value changes of properties or variables. You can also see this type of functionality in other UI frameworks like angular 1.6 etc. We have explored all types of watchers simple, deep, and immediate watchers.</p><p><em>Originally published at </em><a href="https://www.js-tutorials.com/vue-js-tutorial/what-are-vue-js-watchers-and-how-do-they-work/"><em>https://www.js-tutorials.com</em></a><em> on February 25, 2024.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cdec24f11d68" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring the Power of Laravel Eloquent Join? — Phpflow.com]]></title>
            <link>https://parvez1487.medium.com/exploring-the-power-of-laravel-eloquent-join-phpflow-com-204703eb438e?source=rss-853b1db2fffc------2</link>
            <guid isPermaLink="false">https://medium.com/p/204703eb438e</guid>
            <category><![CDATA[laravel]]></category>
            <dc:creator><![CDATA[Parvez Alam]]></dc:creator>
            <pubDate>Tue, 20 Feb 2024 01:56:36 GMT</pubDate>
            <atom:updated>2024-02-20T02:08:08.537Z</atom:updated>
            <content:encoded><![CDATA[<h3>Exploring the Power of Laravel Eloquent Join? — Phpflow.com</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kOOG3nyedObKoCGv.jpg" /></figure><p>We’ll explore different join methods of Laravel eloquent with examples. The join helps to fetch the data from multiple database tables by establishing relationships between them.</p><h3>What is ORM</h3><p>Laravel’s Eloquent ORM (Object-Relational Mapping) is an ActiveRecord implementation that simplifies database communication with PHP applications. It allows developers to interact with database tables using PHP objects and methods, which eliminates the need to write complex SQL queries manually in the application.</p><p>We’ll discuss the following Laravel join methods:</p><ul><li>Inner Join: Returns only the matching rows from both tables.</li><li>Left Join: Returns all rows from the left table and the matching rows from the right table.</li><li>Right Join: Returns all rows from the right table and the matching rows from the left table.</li><li>Full Outer Join: Returns all rows when there is a match in either the left or right table, It returns <strong>NULL</strong> values where there&#39;s no match.</li><li>Cross Join: Returns all rows from both tables.</li></ul><h3>Laravel Eloquent Join Method With Examples</h3><p>Let’s assume you have an “employees” and a “departments” table, and you want to perform a join operation using Laravel’s Eloquent ORM. Define the relationship between Employee and Department models:</p><pre>namespace App\Models; use Illuminate\Database\Eloquent\Model; class Employee extends Model { public function department() { return $this-&gt;belongsTo(Department::class); } } class Department extends Model { public function employees() { return $this-&gt;hasMany(Employee::class); } }</pre><p>Here’s a foreign key department_id in the employees table referencing the id column in the departments table.</p><p>There are the following types of join available in Laravel ORM. Let’s discuss them one by one with examples.</p><h3>Inner Join</h3><p>An inner join in Eloquent fetches records that have matching values in both tables. It filters out non-matching records from both table’s data.</p><pre>$employees = Employee::join(&#39;departments&#39;, &#39;employees.department_id&#39;, &#39;=&#39;, &#39;departments.id&#39;) -&gt;select(&#39;employees.*&#39;, &#39;departments.name as department_name&#39;) -&gt;get();</pre><h3>Left Join</h3><p>A left join retrieves all records from the left table and matching records from the right table. It includes all records from the left table, regardless of whether corresponding matches are in the right table.</p><pre>$employees = Employee::leftJoin(&#39;departments&#39;, &#39;employees.department_id&#39;, &#39;=&#39;, &#39;departments.id&#39;) -&gt;select(&#39;employees.*&#39;, &#39;departments.name as department_name&#39;) -&gt;get();</pre><h3>Right Join</h3><p>A right join fetches all records from the right table and matching records from the left table. It includes all records from the right table, regardless of whether there are corresponding matches in the left table.</p><pre>$employees = Employee::rightJoin(&#39;departments&#39;, &#39;employees.department_id&#39;, &#39;=&#39;, &#39;departments.id&#39;) -&gt;select(&#39;employees.*&#39;, &#39;departments.name as department_name&#39;) -&gt;get();</pre><h3>Cross Join</h3><p>A cross join returns the Cartesian product of two tables, meaning it combines each row from the first table with every row from the second table.</p><pre>$employees = Employee::crossJoin(&#39;departments&#39;) -&gt;select(&#39;employees.*&#39;, &#39;departments.name as department_name&#39;) -&gt;get();</pre><h3>Full Outer Join</h3><p>Laravel does not support full outer join but you can achieve this by combining a left join and a union.</p><pre>use App\Models\Employee; use Illuminate\Support\Facades\DB; $fullOuterJoinResults = Employee::leftJoin(&#39;departments&#39;, &#39;employees.department_id&#39;, &#39;=&#39;, &#39;departments.id&#39;) -&gt;select(&#39;employees.*&#39;, &#39;departments.name as department_name&#39;) -&gt;unionAll(Employee::rightJoin(&#39;departments&#39;, &#39;employees.department_id&#39;, &#39;=&#39;, &#39;departments.id&#39;) -&gt;select(&#39;employees.*&#39;, &#39;departments.name as department_name&#39;)) -&gt;get();</pre><h3>Conclusion:</h3><p>We have covered Laravel eloquent join methods with examples. We have discussed left join, right join, cross join, outer join and inner join methods. You can use any of them as per your requirements.</p><p><em>Originally published at </em><a href="https://www.phpflow.com/laravel/exploring-the-power-of-laravel-eloquent-join/"><em>https://www.phpflow.com</em></a><em> on February 20, 2024.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=204703eb438e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring the Best Practices of jQuery onchange Event Handling]]></title>
            <link>https://parvez1487.medium.com/exploring-the-best-practices-of-jquery-onchange-event-handling-645ce437cff2?source=rss-853b1db2fffc------2</link>
            <guid isPermaLink="false">https://medium.com/p/645ce437cff2</guid>
            <category><![CDATA[jquery]]></category>
            <dc:creator><![CDATA[Parvez Alam]]></dc:creator>
            <pubDate>Sun, 04 Feb 2024 04:05:44 GMT</pubDate>
            <atom:updated>2024-02-04T10:20:52.604Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2Ejd0850dY98cnGg.jpg" /></figure><p>In this jQuery tutorial, we will explore the jQuery change event with examples. We’ll discuss the jQuery change event, exploring its applications and covering different scenarios with use cases where it can be effectively employed.</p><h3>What’s jQuery?</h3><p>jQuery is a fast and lightweight open-source JavaScript library that allows developers to solve complex functionalities with simple code. It enables DOM manipulation, allowing users to find, select, and manipulate elements with specific properties. jQuery simplifies HTML Document Object Model (DOM) manipulation, Asynchronous JavaScript and XML (Ajax), and event handling.</p><h3>Understanding the jQuery Change Event</h3><p>The change event in jQuery is triggered when a user alters the value of an <strong>input</strong>, <strong>select</strong>, or <strong>textarea</strong> element.</p><p><strong>The basic syntax for binding the change event is as follows:</strong></p><pre>$(document).ready(function() { $(&#39;selector&#39;).change(function() { // Your event handling logic here }); });</pre><p>The &#39;selector&#39; in jQuery can be an element ID, name, or class.</p><blockquote><em>You can also check other tutorial of Datatable,</em></blockquote><h3>Common Scenarios and Use Cases:</h3><h3>Form Validation</h3><p>You can bind the change event to relevant form elements to trigger real-time validation and provide instant validation messages to users.</p><p><strong>HTML Code:</strong></p><pre>&lt;label for=&quot;myInput&quot;&gt;Enter Username:&lt;/label&gt; &lt;input type=&quot;text&quot; id=&quot;myInput&quot;&gt;</pre><p><strong>jQuery Code:</strong></p><pre>$(document).ready(function() { $(&#39;#myInput&#39;).on(&#39;change&#39;, function() { // Get the input value var inputValue = $(this).val(); // Perform validation if (validateInput(inputValue)) { // If validation passes, you can perform further actions console.log(&#39;Validation passed!&#39;); } else { // If validation fails, handle accordingly console.log(&#39;Validation failed!&#39;); } }); });</pre><h3>Dropdown change</h3><p>You can bind the change event to a dropdown to update other parts of the page or other dropdown lists dynamically. You can dynamically update other parts of the page based on the user’s selection.</p><pre>$(document).ready(function() { $(&#39;#dropdown&#39;).change(function() { loadSidebar($(this).val()); }); function loadSidebar(selectedValue) { console.log(selectedValue); } });</pre><p>In this scenario, the loadSidebar function is invoked whenever the user changes the selected option in the dropdown menu.</p><h3>Checkbox and Radio Button Handling</h3><p>You can use the change event for both <strong>checkboxes</strong> and <strong>radio</strong> buttons. Below is an example of handling the change event for checkboxes and radio buttons using jQuery:</p><p><strong>Select checkbox Button:</strong></p><pre>$(&#39;input[type=&quot;checkbox&quot;]&#39;).on(&#39;change&#39;, function() { var selectedCheckboxes = $(&#39;input[type=&quot;checkbox&quot;]:checked&#39;); console.log(selectedCheckboxes); });</pre><p>The change event is used to detect when the checkbox is checked or unchecked. The :checked selector is employed to determine the checkbox&#39;s state.</p><p><strong>Select Radio Button:</strong></p><pre>$(&#39;input[type=&quot;radio&quot;]&#39;).on(&#39;change&#39;, function() { var selectedRadio = $(&#39;input[type=&quot;radio&quot;]:checked&#39;); console.log(selectedRadio); });</pre><p>The change event is used to detect when any radio button in the group is selected. The :checked selector is used to find the selected radio button, and its value.</p><h3>Realtime Text Area Character Count</h3><p>You can also bind the change event with a textarea to count the number of characters entered by the user in real-time.</p><pre>$(document).ready(function() { $(&#39;#textarea&#39;).change(function() { countChar($(this).val().length); }); function countChar(charCount) { console.log(charCount) } });</pre><h3>Conclusion</h3><p>We have explored the jQuery change event binding with elements. You can bind this event to input boxes, selects, etc. This is a powerful event for handling user input and applying appropriate actions.</p><p>To get started with jQuery, you can visit the official website: <a href="https://jquery.com/">jQuery</a></p><p><em>Originally published at </em><a href="https://www.js-tutorials.com/jquery-tutorials/exploring-the-best-practices-of-jquery-onchange-event-handling/"><em>https://www.js-tutorials.com</em></a><em> on February 4, 2024.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=645ce437cff2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Can I Exit Python Using the Command Line? — pythonpip.com]]></title>
            <link>https://parvez1487.medium.com/how-can-i-exit-python-using-the-command-line-pythonpip-com-0ccf1114d2dd?source=rss-853b1db2fffc------2</link>
            <guid isPermaLink="false">https://medium.com/p/0ccf1114d2dd</guid>
            <category><![CDATA[exit]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Parvez Alam]]></dc:creator>
            <pubDate>Sun, 04 Feb 2024 03:18:56 GMT</pubDate>
            <atom:updated>2024-02-04T03:38:05.700Z</atom:updated>
            <content:encoded><![CDATA[<h3>How Can I Exit Python Using the Command Line? — pythonpip.com</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OCzP6DJHizdcFCAK.jpg" /></figure><p>in this tutorial, We’ll learn about different ways to gracefully exit a from python program. You can exit by using methods such as the quit(), exit(), and sys.exit() commands.</p><p>We’ll discuss the following method here:</p><h3>Python quit() function</h3><p>The quit is a built-in python method that is used to exit from a Python program. it terminates the execution of the program completely. It stops the interpreter and returns to the operating system.</p><pre>for val in range(0,10): if val == 3: quit() print(val)</pre><p>in the above code, We are printing <strong>“val”</strong>, if the value of <strong>“val”</strong> becomes &quot;3&quot; then the program is forced to quit, and exit from program.</p><h3>Python exit() function</h3><p>The exit is a built-in Python method that is used to exit and come out of the program in Python. it’s functionality is the same as quit() method exit from the program.</p><pre>for val in range(0,10): if val == 3: exit() print(val)</pre><p>in the above code, We are printing <strong>“val”</strong>, if the value of <strong>“val”</strong> variable value is &quot;3&quot; then the program is forced to quit, and exit from program.</p><h3>Python sys.exit() function</h3><p>The sys.exit() method is part of the <strong>sys module</strong>. This method terminates Python program execution instantly. It raises the SystemExit exception and exit code, The exit code 0 for successful execution and non-zero values for errors.</p><pre>import sys def main(): try: # Program logic result = 5 / 0 except ZeroDivisionError as e: print(f&quot;Error: {e}&quot;) # Exit with status code 1 for division by zero sys.exit(1) if __name__ == &quot;__main__&quot;: main() # Exit with status code 0 for successful execution sys.exit(0)</pre><h3>Python atexit Module:</h3><p>Python’s atexit module enables programmers to register functions that run right before a program ends. This can be helpful for cleaning up after operations.</p><pre>import sys import atexit def cleanup(): # Cleanup operations print(&quot;Performing cleanup before exit.&quot;) atexit.register(cleanup) # Program logic here sys.exit(0)</pre><h3>Conclusion</h3><p>We learned common ways to terminate Python program execution. The Python exit commands — quit(), exit(), and sys.exit(), These methods allow the termination of Python script execution gracefully. You can choose any of them as per your needs.</p><p><em>Originally published at </em><a href="https://www.pythonpip.com/python-tutorials/how-can-i-exit-python-using-the-command-line/"><em>https://www.pythonpip.com</em></a><em> on February 4, 2024.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0ccf1114d2dd" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>