Thursday, February 27, 2020

Problem Project Project 2

Problem-

Write a programme, which generates a random password for the user. 
Ask the user how long they want their password to be, and how many letters 
and numbers they want in their password. Have a mix of upper and lowercase 
letters, as well as numbers and symbols. 
The password should be a minimum of 6 characters long.
Solution-

import random
import array
MAX_LEN = int(input("Enter the length of the Password you want (minimum length should be 6): "))

NODigits = int(input("Enter the number of digits you want in Password: "))

NOLocase = int(input("Enter the number of Lower Case you want in Password: "))

NOUpcase = int(input("Enter the number of Upper Case you want in Password: "))

NOSymbol = int(input("Enter the number of symbols you want in Password: "))


DIGITS = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']

LOCASE_CHARACTERS = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
                     'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
                     'q', 'r', 's', 't', 'u', 'v', 'w', 'x',
                     'y', 'z']

UPCASE_CHARACTERS = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
                     'I', 'J', 'K', 'L', 'M', 'N', 'O', 'p',
                     'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
                     'Y', 'Z']

SYMBOLS = ['@', '#', '$', '%', '=', ':', '?', '.', '/', '|', '~', '>',
           '*', '(', ')', '<', '&']

           
COMBINED_LIST = DIGITS + UPCASE_CHARACTERS + LOCASE_CHARACTERS + SYMBOLS

rand_digit = random.choice(DIGITS)
rand_upper = random.choice(UPCASE_CHARACTERS)
rand_lower = random.choice(LOCASE_CHARACTERS)
rand_symbol = random.choice(SYMBOLS)

i = 1
while(i < NODigits):
    rand_digit = rand_digit + random.choice(DIGITS)
    i = i + 1

i = 1
while(i < NOLocase):
    rand_upper = rand_upper + random.choice(UPCASE_CHARACTERS)
    i = i + 1

i = 1
while(i < NOUpcase):
    rand_lower = rand_lower + random.choice(LOCASE_CHARACTERS)
    i = i + 1

i = 1
while(i < NOSymbol):
    rand_symbol = rand_symbol + random.choice(SYMBOLS)
    i = i + 1

temp_pass = rand_digit + rand_upper + rand_lower + rand_symbol

for x in range(MAX_LEN - (NODigits + NOLocase + NOUpcase + NOSymbol)):
    temp_pass = temp_pass + random.choice(COMBINED_LIST)

temp_pass_list = array.array('u', temp_pass)
random.shuffle(temp_pass_list)

password = ""for x in temp_pass_list:
    password = password + x

print("\nGenerated Password: ",password)
OUTPUT:

Enter the length of the Password you want (minimum length should be 6): 16
Enter the number of digits you want in Password: 4
Enter the number of Lower Case you want in Password: 4
Enter the number of Upper Case you want in Password: 4
Enter the number of symbols you want in Password: 4
Generated Password:  ~08=H2R>kCb$kAx0

Sunday, February 23, 2020

Python Project Problem 1

Question:
Make a program which randomly chooses a number to guess and then the user will have a few chances to guess the number correctly. In each wrong attempt, the computer will give a hint that the number is greater or smaller than the one you have guessed.

Answer:
import secrets

n1 = secrets.randbits(7)
n2 = secrets.randbits(7)

if (n1 > n2):
    beg = n2
    end = n1
else:
    beg = n1
    end = n2

import random

rand = random.randrange(beg, end, 1)

print("NUMBER GUESSING GAME.....")

print("Guess a number(between ", beg, " and ", end, "): ", end='');
num = int(input())

while (num != rand):
    if (num > rand):
        print("Your guess was too high: Guess a number lower than ", num);
        num = int(input())
    else:
        print("Your guess was too low: Guess a number higher than ", num);
        num = int(input())

print("Congratulation YOU WON!!!")
OUTPUT:

NUMBER GUESSING GAME.....
Guess a number(between  58  and  87 ): 62
Your guess was too low: Guess a number higher than  62
86
Your guess was too high: Guess a number lower than  86
87
Your guess was too high: Guess a number lower than  87
65
Your guess was too low: Guess a number higher than  65
69
Your guess was too low: Guess a number higher than  69
72
Your guess was too low: Guess a number higher than  72
75
Your guess was too low: Guess a number higher than  75
79
Your guess was too high: Guess a number lower than  79
77
Congratulation YOU WON!!!

Thursday, January 30, 2020

er_Diagram

1. A flight is uniquely identified by an airline and flight number.

2. A flight is made up of one or more flight legs, each of which has a length.

3. For each flight leg, there is a departure airport and an arrival airport (required).
 
4. There is also a scheduled departure time and a scheduled arrival time.

5. A flight leg can have any number of associated instances. 

6. A particular instance has actual departure and arrival information (time and airport; airport is required) on a particular day and has been assigned a particular airplane (required). 

7. A flight leg instance is uniquely identified by the date, departure and arrival airport codes, airline, and flight number.

8. An airport is uniquely identified by a code, and also has a location consisting of the airport's name and the city and state where it is located.

9. A type of airplane is uniquely identified by its maker and model. It also has a range (how far it can fly). 

10. Certain kinds of airplanes can only land at certain airports.

11. A particular airplane is of a particular type (required) and is uniquely identified by its ID.

Tuesday, January 14, 2020

The Tasks of a Database Administrator

A database administrator's (DBA) primary job is to ensure that data is available, protected from loss and corruption, and easily accessible as needed. Below are some of the chief responsibilities. DSP deliver an outsourced DBA service in the UK, providing Oracle Support and SQL Server Support ; whilst mindset and toolset may be different, whether a database resides on-premise or in a Public / Private Cloud, the role of the DBA is not that different.


1. Software installation and Maintenance


A DBA often collaborates on the initial installation and configuration of a new Oracle, SQL Server etc database. The system administrator sets up hardware and deploys the operating system for the database server, then the DBA installs the database software and configures it for use. As updates and patches are required, the DBA handles this on-going maintenance.


And if a new server is needed, the DBA handles the transfer of data from the existing system to the new platform.


2. Data Extraction, Transformation, and Loading


Known as ETL, data extraction, transformation, and loading refers to efficiently importing large volumes of data that have been extracted from multiple systems into a data warehouse environment.


This external data is cleaned up and transformed to fit the desired format so that it can be imported into a central repository.


3. Specialised Data Handling


Today’s databases can be massive and may contain unstructured data types such as images, documents, or sound and video files. Managing a very large database (VLDB) may require higher-level skills and additional monitoring and tuning to maintain efficiency.


4. Database Backup and Recovery


DBAs create backup and recovery plans and procedures based on industry best practices, then make sure that the necessary steps are followed. Backups cost time and money, so the DBA may have to persuade management to take necessary precautions to preserve data.


System admins or other personnel may actually create the backups, but it is the DBA’s responsibility to make sure that everything is done on schedule.


In the case of a server failure or other form of data loss, the DBA will use existing backups to restore lost information to the system. Different types of failures may require different recovery strategies, and the DBA must be prepared for any eventuality. With technology change, it is becoming ever more typical for a DBA to backup databases to the cloud, Oracle Cloudfor Oracle Databases and MS Azure for SQL server.


5. Security


A DBA needs to know potential weaknesses of the database software and the company’s overall system and work to minimise risks. No system is one hundred per cent immune to attacks, but implementing best practices can minimise risks.


In the case of a security breach or irregularity, the DBA can consult audit logs to see who has done what to the data. Audit trails are also important when working with regulated data.


6. Authentication


Setting up employee access is an important aspect of database security. DBAs control who has access and what type of access they are allowed. For instance, a user may have permission to see only certain pieces of information, or they may be denied the ability to make changes to the system.


7. Capacity Planning


The DBA needs to know how large the database currently is and how fast it is growing in order to make predictions about future needs. Storage refers to how much room the database takes up in server and backup space. Capacity refers to usage level.


If the company is growing quickly and adding many new users, the DBA will have to create the capacity to handle the extra workload.


8. Performance Monitoring


Monitoring databases for performance issues is part of the on-going system maintenance a DBA performs. If some part of the system is slowing down processing, the DBA may need to make configuration changes to the software or add additional hardware capacity. Many types of monitoring tools are available, and part of the DBA’s job is to understand what they need to track to improve the system. 3rd party organisations can be ideal for outsourcing this aspect, but make sure they offer modern DBA Support.


9. Database Tuning


Performance monitoring shows where the database should be tweaked to operate as efficiently as possible. The physical configuration, the way the database is indexed, and how queries are handled can all have a dramatic effect on database performance.


With effective monitoring, it is possible to proactively tune a system based on application and usage instead of waiting until a problem develops.


10. Troubleshooting


DBAs are on call for troubleshooting in case of any problems. Whether they need to quickly restore lost data or correct an issue to minimise damage, a DBA needs to quickly understand and respond to problems when they occur.