User Tools

Site Tools


opus:fall2012:asowers:part3

Part 3

Entries

Entry 1: November 20, 2012

At this point I'm nearly done with bignum, all that is needed is the multiplication function along with some minor tweaking. I hope to complete it before the end of break.

Entry 2: November 24, 2012

Today I've looked into some extensive research:(http://math.berkeley.edu/~jakub/pdf/kominiarczuk2004.pdf) regarding tin-can phones. In order to receive higher quality connection I propose we build a box apparatus around our speaker and microphone setups. Also, the fishing line will most likely produce the greatest result with identical plastic cups rather than cans due to their membranes ability to vibrate easily. Finally the tension. Section D discuses frequency of waves in relation to tension. Essentially, to tight is just as bad as too loose. (that's what he said.)

I hope we can put this information to use on Tuesday Dec 4.

Entry 3: November 25, 2012

today for data comm, I've started research on network programming with a a focus in C to be reinvent to my independent study. I plan on spending a better part of this day going over this page: http://shoe.bocks.com/net/

My hope is to build network status LED via the GPIO on my Raspberry Pi

Entry 4: November 30, 2012

Out with my girlfriend Dana and some friends at Ithaca College. We were paying a game called “Power Hour”(Google is your friend) I decided that instead of keeping track of the time, why not write a simple program to do this for us? I came up with the following:

#include <time.h>
#include <stdio.h>
int main()
{
printf("\a");
for (;;)
        {
        printf("begin minute\n");
        sleep(60);
        printf("BEEP\a\n");
        }
}

Having lots of funnnn =)

UPDATE: After looking over what I had done last night I realized there was huge room for improvement. Here's the update:

#include <stdio.h>
#include <time.h>
 
int main()
{
        printf("Begin power hour!\n\a");
        int i;
        for(i = 0; i <= 60; ++i)
        {
                printf("Minute Number: %d\n",i);
                sleep(60);
                printf("Drink!\n\a");
        }
        return 0;
}

Keywords

cprog Keyword 3

Identification of chosen keyword.

Malloc

Malloc uses blocks of memory and pointers to perform operations. In the following program we declare the struct RECORD, fill it with datatypes, and point to it. malloc lets us output the individual blocks of RECORD we defined to stdout.

#include<stdio.h>
 
        typedef struct rec
        {
                int i;
                float PI;
                char A;
        }RECORD;
 
        int main()
        {
                RECORD *point;
 
                point = (RECORD *) malloc (sizeof(RECORD));
 
                point->i = 10;
                point->PI = 3.14;
                point->A = 'a';
 
                printf("First value: %d\n", point->i);
                printf("Pi is: %f\n", point->PI);
                printf("Third value: %c\n", point->A);
 
                free(point);
 
                return 0;
        }

References

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

  • Reference 1
  • Reference 2
  • Reference 3

cprog Keyword 3 Phase 2

Identification of chosen keyword.

Malloc

Malloc uses blocks of memory and pointers to perform operations. In the following program we declare the struct RECORD, fill it with datatypes, and point to it. malloc lets us output the individual blocks of RECORD we defined to stdout.

#include<stdio.h>
 
        typedef struct rec
        {
                int i;
                float PI;
                char A;
        }RECORD;
 
        int main()
        {
                RECORD *point;
 
                point = (RECORD *) malloc (sizeof(RECORD));
 
                point->i = 10;
                point->PI = 3.14;
                point->A = 'a';
 
                printf("First value: %d\n", point->i);
                printf("Pi is: %f\n", point->PI);
                printf("Third value: %c\n", point->A);
 
                free(point);
 
                return 0;
        }

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:

#include<stdio.h>
 
        typedef struct rec
        {
                int i;
                float PI;
                char A;
        }RECORD;
 
        int main()
        {
                RECORD *point;
 
                point = (RECORD *) malloc (sizeof(RECORD));
 
                point->i = 10;
                point->PI = 3.14;
                point->A = 'a';
 
                printf("First value: %d\n", point->i);
                printf("Pi is: %f\n", point->PI);
                printf("Third value: %c\n", point->A);
 
                free(point);
 
                return 0;
        }

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

andrew ~ $ nano -c malloc.c
andrew ~ $ gcc malloc.c -o malloc
andrew ~ $ ./malloc
First value: 10
Pi is: 3.140000
Third value: a
andrew ~ $ 

datacomm Keyword 3

Identification of chosen keyword.

Minimodem

Minimodem is a linux command line utility that generates modem tones. It works over different modem protocols. to use minimoddem you want to set it to transmit or receive and set the bit rate. Example:

andrew ~/ls |minimodem -t "200"

minimodem will pass the result of the ls to transmit via minimodem at a bit rate of 200. the receiveing end would simply change -t to -r and pass it into a file.

The audio output of minimodem can travel over any acceptable medium. Even cup and string! (if implemented properly)

References

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

  • Reference 1
  • Reference 2
  • Reference 3

datacomm 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$ 

Experiment 3

Question

Can I declare all my datatypes in a struct and alias them in main?

Resources

Hypothesis

I believe that it will be possible to declare all my datatypes in a simple structure and call them in main.

Experiment

I've built a simple program that calls three integers and one character array that I will use as a base for my experiment.

#include <stdio.h>
#include <string.h>
 
int main()
{
        int a = 1;
        int b = 2;
        int c = 3;
        char abc[] = "abc";
        printf("Now I know my %s's, they are easy as %d, %d, %d\n", abc, a, b, c);
        return 0;
}

Program modified with struct:

#include <stdio.h>
#include <string.h>
 
typedef struct {
        int a;
        int b;
        int c;
        char abc[];
        }node;
 
int main()
{
        node n;
        n.a = 1;
        n.b = 2;
        n.c = 3;
        strcpy(n.abc, "abc");
        printf("Now I know my %s's, they are easy as %d, %d, %d\n", n.abc, n.a, n.b, n.c);
        return 0;
}

Data

By declaring variables with their assigned datatype in the typedef struct, you can call the variable with an alias to that struct without setting the datatype in that function.

Analysis

Based on the data collected:

  • My hypothesis was correct.
  • my hypothesis was applicable.

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.

opus/fall2012/asowers/part3.txt · Last modified: 2012/12/05 16:17 by asowers