Develop code in a Scala Maven project to monitor a folder in HDFS in real time such that any new file in the folder will be processed .For each RDD in the stream, the following subtasks are performed concurrently: (a) Count the word frequency and save the output in HDFS. Note, for each word, make sure space (" "), comma (","), semicolon (";"), colon (":"), period ("."), apostrophe (“’”), quotation marks (“””), exclamation (“!”), question mark (“?”), and brackets ("[", “{”, “(”, “” ) are trimmed. (b) Filter out the short words (i.e., < 5 characters) and save the output in HDFS. (c) Count the co-occurrence of words in each RDD where the context is the same line; and save the output in HDFS.
In: Computer Science
Think of a product that you can recycle that you might want to be able to deposit into aRecycling Machine, like maybe an empty soft drink can. Start by listing all the properties of that object that you can think of – try to come up with at least tengeneral properties of aRecyclableItemand write these down in your Assignment_Part_1_Microsoft Word document, provided for download in the assessment section of your Moodle shell. Next, use the process of abstraction to cut the number of properties back to only ‘key’ properties – write these down in the next section of your Word document. Take a look at the week 2 lecture slides if you need a reminder on how to go about this. Now, fill in the class diagram for your Item class in the Word document template provided. Your RecyclableItemclass does not have to have any methods (i.e. functions) associated with it to perform any actions other than a constructor which takes and set the key properties that you’ve identified. Next we’ll move on to RecyclingMachine class – think about what information the Recycling Machine has to keep track of to allow you to successfully deposit an item to be recycled. There will only really be three key properties that the RecyclingMachine cares about, and the RecyclingMachineclass should have the following five methods available: 1) A default constructor that takes no arguments and initialises a new object and its properties, 2) accept_product(), 3) select_product() 4) payout(anAmount) 5) print_receipt(). Fill in the class diagram for the RecyclingMachine class in the Word template, and that’s the first part completed!
In: Computer Science
How to combine these 2 main functions of c++ files in 1 main class?
//SinglyLinkedList
int main() {
SinglyLinkedList<std::string> list;
list.Add("Hello");
list.Print();
list.Add("Hi");
list.Print();
list.InsertAt("Bye",1);
list.Print();
list.Add("Akash");
list.Print();
if(list.isEmpty()){
cout<<"List is Empty "<<endl;
}
else{
cout<<"List is not empty"<<endl;
}
cout<<"Size = "<<list.Size()<<endl;
cout<<"Element at position 1 is
"<<list.get(1)<<endl;
if(list.Contains("X")){
cout<<"List contains X"<<endl;
}
else{
cout<<"List does not contain X"<<endl;
}
cout<<"Position of the word Akash is
"<<list.IndexOf("Akash")<<endl;
cout<<"Last Position of the word Akash is
"<<list.LastOf("Akash")<<endl;
list.RemoveElement("Akash");
cout<<"After removing Akash from the list
"<<endl;
list.Print();
return 0;
}
//DoublyLinkedList
int main() {
DoublyLinkedList<std::string> list;
list.Add("Hello");
list.Print();
list.Add("Hi");
list.Print();
list.InsertAt("Bye",1);
list.Print();
list.Add("Akash");
list.Print();
if(list.isEmpty()){
cout<<"List is Empty "<<endl;
}
else{
cout<<"List is not empty"<<endl;
}
cout<<"Size = "<<list.Size()<<endl;
cout<<"Element at position 1 is
"<<list.get(1)<<endl;
if(list.Contains("X")){
cout<<"List contains X"<<endl;
}
else{
cout<<"List does not contain X"<<endl;
}
cout<<"Position of the word Akash is
"<<list.IndexOf("Akash")<<endl;
cout<<"Last Position of the word Akash is
"<<list.LastOf("Akash")<<endl;
list.RemoveElement("Akash");
cout<<"After removing Akash from the list
"<<endl;
list.Print();
return 0;
}
In: Computer Science
Eighth edition Administrative office management An Introduction Zane K. Quible Ph.D.
Mary Brown, the supervisor of the word processing center in Delta Corporation in San Antonio, recently retired because of her age. During the years she had been supervisor, various managers felt that Brown should be dismissed because of her laxness in supervising the ten employees in the center. Because she reaching retirement age, however she was not dismissed. The employees were often late to work, took longer breaks that was permissible, took advantage of the corporation in terms of sick days, and so forth. Mary was repeatedly asked to be stricter in her supervisory efforts, but no noticeable changes were ever made. When the qualifications for the replacement for Mary brown were developed, the decision was made that the new supervisor should be more authoritarian and should require the employees in the word processing center to conform with existing company policy. The replacement, Annabell Jackson, was hired primarily because of her authoritarian characteristics. All of her former employers who were contacted regarding Jackson’s performance mentioned her authoritarian personality. Because of the laxness of brown and the hope that Jackson could improve the situation, she was offered the job. As the administrative office manager, you are aware that the first day Jackson is on the job will probably determine whether or not the employees in the word processing center will cooperate with her. Thus, you feel a necessity to discuss several things with her before her first day on the job.
What suggestions do you have to assure Jackson’s success as a supervisor in the word processing center?
In: Operations Management
You download two sets of posts from an online forum. Set One is a collection of posts by "pro-Hong Kong Protestors" (HKP) students. Set Two is a collection of posts by pro-Chinese Government (CG) students. (Let's say you get these two collections by searching for students who are members either of a pro-HKP group, or pro-CG group.) You compute the probabilities of different words they use, and focus on a set of six "key" words of interest, {"legal", "democracy", "violence", "legitimate", "calm", "foreign"}. You compute the "probability that, given that they use one of these five words, which word it is" (you could do this by counting up each of those words for the two sets, and dividing by the total number of those words in each set.) words: {"legal", "democracy", "violence", "legitimate", "calm", "foreign"}. pHKP = {0.2, 0.2, 0.3, 0.2, 0.05, 0.05} pCG = {0.1, 0.05, 0.3, 0.05, 0.1, 0.4}
The government tells you that they think about 10% of the
posters on the mainland are pro-HKP, and they just want to have a
conversation with these people about things.
You encounter a post. The poster uses the word "democracy" twice,
the word "violence" once, and the word "foreign" once. Assuming
that he is either pro-HKP, and follows the pHKP distribution, or
pro-CG, and follows the pCG distribution...
Q: Given government priors, what is the probability that the poster is pro-HKP? (i.e., follows the pHKP distribution rather than the pCG distribution)
In: Math
EXPLAIN ANS PLEASE:
PYTHON
1. s = 'abc'
print(s[0:] + s[-2:2] + s[:1])
2. def mirrorOnWheels(s):
prev = 0
for current in range(1, len(s) - 1):
prev = current - 1
next = current + 1
if s[prev] == s[next]:
break
else:
continue
return 0
return prev
s = 'Good decision!'
print(mirrorOnWheels(s))
3. mixture = {1:[1, 2, 0], 2:[2, 0, 1], 0:[0, 1, 2]}
print(mixture[2][2])
4. noOddHeroes = []
heroes = ['superman', 'batman', 'aquaman']
for hero in heroes:
if len(hero) % 2 == 0:
noOddHeroes.append(hero)
print(noOddHeroes)
5. candyOnStick = 'lolli lolli lolli lollipop lollipop'
wordList = candyOnStick.split('i')
d = {}
for word in wordList:
if word not in d:
d[word] = 1
else:
d[word] += 1
print(len(d))
6. def oldMcDonald(farm):
result = 0
for animal in farm:
if animal[0] in farm[animal]:
result += 1
return result
farm = {'cow':'moo', 'duck':'quack', 'cricket':'chirp'}
print(oldMcDonald(farm))
7. def analyzer(fileName):
inputFile = open(fileName)
line = inputFile.readline()
inputFile.close()
return line.count(',')
quotes = open('alice.txt', 'w')
quotes.write('Now, here, you see, it takes all the
running\n')
quotes.write('you can do, to keep in the same place.\n')
quotes.close()
print(analyzer('alice.txt'))
In: Computer Science
Cognitive Psychology: Applying The Science of the Mind (4th
Edition)
Chapter 10
Discussion Question:
What do you think is the most important factor in
communicating through your writing? Think of the comments you get
from professors, or the problems you seem to have in writing. Do
they map onto any of the factors you've read about?
Here's an example of one of my classmate
response....
I feel that with writing being such a common way of communicating
it is important to be as proficient as possible. To be able to do
so it truly helps to understand the processes involved. After
understanding the processes, you can come to utilize them within
your writing to communicate effectively. For example, the word
skipping issue in reading is something that also affects my
writing. Word skipping is one of the biggest problems I have in
reading and writing. Like stated in the textbook, short words such
as “an” and “the” are more likely to be skipped. When writing
sometimes I will repeat short words without even realizing it. When
proofreading my writing to uncover mistakes like that I will just
skip right over them without even realizing it and the mistake
remains in my writing. One of my English teachers advised me to
read through my writing backwards because this would ensure that I
read it word per word and would likely not skip over any words.
This advice helped me with detecting repeated short words that I
usually skipped over.
In: Psychology
Define: EA = (X)+ is the effective address equal to the contents of location X, with X incremented by one word length after the effective address is calculated; is the effective address equal to the contents of location X, with X decremented by one word length before the effective address is calculated; is the effective address equal to the contents of location X, with X decremented by one word length after the effective address is calculated. Consider the following instructions, each in the format (Operation Source Operand, Destination Operand), with the result of the operation placed in the destination operand.
a. OP X, (X)
b. OP (X), (X)+
c. OP (X), (X)
d. OP (X), (X)
e. OP (X), (X)+
f. OP (X), (X)+
g. OP (X), (X)
Using X as the stack pointer, which of these instructions can pop the top two elements from the stack, perform the designated operation (e.g., ADD source to destination and store in destination), and push the result back on the stack? For each such instruction, does the stack grow toward memory location 0 or in the opposite direction?
In: Computer Science
Question 5
On 31 December 2018, Sela Plc acquired Lomo Plc which had a separately identified brand, valued at £7,600,000. In addition to this, Sela Plc also estimated at the end of 2019 that their own internally generated brand is worth £12,000,000. A director has suggested that both figures should be recorded in the statement of financial position as intangible assets, as brands would strengthen their financial position. Sela Plc is currently working towards a target gearing ratio in order to secure external funds for expansion. Both brands described have an indefinite life. Requirement:
i) With reference to the above scenario, explain how these brands would be accounted for in the financial statements of Sela Plc for year ending 31 December 2019. (maximum word count 140 words)
ii) How does the recognition and accounting treatment of goodwill differ from that used for brands? Explain any three differences. (maximum word count 120 words)
iii) Explain any two justifications for reporting brands as assets. (maximum word count 40 words)
In: Accounting
c++
9.39 LAB: Replacement words
Write a program that replaces words in a sentence. The input begins with an integer indicating the number of word replacement pairs (original and replacement) that follow. The next line of input begins with an integer indicating the number of words in the sentence that follows. Any word on the original list is replaced.
Ex: If the input is:
3 automobile car manufacturer maker children kids 15 The automobile manufacturer recommends car seats for children if the automobile doesn't already have one.
then the output is:
The car maker recommends car seats for kids if the car doesn't already have one.
You can assume the original words are unique. For coding simplicity, follow each output word by a space, even the last one.
Hint: For words to replace, use two vectors: One for the original words, and the other for the replacements.
Your program must define and call the following function that
returns index of word's first occurrence in wordList. If not found,
then the function returns -1.
int FindWordInWordList(vector<string> wordList, string
wordToFind)
In: Computer Science