Table of Contents

Part 2

Land of the Lost

Entry 5: March 6, 2012

gcc -Wall -g -o prog prog.c

GNU debugging
gdb ./program
break- can recognize functions or it can be used to place breaks in particular lines.
(gdb) run
Starting program: /home/jdavis34/src/cprog/m61
total is: 734
total is: 937.299438

Program exited normally.
(gdb) break main
Breakpoint 1 at 0x40053d: file m6_1.c, line 13.
(gdb) break 17
Breakpoint 2 at 0x40058f: file m6_1.c, line 17.
(gdb) break 23
Breakpoint 3 at 0x400620: file m6_1.c, line 23.
(gdb) run
Starting program: /home/jdavis34/src/cprog/m61

Breakpoint 1, main () at m6_1.c:13
13      value.x=0;
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) n
Program not restarted.
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/jdavis34/src/cprog/m61

Breakpoint 1, main () at m6_1.c:13
13      value.x=0;
(gdb)
(gdb)
(gdb)
(gdb)
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/jdavis34/src/cprog/m61

Breakpoint 1, main () at m6_1.c:13
13      value.x=0;
(gdb) 
 print- allows to print values in code 
(gdb) run
Starting program: /home/jdavis34/src/cprog/m61 
total is: 734
total is: 937.299438

Breakpoint 1, main () at m6_1.c:26
26      }
(gdb) print i
$6 = 73
(gdb) print & i
$7 = (int *) 0x7fffffffe20c
(gdb) print value
$8 = {x = 1147818794, f = 937.299438}
(gdb) 
!dice: 1d99
8-ball: question ?
  1 struct person {
  2         char name;
  3         unsigned char age;
  4         short int weight;
  5         float gpa;
  6         };
  7 typedef struct person P;
  8 
  9 P.age
 10 P.name
 11 P.gpa   

Entry 6: March 8, 2012

C++

OOP-Object-Oriented Programming

Classes & Objects

Inheritance/Multiple Inheritance

Polymorphism

Templates

Entry 7: March 13, 2012

hpc

ssh -g -L port#:vm##.student.lab user@lab46.corning-cc.edu

ssh -X root@vm34.student.lab (use for wine on vm server to use a GUI app)

Xming32 “fancy X window for windows that lets us do our fancy window servery stuff”

CYGWIN

winecfg ←- to access wine

c++

Function overloading, can have numerous variations of a function of the same name with different parameters.

steps on own header.

1. make copy

2. remove all but dec

3. remove dec in orig

4. add “ name.h” to the orig

Now in separating main, from the functions of the program, be sure to compile each separate file using

g++ -c file.cc

do this for each of the Objects

It will print out file.o

next once all objects compiled,

g++ -o programname (each object created previously) ex1.o ex2.o etc etc

Entry 8: March Day, 2012

This is a sample format for a dated entry. Please substitute the actual date for “Month Day, Year”, and duplicate the level 4 heading to make additional entries.

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

Remember that 4 is just the minimum number of entries. Feel free to have more.

cprog Keywords

Scope

Identification and definition of the chosen 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);
}
Compiler

program or interface which translates code into a machine language. Usually outputting an executable program such as we use via putty terminal.

Source Code

listing of commands, in a text based language, that are more user friendly than machine language, to be compiled or assembled into an executable computer program.

Binary Code

A form of code using 0's and 1's. More commonly associated with low level programming such as machine language, that most programmers don't work with but a library of language a compiler may use.

Flags

In programming, a flag is a predefined bit or bit sequence that holds a binary value. Typically, a program uses a flag to remember something or to leave a sign for another program.

For example, in a message being exchanged by two programs, a three-bit flag's field or data area might be set to one of three configurations:

001 (meaning “I'm a self-contained message”)

011 (meaning “I'm one of several chunks of data in this message”)

111 (meaning “I'm the last chunk of data in this message”)

Preprocessor

Separate program invoked by the compiler as the first part of translation.

The preprocessor handles directives for source file inclusion (#include), macro definitions (#define), and conditional inclusion (#if).

#include <stdio.h>
 
int main(void)
{
    printf("Hello, world!\n");
    return 0;
}

The preprocessor replaces the line #include <stdio.h> with the system header file of that name, which declares the printf()

assembler

An assembler is a program that takes basic computer instructions and converts them into a pattern of bits that the computer's processor can use to perform its basic operations. Some people call these instructions assembler language and others use the term assembly language.

Pointers

they “point” to locations in memory. In the computer, pointers are just variables that store memory addresses, usually the addresses of other variables. <codec> <variable_type> *<name>; one pointer, one regular int int *pointer1, nonpointer1; two pointers int *pointer1, *pointer2; </code>

cprog Objective

Objective

understand the difference between procedural and object-oriented languages

Method

To understand the difference between the two, it would probably be easiest to have someone create a program that best depicts both types of writing.

Measurement

Object Orientation Languages (OOL) is concerned to develop an application based on real time while

Procedural Programing Languages (PPL) are more concerned with the processing of procedures and functions.

OOL concepts includes Inheritance, Encapsulation and Data Abstraction, Late Binding, Polymorphism, Multithreading, and Message Passing while PPL is simply a programming in a traditional way of calling functions and returning values.

Analysis

Reflect upon your results of the measurement to ascertain your achievement of the particular course objective.

  • How did you do? Still somewhat confused on what exactly both entail, I guess picking this for my objective made me more curious to understand both of them a little better.
  • Room for improvement? ALOT for me in the terms of using both and knowing when and why i would want to.
  • Could the measurement process be enhanced to be more effective?
  • Do you think this enhancement would be efficient to employ?
  • Could the course objective be altered to be more applicable? How would you alter it?

hpc0 Keywords

make
Definition

The purpose of the make utility is to determine automatically which pieces of a large program need to be recompiled, and issue the commands to recompile them. To prepare to use make, you must write a file called the makefile that describes the relationships among files in your program, and the states the commands for updating each file. In a program, typically the executable file is updated from object files, which are in turn made by compiling source files.

Demonstration

Demonstration of the chosen 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$ 
Screen

Identification of chosen keyword (unless you update the section heading above).

Definition

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

Demonstration

Demonstration of the chosen 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$ 
hpc0 Keyword 11

Identification of chosen keyword (unless you update the section heading above).

Definition

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

Demonstration

Demonstration of the chosen 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$ 
hpc0 Keyword 12

Identification of chosen keyword (unless you update the section heading above).

Definition

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

Demonstration

Demonstration of the chosen 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$ 
hpc0 Keyword 13

Identification of chosen keyword (unless you update the section heading above).

Definition

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

Demonstration

Demonstration of the chosen 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$ 
hpc0 Keyword 14

Identification of chosen keyword (unless you update the section heading above).

Definition

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

Demonstration

Demonstration of the chosen 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$ 
hpc0 Keyword 15

Identification of chosen keyword (unless you update the section heading above).

Definition

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

Demonstration

Demonstration of the chosen 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$ 
hpc0 Keyword 16

Identification of chosen keyword (unless you update the section heading above).

Definition

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

Demonstration

Demonstration of the chosen 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$ 

hpc0 Objective

hpc0 Objective

State the course objective

Definition

In your own words, define what that objective entails.

Method

State the method you will use for measuring successful academic/intellectual achievement of this objective.

Measurement

Follow your method and obtain a measurement. Document the results here.

Analysis

Reflect upon your results of the measurement to ascertain your achievement of the particular course objective.

  • How did you do?
  • Is there room for improvement?
  • Could the measurement process be enhanced to be more effective?
  • Do you think this enhancement would be efficient to employ?
  • Could the course objective be altered to be more applicable? How would you alter it?

unix Keywords

PATH
Definition

PATH is an environmental variable that specifies a set of directories where executable programs are located.

Demonstration
lab46:~$export PATH=$PATH:/home/jdavis34/src/unix
Daemons
Definition

A daemon is a computer program that runs in the background as a process, instead of running in the foreground. Rather than being directly controlled by the user. Often these are used to start processes at a particular time, and or to maintain certain processes are always running.

Wild Cards
Definition

Various tools that are very powerful in the land of UNIX. These enable a user to control the output of commands without having to specify the exact context of the name of a file.

* zero or more of “any” character

? used to represent one of “any” character

\ will ignore such things as space if the variable name isn't one string.

” ” (or ' ') quote the enclosed characters

[ ] character class - match any of the enclosed characters.

[^ ] inverted character class - do not match any of the enclosed characters.

who
Definition

who - will print a list of all the current users logged in to a specific system.

Demonstration
jdavis34@lab46:~/src/cprog$ who
NAME       LINE         TIME             IDLE          PID COMMENT
jjohns43 + pts/24       2012-01-23 12:18  old          701 (cpe-74-65-82-173:S.0)
skinney1 + pts/35       2012-03-16 10:15 20:26       27443 (65-124-85-125.dia.static.qwest.net)
mfaucet2 + pts/65       2012-03-09 17:09  old        28217 (55:S.0)
thakes3  + pts/68       2012-03-16 19:16 00:01       17986 (cpe-69-207-208-154:S.0)
jdavis34 + pts/22       2012-03-06 12:57 00:18        2741 (cpe-69-205-141-69:S.0)
thakes3  + pts/76       2012-03-16 15:41 00:02        6590 (cpe-69-207-208-154:S.2)
thakes3  + pts/101      2012-03-16 20:32 00:01       19641 (cpe-69-207-208-154:S.1)
jjohns43 + pts/82       2012-02-27 11:03  old        26118 (cpe-74-65-82-173:S.0)
cron/crontab
Definition

This could be tied to daemon, but is the means of setting a daemon in the system. It is a time based job scheduler used to run periodically at certain times or dates. often used to automate system processes.

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

(at) is a powerful tool also used to schedule task, but for a single time occurrence. atrm is used to remove specific jobs, which can be done by following the command with the jobs PID number.

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

ps gives a snapshot of the current processes.

Demonstration
jdavis34@lab46:~/src/cprog$ ps
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
jdavis34  2741  0.0  0.1  13660  1916 pts/22   SNs  Mar06   0:00 /bin/bash
jdavis34  7001  0.0  0.1  13676  2028 pts/49   SNs  Mar16   0:00 /bin/bash
jdavis34  7004  0.0  0.1  13676  2032 pts/90   SNs  Mar16   0:00 /bin/bash
jdavis34 12154  0.0  0.3  42844  5376 pts/22   SN+  Mar10   1:04 irssi
jdavis34 20760  0.0  0.8  54232 13632 pts/49   SN+  Mar16   0:00 gdb bignum
jdavis34 29021  0.0  0.1  13636  1964 pts/8    SNs  08:48   0:00 -bash
jdavis34 29024  0.0  0.1  61848  2352 pts/8    SN+  08:48   0:00 screen -r
jdavis34 29203  0.0  0.0   8588   988 pts/90   RN+  09:46   0:00 ps u
kill
Definition

kill is a very powerful command with a huge list of arguments that follow it, generally used to kill a process.

Demonstration

Refer to the previous word for seeing what process was killed. The argument -9 is OP…

jdavis34@lab46:~/src/cprog$ kill -9 20760
jdavis34@lab46:~/src/cprog$

unix Objective

unix Objective

State the course objective

Definition

In your own words, define what that objective entails.

Method

State the method you will use for measuring successful academic/intellectual achievement of this objective.

Measurement

Follow your method and obtain a measurement. Document the results here.

Analysis

Reflect upon your results of the measurement to ascertain your achievement of the particular course objective.

  • How did you do?
  • Is there room for improvement?
  • Could the measurement process be enhanced to be more effective?
  • Do you think this enhancement would be efficient to employ?
  • Could the course objective be altered to be more applicable? How would you alter it?

Experiments

Hydro-Ponics

Question

This project more or less is not based off the format of being a question, but a periodical observation of a process. It also maintains the ability to monitor and maintain a system of suitable environmental aspects for efficient growth.

Resources

All of our resources exist within the “Lair” and or previous knowledge acquired as of now. (With the setting up the server and IP cam and other various monitoring instruments I am sure this will extend its welcome to the interwebs.

Hypothesis

Will our plants effectively survive for the remainder of the duration of this semester that we get to spend with such a outstanding group of individuals???? YES CAUSE WE ARE OP…

I have a garden at home, and so maintaining plants is already known, also in middle school for like 8th grade we have to develop our own hydroponics system from various jugs and tubes. The one we made was prior to spring break and had to be able to survive for the duration of our absence. (mine survived)

Experiment

1. We began with the three of us prepping the area for the experiment.

2. We then all chose two specific slots each for our plants.(8/3 = WTF…. we gave Matt 2, so this complex math was resolved(6/3))

3. Set the timers for the lights to be on for 16 hours (6am turn on, 10pm turn off)

4. We prepped the proper amount of nutrients for the water A B C. (I am adding I refused the way they were added… I wanted it put in the gallon of water not directly into the resivior)

5. We all chose our seeds to plant in our specific slots, and assembled it with the water just touching the bottom of the baskets.

6. The air pump was also plugged in and submerged under the water.

7. We then began to fiddle thumbs and stare dumbfoundly at the rapid progression of our success.

Data

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

Analysis

Based on the data collected: (TO COME)

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. (TO COME)

Experiment 5

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:

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.

Retest 2

Perform the following steps:

State Experiment

Whose existing experiment are you going to retest? Provide the URL, note the author, and restate their question.

Resources

Evaluate their resources and commentary. Answer the following questions:

Hypothesis

State their experiment's hypothesis. Answer the following questions:

Experiment

Follow the steps given to recreate the original experiment. Answer the following questions:

Data

Publish the data you have gained from your performing of the experiment here.

Analysis

Answer the following:

Conclusions

Answer the following: