======Part 1======
=====Entries=====
====Entry 1: February 9th, 2012====
On the 9th of February we learned how to use arrays to take a user inputted word and break it into letter parts, store it in an array, and finally print it to the screen along with the letter ASCII values. This was of significance because we learned how to use an manipulate elements of an array with pointers and how to manipulate user input. We used the array word with pos for positioning and indexing parts of the word array for each letter, and to use those indexes of the word array to find things out about the letters. I did not find anything confusing when writing this program along with the instructor, but I have worked with arrays before.
Here is the source code of the program that was written in class on the 9th of February:
#include
#include
int main(){
char *word, len = 0, x, pos = 0;
word = (char *)malloc(sizeof(char)*24);
fprintf(stdout, "Please enter a word: ");
fscanf(stdin, "%s", word);
x = *(word + pos);
while ((x != '\0')&&(x != '\n')){
printf("In this while, x is %hhd\n", x);
len++;
pos++;
x = *(word + pos);
}
for (pos = 0; pos < len; pos++){
fprintf(stdout, "%c", *(word + pos) - 32);
}
fprintf(stdout, "\n");
return(0);
}
====Entry 2: February 14th, 2012====
On the 14th of February we learned how to use the main() function's inherited parameters to accept input in a different way than we are used to. This was of significance because it was a new way of accepting input in a more efficient way that is already included in the c language when we use the main() function. This is a very useful method of accepting arguments when the program is first run and a very efficient way of defining those arguments and having a pointer to point to them. I find that the main() function's parameters are confusing at first to work with and I have no documentation yet of the main() function, but I would assume it is part of the file. There have yet to be too many challenges that I have not been able to overcome, due to the way the material is presented and the time given to play with the things we learn.
Here is the source code of the program that was written in class on the 14th of February:
#include
#include
int main(int argc, char **argv){
unsigned char i;
if (argc<2){
printf("%8s must be run with 1 or more arguments, you only provide %hhu\n", *(argv+0), (argc-1));
exit(1);
}
printf("You ran this program with a %hhu arguments, they are:\n", argc);
for (i = 0; i < argc; i++){
printf("argv[%hhu]: %s\n", i, *(argv+i));
}
return(0);
}
====Entry 3: February 16th, 2012====
On the 16th of February we were made to write a program that associated everything we had done in class previously and outside of class to show that we could apply what we had learned so far. This was of significance because it was a way to not only test yourself but to show to the teacher that you could learn efficient through his methods, and through your own personal time devoted to the subject. If you were able to complete the task in the class period time available, it was a statement that said you understood everything taught so far in the class and were able to duplicate it and manipulate it all into one program. Some of the concepts that might not make perfect sense to me are mostly just pointers, but I feel as I find more uses for pointers, I will understand them more. I find that I am not facing too much of a challenge because I have experience with the subject matter through many different opportunities I have been given.
Here is the source code of the program that was written in class on the 16th of February:
#include
#include
#include
int main(int argc, char **argv){
int input;
bool check = false;
unsigned char i;
while (check == false){
printf("Enter a value (0-4):");
scanf("%d", &input);
if (input > 4 || input < 0){
printf("You have entered an incorrect value.\n");
check = false;
}else{
for (i = 0; i < argc; i++){
printf("argv[%hhu][%hhu]: %c\n", i, input, *(*(argv+i)+input));
}
check = true;
}
}
return(0);
}
====Entry 4: February 16th, 2012====
On the 16th of February I created virtual machines on the virtual machine server my group had created early in the HPC class. This was of significance because it will allow me to complete the network services project which comes next in my order of things and I plan on creating a proxy of some sort. Some of the problems that I ran into would include file modifications for xm##.cfg mirror links and problems with the xen conf file. I find that I am facing challenges every day in HPC and in turn learning a lot about cool projects that can be completed with the tools we learn each day through direct experience and really just diving right into things to learn about them, which is actually my favorite way of learning.
Here is the commands I had to run to complete the project:
root@vmserver02:~# xm create -c /xen/conf/vm31.cfg
root@vmserver02:~# xm create /xen/conf/vm31.cfg
lab46:~$ ssh root@vm31.student.lab
=====Keywords=====
{{page>cprogpart1&nofooter}}
{{page>hpc0part1&nofooter}}
{{page>unixpart1&nofooter}}
=====Experiments=====
====Experiment 1====
===Question===
What would happen if I were to try to install a package with aptitude that does not exist?
===Resources===
My resource can be completely by testing this on a command line interface.
===Hypothesis===
I believe there will be some sort of error that is spit back at you from aptitude based on trying to throw arguments at other commands that do not exist.
State your rationale.
===Experiment===
I am going to test my hypothesis by executing the command:
aptitude install blahblahblah
===Data===
lab46:~$ aptitude install blahblahblah
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
===Analysis===
My hypothesis was not correct, because I got an error back not from aptitude but from another source. There is definitely more going on than I had conceived to begin with, I am getting a permissions error that I am not in root.
===Conclusions===
Based on the experiment, I can say that you cannot execute an aptitude install from a lab46 account that is not rooted.
====Experiment 2====
===Question===
Is there a way to use strings in the c language without using a library?
===Resources===
http://www.dfstermole.net/OAC/hstrings.html
"In C, a string is stored as a null-terminated char array. This means that after the last truly usable char there is a null, hex 00, which is represented in C by '\0'. The subscripts used for the array start with zero (0). The following line declares a char array called str. C provides fifteen consecutive bytes of memory. N.B. Only the first fourteen bytes are usable for character storage, because one must be used for the string-terminating null."
But this source showed an include of:
"#include "
===Hypothesis===
Based on what I have read, I do not believe it is possible to use strings without an include file.
===Experiment===
To test my theory I will do more research and attempt to define a variable as type String.
===Data===
String x = "this is a string";
This code gave me an error that String is undefined. This leads me to believe that without the string include library, strings do not work in c as defined in other languages by the above.
===Analysis===
My hypothesis was correct, and the test examples show this.
===Conclusions===
I can get out of this experiment that to work with Strings in c, you have to include the String.h library.
====Experiment 3====
===Question===
Can the traffic of the irc between unix and csci be controlled by active users engaged in conversation?
===Resources===
For resources, I used a friend of mine from my hpc and c/c++ class named Josh to be the other active user in the irc to troll conversations with.
===Hypothesis===
I do believe that the irc traffic can be indeedly manipulated by active users by making conversation in only certain channels at different points in time.
To rationale this, we conducted conversations in different irc channels and the masses of the users seem to have flocked to those channels for help instead of the usual channels that the questions should be prompted in.
===Experiment===
How are you going to test your hypothesis? What is the structure of your experiment?
===Data===
The data can be viewed through the many troll of such conversations in the irc logs.
===Analysis===
My hypothesis was correct, the masses of the users did change to channels that were more active to ask their questions in.
===Conclusions===
I can now, in conclusion, manipulate the irc channels with a friend in anyway possible, maybe even to take over the world!
*Throws to bwammm sound on youtube from inception*
http://www.youtube.com/watch?v=h4a3y7xetJY