What advice would you provide to a company that has been compromised by a hacker?
Subject Information Security.
In: Computer Science
Why does the percent go beyond 100% using the progressbar?
****************************************
timer.js
**************************************
var timer = undefined;
$(document).ready(function() {
$("#start_timer").click(
function () {
var totalTime =
$("#time").val();
var interval =
$("#interval").val();
var isValid =
true;
// validate the
time
if (totalTime ==
"") {
$("#time_error").text("This field is required.");
isValid = false;
} else if
(isNaN(totalTime)) {
$("#time_error").text("Time must be a number.");
isValid = false;
} else {
$("#time_error").text("");
}
// validate the
interval
if (interval ==
"") {
$("#interval_error").text("This field is required.");
isValid = false;
} else if
(isNaN(interval)) {
$("#interval_error").text("Interval must be a number.");
isValid = false;
} else {
$("#interval_error").text("");
}
if (isValid)
{
console.log('Valid. Hence starting');
totalTime = totalTime * 1000;
interval = interval * 1000;
var elapsedTime = 0;
var progressbar = $( "#progressbar" );
var progressLabel = $( ".progress-label" );
progressbar.progressbar({
value: 0,
max: 100
});
function progress() {
elapsedTime += interval;
var perc = 100.0 * elapsedTime/totalTime;
console.log('making progress ' + perc)
progressLabel.text(perc.toFixed(0) + '%');
if(perc > 100) {
perc = 100;
progressbar.progressbar( "value", perc );
$("#start_timer").removeAttr('disabled');
} else {
progressbar.progressbar( "value", perc );
setTimeout(progress, interval);
}
}
progressLabel.text('0%');
setTimeout( progress, interval);
$("#start_timer").attr('disabled','disabled');
}
}
);
$("#totalTime").focus();
});
In: Computer Science
Write a program to perform the following two tasks:
1. The program will accept a string as input in which all of the words are run together, but the first character of each word is uppercase. Convert the string to a string in which the words are separated by spaces and only the first word starts with an uppercase letter. For example, the string "StopAndSmellTheRose" would be converted to "Stop and smell the rose". Display the result string.
2. Then the program will convert each word in the result string of task 1 into "Pig Latin" and display the result string. In one version of Pig Latin, you convert a word by removing the first letter, placing that letter at the end of the word, and then appending "ay" to the word.
For example, for the result string "Stop and smell the roses" in task 1, the Pig Latin string should be "topSay ndaay mellsay hetay osesray"
Hints:
1. In the first task, the first letter of a sentence should always be uppercase. Starting from the second letter to the last letter, if the letter is an uppercase (be cautious with I), that means it is the beginning of a new word. What you need to do is to insert a space before that uppercase letter, and change that uppercase letter to lowercase.
Python has isupper() function to check if a string or a character is uppercase, islower to check if a string or a character is lowercase
you may need a variable to remember the beginning index of a word and the ending index of a word. So you can use the two indexes to extract the word from the input phrase.
to add a space after a word, you can use the + operator as long as both operands are strings/characters
2. In the second task (pig Latin task), the result string of the first task should be passed as argument when you call the function you define for the second task.
You may need to use:
the index to access individual character (particularly the first character of each word in the sentence)
move the first character to the end of the word
add "ay" at the end of the word
Requirements:
In: Computer Science
In: Computer Science
Write a program that calls a/few function(s) to determine the
smaller of two
arguments. Test the program using integer, character and
floating-point number
arguments. Produce 3 separate programs solving the problem above.
The three
approaches you should be using are:
a) 3 different functions (findMinimum1(), findMinimum2(),
findMinimum3()), each to solve different data types
parameters.
b) Function overloading with only one function named findMinimum(
)
c) Function template with only one function named findMinimum(
)
In: Computer Science
For this problem, use the e1-p1.csv dataset.
Using the decision tree algorithm that we discussed in the class, determine which attribute is the best attribute at the root level. You should not use Weka, JMP Pro, or any other data mining/machine learning software. You must show all intermediate results and calculations.
For this problem, use the e1-p1.csv dataset.
Using the decision tree algorithm that we discussed in the class, determine which attribute is the best attribute at the root level. You should not use Weka, JMP Pro, or any other data mining/machine learning software. You must show all intermediate results and calculations.
A1 | A2 | Class |
hot | medium | N |
mild | large | N |
hot | small | Y |
cold | medium | N |
cold | small | N |
mild | medium | Y |
cold | large | N |
mild | medium | Y |
mild | large | Y |
mild | medium | N |
hot | medium | Y |
cold | large | N |
mild | small | N |
hot | medium | Y |
cold | medium | N |
In: Computer Science
Write pseudo code for the following parts of class BinarySearchTree:
a) find(x)
b) contains(x)
c) add(x)
d) remove(x)
e) splice(x)
f) min()
g) max()
h) pred()
i) succ()
j) floor()
k) ceil()
In: Computer Science
For this problem, use the e1-p3.csv dataset.
A1 |
A2 |
A3 |
Class |
low |
hot |
medium |
Y |
low |
mild |
large |
N |
low |
hot |
small |
N |
low |
cold |
medium |
N |
high |
cold |
small |
N |
high |
mild |
medium |
Y |
high |
cold |
large |
N |
low |
cold |
medium |
Y |
high |
mild |
large |
Y |
low |
mild |
large |
N |
high |
hot |
medium |
Y |
high |
cold |
large |
N |
low |
mild |
small |
Y |
low |
hot |
small |
N |
low |
hot |
medium |
N |
(1). Using the Naïve Bayes algorithm that we discussed in the class, classify the following unseen instance:
X = <A1 = high, A2 = hot, A3 = large>
You should not use Weka, JMP Pro, or any other data mining/machine learning software. You must show all intermediate results and calculations.
(2). Suppose that P(X) = 0.0667. Calculate P(Y | X) and P(N | X). You must show all intermediate results and calculations.
In: Computer Science
Name and Describe at least 3 elements to incorporate or use in secure coding.
In: Computer Science
Here is my fibonacci code using pthreads. When I run the code, I am asked for a number; however, when I enter in a number, I get my error message of "invalid character." ALSO, if I enter "55" as a number, my code automatically terminates to 0. I copied my code below. PLEASE HELP WITH THE ERROR!!!
#include
#include
#include
#include
#include
int shared_data[10000];
void *fibonacci_thread(void* params);
void parent(int* numbers);
int main() {
int numbers = 0; //user input.
pthread_t child; // create thread
pthread_attr_t attr;
pthread_attr_init(&attr);
parent(&numbers); // get user input then start
separate thread.
pthread_create(&child, &attr,
fibonacci_thread, (void*) &numbers); //starts fibonacci
thread
pthread_join(child, NULL); //waits for thread to
finish
//output to command prompt after thread
finishes.
for(int i = 0; i <= shared_data[i]; i++) {
printf("%d",shared_data[i]);
}
return 0;
}
void *fibonacci_thread(void* params) {
int fib0 = 0, fib1 = 1, next = 0;
int *pointer;
pointer = (int*) params;
int total = *pointer;
for (int i = 0 ; i < total; i++ ) {
if ( i <= 1 )
next = i;
else {
next = fib0 + fib1;
fib0 = fib1;
fib1 = next;
}
next = shared_data[i]; //store to shared_data
array
}
//pthread_exit(0);
return NULL;
}
void parent(int* numbers) {
std::cout<<"Enter in a number to generate the
Fibonacci sequence: ";
std::cin>>*numbers;
while(isdigit(*numbers) != true) {
std::cout<<"Invalid
character, please enter in a number: ";
std::cin>>*numbers;
}
return;
}
here is the error below:
student@tuffix-vm:~$ cd CPSC-351-Project2-Fall2020
student@tuffix-vm:~/CPSC-351-Project2-Fall2020$ g++ -pthread
fibonacci.cpp -o fibonacci
student@tuffix-vm:~/CPSC-351-Project2-Fall2020$ ./fibonacci
Enter in a number to generate the Fibonacci sequence: 2
Invalid character, please enter in a number: 3
Invalid character, please enter in a number: 4
Invalid character, please enter in a number: 5
Invalid character, please enter in a number: 6
Invalid character, please enter in a number: 7
Invalid character, please enter in a number: 8
Invalid character, please enter in a number: 9
Invalid character, please enter in a number: 55
student@tuffix-vm:~/CPSC-351-Project2-Fall2020$
In: Computer Science
matlab code of Free Vibration Response of the System as a Continuous/ Distributed/Infinite DOF System
In: Computer Science
Show that every schema consisting of exactly two attributes must be in BCNF regardless of the given set F of functional dependencies.
In: Computer Science
In this assignment we will be working with both text strings and a user input integer array from the data segment. The goal of the assignment is to have the user choose the number of items that they want to have in an array (we will keep it a small number for now, 1-10) and then enter those values which we will store into our array. We then want to allow them to search for a specific item in the list of number that they just entered and report if the number was found or not. Requirements:
• Name your program P02LastNameFirstName.asm
• You must make use of the data segment in order to both have strings to prompt the user and to have a location to store the values the user inputs.
• String prompts and information about the program must be given to the user in a well formatted and logical fashion so that someone using the program with no knowledge about it would understand what is happening.
• The user must be allowed to choose the number of items they are going to input, though we will limit it to a smaller number (1-10).
• The user can then enter their integers, which must be stored in the array defined in the data segment.
• You will then prompt the user for an integer to search for and then search through the input array to see if it is present. • If it is, report success. If it is not found, report failure.
Hints: • Remember that the data segment holds the larger pieces of data and the text segment has the instructions that will be run. • You can define an area for more data than you use. • Using “.align #” in the data segment can help if your array is not aligned on memory boundaries (an error you may encounter). The # refers to the boundary you want to align on, check the tooltip in MARS for more information. The value 2 is the likely choice. • Keep in mind that since we are working with integers, that we will need to move through our array with their size in mind.
In: Computer Science
The growth of clock rate is a factor of 1000, where the growth in power is a factor of 30. What is the reason behind that? Why can’t we reduce the power consumption anymore?
In: Computer Science
A company contracted security consultant to perform a remote white box penetration test. The company wants the consultant to focus on internet-facing services without negatively impacting Production Services. Which of the following is the consultant most likely to use to identify the company's attack surface? Select 2
Web crawler
WHOIS registry
DNS records
companies firewall ACL
internal routing tables
directory service queries
In: Computer Science