How does streaming traffic differ from browsing traffic (in terms of network utilization)?
In: Computer Science
1. Write a program which simulates rolling dice. It should: Display the random number rolled Ask the user if they want to roll again. If they don't want to roll again, the program should end. If they do want to roll again, the new number should display. At a minimum, the die should have 6 sides, but if you want to use a d12 or d20, that is fine too.
USE PYTHON
In: Computer Science
Complete a) flowchart solution and b) working Python solution. It will need to compare gene sequences, looking for differences (mutations), keeping track of how many are different and will include clear two-part output: indicating if the ‘baby’ has the mutation for diabetes or not, and the identity between the siblings’ sequences.
BABY:
ATGGCCCTGTGGATGCGCCTCCTGCCCCTGCTGGCGCTGCTGGCCCTCTGGGGACCTGACCCAGCCGCAGCCTTTGTGAACCAACACCTGTGCGGCTCACACCTGGTGGAAGCTCTCTACCTAGTGTGCGGGGAACGAGGCTTCTTCTACACACCCAAGACCTGCCGGGAGGCAGAGGACCTGCAGGTGGGGCAGGTGGAGCTGGGCGGGGGCCCTGGTGCAGGCAGCCTGCAGCCCTTGGCCCTGGAGGGGTCCCTGCAGAAGCGTGGCATTGTGGAACAATGCTGTACCAGCATCTGCTCCCTCTACCAGCTGGAGAACTACTGCAACTAG
BROTHER:
ATGGCCCTGTGGATGCGCCTCCTGCCCCTGCTGGCGCTGCTGGCCCTCTGGGGACCTGACCCAGCCGCAGCCTTTGTGAACCAACACCTGTGCGGCTCACACCTGGTGGAAGCTCTCTACCTAGTGTGCGGGGAACGAGGCTTCTTCTACACACCCAAGACCCGCCGGGAGGCAGAGGACCTGCAGGTGGGGCAGGTGGAGCTGGGCGGGGGCCCTGGTGCAGGCAGCCTGCAGCCCTTGGCCCTGGAGGGGTCCCTGCAGAAGCGTGGCATTGTGGAACAATGCTGTACCAGCATCTGCTCCCTCTACCAGCTGGAGAACTACTGCAACTAG
Does the ‘baby’ carry the mutation associated with
diabetes?
Which (what number) nucleotide has mutated?
What is the ‘identity” of the siblings’ sequences? In other words,
find the percentage, to one decimal place, describing how similar
those two are.
--------------------------------------------------
So far I have this:
def find_mutation_location(nuc1, nuc2):
n = len(nuc1)
for i in range(0,n,3):
if nuc1[i:i+3] != nuc2[i:i+3]:
return (i+1)//3
n1 =
"ATGGCCCTGTGGATGCGCCTCCTGCCCCTGCTGGCGCTGCTGGCCCTCTGGGGACCTGACCCAGCCGCAGCCTTTGTGAACCAACACCTGTGCGGCTCACACCTGGTGGAAGCTCTCTACCTAGTGTGCGGGGAACGAGGCTTCTTCTACACACCCAAGACCTGCCGGGAGGCAGAGGACCTGCAGGTGGGGCAGGTGGAGCTGGGCGGGGGCCCTGGTGCAGGCAGCCTGCAGCCCTTGGCCCTGGAGGGGTCCCTGCAGAAGCGTGGCATTGTGGAACAATGCTGTACCAGCATCTGCTCCCTCTACCAGCTGGAGAACTACTGCAACTAG"
n2 =
"ATGGCCCTGTGGATGCGCCTCCTGCCCCTGCTGGCGCTGCTGGCCCTCTGGGGACCTGACCCAGCCGCAGCCTTTGTGAACCAACACCTGTGCGGCTCACACCTGGTGGAAGCTCTCTACCTAGTGTGCGGGGAACGAGGCTTCTTCTACACACCCAAGACCCGCCGGGAGGCAGAGGACCTGCAGGTGGGGCAGGTGGAGCTGGGCGGGGGCCCTGGTGCAGGCAGCCTGCAGCCCTTGGCCCTGGAGGGGTCCCTGCAGAAGCGTGGCATTGTGGAACAATGCTGTACCAGCATCTGCTCCCTCTACCAGCTGGAGAACTACTGCAACTAG"
print(find_mutation_location(n1,n2))
def calculate_similarity(nuc1, nuc2):
n = len(nuc1) // 3
different = 0
for i in range(0,n,3):
if nuc1[i:i+3] != nuc2[i:i+3]:
different += 1
print(calculate_similarity(n1,n2))
I seem to have been able to locate the mutation at nucleotide number 54, but am having issues with calculating the similarity to a percentage/1 decimal point. Please advise, and also provide working flow-chart solution if possible. Thanks!
In: Computer Science
There is no question the router plays a vital role in networking. If this device were to be controlled by an attacker, then the entire CIA goal can be violated. As such, you can argue about the need to protect the router administratively, physically, and technically. Our focus again is on the technical part. Having said this, discuss the methods that can be used on a standard IOS router that will prevent unauthorized access to the router. Also, discuss how privilege levels and role-based CLI can improve the security on the router.
In: Computer Science
b, prompt the user to input several (x,y) pairs. As the data is entered, store it in a vector of Points called orginal_points. Input is terminated with the EOF character (differs by OS type). To be clear, I am asking you to define an input stream operator to read the point format: (x,y). As an example, the input of (5,6) is the correct input format for a point. While the I/O format includes the ‘(‘, ‘,’, and ‘)’ characters, the internal storage contains only the x and y values. Please Note -- I am expecting a robust, user-friendly way to ensure Points are entered correctly and in a valid format. A simple termination of the program is not acceptable here -- If I’ve entered a number of valid points, don’t discard them -- recover from the error so that input can continue (if possible) and if input cannot continue, ensure that the program proceeds to save the points I have entered. Also important -- this input stream operator needs to work with standard input (cin) and formatted (text) file input streams.
#include <iostream> #include <fstream> #include <vector> using namespace std; struct Point{ int x, y; bool operator==(const Point& p2) { return this->x == p2.x and this->y == p2.y; } bool operator!=(const Point& p2) { return this->x != p2.x or this->y != p2.y; } friend ostream &operator<<( ostream &out, const Point &P ) { out << "(" << P.x << ", " << P.y << ")"; return out; } friend istream &operator>>( istream &in, Point &P ) { char d1, d2, d3; // input format: (1, 2) in >> d1 >> P.x >> d2 >> P.y >> d3; return in; } }; int main() { vector<Point> original_points; cout << "Enter points :\n"; Point P; while( cin >> P ) { original_points.push_back(P); } ofstream out("mydata.txt"); cout << "You entered the points:\n"; for(Point p: original_points) { cout << p << '\n'; out << p << '\n'; } out.close(); //pause cin.get(); char ch; cout << "Press enter to continue: "; getchar(); ifstream in("mydata.txt"); vector<Point> processed_points; while( in >> P ) { processed_points.push_back(P); } int n = original_points.size(); for(int i=0; i<n; i++) { if(original_points[i] == processed_points[i]) { cout << "Points at index " << i << " are same\n" << original_points[i] << " " << processed_points[i] << '\n'; } if(original_points[i] != processed_points[i]) { cout << "Points at index " << i << " are not same\n" << original_points[i] << " " << processed_points[i] << '\n'; } } } depend on this code write error handling code
In: Computer Science
IN C LANGUAGE ONLY PLEASE!
First Program:
Second Program:
Third program:
In: Computer Science
Create a python program that will:
prompt a user for a command
Command
get_data
Level 1: Take one of the commands
my_max
my_min
my_range
my_sum
mean
median
Requirements:
Your commands should be case-insensitive
You should use python lists to store data
You should NOT use built-in python math functions, or math libraries to compute these values
Tips:
Write one function that will convert a string with comma-separated numbers into a python list with the numbers. You can use this in multiple other functions.
Don't name any of your functions "min", "max", or "range" or "sum". These are built-in functions.
Details
Load command details
Get_data: prompts users for a list of numbers, separated by commas
(please also print the list, for testing)
Level 1 details (these functions work with the loaded data list)
my_max
my_min
my_range: Computes the range (difference of greatest value and least value)
my_sum
mean: Computes and prints the arithmetic mean (average)
Level 2
median: show the median (middle value, or average of two middle values)
mode: show the mode, or modes
Level 3 details (these functions should use the first number in the data list)
prime: determine if a number is prime
factorize: get the prime factors of a number
fib: get the nth number in the fibonacci sequence
Here is my code so far:
#hehe my sum and stuff
f = open("input.txt",'r')
def input(prompt=''):
print(prompt, end='')
return f.readline().strip()
#get data
def get_data():
pass
line = input().strip().split(',')
nums=[]
for n in line:
nums.append(float(n))
return nums
#get sum
def my_sum(data):
s=0
for n in data:
s += n
return s
pass
#get max
def my_max(data):
m=0
for n in data:
m >= n
return m
pass
#get min
def my_min(data):
i=0
for n in data:
i < n
return i
pass
#get range
def my_range(data):
r=0
for n in data:
m - i
return r
pass
#get mean
def mean(data):
e=0
for n in data:
????????
#get median
def median(data):
d=0
for n in data:
??????
#get mode
def mode(data):
o=0
for n in data:
???
#get prime
def prime(data):
p=0
for n in data:
???
#get factorization
def factorization(data):
f=0
for n in data:
????
#get fib
def fib(data):
b=0
for n in data:
??
#run it
def run_cli():
while(1):
cmd = input()
if cmd=='exit':
break
elif cmd=='get_data':
data = get_data()
print(data)
elif cmd=='my_sum':
s = my_sum(data)
print(s)
elif cmd=='my_max':
m = my_max(data)
print(m)
elif cmd=='my_min':
i = my_min(data)
print(i)
elif cmd=='my_range':
r = my_range(data)
print(r)
elif cmd=='mean':
e = mean(data)
print(e)
elif cmd=='median':
d = median(data)
print(d)
elif cmd=='mode':
o = mode(data)
print(o)
elif cmd=='prime':
p = prime(data)
print(p)
elif cmd=='factorization':
f = factorization(data)
print(f)
elif cmd=='fib':
b = fib(data)
print(b)
pass
#ha ahsbas
def main():
run_cli()
main()
In: Computer Science
write the code in python
Design a class named PersonData with the following member variables:
Write the appropriate accessor and mutator functions for these member variables. Next, design a class named CustomerData , which is derived from the PersonData class. The CustomerData class should have the following member variables:
The customerNumber variable will be used to hold a unique integer for each customer. The mailingList variable should be a bool . It will be set to true if the customer wishes to be on a mailing list, or false if the customer does not wish to be on a mail-ing list. Write appropriate accessor and mutator functions for these member variables.
Next write a program which demonstrates an object of the CustomerData class in a program. Your program MUST use exception handling. You can choose how to implement the exception handling. Organize your non object oriented code into a main function
In: Computer Science
Task 4
The class Polynomials is a collection of polynomials of either
implementation stored in an instance of the
generic library class List.
class Polynomials
{
private List<Polynomial> L;
// Creates an empty list L of polynomials
public Polynomials ( )
{ … } (1 mark)
// Retrieves the polynomial stored at position i in L
public Polynomial Retrieve (int i) (1 mark)
{ … }
// Inserts polynomial p into L
public void Insert (Polynomial p) (1 mark)
{ … }
// Deletes the polynomial at index i
public void Delete (int i) (1 mark)
{ … }
// Returns the number of polynomials in L
public int Size ( )
{ … } (1 mark)
// Prints out the list of polynomials
public void Print ( )
{ … }
}
In: Computer Science
Provide a summary of WPA2 and WPA3. How is WPA2 more secure than WPA? How is WPA3 more secure than WPA2? Does WPA3 still have vulnerabilities?
In: Computer Science
What are the principle security hardening steps for a virtual machine environment?
In: Computer Science
7. Use the substitution & method of INSERT command to populate EMP_PROJ table. INSERT INTO EMP_PROJ VALUES (‘&empNo’, ‘&projNo’, &hoursWorked); NOTE: enclose &empNo in ‘ ‘ if the datatype is a string – VARCHAR2 or CHAR If empNo is NUMBER datatype then do not enclose &empNo in ‘ ‘!
empNo |
projNo |
hoursWorked |
1000 |
30 |
32.5 |
1000 |
50 |
7.5 |
2002 |
10 |
40.0 |
1444 |
20 |
20.0 |
1760 |
10 |
5.0 |
1760 |
20 |
10.0 |
1740 |
50 |
15.0 |
2060 |
40 |
12.0 |
In: Computer Science
(a) Assume that a polynomial-time primality testing algorithm, calledPrimes is available, which takes as input a single numbern >1 and outputs whethernis a primenumber or not. Now consider the following algorithm:
Input: A natural number n > 1
Algorithm Mystery(n)
if ( n mod 2 == 0 ) then
if (n == 2) then
output ‘‘Input is a prime number’’
else ‘‘Input is not a prime number’’
else
Primes(n)
What is Algorithm Mystery trying to achieve? What is tightest possible lower bound that you can prove for Mystery and why? What is the tightest possible upper bound, assuming Primes(n)runs in quadratic time, that you can prove for Mystery and why? (b) Solve the recurrence T(n) =T(n/2) + 1 with the initial condition T(1) = 1. Show all steps. You may assume that is a power of 2 if it is convenient. Give one example of an algorithm whose time complexity can be expressed by this recurrence. Briefly explain what this algorithm does and how, and also what is its input.
In: Computer Science
Use attribute directives to display credit card logo based on the credit card number Use simplified rules as follows:
4 visa
5 mastercard
34 and 37 amex
30, 36, 38, 39 diners
60, 64, 65 discover
In: Computer Science
Discuss why naming conventions are important and why as a programmer you should consistently follow them. Include in this discussion, problems that could arise in naming variables if one convention is NOT followed.
In: Computer Science