Skip to main content

Posts

Python - Connect to MariaDB

 Below is the Python program which will show you how to connect to MariaDB. Here is the code:  # Module Imports import mariadb import sys # Connect to MariaDB Platform try:     conn = mariadb.connect(         user="user",         password="password",         host="host",         port=port,         database="database"     ) except mariadb.Error as e:     print(f"Error connecting to MariaDB Platform: {e}")     sys.exit(1) # Get Cursor cur = conn.cursor() try:     cur.execute("show databases;")     cur.execute("use test_db;")     cur.execute("show tables;")     for table in cur:         print(table) except mariadb.Error as e:     print(f"Error: {e}") # Close Connection conn.close()
Recent posts

Python - get file attributes or file related information

 Below is the Python program which will get file attributes or file related information. Here is the code:  import os import sys sys.path.extend(r'mention your file path here') print('Get current working directory : ', os.getcwd()) print('File name :    ', os.path.basename(__file__)) print('Directory Name:     ', os.path.dirname(__file__)) print('Absolute path of file:     ', os.path.abspath(__file__)) print('Absolute directory name: ', os.path.dirname(os.path.abspath(__file__))) # Specify the directory you want to list directory_path = os.getcwd() # List all files and folders in the directory file_list = os.listdir(directory_path) # Get full paths full_paths = [os.path.join(directory_path, file) for file in file_list] print(full_paths)

Operating System & Applications of Mobile Computing

  Operating System & Applications of Mobile Computing   asic Concepts of mobile operating system? A mobile operating system ( OS ) is software that allows smartphones,  tablets  and other devices to run applications and programs. A mobile OS provides an interface between the device's hardware components and its software functions. It typically starts when a device powers on, presenting a screen with icons or tiles that show information and provide application access. Mobile operating systems also manage cellular and wireless network connectivity and phone access. Millions of people use mobile operating systems worldwide, powering a wide range of devices, from smartphones to tablets and wearable technology. These systems offer users a wide selection of features, including calling and messaging, internet and cellular data connectivity, multitasking capabilities, interactive user interfaces and access to a wide range of third-party applications and services...