djfish's studio

4/21/2009

How to write a paper in college/university(zt)

track by:http://asil.logicalinsanity.ca/300college paper.html

1. Sit in a straight, comfortable chair in a well lit place in front of your computer.

2. Log onto MSN and ICQ (be sure to go on away!). Check your email.

3. Read over the assignment carefully, to make certain you understand it.

4. Walk down to the vending machines and buy some chocolate to help you concentrate.

5. Check your email.

6. Call up a friend and ask if he/she wants to go to grab a coffee.  Just to get settled down and ready to work.

7. When you get back to your room, sit in a straight, comfortable chair in a clean, well lit place.

8. Read over the assignment again to make absolutely certain you understand it.

9. Check your email.

10. You know, you haven't written to that kid you met at camp since fourth grade. You'd better write that letter now and get it out of the way so you can concentrate.

11. Look at your teeth in the bathroom mirror.

12. Grab some mp3z off of kazaa.

13. Check your email. ANY OF THIS SOUND FAMILIAR YET?!

14. MSN chat with one of your friends about the future. (ie summer plans).

15. Check your email.

16. Listen to your new mp3z and download some more.

17. Phone your friend on the other floor and ask if she's started writing yet. Exchange derogatory emarks about your prof, the
course, the college, the world at large.

18. Walk to the store and buy a pack of gum. You've probably run out.

19. While you've got the gum you may as well buy a magazine and read it.

20. Check your email.

21. Check the newspaper listings to make sure you aren't missing something truly worthwhile on TV.

22. Play some solitare (or age of legends!).

23. Check out bored.com.

24. Wash your hands.

25. Call up a friend to see how much they have done, probably haven't started either.

26. Look through your housemate's book of pictures from home. Ask who everyone is.

27. Sit down and do some serious thinking about your plans for the future.

28. Check to see if bored.com has been updated yet.

29. Check your email and listen to your new mp3z.

30. You should be rebooting by now, assuming that windows is crashing on schedule.

31. Read over the assignment one more time, just for heck of it.

32. Scoot your chair across the room to the window and watch the sunrise.

33. Lie face down on the floor and moan.

34. Punch the wall and break something.

35. Check your email.

36. Mumble obscenities.

37. 5am - start hacking on the paper without stopping. 6am -paper is finished.

38. Complain to everyone that you didn't get any sleep because you had to write that stupid paper.

39. Go to class, hand in paper, and leave right away so you can take a nap.



Ordering Adjectives(zt gg)

Most people who grow up speaking English put adjectives in the proper order in sentences without giving it much thought. In fact, many of you will probably be surprised to learn that there is a quasi-official proper order. Surprise! (Imagine Squiggly, Aardvark, and Grammar Girl jumping out from behind furniture and throwing confetti.)

Adjectives should go in the following order, with opinion first and purpose last:

Opinion (ridiculous, crazy, beautiful)
Size (big, small)
Age (old, young)
Shape (round, square)
Color (yellow, blue)
Origin (American, British)
Material (polyester, styrofoam)
Purpose (swimming, as in "swimming pool"; shooting, as in "shooting range")

The first letters of the words spell something that almost sounds like a word: OSASCOMP.

These are examples of sentences with the adjectives in the correct order:

Squiggly's crazy, big idea stunned the audience. (opinion, size)
Aardvark threw his old, round, wooden ball at Squiggly. (age, shape, material)
Grammar Girl wanted to swim in the beautiful, small swimming pool. (opinion, size, purpose)

4/15/2009

csort

/*sort routine:explain:create binary tree,simple linked list,recursive,traverse binary tree*/
#include <stdio.h>
#define MAXLINE 132
#define RECORD_SIZE sizeof(struct rec)

struct rec
{
       char *string;
       struct rec *left, *right;
};
/*
**csort: a utility that sorts named file
**and sends results to standard output.
**Syntax: csort filename
*/
main(argc,argv)
int argc;
char *argv[];
{
     FILE *file;
     char line[MAXLINE];       /*input line*/
     struct rec *add();
     struct rec *root=NULL;
     void print_tree();
    
     if(file=fopen(argv[1],"r"))  /*open input file*/
     {
         while(fgets(line,MAXLINE,file))  /*line byb line*/
             root=add(root,line);       /*addm,lines to tree*/
         print_tree(root);             /*print sorted lines*/
     }
     else
         printf("csort:can't open %s\n",argv[1]);
}

/*
**Add a record containing the indicated text to the binary tree
**pointed to by the argument named root.
**If this is the first rocord(i.e.,if root is NULL),
**return address of new record for use as root.
**Otherwise return root's current value.
*/
struct rec *add(ptr,line)
struct rec *ptr;
char *line;
{
     struct rec *install();
    
     if(ptr)                       /*we're not yet at an empty node*/
         if((strcmp(line,ptr->string))<=0)
             ptr->left=add(ptr->left,line);           /*go left*/
         else
             ptr->right=add(ptr->right,line);         /*go right*/
     else
         ptr=install(line);                /*we're at an empty node*/
     return(ptr);                        /*return for use in main()*/
}

/*
**Create a new record.Store a line of text in memory and
**insert a pointer to it in the new record.
**Return the addr of the new record.
**If no more space available,halt.
*/
struct rec *install(line)
char *line;
{
    // char *malloc();
     struct rec *ptr;
    
     if((ptr=(struct rec*)malloc(RECORD_SIZE))&&
         (ptr->string=malloc(strlen(line)+1)))
         /*ptr is the address of a new record;
           ptr->string points to reserved memory
           large enough to hold the input line.
         */
         {
             strcpy(ptr->string,line);  /*copy line into memory*/
             ptr->left=ptr->right=NULL; /*initialize l. and r.ptrs*/
             return(ptr);
         }
     /*malloc() returned NULL;out of memory*/
     printf("csort: out of memory\n");
     exit(0);
}

/*
**Walking the binary tree.
**When we traverse the tree,
**printing each node's text as we visit it,
**we're listing the lines of text in alphabetical order.
*/
void print_tree(ptr)
struct rec *ptr;
{
       if(ptr)           /*we're not yet at an empty node*/
       {
           print_tree(ptr->left);  /*traverse the left subtree*/
           printf("%s",ptr->string); /*print current node*/
           print_tree(ptr->right);      /*traverse the right subtree*/
       }
}

4/12/2009

pointers to functions-cstrip.c

/*pointers to functions*/
#include <stdio.h>
struct table_entry
{
       void (*prtptr)(char c);    /* pointer to a print function */
       int next_state;      /* state to go to next */
};
/*
** Strip c comments from standard input and
* send striipper code to standard output.
*/

main()
{
      FILE *file;
      file = fopen("cstrip.c","r");
      int c,col, row;
      void charprt(), noprt(), slsh();     /* print functions */
      static struct table_entry table[][3]=
      {
             {{noprt, 2},{charprt,0},{charprt,0}},
             {{noprt, 1},{noprt,3},{noprt,1}},
             {{slsh, 0},{noprt,1},{slsh,0}},
             {{noprt, 0},{noprt,1},{noprt,1}}
      };
      row=0;
      while ((c=getc(file))!=EOF)       /* read till end of file*/
      {
            /* find column matching input character*/
            if(c=='/')
                col=0;
            else if(c=='*')
                col=1;
            else
                col=2;
            (*table[row][col].prtptr)(c); /* execute approp print function*/
            row=table[row][col].next_state;  /* get next state*/
      }
      fclose(file);
}

void noprt(c)            /*print nothing*/
char c;
{}

void charprt(c)            /*print a char*/
char c;
{
     putchar(c);
}

void slsh(c)              /*print a slash, then a char */
char c;
{
     charprt('/');
     putchar(c);
}

4/09/2009

The printbits() Function

#define BYTESIZE 8
/*
**Print an integer argument as a binary string
*/
printbits(intval)
int intval;
{
    int i;
    for(i=0;i<BYTESIZE*SIZEOF(INT);++i)
        printf("%d",(intval<<i&1<<BYTESIZE*sizeof(int)-1)?1:0);
    putchar('\n');
}