Merged branches Puneeth and Vattam.
authorSantosh G. Vattam <vattam.santosh@gmail.com>
Fri, 18 Sep 2009 15:51:15 +0530
changeset 69 5e3ce06069cf
parent 61 cfae54ede139 (diff)
parent 68 c4cfe656b57f (current diff)
child 70 7f22e5b9a2d9
Merged branches Puneeth and Vattam.
--- a/latex/handout.rst	Fri Sep 18 15:48:36 2009 +0530
+++ b/latex/handout.rst	Fri Sep 18 15:51:15 2009 +0530
@@ -52,7 +52,7 @@
 Hello World
 ~~~~~~~~~~~
 
-Ok, let's get started with our first LaTeX document. Open up your favorite editor and type in the following code. 
+OK, let's get started with our first LaTeX document. Open up your favorite editor and type in the following code. 
 
 ::
 
@@ -275,7 +275,7 @@
 Emphasizing
 ~~~~~~~~~~~
 
-*Italic* font is generally used to emphasize text. The ``\emph`` command may be used to achive this effect in LaTeX.
+*Italic* font is generally used to emphasize text. The ``\emph`` command may be used to achieve this effect in LaTeX.
 ::
 
   This is the \emph{emphasized text}.
@@ -325,9 +325,9 @@
 
 Itemize, Enumerate, and Description
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-LaTeX has three different enivronments for producing lists. Itemize, Enumerate and Description allow you to produce lists of various types in LaTeX. 
+LaTeX has three different environments for producing lists. Itemize, Enumerate and Description allow you to produce lists of various types in LaTeX. 
 
-Itemize is used to produce unnumbered lists. The bullets of the list can be easily changed to use any character. Enumerate environment allows you to produce auto-numbered lists. The description environment, allows you to produce a list of definitons. These environments can be nested within each other, easily. 
+Itemize is used to produce unnumbered lists. The bullets of the list can be easily changed to use any character. Enumerate environment allows you to produce auto-numbered lists. The description environment, allows you to produce a list of definitions. These environments can be nested within each other, easily. 
 
 ::
 
@@ -400,10 +400,10 @@
   from numpy import *
   a = linspace(0, 5, 50, endpoint = False)
 
-To insert verbatim text inline, the ``\verb`` command can be used. 
+To insert verbatim text in-line, the ``\verb`` command can be used. 
 ::
   
- The verb command allows placing \verb|verbatim text| inline. 
+ The verb command allows placing \verb|verbatim text| in-line. 
 
 The | is just an example of a delimiter character. You can use any character except letters, * or space.
 
@@ -479,7 +479,7 @@
     This parameter can either be set to true or false. When set to true, the image is scaled according to both width and height, without changing the aspect ratio, so that it does not exceed both the width and the height dimensions. 
 
   ``scale=x``
-    Scale the image by a factor of ``x``. For eg. ``scale=2``, will double the image size. 
+    Scale the image by a factor of ``x``. For example, ``scale=2``, will double the image size. 
 
   ``angle=x``
     This option can be used to rotate the image by ``x`` degrees, counter-clockwise. 
@@ -604,7 +604,7 @@
 
 The type of reference is followed by a left curly brace, and immediately followed by the citation key. The citation key, ``Lamport94`` in the example above is used to cite this reference using the command ``\cite{Lamport94}``. 
 
-This is followed by the relevant fields and their values, listed one by one. Each entry must be followed by a comma to delemit one field from the other. 
+This is followed by the relevant fields and their values, listed one by one. Each entry must be followed by a comma to delimit one field from the other. 
 
 To get your LaTeX document to use the bibliography database, you just add the following lines to your LaTeX document. 
 ::
@@ -614,7 +614,7 @@
 
 Bibliography styles are files that tell BibTeX how to format the information stored in the ``.bib`` database file. The style file for this example is ``plain.bst``. Note that you do not need to add the ``.bst`` extension to the filename.  If you wish to achieve a particular style of listing the bibliography items and citing them, you should use an appropriate style file. 
 
-The ``bibliography`` command specifies the file that shoule be used as the database for references. The file used in this example is ``LaTeX.bib``
+The ``bibliography`` command specifies the file that should be used as the database for references. The file used in this example is ``LaTeX.bib``
 
 Compiling
 +++++++++
@@ -663,7 +663,7 @@
 
 The ``\sqrt`` command is used to typeset the square root symbol. LaTeX of the root sign is determined automatically. The nth root is generated with ``\sqrt[n]``. 
 
-To explicitly show a multiplication a dot may be shown. ``\cdot`` could be used, which typesets the dot to the centre. ``\cdots`` is three centered dots while ``\ldots`` sets the dots on the baseline. Besides that ``\vdots`` for vertical and ``\ddots`` can be used for diagonal dots.
+To explicitly show a multiplication a dot may be shown. ``\cdot`` could be used, which typesets the dot to the center. ``\cdots`` is three centered dots while ``\ldots`` sets the dots on the baseline. Besides that ``\vdots`` for vertical and ``\ddots`` can be used for diagonal dots.
 
 A fraction can be typeset with the command ``\frac{..}{..}``
 
@@ -690,7 +690,7 @@
 Arrays and Matrices
 ~~~~~~~~~~~~~~~~~~~
 
-To typset arrays, use the ``array`` environment. It works similar to the ``tabular`` environment. The ``\\`` command is used to break the lines. 
+To typeset arrays, use the ``array`` environment. It works similar to the ``tabular`` environment. The ``\\`` command is used to break the lines. 
 ::
 
   \begin{equation*}
@@ -786,7 +786,7 @@
 
 Including files
 ~~~~~~~~~~~~~~~
-When working on a large document, it is convinient sometimes, to split the large file into smaller input files and club them together at the time of compiling. 
+When working on a large document, it is convenient sometimes, to split the large file into smaller input files and club them together at the time of compiling. 
 
 The ``\input`` or ``\include`` commands may be used to embed one LaTeX file into another. The ``\input`` command is equivalent to a copy and paste of the document, just before the compilation. The ``\include`` command is exactly similar, except for the fact that it creates a new page every time it is issued.
 
@@ -799,19 +799,19 @@
 
 Never use filenames or directories that contain spaces. Make filenames as long or short as you would like, but strictly avoid spaces. Stick to upper or lower case letters (without accents), the digits, the hyphen and the full stop or period.
 
---------------------------------------------------------
+
 
-Acknowledgements, Attributions
-------------------------------
+Recommended Reading
+===================
 
 1. *LaTeX Wikibook*
 
 2. *The Not So Short Introduction to LaTeX2e* by Tobias Oetikar et al.. 
 
-3. http://www.ctan.org/tex-archive/info/l2tabu/english/
-..  LocalWords:  LaTeX WYSIWG WYSIWM pdf
 
 
 
 
 
+..  LocalWords:  LaTeX Lamport tex documentclass pdf pdflatex dvi topmatter ToC
+..  LocalWords:  FOSSEE tocdepth addcontentsline toc emph
--- a/latex/latex.rst	Fri Sep 18 15:48:36 2009 +0530
+++ b/latex/latex.rst	Fri Sep 18 15:51:15 2009 +0530
@@ -64,9 +64,6 @@
 | 7       | ``beamer``, ``listing``,        |  10 min |
 |         | Including files                 |         |
 +---------+---------------------------------+---------+
-| 8       | Excercises                      |  15 min |
+| 8       | Exercises                       |  15 min |
 +---------+---------------------------------+---------+
 
-
-
-
--- a/ult/Section_5.rst	Fri Sep 18 15:48:36 2009 +0530
+++ b/ult/Section_5.rst	Fri Sep 18 15:51:15 2009 +0530
@@ -11,7 +11,7 @@
     diff, cmp, comm
   - Create and extract archives(.tar files) and zipped files(.gz)     Ap
   - Set/Modify environment as per need	    	                      Ap
-  - Create shell scripts to autmoate tasks.			      Ap
+  - Create shell scripts to automate tasks.			      Ap
 
 tar:
 ====
@@ -431,7 +431,7 @@
    $ expr 2*3
    expr: syntax error
    
-One can use backquotes(`) also to get value of expr. ::
+One can use back-quotes(`) also to get value of expr. ::
 
    $ echo `expr 6 + 3`
    9
@@ -439,7 +439,7 @@
    $ echo $result
    9
 
-Shell uses three kinds of quotes. Double quotes("), anything enclosed among them except from variable trailing after $, and characters after \ would be printed as it is. Single quotes('), anything enclsed within them is just same, no formulation/interpretaion. Back quotes(`), anything inclosed is considered as command, or is executed. ::
+Shell uses three kinds of quotes. Double quotes("), anything enclosed among them except from variable trailing after $, and characters after \ would be printed as it is. Single quotes('), anything enclosed within them is just same, no formulation/interpretation. Back quotes(`), anything inclosed is considered as command, or is executed. ::
 
    $ echo "Today is date"
    Today is date
@@ -453,8 +453,8 @@
    Today is 
     Wed Sep 16 17:41:13 IST 2009 
 
-if construct:
--------------
+if else construct:
+------------------
 
 One can have simple *if else if* constructs in shell scripts to check conditions. Lets take simple example of writing a script which returns back whether the argument passed is positive or not: ::
 
@@ -594,6 +594,40 @@
   done
   exit 0
 
+Now lets try and use these above mentioned options provided by shell to write a utility. Until now, when we try find or locate it looks through directories and files for result. But they wont search through tar archives and zipped files. Lets create a shell script for especially looking through these files: ::
+
+  #!/bin/sh
+
+  #To check number of arguments being passed.
+  if [ $# -eq 0 ] ; then
+  echo "Correct usage: $0 tar-archive filename \nOr $0 filename"
+  exit 1
+  else
+    if [ $# -eq 1 ] ; then
+      tar_archive=`find $PWD -name "*.tar*"`
+    else
+      tar_archive=`find $PWD -name $1`
+    fi
+  fi
+
+  #Search of particular file inside archives.
+  for archive in $tar_archive
+  do
+    echo $archive
+    variable=`tar -tf $archive`
+    for word in $variable
+    do
+      if [ $# -eq 1 ] ; then
+        echo "$word" | grep -q ".*$1"
+      else
+	echo "$word" | grep -q ".*$2"
+      fi
+    if [ $? -eq 0 ] ; then 
+      echo "File present in $archive!" 
+    fi  
+    done
+  done
+
 ``until``
 ~~~~~~~~~
 
@@ -607,10 +641,63 @@
     echo "True"
   done
 
+Functions
+---------
+
+When a group of commands are repeatedly being used within a script, it is convenient to group them as a function. This saves a lot of time and you can avoid retyping the code again and again. Also, it will help you maintain your code easily. Let's see how we can define a simple function, ``hello-world``. Functions can be defined in bash, either using the ``function`` built-in followed by the function name or just the function name followed by a pair of parentheses. 
+::
+
+  function hello-world
+  { 
+  echo "Hello, World."; 
+  }
+
+  hello-world () {
+    echo "Hello, World.";
+  }
+
+  $ hello-world
+  Hello, World.
+
+Passing parameters to functions is similar to passing them to scripts. 
+::
+
+  function hello-name
+  { 
+  echo "Hello, $1."; 
+  }
+
+  $ hello-name 9
+  Hello, 9.
+
+Any variables that you define within a function, will be added to the global namespace. If you wish to define variables that are restricted to the scope of the function, define a variable using the ``local`` built-in command of bash.
+
+We shall now write a function for the word frequency generating script that we had looked at in the previous session. 
+
+::
+
+  function word_frequency {
+    if [ $# -ne 1 ]
+    then
+      echo "Usage: $0 file_name"
+      exit 1
+    else 
+      if [ -f "$1" ]
+      then
+        grep  "[A-Za-z]*" -o "$1" | tr 'A-Z' 'a-z' | sort | uniq -c | sort -nr | less
+      fi
+    fi
+  }
+
+As an exercise, modify the function to accept the input for the number of top frequency words to be shown (if none is given, assume 10).
+
 
 Further Reading:
 ---------------- 
 	* http://www.freeos.com/guides/lsst/ 
-	* http://www.freeos.com/guides/lsst/ch02sec01.html
 	* http://bash.cyberciti.biz/guide/Main_Page
+	* http://tldp.org/LDP/abs/html/
+	* http://tldp.org/LDP/Bash-Beginners-Guide/html/Bash-Beginners-Guide.html
 	
+
+..  LocalWords:  allfiles txt cvf vf tf regex mkdir cp cd xvf gzip gz stdout
--- a/ult/session4.rst	Fri Sep 18 15:48:36 2009 +0530
+++ b/ult/session4.rst	Fri Sep 18 15:51:15 2009 +0530
@@ -245,7 +245,7 @@
 To save the file, use ``:w`` in the command mode. From here on, it is understood that we are in the command mode, whenever we are issuing any command to vim. 
 
 To save a file and continue editing, use ``:w FILENAME``
-The file name is optional. If you donot specify a filename, it is saved in the same file that you opened. If a file name different from the one you opened is specified, the text is saved with the new name, but you continue editing the file that you opened. The next time you save it without specifying a name, it gets saved with the name of the file that you initially opened. 
+The file name is optional. If you do not specify a filename, it is saved in the same file that you opened. If a file name different from the one you opened is specified, the text is saved with the new name, but you continue editing the file that you opened. The next time you save it without specifying a name, it gets saved with the name of the file that you initially opened. 
 
 To save file with a new name and continue editing the new file, use ``:saveas FILENAME``
 
@@ -385,21 +385,21 @@
 Searching and Replacing
 ~~~~~~~~~~~~~~~~~~~~~~~
 
-+----------------------------------------+---------+
-| Finding                                          |
-+========================================+=========+
-| Next occurence of ``text``, forward    |``\text``|
-+----------------------------------------+---------+
-| Next occurence of ``text``, backward   |``?text``|
-+----------------------------------------+---------+
-| Search again in the same direction     | ``n``   |
-+----------------------------------------+---------+
-| Search again in the opposite direction | ``N``   |
-+----------------------------------------+---------+
-| Next occurence of ``x`` in the line    | ``fx``  |
-+----------------------------------------+---------+
-| Previous occurence of ``x`` in the line| ``Fx``  |
-+----------------------------------------+---------+
++-----------------------------------------+---------+
+| Finding                                           |
++=========================================+=========+
+| Next occurrence of ``text``, forward    |``\text``|
++-----------------------------------------+---------+
+| Next occurrence of ``text``, backward   |``?text``|
++-----------------------------------------+---------+
+| Search again in the same direction      | ``n``   |
++-----------------------------------------+---------+
+| Search again in the opposite direction  | ``N``   |
++-----------------------------------------+---------+
+| Next occurrence of ``x`` in the line    | ``fx``  |
++-----------------------------------------+---------+
+| Previous occurrence of ``x`` in the line| ``Fx``  |
++-----------------------------------------+---------+
 
 +---------------------------------------+------------------+
 | Finding and Replacing                                    |
@@ -425,30 +425,36 @@
 | for confirmation each time.           |                  |
 +---------------------------------------+------------------+
 
-
-scite
+SciTE
 -----
 
+SciTE is a *source code* editor, that has a feel similar to the commonly used GUI text editors. It has a wide range of features that are extremely useful for a programmer, editing code. Also it aims to keep configuration simple, and the user needs to edit a text file to configure SciTE to his/her liking. 
+
+Opening, Saving, Editing files with SciTE is extremely simple and trivial. Knowledge of using a text editor will suffice. 
+
+SciTE can syntax highlight code in various languages. It also has auto-indentation, code-folding and other such features which are useful when editing code. 
+
+SciTE also gives you the option to (compile and) run your code, from within the editor. 
 
 Personalizing your Environment
 ==============================
 
 .bashrc
 -------
-What would you do, if you want bash to execute a particular command each time you start it up? For instance, say you want the current directory to be your Desktop instead of your home folder, each time bash starts up. How would you achieve this? Bash reads and executes commands in a whole bunch of files called startup files, when it starts up. 
+What would you do, if you want bash to execute a particular command each time you start it up? For instance, say you want the current directory to be your Desktop instead of your home folder, each time bash starts up. How would you achieve this? Bash reads and executes commands in a whole bunch of files called start-up files, when it starts up. 
 
 When bash starts up as an interactive login shell, it reads the files ``/etc/profile``, ``~/.bash_profile``, ``~/.bash_login``, and ``~/.profile`` in that order. 
 
-When it is a shell that is not a login shell, ``~/.bashrc`` is read and the commands in it are executed. This can be prevented using the ``--norc`` option. To force bash to use another file, instead of the ``~/.bashrc`` file on startup, the ``--rcfile`` option may be used. 
+When it is a shell that is not a login shell, ``~/.bashrc`` is read and the commands in it are executed. This can be prevented using the ``--norc`` option. To force bash to use another file, instead of the ``~/.bashrc`` file on start-up, the ``--rcfile`` option may be used. 
 
 Now, you know what you should do, to change the current directory to you Desktop. Just put a ``cd ~/Desktop`` into your ``~/.bashrc`` and you are set!
 
-This example is quite a simple and lame one. The startup files are used for a lot more complex things than this. You could set (or unset) aliases and a whole bunch of environment variables in the ``.bashrc``. We shall look at them, in the next section where we look at environment variables and ``set`` command.
+This example is quite a simple and lame one. The start-up files are used for a lot more complex things than this. You could set (or unset) aliases and a whole bunch of environment variables in the ``.bashrc``. We shall look at them, in the next section where we look at environment variables and ``set`` command.
 
 
 .vimrc
 ------
-``.vimrc`` is a file similar to ``.bashrc`` for vim. It is a startup file that vim reads and executes, each time it starts up. The options that you would like to be set every time you use vim, are placed in the ``.vimrc`` file, so that they are automatically set each time vim starts. The recommended place for having your ``.vimrc`` is also your home directory. 
+``.vimrc`` is a file similar to ``.bashrc`` for vim. It is a start-up file that vim reads and executes, each time it starts up. The options that you would like to be set every time you use vim, are placed in the ``.vimrc`` file, so that they are automatically set each time vim starts. The recommended place for having your ``.vimrc`` is also your home directory. 
 
 The file ``/etc/vimrc`` is the global config file and shouldn't usually be edited. You can instead edit the ``~/.vimrc`` file that is present in your home folder. 
 
--- a/versionControl/handOut.rst	Fri Sep 18 15:48:36 2009 +0530
+++ b/versionControl/handOut.rst	Fri Sep 18 15:51:15 2009 +0530
@@ -1,7 +1,6 @@
-is	
-=================
- Version Control
-=================
+===============
+Version Control
+===============
 
 Introduction
 ============
--- a/versionControl/versionControl.rst	Fri Sep 18 15:48:36 2009 +0530
+++ b/versionControl/versionControl.rst	Fri Sep 18 15:51:15 2009 +0530
@@ -5,11 +5,12 @@
 Module Objectives
 -----------------
 
-After successfully completing this module a participant will be able to:
-	- Understand use of Version Control tools                            U
-	- Create and use repository for daily use of assignments/projects    Ap
-	- Browse exsiting repo, make changes and commit back                 Ap
-	- Work collaboratively with a team on live project                   Ap
+After successfully completing this module a participant will be able to: ::
+      
+  - Understand use of Version Control tools                            U
+  - Create and use repository for daily use of assignments/projects    Ap
+  - Browse exsiting repo, make changes and commit back                 Ap
+  - Work collaboratively with a team on live project                   Ap
 
 Suggested Reading:
 ------------------