Author: mashiurrahman99
-
Converting Between Python Dictionaries and JSON
We will use json.dums() function to convert to json from python dictionary and json.loads() to convert from json to python dictionary. In this example code we used flower details data in python dictionary and converted it to json. import json # flowers in python dictionary flowers = { “rose”: { “scientific_name”: “Rosa”, “grows_in”: [“gardens”, “wild”],…
-
Optimize Website Performance: Pause Media Playback on Inactive Tabs
How pause media playback on inactive tabs can be very very useful? By using visibilitychange event, its possible stop playback when user move to another browser tab or inactive. So we can save bandwidth and which can be used for active users to give them the best quality uninterrupted media playback. Because in streaming platform…
-
Add, Delete, and Update Accounts in Ubuntu from Terminal
Single user account on a shared computer can be a security issue? Using multiple user accounts in Ubuntu is a powerful way to improve both security and workflow organization. Separating work documents from personal files, restricting access to sensitive data for different users, and simplifying collaboration with colleagues. Most importantly, using a single root account…
-
Send Desktop notification from pygame
For notification handling we will use plyer library We will add this functionality in our pygame code The complete code import pygame import sys from pygame.locals import * from plyer import notification pygame.init() clock = pygame.time.Clock() user_display = pygame.display.Info() width, height = 800, 600 screen = pygame.display.set_mode((width, height)) background = (255, 255, 255) red =…
-
Storing and retrieving data from sqlite with python
For making everything simpler we will use peewee orm with python sqlite3…. First create and connect to our database from peewee import * # SQLite database setup with Peewee db = SqliteDatabase(‘cv_database.db’) class User(Model): username = CharField(unique=True) # Add more user details as needed class Meta: database = db class CV(Model): user = ForeignKeyField(User, backref=’cv’)…
-
Pygame Project: Create the simplest digital clock
We will use python datetime module for our clock; We get the current time and separate the time into hour minutes and second. First get the current time Get the time in hour, minute and second Now got our clock time components. It will be like this import datetime current_time = datetime.datetime.now() hour = current_time.hour…
-
How to create or remove files or folders using python
The easiest way to create or remove file is using python os module To create file To create folder To remove file To remove folder The consideration. If file already exist when creating file it will show error so we can check if the file already exist or when deleting folder
-
Save wikipedia article in txt format with python and wikipedia API
For focus based study its essential to get rid of all unnecessary context like wonderful design, and other ui effect. Whats necessary only text like the text book. Wikipedia is one of my most visited website at this time. Though I love the content , i wll love more if its more minimalist.. So there…
-
How to prevent text selection in html
Its necessary to prevent text selection when the text is ui feature, to make the webpage more professional. We can prevent the text from selecting by using this in css You cannot select this text You can select this text example code
-
How to create tooltip in html
Is essential to add tooltip to make web page more professional and understandable The simplest way can we add tooltip is use html inline element <span> We will add the tool in div and tooltip text(tool description) in the span Toll description will be always hide ( display none in css) until the user hover…