Table of Contents

Part 1

Entries

Entry 1: September 25, 2012

Today we started off talking about sorting. We tried to figure out how a program would sort numbers from least to greatest. We spent the rest of the class trying to write the program. After matt helped me with the loop I tried to get it to sort but it's a little harder than I thought it would be. I tried just putting the less than symbol in but that didn't work. I haven't figured it out yet but hopefully I will soon.

Entry 2: September 26, 2012

Today in linux/unix we talked about wildcards. We learned that ? = any single character, * = 0 or more of any character, [] = match any size of echoed and [^] = do not match any single. You can also combine then together with ls to find vowels or how many files have 4 letters. We played around with combining different kinds of wildcards with the ls and wc -w command. I had to leave about a half hour early and thats the last thing that I did.

Entry 3: September 27, 2012

Today in discrete I worked on the sorting program. I realize that I am not very good at programming but hopefully I get better soon because im feeling lost. I worked on trying to get it to sort and also just printing the list before it gets sorted. I spent just about all class trying to do this. I looked at the set program at first but I didn't work on it much. Most of the time I was trying to get numbers sorted.

Entry 4: September 28, 2012

Today we talked more about scripts. We went over that you need the #!/bin/bash before any script that you make, unless its a different language. We then made a game from a script. It asked the user try and guess a number using the $RANDOM variable. It would then say with it was equal with -eq, less than with -lt, or greater with -gt than the random number. At first we were getting really high numbers but then we changed the range from 0-9 by using the bc calculator. We went over if statements and if else statements and learned that to close if statements its fi and else if is elif. At the end we had a working guessing game that gave you six chances to guess the right number.

Keywords

discrete Keyword 1

nonimplication/difference/but not

Definition

Nonimplicion/difference/but not means that the only true output is if p is true and q is false. Everything else is false. So if p is 0 and q is 1 the output should be 0.

References

discrete Keyword 1 Phase 2

Converse Nonimplication

Definition

Converse Non-implication is the negation of the reverse of implication. implication is if … then where it is only false if the first term “p” is true and the second term “q” is false so converse non-implication is only true if the first term “p” is false and the second term “q” is true

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:

/*
 * converse nonimplication
 */
 
#include <stdio.h>
 
char nonimp(char, char);
 
int main() {
 
	char p;
	char q;
	char r;
 
	printf(" Nonimplicaton \n  Truth Table\n");
	printf("- - - - - - - -\n");
	printf("|  P | Q | X  |\n");
	printf("- - - - - - - -\n");
 
	p = 0;
	q = 0;
	printf("|  %d | %d | %d  |\n", p,q, nonimp(p,q));
 
	p = 0;
	q = 1;
	printf("|  %d | %d | %d  |\n", p,q, nonimp(p,q));
 
	p = 1;
	q = 0;
	printf("|  %d | %d | %d  |\n", p,q,nonimp(p,q));
 
	p = 1;
	q = 1;
 
	printf("|  %d | %d | %d  |\n", p,q,nonimp(p,q));
	printf("- - - - - - - - \n");
 
	printf("Number for p: ");
	scanf("%hhd%*c", &p);
 
	printf("Number for q: ");
	scanf("%hhd", &q);	
 
	printf("Number for r: ");
	scanf("%hhd", &r);
 
	printf("- -  - - - - - -\n  ");
	printf("%d | %d | %d | %d\n" ,p,q,r, nonimp(p,q));
 
 
	}
 
	char nonimp(char p, char q) {
 
	char r;
	char result;
 
	if((p == 1) & (q == 0) & (r == 0) )
		result = 0;
	else
		result = 1;
 
	return(result);
}

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

lab46:~$ gcc -o cnonimp cnonimp.c
lab46:~$ ./cnonimp
 Nonimplicaton 
  Truth Table
- - - - - - - -
|  P | Q | X  |
- - - - - - - -
|  0 | 0 | 1  |
|  0 | 1 | 1  |
|  1 | 0 | 0  |
|  1 | 1 | 1  |
- - - - - - - - 
Number for p: 0
Number for q: 0
Number for r: 1
- -  - - - - - -
  0 | 0 | 1 | 1
lab46:~$ 

unix Keyword 1

local host

Definition

Local host is the name given to your computer. Its ip address is 127.0.0.1 to the local network but for the outside network or internet it would have a different ip address. The ip address 127.0.0.1 is used for loopback. If you send out packets and get the same packets back using 127.0.0.1 it is loopback. People use it for setting up servers and finding a database.

References

Unix/Linux Keyword 1 Phase 2

Version Control

Definition

Version control refers to managing the changes in a document, source code, or other collection of information. The changes are usually documented by a revision number, timestamp, and who made the change. Revisions can then be compared with or restored to a previous revision. Version control uses a repository, which stores both the current and previous data of the files being version controlled. Version control repositories can either be local only, client-server, or distributed.

Local only repositories are outdated and obsolete. In a local only system, all users must share the same computer system. In a client-server version control system, users share a single repository. While not as outdated or obsolete as a local only repository, it is still not the optimal choice. A distributed revision control system (DRCS) creates a peer-to-peer network, where each user has their own local repository. Changes are then shared between repositories. One of the biggest upsides to a DRCS is that it does not rely on a central node, and therefore is more durable. Two of the most popular DRCS's are Mercurial and Git.

References

Demonstration

Demonstration of the indicated keyword.

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

lab46:~$ cd src
lab46:~/src$ hg push
http authorization required
realm: Lab46/LAIR Mercurial Repository (Authorization Required)
user: mwitter3
password: 
pushing to http://lab46.corning-cc.edu/hg/user/mwitter3
searching for changes
no changes found
lab46:~/src$ hg pull
http authorization required
realm: Lab46/LAIR Mercurial Repository (Authorization Required)
user: mwitter3
password: 
pulling from http://lab46.corning-cc.edu/hg/user/mwitter3
searching for changes
no changes found
lab46:~/src$ hg update
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
lab46:~/src$ 

Experiment 1

Question

What does the > mean in vim.

Resources

http://www.pixelbeat.org/vim.tips.html

Hypothesis

I know » indents but maybe > indents less or maybe half of an indent. State your rationale.

Experiment

Im going to type a bunch of words that dont really make any sense. After I get done typing im going to do the » command to see an indent first and then the just the > to see what happens.

Data

what I typed before doing anything.

  1 this is the experiment i dont know what im
  2 typing i just need a
  3 bunch of words and im trying to think
  4 of ideas but im running out so im going to
  5 go because i think i have enough words now

What happened when I used the » command

  1 this is the experiment i dont know what im
  2 typing i just need a
  3 bunch of words and im trying to think
  4     of ideas but im running out so im going to
  5 to go because i think i have enough words now 

What happened after I did the > command on the last line. Nothing happened.

  1 this is the experiment i dont know what im
  2 typing i just need a
  3 bunch of words and im trying to think
  4     of ideas but im running out so im going to
  5 to go because i think i have enough words now 

Analysis

Based on the data collected:

Conclusions

I found out that although the » indents the > command does not do anything. I tried the 2» command too and it doesn't indent twice either. So unless it is used differently than what I'm trying to do I think the » command is the only command using the greater than symbol. Also you can only indent once at a time, but its very quick so maybe thats why they didn't add that