Table of Contents

Dan McKinney's fall2012 Opus

Introduction

My Name is Dan McKinney. I am in my last semester of my computer science degree. This will be my second degree from corning.

Part 1

Entries

Entry 1: 9/5/2012

Today we cloned our own personal repository on lab46. A repository is great for creating programs because it gives you version control. Version control allows you to save a version of your file every time you make a change, and allows you to go back and see previous versions.

As an aid, feel free to use the following questions to help you generate content for your entries:

  • version control
  • Why was this significant? you can save a version of your file every time you make a change and have it organized.

Entry 2: 9/11/2012

Today we cloned a copy of the “bignum” repository. The bignum repository has a bunch of files and utilities that we can use to help us with our own bignum project.

As an aid, feel free to use the following questions to help you generate content for your entries:

  • bignum repository
  • has very helpful tools to use for creating our bignum programs

Entry 3: 9/18/2012

Today in discrete Matt showed us his “gimmeh” script that he wrote. It was very nifty, it allows us to enter some of our contact info, and also certian things about the class(s) that i am taking with Matt. The first thing is to tell him if the keywords that where assigned to you where discribed good enough to give a dipslay.

As an aid, feel free to use the following questions to help you generate content for your entries:

  • the “gimmeh” script
  • it will help us know what is due and when. And it will also help matt for collecting data.

Entry 4: 9/25/12

Today in class, Matt showed us a little bit about sets. We learned the notation that you use. We also learned about subsets. Matt had us start to write a program asking the user for some input and then putting then into a set and show the output in set form.

As an aid, feel free to use the following questions to help you generate content for your entries:

  • Sets
  • not sure yet, we just started to talk about them(seems to me like they are kinda like arrays)

Keywords

data Keyword 1

dynamic memory allocation (malloc/free)

Definition

dynamic memory allocation is the task of allocating a free chunk of memory specific to the size you predetermine in bytes, by using the malloc function. The chunk of memory is not always in the same location hence being “dynamic” instead of static. By using the “free” function, that will release the block of memory back to the system.

References

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

  • wikipedia
  • class
  • Reference 3

data Keyword 1 Phase 2

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

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:

#include <stdio.h>
void tripnum(int *x)
{
*x = (*x) * (*x) * (*x);
}
 
int main ( )
{
int num = 10;
tripnum(&num);
printf(" Value of num is %d\n”, num); // Value of num is 1000
return (0);
}

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

lab46:~/src$ gcc -otripnum tripnum.c
lab46:~/src$ ./tripnum
 Value of num is 1000 

discrete Keyword 1

left projection

Definition

Left Projection, in programming logic always returns the left-side value in a Truth table. So for values P and Q in a truth table, the left projection always reflects the value of P.

References

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

  • wikipedia
  • class
  • Reference 3

discrete Keyword 1 Phase 2

Left Complementation

Definition

Left Complement is similar to negation p. it is a logic operation that basically negates the p. For example if p was a 1 it would not matter what q was the result would be a 0. Likewise if p was a 0 regardless of q the result would be a 1.

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:

#include<stdio.h>
#include<stdlib.h>
char lproj(char, char);
char p;
char q;
int main()
{
 printf("P | Q | X | \n");
 printf("----------- \n");
 p = 0;
 q = 0;
 printf("%d | %d | %d\n",p,q,lproj(p,q));
 p = 0;
 q = 1;
 printf("%d | %d | %d\n",p,q,lproj(p,q));
 p = 1;
 q = 0;
 printf("%d | %d | %d\n",p,q,lproj(p,q));
 p = 1;
 q = 1;
 printf("%d | %d | %d\n",p,q,lproj(p,q));
 printf("enter either 1 or 0 for P\n");
 printf(":");
 scanf("%d", &p);
 printf("enter either 1 or 0 for Q\n");
 printf(":");
 scanf("%d", &q);
 printf("%d | %d | %d\n",p,q,lproj(p,q));
 return(0);
}
char lproj(char p, char q)
{
char x;
if(p==1)
{
    x=0;
}
if(p==0)
{
    x=1;
}
return(x);
}

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

lab46:~/src/discrete$ ./ttable
P | Q | X |
-----------
0 | 0 | 1
0 | 1 | 1
1 | 0 | 0
1 | 1 | 0
enter either 1 or 0 for P
:0
enter either 1 or 0 for Q
:1
0 | 1 | 1

Experiment 1

Question

If you take the brackets off of an if statement will it still compile and run?

Resources

based on some wikipedia articles, there are many ways to write if statement and if else statements.

Hypothesis

Based of what i know about c programming, and what i have read on wikipedia, i think that the program will still run with brackets on the if statement. I also think when you try to compile the program it will yell at you and give some warnings.

State your rationale.

Experiment

I am going to write a program with some sort of if statement in it and try to compile and run the program with the brackets on and then with them off.

Data

The data that i have collected from doing this experiment confirms that the program will compile and run with the brackets taken off of the if statement and also with the brackets on the if statement.

Analysis

Based on the data collected:

  • My hypothesis was partially correct.
  • Is there more going on than you originally thought? It will compile with no issues
  • What shortcomings might there be in your experiment?
  • What shortcomings might there be in your data?

Conclusions

My conclusion is that functions can be written different ways. At first i did not think that an if statement would run without brackets, but then after some research on wikipedia, i thought a program will probably run, i just didnt think it would compile cleanly. After preforming the experiment i found that not only will the program run with or with out brackets but the compiler runs fine and does not give any warnings or errors.

Part 2

Entries

Entry 1: October 10, 2012

Today in data structures, we talked about stacks. Stacks are pretty much like a linked list ecxept you can not insert or delete “nodes” from where ever you want. When you add an object it gets put at the top of the stack. And when you delete an object it takes it off of the top of the stack.

As an aid, feel free to use the following questions to help you generate content for your entries:

  • pop,push
  • these are the two commands to use for stacks

Entry 2: October 11, 2012

Today in discrete stuctures we went back to talking about functions. We talked about the function signature. The function signature is basically the type, return value,function name, and parameter list. The main point of the lecture was that when you declare your parameters as somthing, what ever you pass into them need to be the same type.

As an aid, feel free to use the following questions to help you generate content for your entries:

  • parameter passing is significant
  • parameter passing is significant because if you do not pass things into the parameters the same excact way that you declared them the program will not run.

Entry 3: October 25, 2012

Today in discrete we talked some more about recusion. We worked more on our inclass recursion program. Recursion is a good concept to learn because it can make your program be more efficient.

  • recursion is significant
  • it is significant because it can make your program more efficient
  • What concepts are you dealing with that may not make perfect sense?
  • What challenges are you facing with respect to the course?

Entry 4: October 31, 2012

Today in Data we talked about a binary tree. To navigate from left to right in a binary tree you “traverse”. You can not loop in a tree, if you do it is no longer a tree but a graph. Trees are like linked list but automatically sort.

  • binary trees are signigicant
  • compares inputs and traverses them to the correct side of the tree
  • What concepts are you dealing with that may not make perfect sense?
  • What challenges are you facing with respect to the course?

Keywords

data Keyword 2

stack pop operation

Definition

Stack is a data structure that is used to keep things in order. A stack allows adding and removing items in order. When something is added to the stack it goes to the top of the stack, and the first item added to the stack is the last item to be removed.Pop is the operation used to remove an item from a stack.

References

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

  • Wikipedia
  • class
  • c book

data Keyword 2 Phase 2

stack underflow condition

Definition

When a command in a program tries to pop an element from an empty stack causing it to error out.

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:

Stack A=NULL

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

lab46:~$ ./stack
1. to pop
: 1
error stack underflow!
lab46:~$  

discrete Keyword 2

subset

Definition

A subset is a set which every element in the set is contained in a larger or equal size set. In other words a set with in a set.

References

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

  • wikipedia
  • Matt
  • Class

discrete Keyword 2 Phase 2

union

Definition

Union is the combination of the elements of two sets, without any duplicates.

References

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

Demonstration

Demonstration of the indicated keyword.

A={1,3,5,7,9,} B={1,2,4,6,8} A U B={1,2,3,4,5,6,7,8,9}

Experiment 2

Question

Can you load windows 7 onto a macbook pro?

Resources

Hypothesis

Based on what i have read, i think that it is very possible and easy to install windows7 onto a macbook.

All of the articles are saying to upgrade your version of bootcamp and then just follow the on screen instructions in book camp to install windows.

Experiment

I am going to test this experiment by using my macbook pro, and attempting to load my copy of windows7 onto it. I still want the ability to use mac as well, so i am going to attempt to duel boot this bitch.

Data

I preformed the experiment.

It took around an hour to complete.

I partitioned the HDD in half and used one half for windows7 and one half for mac osx.

Boot camp then asked me to put the mac os cd in to load the drivers into windows(so that i can use the hardware).

It seems to be working fine, i can choose to boot into windows or mac, when i start up the computer.

Analysis

Based on the data collected:

  • My hypothesis was correct, you can install windows7 onto a macbook!
  • Although windows7 is installed, some features do not work( some of the key board buttons). I also get the BSOD often.
  • There may be some shortcomings in my experiment. Maybe i did not download the correct drivers(even though i used the ones provided)

Conclusions

You can most definitely load windows7 onto a macbook. It is a great idea if you like the features and security that mac provides, but also need access to the business side of computing(Microsoft office, and other common programs)

If you do not care about mac and only want to use windows i would not suggest putting windows on a macbook for a couple reasons:

1. macbooks are a lot more expensive for the hardware that you get.

2. windows7 is not as stable when loaded on a macbook with boot camp.

Part 3

Entries

Entry 1: November 15, 2012

Today in Discrete we got all of our implemented sort programs check off. Most of the class did not have it completed, but we needed to move on. We also filled out the instructor evaluation papers for Matt.

  • finishing our sort program
  • long project

Entry 2: November 16, 2012

Today in Data we took a pop knowlege quiz. We also talked more about libraries, and also learned about archives.

  • Libraries, archives

Entry 3: November 27, 2012

Today in discrete, we were introduced to some of our end of course experience. Matt went over the content of the questians and then talked a little bit about the GD librairy. We also talked about what the rest of the semester was going to consist of, as far as new material and projects.

  • the EOCE is significant to this course
  • the EOCE is significant because it is our final for the course

Entry 4: November 28, 2012

Today in Data we were introduced to our end of course experience. We talked about libraries, and binary trees as well. The rest of the classes will be working on the remaining binary tree project and EOCE.

  • EOCE is significant
  • the EOCE is significant because it is the final for data structures

Keywords

data Keyword 3

Recursion

Definition

Recursion is one technique for representing data that's size is not always known by the programmer. The implementation of recursion would be a function calling it's self in the function, there fore creating an infinite number of computations.

References

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

  • class
  • wikipedia

data Keyword 3 Phase 2

Identification of chosen keyword.

Definition

Definition (in your own words) of the chosen keyword.

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$ 

discrete Keyword 3

combination

Definition

A combination is a set containing a certain number of objects that have been selected from another set. In combinations, the order of the elements does not matter.

References

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

  • wikipedia
  • class

discrete Keyword 3 Phase 2

regular expression

Definition

Regular expressions are commands that match a pattern or characters in a string of characters or words. Some of the regular expression commands are the ^ that matches the beginning of a line, the $ matches the end of line, the \< matches the beginning of the line, \> matches the end of the word, . matches any single character, * 0 is 0 or more of the previous character or whatever you put in front of the *, [] matches any of the characters enclosed, [^ ] does not match any of the characters enclosed. Then there is also extended regular characters or egrep. Those are () which is like \( \), | which means or and + which matches 1 or more of the previous character. Usually you have to use a combinations of these to get what you want.

References

Demonstration

Demonstration of regular expression.

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

#include <stdio.h>
#include <regex.h>
int main(void)
{
        regex_t reg;
        const char *regex="[abc]";
        const char *str="sadf";
        regmatch_t matches[16];
 
        regcomp(&reg, regex, REG_EXTENDED);
 
        if(regexec(&reg, str, 16, matches, 0) == 0)
        {
                printf("regex /%s/ matched string '%s' at bytes %d-%d\n",
                        regex, str, matches[0].rm_so, matches[0].rm_eo);
        }
        else
                printf("regex /%s/ does not match string '%s'\n", regex, str);
}

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

lab46:~$ nano test.c
lab46:~$ gcc -otest test.c
lab46:~$ ./test
regex /[abc]/ matched string 'sadf' at bytes 1-2
lab46:~$ 

Experiment 3

Question

is a cpu water cooling system significantly better then a typical fan and heat sink system?

Resources

Hypothesis

based on what i have read, and learned in school, i think that a water cooling system will deffinitly cool the cpu and the over all system by a noticable amount. I am not sure how ever that it will make much of a difference when not putting a large load on the system (i.e. overclocking or gaming).

Experiment

Since i over clock my cpu to the max and game often i have done plenty of researce and have decided to purchase a corseair h100 water cooler. I will run a controll test before i install the water cooler and get a temp reading on the cpu. I will then install the water cooler, and run the same test and take another reading.

Data

While the cpu was over clocked over 4 GHz and wile playing a graphic intensive game(starcraft 2 ), the cpu was running very hot some times over 65 C. while under the same senorio with the water cooling the cpu ran around 45 c.

Analysis

Based on the data collected:

  • my hypothesis was correct
  • although my hypothesis was correct, the water cooler performed much better wile under a load then i though it would.
  • there might be some shortcomming in my experiment only because the room i was in was much warmer when i ran the second test then it was during the first. even though i dont think that would effect it much at all.

Conclusions

My feelings are, that if you plan to over clock your cpu and or you do alot of gaming, i would make the investment and buy a water cooler. On the other hand, if you dont do either of those two things then your computer should be perfectly find with the stock cooling.