Saturday, October 17, 2009

Basics Of Excel.

Microsoft Excel is a spreadsheet program that can be used for storing, organizing and manipulating data.

Before starting excel the user needs to know the following terminologies:
1. Worksheet: A worksheet is a grid of columns and rows.
2. Cell: The intersection of any column and row is called a cell.
3. Cell Reference: Each cell in the worksheet has a unique identification formed by combining the column heading and row heading. This unique identification is known as cell reference. This is also known as cell name and cell location.
4. Cell pointer: A white cross shaped pointer that appears over cell in the worksheet. It indicates a cell which is currently selected.
5. Active Cell: The selected cell is known as active cell. There will be atleast one active cell in the worksheet at any point of the time.
6. Range: It is a specified group of cell. It could be either a column, a row or a combination of both.
7. Range Co-ordinates: It identifies a range. The first element in a range coordinate is the location of the upper-left cell in the range; the second element is the lower-right cell in the range. A colon(:) separates these two elements. Ex: A1:D4
8. Data: It is the technical term for the text and numbers that a user enters into a worksheet.


Cells:

An Excel worksheet is made up of many cells. The user places the information he wants to save, whether it be text, number or a graph in this cell. Each cell has a location name and it is unique to it. This is also known as cell reference. If the user wants to know the cell reference of any cell, then he should select that cell. The Cell reference of the selected cell or active cell is displayed in the “Name box”. The name box lies at the top right just about the column headers and to the left of the functions box.

No two cells have the save cell name, even if they are in two different worksheets and in the same workbook. Because Excel references the cells by “Sheet1!D4” and “Sheet2!D4” for the same cell “D4” in two different worksheets “Sheet1” and “Sheet2”. If they same cell name and sheet name but are in different workbooks, then excel references them as “[file1.xls]Sheet1!D4” and “[file2.xls]Sheet1!D4”


Selecting Cells:

The user can select a particular cell either by clicking on that cell using mouse or by using arrow keys.

If the user wants to select multiple cells which aren’t next to each other then user should press the “Ctrl” key and start selecting the cells. But remember the user cannot unselect a cell once he has selected!!! If the user selects a wrong cell, then the only way to unselect it is to start a new selection!!

If the user wants to select multiple cells which are adjacent then he can select them in 2 ways:
1. Dragging the mouse pointer from the start cell to the end cell.
2. Holding the shift key and selecting the start cell and the end cell either by mouse or by the arrow keys.

To select the whole column at once left click on the column header. Similarly to select the whole row at once left click on the row header. The same could be achieved using keyboard by selecting the first cell of the row/column and Ctrl + Shift + Down arrow.


Adding Comments to the cell:

The user can add comments to the cell. These comments are not displayed in the cell, but instead a small red triangle is displayed at the top right of the cell. When the mouse is moved to that location, then the comment is displayed as the screen tip.

Adding comment in Excel is pretty easy. The user just need to right click on the cell he wants to add a comment, select the “Insert comment” option from the shortcut menu and type the comment in the box appearing. Then click anywhere else on the worksheet. To modify the comment the user has to right click and select the “Edit Comment” option from the short cut menu and edit.

By default the comments are not displayed always. They are only displayed if the user takes the mouse to the red triangle which will be at the top right corner of the cell. But the user can make the comment always visible by selecting the “Show comment” option from the short cut menu.

If the user wants to delete the comment, then he should just select the option “Delete Comment” from the short cut menu. The comment will be deleted and the red triangle will be no more displayed at the top right corner of the cell.


Adding Symbols to the cell:

It is easy to add symbols to the cell. The user should select the cell in which he desired to have the symbol and select the symbol from Insert -> Symbol dialogue box. The symbols can be deleted as any other character.

The symbol dialogue box contains all the symbols. There is an option for fonts. Choose a different font to insert the symbol in that font. The default font will be “(normal text)”.


Formatting the display of numeric data:

The numeric data can be displayed in a number of formats. For example, in comma format (displays the numeric data with proper commas), currency format(displays the numeric data with currency symbol), percentage format(displays numeric data with percent symbol) etc. The user can choose different formatting in the Format -> Style Menu. The user can also customize the view here.

If the user gets “#######” in the cell after changing the style then it means, either the number cannot be displayed in that particular format or the width of the cell is not enough to display that numeric data in that particular format. The first thing the user should do is to increase the width of the cell. If this doesn’t solve the problem, then revert to the previous format.

The default format of the numbers in the Excel is “General Format”. Here the numbers are just displayed in the cell with right aligned and no other rules are applied. There is an option in Excel to clear all the formatting done to the cell in one go and return to the default format style. Just select Edit -> Clear -> Format!

Merging Cells:

There will be times when the user wants to merge cells. This may be to put a heading for the columns following or for any other reason. There are 2 ways to merge the cells in Excel.
1. Select the cells to be merged and go to Format -> Cells menu. Go to Alignment tab and select “merge”. This will merge all the cells and keep the data of the upper left cell and deletes the data of all other cells. The same can be achieved by selecting the cells that are to be merged and selecting “Format Cells” menu by right clicking on those cells. The format of the new cell formed will be the formatting of the upper left cell.
2. Select the cells to be merged and click on the “Merge and Centre” button in the formatting toolbar. This will merge all the cells and the data in the upper left cell will be placed at the centre of the new formed cell.

To undo merging go to Format -> Cells menu. Go to Alignment tab and unselect the merge option. Or you can also do it by right clicking on the merged cell and selecting “Format cell” option. Then unselect merge cells option from the menu.


Changing Alignment:

Do you think you can align the data in a cell in only 3 ways? i.e., left, right and centre. If you think so, then you are wrong, At least in Excel. Excel provides many ways to align the data in the cell. You can find them in the Format -> Cells menu, Alignment tab.

The three most popularly used alignment (left align, right align and centre align) are also available in the formatting toolbar. The user has to just select the cell and click the particular button to change the alignment!

Saturday, October 10, 2009

109 Shortcuts in UBUNTU

I would always prefer to use shortcuts instead of using mouse, no matter which OS I use. I have recently started using Ubuntu. So I digged into its shortcuts. In this blog I share with you what ever I have found. If you have more let me know.

Desktop Shortcuts:

1.Open Applications Menu: Alt + F1
2.Run an application: Alt + F2
3.Take screenshot of the screen: Prt Sc
4.Take screenshot of only the current window: Alt + Prt Sc
5.Open Home folder: Alt + home
6.Show all workspaces and then select one among it: Windows Logo + e
7.Shut down options menu: Ctrl + Alt + Del
8.Lock the screen: Ctrl + Alt + l
9.Initiate window picker: Shift + Alt + up

Window Shortcuts:

1.Switch between windows: Alt + Tab
2.Switch between workspaces: Ctrl + Alt + Left/Right Cursor
3.To Move the current window(either with mouse or keyboard): Alt + F7
4.To minimize the window: Alt + F9
5.Toggle Maximization State: Alt + F10
6.To view window menu: Alt + Space
7.To restore window to the normal size: Alt + F5
8.To close the window: Alt + F4
9.Move window one workspace to left: Shift + Ctrl + Alt + Left arrow
10.Move window one workspace to right: Shift + Ctrl + Alt + Rigth arrow
11.Move window one workspace up: Shift + Ctrl + Alt + up arrow
12.Move window one workspace down: Shift + Ctrl + Alt + up arrow

Nautilus Shortcuts:

1.Create new folder: Ctrl + Shift + n
2.Show file/folder properties: Alt + Enter
3.Change the way the files/folders are displayed: Ctrl + 1/2/3
4.Close current Nautilus window: Ctrl + w
5.Close all Nautilus window: Shift + Ctrl + w
6.Open new tab: Ctrl + t
7.Go to parent folder: Alt + up arrow
8.Go to selected folder: Alt + down arrow
9.Move back: Alt + Left arrow
10.Move Forward: Alt + down arrow
11.Toggle display of Hidden files and folders: Ctrl + h

Common Application Shortcuts:

1.To copy selected text/object: Ctrl + c
2.To cut selected text/object: Ctrl + x
3.To paste or insert the copied or cut text/object: Ctrl + v
4.Select All: Ctrl + a
5.Make selected text bold or to Enable bold lettering: Ctrl + B
6.Make selected text italics or to Enable italic lettering: Ctrl + I
7.Underline selected text or to Enable underlining of the text: Ctrl + U
8.To open a new document or window: Ctrl + n
9.To save current document: Ctrl + s
10.To open another document: Ctrl + o
11.Print current document: Ctrl + p
12.Undo last change: Ctrl + z
13.Redo last change that you just undid: Ctrl + Shift + z


Firefox shortcuts:

1.Open a new tab: Ctrl + t
2.Rotate through the opened tabs: Ctrl + Tab & Ctrl + Pgup
3.Rotate backward through the opened tabs: Ctrl + Shift + Tab & Ctrl + Pgdown
4.Close the current tab: Ctrl + w & Ctrl + F4
5.Enter new web address(URL): Ctrl + l & F6 & Alt + D
6.Show a list of bookmarks: Ctrl + b
7.Show your browsing history: Ctrl + h
8.Enter new web search in the search bar: Ctrl + k & Ctrl + j
9.Show the list of downloaded files: Ctrl + y
10.To display the current page in Full screen: F11
11.Reload current page: Ctrl + r & F5
12.View page source: Ctrl + u
13.Go back to previous page: Alt + Left arrow & Ctrl + [
14.Go forward: Alt + Right arrow & Ctrl + ]
15.Go to home page: Alt + home
16.Open a file: Ctrl + o
17.Reload (overriding cache): F5 & Ctrl + r
18.Go to bottom of the page: End
19.Go to top of the page: Home
20.View page info: Ctrl + i
21.Print page: Ctrl + p
22.Save page as: Ctrl + s
23.Zoom in: Ctrl + '+'(Numpad Plus button)
24.Zoom out: Ctrl + '-'(Numpad minus button or hiphen)
25.Zoom reset: Ctrl + 0(Zero)
26.Copy: Ctrl + c
27.Cut: Ctrl + x
28.Delete: Delete
29.Paste: Ctrl + v
30.Undo: Ctrl + z
31.Redo: Ctrl + Shift + z
32.Select All: Ctrl + a
33.Find: Ctrl + f
34.Find Again: F3 & Ctrl + g
35.Find as you type link: '
36.Find as you type text: /
37.Find Previous: Shift + F3
38.Close current window: Alt + F4
39.Move tab to right: (When the tab is focussed)Ctrl + Right Arrow & Ctrl + Up arrow
40.Move tab to left: (When the tab is focussed)Ctrl + Left arrow & Ctrl + down arrow
41.Move tab to beggining: (When the tab is focussed) Ctrl + Home
42.Move tab to end: (When the tab is focussed) Ctrl + End
43.Open new window: Ctrl + t
44.Undo close tab: Ctrl + Shift + t
45.Select tab(1 to 8): Alt + (1 to 8)
46.Select last tab: Alt + 9
47.Bookmark current page: Ctrl + d
48.Show all bookmarks: Ctrl + b
49.Turn caret browsing on/off: F7
(Caret browsing is a kind of keyboard navigation where a text cursor is used to navigate within the text document. When caret browsing is on, a blinking caret appears within the webpage. User can navigate through the webpage using arrow keys.)
50.Clear private data: Ctrl + Shift + Delete
51.View error console: Ctrl + Shift + j
52.Complete “.com” address: Ctrl + Enter
53.Complete “.org” address: Ctrl + Shift + Enter
54.Complete “.net” address: Shift + Enter
55.Delete Auto complete entry: Delete
56.Display help: F1

OpenOffice.org Writer:

1.Check the spelling of the current document: F7
2.Find and replace words: Ctrl + f
3.Undo last change: Ctrl + z
4.Redo a change which you just undid: Ctrl + y
5.Align the current paragraph section to left: Ctrl + l
6.Align the current paragraph/selected section to centre: Ctrl + E
7.Align the current paragraph/selected section to right: Ctrl + R
8.Show current document full screen: F11

Saturday, October 3, 2009

Subcommands Episode 2

blame:

syntax:
$ svn blame
“filename” is the path of the file from the current directory or may be a URL or the file.

What it does?
The blame subcommand displays the author and revision information in-line for the specified “filename”. Each line of text in the file is annotated with the author and the revision number for the last change to that line. It works only on files and not directories. It does not alter the contents of the file. It only displays them.

Alternate Names:
1.praise:
Ex: $ svn praise file1
2.annotate:
Ex: $ svn annotate directory1/file2
3.ann:
Ex: $ svn ann https://repositoryurs/directory2/file3

Access Repository: Yes

Options that could be used with this subcommand:
1.--config-dir
2.--no-auto-cache
3.--non-interactive
4.--password
5.--revision , -r
6.--username

Example:
$ svn blame ./directory2/directory3/file4.sh
1 user1 #!/bin/sh
4 user2 echo “changed line 4 times”


cat:

syntax:
$ svn cat []
“filename” is the path of the file or the URL of the file.
“revision no.” is optional.

What it does?
The “cat” subcammand of svn is similar to unix “cat” command. It displays the contents of the file from the repository.

Alternate names:
None.

Access Repository: Yes

Options that could be used with this subcommand:
1.--config-dir
2.--no-auth-cache
3.--non-interactive
4.--password
5.--revision , -r
6.--username

Example:
$ svn cat file1.sh
#!/bin/sh
echo “This is the latest copy in the repository”


checkout:

syntax:
$ svn checkout
“source url” is the location of the repository from where the user wants to checkout. The user can give multiple url's to checkout from.
“target location” is the path in the local system where the user wants the copy of the repository. This is optional. If this is omitted, then a folder whose name is the base name of the 'source url' is created in the current directory and the re

What it does?
'checkout' subcommand is used to check out a working copy from a repository. Checking out a repository creates a copy of it in the local system. This copy contains latest revision by default. If user wants, he can download different revisions by using the option “--revision”. When multiple URL's are given, each one is checked out into a subdirectrory of “target location”, with the name of the subdirectory being the basename of the URL. It does not cause any change to the repository, but only creates a working copy for the user.
If by any chance, the download is interrupted, then the user can continue the checkout by executing the same command or by using “svn up” command, i.e., by updating the woking copy.

Alternate Name:
1.co:
Ex: $ svn co https://repositoryurl/directory/ targetdirectory/

Access Repository: Yes

Options that could be used with this subcommand:
1.--config-dir
2.--no-auth-cache
3.--non-interactive
4.--non-recursive(-N)
5.--password
6.--quiet (-q)
7.--revision , -r
8.--username

Example:
1.$ svn checkout http://repositoryurl/directory1 targetdirectory/
A targetdirectory/directory1/file1
A targetdirectory/directory1/file2
A targetdirectory/directory1/directory2/
A targetdirectory/directory1/directory2/file3
.
.
.
updated to revision 5
2.$ svn checkout https://repositoryurl/directory1
A directory1/file1
A directory1/file2
A directory1/directory2/
A directory1/directory2/file3
.
.
.
updated to revision 5
3.$ svn co https://repositoryurl/directory1 https://repositoryurl/directory2
A directory1/file11
A directory1/file12
A directory1/directory12/
A directory1/directory12/file13
.
.
.
updated to revision 5
A directory2/file21
A directory2/file22
A directory2/directory22/
A directory2/directory22/file23
.
.
.
updated to revision 3
4.$ svn co https://repositoryurl/directory1 https://repositoryurl/directory2 targetfolder/
A targetfolder/directory1/file11
A targetfolder/directory1/file12
A targetfolder/directory1/directory12/
A targetfolder/directory1/directory12/file13
.
.
.
updated to revision 5
A targetfolder/directory2/file21
A targetfolder/directory2/file22
A targetfolder/directory2/directory22/
A targetfolder/directory2/directory22/file23
.
.
.
updated to revision 3

Wednesday, August 26, 2009

Options Episode 7 + Subcommands Episode 1

--ignore-ancestry
Tells Subversion to ignore historical details(ancestry) while calculating differences. If this option is used, then Subversion relies on path contents alone to calculate the differences.

--no-ignore

In the working copy, there will be certain files which are not supposed to be under version control. E.g., the “.o” or “.so” files which are generated after compiling. Some text files etc. When the user runs “svn stat” to see the differences in the working copy and the repository, then he doesn't want the Subversion to display these files. Hence Subversion ignores such files. The files which should be ignored are mentioned by the “svn:ignore” property. If the user wants to override this rule and wishes to see all the files without excluding any files, then he could use this option. This will override the ignore property and displays all the files.

--relocate from to [path... ]
This option is used only with “svn switch” command. This is used to change the location of the repository that the users working copy is referencing. One of the situation where this option could be useful for the user is when the location of the repository changes and the user still has a working copy in the previous location which he continues to use.

--revprop
This option tells the Subversion to operate on a revision property instead of Subversion property specific to a file or directory. This option requires the user to pass the revision no. also.

--show-updates
Displays information about which files and directories in the working copy of the user are out-of-date. This option doesn't actually updates the working copy, but instead just displays what would happen if the user uses “svn update”. “-u” is the shorter form of this option.

--strict
Tells the Subversion to use strict semantics with certain subcommands like “svn propget”.



Subcommands:


The svn command is the main user interface to the Subversion. The following are the commands:


add

syntax: svn add

This command adds files and directories to the working copy and schedule them to be added to the repository on the users next commit. This command does not access the repository, it changes only in the working copy. This command just adds the file or directory to version control. When the user commits the file or directory is uploaded to the repository. Note that if the user does not commit the file or directory which he has added then that file or directory won't be uploaded to the repository. The “add” subcommand just adds the files or directories under version control in the working copy only. The options that could be used with this subcommand are
1.--auto-props.
2.--cofig-dir
3.--no-auto-props
4.--non-recursive (-N)
5.--quiet(-q)
6.--targets

Examples:

1. Adding a file.
$ svn add file1.c
A file1.c

2. Adding a directory with all its files and subdirectories.
$ svn add directroy1
A directory1
A directory1/file1.c
A directory1/file2.java
A directory1/directory2
A directory1/directory2/file3.cpp
.
.
.

3. Adding a directory without adding its contents.
$ svn add --non-recursive directory1
A directory1

4. Adding multiple files at once.
$ svn add file1.c file2.c file3.c directory1
A file1.c
A file2.c
A file3.c
A directory1
A directory1/file1.c
A directory1/file2.java
A directory1/directory2
A directory1/directory2/file3.cpp
.
.
.

Saturday, August 22, 2009

The "vim"

“vim” options:

These options are exclusively for “vim”. They do not work for “vi”.
-b: Edit the file in binary mode.
--cmd : Execute the command before any resource files are read. This is just like “-c” option. The the command is executed not upon startup but before opening the file.
-C: Start the the visual editor in “vi – compatible” mode.
-h: Print “help message” and then exit editor. In other words, this option is used to see the help text.
-i : Use the specified file, “file” to save or restore vim's state. By default vim uses “~/.viminfo” file to save or restore vim's state.
-m: Start the editor with “write” option turned off. The user cannot write anything to the file when this option is used. This option could be used by the user, if he wants to only read the file and does not want to change anything accidentally.
-M: Start the editor with “modifiable” option turned off. This is same as the above option, but the difference is that when the user uses above option then the error is thrown when the user wants to save the file while in this case the error is thrown when user even tries to modify the file. If the user uses above option, then he can make changes to the file but cannot save it. While if he uses this option, then he can't even make modifications to the file.
-n: This option tells the vim not to create a swap file to record the changes instead record all the changes in the memory only. When user opens a file via vim, then it, by default creates a swap file to record the changes that is going to be done by user. To observe this you can open a file in vim and then do “ls -a” to see the swap file! If this option is used, then vim does not create a swap file but instead records the changes in the memory only.
-N: Run “vim” in “non vi-compatible” mode. This means many of the “vi” commands would not work.
--no-plugin: Start vim session without loading any plug-ins.
-o: Open multiple files at once. The user can give as many files as he wants. Vim will divide the window to the no. of files and opens all the files in same terminal.
-O: Open multiple files at once not by dividing the terminal horizontally but by dividing it vertically.
-s : If the user wants to give many commands, then he could write those commands in a scriptfile and then use this option. This tells the vim to read the commands from the script file and execute them as if they were given on the command prompt.
-S : In vim, while using “-c” option, the user can execute upto 10 commands. If the user does not want to type all of them in the command line, then he could use this option. This tells the vim to read and execute the commands from the command file after opening any file for editing.
-T : This option is to override the “$TERM” Environmental variable. This variable sets the type of the terminal.
-u : This option tells the vim to read the configuration information from the specified file. By default vim reads the configuration information from the “.vimrc” resource file. If file name is not mentioned with this option, then vim does not read any resource file, load any plug-ins, and run in vi-compatible mode. If the argument it “NORC”, then it does not read any resource file but loads all the plug-ins.
--version: Prints version information of the vim and exits.
-V : Sets verbose mode. Displays all the informations about which file is being read and which options are being set. “” is to set the level of verbosity. Level of verbosity indicates the no. of messages being displayed on the screen. By default it is “10”.
-W : Record all the typed commands in the current session in the “scriptfile”. This could be used as input for “-s” option.
-y: Run vim in “insert” mode only. The user cannot switch to command mode. It is same as invoking vim as evim.
-Z: Run vim in a restricted mode. It tells vim not to allow any shell commands or the suspension of the editor.


Visual Mode:

The vi editor operates in 2 modes. The vim provides another mode of operation, Visual Mode. This functionality is vim specific. This mode allows user to highlight blocks of texts which then could be object of edit commands such as deletion, copying etc. The Graphical versions of vim allows the user to highlight the text using mouse. The operations that could be performed in this mode are:
1.v: Select text one character at a time.
2.V: Select text one line at a time.
3.Ctrl V: Select text in blocks.

The above commands are solely for visual mode. To go to visual mode, the user should press “v” in the command mode. To return he can press “escape” again. The above commands is for selection of text. The user can copy the selected text, move the selected text or even delete the selected text.


Window Commands:

The following are the lists of commands to control windows in vim. These commands are run in the command.
“:new ” or “^W n
Open a new file in new window. If is not specified then a new file is created.
“:sp ” or “^W s
Split the current window and open the file “” in the new window. It works same as “:new ” command. If the user does not specify a file name then same file will be opened even in other window.
“:sv
Split the current window and open the file “” in the new window in read-only mode. If filename argument is compulsory. If the user gives the name of the same file which he has opened then in the new window it won't be in read-only mode.
“:sn
The user can open multiple files at once in vim. Instead of mentioning only one file the user can mention multiple files with vim command.
E.g: vim .....
This option is used to edit the file “” which is in this list. If no filename is mentioned then the cursor jumps to the next file in the list to edit. If there is no file in the list, then an error is displayed to the user.
“:vsp
Same as “:sp” except that the window will be split in vertically and not horizontally.
“:clo” or “^W c”
Close the current window.
“:hid”
Hide the current window. If there is only one window open, then vim will throw an error.
“:on” or “^W o”
Make the current window the only visible window. This makes all other windows to hide.
“:res
Resize the window to the “” lines. If “” is not used then that window will be resized to the max possible number of lines. All other windows would contain only 1line.(Only if the window is split in horizontal way).
“:wa”
Write all changed buffers to the file. This option is used to save all the files open in different windows at once.
“:qa”
Close all the windows and exit vim.
“^W ^”
Open new window with previously edited file.
“^W j”
Move cursor to the next window.
“^W k” or “^W p”
Move cursor to the previous window.
“^W h”
Move cursor to the window on left.
“^W l”
Move cursor to the window on right.
“^W t” or “^W K”
Move cursor to the window on the top of the screen.
“^W b” or “^W B”
Move cursor to the window on the bottom of the screen.
“^W H”
Move cursor to the window far left of the screen.
“^W L”
Move cursor to the window far right of the screen.
“^W r”
Rotate windows down.
“^W R”
Rotate windows up.
“^W +”
Increase current window size.
“^W -”
Decrease current window size.
“^W =”
Make all windows same height.

Tuesday, August 18, 2009

Vi, ex and vim Editors

The vi and ex are the “standard” editors of the unix. Any unix system contains it some version. Besides original unix vi, there are a number of clone versions(or enhanced versions) are available now. The vim is one among it and is now popularly used.


Overview:

The 'vi' is the screen editor program in unix. It stands for 'VIsual editor'. It is based on the older 'ex' editor. There are many editing commands in the vi. These can be invoked by pressing 'esc' and ':' keys, then enter the command and press 'ENTER'. The user can place some 'ex' commands in the 'vi' startup file '~/.exrc. The 'vi' reads this file at the beginning of editing session.

One of the most common versions of 'vi' found in most of the GNU/Linux systems is 'vim' editor. It stands for 'vi' Improved. In some Linux distributions, 'vim' is the default editor! When ever user presses 'vi', 'vim' would be invoked! 'vim' offers many extra features and optionally changes some of the basic 'vi' features.

Modes:

The 'vi' editor operates in two modes.
1.Command mode.
2.Insert mode.
The dual mode makes the 'vi' an attractive editor for the users who separate text entry from editing.

1.Command mode:
The default mode when the file is opened is command mode. Command mode is used to perform certain actions on the opened file. These actions are as follows:
1. Invoke 'Insert mode'.
2. Issue editing commands.
3. Move the cursor to different position in the file.
4. Invoke 'ex' commands.
5. Invoke Unix shell commands.
6. Save the file.
7. Exit from 'vi'.
There are a number of commands to perform above mentioned actions. These commands will be introduced in the later stage.

2.Insert mode:
The insert mode is used to enter textual data to the file. The user can enter 'insert mode' by pressing 'i' in the 'command mode' and exit by pressing 'esc' key. There are a number of other commands to enter 'insert mode'. These will be presented in the later blogs. Insert mode has certain commands to perform operations. Even these commands will be presented later in the blog.


Command Line Syntax:

There are 3 different ways to start a 'vi' session. They are
1.vi [options] file: Open a file for editing.
2.vi [options] +num file: Open a file for editing at line “num” or the last line of the file if “num” is omitted.
3.vi [options] +/pattern file: Open a file for editing at the first matching pattern “pattern”.


Command-Line Options:


The following options are same for vi and ex editors.
-c : Run the given 'ex' command upon startup. Only one '-c' option could be used in 'vi' where as 'vim' accepts upto 10 commands. The older form of this is '+command'.
-d : Run 'vi' in diff mode, like 'vimdiff'. Showing difference between 2 files.
-e: Run as 'ex'. Opening in line editing mode rather than full screen or visual mode.
-l: Enter Lisp mode for running Lisp options. It is not supported in all the versions.
-L: List all the files which were saved due to an aborted editor session or due to system crash. This option is not supported in all the versions. In 'vim', this option is same as '-r'.
-r : Resume editing or recover a file after an aborted editor session or system crash. Open file in 'Recovery Mode'. Without , it lists all the files available for recovery.
-R: Open files is Read-only mode. The user can't edit the file. Even if he edits he can't save the changes. This option could be used by the user if he doesn't want to make any changes to the file by mistake.
-s: Open the file in “Silent” mode. Or in other words, open the file without displaying prompts. This is useful while running a script. For 'vim', this option applies only if it is used with '-e' option.
-t : Open the file containing the and place the cursor at that position. The user should have run 'ctags' before using this option.
-v: Run 'vi' in full screen mode. This is default option and user need not have to specify it explicitly.
-w : Set the window size so that lines at a time are displayed. 'vim' does not support this option. Even in systems where 'vim' is made default, this option does not work.
-x: This option is not supported in all the versions. This option makes the 'vi' to prompt for a key to encrypt the file using 'crypt' command.

The 'vim' supports all the above options(except '-w'). It also supports many more additional options which are not supported by normal 'vi'. Those options are explained in coming post.


Exiting from 'vi':
There are 2 ways to exit from vi. They are:
1.:x - Exit 'vi' by saving all the changes.
2.:q! - Exit 'vi' without saving any changes.


Status line commands:


The vi has a status line at the bottom of the screen. This screen echoes some of the vi commands. But most of the commands are not echoed on the screen. The commands which are echoed on the status bar are:
“/” : Search forward for a pattern.
“?” : Search backward for a pattern.
“:” : Invoke an ex command.
“!” : Invoke a Unix command.

Friday, August 14, 2009

Options: Episode-6

--encoding

By default Subversion uses the operating systems encoding format for encoding. If the user wants to change to some other charset, then he can use this option to specify that.


--file


Uses the contents of the file specified for the subcommand. “-F” is the short form of the option. Different subcommands do different thing with this file.
E.g.: “svn commit” command uses the contents in the file for the log message while “svn propset” uses this as a property value.

--force-log

Forces a suspicious parameter passed to the “--message (-m)” or “--file (-F)” option
to be accepted as valid. By default, Subversion will produce an error if parameters to
these options look like they might instead be targets of the subcommand. For example,
if you pass a versioned file's path to the “--file (-F)” option, Subversion will assume
you've made a mistake, that the path was instead intended as the target of the opera-
tion, and that you simply failed to provide some other—unversioned—file as the source
of your log message. To assert your intent and override these types of errors, pass the
--force-log option to subcommands that accept log messages.

--message

This option could be used by the user to specify either a log message(while committing) or a lock comment(while locking a copy) in the command line. The catch using this option is that you can't write multiline comments!!

--editor-cmd

This specifies an external editor to use to edit a log message or a property value. If this option is not specified then Subversion will look for the following in order:
1.“SVN_EDITOR” environment variable.
2.“editor-cmd” runtime configuration option.
3.“VISUAL” environmental variable.
4.“EDITOR” environmental variable.

If none of this is successful, then it throws an error message. Alternatively the user can use “--message” or “--file” option to achieve the same goal.

--force

Subversion will prevent the user from performing certain operations or to execute some commands when it thinks that the result may be nasty! If the user is aware of the result, and still wants to go ahead with performing the operation, then “--force” option could be used. This option force a particular operation or command to run.

--new , --old

These options could be used by the user to specify a new or old target for the svn diff command.


--no-diff-deleted

If the user deletes a file, then Subversion by default would print the same differences that the user would see if the file exists and all its contents have been deleted. If the user does not want this kind of behavior, then he could use this option. This option prevents the Subversion from printing the differences of the deleted file.

--notice-ancestry


By default, “svn diff” ignores the ancestry(revision history) of the files being compared and merely compares their contents. i.e., If the contents of the file is deleted in some revision and later added in another revision, then if the user compares the files using “svn diff” then it does not show any difference. If “--notice-ancestry” option is added, then svn takes the revision history(or ancestry) into consideration while performing diff. So the user will see the differences as the contents being removed and added later again.

--verbose

This option could be used by the user to request the Subversion to print out as much information as possible while running a subcommand. This results in Subversion printing out additional fields, detailed information about every file or regarding every action. “-v” is the short form of this option.

--incremental

This option is used to print output in a format suitable for concatenation. When used with “svnadmin” this instructs the Subversion to dump a revision only as a difference against the previous revision, instead of a full text.

--stop-on-copy

If a user is traversing the history of a versioned resource, and he wants the to stop at a point where the resource was copied to that location from another location in the repository, then he could use this option. This option makes the Subversion to stop at a point where the resource was copied from another location in the repository.

--xml

This option is used to print output in the XML format.

--dry-run

This option is used when the user wants to see the results of the subcommand he is going to run without any modifications to the repository or the sand-box. This makes Subversion to go through through all the motions of a subcommand without making any actual change to repository or the working copy.