Site hosted by Angelfire.com: Build your free website today!


sudo aptitude install vim-full vim-gnome
the above command is used to install gvim

to mount a resource to linux;
sudo mount.vboxsf <resource to be mounted> <destination folder where the resouce has to be mounted>

usage of find command:
1) find : list everything in the current directory
2) find . -name foo:   finds files/folders with the name foo
3) find . -type f -name *.c : lists all c files

usage: find <where to find> <options> <what to find>

wget -m -p -e robots=off <website address>

gcc c stdout:
stdout is a buffered stream. Whatever is written to stdout does not get
printed until \n is encountered or buffer over flows

so fprintf(stdout, "hello"); don't show anything on the terminal immediately
while, fprintf(stdout, "hello\n"); is seen on the terminal immediately

gcc c:
in switch if "default" is spelt wrong, then it won't execute
  #include<stdio.h>
  int main()
  {
          int a=10;
          switch(a)
          {
                  case '1':
                      printf("ONE\n");
                      break;
                  case '2':
                      printf("TWO\n");
                      break;
                  defa1ut:
                      printf("NONE\n");
          }
          return 0;
  }


Virtual box, shared folder, :
to share a folder of host system with guest system, first add the folder to
"Shared Folders" in virtual box, then, mount it in the guest linux system with
the folowing command
 sudo umount -t vboxsf /home/maruthi/Documents/SharefrmWin


this webpage is generated using Tohtml command in gvim
1) to open ~vimrc file for editing from anywhere from vim, type $MYVIMRC. After editing need to source it inorder for the changes to be effective. Source ~vimrc with following command:
so $MYVIMRC or
so % (if ~vimrc is the current file)


2) to return to place where you last made an edit use the following mark: `.

3) to return to place where you started the search use the following mark: ``

4) if you come accross a file name and you want to open it then 'gf' can be used to open the file it the file is in the current directory. Then to go back to the the previous file press '<C-o>'

5) to find a local defintion use 'gd'

6) to find a global definition use 'gD'


7) on finding something, do find and replace of something
g/<search pattern 1>/s/searchpattern 2/replace string/<flags>


8) to use newline in command line use Ctrl+v+Enter key. here control v acts
like a escape character.

9) in search pattern * means, any number of times of the character or atom preceding the *
   [0-9]* in search term means, any number
  
10) visincr is utility used to insert a column of increasing or descreasin numbers

11) :version
:echo expand('~')
:echo $HOME
:echo $VIM
:echo $VIMRUNTIME


12) opening vimrc file
e $MYVIMRC

http://fishbowl.pastiche.org/archives/pictures/life-lessons-flowchart.png


to log or redirect matlab command window contents:
diary <log file name>
will start logging
to turn the logging off use
diary off


python:
py2exe usage:
python setup.py py2exe
A sample setup.py
  from distutils.core import setup
  import py2exe

  setup(console=['ExcelCompareCols.py'])


wget:
to use wget through proxy:
http://blog.taragana.com/index.php/archive/how-to-use-wget-through-proxy/

following commad is successfully gets everything from website
wget -proxy=on -m -e robots = off -p <web site addrs>


echo, main command line arguments (command-line arguments):
echo is a program with argument \hello, world".
And it can is implemented as followed,
#include <stdio.h>
main(int argc, char *argv[])
{
while(--argc > 0)
/* conditional expressions*/
printf((argc > 1) ? "%s" : "%s", *++argv);
printf("\n");
return 0;
}
9
Th main() function is called with two arguments. First, argc is the number of commandline
arguments, *argv[] is a pointer to the
beginning of the array of character strings
which contain the arguments.
Conventionly, the index of argv[] starts from
0, as argv[0], argv[1], ..., argv[n]. e.g. in
echo hello, world, argv[0]=echo, argv[1]=hello,
argv[2]=world. And argc is at least 1(only
with name of executing program).
In this program, argc is counted down, and
when argc > 1, the argv is increased, starting
with ++argv, makes it originally point at
argv[1] instead of argv[0], because we don't
want to echo back \echo"!


linux:
user space and kernel space are two important concepts in linux or any unix
based operation system

modules in user space are : user programs and libraries
in kernel space: System calls, kernel, device drivers, hardware

Note: Device drivers must be designed to run in kernel space


cat:
concatanate files given in command line arguments
if no file names are given echo stdin until program is terminated by <C-c>

file discriptor or fp values for stdin = 0, stdout = 1, stderr = 2


gvim:
count the number of patterns matched
:%s/pattern//gn

number of lines where the pattern is used
:%s/pattern//n



gcc c : can't use '-' characters in names

gcc c: 'continue' statement, when used starts the loop over from the begining,
after evaluating the condition.


vim:
best of vim tips:
http://rayninfo.co.uk/vimtips.html

Euler project: has some interesting mathemetical and programming problems
http://projecteuler.net/index.php?section=problems


some of the websites for c problems and solutions:
http://users.powernet.co.uk/eton/kandr2/


C: it is always a good practice to clarify expression evaluation using
brackets

excel:
Macro to insert multiple columns
Sub insert_multiple_colms()
Dim CurrentSheet As Object

' Loop through all selected sheets.
For Each CurrentSheet In ActiveWindow.SelectedSheets
' Insert n rows depending on values of a1 and a2.
For i = 0 To 8
CurrentSheet.Range("AY1:AY1").EntireColumn.Insert
Next i
Next CurrentSheet
[/code]
End Sub



C: a good site for some interview questions
http://vijayinterviewquestions.blogspot.com/2007/05/given-only-pointer-to-node-to-be.html


excel: random number generation in the interval a, b
=RAND() * (b-a) + a

excel: formula for genarting random numbers between 1 and 10 with precision
limited to 4 digits

an example formula that generates pattern as shown
formula: ="{"&ROUND((RAND() * (10-0) + 0),4)&","&ROUND((RAND() * (10-0) + 0),4)&","&ROUND((RAND() * (10-0) + 0),4)&","&ROUND((RAND() * (10-0) + 0),4)&",FALSE,FALSE"&ROUND((RAND() * (10-0) + 0),4)&","&ROUND((RAND() * (10-0) + 0),4)&","&ROUND((RAND() * (10-0) + 0),4)&"}"

generates:
{3.698,5.7086,5.3394,9.5183,FALSE,FALSE1.0317,1.5353,7.4865}

excel: if statement
=IF(logical_test, value_if_true, value_if_false)

excel: find statement
The syntax for the Find function is:

    Find( text1, text2, start_position )

text1 is the substring to search for in text2.

text2 is the string to search.

start_position is the position in text2 where the search will start. The first position is 1.


excel: find with if
=IF(FIND("FALSE",W21,1),"TRUE","FALSE")