Month: January 2008

Asterisk md5secret password problem

Asterisk md5secret password problem

Introduction –

After upgrading the Asterisk-1.2 to new Asterisk version 1.4 … The md5secret password option in SIP configuration file was not working with new Asterisk 1.4 version…. We try to sort this problem… and finally we found the solution…..

1] Open Asterisk configuration file ‘ sip.conf ‘ and check your realm name –

[ cat sip.conf

port = 5060 ; Port to bind to (SIP is 5060)
bindaddr = ; Address to bind to (all addresses on machine)


;add sip_account.conf file configuration ;; note below line is not comment..
#include sip_account.conf

2] How to generate MD5 secret password for SIP account –

[ echo -n “” | md5sum
91f55d8bd74cad9e223c2d3a326f1367 –

3] The format for generating the MD5 secret password is ….

[ echo -n “sip_account_no:realm_name:password” | md5sum

sip_account_no = This is the SIP account name see below file
realm_name = This option is set in sip.conf file of asterisk with “realm” option
password = Password for your SIP account

4] Asterisk SIP account file (in my case ‘sip_account.conf’ )

[ head -n 13 sip_account.conf


callerid=Arun Bagul<4050>



Now restart or reload Asterisk server and try to login register account 4050 with secrete password “mypwd” .. The account will be registered successfully…

[ /etc/init.d/asterisk reload
Reloading Asterisk PBX configuration files.

Thank you,

Arun Bagul

A Glance into Ruby on Rails

A Glance into Ruby on Rails

Ruby is a pure object-oriented programming language with a super clean syntax that makes programming elegant and fun. Ruby successfully combines Smalltalk’s conceptual elegance, Python’s ease of use and learning, and Perl’s pragmatism. Ruby originated in Japan in the early 1990s, and has started to become popular worldwide in the past few years as more English language books and documentation have become available.
Rails is an open source Ruby framework for developing database-backed web applications. What’s special about that? There are dozens of frameworks out there and most of them have been around much longer than Rails. Why should you care about yet another framework?

Many things that are very simple to do in Ruby are not even possible in most other languages. Rails takes full advantage of this. The rest of the answer is in two of Rail’s guiding principles: less software and convention over configuration.

Ruby on Rails is a free web application framework. It aims to increase the speed and ease with which database-driven web sites can be created, and offers skeleton code frameworks (scaffolding) from the outset. Often shortened to Rails, or RoR, Ruby on Rails is an open source project written in the Ruby programming language, and applications using the Rails framework are developed using the Model-View-Controller design paradigm

You can find Installation HowTos from te following Link :-

Like many contemporary web frameworks, Rails uses the Model-View-Controller (MVC) architecture for organizing application programming.

Rails provides ‘out of the box’ scaffolding which can quickly construct most of the models and views needed for a basic website. Other helpful development tools come with or are installed with Rails, such as the WEBrick web server, and the Rake build system.

Rails is also noteworthy for its extensive use of the JavaScript libraries Prototype and for Ajax and its graphical interface.

For web services Rails initially supported lightweight SOAP; later it was replaced by RESTful web services. The recommended REST based programming structure changed drastically in version 1.2.

For Installation How Tos about RubyOnRails on RedHat :-

Installing Ruby, Gems and Rails On Debian


Debian Stable contains a prepackaged version of Ruby. In addition to installing Ruby, you also need to install the zlib compression libraries for Ruby, the Ruby Documentation program that generates documentation from ruby source files, and the command-line Ruby interface. Run the following command to install the needed packages:

aptitude install ruby libzlib-ruby rdoc irb

(You might prefer to use “apt-get install ruby libzlib-ruby rdoc irb” if you don’t use aptitude.)

If you want to test-drive Ruby from the command line you can run the irb program and execute Ruby commands:

# irb
rb(main):001:0> 3+5
=> 8
irb(main):002:0> 4*20
=> 80
irb(main):003:0> foo="bar"
=> "bar"
irb(main):004:0> foo.reverse
=> "rab"
irb(main):005:0> bar=40
=> 40
irb(main):006:0> bar.to_s.reverse
=> "04"
irb(main):007:0> exit


Now that you have Ruby installed you need to manually download the Gems package management software for Ruby. The latest version of Gems can be downloaded from the RubyForge web site.

From the command line, cd into the directory where you downloaded the Gems tarball and run the following command to extract the contents of the archive:

tar zxvf rubygems-0.8.11.tgz

Please note that the version number may be different if you downloaded a different version. You now need to cd into the newly created Gems directory and run the setup program for Gems:

cd rubygems-0.8.11
ruby setup.rb all

Notice how even the setup program for Gems is written in Ruby. These people take their language seriously.


Now that Gems is installed, you can finally install Rails. Run the following command to tell Gems to download and install the latest version of Rails:

gem install rails --include-dependencies

Congratulations, Ruby on Rails is now installed on your system.


While you can use many different web servers with Rails, we’re going to configure our installation with Apache. If you want to configure Rails with a different web server, a quick Google search will yield results on how to configure Rails with other web servers.

The following command will install Apache and the FastCGI libraries for both Apache and Ruby:

aptitude install apache libapache-mod-fastcgi libfcgi-ruby1.8

(Again, you may use apt-get if you wish: “apt-get install apache libapache-mod-fastcgi libfcgi-ruby1.8“.)

The Debian package manager will automatically update Apache’s configuration file to enable FastCGI and will start the web server. That’s all you need to configure in Apache for right now. We will revisit Apache later in the article when we’ve made more progress.

Now you need to create a place to store your Rails applications. While you can store your Rails applications anywhere you want, including your home directory if desired, I recommend storing them in /var/rails. Why /var? Because /var is where Apache on Debian stores its web site files (/var/www to be exact) and I like keeping similar files in the same directory.

The following commands will create the Rails application directory and set the proper permissions for their use by the web server:

mkdir /var/rails
chown -R www-data:www-data /var/rails


Ruby on Rails supports multiple databases. The following is a list of some of the packages that supply database drivers for Ruby:

  • libmysql-ruby
  • libpgsql-ruby
  • libsqlite3-ruby

For example, to install the Ruby drivers for PostreSQL, you would run the following command:

aptitude install libpgsql-ruby

If you want to verify that the drivers are properly installed, you can run the following set of commands:

# irb
irb(main):001:0> require 'postgres'
=> true
irb(main):002:0> exit

You can see that the driver loaded successfully and we were able to exit out of the Ruby interface.

RadRails: A Rails IDE

If you’re considering using Rails it’s probably because of the promises of a faster development cycle (that’s certain not a bad thing). To further speed up your development time you may consider using an IDE (integrated development environment) like RadRails. The RadRails IDE is based on the Eclipse project and has been customized specifically for Ruby on Rails development. If RadRails sounds like something you’d like to try, read on, otherwise, skip on down to the Creating a Rails Application section and fire up your favorite editor.


Because RadRails is written in Java, you need to install Java on your system. The latest version of Java can be downloaded from Sun’s website.

Once you’ve downloaded the self-extracted archive, run the following command to extract the archive’s contents:

bash jdk-1_5_0_06-linux-i586.bin

You now need to move the extracted directory into the /usr/local directory:

mv jdk1.5.0_06 /usr/local

In order to make the Java executables accessible from your path, you need to create symbolic links for all the Java programs. Fortunately, you can use the wildcard and your shell will automatically expand all the programs and create the links for you.

ln -s /usr/local/jdk1.5.0_06/bin/* /usr/local/bin/

To test that Java is installed on your system and accessible from the path, run the following command.

java -version

You should see a few lines telling you about the version of Java you just installed. If you get an error, please go back and make certain you followed the steps correctly.

An alternative approach is to create a Debian package, and use that to install your Java install. This has been covered here before.


You now need to download the RadRails archive from their website.

After the download is complete, change into the directory where you downloaded the archive to and execute the following command:


If unzip isn’t installed on your system you need to install the package:

aptitude install unzip

(Or “apt-get install unzip“.)

Once you’ve successfully extracted the contents of the archive, execute the following command to move RadRails into its destination directory:

mv radrails /usr/local

RadRails is now installed. You can run RadRails by executing the following command:


Note: Because RadRails is a Java program it doesn’t like being called from a symbolic link. If you create a symbolic link to a directory in your path and then try to run the program it will spit out errors and crash. I guess that’s the downside of write-once, run-anywhere.

Creating a Rails Application

Now you’re ready to create your first Rails application. All the Rails files that require editing can be opened in any editor (e.g. vi, emacs, etc.) or can be edited with RadRails. Use whichever program is most comfortable for you. However, I do not recommend using RadRails to edit non-Rails files (e.g. httpd.conf). Non-rails files should be edited with a normal editor.

Before you run any commands, change into the rails directory that you created earlier.

cd /var/rails

Now you can tell Rails to create a new application. Replace yourapp with the name of your application:

rails yourapp

Rails will now create a large number of files in /var/rails/yourapp that will make up your Rails application. Let’s start out by editing the .htaccess file in order to tell your application to use FastCGI instead of regular CGI.

Edit the file /var/rails/yourapp/public/.htaccess and make the following changes:

Comment out: RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
Insert: RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

Notice that the different between the two lines is the extension on the dispatch file. We’ve changed it so your application will use the FastCGI version.


Ruby on Rails has a built-in web server called WEBrick that you can use to test out your Rails applications. While WEBrick is good for testing, you wouldn’t want to use it in a production environment. For the real deal you will want to use a real web server like Apache or lighttpd.

To start WEBrick, run the following command:


Now you can fire up your web browser and load the following URL to access the web server:

Configuring Apache

You now have two different options for configuring Apache to use your Rails application. You can configure your application is a virtual host which will not effect the main web site, or you can make the rails application the main web site. If you want to test Rails on a web server that is already serving web sites then you will want to use the virtual host option. If your Rails application is the only thing being served by your web server then you can make it the main web site.

Virtual Host

Open up the /etc/apache/httpd.conf file and add the following configuration information at the end of the file:

<virtualhost *:80>
   ServerName yourapp
   DocumentRoot /var/rails/yourapp/public/
   ErrorLog /var/rails/yourapp/log/apache.log

   <directory /var/rails/yourapp/public>
      Options ExecCGI FollowSymLinks
      AddHandler cgi-script .cgi
      AllowOverride all
      Order allow,deny
      Allow from all

Save the file, exit from your editor and run the following command to restart Apache:

/etc/init.d/apache restart

You now need to edit your /etc/hosts file so the name you gave your server will resolve. Either add the following line to your hosts file or add yourapp to the end of the existing line: yourapp

Now open up your web browser and load the following address:

You should see a page welcoming you to Ruby on Rails!

Entire Web Server

Open up the /etc/apache/httpd.conf file and make the following change:

Comment out: DocumentRoot /var/www
Insert: DocumentRoot /var/rails/yourapp/public

You will also need to add the follow configuration to the end of the file:

<directory /var/rails/yourapp/public>
   Options ExecCGI FollowSymLinks
   AddHandler cgi-script .cgi
   AllowOverride all
   Order allow,deny
   Allow from all

Save the file, exit from your editor and run the following command to restart Apache:

/etc/init.d/apache restart

Now open up your web browser and load the following address:

You should see a page welcoming you to Ruby on Rails!

Developing your Application

This article isn’t going to cover how to write a Rails application. There are a million resources out there that can get you started developing with Rails. If you want some demonstrations of what can be done with Rails in less than half an hour, take a look at the ScreenCasts on the Ruby on Rails web site.

Ruby on Rails documentation, including web sites, books, and other resources, can also be found on the Ruby on Rails Documentation web page.

A Little about the Regular Expressions

A Little about the Regular Expressions

A regular expression (regex or regexp for short) is a special text string for describing a search pattern. You can think of regular expressions as wildcards on steroids. You are probably familiar with wildcard notations such as *.txt to find all text files in a file manager. The regex equivalent is .*\.txt$.

But you can do much more with regular expressions. In a text editor like EditPad Pro or a specialized text processing tool like PowerGREP, you could use the regular expression \b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b Analyze this regular expression with RegexBuddy to search for an email address. Any email address, to be exact. A very similar regular expression (replace the first \b with ^ and the last one with $) can be used by a programmer to check if the user entered a properly formatted email address. In just one line of code, whether that code is written in Perl, PHP, Java, a .NET language or a multitude of other languages.

If you are not a programmer, you use regular expressions in many situations just as well. They will make finding information a lot easier. You can use them in powerful search and replace operations to quickly make changes across large numbers of files. A simple example is gr[ae]y which will find both spellings of the word grey in one operation, instead of two. There are many text editors and search and replace tools with decent regex support.

If you’re hungry for more information on regular expressions after reading this website, there are a variety of books on the subject., the Internet’s first Regular Expression Library. They have indexed 1935 expressions from 1188 contributors around the world.

A large number of tools incorporate regular expressions as part of their functionality. Unix-oriented command line tools like grep, sed, and awk are mostly wrapper for regular expression processing. Many text editors allow search and/or replacement based on regular expressions. Many programming languages, especially scripting languages such as Perl, Python, and TCL, build regular expressions into the heart of the language. Even most command-line shells, such as Bash or the Windows-console allow restricted regular expressions as part of their command syntax.

There are a few variations in regular expression syntax between different tools that use them. Some tools add enhanced capabilities that are not available everywhere. In general, for the simplest cases, this tutorial will use examples based around grep or sed. For a few more exotic capabilities, Perl or Python examples will be chosen. For the most part, examples will work anywhere; but check the documentation on your own tool for syntax variations and capabilities.

A good tutorial on Regular expressions can be found on
The tutorial has been written by David Mertz (

A good amount of information and other tutorails on Regular Expressions can be found on (Recommended to visit, if you would like to have more information on Regular expressions).

And, the Internet’s first Regular Expression Library. A great Thanks to all the contributors, who have contributed to the library and helping all the people like us.

The Tcl programming Language

The Tcl programming Language

Tcl (Tool Command Language) is a very powerful but easy to learn dynamic programming language, suitable for a very wide range of uses, including web and desktop applications, networking, administration, testing and many more. Open source and business-friendly, Tcl is a mature yet evolving language that is truly cross platform, easily deployed and highly extensible.

Tk is a graphical user interface toolkit that takes developing desktop applications to a higher level than conventional approaches. Tk is the standard GUI not only for Tcl, but for many other dynamic languages, and can produce rich, native applications that run unchanged across Windows, Mac OS X, Linux and more.

Here in Library Systems at The University of Chicago Tcl is already in use :

* as a general-purpose scripting language to write Unix applications;
* to automate login scripts for telnet connections;
* as the programming language for the Reserve System.

In addition, a number of our Unix applications are written in Tcl (see below), and Tcl is the programming language of the University of Chicago BSDAC Phoenix Project.

The Tcl/Tk developer community now numbers in the tens of thousands and there are thousands of Tcl applications in existence or under development. The application areas for Tcl and Tk cover virtually the entire spectrum of graphical and engineering applications, including computer-aided design, software development, testing, instrument control, scientific visualization, and multimedia. […] Tcl and Tk are being used by hundreds of companies, large and small, as well as universities and research laboratories.[1]

It provides all the usual high-level programming features that we’ve come to expect from languages like the Unix shell, Awk, Perl, or Rexx, such as:

* Variable-length strings
* Associative arrays
* Lists
* Keyed lists (aka structs, structures or records)
* Pattern matching with regular expressions
* Ability to define or redefine procedures at run-time
* Full file access
* Error handling

Tcl is a small language designed to be embedded in other applications (C programs for example) as a configuration and extension language. This minimizes the number of languages that users need to learn in order to configure their applications, and makes these applications programmable with no extra effort. In addition, Tcl is a complete and well-designed programming language, whereas many existing configuration languages were designed (to be kind) in an ad hoc manner.

An instruction is the name of a command (not a keyword) followed by a list of words separated by a whitespace, the arguments.
Statements end with the end of the line. They may be separated by a semi-colon on a same line.
Square brackets replace an argument by a command. These are so a substitution symbols.
The = sign is never used, the “set” command assigns a value to a variable:

set varname value

The { } serve for grouping, without subsitution.

# introduces a comment.

Control structures

The if command use two groups { }, the first for the condition, the second for the actions.

if { x < 10 }
puts “x less than 10”
The while command has the same syntax.

The definition starts with the proc command, plus the name and two groups for the arguments and the statements.

proc procname { arguments }

More Information and Tutorials on the TCL programming language can be

found on the TCL/TK website

The Ruby Programming language

The Ruby Programming language

Ruby is a language of careful balance. Its creator, Yukihiro “matz” Matsumoto, blended parts of his favorite languages (Perl, Smalltalk, Eiffel, Ada, and Lisp) to form a new language that balanced functional programming with imperative programming.

Ruby is the interpreted scripting language for quick and easy object-oriented programming. It has many features to process text files and to do system management tasks (as in Perl). It is simple, straight-forward, extensible, and portable.

Oh, I need to mention, it’s totally free, which means not only free of charge, but also freedom to use, copy, modify, and distribute it.

Ruby runs on many platforms, including Linux and many flavors of UNIX, MS-DOS, Windows 9x/2000/NT, BeOS, and MacOS X.

Ruby’s primary focus is productivity of program development, and users will find that programming in Ruby is productive and even fun. Ruby is well suited for the problem domains such as these:

  • Text processing—Ruby’s File, String, and Regexp classes help you process text data quickly and cleanly.
  • CGI programming—Ruby has everything you need to do CGI programming, including text-handling classes, a CGI library, database interface, and even eRuby (embedded Ruby) and mod_ruby for Apache.
  • Network programming—Network programming can be fun with Ruby’s well-designed socket classes.
  • GUI programming—GUI tool kit interfaces such as Ruby/Tk and Ruby/Gtk are available.
  • XML programming—Text-handling features and the UTF-8-aware regular expression engine make XML programming handy in Ruby. The interface to the expat XML parser library is also available.
  • Prototyping—With its high productivity, Ruby is often used to make prototypes. Prototypes sometimes become production systems by replacing the bottlenecks with C written extensions.
  • Programming education—You can teach students that programming is fun

Unlike Perl, Ruby is a genuine object-oriented language; OOP features are not an add-on. Ruby uses less punctuation ($,@,%, and so on), less context dependency, and less implicit type conversion, so Ruby programs tend to be less cryptic.

For example, the following is used in Ruby to obtain length of a string and an array:

    a = "abc"
    a.length           # => 3
    a = [1,2,3]

    a.length           # => 3

Very simple. In Perl, however, things are far more complicated:

    $a = "abc";
    length($a);        # => 3, it's OK
    @a = (1,2,3);
    length(@a);        # => 1, not as expected
    scalar(@a);        # => 3, it's the Perl way to get array size
    $a = [1,2,3];      # reference to an anonymous array
    length($a);        # => 16, not as expected

    scalar(@$a);       # => 3, need dereference to get array size

You must always be aware of data types and context in Perl, and this can be a burden for programmers. Ruby frees you of this burden.

In Ruby, most of the Perl functions are organized into class libraries. Simple Ruby programs often look like reordered and simplified Perl programs. Take a look at some examples:

-- Ruby
print "hello world"
-- Perl
print "hello world";

-- Ruby
print"%a %b %e %H:%M:%S %Y\n")
-- Perl
use POSIX qw(strftime);
print strftime("%a %b %e %H:%M:%S %Y\n", localtime(time()));

-- Ruby
require 'socket'
print"localhost", "daytime").read

-- Perl
use IO::Socket;

$sock = IO::Socket::INET->new(PeerAddr => 'localhost:daytime');
print <$sock>;


Ruby is very much influenced by Perl—in fact, some users describe Ruby as “a better Perl than Perl.”

The Ruby language is supported by a rich built-in library. This first example uses the TCPServer class to open a server socket on port 9090 and waits for incoming connections. The goal is to be able to handle HTML GET requests like

The following Ruby code opens a server TCP socket, accepts incoming session requests, and writes each incoming request back to the user’s browser:

Listing 1
require 'socket' server ='', 9090) while (session = server.accept) request = session.gets puts request session.print "HTTP/1.1 200/OK\rContent-type: text/html\r\n\r\n" session.print "<html><head><title>Response from Ruby Web server</title></head>\r\n" session.print "<body>request was:" session.print request session.print "</body></html>" session.close end

The line “puts request” prints out incoming browser requests:

GET /foo?bar=123 HTTP/1.1
GET /favicon.ico HTTP/1.1

The second line printed because my browser (Safari on OS X) requested a “favorite icon” for this Web site. Fetching this response also would be simple without using a Web browser but instead using some simple Ruby TCP client code (here I use the “open-uri” library, which allows a remote resource identified by a URI to be accessed like a local file):

Listing 2
require 'open-uri' # allows the use of a file like API for URLs open("") { |file| lines = puts lines }

The output would be:

<html><head><title>Response from a very simple Ruby Web server</title></head>
<body>request was:GET /foo?bar=123 HTTP/1.1

While extending this simple Web server to return local HTML files, etc. would be trivial, it wouldn’t make much sense: the standard Ruby library contains the flexible WEBrick Web server toolkit. If you want to set up a full-featured Web site using pure Ruby, use WEBrick! Using the standard library, you can create a full service Web server with just a few lines of code (from the WEBrick documentation):

Listing 3
require 'webrick' include WEBrick s = => 9090, :DocumentRoot => Dir::pwd + "/htdocs") trap("INT"){ s.shutdown } s.start

Sometimes writing a simple Web server from scratch in Ruby is useful. Instead of returning HTML, a simple TCP socket server can return XML data.

One-click Ruby Installer :-

A self-contained installer that includes the Ruby language, dozens of popular extensions, a syntax-highlighting editor and the book “Programming Ruby: The Pragmatic Programmer’s Guide”. Platforms: Windows NT/2000/XP, (OS X in development).

Can be found from

You can even Try out Ruby code:

Give Ruby a shot right now!

Caller ID problem with Aserisk?

Caller ID problem with Aserisk?

Introduction –

Magnet has the expertise to build a VoIP based extensible EPABX system. The system runs on standard PC hardware and provides scalability and advance feature set at a fraction of cost of similar solutions. Please click here for more details…

We were facing Caller ID problem with Asterisk (PBX) since long time.. Finaly we got the solution!!…

Few days back we have upgraded our Asterisk version to latest Asterisk-1.4 version. There are few changes in Asterisk-1.4 and some functions are deprecated in 1.2, and removed innew Asterisk-1.4  version…

In old version we are using SetCallerID() function, which is removed in Asterisk-1.4. So we have used Set() and CALLERID() functions for Caller ID and it is working perfectly… We are very thankful to Nirav Sir, for helping us to resolve this issues. It was a good thing to learn the new ways of debugging…

Thank you,

Arun Bagul

How to swap data in two columns – MySQL

How to swap data in two columns – MySQL

Introduction – Few days back somebody ask me about “How to swap data in two columns?”. Before that I have never thought about such situation…

1] Login to MySQL Server and create Datatabase –

root@IndianGNU:/home/arun.bagul# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 137 to server version: 5.0.21-Debian_3ubuntu1-log

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql> show databases;
| Database |
| information_schema |
| mysql |
2 rows in set (0.04 sec)

mysql> create database arunbagul;
Query OK, 1 row affected (0.02 sec)

mysql> show databases;
| Database |
| information_schema |
| mysql |

| arunbagul |
3 rows in set (0.04 sec)

2 ] Now create Table in ‘arunbagul’ database –

mysql> use arunbagul;
Database changed

mysql> create table student ( id INT AUTO_INCREMENT NOT NULL PRIMARY KEY , name varchar(30), surname varchar(30) );
Query OK, 0 rows affected (0.03 sec)

mysql> show tables;
| Tables_in_arunbagul |
| student |
1 row in set (0.00 sec)


mysql> desc student;
| Field | Type | Null | Key | Default | Extra |
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar(30) | YES | | NULL | |
| surname | varchar(30) | YES | | NULL | |
3 rows in set (0.01 sec)


3 ] Now insert values in ‘student’ table –

mysql> INSERT INTO student VALUES (”,’Arun’ , ‘Bagul’);
Query OK, 1 row affected, 1 warning (0.03 sec)

mysql> INSERT INTO student VALUES (”,’Yogesh’ , ‘Nikam’);
Query OK, 1 row affected, 1 warning (0.00 sec)

mysql> INSERT INTO student VALUES (”,’Nishit’ , ‘Shah’);
Query OK, 1 row affected, 1 warning (0.00 sec)

mysql> INSERT INTO student VALUES (”,’Binish’ , ‘Philip’);
Query OK, 1 row affected, 1 warning (0.00 sec)

mysql> INSERT INTO student VALUES (”,’Deven’ , ‘Jadhav’);
Query OK, 1 row affected, 1 warning (0.00 sec)

mysql> select * from student;
| id | name | surname |
| 1 | Arun | Bagul |
| 2 | Yogesh | Nikam |
| 3 | Nishit | Shah |
| 4 | Binish | Philip |
| 5 | Deven | Jadhav |
5 rows in set (0.00 sec)


4 ] Swap data in two cloumns in ‘student’ table –

mysql> UPDATE student as tab1, student as tab2 set = tab1.surname, WHERE = AND =;
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4 Changed: 4 Warnings: 0

mysql> select * from student;

| id | name | surname |
| 1 | Bagul | Arun |
| 2 | Nikam | Yogesh |
| 3 | Shah | Nishit |
| 4 | Philip | Binish |
| 5 | Jadhav | Deven |
5 rows in set (0.00 sec)


Thank you,

Arun Bagul , Prasnna and Devendra

SSH to Run Command on a Remote Machine..

SSH to Run Command on a Remote Machine..

SSH provides wounder facility to run linux command on remote machine, provided that you have SSH access to that machine…

  • We can use this feature of SSH for troubleshooting purpose… for example suppose there is “logout” command in your “.bashrc” file of remote user. In this case you will not get ssh access until you remove this “logout” command from “.bashrc” file of remote user. This can be done remotely by using SSH..

1] I am login on machine ‘’ and trying to login to ‘’ ie ‘Remote’ machine.. but it immediately logout. see below…. ssh arun.bagul@
arun.bagul@’s password:
Last login: Sun Jan 20 18:49:29 2008 from
Connection to closed.

2] This is happening because there is ‘logout’ command added in ‘.bashrc’ file of arun.bagul‘s profile on ‘’

3] How to check this ‘.bashrc’ file on ‘’ – ssh arun.bagul@ ‘tail /home/arun.bagul/.bashrc’
arun.bagul@’s password:
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion


## ‘logout’ command which will terminate your session just after login.
#You will not get any access via SSH

4] How to remove this ‘logout’ command from remote file by ssh ssh arun.bagul@ ‘sed -i “s/logout/#welcome/g” /home/arun.bagul/.bashrc’
arun.bagul@’s password:

5] Check now – ssh arun.bagul@ ‘tail /home/arun.bagul/.bashrc’
arun.bagul@’s password:
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion


## ‘#welcome’ command which will terminate your session just after #login.
#You will not get any access via SSH

6] Now try to login on′ with user name ‘arun.bagul’ – ssh arun.bagul@
arun.bagul@’s password:
Last login: Sun Jan 20 18:39:15 2008 from

7] Other uses of ssh for running remote command – ssh arun.bagul@ ‘df -h’
arun.bagul@’s password:
Filesystem Size Used Avail Use% Mounted on
/dev/hda2 79G 26G 50G 34% /
varrun 1009M 108K 1009M 1% /var/run
varlock 1009M 8.0K 1009M 1% /var/lock
udev 1009M 104K 1009M 1% /dev
devshm 1009M 0 1009M 0% /dev/shm
/dev/hda5 56G 42G 11G 81% /backup
/dev/hda1 361M 27M 315M 8% /boot
/dev/hda6 9.2G 8.6G 180M 98% /var
** List mounted partion – ssh root@ ‘mount’
root@’s password:
/dev/hda3 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/hda2 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
/dev/hda7 on /usr type ext3 (rw)
/dev/hda6 on /var type ext3 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/usr/tmpDSK on /tmp type ext3 (rw,noexec,nosuid,loop=/dev/loop0)
/tmp on /var/tmp type none (rw,noexec,nosuid,bind)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

Arun Bagul

Sun Microsystems acquire MySQL !!

Sun Microsystems acquire MySQL !!

January 16, 2008 Sun Microsystems, Inc. announced that it has entered into a definitive agreement to acquire MySQL AB, an open source icon and developer of one of the world’s fastest growing open source databases for approximately $1 billion in total consideration. The acquisition accelerates Sun‘s position in enterprise IT to now include the $15 billion database market. This announcement reaffirms Sun‘s position as the leading provider of platforms for the Web economy and its role as the largest commercial open source contributor. For more information, please visit and

Sun Microsystems, Inc. has assures that MySQL users have plenty of reason to feel happy about the acquisition. In addition to the current MySQL offerings, Sun is unveiling new global support offerings. This has huge implications, not only for Sun and MySQL… but for Open Source in general. MySQL was one of the hottest commercial Open Source companies. Sun was already one of the largest contributors of Open Source in the world, but this puts them at the epicenter of the LAMP stack. How this will impact their on again off again relationship with Linux remains to be seen, but I’m already seeing promises that this acquisition will not impact MySQL support on non-Solaris platforms.

(: Arun Bagul

Capturing a UNIX terminal session!

Capturing a UNIX terminal session!

One of the best methods to capture a Unix terminal session is to use the `script` command.

In this example we start a script session, run a couple of commands, and then use the `exit` command to stop capturing the terminal session:

$ script
Script started, output file is typescript
$ pwd
$ ps
11909  p0  Ss     0:00.05 -bash (bash)
25622  p0  S+     0:00.01 script
25623  p1  Ss     0:00.01 /usr/local/bin/bash -i
25624  p1  R+     0:00.00 ps
$ exit
Script done, output file is typescript

We have now captured our terminal session into the file “typescript”.

We can use the `cat` command to view the contents of the “typescript” file:

$ cat typescript
Script started on Tue Jul 26 21:28:50 2005
$ pwd
$ ps
11909  p0  Ss     0:00.05 -bash (bash)
25622  p0  S+     0:00.01 script
25623  p1  Ss     0:00.01 /usr/local/bin/bash -i
25624  p1  R+     0:00.00 ps
$ exit
Script done on Tue Jul 26 21:29:13 2005

If you’re new to UNIX, this concise book will tell you just what you need to get started and no more. This fifth edition is the most effective introduction to UNIX in print, covering Internet usage for email, file transfers, and web browsing. It’s an ideal primer for Mac and PC users who need to know a little about UNIX on the systems they visit. The new edition also contains many major and minor updates to help the reader navigate UNIX’s ever-expanding capabilities. In response to the popularity of Linux, the book now focuses on the popular bash shell preferred by most Linux users. A new chapter explains how to use ftp, pine for mail, and offers useful knowledge on how to surf the web. And the author has included tips throughout the text on security basics, especially in the Internet and networking sections. The book includes a completely updated quick reference card to make it easier for the reader to access the key functions of the command line.

Thanks & Regards

Ravi Bhure