rainkinz


Joined 3 years ago
Homeworks submitted:
Homework comments:
10
0

About Me

No description provided.

Classes

Guitar for Beginners - Playing Pink Floyd

Class status: Established
Role: Student
. 0% complete

Introduction to Algorithms (MIT 6.046J)

Class status: Established
Role: Student
. 0% complete

Programming in C

Class status: Established
Role: Student
. 6% complete

Learning Vim from the inside

Class status: Established
Role: Student
. 41% complete

Structure and Interpretation of Computer Programs

Class status: Established
Role: Student
. 0% complete

Submitted Assignments

Programming in C: Lesson 1, HW 3
#include <stdio.h>

/* print Fahrenheight-Celcius table */
main() {
  int fahr;

  for (fahr = 300; fahr >= 0; fahr = fahr - 20) 
    printf("%3d %6.1f\n", fahr, (5.0/9.0)*(fahr - 32));

  return 0;
}

~/code/c/kr/chap1 $ gcc ex_1.5_fahrcel_using_for.c -o fc
~/code/c/kr/chap1 $ ./fc 
300  148.9
280  137.8
260  126.7
240  115.6
220  104.4
200   93.3
180   82.2
160   71.1
140   60.0
120   48.9
100   37.8
 80   26.7
 60   15.6
 40    4.4
 20   -6.7
  0  -17.8

rainkinz 1 year ago
Programming in C: Lesson 1, HW 2
# 1-3

#include <stdio.h>

/*
 * Print Fahrenheit-Celcius table
 */
main() 
{
  float fahr, celsius;
  int lower, upper, step;

  lower = 0;
  upper = 300;
  step = 20;

  fahr = lower;
  printf("Fahrenheit\tCelcius\n=======================\n");
  while (fahr <= upper) {
    celsius = (5.0/9.0) * (fahr - 32.0);
    printf("%10.0f\t%6.1f\n", fahr, celsius);
    fahr = fahr + step;
  }
}

~/code/c/kr/chap1 $ gcc fahr_celcius.c -o farcel
~/code/c/kr/chap1 $ ./farcel 
Fahrenheit	Celcius
=======================
         0	 -17.8
        20	  -6.7
        40	   4.4
        60	  15.6
        80	  26.7
       100	  37.8
       120	  48.9
       140	  60.0
       160	  71.1
       180	  82.2
       200	  93.3
       220	 104.4
       240	 115.6
       260	 126.7
       280	 137.8
       300	 148.9

# 1-4


#include <stdio.h>

/*
 * Print celsius-Fahrenheit table
 */
main() 
{
  float fahr, celsius;
  int lower, upper, step;

  lower = 0;
  upper = 300;
  step = 20;

  celsius = lower;
  printf("Celsius\tFahrenheit\n=======================\n");
  while (celsius <= upper) {
    fahr = (9.0/5.0) * celsius + 32.0; // (5.0/9.0) * (fahr - 32.0);
    printf("%6.0f\t%10.1f\n", celsius, fahr);
    celsius = celsius + step;
  }
}

~/code/c/kr/chap1 $ gcc celcius_fahr.c -o celfar
~/code/c/kr/chap1 $ ./celfar 
Celsius	Fahrenheit
=======================
     0	      32.0
    20	      68.0
    40	     104.0
    60	     140.0
    80	     176.0
   100	     212.0
   120	     248.0
   140	     284.0
   160	     320.0
   180	     356.0
   200	     392.0
   220	     428.0
   240	     464.0
   260	     500.0
   280	     536.0
   300	     572.0

rainkinz 1 year ago
Programming in C: Lesson 1, HW 1

Ran the program. Tried using a different escape character. Get the warning "unknown escape sequence"

# \o unknown escape sequence
~/code/c/kr/chap1 $ gcc helloworld.c 
helloworld.c:5:12: warning: unknown escape sequence '\o'

rainkinz 1 year ago
Learning Vim from the inside: Lesson 3, HW 2

Used the -R option of lid as shown in the code below:

   -R, --result=STYLE
          STYLE is one of `filenames', `grep', `edit' or `none'

Very nice output:

README.txt:103:There are several mailing lists for Vim, see http://www.vim.org/maillist.php. runtime/doc/intro.txt:98:There are several mailing lists for Vim: runtime/doc/os_vms.txt:111:For more advanced questions, please send your problem to Vim on VMS mailing runtime/doc/pi_netrw.txt:1687:For Windows, folks on the vim mailing list have mentioned that Pageant helps runtime/doc/pi_netrw.txt:2551: mailing list) runtime/doc/uganda.txt:95: by e-mail or by uploading the files to a server and e-mailing the URL. runtime/doc/uganda.txt:96: If the number of changes is small (e.g., a modified Makefile) e-mailing a runtime/tools/efm_filter.txt:1:[adopted from a message that Ives posted in the Vim mailing list] runtime/tools/mve.txt:1:[ The mve awk script was posted on the vimdev mailing list ]

lid -R grep mailing

rainkinz 1 year ago
Learning Vim from the inside: Lesson 2, HW 2

Only thing of interest was I needed to sudo updatedb on Ubuntu

brendan@punga:~/code/vim$ updatedb
updatedb: can not open a temporary file for `/var/lib/mlocate/mlocate.db'
brendan@punga:~/code/vim$ sudo updatedb
[sudo] password for brendan: 
brendan@punga:~/code/vim$ locate if_python.c
/home/brendan/code/vim/src/if_python.c

rainkinz 1 year ago
Learning Vim from the inside: Lesson 2, HW 1

Ran mkid from the vim dir so that I could query over all files in the codebase.

Thanks for introducing this. Had no idea about it. @dioltas thanks for examples.


rainkinz 1 year ago
Learning Vim from the inside: Lesson 1, HW 3

Installed on Ubuntu 10.04 LTS. No major issues, except had to install libncurses-dev


rainkinz 1 year ago
Learning Vim from the inside: Lesson 1, HW 2

Done

brendan@punga:~$ hg clone https://vim.googlecode.com/hg/ vim
requesting all changes
adding changesets
adding manifests
adding file changes
added 2945 changesets with 22133 changes to 2522 files (+2 heads)
updating to branch default
2341 files updated, 0 files merged, 0 files removed, 0 files unresolved

rainkinz 1 year ago