Table of Contents

Michael Owens' fall 2012 Opus

3 Different Classes and more.

Introduction

I dislike introductions, so enjoy this simple thing; I am who I am, enjoy lol.

Part 1

Entries

Entry 1: August 31st, 2012

Got told today that my wonderful idea from last semester's C/C++ is no longer a wonderful idea due to the fact that I know more about C…

Well, that was definetly fine, but now I have to come up with another good idea, first idea was to use our project big num, but I can't think of some way to put those numbers into the array for it yet. But that is a possible way to do it. I will have to keep thinking about this.

Entry 2: September 5th, 2012

Displaying numbers as hex, why did I not think of this…

Ohh, that is why, I dislike displaying numbers outside of decimal numbers (aka base 10). Guess I am going to have to attempt to learn to read hexidecimal now gah…

Entry 3: September 12th, 2012

Still not 100% sure how I am going to mess around with the hex to decimal bignum thingy… I am confused on how to get the hexidecimal into variables. But I have decided how to turn the hexidecimal into decimal.

Entry 4: September 18th, 2012

Realized I forgot to do the function part of our work that we needed for discrete today. I guess that is what I get for not paying attention

Keywords

data Keyword 1

address of

Definition

Address Of: is the hexadecimal location of a variable in memory or storage.

References

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

The C Programming Language 2nd Edition By Briand W. Kernighan and Dennis M. Ritchie

data Keyword 1 Phase 2

pointer arithmetic (esp. in relation to arrays)

Definition

Pointer arithmetic is basically when you use math on pointers to accomplish a task. Generally this task is looped, where the math is incrementing or decrementing… and generally this is used for 'pointer arrays' (as opposed to 'bracket arrays').

When you want to make an array, and fill it with 20 zero's. You will create a pointer. You will then create a loop that will fill in a zero to the array, where the pointer is having a counter of some form (usually) being added to it. That part where the pointer is having stuff added to it, that's pointer arithmetic.

Pointer arithmetic is arguably faster, but it really does depend on surrounding code and the CPU and the compiler etc.

References

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

http://stackoverflow.com/questions/233148/accessing-array-values-via-pointer-arithmetic-vs-subscripting-in-c

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:

<code c> /* * Sample code block */ #include <stdio.h> #include <stdlib.h>

int main() {

  char array[20];
  char i = 0;
  while(i > 20)
  {
      array[i] = i;
      i = i + 1;
  }

}

discrete Keyword 1

contradiction/falsehood

Definition

Contradiction/Falsehood: Setting every bit to 0; Outputting logically false to all possible logical inputs.

References

discrete Keyword 1 Phase 2

nonimplication/difference/but not

Definition

Nonimplicion/difference/but not means that the only true output is if p is true and q is false. Everything else is false. So if p is 0 and q is 1 the output should be 0.

References

Demonstration

Demonstration of the indicated keyword.

lab46:~$ P = 0 Q = 0 Output = 0
lab46:~$ P = 0 Q = 1 Output = 0
lab46:~$ P = 1 Q = 0 Output = 1
lab46:~$ P = 1 Q = 1 Output = 0
lab46:~$

unix Keyword 1

Data Streams (STDIN, STDOUT, STDERR)

Definition

Data Streams:

The location information is sent to form your computer.

References

unix Keyword 1 Phase 2

Paths: Absolute and Relative

Definition

Paths specify the unique location of a file or directory by showing the root and the hierarchy of directories in which the file resides. For example, in the Lab46 file system, the path to get to the games directory is from the Lab46 root, to the user directory, followed by the games directory. This path would be written as “lab46:/usr/games”.

Paths may be absolute or relative. An absolute path is a path that points to the same file location in a file system regardless of the current, or working, directory (where the user currently is). A relative path is a path that points to the file location but is dependent on the working directory.

Examples:

/a/b/c/d is an absolute path, as it specifies the full location for the directory/file “d”.

Using the above example, if the user is currently in the /c directory, he/she could use /d as a relative path to get to d. However, if the user is currently in the /a or /b directories, typing /d will not direct him/her to d.

References

  • “Programming Logic and Design” - Joyce Farrell
  • Wikipedia - “Path (computing)”

Demonstration

Demonstration of the indicated keyword.

lab46:~$ /src/hello   (absolute path)
lab46:~$ cd /src
lab46:~/src$ ./hello  (relative path)

Experiment 1

Question

In unix's ViM, does :1m$ do the same thing as :0m$?

Resources

Basic knowledge with the unix system and ViM is very helpful in helping you understand how this will work.

Hypothesis

I hypothesis that it will move the 1st line and do the same thing. Line 0 can be the same as line 1.

Experiment

I am going to make a vim text file and just use the commands.

Create a file, put in a bunch of none repeating jibberish and run the first command, and then recreate the same jibberish, and run the second command, and then compare.

Data

This is the vi file I used for my start point

There is going to be stuff we are doing.
where we need a good chunk of space per line.
So here I am typing a bunch of jibberish lines of text.
and i don't know what we are doing yet so.
I will keep typing until matt says we can stop.
Okay I think a 7th line is way more than enough lines.
http://www.google.com/
ohh my, ohh my gosh.
hi.

Next we will run the :0m$ command

where we need a good chunk of space per line.
So here I am typing a bunch of jibberish lines of text.
and i don't know what we are doing yet so.
I will keep typing until matt says we can stop.
Okay I think a 7th line is way more than enough lines.
http://www.google.com/
ohh my, ohh my gosh.
hi.
there is going to be stuff we are doing.

This is my results after running the command :om$ It appears it moved the first line to the last line of the file.

Next lets run the :1m$ command

where we need a good chunk of space per line.
So here I am typing a bunch of jibberish lines of text.
and i don't know what we are doing yet so.
I will keep typing until matt says we can stop.
Okay I think a 7th line is way more than enough lines.
http://www.google.com/
ohh my, ohh my gosh.
hi.
there is going to be stuff we are doing.

The experiment has shown that the two commands act the same. Perform your experiment, and collect/document the results here.

Analysis

Based on the data collected: My hypothesis is correct and the commands worked as expected.

Conclusions

I have concluded that ViM does not use programming based counting for its lines (starting at 0).

Part 2

Entries

Entry 1: October 16th, 2012

Definetly couldn't figure out this sort program due today. I even have issues sleeping because of it, I tell you.

Entry 2: October 19th, 2012

I got rid of my unwanted global variable and feel very happy that it worked just like I had hoped. I still need to find an experiment though.

Entry 3: October 26, 2012

I am still stressing over the sort programs, even after talking with matt about it. I still don't get how to get them in their right positions…

Entry 4: October 29, 2012

Today we have a gaint storm coming through and i need to work out the kinks in my program, hope we dont lose power

Keywords

data Keyword 2

queue enqueuing operation

Definition

Enqueuing is the operation of putting something at the end of a queue There for adding something to the queue

References

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

  • Reference 1
  • Reference 2
  • Reference 3

data Keyword 2 Phase 2

Queue Dequeuing Operation

Definition

Removes and returns the object at the beginning of the Queue (Represents a first-in, first-out collection of objects). Often referred to as a head-tail linked list.

References

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:

/*
 * Sample code block
 */
#include <stdio.h>
 
List deque(List list1)
{
    //List is a stuct that contains the ending node's and starting node's address
    printf("%hhd", (list1 -> end));
    (list1 -> end) = (list1 -> end) -> next //could also be previous instead of end, depends on the coder's choice
    //You could also use start instead of end in this situation, both logically would, just reads different
    return(list1);
}

discrete Keyword 2

set difference

Definition

Set Difference is the resulting set from two different sets. The resulting set contains only values that were in the first set (aka set a) that are not in the second set (aka set b).

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

singleton set

Definition

A set containing only a single item in its set. (Editted by myself)

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:

/*
 * Sample code block
 */
#include <stdio.h>
 
int main()
{
    return(0);
}

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

lab46:~$ cd src
lab46:~/src$ gcc -o hello hello.c
lab46:~/src$ ./hello
Hello, World!
lab46:~/src$ 

unix Keyword 2

dot files

Definition

A dot file is a file that is not normally visible using a basic ls command. These files tend to be configuration files for other programs, but not always.

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 2 Phase 2

pipes

Definition

In Unix, a pipe (or pipeline) is used to direct the flow of output from one command as input to another command. This can be used to connect two operations together on a single command line, instead of having to use multiple command line inputs to receive the same result.

In Unix systems, pipes are shown using a vertical bar symbol, |. This bar will take the output from the command on the left, and use it as the input for the command on the right.

An example of this would be:

who | grep $USER

This would execute the who command, and then use it as input to the grep command, which would parse who for all instances of your own username.

References

Demonstration

lab46:~$ who | grep $USER
mowens3  + pts/22       2012-10-25 14:00   .          4935 (grrasp.offbyone.lan
lab46:~$

Experiment 2

Question

What is the question you'd like to pose for experimentation? State it here.

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.

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.

Experiment

How are you going to test your hypothesis? What is the structure of your experiment?

Data

Perform your experiment, and collect/document the results here.

Analysis

Based on the data collected:

  • Was your hypothesis correct?
  • Was your hypothesis not applicable?
  • Is there more going on than you originally thought? (shortcomings in hypothesis)
  • What shortcomings might there be in your experiment?
  • What shortcomings might there be in your data?

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 3

Entries

Entry 1: November 9, 2012

Finished the MOST AWESOMEST puzzlebox EVER!!!

Entry 2: November 15, 2012

Finally our set program was due, I still have no real idea how I was supose to do mine still.

Entry 3: November 27, 2012

Taking a more indepth look into how this binary tree program is going to be. Look like I will use a couple of different things. I am going to have to write stuff down on paper by the looks of it, nothing unusual though.

Entry 4: November 28, 2012

Couple of days left to do my keywords and my experiment.

This is going to be interesting. Also went over all of our end of course experiences, looks pretty fun. I am excited for this semester to be almost over. 1 more semester and hopefully I will be trnasfering to RIT!

Keywords

data Keyword 3

Recursive tree transversal

Definition

A form of going through a Tree via recursion. Recusion is calling the function while still inside the function before finishing the original function.

References

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

  • Reference 1
  • Reference 2
  • Reference 3

data Keyword 3 Phase 2

Postfix (reverse polish)

Definition

A mathematical notation wherein every operator follows all of its operands. For instance “3 + 4” would be written as “3 4 +”. If there are multiple operators the operator is given immediately after its second operand; so the expression written “3 − 4 + 5” in conventional infix notation would be written “3 4 − 5 +”

References

Demonstration

A simple demonstration of this would be 5 5 + 10 - which would equal 0

The conventional infix notation is 5+5-10.

discrete Keyword 3

Matrix Multiplication

Definition

The multiplication of two or more matrices to produce a new matrix.

References

discrete Keyword 3 Phase 2

finite state machine.

Definition

  It is conceived as an abstract machine that can be in one of a finite number of states. 
  The machine is in only one state at a time; the state it is in at any given time is called the current state.
  It can change from one state to another when initiated by a triggering event or condition, this is called a transition. 

References

Demonstration

Draw some circles and connect the dots, upload them to this.

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:

/*
 * Sample code block
 */
#include <stdio.h>
 
int main()
{
    return(0);
}

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

lab46:~$ cd src
lab46:~/src$ gcc -o hello hello.c
lab46:~/src$ ./hello
Hello, World!
lab46:~/src$ 

unix Keyword 3

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

unix Keyword 3 Phase 2

head

Definition

head is a command used to display the first few lines of a text file or piped data

References

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

en.wikipedia.org/wiki/Head_(Unix)

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:

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

lab46:~/src/unix$ head wildcard.notes
Their are a set of wild cards for your command line

* means 0 or more of any character (a true wild card);
so *.o would be any file that ends with .o

? - 1 of any character (a single wild card);
so ??? would be any file with 3 letters (so ls ??? would show any 3 letter files)

[] - 1 of any of the enclosed, so any of the letters entered in the brackets
so [rstlne] means it must have one of them to show, so ls [rstlne]* would only show
lab46:~/src/unix$

Experiment 3

Question

what is up with the “+” and the “-” from jobs

Resources

What Matt said in class and my minor playing around with it before starting the hypothesis

Hypothesis

I believe the + sign desonates the last paused job that will be resumed first in a stack style. While the - sign desonates the 2nd last paused job that will become the + sign after resuming the previous + signed job.

Experiment

I am going to run and pause several jobs, and then print out jobs, and take note of where the + and - sign are. Then resume a job, and close it. Rerun jobs, and take note of where the + and - sign are again. Contine that a couple of times taking note of where the + and the - signs god, and that should give us enough data to confirm what is what.

Data

lab46:~$ jobs
lab46:~$ cat
^C
lab46:~$ cat
^Z
[1]+  Stopped                 cat
lab46:~$ vi

[2]+  Stopped                 vi
lab46:~$ nano
Use "fg" to return to nano.

[3]+  Stopped                 nano
lab46:~$ emac
-bash: emac: command not found
lab46:~$ emacs

[4]+  Stopped                 emacs
lab46:~$ jobs
[1]   Stopped                 cat
[2]   Stopped                 vi
[3]-  Stopped                 nano
[4]+  Stopped                 emacs
lab46:~$ man jobs

after resuming and closing EMACS

lab46:~$ fg 4
emacs
lab46:~$ jobs
[1]   Stopped                 cat
[2]-  Stopped                 vi
[3]+  Stopped                 nano
lab46:~$ 

we noticed how our - on nano became a + and the vi program got -, so next we will open and close Vi, which should move the - from vi to cat.

vi
lab46:~$ jobs
[1]-  Stopped                 cat
[3]+  Stopped                 nano
lab46:~$ 

Did exactly as expected. now lets open up a couple more programs and see what happens.

lab46:~$ vi

[4]+  Stopped                 vi
lab46:~$ jobs
[1]   Stopped                 cat
[3]-  Stopped                 nano
[4]+  Stopped                 vi
lab46:~$ man
What manual page do you want?
lab46:~$ man printf

[5]+  Stopped                 man printf
lab46:~$ jobs
[1]   Stopped                 cat
[3]   Stopped                 nano
[4]-  Stopped                 vi
[5]+  Stopped                 man printf
lab46:~$ 

so now lets use basic fg, which is what this entire experiment is about.

lab46:~$ fg
man printf
lab46:~$ jobs
[1]   Stopped                 cat
[3]-  Stopped                 nano
[4]+  Stopped                 vi
lab46:~$ 

it opened our man page.

So all of this data has confirmed to me my hypothosis was correct.

Analysis

Based on the data collected: My hypothesis was correct, even after running the progams several times to make sure.

Conclusions

Jobs and fg and bg work all together and they work on a stacak based idea. Last object in is the first object out. 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.