Table of Contents

Josh Cavaluzzi's Super awesome fall2012 Opus that is gonna BLOW YOUR FREAKIN' MIND

LIKE I SAID, IS GONNA BLOW YO MIND

Introduction

Hello! I began my journey as a Computer Science major about 9 months ago, and it has been a journey of great sacrifice and success! Having taken C/C++ Programming, I have found that I am ready to partake in the quest to become a great programmer!

Part 1

Entries

Entry 1: August 30, 2012

Mercurial/hg/Repository

  • On this date, the class was first taught how to use Mercurial through linux, which will be used as revision control.
  • This will allow the class to create and upload files into a database that can be updated at any time. It also allows the class to revisit a previously saved version of a file, and retrieve that file.
  • I used revision control in a class before (Structured and Object Oriented Problem Solving) with Joe, but he used www.bitbucket.org, which wasn't the easiest thing to mess with.
  • I find that using Mercurial through linux is much easier than in Windows and that unforgiving website, but, overall, revision control is a huge part of programming and is very, very important!

Entry 2: September 4, 2012

Truth Table

  • On this day, we learned about the Truth Table.
  • This showed me what each of the possibilities are and what they are represented by.
  • I learned about this a little in SOOPS and Computer Essentials, but the new names for each of the different combinations is a first for me.
  • I still need to understand what each of those new terms mean and what they represent, as well as memorize most to all of the Truth Table.

Entry 3: September 12, 2012

  • We learned how to use VI/VIM in UNIX/Linux.
  • VI (Visual) and VIM (Visual Improved) are both text editors available on UNIX.
  • They are very useful because they have many different settings for modifying a file without actually typing in words. The possibilities are ENDLESS!
  • With all of the different commands to edit the files through VI/VIM, I am having a difficult time learning and remembering all of the commands and their purposes. I need to practice it more, sometimes I have to resort to using nano, which works for the time being, but VI is so much better!

Entry 4: September 19, 2012

  • In data, I first grasped the concept of Linked Nodes and the program created the previous class.
  • The Linked Nodes concept is very similar to the concept of arrays. It takes multiple values and stores them in the order they were input. Linked Nodes just take more to program and make one think more about it. It requires structs, renaming of variables, all sorts of things I wasn't very familiar with before.
  • By working on this, I have become more familiar with structs, renaming of variables, and the way that Linked Nodes works in general.
  • The nodes themselves can have both a “name” and value or just a value. They could just have a “name”, but what is the point of that when inserting a value and that value actually having meaning? Know what I mean? Anyway, the big understanding I had with the Linked Node program was appending and removing nodes from the list.

Keywords

data Keyword 1

passing by address (function parameter passing)

Definition

Passing by address is just one of the ways that you pass a variable into a function. This is done not by passing the variable itself, but by passing the variable address. The only uses for this type of variable passing that I have encountered are arrays.

References

Phase 2

pointer assignment

Definition

The pointer assignment statement causes a pointer to become associated with a target or causes the pointer's association status to become disassociated or undefined. this means that a pointer or (*) can force a pointer or word or number to be paired with another or not depending on how it is used.

References

List any sites, books, or sources utilized when researching information on this topic. (Remove any filler text).

  • google.com

Demonstration

Demonstration of the indicated keyword.

The following is the demonstration of pointer assignment by using the code and the resulting output:

  1 #include <stdio.h>
  2 #include <stdlib.h>
  3 
  4 int main()
  5 {
  6     char *array1, *array2;
  7     int i = 0;
  8 
  9     array1 = (char *)malloc( sizeof(char) * 4 );
 10     array2 = (char *)malloc( sizeof(char) * 4 );
 11 
 12     printf("Please input four values for the first array\n");
 13 
 14     for( i; i < 4; i++ )
 15     {
 16         scanf("%hhu", &*(array1 + i));
 17         *(array2 + i) = 0;
 18     }
 19 
 20     printf("Here are the values in both arrays:\nArray1: ");
 21 
 22     for( i = 0; i < 4; i++)
 23     {
 24         printf("%hhu ", *(array1 + i));
 25     }
 26     printf("\nArray2: ");
 27 
 28     for( i = 0; i < 4; i++)
 29     {
 30         printf("%hhu ", *(array2 + i));
 31     }
 32 
 33     array2 = array1; // Example of Pointer Assignment
 34 
 35     printf("\nHere are the results after setting 'array2' = to 'array1':\nArray1: ");
 36 
 37     for( i = 0; i < 4; i++)
 38     {
 39         printf("%hhu ", *(array1 + i));
 40     }
 41     printf("\nArray2: ");
 42 
 43     for( i = 0; i < 4; i++)
 44     {
 45         printf("%hhu ", *(array2 + i));
 46     }
 47 
 48     printf("\n\nThank you for your time.\n\n");
 49     return(0);
 50 }

The code makes two arrays, sets one equal to whatever input the user decides to go with, and the other being equal to 0. The program will then print the arrays, then set the second array equal to the first, which is the example of pointer assignment. The program is assigning the second array to the data in the first array. The result is then this:

lab46:~/src/opus/opus1$ ./pa
Please input four values for the first array
1 2 3 4
Here are the values in both arrays:
Array1: 1 2 3 4 
Array2: 0 0 0 0 
Here are the results after setting 'array2' = to 'array1':
Array1: 1 2 3 4 
Array2: 1 2 3 4 

Thank you for your time.

lab46:~/src/opus/opus1$ 

discrete Keyword 1

Right Complementation

Definition

When given a Truth Table, you see two columns of two different values that are related to each other and show opposite relationships, most of the time they are represented by F for false and T for true. Right Complementation is the opposite of the second column, or the right one. When representing each of the results for a 4 by 2 table, there are 16 possible results, one of them being the right complementation, which is actually represented by negation q.

References

discrete Keyword 1 Phase 2

equivalence/if and only if

Definition

The opposite of an XOR, if something is T and T, then it would be T when applied.

References

Demonstration

Demonstration of the indicated keyword.

The following is the code used to demonstrate if and only if/equivalence and the resulting output when the program is run:

  1 #include <stdio.h>
  2 
  3 char logicor( char, char );
  4 
  5 char logiciff( char a, char b )
  6 {
  7     char x;
  8     if(a == b)
  9         x = 1;
 10     else
 11         x = 0;
 12     return(x);
 13 }
 14 
 15 int main()
 16 {
 17     char p = 1;
 18     char q = 1;
 19 
 20 // Printing the OR Truth Table
 21 
 22     printf("\nTreat 0 as false, and 1 as true.\n\tXOR Truth Table:\n\n");
 23     printf("\t P | Q | X \n");
 24     printf("\t___________\n");
 25 
 26 // Printing the first set of values (values for p, q, and the result of p|q)
 27 
 28     printf("\t %d | %d | %d \n", p, q, logiciff( p, q ));
 29     q = 0;
 30     printf("\t %d | %d | %d \n", p, q, logiciff( p, q ));
 31     p = 0;
 32     q = 1;
 33     printf("\t %d | %d | %d \n", p, q, logiciff( p, q ));
 34     q = 0;
 35     printf("\t %d | %d | %d \n\n", p, q, logiciff( p, q ));
 36 
 37 // Printing PART 3
 38 
 39 /*  printf("\tOR Truth Table comparing X and Q:\n\n");
 40     printf("\t P | Q | X | ( X|Q )\n");
 41     printf("\t____________________\n");
 42 
 43     p = 1;
 44     q = 1;
 45 
 46     printf("\t %d | %d | %d |    %d \n", p, q, logicor( p, q ), logicor( logicor( p, q ), q ));
 47     q = 0;
 48     printf("\t %d | %d | %d |    %d \n", p, q, logicor( p, q ), logicor( logicor( p, q ), q ));
 49     p = 0;
 50     q = 1;
 51     printf("\t %d | %d | %d |    %d \n", p, q, logicor( p, q ), logicor( logicor( p, q ), q ));
 52     q = 0;
 53     printf("\t %d | %d | %d |    %d \n", p, q, logicor( p, q ), logicor( logicor( p, q ), q ));*/
 54     return(0);
 55 }

Alternatively (or additionally), if you want to demonstrate something on the command-line, you can do so as follows:

lab46:~/src/opus/opus1$ ./iff

Treat 0 as false, and 1 as true.
	XOR Truth Table:

	 P | Q | X 
	___________
	 1 | 1 | 1 
	 1 | 0 | 0 
	 0 | 1 | 0 
	 0 | 0 | 1 

lab46:~/src/opus/opus1$ 

unix Keyword 1

Home Directory

Definition

The Home Directory is basically the place that all of a user's files and folders are stored. From the home directory, one may be able to access all of their files, or just access specifically places files. The user is able to completely customize their home directory. When files and folders are in a home directory (including readable, writable, and executable files), they are only able to be accessed by the user or any other administrator on the system. That can be changed at any point, however.

References

unix Keyword 1 Phase 2

file ownership(access control)

Definition

Allowing others to view or change a files

References

Demonstration

Demonstration of the indicated keyword.

File ownership (access control), like previously stated, determines who can either read, write, or execute a file or directory.

First, by entering 'ls' into the terminal, you can see what files are in that directory, but if you add a '-l', you can see who has access to the files. The order displayed is Owner, Group, World. For Example

lab46:~/src/unix$ ls -l
total 16
-rwxrwxrwx 1 jcavalu3 lab46 115 Sep 19 16:44 logincnt.sh
 _O__G__W_   O - Owner/G - Group/W - World
drwxr-xr-x 6 jcavalu3 lab46  66 Sep 27 23:59 projects
-rwx------ 1 jcavalu3 lab46 147 Sep 28 15:36 script2.sh
-rwx------ 1 jcavalu3 lab46 574 Sep 28 16:52 script3.sh
drwxr-xr-x 3 jcavalu3 lab46  16 Sep 26 11:39 submit
-rw-r--r-- 1 jcavalu3 lab46 195 Sep  7 15:45 unixstuffs
lab46:~/src/unix$ 

To edit a file and who can access it, simply input the command 'chmod 744* script2.sh'.

chmod stands for change mode, which is the program that allows you to modify who can access the file Followed by the change in access Lastly, the file should follow behind the change in access

* Each number represents one of the three types of access (OGW). The number for each type or access is 4(read - r), 2(write - w), 1(execute - x). The size of the number input depends on what type of access the modifier would like each “group” to access. 744 means that the Owner can read, write and execute, the Group can read and execute, and the World can read and execute.

Example:

lab46:~/src/unix$ ls -l
total 16
-rwxrwxrwx 1 jcavalu3 lab46 115 Sep 19 16:44 logincnt.sh
drwxr-xr-x 6 jcavalu3 lab46  66 Sep 27 23:59 projects
-rwx------ 1 jcavalu3 lab46 147 Sep 28 15:36 script2.sh
  ^  ^  ^
-rwx------ 1 jcavalu3 lab46 574 Sep 28 16:52 script3.sh
drwxr-xr-x 3 jcavalu3 lab46  16 Sep 26 11:39 submit
-rw-r--r-- 1 jcavalu3 lab46 195 Sep  7 15:45 unixstuffs
lab46:~/src/unix$ chmod 744 script2.sh 
lab46:~/src/unix$ ls -l
total 16
-rwxrwxrwx 1 jcavalu3 lab46 115 Sep 19 16:44 logincnt.sh
drwxr-xr-x 6 jcavalu3 lab46  66 Sep 27 23:59 projects
-rwxr--r-- 1 jcavalu3 lab46 147 Sep 28 15:36 script2.sh
  ^  ^  ^
-rwx------ 1 jcavalu3 lab46 574 Sep 28 16:52 script3.sh
drwxr-xr-x 3 jcavalu3 lab46  16 Sep 26 11:39 submit
-rw-r--r-- 1 jcavalu3 lab46 195 Sep  7 15:45 unixstuffs
lab46:~/src/unix$ 

Experiment 1

Question

Arrays in Shell Script: Fact or Fiction? (Are they different from arrays in C/C++?)

Resources

  • According to http://www.tldp.org/LDP/abs/html/arrays.html, arrays are created in the same way that they are created in C/C++ programming: array[##]
  • It also tells me that it can first introduce an array by the declare -a variable statement.
  • To dereference an array, just use curly brackets: ${array[##]}
  • Left in the comments were a few pointers (see what I did there?) about arrays: 1) The members of arrays don't need to be consecutive or contiguous. 2) Not all of the members of an array need to be initialized. 3) It is alright to leave gaps in the array (spaces of memory without values).

Hypothesis

From the information I have collected, arrays are possible and very similar to arrays in C/C++.

Experiment

I will create a shell script that will basically perform the same process as the Pointer Assignment Demonstration (http://lab46.corning-cc.edu/opus/fall2012/jcavalu3/part1?#phase_2), and compare the two. This will, hopefully, confirm my hypothesis and allow me to know and understand how arrays work in shell script as well as C/C++ (Nothing wrong with more refreshers!).

Data

The following is the shell script program I created and the results:

  1 #!/bin/bash
  2 #
  3 # You know, just a shell script file for my experiment in opus1
  4 #
  5 # I will create an identical file as the one I used in the pointer
  6 # assignment and check to see if I get the same result.
  7 #
  8 # ONWARD!
  9 
 10 for((i=0;i<4;i++)); do
 11 echo -n "Enter a value (0-9): "
 12 read array1[i]
 13 echo -n "Enter a zero: "
 14 read array2[i]
 15 done
 16 echo "Array1:"
 17 for((i=0;i<4;i++)); do
 18 echo "${array1[i]}"
 19 done
 20 echo "Array2: "
 21 for((i=0;i<4;i++)); do
 22 echo "${array2[i]}"
 23 done
 24 for((i=0;i<4;i++)); do
 25 array2[i]=${array1[i]}
 26 done
 27 echo "Array1:"
 28 for((i=0;i<4;i++)); do
 29 echo "${array1[i]}"
 30 done
 31 echo "Array2: "
 32 for((i=0;i<4;i++)); do
 33 echo "${array2[i]}"
 34 done
 35 echo "Thank you for your time."
 36 exit 0
lab46:~/src/opus/opus1/experiment$ ./array.sh
Enter a value (0-9): 1
Enter a zero: 0
Enter a value (0-9): 2
Enter a zero: 0
Enter a value (0-9): 3
Enter a zero: 0
Enter a value (0-9): 4
Enter a zero: 0
Array1:
1
2
3
4
Array2: 
0
0
0
0
Array1:
1
2
3
4
Array2: 
1
2
3
4
Thank you for your time.

Now, the results from the Pointer Assignment Demonstration:

lab46:~/src/opus/opus1$ ./pa
Please input four values for the first array
1 2 3 4
Here are the values in both arrays:
Array1: 1 2 3 4 
Array2: 0 0 0 0 
Here are the results after setting 'array2' = to 'array1':
Array1: 1 2 3 4 
Array2: 1 2 3 4 

Thank you for your time.

lab46:~/src/opus/opus1$ 

Analysis

Based on the data collected:

  • My hypothesis was correct, I was able to create a program in shell script that performed the same operations that the original Pointer Assignment program did.
  • The hypothesis was, indeed, applicable.
  • The hypothesis was basically straightforward. Of course, it usually isn't the idea or concept that is different, it is the implementation that is different.
  • In the experiment, the shell script was much more difficult to create the same output as the original program created. I was unsure of how to actually have it print each value out in a row, to make it look like it was one large number, as I did in the original. Also, I couldn't just point one array to another and say “You hold the same values as this array now!” I had to dereference the first array to allow the second to take the value that the specific space of memory was holding. If I didn't do that, it would just say “array2[i] = array1[i].” That just isn't what I wanted!
  • Shortcomings… are non-existent… in this experiment… Everything went well! I now understand how to declare arrays in shell script, how to dereference them, and how to use pointer assignments in shell script. SUCCESS!

http://beastkong.com/wp-content/uploads/2012/05/success-baby.jpg

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.

Part 2

Entries

Entry 1: October 10, 2012

  • ON THIS TREMENDOUS DAY, WE LEARNED OF THE BEAUTY OF STACKS (aka STAXX, YO).
  • Stacks are very similar to linked list, the access is the big difference.
  • In a stack, you can only access the values in it working from the top of the stack to the bottom, instead of grabbing any of the values at any time.
  • Stacks help keep things neat, no stabbing at the “pile” and loosing track of things this way!
  • I will be working on stacks and creating my own with the help of the linked list program

Entry 2: October 31, 2012

  • So… postfix notation… MIND BLOWN.
  • As opposed to infix notation ( (1 + 7) * 6 ), postfix notation lists the operations at the end of the numbers involved. For example:
    • 1 7 + 6 *
    • 5 3 - 2 /
  • We were told about this concept with the unveiling of BINARY TREE BOOM!!!!! It is used with stack-based and concatenative programming.
  • It is also known as Reverse Polish Notation (RPN).

Entry 3: October 19, 2012

  • I worked with the grep(1) command, which searches through plain text looking for lines that match a regular expression.
  • This is nice when you have a file, such as an html file, that has a lot of the html commands present, but you just want what the html file is going to be displaying (The example in class where we reduced the html file from the CCC course page to just the courses and such).
  • This command can be used right from the command line or in a program itself (Puzzle Box 2).
  • There is another type of grep(1) function that covers extended regular expressions, which is egrep(1).

Entry 4: October 17, 2012

  • I learned that there exists a tremendously hideous but interesting sorting algorithm called Bogo Sort.
  • The way Bogo Sort works is it takes a set of numbers, basically “throws them up in the air and however they land” is your new set, if the numbers aren't in numerical order, then the set will repeat the process and check again. This is done until the set is in correct numerical order.
  • This sorting algorithm is very inconvenient, can be finished within the first ten tries or never even complete, and can use up a great amount of memory.
  • However, it is very interesting knowing how it works and seeing how long and how many tries it takes to find the correct sort.

Keywords

data Keyword 2

queue overrun condition

Definition

Queue Overrun/Overflow Condition happens when a program attempts to add an element onto an already filled queue.

References

data Keyword 2 Phase 2

stack (LIFO or FIFO?)

Definition

LIFO is an acronym that stands for “Last In, First Out.” When it comes to stacks, functions and procedures that are running become stacked on top of one another in memory (called a “push”). When an item is removed from the stack (or “popped”), it is removed from the top down. This computing action allows for stack integrity, and limits access/insertion.

FIFO means “First In, First Out.” In this regard, data and processing are handled on a first come, first serve basis through usage of a queue (or linear data structure). The first process in line is handled before any others are, and then the next, and so on.

References

List any sites, books, or sources utilized when researching information on this topic. (Remove any filler text).

Demonstration

  • To put another node on top of the stack, you “push” the node onto the top of the stack and becomes the top of the stack (obviously).
  • To pull nodes from the top of the stack, you “pop” the top node off of the stack.

LIFO STACK (Last In, First Out)

(The number represents the order in which they were put into the list)

( 6 ) TOP (This would be the first one out, being the last one input, because it is on the top of the list)
  ^
  |
( 5 ) 
  ^
  |
( 4 
  ^
  |
( 3 )
  ^
  | 
( 2 )
  ^
  |
( 1 ) BOTTOM (This would be the last one out, although it was the first one input)

FIFO STACK (First In, First Out)

(The number, just like above, represents the order)

( 1 ) TOP (This would be the first one out)
  ^
  |
( 2 ) 
  ^
  |
( 3 )
  ^
  |
( 4 )
  ^
  |
( 5 )
  ^
  |
( 6 ) BOTTOM (This would be the last one out)

discrete Keyword 2

cartesian product

Definition

Cartesian Product is making one set that takes one from a set and pairs it with one value from another set. This is done for each of the values in each set. Example:

  • {1, 2} * {up, down} = {(1, up), (1, down), (2, up), (2, down)}
  • {1, 2, left} * {left, right, up, down} = {(1, left), (1, right), (1, up), (1, down), (2, left), (2, right), (2, up), (2, down), (left, left), (left, right), (left, up), (left, down)}

References

List any sites, books, or sources utilized when researching information on this topic. (Remove any filler text).

  • Reference 1
  • Reference 2
  • Reference 3

discrete Keyword 2 Phase 2

variables (environment/local)

Definition

A local variable is only known in the function that you created it in. It isn't known in any other functions and can't be used in any other function. Each time you use the function is starts at whatever value you assigned it to. Global variables are known and can be used by any function in the program. So if you make a variable outside of main() it is a global variable because it can be used in any function. If you make a variable inside main() it can only be used in main() so it is a local variable.

References

Demonstration

  1 #include <stdio.h>
  2 
  3 int glovar = 20; // Global Variable
  4 
  5 int local( int );
  6 
  7 int main()
  8 {
  9     int localvarmain = 0;
 10 
 11     printf("global variable: %d\n\n", glovar);
 12     printf("Local variable cannot be demonstrated the same way because if the program tries\n");
 13     printf("to access a variable that doesn't exist, the program will not compile correctly\n");
 14     printf("and result in the program not running correctly\n\n");
 15 
 16 // Running local function to add the local variable (to the function) to the global variable
 17 
 18     glovar = local( glovar );
 19 
 20     printf("New global variable: %d\n", glovar);
 21 
 22     return 0;
 23 }
 24 
 25 int local( int glovar )
 26 {
 27     int localvar = 10;
 28 
 29     glovar = glovar + localvar;
 30     return glovar;
 31 }

The printed result:

lab46:~/src/opus/opus2$ ./unixdemo 
global variable: 20

Local variable cannot be demonstrated the same way because if the program tries
to access a variable that doesn't exist, the program will not compile correctly
and result in the program not running correctly

New global variable: 30

unix Keyword 2

shabang

Definition

A shabang is this: #! The shabang is used to read the following test on the first line after it to determine what interpreter the user would like to… use. Some example of interpreters (Taken directly from http://en.wikipedia.org/wiki/Shebang_(Unix):

  • #!/bin/bash – Execute the file using sh, the Bourne shell, or a compatible shell
  • #!/bin/csh – Execute the file using csh, the C shell, or a compatible shell
  • #!/usr/bin/perl -T – Execute using Perl with the option for taint checks
  • #!/usr/bin/php – Execute the file using the PHP command line interpreter
  • #!/usr/bin/python -0 – Execute using Python with optimizations to code
  • #!/usr/bin/ruby – Execute using Ruby

References

unix Keyword 2 Phase 2

PATH environment variable

Definition

The $PATH variable specifies a list of one or more directory names separated by colons.

The /bin, /usr, and /local directories are typically included in most users' $PATH settings. The current directory is sometimes included, allowing programs in the current directory to be executed. Superuser (root) accounts as a rule are not include in $PATH, however, in order to prevent the accidental execution of scripts in the current directory.

When a command name is specified by the user or an exec call is made from a program, the system searches through $PATH, examining each directory from left to right in the list, looking for a filename that matches the command name. Once found, the program is executed as a child process of the command shell or program that issued the command.

References

Demonstration

The following is an example of a $PATH:

lab46:~/src/opus/opus2$  

The $PATH The home directory (~/) is the beginning of this specified $PATH, followed by the src directory, then the opus directory, and lastly the opus2 directory.

Experiment 2

Question

I downloaded VirtualBox and Debian to run on it, but when everything was installed, the possible resolutions were not available to me. I am going to experiment with it and figure out how to fix it.

Resources

I installed it with the help of Evan Olson, but the rest of my help will come from the internet and whatever I can find. Any websites used will be listed below:

Hypothesis

I believe that I will need to install packages for the resolution. I don't think there will be much more to it, maybe some command line arguments to actually use the packages or something along those lines.

Experiment/Data

I will research VirtualBox and Debian and find how to fix the problems. I will document my research and experiment in the data section below with the use of screenshots and such!

Well, the first problem I ran into was that I wasn't a sudo user, so with your help, I made myself one by going to the terminal, going to the root command prompt, accessing the visudo file, and adding myself as a user. From there, I typed in sudo apt-get install virtualbox-ose-guest-x11, which, I think, installed the Guest Addition Driver X11. I ended up getting a larger resolution (1024 x 768) instead of the monitor's natural resolution (1600 x 900). I tried the other website's tactics, which were to update Debian, remove the OSE guest additions using sudo apt-get remove virtualbox-ose-guest* and then mounted the VBOXADDITIONS ISO by using the command sudo sh /media/cdrom/VBoxLinuxAdditions.run.

Analysis

Based on the data collected:

  • Yes, but it isn't working very well. I still haven't been able to use the correct resolution.
  • I couldn't get past the 1024 x 768 resolution, even when I tried the things I was told to try on the websites, and I can't think anymore! I'm too tired!
  • I probably could have tried more, but I am going to do that tomorrow when I come in before class starts.
  • The data showed a change in resolutions, it was a better resolution than the one that I started with, but it isn't the best and I can find the best.

Conclusions

I can conclude that I have an extremely hard time messing around with operating systems and it is a lot harder than I thought it would be.

Part 3

Entries

Entry 1: November 9, 2012

  • On this day, I learned about head and tail.
  • Both are regular expressions used to access different areas of a file.
  • The expression head is used to access the top of a file, it can be manipulated with other commands to access certain amounts of the beginning.
  • The expression tail is used to access the bottom of a file, it can also be manipulated with other commands but it will access specific amounts in the bottom.
  • One can also use them together to access even more specific data in a file.

Entry 2: November 9, 2012

  • We were told more in-depth about Makefiles.
  • Makefiles are used to make compiling, copying the directory and other useful command line activities easier by typing in one or two words on the command line.
  • Some of the commands are copy, make, make debug, make poop (NOT), many other funstuffs!
  • It is a script file that just reads the file names in the directory in a lot of cases and puts them in for compiling, copying, etc.

Entry 3: November 8, 2012

  • The GD LIBRARY!!!!
  • The gd Library is used to create some sort of graphic output using programming languages and compiling those files.
  • The file given to us was a pac-man like image with a border, a rectangle on the bottom and a web-URL. With that, we were able to manipulate it and create a CCC logo just the other day.
  • There are many functions available to programmers, but the only relevant ones that I have used so far are the arc function, rectangle function, and line function.

Entry 4: November 7, 2012

  • Binary Tree Fun Stuff!
  • The binary tree is used to sort a queue of values in numerical order.
  • There are multiple ways of implementing the binary tree, we are tasked with creating an iterative method, recursive method, and stack method of sorting. Each will probably use the left-parent-right method.
  • The left-parent-right method: taking values in a queue, comparing them along the list, then moving all the way to the left and inputting the value into that node. Next, it will move to the parent node and input the next largest value. From there, it will move to the right and input the next largest value. The program will then shift back to the left, input the next largest value, then to the parent, then to the right, until it hits the middle of the queue, then it will move to the right, then the left and input the next largest value there, then to the parent, input the value, until the end of the queue is reached.

Keywords

data Keyword 3

prefix (polish) notation

Definition

Polish Notation, also known as Prefix Notation, is a form of notation that puts the operator at the beginning instead of between two numbers or other operations. Example:

  • (20 - 11) * 5 is represented as *(- 20 11) 5

References

data Keyword 3 Phase 2

Iterative Tree Traversal

Definition

Iterative Tree Traversal is the act of moving through a binary tree by the use of repetition. The function would most likely have nested for loops, which will result in more code than that of recursive tree traversal.

References

List any sites, books, or sources utilized when researching information on this topic. (Remove any filler text).

  • Reference 1
  • Reference 2
  • Reference 3

Demonstration

Demonstration of the indicated keyword.

If you wish to aid your definition with a code sample, you can do so by using a wiki code block, an example follows:

/*
 *
 * PSEUDO CODE
 *
 */
 
 
    queue[7] = 11, 22, 33, 44, 55, 66, 77;
    queuevalue = queue[0];
 
    while node -> left != NULL
        node = node -> left;
 
    node -> value = queuevalue;
 
    node = node -> parent;
    node -> value = queue[1];
 
    /* And this goes on until the tree is filled, resulting in:
 
                44
        22              66
    11      33      55      77
*/

discrete Keyword 3

kleene star

Definition

Kleene star is an operation that gives a single output (unary operation) and is used on sets of strings or sets of characters or symbols. Used a great amount in regular expressions, its purpose is to search a file for any combination of the given strings or characters.

Example:

  • {“cd”, “q”}* = {ε, “cd”, “q”, “cdq”, “cdqcd”, “qcdq”, “cdcdq”, “qqcd”, “qcdcd”, “cdqq”, …}.

References

List any sites, books, or sources utilized when researching information on this topic. (Remove any filler text).

discrete Keyword 3 Phase 2

Karnaugh Mapping

Definition

Karnaugh Mapping is a method by which one can take a truth table, or an expression, and simplify it. The working example on wikipedia is VERY useful in understanding this - I would recommend drawing it all out on a whiteboard and going by step-by-step. That is how I was able to grasp an understanding of it. I'll attach a photo as well showing how I worked through the example.

References

Demonstration

Demonstration of the indicated keyword.

For my demonstration of Karnaugh Mapping, I performed the same steps as the person that defined it originally, and took a picture of it. It is used to simplify any truth table so that you can just represent the common truths as functions.

Example:

  • If f(A,B,C,D) has any combination including AC', then the result will be true.
  • If f(A,B,C,D) has any combination including AB', then the result will be true.
  • If f(A,B,C,D) has any combination including BCD', then the result will be true.

unix Keyword 3

mesg/write/wall

Definition

  • mesg - A Unix command that allows or denies the ability of other users to write to your terminal.
  • write - used to allow people to write messages to each other.
  • wall - (an abbreviation of write to all) used to display the contents of a file or standard input to all logged-in users.

References

List any sites, books, or sources utilized when researching information on this topic. (Remove any filler text).

  • Reference 1
  • Reference 2
  • Reference 3

unix Keyword 3 Phase 2

bvi/hexedit

Definition

bvi: BVI is a binary visual editor, it allows you to visually see binary values and edit them.

Hexedit: Hexedit is a similar program that show's you the same values in hexidecimal instead of binary.

References

List any sites, books, or sources utilized when researching information on this topic. (Remove any filler text).

  • Reference 1
  • Reference 2
  • Reference 3

Demonstration

Demonstration of the indicated keyword.

Hexedit:

BVI:

Experiment 3

Question

For my final experiment of the semester, I took a computer from the LAIR and put all of the necessary parts back into it (hard drive, RAM) so I could have a computer of my own to work with during the upcoming semesters.

Resources

I received help from Tom and Evan when I put the computer together. I put my desktop computer together during the summer of 2011, but I received help from a good friend of mine and I didn't really pay much attention to what went where and how it all worked, which is why I wanted to do this, so I could get a better understanding of how things go inside of a computer.

Hypothesis

I believe that this will be a good learning experience for me. Like I had previously stated, I need to understand the inner workings of a computer more and I feel as if this is a good start.

Experiment

I am going to take a computer down in the LAIR that doesn't have all of the necessary components to run and fix it up so that it can. (The computer already has a CPU inside of it and, seeing as how I accidentally messed up my old desktop's CPU when trying to clean it out, I figure that I won't bother taking it out and putting it back in, I'll just explain its purpose without showing its installment).

Data

The modern computer begins with the computer case. Every computer has a case to protect it from dust, dirt, fur, getting kicked, holds the power supply, motherboard in most cases comes with a usb port or two, and any other drives like the CD/DVD drive, floppy disk drive, etc.

The following is a picture of the case opened up:

The next piece of hardware that should be installed is the power supply. The power supply, as you probably could have guessed, gives all of the other hardware inside of the case power so that it can function. Power supplies range in the amount of power they put out.

The following is a picture of the power supply already installed:

Next, the motherboard should be installed into the case. The motherboard connects the circuit between all of the hardware in the case. In many cases, motherboards can come with integrated graphics, networking, audio, although the integrated hardware is not as powerful as the card counterparts (graphics cards, sound cards, network cards, etc.)

Directly connected to the motherboard are the CPU and the RAM.

  • The CPU is what performs the basic arithmetic, logical and input/output operations of the instructions of the computer programs being run.

The following is a picture of the CPU covered with a heat sink which cools the CPU due to all of the processes and currents running through the CPU:

  • The RAM is used to access memory in any storage location at any time quicker than hard drives, CDs, etc.

The following is a picture of RAM connected to the motherboard:

The hard drive is the final necessary piece of hardware for the computer to run correctly. The hard drive is the storage for the computer and allows the RAM to access it whenever it is needed.

The following is a picture of the installed hard drive:

With all of the hardware installed, the computer did work, however, I found a better computer and I am using it now, so I uninstalled the hardware for others to use. But here is a picture of the hard drive and RAM before it was installed:

Analysis

Based on the data collected:

  • I learned more about how the hardware is installed and it was a grand 'ol time!
  • I had a bit of an understanding of the computer hardware from classes I have taken and when I put together my own computer, but it was nice to have a quick refresher on the hardware and it's purpose.
  • Due to the computer having a few things like the power supply, a floppy disk drive, the motherboard and the CPU already installed, I didn't actually get to install everything myself, but since I described each piece of hardware's function, I know more about it all.
  • I wanted to check the hard drive and see if there was an operating system on it or anything but the new computers came in and I didn't get that far before I picked another computer.

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.

  • Not only do I find programming to be enjoyable, but now I realize that I am interested in the separate pieces of the computer itself and not just the programs that run it. I really want to experiment more with computers and get more of an understanding of all of it.