Hosting Of a Django Application Using Plesk webserver

To set up Django on Plesk: First of all, let’s check Python presence in the system. we can do it by issuing the command: python –version Install a Python package manager (under the “root” user): apt-get install python-pip It is common practice to have a separate virtual environment for each Python application. So, let’s install… Continue reading Hosting Of a Django Application Using Plesk webserver

PyTorch: An open source ML Framework

PyTorch is an open source machine learning framework, used for applications such as computer vision and natural language processing. It is one of the preferred platforms for deep learning research. PyTorch is employed on Python, along with C/C++ libraries, and was designed for overall flexibility. PyTorch is widely used in large companies like Facebook, Twitter,… Continue reading PyTorch: An open source ML Framework

Building a Django Application with Google Routing and Geocoding API

In the realm of web development, incorporating mapping functionalities into applications has become increasingly popular. Google Maps APIs provide a powerful toolkit for developers to integrate mapping, geocoding, and routing capabilities seamlessly into their web applications. In this article, we will explore how to leverage Django, a high-level Python web framework, along with Google Routing… Continue reading Building a Django Application with Google Routing and Geocoding API

Map Box Api for Geocoding

Mapbox APIs are much more than just map tiles. They hold the key to unlocking a rich world of location-based possibilities, enriching your applications and engaging your users in innovative ways. This article delves deeper into the diverse capabilities of Mapbox APIs, showcasing their potential beyond the standard map visualization. From Static to Interactive: Imagine… Continue reading Map Box Api for Geocoding

Visualizing Geospatial Data using Folium in Python

In the realm of data visualization, maps have proven to be an invaluable tool for conveying complex spatial information. While Python boasts an impressive collection of data visualization libraries, Folium stands out as a powerful and user-friendly library specifically designed for creating interactive maps. What is Folium? Folium is a Python wrapper for Leaflet.js, a… Continue reading Visualizing Geospatial Data using Folium in Python

Multiplication Table Maker

Create a program multiplicationTable.py that takes a number N from the command line and creates an N×N multiplication table in an Excel spreadsheet. import sys import openpyxl from openpyxl.styles import Font if len(sys.argv) != 2:   print(“Usage: python multiplicationTable.py <N>”) else:   n = int(sys.argv[1])   # Create a new workbook and select the active sheet   wb =… Continue reading Multiplication Table Maker

Published
Categorized as AI Tagged

Updating excel document using python

we already have an excel document namely produceSales and we need to update it with new values.Without searching each item we can done it through python programming Code: import openpyxl wb=openpyxl.load_workbook(‘produceSales.xlsx’) print(‘—-workbook opened—‘) produce_update={‘Garlic’: 3.07,’Celery’: 1.19,’Lemon’: 1.27} sheet=wb[‘Sheet’] for rows in range(2,sheet.max_row+1):   product=sheet.cell(row=rows,column=1).value   if product in produce_update:     sheet.cell(row=rows,column=2).value=produce_update[product] wb.save(‘updatedProduceSales.xlsx’) print(“Update completed”)

Published
Categorized as AI Tagged

Encrypt a pdf using python

Code to encrypt a pdf using python: import PyPDF2 pdfFile = open(‘meetingminutes.pdf’, ‘rb’) pdfReader = PyPDF2.PdfFileReader(pdfFile) pdfWriter = PyPDF2.PdfFileWriter() for pageNum in range(pdfReader.numPages):       pdfWriter.addPage(pdfReader.getPage(pageNum)) pdfWriter.encrypt(‘swordfish’) resultPdf = open(‘encryptedminutes.pdf’, ‘wb’) pdfWriter.write(resultPdf) resultPdf.close()

Published
Categorized as AI Tagged

Finding Text Similarity using Python

Cosine similarity is a measure of similarity between two non-zero vectors of an inner product space that measures the cosine of the angle between them. Similarity = (A.B) / (||A||.||B||) where A and B are vectors. nltk.tokenize: It is used for tokenization. Tokenization is the process by which big quantity of text is divided into… Continue reading Finding Text Similarity using Python

DJANGO FRAMEWORK BASICS

CREATING PROJECT django-admin startproject projectname eg:django-admin startproject myproject cd myproject myproject/ manage.py myproject/ init.py settings.py urls.py wsgi.py settings.py DEBUG = True for sqlite3 DATABASES = { ‘default’: { ‘ENGINE’: ‘django.db.backends.sqlite3’, ‘NAME’: os.path.join(BASE_DIR, ‘db.sqlite3’), } } for mysql DATABASES = { ‘default’: { ‘ENGINE’: ‘django.db.backends.mysql’, ‘NAME’: ‘databasename’, ‘USER’: ‘root’, ‘PASSWORD’: ”, ‘HOST’: ‘localhost’, ‘PORT’: ”, }… Continue reading DJANGO FRAMEWORK BASICS