Posts

Showing posts from December, 2009

Running JAVA program in Linux Ubuntu

The tutorial bellow explains simple procedure to compile, interpret, and execute Java program in Ubuntu using JDK sofware. Steps to run Java program in Ubuntu: 1. Go to Applications > Accessories > Terminal, to open terminal window. 2. Type the following in command line gedit Add.java 3. Enter the code bellow in the editor. /* Addition of two numbers – Add.java */ import java.io.*; class Add { public static void main(String args[]) { InputStreamReader ISR = new InputStreamReader(System.in); BufferedReader BR = new BufferedReader(ISR); int a = 0, b = 0; try { System.out.print("Enter the first number: "); a = Integer.parseInt(BR.readLine()); System.out.print("Enter the second number: "); b = Integer.parseInt(BR.readLine()); } catch(Exception e) { System.out.println("Check the program."); } System.out.println("Addition of " + a + " + " + b + " is " + (a+b)...

Linux wvdial.conf script for Vodafone IN

[Modem0] Modem = /dev/rfcomm0 Baud = 115200 SetVolume = 0 Dial Command = ATDT Init1 = ATZ Init3 = ATM0 FlowControl = CRTSCTS [Dialer  vodafone ] Username = " vodafone " Password = " vodafone " Phone =  *99# Stupid Mode = 1 Init1 = ATZ Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 Init3 = AT+CGDCONT=1," 10.10.1.100:9401 "," portalnmms ","",0,0 Inherits = Modem0 [Dialer three] Username = " none " Password = " none " Phone =  *99# Stupid Mode = 1 Init1 = ATZ Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 Init3 = AT+CGDCONT=1," 10.10.1.100:9401 "," portalnmms ","",0,0 Inherits = Modem0

Two methods to run PHP script

This article explains different methods to write PHP scripts. Basically PHP is a HTML, without using PHP script in it. A PHP script can be inserted between <?php and ?> tags. General contents can be simply displayed using HTML web page to reduce PHP server script runtime duration. HTML and PHP HTML: add.html <html> <head> <title>Addition of Two Numbers</title> </head> <body> <form action="add.php" method="post"> Enter the first number: <input type="text" name="a"><br/> Enter the second number: <input type="text" name="b"><br/> <input type="submit" name="submit" value="ADD"> </form> </body> </html> PHP: add.php <html> <head> <title>Addition of Two Numbers</title> </hea...

Running C or C++ program in Linux

The tutorial bellow explains simple procedure to compile, run, and execute C or C++ (CPP) programs in Ubuntu using build-in G++ compiler. Steps to run C program in Ubuntu: 1. Go to Applications > Accessories > Terminal, to open terminal window. 2. Type the following in command line sudo gedit first.c 3. Enter the code bellow in the editor. /* Program first.c */ #include<stdio.h> main() { printf(”Hello World.\n”); } 4. Save the file and close to return to terminal window. 5. Firstly compile the code using the following command cc -c first.c That would produce an object file you may need to add to the library. 6. Then create an executable using the following command cc -o first first.c 7. Now run this executable using the following command ./first 8. Output should show as follows Hello World. Steps to run C++ program in Ubuntu: 1. Go to Applications > Accessories > Terminal, to open terminal window. 2. Type the following in command line s...

Addition using Perl/CGI in Ubuntu

Image
If Apache web server has installed in your system, you can run Perl/CGI script successfully. Create a HTML file and Perl script using following steps. Step 1: Creating a web page add.html 1. Open your console and type: $ sudo gedit /var/www/add.html 2. Copy the lines below in the file and save it. <html> <head> <title>Addition of two numbers.</title> </head> <body> <br><br><br><br><br> <form action='cgi-bin/add.pl' method='post' enctype='multipart/form_data'> <table border='0' align='center'> <tr><td colspan='2' align='center'> <b>Adding Two Numbers</b> </td></tr> <tr> <td>Enter the first value:</td> <td><INPUT TYPE ='text' NAME='n1'></td> </tr> <tr> ...