User Tools

Site Tools


opus:fall2012:eolson1:start

Evan Olson's Fall2012 Opus

Introduction

My name is Bevan Bolson Boy! as seen above. I am a computer science major with a little hesitation. I transfered over from engineering science and Im not sure what I am totally interested in. I am pretty sure it is some type of engineering though, just not what branch. I am interested in pretty much everything but I just need to find my passion.

Part 1

Entries

Entry 1: discrete/data August 29, 2012

Durring this class session we began talking about pointers and memory. Such as the different ways memory can be stored, data types. some of the various data types are integers, characters, float, double, boolean and string etc. Pointers on the other hand are very different. Pointers hold the adress of allocated memory. Basically a sign on a highway telling where a city is.

This is very significant because this is how data is stored in memory on the computer. Each data type has its own purpose and is very important when planning a program. Same with pointer although very different and having a different purpose very important when planning a program.

I am a little shakey on the concept of pointers but after the lecture on the 31st i felt a little more confident and it seemed to make more sense. This might change…

The biggest chalenge i am having with the course is the fact that i feel as if i learned absolutly nothing in my c/c++ class last semester. I got a good grade but do not feel i learned up to my grade and that is frustrating to me.

Entry 2: Discrete September 4, 2012

On this day we started talking about logic. Logic is a very important thig when it comes to computers and software. Logic is the backbone of software or programs without logic there would be no computer programs. We also went over the logic table. We created the table and named six binary and one unary opperation.

Binary: AND, NAND, OR, NOR, XNOR, XOR Unary: NOT

After creating the logic table the class begain name where those opperations where on the logic table. This confused me a little bit i didnt seem to get where and how you knew what opperations were which on the table.

I definitally need to sort this out. I will be asking for help.

Entry 3: Unix September, I cant remember, 2012

Today we began going over the vi editor. This was very usefully because i was constantly dealing with scrutiny and judgment when using the infamous nano editor. Not only was a able to feel more accepted when using it but I was also able to become more efficient when typing code using the many key commands implemented in vi. Just a few of the commands that where taught were i, w , b, ^ and $. These are just a few of the commands but using them efficiently can greatly improve productivity.

i is simple it simply allows you to enter [insert] mode.

w is very usefully and allows you to advance a work or a certain number of words by entering 5w or 9w or 10w.

b is very much the same except for going back a word or a number of words.

$ sends the cursor to the end of the line.

As i said these are only a few of the things described in the class but i thought they were some of the most useful. I found it very useful at least. There was really nothing in this lecture that i had a hard time understanding it will just take practice and use to remember all of the commands. I am having no challenges with respect to the course.

Entry 4: Data September sometime, 2012

During this lecture we began the concept of linked list and “nodes”. This concept is very useful and inherently confusing. A linked list allow you to allocate a computers memory until it basically runs out. This is very useful when you want to store data but do not know necessarily how much data or how many values you will need to store. Hence the name Linked List, it is a list of data that is linked so it may be navigated. A linked list is similar but at the same time VERY different from an array and array is finite and once defined its space allocated cannot be “re allocated” and the array cannot be re sized. I have been dealing with a lot of understanding issues regarding linked lists but i am getting help and i begin to understand more and more every time i get help and expose myself to them. The only challenges i feel like i am facing for this course is my understanding due to lack of prior knowledge but that is quickly becoming less of a problem because of the high amount of exposure i am having to the material!!!!

Keywords

data Keyword 1

Null Pointers

Definition

A Null pointer is a pointer that points definitivly nowhere. it does not yield the address of any object or function.

malloc for instance returns a null pointer when it fails.

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

passing by reference (function parameter passing) [C++]

Definition

To use the address of a variable as a reference to some sort of data contained in the variable to send to some algorithmic function which can use the variable's data to perform some sort of action or solve a problem.

References

Demonstration

Demonstration of the indicated keyword.

The code block below demonstrates the concept defined above.

  1 #include <stdio.h>                                                                                           
  2 #include <stdlib.h>
  3 
  4 int Sum(int, int);
  5 
  6 int main()
  7 {
  8     int a;
  9     int b;
 10     int S;
 11 
 12     printf("please enter two values you would like to add together.\n");
 13 
 14     scanf("%d", &a);
 15     scanf("%d", &b);
 16 
 17     Sum(a, b);
 18 
 19     printf("\nThe sum of a and b is %d.\n", Sum(a, b));
 20     return 0;
 21 }
 22 
 23 int Sum(int a, int b)
 24 {
 25 
 26     int S;
 27 
 28     S = a + b;
 29     return (S);
 30 }

discrete Keyword 1

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

discrete Keyword 1 Phase 2

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

Demonstration

Demonstration of the indicated keyword.

Right Complementation is very similar the Negation P except its Negation Q if you get a combination of P:1 and Q:0 the result will be 1 negating Q and similarly if it is P:0 and Q:1 then the result will be 0. so no mater what P is the answer will always be the negation of Q

The c code block below reflects this.

char NP(char P, char Q)                                                                                      
  2 {
  3     char x;
  4 
  5     if (Q == 0)
  6         x = 1;
  7     else
  8         x = 0;
  9 
 10     return (x);
 11 }

unix Keyword 1

Remote Host

Definition

A remote host is a computer typically refereed to as a server in a private or a public network. The computer or server will be located in a distant location. This server or computer can retrieve and store data and users can even access data off of them. A good example would be the servers located here at the business center when we log on and access files from home.

References

unix Keyword 1 Phase 2

File Listing

Definition

File listing in unix is a command “ls” when you type ls into the terminal it will list all the files or directory's in that directory. File listing can also be used with parameters such as -l. when you type “ls -l” it will list all the files again but you will also see more details about the files such as the various permissions the file or directory has. For more information you can visit the “ls” man page.

References

  • “ls” man page

Demonstration

Demonstration of the indicated keyword.

An example on the Terminal.

lab46:~$ ls
Desktop    Maildir   Public     arc.tar          archives     data         lyrics.mp3    src
Documents  Music     Templates  archive1.tar.gz  closet       file.txt.gz  public_html   the answer.txt
Downloads  Pictures  Videos     archive2.zip     courses.tar  logincnt.sh  puzzlebox.sh
lab46:~$ 
lab46:~$ ls -l
total 48
drwxr-xr-x 2 eolson1 lab46     6 Aug 28 14:21 Desktop
drwxr-xr-x 2 eolson1 lab46     6 Aug 28 14:21 Documents
drwxr-xr-x 2 eolson1 lab46     6 Aug 28 14:21 Downloads
lrwxrwxrwx 1 eolson1 lab46    17 Aug 25 15:40 Maildir -> /var/mail/eolson1
drwxr-xr-x 2 eolson1 lab46     6 Aug 28 14:21 Music
drwxr-xr-x 2 eolson1 lab46     6 Aug 28 14:21 Pictures
drwxr-xr-x 2 eolson1 lab46     6 Aug 28 14:21 Public
drwxr-xr-x 2 eolson1 lab46     6 Aug 28 14:21 Templates
drwxr-xr-x 2 eolson1 lab46     6 Aug 28 14:21 Videos
-rw-r--r-- 1 eolson1 lab46 10240 Sep 21 16:01 arc.tar
-rw-r--r-- 1 eolson1 lab46   237 Sep 21 15:42 archive1.tar.gz
-rw-r--r-- 1 eolson1 lab46   584 Sep 21 15:42 archive2.zip
drwxr-x--x 3 eolson1 lab46    80 Sep 21 16:00 archives
drwxr-xr-x 2 eolson1 lab46    17 Sep 14 16:37 closet
-rw-r----- 1 eolson1 lab46 10240 Sep 22 15:15 courses.tar
lrwxrwxrwx 1 eolson1 lab46    27 Aug 29 13:56 data -> /usr/local/etc/data/eolson1
-rw-r--r-- 1 eolson1 lab46    76 Sep 22 15:00 file.txt.gz
-rwxr-x--- 1 eolson1 lab46   112 Sep 19 16:40 logincnt.sh
-rw-r--r-- 1 eolson1 lab46   658 Sep 21 11:51 lyrics.mp3
drwx-----x 2 eolson1 lab46     6 Aug 26  2009 public_html
-rw-r--r-- 1 eolson1 lab46   447 Sep 22 15:35 puzzlebox.sh
drwx------ 8 eolson1 lab46   108 Sep 19 14:15 src
drwxr-xr-x 2 eolson1 lab46    21 Sep 24 13:25 the answer.txt
lab46:~$ 

Experiment 1

Question

what would happen if i modified the guessing game script to try to guess itself would it ever get it right?

Resources

Hypothesis

Since i set it up to have one value static and one continuing to be random i think it will be possible

Experiment

I will write and test a bash script in a controlled environment!

Data

Nope 15864 is not equal to 25740
guess a value: 22205
Nope 22205 is not equal to 25740
guess a value: 4461
Nope 4461 is not equal to 25740
guess a value: 12557
Nope 12557 is not equal to 25740
guess a value: 28518
Nope 28518 is not equal to 25740
guess a value: 17998
Nope 17998 is not equal to 25740
YAY!!!!! IT WORKED! 25740 was equal to 25740
It took 21678 guesses.
evan@evan-Extensa-4630Z:~$

This was the final result after letting the script run for about 1 minute.

The code i used :

#!/bin/bash
#script 3
#
#
value=`bc <<< "$RANDOM"`
num=5
count=0;
 
while [ $num -ne $value ] ;
do
 
echo -n "guess a value: " 
echo "$num"
echo "Nope $num is not equal to $value"
count=$((count+1))
num=`bc <<< "$RANDOM"`
 
done
 
echo "YAY!!!!! IT WORKED! $num was equal to $value"
echo "It took $count guesses."
exit 0

Analysis

Based on the data collected:

  • Yes the hypothesis was correct.

One shortcoming of this would be knowing the exact time it took I feel that would have been nice to have.

Conclusions

I was pretty confident that the experiment would work but i was a little unsure of how long it would take. I implemented the counter to get an idea but it would have been nice ti have a run time timer of some sort. maybe a future revision…

Part 2

Entries

Entry 1:UNIX October 12, 2012

In class today we began talking about programming. We walked through through the different languages or tools available to the average programer to complete certain tasks. Some of the different types of languages are logical, procedural, functional etc… These different types all have there purpose and are used for different tasks. Then we talked about the different levels of programming languages such as the assembly language which is very low level all the way up to c++ which is much higher lever. Then we wrote and compiled Hello.c. All the concepts talked about today made sense to me. I am not really facing any challenges with this course.

Entry 2: UNIX October 19, 2012

Today we began by talking about the ps command like we talked about last class. We got into ps aux which shows all the processes running on the system. Then we talked about the command top. Top shows you the top running programs on the system at that time and it also refreshes itself! Also a command called whowatch became apparent to us. we then began talking bout and using the sed command which is a stream editor with that and the cut command we were able to edit our output of ps aux to what we wanted.

  • just a cool what to see what is running on the system.
  • all of this made sense

Entry 3: DATA October 31, 2012

On the dark Halloween day we started to talk about the binary tree. They seem to be very useful in the sense that they can be used for sorting automatically. There very structure allows them to sort. There are also many ways to implement them such as recursion, iteration, and even stacks. We then talked about infix notation and how the computer does the math functions different than we do. we will writ an equations (2+3)*6 and the computer will do 2 3 + 6 *. so 2 3 and the operation and do that 6 * (six times)

  • This was very interesting seeing the logic to this after trying our own implementation of a sort
  • seems very simple i am excited to attempt implementing it.
  • I am not really sure what is not making sense because i have not played with it yet.

Entry 4: UNIX October 31, 2012

In class today we did more with editing a string. We used the file spring2013-20121026.html. Most of our experimentation consisted of the sed command to replace strings of characters with other things to make the string more useful. Many times we removed a ton of code. In this case the file was an html file so after removing all the html code the file became very useful. This was very eye opening someone who was experienced with these techniques could especially get a ton of information very quickly and efficiently from different sources.

  • I just need more practice using the sed command and scanning for useful information in various files.

Keywords

data Keyword 2

stack overflow condition

Definition

A stack overflow is when to much memory is used when creating a stack. when a stack is created it uses something called a push which is basically the append function in a linked list. The push will “Push” something on the stack. similar to a stack of papers the “push” puts a paper on the top of the stack. A stack overflow is when you put to many papers on the stack.

References

data Keyword 2 Phase 2

! queue data structure !!!!

Definition

Queue Data Structure

Queue is a specialized data storage structure (Abstract data type). Unlike, arrays access of elements in a Queue is restricted. It has two main operations enqueue and dequeue. Insertion in a queue is done using enqueue function and removal from a queue is done using dequeue function. An item can be inserted at the end (‘rear’) of the queue and removed from the front (‘front’) of the queue. It is therefore, also called First-In-First-Out (FIFO) list. Queue has five properties - capacity stands for the maximum number of elements Queue can hold, size stands for the current size of the Queue, elements is the array of elements, front is the index of first element (the index at which we remove the element) and rear is the index of last element (the index at which we insert the element).

Queue is a data structure that maintain “First In First Out” (FIFO) order. And can be viewed as people queueing up to buy a ticket. In programming, queue is usually used as a data structure for BFS (Breadth First Search). Queue operations

Operations on queue Q are :

1. enqueue - insert item at the back of queue Q 2. dequeue - return (and virtually remove) the front item from queue Q 3. init - intialize queue Q, reset all variables.

References

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

Demonstration

This is a basic linked list based demonstration of a queue. A queue is basically a line so first in the queue is at the “front” of the line and when you insert into the queue you insert at the end just like a line.

discrete Keyword 2

power set

Definition

A power set is a set of all the subsets. This set includes the empty set and the set itself. for example if we took a set called t={x,y}. All the subsets would be:

{} {x} {y} {x,y}

Thus the power set of this would include:

P(t)=x_y_x_y

References

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

Demonstration

Demonstration of the indicated keyword.

Set's:

A = {1, 2, 3}

B = {2, 3, 4}

set difference C = {1}

unix Keyword 2

wildcards

Definition

wildcards are used in unix and other operating systems when searching for files or directory’s. some of the most common wildcards are the * and ?. The asterisk is used to represent any number of unknown characters. For example if you typed in file* you may receive a number of files beginning with file… file1.txt, file2.txt, fileboy.txt, fileoctopus.txt. Note that the .txt has nothing to do with it it is just a file name extension. The ? make on the other hand only represents one unknown character so if you typed in file? you will only receive file names such as file.txt, file1.txt, file2.txt but now files with more than one extra character after the name file.

References

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

Demonstration

The #!/bin/bash makes the script use the bash interpreter.

  1 #!/bin/bash
  2 #
  3 #script 3
  4 #
  5 #
  6
  7 value=`bc <<< "$RANDOM"`
  8 num=`bc <<< "$RANDOM"`
  9
 10 While [ $num -ne $RANDOM ] ;
 11 do
 12
 13 echo -n "guess a value: "
 14 echo "$num"
 15 echo "Nope $num is not equal to $RANDOM"
 16
 17 done
 18
 19
 20 echo "YAY!!!!! IT WORKED!"
 21
 22
 23 exit 0

Experiment 2

Question

Is it possible to run an Nvidia GPU running two monitors and a ATI GPU running a third?

Resources

After asking some Questions around the LAIR it was apparent that it was possible but could be a bit weird. After looking online i also fiound information agreeing that it would be possible. So i thought i would give it a try.

Source's:

-Wisdom and Knowledge resonating from the LAIR

-http://www.techradar.com/us/news/computing-components/peripherals/the-complete-guide-to-multiple-monitors-1074313

Hypothesis

I believe this will be possible based on what I had read and heard so basically i just decided to go full throttle and just give it a whirl.

Experiment

I am going to install an ATI graphics card borrowed from the LAIR's vast resources and start op my machine and see what happens.

Data

upon starting the computer the drivers for the graphics card were automatically installed and then i restarted the computer. Then I began to attempt to configure the tipple monitor display. In my case it was fairly easy, I stared blankly at the configuration window and wondered why it was not using the third monitor. In the middle of staring Pressly came over and simple told the Nvidia card to use the card. THEN! MAGICALLY it came alive. The point is though it did nopt give me any problems and was very simple to get the system to work.

Analysis

Based on the data collected:

  • The hypothesis was correct
  • I actually thought there would be more to it than there was. The process ended up being very simple.
  • Having two different GPU's for three monitors could have limitations especially when one is not as advanced.

Conclusions

I have ascertained that the idea will work and for my application i will have no problems. If i wanted to play games on the other hand although not tested there could be some problems.

Part 3

Entries

Entry 1: November 29, 2012

Today we will talk about graphics and creating them with the the gd library!! in class we will make a CCC logo. The logo is basically 3 consecutive half circles filled in red. When considering making an image you must consider the size if your image size is 600×800 you might want some white space and not make your image the full size. so we created margin variables that held the upper,lower, left and right margins. With these we were able to easily create parameters . Once all these are created you will fill the function with the parameters That were previously decided upon. When creating an image it is very important to “plan ahead” and what i mean by that is don't just start writing the code. This can be problematic. By “planning ahead' you have already done all the math and know all the dimensions you are working with and will be able to easily enter the information in to the function. Also do your research on the function itself. Knowing the parameters and what they mean and represent is very important. When i was creating the image that was what set me back, not being extremely familiar with the function.

Entry 2: November 9, 2012

Today we talked about a number of commands, some of which including head, and tail. These commands are mainly used in the filtering of data in large files ore outputs. First we will talk about head. head automatically will display the first 10 lines of a file or output. This can be notified. For instance if i were to type in the the terminal head -5 file.txt only the first five lines would be displayed. Now this may not seem very interesting but it can be very useful especially when combined with tail. Tail respectively automatically prints the last 10 lines ogf an output and also can be modified just like head. For example say you were only interested in a certain line of a file and you wanted it to be displayed. You could easily type “head -23 file.txt | tail -1” head would display the first 23 lines and when piped to tail it would only display the last line of that 23 therefore you have the 23rd line!!

Entry 3: November 30 , 2012

Today i spent most of my time in the lair working on the opus. I got a TON done. By the time i finish i will only have 2 demonstrations to do! This is good news!! Once the opus is finished i will then be able to start working more heavily on the binary tree and the EoCE. I plan on finishing the rest of the opus tonight which will mean i will have it done a day early!!!

Entry 4: November 30, 2012

In moy break between working on the opus and heading home i installed vlc on debian in the hopes to be able to play a dvd which happened to be in my disk drive.

Keywords

data Keyword 3

Recursive tree traversal

Definition

A tree traversal is the process of examining each node exactly once in a systematic way. Different traversals are classified and named by the process in which they examine the tree. A recursive tree traversal examines the tree recursively which is the process of calling a function within itself. One example of recursion is two mirrors faced towards each other creating an infinite recursion.

References

data Keyword 3 Phase 2

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

Demonstration

Demonstration of the indicated keyword.

This is an example of a basic tree setup. A recursive type tree traversal would have various “if's” or checks within the function before it calls itself again these check would ensure that the “tmp” or temporary variable or “position” would be sent to the right place.upon sending the tmp to that position the function might have the user enter a variable to a node that has just been created. or it might print the value that is has moved too. A recursive traversal is very AWESOME and versatile. The main processes in the recursive functions basically stay the same so only a few changes have to be made in order to create a printing function from a building function.

discrete Keyword 3

Turing machine

Definition

A Turing machine processes symbols on a strip of tape with a set of rules. A Turing machine is not really meant for practical use but more to help computer scientists understand the limits of mechanical computation. A hypothetical device to represent a computing machine.

References

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

discrete Keyword 3 Phase 2

push down automaton

Definition

Similar to a stack machine. There is a virtual stack machine that was shown to me by Presley in the form of a spark machine. The bios has a “stack machine”built in. Basically a stack machine can only access and work with the top value of the stack.

References

Demonstration

Demonstration of the indicated keyword.

Take a look at the spark machine in the back of the room using open firmware fourth interpreter.

ok 5 5 8 9 7 ok .s 5 5 8 9 7 ok

This is an example of the command line showing pushing numbers on the stack and then displaying them.

ok 5 5 + .d 10 ok

that for example is pushing two numbers on the stack adding them and then displaying the result.

unix Keyword 3

Cut

Definition

Cut removes sections of each line of files.

Print selected parts of lines from each FILE to standard output.

References

  • cut man page

unix Keyword 3 Phase 2

diff/diff3/patch

Definition

Operations used to compare files, outputting their differences, and is often used to tell the differences between versions of the same file.

References

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

Demonstration

In this demonstration I am simply using two files to demonstrate diff and all it is doing is showing the differences between the files.

lab46:~$ diff text.txt text2.txt 
2,3c2,3
< this 
< is 
---
> these 
> are 
4a5
> yo
lab46:~$ 

In this demonstration i am using diff3 to examine three files line by line

lab46:~$ diff3 text.txt text2.txt text3.txt
====
1:1,3c
  hi
  this 
  is 
2:1,3c
  hi
  these 
  are 
3:1,4c
  hello
  these
  are
  sooo
====
1:4a
2:5c
  yo
3:6c
   
lab46:~$ 

In this demonstration i created a patch file then used it.

lab46:~$ diff -Naur text.txt text2.txt > new-patch
lab46:~$ patch -p0 <new-patch
patching file text.txt
lab46:~$ 

Experiment 3

Question

Would a different configuration of the “two can and string model” increase the performance enough to be noticeable.

Resources

I basically used my own thoughts and knowledge to estimate what would be a better configuration that what was currently there.

Hypothesis

I believe that a central location on the can is ideal for the best acoustics of the can. Currently there was a central hole in the can but instead of tethering the copper wire directly to that central whole it was, loosely tied around and inside of the can. This did not make very much sense to me, i thought there would be a tremendous loss of signal. I decided to drill a second hole and tether the wire centrally on the can and not as loose.

Experiment

I AM GOING TO MAKE IT!!!

Data

After completion of the build we tested and it was clear that the system was a lot more effective. Although with a new system there will always b more bugs to figure out. I will continue toying with this system.

Analysis

Based on the data collected:

  • YES! IT WAS
  • Yes there is more. The copper wire when functioning “correctly” picks up alot of extra noise.
  • The noise issue that needs to be solved.
  • A loud room.

Conclusions

The experiment was a success and i got the results i was hoping for. I would still like to work with this idea and improve upon it.

opus/fall2012/eolson1/start.txt · Last modified: 2012/12/31 04:33 by 127.0.0.1