User Tools

Site Tools


opus:fall2012:mowens3:part1

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).

opus/fall2012/mowens3/part1.txt · Last modified: 2012/09/18 15:03 by mowens3