Table of Contents

Part 3

Entries

Entry 9: April 10, 2012

In my UNIX class i learned how to better search through files and use the head(1) and sed(1) utility to take text out of the file i did not want. sed 's/pattern/replacement/g' = pattern searching for and then replace pattern searching for with this replacement and g means globally.head -25 file.txt = -n for number of lines you want to print of the file you choose which could then be piped to sed a stream editor to remove unwanted text. a basic line may look like this

head -25 file.txt | sed -e 's/[a-z]*5/:/g' print first 25 lines of file.txt and then search for text that start with a to z and end in 5 and once found replace that with colon globally in the file.

Entry 10: April 13, 2012

C++ class

A program can be split up into multiple files making it easier to edit and understand, especially in the case of large programs but also allows the individual parts to be compiled independently.

*when compiling a large program with multiple header file remember to add this line in the header file so you do not include the same header file twice in your program.

#ifndef _HEADERFILENAME_H #define _HEADERFILENAME_H

#endif

Entry 11: April 14, 2012

g++ -o prog file1.o file2.o file3.o compile c++ code into one executable named prog with the object files: file1 file2 file3. then you can now run ./prog on the command line because it is now an executable file.

To produce only .o files from source files without doing any linking invoke -c option

Entry 12: April 19,2012

some html i did in unix class that diplayes an image of myself and some general info

<html>
<title> RM Lab46 Homepage</title>
<body>
<center>Unix Homepage by Robert Matsch</center>
<img src="player.jpg"  height="42" width="42" />


<strong>Who am I :</strong>
<p>My name is Robert matsch, I am currently a student at corning community college. Upon completion of my Computer Information Science degreein in may 2012  i am attending RIT for the fall of 2012. I am majoring in software engineering and planning to live in california once i graduate to work with my uncle and be part owner in a private consulting company.I enjoy listening to music, being active, riding my motorcycle and best of all spending time with friends and family.
</p>
<hr>
<br> Top 6 movies:
<ol>
<li>Step Brothers</li>
<li>Hangover 1 and 2 </li>
<li>Finding Nemo</li>
<li>Bad Boys II</li>
<li>Talladega Nights</li>
<li>k-pax</li>
</ol>
<p>


</p>
<br> who is I ?
</body>
</html>

<html> <title> RM Lab46 Homepage</title> <body> <center>Unix Homepage by Robert Matsch</center> <img src=“player.jpg” height=“42” width=“42” />

<strong>Who am I :</strong> <p>My name is Robert matsch, I am currently a student at corning community college. Upon completion of my Computer Information Science degreein in may 2012 i am attending RIT for the fall of 2012. I am majoring in software engineering and planning to live in california once i graduate to work with my uncle and be part owner in a private consulting company.I enjoy listening to music, being active, riding my motorcycle and best of all spending time with friends and family. </p> <hr> <br> Top 6 movies: <ol> <li>Step Brothers</li> <li>Hangover 1 and 2 </li> <li>Finding Nemo</li> <li>Bad Boys II</li> <li>Talladega Nights</li> <li>k-pax</li> </ol> <p>

</p> <br> who is I ? </body> </html>

Entry 12: April 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

•	logic and operators (and, or, not, xor)
•	Scope (Block, Local, Global, File)
•	Type Casting
•	Structures (Declaration, Accessing Elements, Pointers to)
•	Type Casting Operators, Const-Volatility Specifiers (const, volatile) [C++]
•	Overloading (Functions, Operators) [C++]
•	Exception Handing (throw, try, catch) [C++]
•	Templates, STL (Standard Template Library) [C++]
Logic operators
Definition

logic operators are a logical operation on one or more logic inputs that produces a single logic output

Demonstration
a b  |  and   or    xor   nor   xnor  nand  notb  nota
F T  |  F     T     T     F     F     T      F     T
T T  |  T     T     F     F     T     F      F     F
F F  |  T     F     F     T     T     T      T     T
T F  |  F     T     T     F     F     T      T     F
Type casting
Definition

Converting one type of data into another type of data.

Demonstration
short a=2000;
int b;
b = (int) a;    
b = int (a);
or
short a=2000;
int b;
b=a;
Templates
Definition

Templates in C++ template are classes to provide common programming data structures and functions. STL- standard template library is a library of templates

Demonstration
#include<iostream>
using namespace std;

template <class T>
void myfunc (T val1, T val2, T val3)
{
        T result;
        result = val1 + val2 + val3;

        cout << "First value is: " << val1 << endl;
        cout << "Second value is: " << val2 << endl;
        cout << "Third value is: " << val3 << endl;

        cout << "The sum of all three are: " << result << endl;

        cout << "The average of all three are: " << (T)(result/3) << endl;
}

int main()
{
        // some c code here 
        return 0;
}
Overloading Functions, Operators
Definition

You can redefine a function of most built-in operators in C++ by overloading globally or on a class. key point * Overloaded operators are implemented as functions and can be “member functions or global functions”.

You can also overload a function name by declaring more than one function with the that name in the same scope. when the program is being run and the function is call the program matches parameters up to select the right function.

Demonstration

Operator overloading

#include <iostream>
using namespace std;
 
class complx
{
      double real,
             imag;
public:
      complx( double real = 0., double imag = 0.); // constructor
      complx operator+(const complx&) const;       // operator+()
};
 
// define constructor
complx::complx( double r, double i )
{
      real = r; imag = i;
}
 
// define overloaded + (plus) operator
complx complx::operator+ (const complx& c) const
{
      complx result;
      result.real = (this->real + c.real);
      result.imag = (this->imag + c.imag);
      return result;
}
 
int main()
{
      complx x(4,4);
      complx y(6,6);
      complx z = x + y; // calls complx::operator+()

and now function overloading

#include <iostream>
using namespace std;

void print(int i) {
  cout << " Here is int " << i << endl;
}
void print(double  f) {
  cout << " Here is float " << f << endl;
}

void print(char* c) {
  cout << " Here is char* " << c << endl;
}

int main() {
  print(10);
  print(10.10);
  print("ten");

and now the output from this function over loading

lab46:~$ ./funoverl
 Here is int 10
 Here is float 10.1
 Here is char* ten
Exception Handing (throw, try, catch) [C++]
Definition

key words that can “catch exceptions” by placing a portion of code under exception inspection and enclosing that portion of code in a “try block”. it works When an exception circumstance comes about within that block, the exception is then thrown which transfers the control to the exception handler. If no exception is thrown the code continues normally.

Demonstration
#include <iostream>
using namespace std;
 
int main () {
  try
  {
    throw 20;
  }
  catch (int e)
  {
    cout << "An exception occurred. Exception Nr. " << e << endl;
  }
  return 0;
}
Scope (Block, Local, Global, File)
Definition

block: C++ names can only be used in parts of a program called the “scope” of the name. unless otherwise acres from a member of that class scope. this is very important in C++ because scope determines when variables local to the scope are initialized.

Local scope:A name declared within a block is accessible only within that block and blocks enclosed by it and only after the point of declaration.

File scope: Any name declared outside all blocks or classes has file scope also known as namespace scope.

global scope: is names with file scope that are not declare objects are global names.

Demonstration
local scope 
{
        int i;
    }

Notice the declaration of i is in a block enclosed by curly braces so i has local scope and is never accessible because there is no code accesses before the closing curly brace.

class area()
{
    int x;
    int y;
};

x and y can be used to access the class area through “.”or “→”

Type Casting Operators, Const-Volatility Specifiers (const, volatile) [C++]
Definition

constant : makes that the type is constant but also the object shall not be modified. In doing so it may you may recieve undesired/undefined results such as compile time error compile-time error.

volatile: makes the type volatile and the object then be modified so that the compiler doesn't yell at you.

Demonstration
       const int five = 5;
       const double pi = 3.141593;

const objects may not be changed below is an example: <Code>

#include <stdio.h> #include <stdlib.h> int main() {

     int result=0;
     const int five = 5;
     const double pi = 3.141593;
     pi = 3.2;
     five = 6;
     result=five+pi;

return(0); } </code> compile msg below

lab46:~$ gcc -o const const.c
const.c: In function 'main':
const.c:9: error: assignment of read-only variable 'pi'
const.c:10: error: assignment of read-only variable 'five'
Structures (Declaration, Accessing Elements, Pointers to)
Definition

Declaring : a structure it is in the form of a block of data which can contain different data types depending on means of a structure declaration.

Accessing elements: structure accessing is done by specify both the structure name (name of the variable) and the member name when accessing information stored in a structure.

Point:you can point to structs by deference them below is example

 
  struct tag *st_per;

and we point it to our example structure with:

  st_per = &my_struct;
Demonstration
struct person{
        char *name;//or --char name[20];
        unsigned char age;
        short int weight;
        float gpa;
        };
//struct differ from union bec struct  allocate memory for each and dont share $
        typedef struct person P;
        P p1,p2,p3,p4,p5;
        struct person p1;
        struct person p2;
        struct person p3,p4,p5;
 
        Accessing Members of a Structure
        p1.age = 29;
 
 
point to :
struct person *st_per;
    st_per = &my_struct;
(*st_per).age = 63;

cprog Objective

cprog Objective

The course objective is to be able to successfully develop C code of a desired program. The program should work and any problems that come about can be figure out and finally manage the code with C++ and abstract details away for security and neatness.

Method

Develop a program that will allow a simpler way of doing something from creating a program of your choice. Have what you wish to be able to do and then program with the requirements chosen. produce a finished result

Measurement

I have develop a program that i thought was going to be easy and turned out my requirement i want i did not achieve so i changed them a little. the program accepts string and compares string to string for user authentication.

Analysis

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

  • How did you do?
  • i did well but could learn a great deal more
  • Is there room for improvement?
  • yes
  • Could the measurement process be enhanced to be more effective? Of course this is only mt perspective.

unix Keywords

■The UNIX Shell

■ Environment variable

■ Source Code, Object Code, Binary Code, Library……x

■ Source Code, Object Code, Binary Code, Library

■ Filtering

■ networking, UNIX Networking Tools

■ Security

■ X Window System

Filtering (Unix)
Definition

filtering is a way to process text in a usable manner for the goal that is in mind.

Demonstration

some filtering utilities

  cat(1) - concatenate files
  cut(1) - cut text
  grep(1) - globally search for regular expression and print
  head(1) - print first “n” lines of output
  sed(1) - stream editor
  sort(1) - sort output
  tail(1) - print last “n” lines of output
  tr(1) - translate characters
  uniq(1) - filter out duplicate lines from sorted file
  wc(1) - word count
lab46:~$ cat sample.db
name:sid:major:year:favorite candy*
Jim Smith:105743:Economics:Sophomore:Lollipops*
Adelle Wilson:594893:Sociology:Junior:Ju-Ju Fish*
Sarah Billings:938389:Accounting:Freshman:Tic-Tacs*
Eric Vincent:1001119:Biology:Freshman:Lollipops*
Linus Torvalds:4432001:Computer Science:Senior:Snickers*
Alan Cox:40049300:Computer Science:Senior:Whoppers*
Alan Turing:40030333:Computer Science:Senior:Rock Candy*
Eric Vincent:1001119:Biology:Freshman:Lollipops*
John Doe:0000000:Unknown:Freshman:unknown*
Leet Haxzor:31337:Business:Sophomore:Gobstoppers*
Matthew Green:439478:Philosophy:Junior:Necco Wafers*
Megan Tanner:372233:Physics:Junior:Zero Bar*
Junior Mint:2228484:Liberal Arts:Junior:Junior Mints*
Alan Wilson:22908948:Economics:Freshman:Whoppers*
Kris Warner:8383833:Biology:Senior:Mars Bar*
Jill Ashley:9939392:Chemistry:Freshman:Warheads*
Francois Laroux:93938383:Anthropology:Sophomore:Bubblegum*

lab46:~$ cat sample.db | grep Biology
Eric Vincent:1001119:Biology:Freshman:Lollipops*
Eric Vincent:1001119:Biology:Freshman:Lollipops*
Kris Warner:8383833:Biology:Senior:Mars Bar*

lab46:~$ cat sample.db | grep Biology | grep Lollipops
Eric Vincent:1001119:Biology:Freshman:Lollipops*
Eric Vincent:1001119:Biology:Freshman:Lollipops*

lab46:~$ echo "hello there:this:is:a:bunch of:text." | cut -d":" -f1
hello there
lab46:~$ echo "hello there:this:is:a:bunch of:text." | cut -d":" -f2
this
lab46:~$ echo "hello there:this:is:a:bunch of:text." | cut -d":" -f3
is
lab46:~$ echo "hello there:this:is:a:bunch of:text." | cut -d":" -f1,6 | sed -e 's/:/ /g'
hello there text.
lab46:~$ sort sample.db sorts alphabetically
Adelle Wilson:594893:Sociology:Junior:Ju-Ju Fish*
Alan Cox:40049300:Computer Science:Senior:Whoppers*
Alan Turing:40030333:Computer Science:Senior:Rock Candy*
Alan Wilson:22908948:Economics:Freshman:Whoppers*
Eric Vincent:1001119:Biology:Freshman:Lollipops*
Eric Vincent:1001119:Biology:Freshman:Lollipops*
Francois Laroux:93938383:Anthropology:Sophomore:Bubblegum*
Jill Ashley:9939392:Chemistry:Freshman:Warheads*
Jim Smith:105743:Economics:Sophomore:Lollipops*
John Doe:0000000:Unknown:Freshman:unknown*
Junior Mint:2228484:Liberal Arts:Junior:Junior Mints*
Kris Warner:8383833:Biology:Senior:Mars Bar*
Leet Haxzor:31337:Business:Sophomore:Gobstoppers*
Linus Torvalds:4432001:Computer Science:Senior:Snickers*
Matthew Green:439478:Philosophy:Junior:Necco Wafers*
Megan Tanner:372233:Physics:Junior:Zero Bar*
Sarah Billings:938389:Accounting:Freshman:Tic-Tacs*
name:sid:major:year:favorite candy*

lab46:~$ head -5 sample.db "print first 5 lines" tail does opposite prints last -n lines of file specified 
name:sid:major:year:favorite candy*
Jim Smith:105743:Economics:Sophomore:Lollipops*
Adelle Wilson:594893:Sociology:Junior:Ju-Ju Fish*
Sarah Billings:938389:Accounting:Freshman:Tic-Tacs*
Eric Vincent:1001119:Biology:Freshman:Lollipops*

Security (UNIX)
Definition

Security is ability to allow and/or deny access to information that is vital to any multi-user system.

Demonstration

To be able to change permissions, allow access for new directories created along with new files is just some of the basic but must be taken into account. below is a command line which will display the umask

lab46:~$ umask
0022
lab46:~$ touch newfile
lab46:~$ ls -l newfile
-rw-r--r-- 1 rmatsch lab46 0 Apr 21 12:18 newfile
lab46:~$

This means your default umask is set to this meaning that any files you make will have this minused the full permissions so a normal file full permission would be 666 but now when a new file is created thanks to umask the permissions on the file in octal are 644 which mean the owner can read and write to the file and everyone else can only read and same for group.

lab46:~$ mkdir newdirect
lab46:~$ ls -ld newdirect
drwxr-xr-x 2 rmatsch lab46 6 Apr 21 12:19 newdirect

full permission on a directory is 777 so 777 -22 = 755 which is show above with the owner having read write execute and group and world having only read and execute privileges.so umask is a very important thing to know if you are considering security of the system and users.

When you don't have access:

lab46:~$ cd /root
-bash: cd: /root: Permission denied
lab46:~$ chmod 077 newdirect "change newdirect's permissions to 077"
lab46:~$ cd newdirect
-bash: cd: newdirect: Permission denied
The unix shell (unix)
Definition

The Unix shell is a command-line interpreter that provides a user interface for Unix/linus operating systems. Users directly operate with the computer by entering commands execute, create, delete, and various other operation. There is no “ button clicking like windows computers”

Demonstration

At a command line interpreter such as bash or various other you can search through files, list files,create new files, copy files, delete files, make directories, and so on.Below is a demonstration of the various nothing i talked about just showing you that all task or “moving around the sytem is done through commands.

lab46:~$ ls
2              badname.tgz             newdirect
CCC.sh         bin                     phenny
CCCclasses.sh  class_notes             phenny.tar.bz2
Desktop        classlog.c              regex.html
Documents      count.c                 sample.db
Downloads      data                    spring2010-20091022.html
Maildir        fall2010-20100315.html  spring2010-20101113.html
Music          fall2010-20101113.html  spring2011-20101105.html
Pictures       fall2011-20110417.html  spring2011-20101113.html
Public         file                    spring2012-20111103.html
Templates      index.html              src
Videos         lab1                    stdout
archives       labD.sh                 winter2011-20101113.html
badname        motd
lab46:~$ cp count.c count.xxxxxxxxxxxxxx
lab46:~$ rm count.c
rm: remove regular file `count.c'? y
lab46:~$ mkdir newdirect2
lab46:~$ touch newfile
lab46:~$ ls
2              bin                     newfile
CCC.sh         class_notes             phenny
CCCclasses.sh  classlog.c              phenny.tar.bz2
Desktop        count.xxxxxxxxxxxxxx    regex.html
Documents      data                    sample.db
Downloads      fall2010-20100315.html  spring2010-20091022.html
Maildir        fall2010-20101113.html  spring2010-20101113.html
Music          fall2011-20110417.html  spring2011-20101105.html
Pictures       file                    spring2011-20101113.html
Public         index.html              spring2012-20111103.html
Templates      lab1                    src
Videos         labD.sh                 stdout
archives       motd                    winter2011-20101113.html
badname        newdirect
badname.tgz    newdirect2
lab46:~$ grep hey regex.html
<td NOSAVE><b><u><font size=+1>Objective:</font></u></b> To become familiar with the UNIX command line through exposure to some simple commands. The student will also be presented with traditional UNIX conventions they are expected to become familiar with and use throughout the semester.</td>
How have they changed?</td>

lab46:~$ cd ..
lab46:/home$ ls

bherrin2   dh018304  hshaikh     jsmit176  mdecker3  rmatsch     tp001498
bhuffner   dherman3  hwarren1    jstrong4  mdittler  rmoses      triley2
bkenne11   dlalond1  ian         jsulli34  mearley1  rnewman     ts004985
bobpauljr  dmay5     javery9     jtongue2  mgough    rpetzke1    wedge
bort       dmckinn2  jbaez       jtreacy   mguthri2  rraplee     wezlbot
bowlett1   dmurph14  jbamper     jtripp    mhenry9   rrichar8    wfischba
brian      dpadget8  jbarne13    jv001406  mkellogg  rsantia4    wknowle1
brobbin4   dparson3  jbesecke    jvanott1  mkelsey1  rshaw8      wroos
bstoll     dpotter8  jblaha      jwalrat2  mmatt     rthatch2    ystebbin
btaber2    dprutsm2  jblanch1    jwhitak3  mowens3   ryoung12    zlittle
bwheat     drobie2   jbrant      jwilli30  mp018526  sblake3     zmccann
bwilso23   ds000461  jbrizzee    jwilso39  mpage9    sc000826    zward
lab46:/home$ cd rmatsch
lab46:~$ cd src
lab46:~/src$ ls
Makefile  cprog  hello1  hello1.c  helloC  helloC.c  submit  unix
lab46:~/src$ cd unix
lab46:~/src/unix$ ls
arc.tar.gz    cs4.txt  cs9.txt  lab0.txt  lab5.txt  laba.txt
contact.info  cs5.txt  csA.txt  lab1.txt  lab6.txt  link.sh
cs1.txt       cs6.txt  csB.txt  lab2.txt  lab8.txt  scripting
cs2.txt       cs7.txt  csC.txt  lab3.txt  lab9.txt  shell
cs3.txt       cs8.txt  devel    lab4.txt  labC.txt  unix_html_stuff
lab46:~/src/unix$
Environment Variables
Definition

environment variables are significant and can be thought of in a sense to create the operating environment in which a process runs. environment variables set at login are valid for the duration of the session. Environment variables have UPPER CASE as opposed to lower case which are shell variables.

Demonstration
  USER (your login name)
  HOME (the path name of your home directory)
  HOST (the name of the computer you are using)
  ARCH (the architecture of the computers processor)
  DISPLAY (the name of the computer screen to display X windows)
  PRINTER (the default printer to send print jobs)
  PATH (the directories the shell should search to find a command)
lab46:~$ echo $HOME
/home/rmatsch
lab46:~$ echo $PATH
/home/rmatsch/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
lab46:~$ echo $OSTYPE
linux-gnu
lab46:~$ echo $USER
rmatsch
lab46:~$ echo $home
lab46:~$
X window system
Definition

a software system which provides a basis for GUI's and has good input device capability for computers. basically it is used to build graphical user interfaces for unix like operating systems originally designed for network connection.

unix networking tools
Definition

tools used to gain networking information such as the host you are connected to and various other network data that may be useful.

Demonstration

some of the two most important networking tools i think are netstat, ping below are example of them to find information on dns server to see if packets or being sent and network information.

lab46:~$ ping localhost
PING localhost.localdomain (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost.localdomain (127.0.0.1): icmp_req=1 ttl=64 time=0.045 ms
64 bytes from localhost.localdomain (127.0.0.1): icmp_req=2 ttl=64 time=0.037 ms
64 bytes from localhost.localdomain (127.0.0.1): icmp_req=3 ttl=64 time=0.038 ms
64 bytes from localhost.localdomain (127.0.0.1): icmp_req=4 ttl=64 time=0.036 ms
^C
--- localhost.localdomain ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 2997ms
rtt min/avg/max/mdev = 0.036/0.039/0.045/0.003 ms

netstat 
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 lab46.offbyone.la:60002 irc.offbyone.lan:ircd   ESTABLISHED
tcp        0      0 lab46.offbyone.lan:ssh  mobile-198-228-20:58895 ESTABLISHED
tcp        0      0 lab46.offbyone.la:47089 irc.offbyone.lan:ircd   ESTABLISHED


lab46:~$ netstat -ta
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 *:ssh                   *:*                     LISTEN
tcp        0      0 *:35801                 *:*                     LISTEN
tcp        0      0 *:nfs                   *:*                     LISTEN
tcp        0      0 *:3939                  *:*                     LISTEN
tcp        0      0 *:3333                  *:*                     LISTEN
tcp        0      0 lab46.offbyone.lan:5000 *:*                     LISTEN
tcp        0      0 lab46.offbyone.lan:5007 *:*                     LISTEN
tcp        0      0 *:59343                 *:*                     LISTEN
tcp        0      0 *:sunrpc                *:*                     LISTEN
tcp        0      0 *:csync2                *:*                     LISTEN
tcp        0      0 lab46.offbyone.lan:4242 *:*                     LISTEN
tcp        0      0 lab46.offbyone.la:60002 irc.offbyone.lan:ircd   ESTABLISHED
tcp        0      0 lab46.offbyone.lan:ssh  mobile-198-228-20:58895 ESTABLISHED
tcp        0      0 lab46.offbyone.la:47089 irc.offbyone.lan:ircd   ESTABLISHED
tcp        0      0 lab46.offbyone.la:47998 irc.offbyone.lan:ircd   ESTABLISHED
tcp        0      0 lab46.offbyone.la:42140 auth1.offbyone.lan:ldap ESTABLISHED
tcp        0      0 lab46.offbyone.la:45645 irc.offbyone.lan:ircd   ESTABLISHED
tcp        0      0 lab46.offbyone.la:58347 vm31.student.lab:ssh    ESTABLISHED
tcp        0      0 lab46.offbyone.la:44392 irc.offbyone.lan:ircd   ESTABLISHED
tcp        0      0 lab46.offbyone.la:51839 auth1.offbyone.lan:ldap ESTABLISHED
tcp        0      0 lab46.offbyone.la:47426 irc.offbyone.lan:ircd   ESTABLISHED
tcp        0      0 lab46.offbyone.la:33595 auth1.offbyone.lan:ldap ESTABLISHED
tcp        0      0 lab46.offbyone.la:44549 irc.offbyone.lan:ircd   ESTABLISHED


netstat -s |less

Ip:
    44800188 total packets received
    2 with invalid addresses
    280120 forwarded
    0 incoming packets discarded
    44488743 incoming packets delivered
    58096734 requests sent out
    7068 outgoing packets dropped
Icmp:
    10051 ICMP messages received
    28 input ICMP message failed.
    ICMP input histogram:
        destination unreachable: 9389
        echo requests: 250
        echo replies: 412
    9622 ICMP messages sent
    0 ICMP messages failed
    ICMP output histogram:
        destination unreachable: 659
        redirect: 7068
        echo request: 1645
        echo replies: 250
IcmpMsg:
        InType0: 412
        InType3: 9389
        InType8: 250
        OutType0: 250
        OutType3: 659
        OutType5: 7068
        OutType8: 1645
Tcp:
    80063 active connections openings
    38145 passive connection openings
    26780 failed connection attempts
    4252 connection resets received
    85 connections established
    44040550 segments received
    57184990 segments send out
    96026 segments retransmited
    0 bad segments received.
    30648 resets sent
Udp:
    388512 packets received
Compiler, Assembler, Linker, Loader
Definition
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$ 
Source Code, Object Code, Binary Code, Library
Definition

source code is code written by a programmer in a text editor, object code is the source code compiled and ready to be linked to the binary code which is the binary executable the processor reads. library can be thought of as a place where header files are located.

Demonstration
lab46:~$ vi hello.c
lab46:~$ file hello.c
hello.c: ASCII C program text
lab46:~$ gcc -c hello.c
lab46:~$ ls
hello.c
hello.o
lab46:~$ file hello.o
hello.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped
lab46:~$ gcc -o helo hello.o
lab46:~$ file helo
helo: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped
lab46:~$ file hello.o
hello.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped
lab46:~$ file hello.c
hello.c: ASCII C program text

unix Objective

unix Objective

students should be able to set permissions on file directories ad be able to filter text using utilities

Definition

the objective entails using reg expression cut(1),tr(1), and many more tools to filter text and be familiar with unix security.

Method

Tell students to find what the default file and directory access is set to and how to change that default permission using umask and have an understanding of what is happening. ask students to search through a document and put the information into a useable manner by filtering the document or database. students should also be asked to change the permissions using chmod utility and demonstrate a clear understanding in permissions and security

Measurement
lab46:~$ umask
0022
lab46:~$ touch file
lab46:~$ ls -l file
-rwxr-xr-x 1 rmatsch lab46 7481 Apr 21 16:21 file
lab46:~$ umask 000
lab46:~$ touch file2
lab46:~$ ls -l file2
-rw-rw-rw- 1 rmatsch lab46 0 Apr 21 16:21 file2
lab46:~$ umask 22
lab46:~$ mkdir newd
lab46:~$ ls -ld
drwx-----x 30 rmatsch lab46 4096 Apr 21 16:23 .
lab46:~$ ls -ld newd
drwxr-xr-x 2 rmatsch lab46 6 Apr 21 16:23 newd
lab46:~$ umask 22
lab46:~$ chmd
-bash: chmd: command not found
lab46:~$ chmod 777 newd
lab46:~$ ls -ld newd
drwxrwxrwx 2 rmatsch lab46 6 Apr 21 16:23 newd
lab46:~$

1 is execute read is 4 and write is 2

Analysis

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

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

Experiments

Experiment 7

Question

what will happen if you remove #ndef #define #endif from header files and re compile

Resources

Class notes

Hypothesis

I think the program will compile with out any problems.

Experiment

take a c++ program with multiple header files and remove the #ndef statements and see what happens.

Data

it compiled with out the statements.

Analysis,Conclusion

Based on the data collected:

upon further investigation in small problems probably wont matter so much but with many header files and larger programs this could be a big plus to have.

Experiment 8

Question

can kids touch there parents private parts (C++ inheritance)

Resources

Mathew hass

Hypothesis

no kids to parent relationships cannot touch there parents private parts because then it would not be a private class if the kid had a friend and then third parties could touch the parents private parts which is not good for security.

Experiment

develop a program and set certain variables to private class and then try to access these variables via a kid of the parent.

Analysis

Based on the data collected:

Conclusions

C++ is great for code management and for security purposes as data access..

Retest 3

State Experiment

josh Davis experiment “IF or not if” http://lab46.corning-cc.edu/opus/spring2012/jdavis34/start#experiment_if_or_not_if

Resources

Evaluate their resources and commentary. Answer the following questions:

Hypothesis

What is the use of \n and to what effect does it have if in a simple program designed to print “hello world” if: 1. it exists.

2. it does not I feel their hypothesis is adequate in capturing the essence of what they're trying to discover. and there is no adjustments i would make.

Experiment

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

there is not to many directions to establish how to do it if i did not have any knowledge of C I feel there room for improvement in the experiment instructions/description such as a small snip of code.

no it is a simple experiment so there structure would do.

Data

#include <stdio.h>
int main()
{
        printf("hello, world\n");
        printf("hello,\n world");

return(0);
}
lab46:~$ gcc -o hello hello.c
lab46:~$ ./hello
hello, world
hello,
world

Analysis

Answer the following:

Yes the data seems in-line with the author

There is no deviations.

Yes the stated hypothesis is adequate.

Conclusions

Answer the following:

\n will make a new line

Good job experiment was done well.