Thursday, 4 April 2013

How to convert shell script into batch file

Quite a number of programmers learned scripting on a PC running DOS. Even the crippled DOS batch file language allowed writing some fairly powerful scripts and applications, though they often required extensive kludges and workarounds. Occasionally, the need still arises to convert an old DOS batch file to a UNIX shell script. This is generally not difficult, as DOS batch file operators are only a limited subset of the equivalent shell scripting ones.


Batch file keywords / variables / operators, and their shell equivalents

Batch File Operator Shell Script EquivalentMeaning
% $ command-line parameter prefix
/ - command-line parameter prefix
\ / directory path separator
== = (equal-to) string comparison test
!==! != (not equal-to) string comparison test
| | pipe
@ set +v do not echo current command
* * filename "wild card"
> > file redirection (overwrite)
>> >> file redirection (append)
< < redirect stdin
%VAR% $VAR environmental variable
REM # comment
NOT ! negate following test
NUL /dev/null "black hole" for burying command output
ECHO echo echo (many more option in Bash)
ECHO. echo echo blank line
ECHO OFF set +v do not echo command(s) following
FOR %%VAR IN (LIST) DO for var in [list]; do "for" loop
:LABEL none (unnecessary) label
GOTO none (use a function) jump to another location in the script
PAUSE sleep pause or wait an interval
CHOICE
case or select

menu choice
IF if if-test
IF EXIST FILENAME if [ -e filename ] test if file exists
IF !%N==! if [ -z "$N" ] if replaceable parameter "N" not present
CALL source or . (dot operator) "include" another script
COMMAND /C source or . (dot operator) "include" another script (same as CALL)
SET export set an environmental variable
SHIFT shift left shift command-line argument list
SGN -lt or -gt sign (of integer)
ERRORLEVEL $? exit status
CON stdin "console" (stdin)
PRN /dev/lp0 (generic) printer device
LPT1 /dev/lp0 first printer device
COM1 /dev/ttyS0 first serial port

Batch files usually contain DOS commands. These must be translated into their UNIX equivalents in order to convert a batch file into a shell script.


Hope this will help you.......
Enjoy :)
 

Saturday, 9 March 2013

Types of Network- LAN WAN MAN

Basically the networks are categorized on their design. The two most popular network design are "LAN" and "WAN".

Now a days offices and schools often have all their computers connected to each other. This is commonly known as Local Area Network or LAN.

 Wide Area Network or WAN, consists of computers that are connected over a wide geographic area, such as a city or a country. In this setup, information is transmitted via telephone lines or satellites.


Local Area Network (LAN) 

A LAN connects network devices over a relatively short distance. A networked office building, school, or home usually contains a single LAN, through sometimes one building will contain a few small LAN's and occasionally a LAN will span a group of nearby buildings.

Besides operating in limited space, LANs include several other distinctive features. LANs are typically owned, controlled and managed by a single person or organization. They also use certain specific connectivity technologies, primarily Ethernet and token ring.

Wide Area Network (WAN)

A Wide Area Network spans a large physical distance. A WAN like the Internet spans most of the world.  

A WAN is geographically dispersed collection of LANs. IN WAN mostly the LANs are connected with each other through a network device called as Router.  


WANs differ from LANs in several iportant ways. Like the internet, most WANs are not owned by one organization but rather exist under collective or disturbed ownership and Management.

Metropolitan Area Network

 A Metropolitan Area Network connects an area larger than a LAN but smaller than a WAN, such as a city, with dedicated or high performance hardware. 

MAN is one of number of types of networks. A MAN is relatively new class of network, it serves role similar to an Internet Service Providers(ISP), but for corporate users with large LANs.


There are three important features which distinguish MAN from LAN or WAN.

1. The network size falls intermediate between LAN and WAN. A MAN typically covers an area of between 5 and 50 kms diameter. Many MANs cover an area the size of a city, although in some cases MANs may be as small as a group of buildings or as large as Pune.

2. A MAN is not generally owned by a single organization. The equipments and communication links used in MAN are generally owned by either a consortium of users by a single network provider who sells the service to users. This level of service provided to each user must therefore be negotiated with the MAN operator and some performance guarantees are normally specified at the time.

3. A MAN ofter acts a high speed network to allow sharing of regional resources. It frequently used to provide a shared connection to other networks using a link to a WAN.


Wednesday, 6 March 2013

Satya 2, Official Trailor.


Satya 2.

Official first trailer of Ram Gopal Varma's Satya 2, sequel to his highly successful and critically acclaimed film Satya.

Watch the video:

Monday, 4 March 2013

How to install Java 7 in Ubuntu


Java is a programming language and computing platform first released by Sun Microsystems in 1995. It is the underlying technology that powers state-of-the-art programs including utilities, games, and business applications. Java runs on more than 850 million personal computers worldwide, and on billions of devices worldwide, including mobile and TV devices.





Ubuntu is Fast, secure and stylishly simple, the Ubuntu operating system is used by 20 million people worldwide every day.









Prepare your Ubuntu

First you need to remove previous openjdk  version from your system, for this run the following command from your terminal

sudo apt-get purge openjdk*

If you installed java 7 from any other PPA and you are having problem with java then you have to do following steps before installing the PPA menctioned here

sudo rm /var/lib/dpkg/info/oracle-java7-installer*
sudo apt-get purge oracle-java7-installer*
sudo rm /etc/apt/sources.list.d/*java*
sudo apt-get update


Install java 7 in ubuntu 12.04

Open the terminal and run the following commands

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer 



Enjoy Coding ....... :)
Plz share your comments .....

Sunday, 3 March 2013

Getting Started and Installing Java.

How to Download and Install Java.

Your Boss gives you a call at the last moment - as usual. You have 20 minutes to write a new web page that gives users an overview of your company's products. Knowing how well java works in such situations, you can choose java as your language of choice to get the task done.

Of course, you've got to make sure you have it before you can use it. So, its time to download and install java.

Click Here to download Java.
Follow the instructions:

1. Click on Agree and Download java button to download java.
2. The file download dialog appears, Click on the save button.
3. Double-Click on the file downloaded.

4. Confirm and proceed with the installation.
5. Few dialogs confirm the last steps of the installation process.

6.  Click Close on the last dialog.

This will complete Java installation process.

Please Note: You need to restart your browser to complete the java installation process.

To verify your machine can find java tools, including the java compiler itself, you need to make sure bin directory is in your computer's path.


In Windows follow the steps to set PATH in system variables in java:

1. Open the start menu and select Settings| Control Panel. Double click the System icon. 

2. In the System Properties dialog box, click the Advanced tab followed by the Environment Variables button.

3. Click the PATH variable.

4. Edit the PATH setting the way you want it. modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value.

To verify Whether java is successfully installed. 

1. To find out if the java executable is in your PATH, execute (In the command prompt)
:  
java -version


Hope you guys find this use full...(-: 


 

Tuesday, 26 February 2013

Apache2 + Passenger Installation for rails on Ubuntu

There are some steps to install and configure apache2 & phusion passenger

To install Apache web server and its documentation & utilities on Linux machine using following commands

sudo apt-get install apache2




To Check the installation, Open web browser and type localhost or 127.0.0.1
It will look like this.

If you are using rvm, goto appropriate ruby version using rvm use 1.9.2(i'm having ruby version 1.9.2) and install passenger gem


gem install passenger

To install apache2 module in passenger type

passenger-install-apache2-module



If all depandencies are fullfilled, it will install otherwise it will give list of command you have to install to run passanger.

Snapshot of asking for dependencies. There are following dependencies.