======Part 3======
=====Entries=====
====Entry 1: October 17, 2012====
Today we went over the creation of a C script capable of calculating the average of 4 numbers entered by the user;
//10-17script
#include
int main()
{
int a, b, c, d;
float e;
fprintf(stdout, "Please enter nubmer 1: ");
fscanf(stdin, "%d", &a);
fprintf(stdout, "Please enter number 2: ");
fscanf(stdin, "%d", &b);
fprintf(stdout, "Please enter number 3: ");
fscanf(stdin, "%d", &c);
fprintf(stdout, "Please enter number 4: ");
fscanf(stdin, "%d", &d);
e=(float)(a+b+c+d)/4;
fprintf(stdout, "The average is %f/n", e);
return(0);
}
====Entry 2: October 19, 2012====
Today was dedicated to the explanation and manipulation of processes, including the 64 kill options. The SIG commands, used to kill processes, that we covered in class include;
-1-SIGHUP (1st kill option)
-2-SIGINT
-3-SIGQUIT (sent every time 'x' button is clicked)
-4-SIGILL (kills illegal functions)
-9-SIGTERM (default kill, terminate)
-15-SIGKILL (unavoidable kill)
====Entry 3: November 2, 2012====
Today we covered the use of 'grrasp:~$', including the use of flakes to send files to other computers.
examples.)
echo $Display =output environment
who =output all environments
xeyes -display flake01:5 =send x program 'eyes' to flake01:5
pkill xeyes =kills all xeyes you initialize
xwininfo -root -display =screen details
xhost minus =blocks new things from screen
====Entry 4: November 9, 2012====
Today we covered the following commands and their uses in class;
-last = logins from now till start of month.
-head = read the first part of a file
-tail = output the last part of a file
-paste = merge lines of files
-comm = compare two sorted files line by line (show similarities)
-diff = compare files line by line (shows differences)
-join =join lines of two files to a common field.
=====Keywords=====
{{page>unixpart3&nofooter}}
=====Experiment 3=====
====Question====
What is the question you'd like to pose for experimentation? State it here.
Is there a way you can find out if a pattern occurs in something consecutively, and in reverse. It seems like a complex process so I'm curious.
====Resources====
Collect information and resources (such as URLs of web resources), and comment on knowledge obtained that you think will provide useful background information to aid in performing the experiment.
It turns out that after some research, the thing I was curious about is defined as a palindrome, it is a string of letters or numbers that reads one way the same as it does the other.
(http://en.wikipedia.org/wiki/Palindrome)
(http://www.fun-with-words.com/palin_explain.html)
====Hypothesis====
Based on what you've read with respect to your original posed question, what do you think will be the result of your experiment (ie an educated guess based on the facts known). This is done before actually performing the experiment.
State your rationale.
Based off of what I have read, and learned from other people, I believe it is more than possible to make a script that does what I'd like, as it seems there are many that already exist that do such a thing.
====Experiment====
How are you going to test your hypothesis? What is the structure of your experiment?
I will construct a script which i will then change into an executable file, I will then feed it strings of text to see if it can correctly distinguish between palindromes and non-palindromes.
====Data====
Perform your experiment, and collect/document the results here.
1 #script: exp3
2 #this is to test strings for palindrome characteristics
3 echo "String please :"
4 read str
5 len=`expr $str | wc -c`
6 len=`expr $len - 1`
7 mid=`expr $len / 2`
8 flag=1
9 m=1
10 while [ $m -le $mid ]
11 do
12 c=`echo $str | cut -c$len`
13 p=`echo $str | cut -c$m`
14 if [ $c != $p ]
15 then
16 flag=0
17 break
18 fi
19 m=`expr $m + 1`
20 len=`expr $len - 1`
21 done
22 if [ $flag -eq 1 ]
lab46:~/src/Unix/submit/Opus$ ./exp3
String please :
cat
The string is not palindrome
lab46:~/src/Unix/submit/Opus$ ./exp3
String please :
boob
The string is palindrome
lab46:~/src/Unix/submit/Opus$
====Analysis====
Based on the data collected:
* Was your hypothesis correct?
-Yes
* Was your hypothesis not applicable?
-No, it was.
* Is there more going on than you originally thought? (shortcomings in hypothesis)
-Yes, the logic is much more involved and the script much more complex than I would have originally guessed.
* What shortcomings might there be in your experiment?
-Lack of personal knowledge prior to the planning of the experiment.
* What shortcomings might there be in your data?
-Only two words were tested so as not to present irrelevant data past testing the script's functionality.
====Conclusions====
What can you ascertain based on the experiment performed and data collected? Document your findings here; make a statement as to any discoveries you've made.