Wednesday, August 8, 2012

Learn Basics of Linux

1. What is Linux?

Linux is a free Unix-type operating system for computer devices. The operating system is what makes the hardware work together with the software. The OS is the interface that allows you to do the things you want with your computer. Linux is freely available to everyone. OS X and Windows are other widely used OS.

Linux gives you a graphical interface that makes it easy to use your computer, yet it still allows those with know-how to change settings by adjusting 0 to 1.
It is only the kernel that is named Linux, the rest of the OS are GNU tools. A package with the kernel and the needed tools make up a Linux distribution. Mandrake , SUSE Linux, Gentoo and Redhat are some of the many variants. GNU/Linux OS can be used on a large number of boxes, including i386+ , Alpha, PowerPC and Sparc.

2. Understanding files and folders

Linux is made with one thought in mind: Everything is a file.
A blank piece of paper is called a file in the world of computers. You can use this piece of paper to write a text or make a drawing. Your text or drawing is called information. A computer file is another way of storing your information.
If you make many drawings then you will eventually want to sort them in different piles or make some other system that allows you to easily locate a given drawing. Computers use folders to sort your files in a hieratic system.
A file is an element of data storage in a file system (file systems manual page). Files are usually stored on harddrives, cdroms and other media, but may also be information stored in RAM or links to devices.
To organize our files into a system we use folders. The lowest possible folder is root / where you will find the user homes called /home/.
Behind every configurable option there is a simple human-readable text file you can hand-edit to suit your needs. These days most programs come with nice GUI (graphical user interface) like Mandrakes Control Center and Suses YAST that can smoothly guide you through most configuration. Those who choose can gain full control of their system by manually adjusting the configuration files from foo=yes to foo=no in an editor.
Almost everything you do on a computer involves one or more files stored locally or on a network.
Your filesystems lowest folder root / contains the following folders:
/bin Essential user command binaries (for use by all users)
/boot Static files of the boot loader, only used at system startup
/dev Device files, links to your hardware devices like /dev/sound, /dev/input/js0 (joystick)
/etc Host-specific system configuration
/home User home directories. This is where you save your personal files
/lib Essential shared libraries and kernel modules
/mnt Mount point for a temporarily mounted filesystem like /mnt/cdrom
/opt Add-on application software packages
/usr /usr is the second major section of the filesystem. /usr is shareable, read-only data. That means that /usr should be shareable between various FHS-compliant hosts and must not be written to. Any information that is host-specific or varies with time is stored elsewhere.
/var /var contains variable data files. This includes spool directories and files, administrative and logging data, and transient and temporary files.
/proc System information stored in memory mirrored as files.
The only folder a normal user needs to use is /home/you/ - this is where you will be keeping all your documents.
Files are case sensitive, "myfile" and "MyFile" are two different files.
For more details, check out:

3. Understanding users and permissions

Linux is based on the idea that everyone using a system has their own username and password.
Every file belongs to a user and a group, and has a set of given attributes (read, write and executable) for users, groups and all (everybody).
A file or folder can have permissions that only allows the user it belongs to to read and write to it, allowing the group it belongs to to read it and at the same time all other users can't even read the file.

4. Who and what is root

Linux has one special user called root (this is the user name). Root is the "system administrator" and has access to all files and folders. This special user has the right to do anything.
You should never log on as this user unless you actually need to do something that requires it!
Use su - to temporary become root and do the things you need, again: never log into your sytem as root!
Root is only for system maintenance, this is not a regular user (LindowsOS don't have any user management at all and uses root for everything, this is a very bad idea!).
You can execute a command as root with:
su -c 'command done as root'
Gentoo Linux: Note that on Gentoo Linux only users that are member of the wheel group are allowed to su to root.

5. Opening a command shell / terminal

To learn Linux, you need to learn the shell command line in a terminal emulator.
In KDE: K -> System -> Konsoll to get a command shell)
Pressing CTRL-ALT-F1 to CTRL-ALT-F6 gives you the console command shell windows, while CTRL-ALT-F7 gives you XFree86 (the graphical interface).
xterm (manual page) is the standard XFree console installed on all boxes, run it with xterm (press ALT F2 in KDE and Gnome to run commands).
Terminals you probably have installed:
Non-standard terminals should install:

6. Your first Linux commands

Now you should have managed to open a terminal shell and are ready to try your first Linux commands. Simply ask the computer to do the tasks you want it to using it's language and press the enter key (the big one with an arrow). You can add a & after the command to make it run in the background (your terminal will be available while the job is done). It can be practical to do things like moving big divx movies as a background process: cp movie.avi /pub &

6.1. ls - short for list

ls lists the files in the current working folder. This is probably the first command to try out.
ls -al --color=yes

6.2. pwd - print name of current/working directory

pwd prints the fully resolved name of the current (working) directory.

6.3. cd - Change directory

cd stands for change (working) directory and that's what it does. The folder below you (unless you are in /, where there is no lower directory) is called "..".
To go one folder down:
cd ..
Change into the folder Documents in your current working directory:
cd Documents
Change into a folder somewhere else:
cd /pub/video
The / in front of pub means that the folder pub is located in the / (lowest folder).

7. The basic commands

7.1. chmod - Make a file executable

To make a file executable and runnable by any user:
chmod a+x myfile

7.2. df - view filesystem disk space usage

df -h
  Filesystem Size  Used Avail Use% Mounted on
  /dev/hda3   73G   67G  2.2G  97% /
  tmpfs      2.0M   24K  2.0M   2% /mnt/.init.d
  tmpfs      252M     0  252M   0% /dev/shm
The flags: -h, --human-readable Appends a size letter such as M for megabytes to each size.

7.3. du - View the space used by files and folders

Use du (Disk Usage) to view how much space files and folders occupy.
Example du usage:
  du -sh Documents/
  409M    Documents

7.4. mkdir - makes folders

Folders are created with the command mkdir:
mkdir folder
To make a long path, use mkdir -p :
mkdir -p /use/one/command/to/make/a/long/path/
Like most programs mkdir supports -v (verbose). Practical when used in scripts.
You can make multiple folders in bash and other shells with {folder1,folder2} :
mkdir /usr/local/src/bash/{old,new,dist,bugs}
The command rmdir removes folders.

7.5. passwd - changes your login password

To change your password in Linux, type:
The root user can change the password of any user by running passwd with the user name as argument:
passwd jonny
will change jonnys password. Running passwd without arguments as root changes the root password.
If you need to add several new users and give them password you can use a handy program like Another Password Generator to generate a large set of "random" passwords.

7.5.1. KDE

From KDE you can change your password by going:
  • K -> Settings -> Change Password
  • K -> Settings -> Control Center -> System Administration -> User Account

7.6. rm - delete files and folders, short for remove

Files are deleted with the command rm:
  rm /home/you/youfile.txt
To delete folders, use rm together with -f (Do not prompt for confirmation) and -r (Recursively remove directory trees):
  rm -rf /home/you/foo/
Like most programs rm supports -v (verbose).

7.7. ln - make symbolic links

A symbolic link is a "file" pointing to another file.
To make a symbolic link :
  ln /original/file /new/link
This makes /original/file and /new/link the same file - edit one and the other will change. The file will not be gone until both /original/file and /new/link are deleted.
You can only do this with files. For folders, you must make a "soft" link.
To make a soft symbolic link :
  ln -s /original/file /new/link
  ln -s /usr/src/linux-2.4.20 /usr/src/linux
Note that -s makes an "empty" file pointing to the original file/folder. So if you delete the folder a symlink points to, you will be stuck with a dead symlink (just rm it).

7.8. tar archiving utility - tar.bz2 and tar.gz

tar is a very handle little program to store files and folders in archives, originally made for tapestreamer backups. Tar is usually used together with gzip or bzip2, comprepssion programs that make your .tar archive a much smaller .tar.gz or .tar.bz2 archive.
You can use the program ark (K -> Utilities -> Ark) to handle archives in KDE. Konqueror treats file archives like normal folders, simply click on the archive to open it. The archive becomes a virtual folder that can be used to open, add or remove files just as if you were working with a normal folder.

7.8.1. tar files (.tar.gz)

To untar files:
  tar xvzf file.tar.gz
To tar files:
  tar cvzf file.tar.gz filedir1 filedir2 filedir2...
Note: A .tgz file is the same as a .tar.gz file. Both are also often refered to as tarballs.
The flags: z is for gzip, v is for verbose, c is for create, x is for extract, f is for file (default is to use a tape device).

7.8.2. bzip2 files (.tar.bz2)

To unpack files:
  tar xjvf file.tar.bz2
To pack files:
  tar cvjf file.tar.bz2 filedir1 filedir2 filedir2...
The flags: Same as above, but with j for for bzip2
You can also use bunzip2 file.tar.bz2 , will turn it into a tar.
For older versions of tar, try tar -xjvf or -xYvf or -xkvf to unpack.There's a few other options it could be, they couldn't decide which switch to use for bzip2 for a while.
How to untar an entire directory full or archives?
for i in `ls *.tar`; do tar xvf $i; done
.tar.gz: for i in `ls *.tar.gz`; do tar xvfz $i; done
.tar.bz2: for i in `ls *.tar.bz2`; do tar xvfj $i; done

Monday, August 6, 2012

Install NS2 ( Network Simulator ) on Ubuntu

Following are the simple steps to install ns2 on Ubuntu 9+ through launchpad ppa.
1> Firstly remove all ns-allinone-2.3x directory (if you put it anywhere to install ns2) and revert back all the path changes you made in ~/.bashrc related to ns2.

2> Now export the Wouter HorrĂ©'s ppa repository key by typing the following command on terminal and enter:
sudo apt-key adv --keyserver --recv-keys B3F3334F

3> Now add the following ppa repository to source list.
deb karmic main
deb-src karmic main
Reload repository information when prompted by "The information about available software is out-of-date"notification or reload it manually by following command on terminal:
sudo apt-get update
4> Now type the following command on terminal to install ns from the launchpad ppa repository:
sudo apt-get install ns nam xgraph
That's all. 

Type ns to check:
you should see % at the command prompt (indicating successful installation)
Type exit if you get stuck with the %

Now Try to run any example tcl file [You can get it here]
To run a tcl file type the following command:
ns example-tcl-file.tcl

Tuesday, June 19, 2012

Ten CSS tricks

1. CSS font shorthand rule

When styling fonts with CSS you may be doing this:
font-weight: bold;
font-style: italic;
font-variant: small-caps;
font-size: 1em;
line-height: 1.5em;
font-family: verdana,sans-serif
There's no need though as you can use this CSS shorthand property:
font: bold italic small-caps 1em/1.5em verdana,sans-serif
Much better! Just a few of words of warning: This CSS shorthand version will only work if you're specifying both the font-size and the font-family. The font-family command must always be at the very end of this shorthand command, and font-size must come directly before this. Also, if you don't specify the font-weightfont-style, or font-variant then these values will automatically default to a value of normal, so do bear this in mind too.

2. Two classes together

Usually attributes are assigned just one class, but this doesn't mean that that's all you're allowed. In reality, you can assign as many classes as you like! For example:
<p class="text side">...</p>
Using these two classes together (separated by a space, not with a comma) means that the paragraph calls up the rules assigned to both text and side. If any rules overlap between the two classes then the class which is below the other in the CSS document will take precedence.

3. CSS border default value

When writing a border rule you'll usually specify the colour, width and style (in any order). For example, border: 3px solid #000 will give you a black solid border, 3px thick. However the only required value here is the border style.
If you were to write just border: solid then the defaults for that border will be used. But what defaults? Well, the default width for a border is medium (equivalent to about 3 to 4px) and the default colour is that of the text colour within that border. If either of these are what you want for the border then you can leave them out of the CSS rule!

4. CSS document for printing

Lots of web pages have a link to a print-friendly version. What many of them don't realise is that there's no need because you can set up a second CSS document to be called up when a user prints the page.
So, your page header should contains links to two CSS documents, one for the screen, and one for printing:
<link type="text/css" rel="stylesheet" href="stylesheet.css" media="screen" />
<link type="text/css" rel="stylesheet" href="printstyle.css" media="print" />
The first line of code calls up the CSS for the screen (notice the inclusion of media="screen") and the second line calls up the CSS for the printable version (using media="print").
So, what commands should you put in this second CSS document? To work it out, open a blank document and save it as printstyle.css. Next, point the screen CSS command to this document so that the command reads: <link type="text/css" rel="stylesheet"href="printstyle.css" media="screen" />.
Now just keep entering CSS commands until the display on the screen matches how you want the printed version to look. You'll certainly want to make use of the display: none command for navigation, decorative images and non-essential items. For more advice on this, read Print Different, which also mentions the other media for which you can specify CSS files.

5. Image replacement technique

It's always advisable to use regular HTML markup to display text, as opposed to an image. Doing so allows for a faster download speed and has accessibility benefits. However, if you've absolutely got your heart set on using a certain font and your site visitors are unlikely to have that font on their computers, then really you've got no choice but to use an image.
Say for example, you wanted the top heading of each page to be ‘Buy widgets’, as you're a widget seller and you'd like to be found for this phrase in the search engines. You're pretty set on it being an obscure font so you need to use an image:
<h1><img src="widget-image.gif" alt="Buy widgets" /></h1>
This is OK but there's strong evidence to suggest that search engines don't assign as much importance to alt text as they do real text (because so many webmasters use the alt text to cram in keywords). So, an alternative would be:
<h1>Buy widgets</h1>
Now, this obviously won't use your obscure font. To fix this problem place these commands in yourCSS document:
background: url(widget-image.gif) no-repeat;
height: image height
text-indent: -2000px
Be sure to change "image height" to whatever the height of the image is (e.g. 85px)! The image, with your fancy font, will now display and the regular text will be safely out of the way, positioned 2000px to the left of the screen thanks to our CSS rule. Please note, this can cause accessibility issues as any user with images turned off won't be able to see the text.

6. CSS box model hack alternative

The box model hack is used to fix a rendering problem in pre-IE 6 browsers on PC, where by the border and padding are included in the width of an element, as opposed to added on. For example, when specifying the dimensions of a container you might use the following CSS rule:
width: 100px;
border: 5px;
padding: 20px
This CSS rule would be applied to:
<div id="box">...</div>
This means that the total width of the box is 150px (100px width + two 5px borders + two 20px paddings) in all browsers except pre-IE 6 versions on PC. In these browsers the total width would be just 100px, with the padding and border widths being incorporated into this width. The box model hack can be used to fix this, but this can get really messy.
A simple alternative is to use this CSS:
width: 150px

#box div
border: 5px;
padding: 20px
And the new HTML would be:
<div id="box"><div>...</div></div>
Perfect! Now the box width will always be 150px, regardless of the browser!

7. Centre aligning a block element

Say you wanted to have a fixed width layout website, and the content floated in the middle of the screen. You can use the following CSS command:
width: 700px;
margin: 0 auto
You would then enclose <div id="content"> around every item in the body of the HTMLdocument and it'll be given an automatic margin on both its left and right, ensuring that it's always placed in the centre of the screen. Simple... well not quite - we've still got the pre-IE 6 versions onPC to worry about, as these browsers won't centre align the element with this CSS command. You'll have to change the CSS rules:
text-align: center

text-align: left;
width: 700px;
margin: 0 auto
This will then centre align the main content, but it'll also centre align the text! To offset the second, probably undesired, effect we inserted text-align: left into the content div.

8. Vertically aligning with CSS

Vertically aligning with tables was a doddle. To make cell content line up in the middle of a cell you would use vertical-align: middle. This doesn't really work with a CSS layout. Say you have a navigation menu item whose height is assigned 2em and you insert this vertical align command into the CSS rule. It basically won't make a difference and the text will be pushed to the top of the box.
Hmmm... not the desired effect. The solution? Specify the line height to be the same as the height of the box itself in the CSS. In this instance, the box is 2em high, so we would insert line-height: 2em into the CSS rule and the text now floats in the middle of the box - perfect!

9. CSS positioning within a container

One of the best things about CSS is that you can position an object absolutely anywhere you want in the document. It's also possible (and often desirable) to position objects within a container. It's simple to do too. Simply assign the following CSS rule to the container:
position: relative
Now any element within this container will be positioned relative to it. Say you had this HTMLstructure:
<div id="container"><div id="navigation">...</div></div>
To position the navigation exactly 30px from the left and 5px from the top of the container box, you could use these CSS commands:
position: absolute;
left: 30px;
top: 5px
Perfect! In this particular example, you could of course also use margin: 5px 0 0 30px, but there are some cases where it's preferable to use positioning.

10. Background colour running to the screen bottom

One of the disadvantages of CSS is its inability to be controlled vertically, causing one particular problem which a table layout doesn't suffer from. Say you have a column running down the left side of the page, which contains site navigation. The page has a white background, but you want thisleft column to have a blue background. Simple, you assign it the appropriate CSS rule:
background: blue;
width: 150px
Just one problem though: Because the navigation items don't continue all the way to the bottom of the screen, neither does the background colour. The blue background colour is being cut off half way down the page, ruining your great design. What can you do!?
Unfortunately one of the only solutions to this is to cheat, and assign the body a background image of exactly the same colour and width as the left column. You would use this CSS command:
background: url(blue-image.gif) 0 0 repeat-y
This image that you place in the background should be exactly 150px wide and the same blue colour as the background of the left column. The disadvantage of using this method is that you can't express the left column in terms of em, as if the user resizes text and the column expands, it's background colour won't.
Using this method the left column will have to be expressed in px if you want it to have a different background colour to the rest of the page.

Saturday, May 26, 2012

Secrets behind Top Company Names

This came from name of the river Adobe Creek that ran behind the house of founder John Warnock..

It was the favorite fruit of founder Steve Jobs. He was three months late in filing a name for the business, and he threatened to call his company Apple Computers if the other colleagues didn't suggest a better name by 5 O'clock that evening..

It is not an acronym as popularly believed. It is short for San Francisco..

This name was formed by using COMp, for computer, and PAQ to denote a small integral object..

The name was derived from the founder's name Dr. Michael Cowpland. It stands for COwpland REsearch Laboratory..

The name started as a joke boasting about the amount of information the search-engine would be able to search. It was originally named 'Googol', a word for the number represented by 1 followed by 100 zeros. After founders- Stanford graduate students Sergey Brin and Larry Page presented their project to an angel investor, they received a cheque made out to 'Google' ...thus the name..

Founder Jack Smith got the idea of accessing e-mail via the web from a computer anywhere in the world. When Sabeer Bhatia came up with the business plan for the mail service, he tried all kinds of names ending in 'mail' and finally settled for hotmail as it included the letters "html" - the programming language used to write web pages. It was initially referred to as HoTMaiL with selective uppercasing.. 

Bill Hewlett and Dave Packard tossed a coin to decide whether the company they founded would be called  Hewlett-Packard or Packard-Hewlett..

Bob Noyce and Gordon Moore wanted to name their new company 'Moore Noyce'but that was already trademarked by a hotel chain so they had to settle for an acronym of INTegrated ELectronics..

-LOTUS (Notes)-
Mitch Kapoor got the name for his company from 'The Lotus Position' or 'Padmasana'. Kapoor used to be a teacher of Transcendental Meditation of Maharishi Mahesh Yogi..

Coined by Bill Gates to represent the company that was devoted to MICROcomputer SOFTware. Originally  christened Micro-Soft, the '-' was removed later on..

Founder Paul Galvin came up with this name when his company started manufacturing radios for cars. The popular radio company at the time was called Victrola.. 

Larry Ellison and Bob Oats were working on a consulting project for the CIA (Central Intelligence Agency). The code name for the project was called Oracle (the CIA saw this as the system to give answers to all questions or something such). The project was designed to help use the newly written SQL code by IBM. The project  eventually was terminated but Larry and Bob decided to finish what they started and bring it to the world. They kept the name Oracle and created the RDBMS engine. Later they kept the same name for the company..

It originated from the Latin word 'sonus' meaning sound, and 'sonny' a slang used by Americans to refer to a bright youngster..

Founded by four Stanford University buddies, SUN is the acronym for Stanford University Network. Andreas Bechtolsheim built a microcomputer; Vinod Khosla recruited him and Scott McNealy to manufacture computers based on it, and Bill Joy to develop a UNIX-based OS for the computer.. 

The word was invented by Jonathan Swift and used in his book 'Gulliver's Travels'. It represents a person who is repulsive in appearance and action and is barely human. Yahoo! Founders Jerry Yang and David Filo selected the name because they considered themselves yahoos..

Saturday, March 31, 2012

How To tie a Tie

A necktie (or tie) is a long piece of cloth worn for decorative purposes around the neck or shoulders, resting under the shirt collar and knotted at the throat. Variants include the ascot tie, bow tie, bolo tie, and the clip-on tie. The modern necktie, ascot, and bow tie are descended from the cravat. Neck ties are generally unsized, but may be available in a longer size. Men and boys wear neckties as part of regular office attire or formal wear. Neckties can also be worn as part of a uniform (e.g. military, school and waitstaff), whereas some choose to wear them as everyday clothing attire. Neckties are traditionally worn with the top shirt button fastened, and the tie knot resting comfortably between the collar points. However, it has become common in recent times for neckties to be worn as a casual item, tied loosely around the neck, nearly always with one or several buttons unfastened.

Originally worn for warmth by soldiers, the tie appeared in France during the reign of Louis XIII. At that time, Croatian soldiers were recruited by the king of France. They wore a knotted scarf around their necks. Some historians even think that the word for tie in French, cravate, is a deformation of the word croate.
Around 1650 ties were worn at the court of Louis XIV. There was competition to see who could sport the most elegant and audacious apparel by adding lace and silk ribbons. This fashion spread throughout Europe.
Worn by the rich and by dandies, the tie remained fashionable during the following century. It also underwent several changes.

A more functional tie developed during the second half of the 19th century due to the influence of the industrial revolution on textiles. A new tie appeared, longer and straighter. This new style of tie, named the REGATTA, was widely worn, and is the basic model of today’s tie.

In 1926, Jesse Langsdorf, a New York inventor, had the idea of cutting the form of the tie diagonally across the fabric and of making it with three separate pieces. This gave a more supple tie. Our modern tie was born.

Today, every day, school children in Nepal, businessmen in Manhattan, and hundreds of millions of men throughout the world wear ties.

Tie Knot Types:-

  1. Four-in-hand
  2. Double Knot
  3. Windsor Knot
  4. Half Windsor
  5. Small Knot
  6. Bow Tie

Friday, February 3, 2012

The Recycler Virus Solution

Symptoms: All files and folder are deleted / Hidden


1. Go to Start > Run > type cmd
2. Dos will open type cd\
3. Now type the drive letter in which you want to Unhide the files lets suppose in my case its E: this will open the E: drive
4. If you want to see all hidden files and folders   type E:\>dir/ah
5. Now type attrib *. -h -s /s /d

6. Now close cmd using exit command

Friday, January 13, 2012

Before You Vote, Find your Leaders Details

SMS :- MYNETA PINCODE     to 56070
Eg:  MYNETA 400050

CALL :- 1800110440

Know your leader before you vote for him/her.