<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6328520688270940312</id><updated>2012-02-16T18:37:19.717+05:30</updated><category term='Phones'/><title type='text'>Anand Shah</title><subtitle type='html'>This is Anand Shah .
An Computer Engg and Linux Professional.

My Areas of Interests is Technology.


Visit My Personal Website http://anandshah.co.cc
and Blogs @
http://anandshah.co.cc/blogs</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>77</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-8255801010749380442</id><published>2009-09-25T14:39:00.001+05:30</published><updated>2009-09-25T14:41:12.432+05:30</updated><title type='text'>PERL script to test SMTP connections</title><content type='html'>SMTP CHECK PERL SCRIPT:&lt;br /&gt;USAGE:- ./perlscript &lt;filename&gt; smtp servername&lt;br /&gt;&lt;br /&gt;#!/usr/bin/perl&lt;br /&gt;&lt;br /&gt;use Net::SMTP;&lt;br /&gt;&lt;br /&gt;$filename = $ARGV[0];&lt;br /&gt;$smtpserver = $ARGV[1];&lt;br /&gt;open (FH, "&lt;$filename") || die "Could not open email file $!\n";&lt;br /&gt;(@lines) = &lt;FH&gt;; # read file into list&lt;br /&gt;close(FH);&lt;br /&gt;&lt;br /&gt;#open(EFILE2,"&lt;$text_attach") || die "Could not open email file $!\n";&lt;br /&gt;#(@lines) = &lt;EFILE2&gt;;           # read file into list&lt;br /&gt;#close(EFILE2);&lt;br /&gt;#close(FH);&lt;br /&gt;&lt;br /&gt;#my $ServerName = $smtpserver;&lt;br /&gt;#$smtp = Net::SMTP-&gt;new($ServerName, Debug =&gt; 0);&lt;br /&gt;#$smtp = Net::SMTP-&gt;new("xx.xx.xx");&lt;br /&gt;&lt;br /&gt;$smtp = Net::SMTP-&gt;new($smtpserver,&lt;br /&gt;                           Hello =&gt; 'mail.testmail.co.in',&lt;br /&gt;                           Port    =&gt; 25,&lt;br /&gt;                           Timeout =&gt; 30,&lt;br /&gt;                           Debug   =&gt; 1,&lt;br /&gt;                          );&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;$from="test\@rediffmail.com";&lt;br /&gt;$cc_list="test\@yahoo.com";&lt;br /&gt;#$recip2="f\@lehman.com";&lt;br /&gt;$recip2="test\@anilkumar.com";&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;$smtp-&gt;mail("$from");&lt;br /&gt;&lt;br /&gt;###############################################&lt;br /&gt;##$smtp-&gt;to("$recip,$cc_list");&lt;br /&gt;##$smtp-&gt;cc("$cc_list");&lt;br /&gt;##$smtp-&gt;bcc("$bcc");&lt;br /&gt;###############################################&lt;br /&gt;&lt;br /&gt;$smtp-&gt;recipient($recip2,$cc_list);&lt;br /&gt;$smtp-&gt;data;&lt;br /&gt;&lt;br /&gt;$smtp-&gt;datasend("To:  $recip2\n");&lt;br /&gt;$smtp-&gt;datasend("From:  $from\n");&lt;br /&gt;&lt;br /&gt;$smtp-&gt;datasend("Cc: $cc_list\n");&lt;br /&gt;$smtp-&gt;datasend("Bcc: $bcc\n");&lt;br /&gt;$smtp-&gt;datasend("Subject: $subject\n");&lt;br /&gt;&lt;br /&gt;$smtp-&gt;datasend("MIME-Version: 1.0 \n");&lt;br /&gt;$smtp-&gt;datasend("Content-Type: text/html; charset=us-ascii \n");&lt;br /&gt;$smtp-&gt;datasend("\n");&lt;br /&gt;&lt;br /&gt;$smtp-&gt;datasend(@lines);&lt;br /&gt;&lt;br /&gt;$smtp-&gt;dataend();&lt;br /&gt;$smtp-&gt;quit;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-8255801010749380442?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/8255801010749380442/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=8255801010749380442&amp;isPopup=true' title='42 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/8255801010749380442'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/8255801010749380442'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/09/perl-script-to-test-smtp-connections.html' title='PERL script to test SMTP connections'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>42</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-2880001532630647910</id><published>2009-09-25T14:37:00.001+05:30</published><updated>2009-09-25T14:38:22.756+05:30</updated><title type='text'>Perl script to uninstall Modules Cleanly</title><content type='html'>This script detects the installed perl modules:-&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#!/usr/local/bin/perl -w&lt;br /&gt;&lt;br /&gt;    use strict;&lt;br /&gt;    use IO::Dir;&lt;br /&gt;    use ExtUtils::Packlist;&lt;br /&gt;    use ExtUtils::Installed;&lt;br /&gt;&lt;br /&gt;    sub emptydir($) {&lt;br /&gt;        my ($dir) = @_;&lt;br /&gt;        my $dh = IO::Dir-&gt;new($dir) || return(0);&lt;br /&gt;        my @count = $dh-&gt;read();&lt;br /&gt;        $dh-&gt;close();&lt;br /&gt;        return(@count == 2 ? 1 : 0);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    # Find all the installed packages&lt;br /&gt;    print("Finding all installed modules...\n");&lt;br /&gt;    my $installed = ExtUtils::Installed-&gt;new();&lt;br /&gt;&lt;br /&gt;    foreach my $module (grep(!/^Perl$/, $installed-&gt;modules())) {&lt;br /&gt;       my $version = $installed-&gt;version($module) || "???";&lt;br /&gt;       print("Found module $module Version $version\n");&lt;br /&gt;       print("Do you want to delete $module? [n] ");&lt;br /&gt;       my $r = &lt;STDIN&gt;; chomp($r);&lt;br /&gt;       if ($r &amp;&amp; $r =~ /^y/i) {&lt;br /&gt;          # Remove all the files&lt;br /&gt;          foreach my $file (sort($installed-&gt;files($module))) {&lt;br /&gt;             print("rm $file\n");&lt;br /&gt;             unlink($file);&lt;br /&gt;          }&lt;br /&gt;          my $pf = $installed-&gt;packlist($module)-&gt;packlist_file();&lt;br /&gt;          print("rm $pf\n");&lt;br /&gt;          unlink($pf);&lt;br /&gt;          foreach my $dir (sort($installed-&gt;directory_tree($module))) {&lt;br /&gt;             if (emptydir($dir)) {&lt;br /&gt;                print("rmdir $dir\n");&lt;br /&gt;                rmdir($dir);&lt;br /&gt;             }&lt;br /&gt;          }&lt;br /&gt;       }&lt;br /&gt;    }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-2880001532630647910?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/2880001532630647910/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=2880001532630647910&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/2880001532630647910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/2880001532630647910'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/09/perl-script-to-uninstall-modules.html' title='Perl script to uninstall Modules Cleanly'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-4598483106155043273</id><published>2009-07-03T15:03:00.001+05:30</published><updated>2009-07-03T15:28:51.507+05:30</updated><title type='text'>Installing Apache Tomcat on Linux</title><content type='html'>&lt;html&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;&lt;title&gt;Installing Tomcat on Linux - Tomcat Installation on Linux - Apache Tomcat HOWTO&lt;/title&gt; &lt;br /&gt;&lt;/head&gt; &lt;br /&gt; &lt;br /&gt;&lt;body text="#000000" bgcolor="#ffffff" link="#000099" vlink="#990099" alink="#000099"&gt; &lt;br /&gt; &lt;br /&gt;&lt;br /&gt;&lt;p&gt; &lt;br /&gt;This article is a step by step guide for installing Apache Tomcat 6.0 (6.0.18) on 64-bit Debian Linux 4.0.&lt;br /&gt;It covers the setup of multiple Tomcat JVM instances on a single Linux server.&lt;br /&gt;The instructions in this guide are applicable to most other Linux distributions.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;b&gt;Contents&lt;/b&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;b&gt;* &lt;a href="http://www.puschitz.com/InstallingTomcat.html#Introduction"&gt;Introduction&lt;/a&gt;&lt;br /&gt;&lt;/b&gt; &lt;br /&gt; &lt;br /&gt;&lt;b&gt;* &lt;a href="http://www.puschitz.com/InstallingTomcat.html#InstallingJavaRuntimeEnvironment"&gt;Installing Java Runtime Environment&lt;/a&gt;&lt;br /&gt;&lt;/b&gt; &lt;br /&gt; &lt;br /&gt;&lt;b&gt;* &lt;a href="http://www.puschitz.com/InstallingTomcat.html#InstallingTomcatSoftware"&gt;Installing Tomcat Software&lt;/a&gt;&lt;br /&gt;&lt;/b&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href="http://www.puschitz.com/InstallingTomcat.html#StartingStoppingTomcat"&gt;Starting/Stopping Tomcat&lt;/a&gt;&lt;br /&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href="http://www.puschitz.com/InstallingTomcat.html#SwitchingToTomcatUserAccount"&gt;Switching to Tomcat User Account&lt;/a&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;b&gt;* &lt;a href="http://www.puschitz.com/InstallingTomcat.html#SettingUpFirstTomcatJVMInstance"&gt;Setting Up First Tomcat JVM Instance&lt;/a&gt;&lt;br /&gt;&lt;/b&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href="http://www.puschitz.com/InstallingTomcat.html#SettingUpDirectoriesAndFiles"&gt;Setting up Directories and Files&lt;/a&gt;&lt;br /&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href="http://www.puschitz.com/InstallingTomcat.html#ConfiguringTomcatNetworkPorts"&gt;Configuring Tomcat Network Ports&lt;/a&gt;&lt;br /&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href="http://www.puschitz.com/InstallingTomcat.html#StartingFirstTomcatInstance"&gt;Starting First Tomcat Instance&lt;/a&gt;&lt;br /&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href="http://www.puschitz.com/InstallingTomcat.html#RelayingHTTPPort"&gt;Relaying HTTP Port 80 Connections to Tomcat Port 8080&lt;/a&gt;&lt;br /&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href="http://www.puschitz.com/InstallingTomcat.html#ConnectingToFirstTomcatInstanceUsingDefaultHTTPPort"&gt;Connecting to First Tomcat Instance Using Default HTTP Port&lt;/a&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;b&gt;* &lt;a href="http://www.puschitz.com/InstallingTomcat.html#SettingUpAWebApplicationForFirstTomcatJVMInstance"&gt;Setting Up a Web Application for First Tomcat JVM Instance&lt;/a&gt;&lt;br /&gt;&lt;/b&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href="http://www.puschitz.com/InstallingTomcat.html#SettingUpWebApplicationLayout"&gt;Setting up Web Application Layout&lt;/a&gt;&lt;br /&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href="http://www.puschitz.com/InstallingTomcat.html#ConfiguringWebApplication"&gt;Configuring Web Application&lt;/a&gt;&lt;br /&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href="http://www.puschitz.com/InstallingTomcat.html#HomePageForWebApplication"&gt;Home Page for Web Application&lt;/a&gt;&lt;br /&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href="http://www.puschitz.com/InstallingTomcat.html#RestartingFirstTomcatInstance"&gt;Restarting First Tomcat Instance&lt;/a&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;b&gt;* &lt;a href="http://www.puschitz.com/InstallingTomcat.html#DeployingJavaServletForWebApplicationInFirstTomcatJVMInstance"&gt;Deploying Java Servlet for Web Application in First Tomcat JVM Instance&lt;/a&gt;&lt;br /&gt;&lt;/b&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href="http://www.puschitz.com/InstallingTomcat.html#SettingUpJavaServletLayout"&gt;Setting up Java Servlet Layout&lt;/a&gt;&lt;br /&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href="http://www.puschitz.com/InstallingTomcat.html#JARFiles"&gt;JAR Files&lt;/a&gt;&lt;br /&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href="http://www.puschitz.com/InstallingTomcat.html#CreatingAJavaServlet"&gt;Creating a Java Servlet&lt;/a&gt;&lt;br /&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href="http://www.puschitz.com/InstallingTomcat.html#ConfiguringTheJavaServlet"&gt;Configuring the Java Servlet&lt;/a&gt;&lt;br /&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href="http://www.puschitz.com/InstallingTomcat.html#TestingAndExecutingTheJavaServlet"&gt;Testing and Executing the Java Servlet&lt;/a&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;b&gt;* &lt;a href="http://www.puschitz.com/InstallingTomcat.html#SettingUpSecondTomcatJVMInstance"&gt;Setting Up Second Tomcat JVM Instance&lt;/a&gt;&lt;br /&gt;&lt;/b&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href="http://www.puschitz.com/InstallingTomcat.html#SettingUpSecondTomcatJVMInstanceGeneral"&gt;General&lt;/a&gt;&lt;br /&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href="http://www.puschitz.com/InstallingTomcat.html#StepsForSecondTomcatJVMInstanceAndApplication"&gt;Steps for Second Tomcat JVM Instance and Application&lt;/a&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;b&gt;* &lt;a href="http://www.puschitz.com/InstallingTomcat.html#BibliographyAndReferences"&gt;Bibliography and References&lt;/a&gt;&lt;br /&gt;&lt;/b&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;&lt;font color="#0000FF"&gt;&lt;u&gt;&lt;a name="Introduction"&gt;Introduction&lt;/a&gt;&lt;/u&gt;&lt;/font&gt;&lt;/h2&gt; &lt;br /&gt; &lt;br /&gt;This article discusses how to install Apache Tomcat 6.0 (6.0.18) on 64-bit Debian Linux 4.0.&lt;br /&gt;Additionally it shows how to setup multiple Tomcat JVM instances on a single Linux server.&lt;br /&gt;For each Tomcat JVM instance a web application and Java servlet example is configured.&lt;br /&gt;The Tomcat installation steps outlined in this article are also applicable to most other Linux distributions.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;i&gt;Note that this document comes without warranty of any kind. But every effort has been made to provide the information as accurate as possible.&lt;br /&gt;I welcome emails from any readers with comments, suggestions, and corrections at webmaster_at_puschitz.com.&lt;/i&gt; &lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h2&gt;&lt;font color="#0000FF"&gt;&lt;u&gt;&lt;a name="InstallingJavaRuntimeEnvironment"&gt;Installing Java Runtime Environment&lt;/a&gt;&lt;/u&gt;&lt;/font&gt;&lt;/h2&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;To run Tomcat, you need Java Standard Edition (Java SE), also known as the JDK.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;For the Tomcat installation I used SUN's latest Java SE JDK that was available at the time of this writing:&lt;br /&gt;Java SE Development Kit (JDK) 6 Update 10 (6u10).&lt;br /&gt;Regarding Java SE 6, Platform Name and Version Numbers, see&lt;br /&gt;&lt;a href="http://java.sun.com/javase/6/webnotes/version-6.html"&gt;http://java.sun.com/javase/6/webnotes/version-6.html&lt;/a&gt;.&lt;br /&gt;And for the whole Java version history I recommend the Wiki article&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Java_version_history"&gt;http://en.wikipedia.org/wiki/Java_version_history&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;You can download SUN's latest Java JDKs at:&lt;br /&gt;&lt;a href="http://java.sun.com/javase/downloads/index.jsp"&gt;http://java.sun.com/javase/downloads/index.jsp&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;For my 64-bit Debian system I selected the 64-bit JDK multiplatform binary for Linux: &lt;tt&gt;jdk-6u10-linux-x64.bin&lt;/tt&gt;.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;I downloaded the binary file to &lt;tt&gt;/tmp&lt;/tt&gt; and installed it as follows as root:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;# &lt;font color="#0000FF"&gt;mkdir -p /usr/java&lt;/font&gt; &lt;br /&gt;# &lt;font color="#0000FF"&gt;cd /usr/java&lt;/font&gt; &lt;br /&gt;#&lt;br /&gt;# &lt;font color="#0000FF"&gt;chmod 700 /tmp/jdk-6u10-linux-x64.bin&lt;/font&gt; &lt;br /&gt;# &lt;font color="#0000FF"&gt;/tmp/jdk-6u10-linux-x64.bin&lt;/font&gt; &lt;br /&gt;...&lt;br /&gt;   creating: jdk1.6.0_10/&lt;br /&gt;   creating: jdk1.6.0_10/db/&lt;br /&gt;   creating: jdk1.6.0_10/db/bin/&lt;br /&gt;  inflating: jdk1.6.0_10/db/bin/ij   &lt;br /&gt;  inflating: jdk1.6.0_10/db/bin/NetworkServerControl  &lt;br /&gt;  inflating: jdk1.6.0_10/db/bin/setNetworkClientCP.bat  &lt;br /&gt;  inflating: jdk1.6.0_10/db/bin/derby_common.sh  &lt;br /&gt;...&lt;br /&gt;Done.&lt;br /&gt;# &lt;font color="#0000FF"&gt;export JAVA_HOME=/usr/java/jdk1.6.0_10&lt;/font&gt; &lt;br /&gt;# &lt;font color="#0000FF"&gt;export PATH=$JAVA_HOME/bin:$PATH&lt;/font&gt; &lt;br /&gt;#&lt;br /&gt;# &lt;font color="#0000FF"&gt;which java&lt;/font&gt; &lt;br /&gt;/usr/java/jdk1.6.0_10/bin/java&lt;br /&gt;# &lt;font color="#0000FF"&gt;java -version&lt;/font&gt; &lt;br /&gt;java version "1.6.0_10"&lt;br /&gt;Java(TM) SE Runtime Environment (build 1.6.0_10-b33)&lt;br /&gt;Java HotSpot(TM) 64-Bit Server VM (build 11.0-b15, mixed mode)&lt;br /&gt;#&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h2&gt;&lt;font color="#0000FF"&gt;&lt;u&gt;&lt;a name="InstallingTomcatSoftware"&gt;Installing Tomcat Software&lt;/a&gt;&lt;/u&gt;&lt;/font&gt;&lt;/h2&gt; &lt;br /&gt; &lt;br /&gt;Download the latest Tomcat 6.x version from&lt;br /&gt;&lt;a href="http://tomcat.apache.org/download-60.cgi"&gt;http://tomcat.apache.org/download-60.cgi&lt;/a&gt;.&lt;br /&gt;For Debian I downloaded the Binary Core Distribution file &lt;tt&gt;apache-tomcat-6.0.18.tar.gz&lt;/tt&gt; which was the&lt;br /&gt;latest version at the time of this writing.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;Once you downloaded the tar file make sure the &lt;i&gt;MD5 checksum matches the value posted on Tomcat's web site&lt;/i&gt;, see&lt;br /&gt;&lt;a href="http://www.apache.org/dist/tomcat/tomcat-6/v6.0.18/bin/apache-tomcat-6.0.18.tar.gz.md5"&gt;http://www.apache.org/dist/tomcat/tomcat-6/v6.0.18/bin/apache-tomcat-6.0.18.tar.gz.md5&lt;/a&gt;:&lt;br /&gt;&lt;pre&gt;# &lt;font color="#0000FF"&gt;md5sum /tmp/apache-tomcat-6.0.18.tar.gz&lt;/font&gt; &lt;br /&gt;8354e156f097158f8d7b699078fd39c1  /tmp/apache-tomcat-6.0.18.tar.gz&lt;br /&gt; &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;Installing Tomcat from a binary release (tar file) requires manual creation of the Tomcat user account.&lt;br /&gt;This is not necessary if you install the Tomcat RPM package on a Linux system that supports RPMs.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;For security reasons I created a user account with no login shell for running the Tomcat server:&lt;br /&gt;&lt;pre&gt;# &lt;font color="#0000FF"&gt;groupadd tomcat&lt;/font&gt; &lt;br /&gt;# &lt;font color="#0000FF"&gt;useradd -g tomcat -s /usr/sbin/nologin -m -d /home/tomcat tomcat&lt;/font&gt; &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;(It should be noted that other Linux systems have &lt;tt&gt;nologin&lt;/tt&gt; under &lt;tt&gt;/sbin&lt;/tt&gt; not &lt;tt&gt;/usr/sbin&lt;/tt&gt;)&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;Next I extracted the tar file to &lt;tt&gt;/var/lib&lt;/tt&gt; and changed the ownership of all files and directories to &lt;tt&gt;tomcat&lt;/tt&gt;:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;# &lt;font color="#0000FF"&gt;cd /var/lib&lt;/font&gt; &lt;br /&gt;# &lt;font color="#0000FF"&gt;tar zxvf /tmp/apache-tomcat-6.0.18.tar.gz&lt;/font&gt; &lt;br /&gt;# &lt;font color="#0000FF"&gt;chown -R tomcat.tomcat /var/lib/apache-tomcat-6.0.18&lt;/font&gt; &lt;br /&gt; &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;The get the Tomcat version of the newly installed Tomcat, run:&lt;br /&gt;&lt;pre&gt;# &lt;font color="#0000FF"&gt;/var/lib/apache-tomcat-6.0.18/bin/version.sh&lt;/font&gt; &lt;br /&gt;Using CATALINA_BASE:   /var/lib/apache-tomcat-6.0.18&lt;br /&gt;Using CATALINA_HOME:   /var/lib/apache-tomcat-6.0.18&lt;br /&gt;Using CATALINA_TMPDIR: /var/lib/apache-tomcat-6.0.18/temp&lt;br /&gt;Using JRE_HOME:       /usr&lt;br /&gt;Server version: Apache Tomcat/6.0.18&lt;br /&gt;Server built:   Jul 22 2008 02:00:36&lt;br /&gt;Server number:  6.0.18.0&lt;br /&gt;OS Name:        Linux&lt;br /&gt;OS Version:     2.6.18-6-amd64&lt;br /&gt;Architecture:   x86_64&lt;br /&gt;JVM Version:    1.4.2&lt;br /&gt;JVM Vendor:     Free Software Foundation, Inc.&lt;br /&gt;#&lt;br /&gt; &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;b&gt;&lt;a name="StartingStoppingTomcat"&gt;Starting/Stopping Tomcat&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;Now try to startup the Tomcat server to see whether the default Tomcat home page is being displayed.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;For security reasons I don't run the Tomcat server as user &lt;tt&gt;root&lt;/tt&gt; but as &lt;tt&gt;tomcat&lt;/tt&gt; which was created with no login shell.&lt;br /&gt;Therefore, to run Tomcat use the &lt;tt&gt;su&lt;/tt&gt; command with the &lt;tt&gt;-p&lt;/tt&gt; option to preserves&lt;br /&gt;all the environment variables when switching to &lt;tt&gt;tomcat&lt;/tt&gt; (more on the Tomcat environment variables later).&lt;br /&gt;And since the &lt;tt&gt;tomcat&lt;/tt&gt; account has no login shell, it needs to be specified with the &lt;tt&gt;-s&lt;/tt&gt; option.&lt;br /&gt;(You may want to use this &lt;tt&gt;su&lt;/tt&gt; command if you plan on writing and implementing a system startup and shutdown script for system reboots.)&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;# &lt;font color="#0000FF"&gt;export JAVA_HOME=/usr/java/jdk1.6.0_10&lt;/font&gt; &lt;br /&gt;# &lt;font color="#0000FF"&gt;export PATH=$JAVA_HOME/bin:$PATH&lt;/font&gt; &lt;br /&gt;# &lt;font color="#0000FF"&gt;export CATALINA_HOME=/var/lib/apache-tomcat-6.0.18&lt;/font&gt; &lt;br /&gt;# &lt;font color="#0000FF"&gt;export CATALINA_BASE=/var/lib/apache-tomcat-6.0.18&lt;/font&gt; &lt;br /&gt;#&lt;br /&gt; &lt;br /&gt;# &lt;font color="#0000FF"&gt;su -p -s /bin/sh tomcat $CATALINA_HOME/bin/startup.sh&lt;/font&gt; &lt;br /&gt;Using CATALINA_BASE:   /var/lib/apache-tomcat-6.0.18&lt;br /&gt;Using CATALINA_HOME:   /var/lib/apache-tomcat-6.0.18&lt;br /&gt;Using CATALINA_TMPDIR: /var/lib/apache-tomcat-6.0.18/temp&lt;br /&gt;Using JRE_HOME:       /usr/java/jdk1.6.0_10&lt;br /&gt;#&lt;br /&gt; &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;Now verify that Tomcat was started successfully by opening the URL &lt;tt&gt;&lt;font color="#0000FF"&gt;http://localhost:8080&lt;/font&gt;&lt;/tt&gt; (Port number 8080 is the default port used by Tomcat).&lt;br /&gt;Note that you should also be able to use the name of your server instead of &lt;tt&gt;localhost&lt;/tt&gt;.&lt;br /&gt;Once you opened the URL in your browser you should see Tomcat's Congratulation page.&lt;br /&gt;If you don't see the page, check the log files under &lt;tt&gt;$CATALINA_HOME/logs&lt;/tt&gt; (&lt;tt&gt;/var/lib/apache-tomcat-6.0.18/logs&lt;/tt&gt;).&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;Before you continue with the next steps, make sure to shut down Tomcat since we want to run the Tomcat server out of a separate&lt;br /&gt;application directory which is covered in the next chapter.&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;# &lt;font color="#0000FF"&gt;su -p -s /bin/sh tomcat $CATALINA_HOME/bin/shutdown.sh&lt;/font&gt; &lt;br /&gt;Using CATALINA_BASE:   /var/lib/apache-tomcat-6.0.18&lt;br /&gt;Using CATALINA_HOME:   /var/lib/apache-tomcat-6.0.18&lt;br /&gt;Using CATALINA_TMPDIR: /var/lib/apache-tomcat-6.0.18/temp&lt;br /&gt;Using JRE_HOME:       /usr/java/jdk1.6.0_10&lt;br /&gt;#&lt;br /&gt; &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;b&gt;&lt;a name="SwitchingToTomcatUserAccount"&gt;Switching to Tomcat User Account&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;Most of the next steps in this article assume that you switched to the &lt;tt&gt;tomcat&lt;/tt&gt; user account.&lt;br /&gt;If you see a '&lt;tt&gt;$&lt;/tt&gt;' prompt, then the steps in this article are executed as the &lt;tt&gt;tomcat&lt;/tt&gt; user.&lt;br /&gt;If you see a '&lt;tt&gt;#&lt;/tt&gt;' prompt, then the steps are executed as &lt;tt&gt;root&lt;/tt&gt;.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;Since for security reasons the &lt;tt&gt;tomcat&lt;/tt&gt; user has no login shell, it needs to be specified with the &lt;tt&gt;-s&lt;/tt&gt; option when switching from&lt;br /&gt;&lt;tt&gt;root&lt;/tt&gt; to &lt;tt&gt;tomcat&lt;/tt&gt;:&lt;br /&gt;&lt;pre&gt;# &lt;font color="#0000FF"&gt;su - -s /bin/sh tomcat&lt;/font&gt; &lt;br /&gt;$ &lt;font color="#0000FF"&gt;id&lt;/font&gt; &lt;br /&gt;uid=1001(tomcat) gid=1001(tomcat) groups=1001(tomcat)&lt;br /&gt;$&lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;Note that non-root users cannot switch to the &lt;tt&gt;tomcat&lt;/tt&gt; account.&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h2&gt;&lt;font color="#0000FF"&gt;&lt;u&gt;&lt;a name="SettingUpFirstTomcatJVMInstance"&gt;Setting Up First Tomcat JVM Instance&lt;/a&gt;&lt;/u&gt;&lt;/font&gt;&lt;/h2&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;It is recommended not to store the web applications's files in Tomcat's distribution directory tree.&lt;br /&gt;For example, having a separate directory makes Tomcat upgrades easier since it won't&lt;br /&gt;overwrite configuration files like &lt;tt&gt;server.xml&lt;/tt&gt;. And since this tutorial shows how to run two&lt;br /&gt;Tomcat instances concurrently on a single Linux server, two separate directories are needed anyway.&lt;br /&gt;It should be noted here that it's also possible to run multiple web applications per Tomcat JVM instance.&lt;br /&gt;This HOWTO shows the creation and configuration of one web application for each Tomcat instance.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;b&gt;&lt;a name="SettingUpDirectoriesAndFiles"&gt;Setting up Directories and Files&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;In the following example I setup the first Tomcat JVM instance under the base directory &lt;tt&gt;/opt/tomcat-instance/sales.example.com&lt;/tt&gt;.&lt;br /&gt;It's a good practice to name the base directory after the site name, in this example &lt;tt&gt;sales.example.com&lt;/tt&gt;.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;Creating a new base directory for a new instance requires the creation and copying of various directories and&lt;br /&gt;configuration files. Execute the following commands as &lt;tt&gt;root&lt;/tt&gt;:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;# &lt;font color="#0000FF"&gt;mkdir -p /opt/tomcat-instance/sales.example.com&lt;/font&gt; &lt;br /&gt;# &lt;font color="#0000FF"&gt;cd /opt/tomcat-instance/sales.example.com&lt;/font&gt; &lt;br /&gt;#&lt;br /&gt;# &lt;font color="#0000FF"&gt;cp -a /var/lib/apache-tomcat-6.0.18/conf &lt;b&gt;.&lt;/b&gt;&lt;/font&gt; &lt;br /&gt;# &lt;font color="#0000FF"&gt;mkdir common logs temp server shared webapps work&lt;/font&gt; &lt;br /&gt;#&lt;br /&gt;# &lt;font color="#0000FF"&gt;chown -R tomcat.tomcat /opt/tomcat-instance&lt;/font&gt; &lt;br /&gt; &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;Most of the remaining steps are executed as the &lt;tt&gt;tomcat&lt;/tt&gt; user. So make sure you switch from &lt;tt&gt;root&lt;/tt&gt; &lt;br /&gt;to &lt;tt&gt;tomcat&lt;/tt&gt;:&lt;br /&gt;&lt;pre&gt;# &lt;font color="#0000FF"&gt;su - -s /bin/sh tomcat&lt;/font&gt; &lt;br /&gt;$ &lt;font color="#0000FF"&gt;id&lt;/font&gt; &lt;br /&gt;uid=1001(tomcat) gid=1001(tomcat) groups=1001(tomcat)&lt;br /&gt;$&lt;br /&gt; &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;Next I created an environment file for the new Tomcat instance.&lt;br /&gt;This will be useful for easily setting the environment variables when starting/stopping the new Tomcat instance:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;$ &lt;font color="#0000FF"&gt;cat &gt; /opt/tomcat-instance/sales.env &lt;&lt; EOF&lt;br /&gt;export JAVA_HOME=/usr/java/jdk1.6.0_10&lt;br /&gt;export PATH=\$JAVA_HOME/bin:\$PATH&lt;br /&gt;export &lt;b&gt;CATALINA_HOME=/var/lib/apache-tomcat-6.0.18&lt;/b&gt; &lt;br /&gt;export &lt;b&gt;CATALINA_BASE=/opt/tomcat-instance/sales.example.com&lt;/b&gt; &lt;br /&gt;EOF&lt;/font&gt; &lt;br /&gt;$&lt;br /&gt;$ &lt;font color="#0000FF"&gt;cat /opt/tomcat-instance/sales.env&lt;/font&gt; &lt;br /&gt;export JAVA_HOME=/usr/java/jdk1.6.0_10&lt;br /&gt;export PATH=$JAVA_HOME/bin:$PATH&lt;br /&gt;export CATALINA_HOME=/var/lib/apache-tomcat-6.0.18&lt;br /&gt;export CATALINA_BASE=/opt/tomcat-instance/sales.example.com&lt;br /&gt;$&lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;&lt;tt&gt;&lt;b&gt;CATALINA_HOME&lt;/b&gt;&lt;/tt&gt; is the base directory of Tomcat that contains all the libraries, scripts etc. for Tomcat.&lt;br /&gt;This is the parent directory of the extracted Tomcat tar file.&lt;br /&gt; &lt;br /&gt;&lt;tt&gt;&lt;b&gt;CATALINA_BASE&lt;/b&gt;&lt;/tt&gt; is the base directory of the new Tomcat instance, which in this example points to&lt;br /&gt;&lt;tt&gt;/opt/tomcat-instance/sales.example.com&lt;/tt&gt;.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;b&gt;&lt;a name="ConfiguringTomcatNetworkPorts"&gt;Configuring Tomcat Network Ports&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;Since this is the first Tomcat instance that's being created here, the default port numbers can be left unchanged&lt;br /&gt;in &lt;tt&gt;&lt;font color="#0000FF"&gt;$CATALINA_BASE/conf/server.xml&lt;/font&gt;&lt;/tt&gt; (&lt;tt&gt;/opt/tomcat-instance/sales.example.com/conf/server.xml&lt;/tt&gt;):&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;    &amp;lt;Server port="8005" shutdown="SHUTDOWN"&amp;gt;&lt;br /&gt; &lt;br /&gt;    &amp;lt;Connector port="8080" protocol="HTTP/1.1"&lt;br /&gt;               connectionTimeout="20000"&lt;br /&gt;               redirectPort="8443" /&amp;gt;&lt;br /&gt; &lt;br /&gt;    &amp;lt;Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /&amp;gt;&lt;br /&gt; &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;However, these port numbers will have to be changed for the second Tomcat instance though, see&lt;br /&gt;&lt;a href="http://www.puschitz.com/InstallingTomcat.html#StepsForSecondTomcatJVMInstanceAndApplication"&gt;Steps for Second Tomcat JVM Instance and Application&lt;/a&gt;.&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;b&gt;&lt;a name="StartingFirstTomcatInstance"&gt;Starting First Tomcat Instance&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;To start the newly created Tomcat JVM instance, ensure that the environment variables are set for the new instance and execute the startup script:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;$ &lt;font color="#0000FF"&gt;source /opt/tomcat-instance/sales.env&lt;/font&gt; &lt;br /&gt;$ &lt;font color="#0000FF"&gt;$CATALINA_HOME/bin/startup.sh&lt;/font&gt; &lt;br /&gt;Using CATALINA_BASE:   /opt/tomcat-instance/sales.example.com&lt;br /&gt;Using CATALINA_HOME:   /var/lib/apache-tomcat-6.0.18&lt;br /&gt;Using CATALINA_TMPDIR: /opt/tomcat-instance/sales.example.com/temp&lt;br /&gt;Using JRE_HOME:       /usr/java/jdk1.6.0_10&lt;br /&gt;$&lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;If everything has been configured correctly, you should now see an empty white page when opening the URL &lt;tt&gt;&lt;font color="#0000FF"&gt;http://localhost:8080&lt;/font&gt;&lt;/tt&gt;.&lt;br /&gt;Note that instead of &lt;tt&gt;localhost&lt;/tt&gt; you should also be able to use the name of your server.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;If you get an error in the browser instead of an empty page, check the log files under&lt;br /&gt;&lt;tt&gt;$CATALINA_BASE/logs&lt;/tt&gt; (&lt;tt&gt;/opt/tomcat-instance/sales.example.com/logs&lt;/tt&gt;).&lt;br /&gt;Note that since &lt;tt&gt;CATALINA_BASE&lt;/tt&gt; has been changed for the new Tomcat instance, the logs are no longer written to &lt;tt&gt;/var/lib/apache-tomcat-6.0.18/logs&lt;/tt&gt;.&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;b&gt;&lt;a name="RelayingHTTPPort"&gt;Relaying HTTP Port 80 Connections to Tomcat Port 8080&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;By default, Tomcat listens on port 8080. To have the Tomcat server itself listen on HTTP port 80, Tomcat would have to run as &lt;tt&gt;root&lt;/tt&gt; &lt;br /&gt;since only &lt;tt&gt;root&lt;/tt&gt; can listen on ports below 1024 on Linux. But for security reasons this is not recommended.&lt;br /&gt;The solution I prefer is to relay port 80 TCP connections to port 8080 using the &lt;a href="http://www.netfilter.org/"&gt;Netfilter package&lt;/a&gt; &lt;br /&gt;that comes with Linux.&lt;br /&gt;An alternate solution would be to use a service wrapper like &lt;tt&gt;jsvc&lt;/tt&gt; from the&lt;br /&gt;&lt;a href="http://commons.apache.org/daemon/"&gt;Jakarta Commons Daemon project&lt;/a&gt;. But this solution would require the installation and maintenance of another&lt;br /&gt;piece of software on my system that I want to avoid.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;The Netfilter package that comes already with Linux is transparent to Tomcat. The following steps show how to relay port 80 TCP connections to Tomcat's&lt;br /&gt;port 8080 using the &lt;tt&gt;iptables&lt;/tt&gt; command from the Netfilter package. Note that these steps must be executed as &lt;tt&gt;root&lt;/tt&gt;:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;# &lt;font color="#0000FF"&gt;iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080&lt;/font&gt; &lt;br /&gt;# &lt;font color="#0000FF"&gt;iptables -t nat -I OUTPUT -p tcp --dport 80 -j REDIRECT --to-ports 8080&lt;/font&gt; &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;The first rule redirects incoming requests on port 80 generated from other computer nodes, and the second rule&lt;br /&gt;redirects incoming requests on port 80 generated from the local node where Tomcat is running.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;To see the newly configured rules, run:&lt;br /&gt;&lt;pre&gt;# &lt;font color="#0000FF"&gt;iptables -t nat -L&lt;/font&gt; &lt;br /&gt;Chain PREROUTING (policy ACCEPT)&lt;br /&gt;target     prot opt source               destination         &lt;br /&gt;REDIRECT   tcp  --  anywhere             anywhere            tcp dpt:www redir ports 8080 &lt;br /&gt; &lt;br /&gt;Chain POSTROUTING (policy ACCEPT)&lt;br /&gt;target     prot opt source               destination         &lt;br /&gt; &lt;br /&gt;Chain OUTPUT (policy ACCEPT)&lt;br /&gt;target     prot opt source               destination         &lt;br /&gt;REDIRECT   tcp  --  anywhere             anywhere            tcp dpt:www redir ports 8080 &lt;br /&gt;#&lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;To remove the NAT rules we just created, you can run the &lt;tt&gt;iptables -t nat -F&lt;/tt&gt; command which flushes and deletes the rules.&lt;br /&gt;Note that this will also flush any other rules that may have been configured on your system!&lt;br /&gt;For more information on &lt;tt&gt;iptables&lt;/tt&gt;, see&lt;br /&gt;&lt;a href="http://www.netfilter.org/documentation/index.html"&gt;netfilter/iptables documentation&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;To make the rules permanent for reboots, you can use the following option outlined here for Debian&lt;br /&gt;(other Linux distributions have other methods). First save the newly created rules in a file:&lt;br /&gt;&lt;pre&gt;# &lt;font color="#0000FF"&gt;iptables-save &gt; /etc/iptables.conf&lt;/font&gt; &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;Then edit the &lt;tt&gt;&lt;font color="#0000FF"&gt;/etc/network/interfaces&lt;/font&gt;&lt;/tt&gt; file and add the line highlighted in blue for the public network interface. For example:&lt;br /&gt;&lt;pre&gt;iface eth0 inet static&lt;br /&gt;        address 192.168.1.23&lt;br /&gt;        netmask 255.255.255.0&lt;br /&gt;        network 192.168.1.0&lt;br /&gt;        broadcast 192.168.1.255&lt;br /&gt;        gateway 192.168.1.1&lt;br /&gt;        &lt;font color="#0000FF"&gt;pre-up iptables-restore &lt; /etc/iptables.conf&lt;/font&gt; &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;The &lt;tt&gt;pre-up&lt;/tt&gt; configuration in this example activates the &lt;tt&gt;iptables&lt;/tt&gt; rules on my system before the public interface &lt;tt&gt;eth0&lt;/tt&gt; comes up.&lt;br /&gt;So the rules can be seen with &lt;tt&gt;iptables -t nat -L&lt;/tt&gt; after each reboot.&lt;br /&gt;Note that for security reasons it's important that firewall rules are established before the network interfaces come up.&lt;br /&gt;Even though this is not an issue for relaying Tomcat connections, as a matter of good practice, the &lt;tt&gt;iptables&lt;/tt&gt; rules should always&lt;br /&gt;be established before the network comes up. &lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;It should be noted here that there is one Tomcat configuration parameter that you may or may not want to change, the &lt;tt&gt;proxyPort&lt;/tt&gt; &lt;br /&gt;parameter in the &lt;tt&gt;server.xml&lt;/tt&gt; file.&lt;br /&gt;Since Tomcat still receives requests on port 8080 as they are relayed by the Linux Netfilter system from port 80, &lt;br /&gt;Tomcat may display port 8080 in the URL depending on the application's content.&lt;br /&gt;So if you want to change it to port 80, the &lt;tt&gt;proxyPort&lt;/tt&gt; parameter would need to be added in the &lt;font color="#0000FF"&gt;&lt;tt&gt;$CATALINA_BASE/conf/server.xml&lt;/tt&gt;&lt;/font&gt; (&lt;tt&gt;/opt/tomcat-instance/sales.example.com/conf/server.xml&lt;/tt&gt;).&lt;br /&gt;file for port 8080:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt; &lt;br /&gt;    &amp;lt;Connector port="8080" protocol="HTTP/1.1" &lt;font color="#0000FF"&gt;proxyPort="80"&lt;/font&gt; &lt;br /&gt;               connectionTimeout="20000"&lt;br /&gt;               redirectPort="8443" /&amp;gt;&lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;After that you need to restart Tomcat to make this change effective.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;b&gt;&lt;a name="ConnectingToFirstTomcatInstanceUsingDefaultHTTPPort"&gt;Connecting to First Tomcat Instance Using Default HTTP Port&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;If &lt;tt&gt;iptables&lt;/tt&gt; have been configured correctly, you should now be able to open the URL&lt;br /&gt;&lt;tt&gt;&lt;font color="#0000FF"&gt;http://localhost&lt;/font&gt;&lt;/tt&gt; and see an &lt;i&gt;empty white page&lt;/i&gt;.&lt;br /&gt;You could also use the URL &lt;tt&gt;http://localhost:80&lt;/tt&gt; (port 80 is the default port used by browsers) or the name of your server.&lt;br /&gt;If you get an error in the browser instead of an empty page, check the &lt;tt&gt;iptables&lt;/tt&gt; configuration and check the log files under&lt;br /&gt;&lt;tt&gt;$CATALINA_BASE/logs&lt;/tt&gt; (&lt;tt&gt;/opt/tomcat-instance/sales.example.com/logs&lt;/tt&gt;).&lt;br /&gt;Note that since &lt;tt&gt;CATALINA_BASE&lt;/tt&gt; was changed for the new Tomcat instance, the logs are no longer written to &lt;tt&gt;/var/lib/apache-tomcat-6.0.18/logs&lt;/tt&gt;.&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h2&gt;&lt;font color="#0000FF"&gt;&lt;u&gt;&lt;a name="SettingUpAWebApplicationForFirstTomcatJVMInstance"&gt;Setting Up a Web Application for First Tomcat JVM Instance&lt;/a&gt;&lt;/u&gt;&lt;/font&gt;&lt;/h2&gt; &lt;br /&gt; &lt;br /&gt;You can setup multiple web applications for each Tomcat JVM instance. In this guide we are setting up one web application for&lt;br /&gt;each Tomcat JVM instance.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;First make sure to switch to the &lt;tt&gt;tomcat&lt;/tt&gt; user account and source in the environment variables for the remaining steps:&lt;br /&gt;&lt;pre&gt;# &lt;font color="#0000FF"&gt;su - -s /bin/sh tomcat&lt;/font&gt; &lt;br /&gt;$ &lt;font color="#0000FF"&gt;source /opt/tomcat-instance/sales.env&lt;/font&gt; &lt;br /&gt; &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;b&gt;&lt;a name="SettingUpWebApplicationLayout"&gt;Setting up Web Application Layout&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;In the previous chapter the first Tomcat JVM instance was setup under the base directory &lt;tt&gt;$CATALINA_BASE&lt;/tt&gt; (&lt;tt&gt;/opt/tomcat-instance/sales.example.com&lt;/tt&gt;).&lt;br /&gt;In the following example I create a new directory called "&lt;tt&gt;sales&lt;/tt&gt;" under &lt;tt&gt;$CATALINA_BASE/webapps&lt;/tt&gt; which&lt;br /&gt;will become the root directory for the first web application, that is &lt;tt&gt;$CATALINA_BASE/webapps/sales&lt;/tt&gt;. In Tomcat web application root directories&lt;br /&gt;are created under &lt;tt&gt;$CATALINA_BASE/webapps&lt;/tt&gt; by default.&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;$ &lt;font color="#0000FF"&gt;mkdir $CATALINA_BASE/webapps/sales&lt;/font&gt; &lt;br /&gt; &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;b&gt;&lt;a name="ConfiguringWebApplication"&gt;Configuring Web Application&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;To configure Tomcat to recognize the new web application under &lt;tt&gt;$CATALINA_BASE/webapps/sales&lt;/tt&gt; (&lt;tt&gt;/opt/tomcat-instance/sales.example.com/webapps/sales&lt;/tt&gt;),&lt;br /&gt;the &lt;font color="#0000FF"&gt;&lt;tt&gt;$CATALINA_BASE/conf/server.xml&lt;/tt&gt;&lt;/font&gt; file needs to be edited.&lt;br /&gt;This is done by adding a new &lt;tt&gt;Context&lt;/tt&gt; element with the &lt;tt&gt;path&lt;/tt&gt; and &lt;tt&gt;docBase&lt;/tt&gt; attributes.&lt;br /&gt;Note that Tomcat refers to webapps as "context". So &lt;tt&gt;Context&lt;/tt&gt; here represents the configuration of a web application.&lt;br /&gt;The &lt;tt&gt;path&lt;/tt&gt; attribute is the application name used within the URL, and the &lt;tt&gt;docBase&lt;/tt&gt; attribute is the absolute path name&lt;br /&gt;of the new web application root under &lt;tt&gt;$CATALINA_BASE/webapps&lt;/tt&gt;:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt; &lt;br /&gt;      &amp;lt;Host name="localhost"  appBase="webapps"&lt;br /&gt;            unpackWARs="true" autoDeploy="true"&lt;br /&gt;            xmlValidation="false" xmlNamespaceAware="false"&amp;gt;&lt;br /&gt; &lt;br /&gt;        &lt;font color="#0000FF"&gt;&amp;lt;Context docBase="sales" path="/mysales"/&amp;gt;&lt;/font&gt; &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;In this example you can see that &lt;tt&gt;appBase&lt;/tt&gt; already points to &lt;tt&gt;webapps&lt;/tt&gt; by default, that is &lt;tt&gt;$CATALINA_BASE/webapps&lt;/tt&gt;.&lt;br /&gt;The newly added &lt;tt&gt;path&lt;/tt&gt; attribute points to&lt;br /&gt;the &lt;tt&gt;&lt;font color="#0000FF"&gt;sales&lt;/font&gt;&lt;/tt&gt; directory under &lt;tt&gt;$CATALINA_BASE/webapps&lt;/tt&gt; which is the location for the new application.&lt;br /&gt;And the &lt;tt&gt;docBase&lt;/tt&gt; attribute is set to &lt;tt&gt;mysales&lt;/tt&gt; &lt;br /&gt;which stands for the application name within the URL, i.e. "&lt;tt&gt;http://localhost/&lt;font color="#0000FF"&gt;mysales&lt;/font&gt;&lt;/tt&gt;" or "&lt;tt&gt;http://localhost:8080/mysales&lt;/tt&gt;".&lt;br /&gt;Make sure to add this new &lt;tt&gt;Context&lt;/tt&gt; element inside the &lt;tt&gt;Host&lt;/tt&gt; container element for '&lt;tt&gt;localhost&lt;/tt&gt;' which is the default host name.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;b&gt;&lt;a name="HomePageForWebApplication"&gt;Home Page for Web Application&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;To have a starting page for the new web application, you can simply create and add a &lt;tt&gt;index.html&lt;/tt&gt; file under the web application's root directory&lt;br /&gt;&lt;tt&gt;$CATALINA_BASE/webapps/sales&lt;/tt&gt; (&lt;tt&gt;/opt/tomcat-instance/sales.example.com/webapps/sales&lt;/tt&gt;).&lt;br /&gt;You could also create your own JSP page here.&lt;br /&gt;For testing purposes here is a simple &lt;tt&gt;index.html&lt;/tt&gt; example for the new application:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;$ &lt;font color="#0000FF"&gt;cat &amp;gt; $CATALINA_BASE/webapps/sales/index.html &amp;lt;&amp;lt; EOF&lt;br /&gt;&amp;lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&lt;br /&gt;"http://www.w3.org/TR/html4/loose.dtd"&amp;gt;&lt;br /&gt;&amp;lt;HTML&amp;gt;&lt;br /&gt;&amp;lt;HEAD&amp;gt;&amp;lt;META http-equiv=Content-Type content="text/html"&amp;gt;&amp;lt;/HEAD&amp;gt;&lt;br /&gt;&amp;lt;BODY&amp;gt;&lt;br /&gt;&amp;lt;H3&amp;gt;Apache Tomcat &lt;b&gt;Sales&lt;/b&gt; Home Page&amp;lt;/H3&amp;gt;&lt;br /&gt;&amp;lt;/BODY&amp;gt;&lt;br /&gt;&amp;lt;/HTML&amp;gt;&lt;br /&gt;EOF&lt;/font&gt; &lt;br /&gt;$&lt;br /&gt;&lt;/pre&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;b&gt;&lt;a name="RestartingFirstTomcatInstance"&gt;Restarting First Tomcat Instance&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;Now check whether the new web application has been configured correctly.&lt;br /&gt;To do that, run the following commands to restart the new Tomcat JVM instance:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;$ &lt;font color="#0000FF"&gt;source /opt/tomcat-instance/sales.env&lt;/font&gt; &lt;br /&gt;$ &lt;font color="#0000FF"&gt;$CATALINA_HOME/bin/shutdown.sh&lt;/font&gt; &lt;br /&gt;$ &lt;font color="#0000FF"&gt;$CATALINA_HOME/bin/startup.sh&lt;/font&gt; &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;If everything was configured correctly, you should now see the default home page for the new web application when&lt;br /&gt;opening the URL &lt;font color="#0000FF"&gt;&lt;tt&gt;http://localhost/&lt;b&gt;mysales&lt;/b&gt;&lt;/tt&gt;&lt;/font&gt; or &lt;tt&gt;http://localhost/mysales:8080&lt;/tt&gt;.&lt;br /&gt;Instead of &lt;tt&gt;localhost&lt;/tt&gt; you should also be able to use the name of your server. &lt;br /&gt;If you get the error '&lt;tt&gt;java.net.ConnectException: Connection refused&lt;/tt&gt;' when you shutdown Tomcat, then Tomcat&lt;br /&gt;was probably not running.&lt;br /&gt;If you don't see the home page, check the log files under &lt;tt&gt;$CATALINA_BASE/logs&lt;/tt&gt;.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h2&gt;&lt;font color="#0000FF"&gt;&lt;u&gt;&lt;a name="DeployingJavaServletForWebApplicationInFirstTomcatJVMInstance"&gt;Deploying Java Servlet for Web Application in First Tomcat JVM Instance&lt;/a&gt;&lt;/u&gt;&lt;/font&gt;&lt;/h2&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;b&gt;&lt;a name="SettingUpJavaServletLayout"&gt;Setting up Java Servlet Layout&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;To follow the Java Servlet Specification for the new "sales" web application, I created the &lt;tt&gt;class&lt;/tt&gt; directory for the Java class files&lt;br /&gt;under the new directory &lt;tt&gt;$CATALINA_BASE/webapps/sales/WEB-INF&lt;/tt&gt;, see also&lt;br /&gt;&lt;a href="http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/WebComponents3.html"&gt;Packaging Web Components&lt;/a&gt;.&lt;br /&gt;The &lt;tt&gt;WEB-INF&lt;/tt&gt; directory is protected from access by browsers, meaning they are unbrowsable and safe from client views.&lt;br /&gt; &lt;br /&gt;The &lt;tt&gt;classes&lt;/tt&gt; directory under &lt;tt&gt;WEB-INF&lt;/tt&gt; is where web components and server-side utility classes should go.&lt;br /&gt;To create the &lt;tt&gt;WEB-INF&lt;/tt&gt; and &lt;tt&gt;classes&lt;/tt&gt; directories, run the following command:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;$ &lt;font color="#0000FF"&gt;mkdir -p $CATALINA_BASE/webapps/sales/WEB-INF/classes&lt;/font&gt; &lt;br /&gt; &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;b&gt;&lt;a name="JARFiles"&gt;JAR Files&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;Most Java servlets also need JAR (Java ARchive) files which should be put under the &lt;tt&gt;lib&lt;/tt&gt; directory.&lt;br /&gt;Since it's a good practice to keep the application separate from the Tomcat distribution directory tree, I created &lt;br /&gt;a new &lt;tt&gt;lib&lt;/tt&gt; directory under &lt;tt&gt;$CATALINA_BASE/webapps/sales/WEB-INF&lt;/tt&gt; which is consistent with&lt;br /&gt;&lt;a href="http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/WebComponents3.html"&gt;WAR's hierarchical directory structure&lt;/a&gt;.&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;$ &lt;font color="#0000FF"&gt;mkdir $CATALINA_BASE/webapps/sales/WEB-INF/lib&lt;/font&gt; &lt;br /&gt; &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;The Java servlet example below requires the &lt;tt&gt;servlet-api.jar&lt;/tt&gt; JAR file. This JAR is already available in the Tomcat distribution directory tree &lt;tt&gt;$CATALINA_HOME/lib&lt;/tt&gt;.&lt;br /&gt;You could copy this JAR file to the application's new lib directory &lt;tt&gt;$CATALINA_BASE/webapps/sales/WEB-INF/lib&lt;/tt&gt;, but then you would get the following&lt;br /&gt;warning in the &lt;tt&gt;$CATALINA_BASE/logs/catalina.out&lt;/tt&gt; log file when you startup Tomcat:&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;tt&gt;&lt;font color="#FF0000"&gt;INFO: validateJarFile(/opt/tomcat-instance/sales.example.com/webapps/sales/WEB-INF/lib/servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class&lt;/font&gt; &lt;br /&gt;&lt;/tt&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;Tomcat shows this warning since it tries now to load the JAR file twice, first from &lt;tt&gt;$CATALINA_HOME/lib&lt;/tt&gt; and then from &lt;tt&gt;$CATALINA_BASE/webapps/sales/WEB-INF/lib&lt;/tt&gt;.&lt;br /&gt;Even though it's not going to be a problem for Tomcat, it's better not to keep JARs in two places. Since the  &lt;tt&gt;servlet-api.jar&lt;/tt&gt; JAR file already exists&lt;br /&gt;in the Tomcat distribution directory, I did not copy it to the &lt;tt&gt;$CATALINA_BASE/webapps/sales/WEB-INF/lib&lt;/tt&gt; directory.&lt;br /&gt;I use this directory for application specific JARs that don't come with the Tomcat distribution.&lt;br /&gt;You could also remove the JAR in &lt;tt&gt;$CATALINA_HOME/lib&lt;/tt&gt; but remember that it will reappier the next time you upgrade the Tomcat software.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;b&gt;&lt;a name="CreatingAJavaServlet"&gt;Creating a Java Servlet&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;Since server-side classes are supposed to go to the &lt;tt&gt;WEB-INF/classes&lt;/tt&gt; directory, I created the following class file example under&lt;br /&gt;&lt;tt&gt;$CATALINA_BASE/webapps/sales/WEB-INF/classes&lt;/tt&gt; (&lt;tt&gt;/opt/tomcat-instance/sales.example.com/webapps/sales/WEB-INF/classes&lt;/tt&gt;) and saved it&lt;br /&gt;as &lt;tt&gt;Sales.java&lt;/tt&gt;:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;$ &lt;font color="#0000FF"&gt;cat $CATALINA_BASE/webapps/sales/WEB-INF/classes/Sales.java&lt;/font&gt; &lt;br /&gt;import java.io.*;&lt;br /&gt;import javax.servlet.*;&lt;br /&gt;import javax.servlet.http.*;&lt;br /&gt; &lt;br /&gt;public class Sales extends HttpServlet {&lt;br /&gt; &lt;br /&gt;    public void doGet(HttpServletRequest request, HttpServletResponse response)&lt;br /&gt;    throws IOException, ServletException&lt;br /&gt;    {&lt;br /&gt;        response.setContentType("text/html");&lt;br /&gt;        PrintWriter out = response.getWriter();&lt;br /&gt;        out.println("&amp;lt;html&amp;gt;");&lt;br /&gt;        out.println("&amp;lt;head&amp;gt;");&lt;br /&gt;        out.println("&amp;lt;title&amp;gt;&lt;b&gt;Sales&lt;/b&gt; Page&amp;lt;/title&amp;gt;");&lt;br /&gt;        out.println("&amp;lt;/head&amp;gt;");&lt;br /&gt;        out.println("&amp;lt;body&amp;gt;");&lt;br /&gt;        out.println("&amp;lt;h1&amp;gt;Executing Sales ...&amp;lt;/h1&amp;gt;");&lt;br /&gt;        out.println("&amp;lt;/body&amp;gt;");&lt;br /&gt;        out.println("&amp;lt;/html&amp;gt;");&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;To compile the new Java servlet, the &lt;tt&gt;servlet-api.jar&lt;/tt&gt; JAR file is needed which can be specified with either&lt;br /&gt;the &lt;tt&gt;-classpath&lt;/tt&gt; option or the &lt;tt&gt;CLASSPATH&lt;/tt&gt; environment variable. The &lt;tt&gt;-classpath&lt;/tt&gt; option for SDK tools is preferred &lt;br /&gt;over the &lt;tt&gt;CLASSPATH&lt;/tt&gt; environment variable since it can be set individually for each application without affecting others.&lt;br /&gt;In the following example I specify the path of the &lt;tt&gt;class&lt;/tt&gt; directory with the basename '&lt;tt&gt;*&lt;/tt&gt;'&lt;br /&gt;(if you are unfamiliar with basename, see '&lt;tt&gt;man basename&lt;/tt&gt;').&lt;br /&gt;This is equivalent to specifying all files with the extensions .jar or .JAR files in the directory and therefore individual JAR files like&lt;br /&gt;&lt;tt&gt;servlet-api.jar&lt;/tt&gt; don't need to be specified.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;The following command should now compile the Java servlet without errors:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;$ &lt;font color="#0000FF"&gt;cd $CATALINA_BASE/webapps/sales/WEB-INF/classes&lt;/font&gt; &lt;br /&gt;$ &lt;font color="#0000FF"&gt;javac -classpath "$CATALINA_HOME/lib/*" Sales.java&lt;/font&gt; &lt;br /&gt;$ &lt;font color="#0000FF"&gt;ls&lt;/font&gt; &lt;br /&gt;Sales.class  Sales.java&lt;br /&gt;$&lt;br /&gt; &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;b&gt;&lt;a name="ConfiguringTheJavaServlet"&gt;Configuring the Java Servlet&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;To configure servlets and other components for an application, an XML file called &lt;tt&gt;web.xml&lt;/tt&gt; needs to be configured.&lt;br /&gt;The format of this file is defined in the Java Servlet Specification. In Tomcat, this file exists in two place:&lt;br /&gt;&lt;pre&gt;  $CATALINA_BASE/conf/web.xml&lt;br /&gt;  $CATALINA_BASE/webapps/{your-appname}/WEB-INF/web.xml&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;The first one is the default &lt;tt&gt;web.xml&lt;/tt&gt; file which is the base for all web applications in a Tomcat JVM instance,&lt;br /&gt;and the latter one is for the web application where &lt;tt&gt;WEB-INF&lt;/tt&gt; resides for overwriting application specific settings.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;For the newly created Java servlet "Sales" I created a new &lt;tt&gt;web.xml&lt;/tt&gt; file under &lt;tt&gt;$CATALINA_BASE/webapps/sales/WEB-INF&lt;/tt&gt;:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;$ &lt;font color="#0000FF"&gt;cat $CATALINA_BASE/webapps/sales/WEB-INF/web.xml&lt;/font&gt; &lt;br /&gt;&amp;lt;?xml version="1.0" encoding="ISO-8859-1"?&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;web-app xmlns="http://java.sun.com/xml/ns/javaee"&lt;br /&gt;    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&lt;br /&gt;    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&lt;br /&gt;    version="2.5"&amp;gt;&lt;br /&gt; &lt;br /&gt;  &amp;lt;servlet&amp;gt;&lt;br /&gt;    &amp;lt;servlet-name&amp;gt;&lt;b&gt;servlet_sales&lt;/b&gt;&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;    &amp;lt;servlet-class&amp;gt;&lt;b&gt;Sales&lt;/b&gt;&amp;lt;/servlet-class&amp;gt;&lt;br /&gt;  &amp;lt;/servlet&amp;gt;&lt;br /&gt; &lt;br /&gt;  &amp;lt;servlet-mapping&amp;gt;&lt;br /&gt;    &amp;lt;servlet-name&amp;gt;&lt;b&gt;servlet_sales&lt;/b&gt;&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;    &amp;lt;url-pattern&amp;gt;&lt;b&gt;/execute&lt;/b&gt;&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;  &amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;/web-app&amp;gt;&lt;br /&gt; &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;For each servlet there is a &lt;tt&gt;&amp;lt;servlet&amp;gt;&lt;/tt&gt; element.&lt;br /&gt;It identifies the servlet name (&lt;tt&gt;&amp;lt;servlet-name&amp;gt;&lt;/tt&gt;) and the Java class name &lt;tt&gt;(&amp;lt;servlet-class&amp;gt;)&lt;/tt&gt;.&lt;br /&gt;The servlet mapping (&lt;tt&gt;&amp;lt;servlet-mapping&amp;gt;&lt;/tt&gt;) maps a URI to the servlet name (&lt;tt&gt;&amp;lt;servlet-name&amp;gt;&lt;/tt&gt;).&lt;br /&gt;In the above example "&lt;tt&gt;/execute&lt;/tt&gt;" in "&lt;tt&gt;http://localhost:8080/mysales/execute&lt;/tt&gt;" maps to "&lt;tt&gt;servlet_sales&lt;/tt&gt;" which points to the "&lt;tt&gt;Sales&lt;/tt&gt;" servlet class.&lt;br /&gt;Note that the order of these elements is important.&lt;br /&gt;So when you open the URL "&lt;tt&gt;http://localhost:8080/mysales/execute&lt;/tt&gt;", the "&lt;tt&gt;Sales&lt;/tt&gt;" Java servlet will be executed.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;In the following example I updated the &lt;tt&gt;$CATALINA_BASE/webapps/sales/index.html&lt;/tt&gt; file to provide an&lt;br /&gt;entry point to the new Java servlet:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;$ &lt;font color="#0000FF"&gt;cat $CATALINA_BASE/webapps/sales/index.html&lt;/font&gt; &lt;br /&gt;&amp;lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&lt;br /&gt;"http://www.w3.org/TR/html4/loose.dtd"&amp;gt;&lt;br /&gt;&amp;lt;HTML&amp;gt;&lt;br /&gt;&amp;lt;HEAD&amp;gt;&amp;lt;META http-equiv=Content-Type content="text/html"&amp;gt;&amp;lt;/HEAD&amp;gt;&lt;br /&gt;&amp;lt;BODY&amp;gt;&lt;br /&gt;&amp;lt;H3&amp;gt;Apache Tomcat Sales Home Page&amp;lt;/H3&amp;gt;&lt;br /&gt;&lt;font color="#0000FF"&gt;&amp;lt;a href="/mysales/execute"&amp;gt;Execute Sales&amp;lt;/a&amp;gt;&lt;/font&gt; &lt;br /&gt;&amp;lt;/BODY&amp;gt;&lt;br /&gt;&amp;lt;/HTML&amp;gt;&lt;br /&gt;$&lt;br /&gt;&lt;/pre&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;b&gt;&lt;a name="TestingAndExecutingTheJavaServlet"&gt;Testing and Executing the Java Servlet&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;Note that if you run &lt;tt&gt;javac&lt;/tt&gt; with the &lt;tt&gt;-classpath&lt;/tt&gt; option or the &lt;tt&gt;CLASSPATH&lt;/tt&gt; environment variable in the same shell before you startup Tomcat,&lt;br /&gt;you will get &lt;tt&gt;&lt;font color="#FF0000"&gt;java.lang.NoClassDefFoundError&lt;/font&gt;&lt;/tt&gt; / &lt;tt&gt;&lt;font color="#FF0000"&gt;java.lang.ClassNotFoundException&lt;/font&gt;&lt;/tt&gt; &lt;br /&gt;errors in your browser when you execute a servlet. To avoid this, simply re-login as the &lt;tt&gt;tomcat&lt;/tt&gt; user before you startup Tomcat:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;# &lt;font color="#0000FF"&gt;su - -s /bin/sh tomcat&lt;/font&gt; &lt;br /&gt;$ &lt;font color="#0000FF"&gt;source /opt/tomcat-instance/sales.env&lt;/font&gt; &lt;br /&gt;$ &lt;font color="#0000FF"&gt;$CATALINA_HOME/bin/shutdown.sh&lt;/font&gt; &lt;br /&gt;$ &lt;font color="#0000FF"&gt;$CATALINA_HOME/bin/startup.sh&lt;/font&gt; &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;After Tomcat restarted, open the URL &lt;tt&gt;&lt;font color="#0000FF"&gt;http://localhost/mysales&lt;/font&gt;&lt;/tt&gt; (or use the server name instead of &lt;tt&gt;localhost&lt;/tt&gt;) and you should see the "Execute Sales" link.&lt;br /&gt;Clicking on this link should invoke the Java servlet and display "Executing Sales" in your browser.&lt;br /&gt;If you are presented with an empty page instead, review the above steps and make sure you didn't miss a step.&lt;br /&gt;Check also the log files under &lt;tt&gt;$CATALINA_BASE/logs&lt;/tt&gt;.&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h2&gt;&lt;font color="#0000FF"&gt;&lt;u&gt;&lt;a name="SettingUpSecondTomcatJVMInstance"&gt;Setting Up Second Tomcat JVM Instance&lt;/a&gt;&lt;/u&gt;&lt;/font&gt;&lt;/h2&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;b&gt;&lt;a name="SettingUpSecondTomcatJVMInstanceGeneral"&gt;General&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;If you've gone through all the previous steps in this HOWTO, then the following steps should be very easy to follow and to understand&lt;br /&gt;without much explanations. Therefore, I'll provide here just the steps for setting up a second Tomcat JVM instance and&lt;br /&gt;an application called "Order".&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;b&gt;&lt;a name="StepsForSecondTomcatJVMInstanceAndApplication"&gt;Steps for Second Tomcat JVM Instance and Application&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;Login as root and execute the following steps to setup the second Tomcat JVM instance:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;# &lt;font color="#0000FF"&gt;mkdir -p /opt/tomcat-instance/order.example.com&lt;/font&gt; &lt;br /&gt;# &lt;font color="#0000FF"&gt;cd /opt/tomcat-instance/order.example.com&lt;/font&gt; &lt;br /&gt;#&lt;br /&gt;# &lt;font color="#0000FF"&gt;cp -a /var/lib/apache-tomcat-6.0.18/conf &lt;b&gt;.&lt;/b&gt;&lt;/font&gt; &lt;br /&gt;# &lt;font color="#0000FF"&gt;mkdir common logs temp server shared webapps work&lt;/font&gt; &lt;br /&gt;#&lt;br /&gt;# &lt;font color="#0000FF"&gt;chown -R tomcat.tomcat /opt/tomcat-instance/order.example.com&lt;/font&gt; &lt;br /&gt;#&lt;br /&gt;# &lt;font color="#0000FF"&gt;su - -s /bin/sh tomcat&lt;/font&gt; &lt;br /&gt;$ &lt;font color="#0000FF"&gt;cat &gt; /opt/tomcat-instance/order.env &lt;&lt; EOF&lt;br /&gt;export JAVA_HOME=/usr/java/jdk1.6.0_10&lt;br /&gt;export PATH=\$JAVA_HOME/bin:\$PATH&lt;br /&gt;export CATALINA_HOME=/var/lib/apache-tomcat-6.0.18&lt;br /&gt;export CATALINA_BASE=/opt/tomcat-instance/order.example.com&lt;br /&gt;EOF&lt;/font&gt; &lt;br /&gt;$&lt;br /&gt;$ &lt;font color="#0000FF"&gt;source /opt/tomcat-instance/order.env&lt;/font&gt; &lt;br /&gt;$&lt;br /&gt; &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;For the second Tomcat JVM instance the default port numbers need to be changed in &lt;tt&gt;&lt;font color="#0000FF"&gt;$CATALINA_BASE/conf/server.xml&lt;/font&gt;&lt;/tt&gt; &lt;br /&gt;(&lt;tt&gt;/opt/tomcat-instance/order.example.com/conf/server.xml&lt;/tt&gt;).&lt;br /&gt;In the following example I increased the port numbers by one:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;    &amp;lt;Server port="&lt;font color="#0000FF"&gt;8006&lt;/font&gt;" shutdown="SHUTDOWN"&amp;gt;&lt;br /&gt; &lt;br /&gt;    &amp;lt;Connector port="&lt;font color="#0000FF"&gt;8081&lt;/font&gt;" protocol="HTTP/1.1"&lt;br /&gt;               connectionTimeout="20000"&lt;br /&gt;               redirectPort="&lt;font color="#0000FF"&gt;8444&lt;/font&gt;" /&amp;gt;&lt;br /&gt; &lt;br /&gt;    &amp;lt;Connector port="&lt;font color="#0000FF"&gt;8010&lt;/font&gt;" protocol="AJP/1.3" redirectPort="&lt;font color="#0000FF"&gt;8444&lt;/font&gt;" /&amp;gt;&lt;br /&gt; &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;Create a new application root directory:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;$ &lt;font color="#0000FF"&gt;mkdir $CATALINA_BASE/webapps/order&lt;/font&gt; &lt;br /&gt; &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;To configure the new web application, edit &lt;font color="#0000FF"&gt;&lt;tt&gt;$CATALINA_BASE/conf/server.xml&lt;/tt&gt;&lt;/font&gt; &lt;br /&gt;(&lt;tt&gt;/opt/tomcat-instance/order.example.com/conf/server.xml&lt;/tt&gt;) and add the following entry in blue:&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;pre&gt; &lt;br /&gt;      &amp;lt;Host name="localhost"  appBase="webapps"&lt;br /&gt;            unpackWARs="true" autoDeploy="true"&lt;br /&gt;            xmlValidation="false" xmlNamespaceAware="false"&amp;gt;&lt;br /&gt; &lt;br /&gt;        &lt;font color="#0000FF"&gt;&amp;lt;Context docBase="order" path="/myorder"/&amp;gt;&lt;/font&gt; &lt;br /&gt; &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;Create a new home page for the new "Order" application and include a link to the Java servlet that will be setup next:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;$ &lt;font color="#0000FF"&gt;cat &amp;gt; $CATALINA_BASE/webapps/order/index.html &amp;lt;&amp;lt; EOF&lt;br /&gt;&amp;lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&lt;br /&gt;"http://www.w3.org/TR/html4/loose.dtd"&amp;gt;&lt;br /&gt;&amp;lt;HTML&amp;gt;&lt;br /&gt;&amp;lt;HEAD&amp;gt;&amp;lt;META http-equiv=Content-Type content="text/html"&amp;gt;&amp;lt;/HEAD&amp;gt;&lt;br /&gt;&amp;lt;BODY&amp;gt;&lt;br /&gt;&amp;lt;H3&amp;gt;Apache Tomcat &lt;b&gt;Order&lt;/b&gt; Home Page&amp;lt;/H3&amp;gt;&lt;br /&gt;&lt;font color="#0000FF"&gt;&amp;lt;a href="/myorder/execute"&amp;gt;Execute &lt;b&gt;Order&lt;/b&gt;&amp;lt;/a&amp;gt;&lt;/font&gt; &lt;br /&gt;&amp;lt;/BODY&amp;gt;&lt;br /&gt;&amp;lt;/HTML&amp;gt;&lt;br /&gt;EOF&lt;/font&gt; &lt;br /&gt;$&lt;br /&gt; &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;Now setup and create a new Java servlet:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;$ &lt;font color="#0000FF"&gt;mkdir -p $CATALINA_BASE/webapps/order/WEB-INF/classes&lt;/font&gt; &lt;br /&gt;$ &lt;font color="#0000FF"&gt;mkdir $CATALINA_BASE/webapps/order/WEB-INF/lib&lt;/font&gt; &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;&lt;pre&gt;$ &lt;font color="#0000FF"&gt;cat $CATALINA_BASE/webapps/order/WEB-INF/classes/Order.java&lt;/font&gt; &lt;br /&gt;import java.io.*;&lt;br /&gt;import javax.servlet.*;&lt;br /&gt;import javax.servlet.http.*;&lt;br /&gt; &lt;br /&gt;public class Order extends HttpServlet {&lt;br /&gt; &lt;br /&gt;    public void doGet(HttpServletRequest request, HttpServletResponse response)&lt;br /&gt;    throws IOException, ServletException&lt;br /&gt;    {&lt;br /&gt;        response.setContentType("text/html");&lt;br /&gt;        PrintWriter out = response.getWriter();&lt;br /&gt;        out.println("&amp;lt;html&amp;gt;");&lt;br /&gt;        out.println("&amp;lt;head&amp;gt;");&lt;br /&gt;        out.println("&amp;lt;title&amp;gt;&lt;b&gt;Order&lt;/b&gt; Page&amp;lt;/title&amp;gt;");&lt;br /&gt;        out.println("&amp;lt;/head&amp;gt;");&lt;br /&gt;        out.println("&amp;lt;body&amp;gt;");&lt;br /&gt;        out.println("&amp;lt;h1&amp;gt;Executing &lt;b&gt;Order&lt;/b&gt; ...&amp;lt;/h1&amp;gt;");&lt;br /&gt;        out.println("&amp;lt;/body&amp;gt;");&lt;br /&gt;        out.println("&amp;lt;/html&amp;gt;");&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;Compile the new Java servlet:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;$ &lt;font color="#0000FF"&gt;cd $CATALINA_BASE/webapps/order/WEB-INF/classes&lt;/font&gt; &lt;br /&gt;$ &lt;font color="#0000FF"&gt;javac -classpath "$CATALINA_HOME/lib/*" Order.java&lt;/font&gt; &lt;br /&gt;$ &lt;font color="#0000FF"&gt;ls&lt;/font&gt; &lt;br /&gt;Order.class  Order.java&lt;br /&gt;$&lt;br /&gt; &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;Configure the Java servlet:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;$ &lt;font color="#0000FF"&gt;cat $CATALINA_BASE/webapps/order/WEB-INF/web.xml&lt;/font&gt; &lt;br /&gt;&amp;lt;?xml version="1.0" encoding="ISO-8859-1"?&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;web-app xmlns="http://java.sun.com/xml/ns/javaee"&lt;br /&gt;    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&lt;br /&gt;    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&lt;br /&gt;    version="2.5"&amp;gt;&lt;br /&gt; &lt;br /&gt;  &amp;lt;servlet&amp;gt;&lt;br /&gt;    &amp;lt;servlet-name&amp;gt;&lt;b&gt;servlet_order&lt;/b&gt;&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;    &amp;lt;servlet-class&amp;gt;&lt;b&gt;Order&lt;/b&gt;&amp;lt;/servlet-class&amp;gt;&lt;br /&gt;  &amp;lt;/servlet&amp;gt;&lt;br /&gt; &lt;br /&gt;  &amp;lt;servlet-mapping&amp;gt;&lt;br /&gt;    &amp;lt;servlet-name&amp;gt;&lt;b&gt;servlet_order&lt;/b&gt;&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;    &amp;lt;url-pattern&amp;gt;&lt;b&gt;/execute&lt;/b&gt;&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;  &amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;/web-app&amp;gt;&lt;br /&gt; &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;Now make sure to relogin as &lt;tt&gt;tomcat&lt;/tt&gt; and start the second Tomcat JVM instance:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;# &lt;font color="#0000FF"&gt;su - -s /bin/sh tomcat&lt;/font&gt; &lt;br /&gt;$ &lt;font color="#0000FF"&gt;source /opt/tomcat-instance/order.env&lt;/font&gt; &lt;br /&gt;$ &lt;font color="#0000FF"&gt;$CATALINA_HOME/bin/startup.sh&lt;/font&gt; &lt;br /&gt; &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;After the second Tomcat JVM restarted, open the URL &lt;tt&gt;&lt;font color="#0000FF"&gt;http://localhost:&lt;b&gt;8081&lt;/b&gt;/&lt;b&gt;myorder&lt;/b&gt;&lt;/font&gt;&lt;/tt&gt; &lt;br /&gt;(or use the server name instead of &lt;tt&gt;localhost&lt;/tt&gt;) and you should see the "Execute Order" link.&lt;br /&gt;Clicking on this link should invoke the Java servlet and display "Executing Order" in your browser.&lt;br /&gt;If you are presented with an empty page instead, review the above steps and make sure you didn't miss a step.&lt;br /&gt;Check also the log files under &lt;tt&gt;$CATALINA_BASE/logs&lt;/tt&gt;.&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h2&gt;&lt;font color="#0000FF"&gt;&lt;u&gt;&lt;a name="BibliographyAndReferences"&gt;Bibliography and References&lt;/a&gt;&lt;/u&gt;&lt;/font&gt;&lt;/h2&gt; &lt;br /&gt; &lt;br /&gt;&lt;a href="http://tomcat.apache.org/"&gt; &lt;br /&gt;Apache Tomcat&lt;/a&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;a href="http://www.bookpool.com/sm/0596101066"&gt; &lt;br /&gt;Tomcat: The Definitive Guide, 2nd Edition&lt;/a&gt; &lt;br /&gt; &lt;br /&gt;&lt;/body&gt; &lt;br /&gt;&lt;/html&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-4598483106155043273?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/4598483106155043273/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=4598483106155043273&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/4598483106155043273'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/4598483106155043273'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/07/installing-apache-tomcat-on-linux.html' title='Installing Apache Tomcat on Linux'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-8636543733535037328</id><published>2009-07-03T15:02:00.000+05:30</published><updated>2009-07-03T15:03:20.310+05:30</updated><title type='text'>Simple Tomcat Startup Script</title><content type='html'>Simple Tomcat Startup Script:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#!/bin/sh&lt;br /&gt;# Tomcat Startup Script&lt;br /&gt;&lt;br /&gt;CATALINA_HOME=/mnt/apache-tomcat-6.0.20; export CATALINA_HOME&lt;br /&gt;JAVA_HOME=/usr/java/jdk1.6.0_06; export JAVA_HOME&lt;br /&gt;TOMCAT_OWNER=tomcat; export TOMCAT_OWNER&lt;br /&gt;&lt;br /&gt;start() {&lt;br /&gt;        echo -n "Starting Tomcat:  "&lt;br /&gt;        su -p -s /bin/sh tomcat $CATALINA_HOME/bin/startup.sh&lt;br /&gt;        sleep 2&lt;br /&gt;}&lt;br /&gt;stop() {&lt;br /&gt;        echo -n "Stopping Tomcat: "&lt;br /&gt;        su -p -s /bin/sh tomcat $CATALINA_HOME/bin/shutdown.sh&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;# See how we were called.&lt;br /&gt;case "$1" in&lt;br /&gt;  start)&lt;br /&gt;        start&lt;br /&gt;        ;;&lt;br /&gt;  stop)&lt;br /&gt;        stop&lt;br /&gt;        ;;&lt;br /&gt;  restart)&lt;br /&gt;        stop&lt;br /&gt;        start&lt;br /&gt;        ;;&lt;br /&gt;  *)&lt;br /&gt;        echo $"Usage: tomcat {start|stop|restart}"&lt;br /&gt;        exit&lt;br /&gt;esac&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-8636543733535037328?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/8636543733535037328/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=8636543733535037328&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/8636543733535037328'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/8636543733535037328'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/07/simple-tomcat-startup-script.html' title='Simple Tomcat Startup Script'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-7770136553265285880</id><published>2009-06-04T23:52:00.000+05:30</published><updated>2009-06-04T23:53:47.370+05:30</updated><title type='text'>Paes-Dlouhy in French Open final</title><content type='html'>Leander Paes and Lucas Dlouhy entered the final of the men's doubles at the French Open after a thrilling victory over top seeds Daniel Nestor and Nenad Zimonjic in the semi-finals on Thursday.&lt;br /&gt;&lt;br /&gt;The Indo-Czech pair needed two tie-breakers to quell the challenge of the Canadian-Serbian duo and emerge 7-6(4), 7-6(5) winners, and set up a meeting with South Africa's Wesley Moodie and Belgium's Dick Norman in the final.&lt;br /&gt;&lt;br /&gt;This will be Paes's third French Open doubles final. On the earlier occasions, in 1999 and 2001, he went on to win the title with estranged partner Mahesh Bhupathi.&lt;br /&gt;&lt;br /&gt;Unseeded Moodie-Norman staged a grand recovery after losing the first set 0-6 to shock the United States' Bryan twins Bob and Mike, seeded second, 0-6, 7-6 (5), 6-4 in the first semi-final.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-7770136553265285880?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/7770136553265285880/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=7770136553265285880&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/7770136553265285880'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/7770136553265285880'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/06/paes-dlouhy-in-french-open-final.html' title='Paes-Dlouhy in French Open final'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-5830409070821564921</id><published>2009-05-14T00:32:00.000+05:30</published><updated>2009-05-14T00:34:31.424+05:30</updated><title type='text'>Mostly used Practises to Speed up your website</title><content type='html'>&lt;h3 id="num_http"&gt;Minimize HTTP Requests&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: content&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;80% of the end-user response time is spent on the front-end. Most of this time is tied up in downloading all the components in the page: images, stylesheets, scripts, Flash, etc. Reducing the number of components in turn reduces the number of HTTP requests required to render the page. This is the key to faster pages. &lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;One way to reduce the number of components in the page is to simplify the page's design. But is there a way to build pages with richer content while also achieving fast response times? Here are some techniques for reducing the number of HTTP requests, while still supporting rich page designs.&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;&lt;strong&gt;Combined files&lt;/strong&gt; are a way to reduce the number of HTTP requests by combining all scripts into a single script, and similarly combining all CSS into a single stylesheet. Combining files is more challenging when the scripts and stylesheets vary from page to page, but making this part of your release process improves response times.&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="http://alistapart.com/articles/sprites"&gt;&lt;strong&gt;CSS Sprites&lt;/strong&gt;&lt;/a&gt; are the preferred method for reducing the number of image requests. Combine your background images into a single image and use the CSS &lt;code&gt;background-image&lt;/code&gt; and &lt;code&gt;background-position&lt;/code&gt; properties to display the desired image segment.&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="http://www.w3.org/TR/html401/struct/objects.html#h-13.6"&gt;&lt;strong&gt;Image maps&lt;/strong&gt;&lt;/a&gt; combine multiple images into a single image. The overall size is about the same, but reducing the number of HTTP requests speeds up the page. Image maps only work if the images are contiguous in the page, such as a navigation bar. Defining the coordinates of image maps can be tedious and error prone. Using image maps for navigation is not accessible too, so it's not recommended.&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;&lt;strong&gt;Inline images&lt;/strong&gt; use the &lt;a href="http://tools.ietf.org/html/rfc2397"&gt;&lt;code&gt;data:&lt;/code&gt; URL scheme&lt;/a&gt; to embed the image data in the actual page. This can increase the size of your HTML document. Combining inline images into your (cached) stylesheets is a way to reduce HTTP requests and avoid increasing the size of your pages. Inline images are not yet supported across all major browsers.&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;Reducing the number of HTTP requests in your page is the place to start. This is the most important guideline for improving performance for first time visitors. As described in Tenni Theurer's blog post &lt;a href="http://yuiblog.com/blog/2007/01/04/performance-research-part-2/"&gt;Browser Cache Usage - Exposed!&lt;/a&gt;, 40-60% of daily visitors to your site come in with an empty cache. Making your page fast for these first time visitors is key to a better user experience.&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt; | &lt;a href="http://developer.yahoo.net/blog/archives/2007/04/rule_1_make_few.html"&gt;discuss this rule&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="cdn"&gt;Use a Content Delivery Network&lt;/h3&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: server&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;The user's proximity to your web server has an impact on response times. Deploying your content across multiple, geographically dispersed servers will make your pages load faster from the user's perspective. But where should you start?&lt;/p&gt; &lt;br /&gt;&lt;p&gt;As a first step to implementing geographically dispersed content, don't attempt to redesign your web application to work in a distributed architecture. Depending on the application, changing the architecture could include daunting tasks such as synchronizing session state and replicating database transactions across server locations. Attempts to reduce the distance between users and your content could be delayed by, or never pass, this application architecture step. &lt;/p&gt; &lt;br /&gt;&lt;p&gt;Remember that 80-90% of the end-user response time is spent downloading all the components in the page: images, stylesheets, scripts, Flash, etc. This is the &lt;em&gt;Performance Golden Rule&lt;/em&gt;. Rather than starting with the difficult task of redesigning your application architecture, it's better to first disperse your static content. This not only achieves a bigger reduction in response times, but it's easier thanks to content delivery networks.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;A content delivery network (CDN) is a collection of web servers distributed across multiple locations to deliver content more efficiently to users. The server selected for delivering content to a specific user is typically based on a measure of network proximity. For example, the server with the fewest network hops or the server with the quickest response time is chosen.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;Some large Internet companies own their own CDN, but it's cost-effective to use a CDN service provider, such as &lt;a href="http://www.akamai.com/"&gt;Akamai Technologies&lt;/a&gt;, &lt;a href="http://www.mirror-image.com/"&gt;Mirror Image Internet&lt;/a&gt;, or &lt;a href="http://www.limelightnetworks.com/"&gt;Limelight Networks&lt;/a&gt;. For start-up companies and private web sites, the cost of a CDN service can be prohibitive, but as your target audience grows larger and becomes more global, a CDN is necessary to achieve fast response times. At Yahoo!, properties that moved static content off their application web servers to a CDN improved end-user response times by 20% or more. Switching to a CDN is a relatively easy code change that will dramatically improve the speed of your web site.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt; | &lt;a href="http://developer.yahoo.net/blog/archives/2007/04/high_performanc_1.html"&gt;discuss this rule&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="expires"&gt;Add an Expires or a Cache-Control Header&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: server&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;There are two things in this rule:&lt;/p&gt; &lt;br /&gt;&lt;ul&gt; &lt;br /&gt;    &lt;li class="bullist"&gt;For static components: implement "Never expire" policy by setting far future &lt;code&gt;Expires&lt;/code&gt; header&lt;/li&gt; &lt;br /&gt;    &lt;li class="bullist"&gt;For dynamic components: use an appropriate &lt;code&gt;Cache-Control&lt;/code&gt; header to help the browser with conditional requests&lt;/li&gt; &lt;br /&gt;&lt;/ul&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;Web page designs are getting richer and richer, which means more scripts, stylesheets, images, and Flash in the page. A first-time visitor to your page may have to make several HTTP requests, but by using the Expires header you make those components cacheable. This avoids unnecessary HTTP requests on subsequent page views. Expires headers are most often used with images, but they should be used on &lt;em&gt;all&lt;/em&gt; components including scripts, stylesheets, and Flash components.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;Browsers (and proxies) use a cache to reduce the number and size of HTTP requests, making web pages load faster. A web server uses the Expires header in the HTTP response to tell the client how long a component can be cached. This is a far future Expires header, telling the browser that this response won't be stale until April 15, 2010. &lt;/p&gt; &lt;br /&gt;&lt;p&gt;&lt;pre&gt;      Expires: Thu, 15 Apr 2010 20:00:00 GMT&lt;/pre&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt;If your server is Apache, use the ExpiresDefault directive to set an expiration date relative to the current date. This example of the ExpiresDefault directive sets the Expires date 10 years out from the time of the request.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;&lt;pre&gt;      ExpiresDefault "access plus 10 years"&lt;/pre&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt;Keep in mind, if you use a far future Expires header you have to change the component's filename whenever the component changes. At Yahoo! we often make this step part of the build process: a version number is embedded in the component's filename, for example, yahoo_2.0.6.js.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;Using a far future Expires header affects page views only after a user has already visited your site. It has no effect on the number of HTTP requests when a user visits your site for the first time and the browser's cache is empty. Therefore the impact of this performance improvement depends on how often users hit your pages with a primed cache. (A "primed cache" already contains all of the components in the page.) We &lt;a href="http://yuiblog.com/blog/2007/01/04/performance-research-part-2/"&gt;measured this at Yahoo!&lt;/a&gt; and found the number of page views with a primed cache is 75-85%. By using a far future Expires header, you increase the number of components that are cached by the browser and re-used on subsequent page views without sending a single byte over the user's Internet connection.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt; | &lt;a href="http://developer.yahoo.net/blog/archives/2007/05/high_performanc_2.html"&gt;discuss this rule&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="gzip"&gt;Gzip Components&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: server&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;The time it takes to transfer an HTTP request and response across the network can be significantly reduced by decisions made by front-end engineers. It's true that the end-user's bandwidth speed, Internet service provider, proximity to peering exchange points, etc. are beyond the control of the development team. But there are other variables that affect response times. Compression reduces response times by reducing the size of the HTTP response.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;Starting with HTTP/1.1, web clients indicate support for compression with the Accept-Encoding header in the HTTP request.&lt;/p&gt; &lt;br /&gt;&lt;pre&gt;      Accept-Encoding: gzip, deflate&lt;/pre&gt; &lt;br /&gt;&lt;p&gt;If the web server sees this header in the request, it may compress the response using one of the methods listed by the client. The web server notifies the web client of this via the Content-Encoding header in the response.&lt;/p&gt; &lt;br /&gt;&lt;pre&gt;      Content-Encoding: gzip&lt;/pre&gt; &lt;br /&gt;&lt;p&gt;Gzip is the most popular and effective compression method at this time. It was developed by the GNU project and standardized by &lt;a href="http://www.ietf.org/rfc/rfc1952.txt"&gt;RFC 1952&lt;/a&gt;. The only other compression format you're likely to see is deflate, but it's less effective and less popular. &lt;/p&gt; &lt;br /&gt;&lt;p&gt;Gzipping generally reduces the response size by about 70%. Approximately 90% of today's Internet traffic travels through browsers that claim to support gzip. If you use Apache, the module configuring gzip depends on your version: Apache 1.3 uses &lt;a href="http://sourceforge.net/projects/mod-gzip/"&gt;mod_gzip&lt;/a&gt; while Apache 2.x uses &lt;a href="http://httpd.apache.org/docs/2.0/mod/mod_deflate.html"&gt;mod_deflate&lt;/a&gt;. &lt;/p&gt; &lt;br /&gt;&lt;p&gt;There are known issues with browsers and proxies that may cause a mismatch in what the browser expects and what it receives with regard to compressed content. Fortunately, these edge cases are dwindling as the use of older browsers drops off. The Apache modules help out by adding appropriate Vary response headers automatically. &lt;/p&gt; &lt;br /&gt;&lt;p&gt;Servers choose what to gzip based on file type, but are typically too limited in what they decide to compress. Most web sites gzip their HTML documents. It's also worthwhile to gzip your scripts and stylesheets, but many web sites miss this opportunity. In fact, it's worthwhile to compress any text response including XML and JSON. Image and PDF files should not be gzipped because they are already compressed. Trying to gzip them not only wastes CPU but can potentially increase file sizes. &lt;/p&gt; &lt;br /&gt;&lt;p&gt;Gzipping as many file types as possible is an easy way to reduce page weight and accelerate the user experience.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt; | &lt;a href="http://developer.yahoo.net/blog/archives/2007/07/high_performanc_3.html"&gt;discuss this rule&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="css_top"&gt;Put Stylesheets at the Top&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: css&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;While researching performance at Yahoo!, we discovered that moving stylesheets to the document HEAD makes pages &lt;em&gt;appear&lt;/em&gt; to be loading faster. This is because putting stylesheets in the HEAD allows the page to render progressively. &lt;/p&gt; &lt;br /&gt;&lt;p&gt;Front-end engineers that care about performance want a page to load progressively; that is, we want the browser to display whatever content it has as soon as possible. This is especially important for pages with a lot of content and for users on slower Internet connections. The importance of giving users visual feedback, such as progress indicators, has been well researched and &lt;a href="http://www.useit.com/papers/responsetime.html"&gt;documented&lt;/a&gt;. In our case the HTML page is the progress indicator! When the browser loads the page progressively the header, the navigation bar, the logo at the top, etc. all serve as visual feedback for the user who is waiting for the page. This improves the overall user experience.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;The problem with putting stylesheets near the bottom of the document is that it prohibits progressive rendering in many browsers, including Internet Explorer. These browsers block rendering to avoid having to redraw elements of the page if their styles change. The user is stuck viewing a blank white page.&lt;br /&gt;&lt;p&gt;The &lt;a href="http://www.w3.org/TR/html4/struct/links.html#h-12.3"&gt;HTML specification&lt;/a&gt; clearly states that stylesheets are to be included in the HEAD of the page: "Unlike A, [LINK] may only appear in the HEAD section of a document, although it may appear any number of times." Neither of the alternatives, the blank white screen or flash of unstyled content, are worth the risk. The optimal solution is to follow the HTML specification and load your stylesheets in the document HEAD.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt; | &lt;a href="http://developer.yahoo.net/blog/archives/2007/07/high_performanc_4.html"&gt;discuss this rule&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="js_bottom"&gt;Put Scripts at the Bottom&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: javascript&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;The problem caused by scripts is that they block parallel downloads. The &lt;a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html#sec8.1.4"&gt;HTTP/1.1 specification&lt;/a&gt; suggests that browsers download no more than two components in parallel per hostname. If you serve your images from multiple hostnames, you can get more than two downloads to occur in parallel. While a script is downloading, however, the browser won't start any other downloads, even on different hostnames. &lt;/p&gt; &lt;br /&gt;&lt;p&gt;In some situations it's not easy to move scripts to the bottom. If, for example, the script uses &lt;code&gt;document.write&lt;/code&gt; to insert part of the page's content, it can't be moved lower in the page. There might also be scoping issues. In many cases, there are ways to workaround these situations.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;An alternative suggestion that often comes up is to use deferred scripts. The &lt;code&gt;DEFER&lt;/code&gt; attribute indicates that the script does not contain document.write, and is a clue to browsers that they can continue rendering. Unfortunately, Firefox doesn't support the &lt;code&gt;DEFER&lt;/code&gt; attribute. In Internet Explorer, the script may be deferred, but not as much as desired. If a script can be deferred, it can also be moved to the bottom of the page. That will make your web pages load faster.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt; | &lt;a href="http://developer.yahoo.net/blog/archives/2007/07/high_performanc_5.html"&gt;discuss this rule&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="css_expressions"&gt;Avoid CSS Expressions&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: css&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;CSS expressions are a powerful (and dangerous) way to set CSS properties dynamically. They're supported in Internet Explorer, starting with &lt;a href="http://msdn.microsoft.com/workshop/author/dhtml/overview/recalc.asp"&gt;version 5&lt;/a&gt;. As an example, the background color could be set to alternate every hour using CSS expressions.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;&lt;pre&gt;      background-color: expression( (new Date()).getHours()%2 ? "#B8D4FF" : "#F08A00" );&lt;/pre&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt;As shown here, the &lt;code&gt;expression&lt;/code&gt; method accepts a JavaScript expression. The CSS property is set to the result of evaluating the JavaScript expression. The &lt;code&gt;expression&lt;/code&gt; method is ignored by other browsers, so it is useful for setting properties in Internet Explorer needed to create a consistent experience across browsers.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;The problem with expressions is that they are evaluated more frequently than most people expect. Not only are they evaluated when the page is rendered and resized, but also when the page is scrolled and even when the user moves the mouse over the page. Adding a counter to the CSS expression allows us to keep track of when and how often a CSS expression is evaluated. Moving the mouse around the page can easily generate more than 10,000 evaluations.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;One way to reduce the number of times your CSS expression is evaluated is to use one-time expressions, where the first time the expression is evaluated it sets the style property to an explicit value, which replaces the CSS expression. If the style property must be set dynamically throughout the life of the page, using event handlers instead of CSS expressions is an alternative approach. If you must use CSS expressions, remember that they may be evaluated thousands of times and could affect the performance of your page.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt; | &lt;a href="http://developer.yahoo.net/blog/archives/2007/07/high_performanc_6.html"&gt;discuss this rule&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="external"&gt;Make JavaScript and CSS External&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: javascript, css&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;Many of these performance rules deal with how external components are managed. However, before these considerations arise you should ask a more basic question: Should JavaScript and CSS be contained in external files, or inlined in the page itself?&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;Using external files in the real world generally produces faster pages because the JavaScript and CSS files are cached by the browser. JavaScript and CSS that are inlined in HTML documents get downloaded every time the HTML document is requested. This reduces the number of HTTP requests that are needed, but increases the size of the HTML document. On the other hand, if the JavaScript and CSS are in external files cached by the browser, the size of the HTML document is reduced without increasing the number of HTTP requests. &lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;The key factor, then, is the frequency with which external JavaScript and CSS components are cached relative to the number of HTML documents requested. This factor, although difficult to quantify, can be gauged using various metrics. If users on your site have multiple page views per session and many of your pages re-use the same scripts and stylesheets, there is a greater potential benefit from cached external files. &lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;Many web sites fall in the middle of these metrics. For these sites, the best solution generally is to deploy the JavaScript and CSS as external files. The only exception where inlining is preferable is with home pages, such as &lt;a href="http://www.yahoo.com"&gt;Yahoo!'s front page&lt;/a&gt; and &lt;a href="http://my.yahoo.com"&gt;My Yahoo!&lt;/a&gt;.&lt;br /&gt;Home pages that have few (perhaps only one) page view per session may find that inlining JavaScript and CSS results in faster end-user response times.&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;For front pages that are typically the first of many page views, there are techniques that leverage the reduction of HTTP requests that inlining provides, as well as the caching benefits achieved through using external files. One such technique is to inline JavaScript and CSS in the front page, but dynamically download the external files after the page has finished loading. Subsequent pages would reference the external files that should already be in the browser's cache.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt; | &lt;a href="http://developer.yahoo.net/blog/archives/2007/07/rule_8_make_jav.html"&gt;discuss this rule&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="dns_lookups"&gt;Reduce DNS Lookups&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: content&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;The Domain Name System (DNS) maps hostnames to IP addresses, just as phonebooks map people's names to their phone numbers. When you type www.yahoo.com into your browser, a DNS resolver contacted by the browser returns that server's IP address. DNS has a cost. It typically takes 20-120 milliseconds for DNS to lookup the IP address for a given hostname. The browser can't download anything from this hostname until the DNS lookup is completed. &lt;/p&gt; &lt;br /&gt;&lt;p&gt;DNS lookups are cached for better performance. This caching can occur on a special caching server, maintained by the user's ISP or local area network, but there is also caching that occurs on the individual user's computer. The DNS information remains in the operating system's DNS cache (the "DNS Client service" on Microsoft Windows). Most browsers have their own caches, separate from the operating system's cache. As long as the browser keeps a DNS record in its own cache, it doesn't bother the operating system with a request for the record.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;Internet Explorer caches DNS lookups for 30 minutes by default, as specified by the  &lt;code&gt;DnsCacheTimeout&lt;/code&gt; registry setting. Firefox caches DNS lookups for 1 minute, controlled by the &lt;code&gt;network.dnsCacheExpiration&lt;/code&gt; configuration setting. (Fasterfox changes this to 1 hour.)&lt;/p&gt; &lt;br /&gt;&lt;p&gt;When the client's DNS cache is empty (for both the browser and the operating system), the number of DNS lookups is equal to the number of unique hostnames in the web page. This includes the hostnames used in the page's URL, images, script files, stylesheets, Flash objects, etc. Reducing the number of unique hostnames reduces the number of DNS lookups. &lt;/p&gt; &lt;br /&gt;&lt;p&gt;Reducing the number of unique hostnames has the potential to reduce the amount of parallel downloading that takes place in the page. Avoiding DNS lookups cuts response times, but reducing parallel downloads may increase response times. My guideline is to split these components across at least two but no more than four hostnames. This results in a good compromise between reducing DNS lookups and allowing a high degree of parallel downloads.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt; | &lt;a href="http://developer.yahoo.net/blog/archives/2007/07/high_performanc_7.html"&gt;discuss this rule&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="minify"&gt;Minify JavaScript and CSS&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: javascript, css&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;Minification is the practice of removing unnecessary characters from code to reduce its size thereby improving load times. When code is minified all comments are removed, as well as unneeded white space characters (space, newline, and tab). In the case of JavaScript, this improves response time performance because the size of the downloaded file is reduced. Two popular tools for minifying JavaScript code are &lt;a href="http://crockford.com/javascript/jsmin"&gt;JSMin&lt;/a&gt; and &lt;a href="http://developer.yahoo.com/yui/compressor/"&gt;YUI Compressor&lt;/a&gt;. The YUI compressor can also minify CSS.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;Obfuscation is an alternative optimization that can be applied to source code. It's more complex than minification and thus more likely to generate bugs as a result of the obfuscation step itself. In a survey of ten top U.S. web sites, minification achieved a 21% size reduction versus 25% for obfuscation. Although obfuscation has a higher size reduction, minifying JavaScript is less risky.&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;In addition to minifying external scripts and styles, inlined &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;style&amp;gt;&lt;/code&gt; blocks can and should also be minified. Even if you gzip your scripts and styles, minifying them will still reduce the size by 5% or more. As the use and size of JavaScript and CSS increases, so will the savings gained by minifying your code.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt; | &lt;a href="http://developer.yahoo.net/blog/archives/2007/07/high_performanc_8.html"&gt;discuss this rule&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="redirects"&gt;Avoid Redirects&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: content&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;Redirects are accomplished using the 301 and 302 status codes. Here's an example of the HTTP headers in a 301 response:&lt;/p&gt; &lt;br /&gt;&lt;p&gt;&lt;pre&gt;      HTTP/1.1 301 Moved Permanently&lt;br /&gt;      Location: http://example.com/newuri&lt;br /&gt;      Content-Type: text/html&lt;/pre&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt;The browser automatically takes the user to the URL specified in the &lt;code&gt;Location&lt;/code&gt; field. All the information necessary for a redirect is in the headers. The body of the response is typically empty. Despite their names, neither a 301 nor a 302 response is cached in practice unless additional headers, such as &lt;code&gt;Expires&lt;/code&gt; or &lt;code&gt;Cache-Control&lt;/code&gt;, indicate it should be. The meta refresh tag and JavaScript are other ways to direct users to a different URL, but if you must do a redirect, the preferred technique is to use the standard 3xx HTTP status codes, primarily to ensure the back button works correctly.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;The main thing to remember is that redirects slow down the user experience. Inserting a redirect between the user and the HTML document delays everything in the page since nothing in the page can be rendered and no components can start being downloaded until the HTML document has arrived.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;One of the most wasteful redirects happens frequently and web developers are generally not aware of it. It occurs when a trailing slash (/) is missing from a URL that should otherwise have one. For example, going to &lt;a href="http://astrology.yahoo.com/astrology"&gt;http://astrology.yahoo.com/astrology&lt;/a&gt; results in a 301 response containing a redirect to &lt;a href="http://astrology.yahoo.com/astrology/"&gt;http://astrology.yahoo.com/astrology/&lt;/a&gt; (notice the added trailing slash). This is fixed in Apache by using &lt;code&gt;Alias&lt;/code&gt; or &lt;code&gt;mod_rewrite&lt;/code&gt;, or the &lt;code&gt;DirectorySlash&lt;/code&gt; directive if you're using Apache handlers.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;Connecting an old web site to a new one is another common use for redirects. Others include connecting different parts of a website and directing the user based on certain conditions (type of browser, type of user account, etc.). Using a redirect to connect two web sites is simple and requires little additional coding. Although using redirects in these situations reduces the complexity for developers, it degrades the user experience. Alternatives for this use of redirects include using &lt;code&gt;Alias&lt;/code&gt; and &lt;code&gt;mod_rewrite&lt;/code&gt; if the two code paths are hosted on the same server. If a domain name change is the cause of using redirects, an alternative is to create a CNAME (a DNS record that creates an alias pointing from one domain name to another) in combination with &lt;code&gt;Alias&lt;/code&gt; or &lt;code&gt;mod_rewrite&lt;/code&gt;.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt; | &lt;a href="http://developer.yahoo.net/blog/archives/2007/07/high_performanc_9.html"&gt;discuss this rule&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="js_dupes"&gt;Remove Duplicate Scripts&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: javascript&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;It hurts performance to include the same JavaScript file twice in one page. This isn't as unusual as you might think. A review of the ten top U.S. web sites shows that two of them contain a duplicated script. Two main factors increase the odds of a script being duplicated in a single web page: team size and number of scripts. When it does happen, duplicate scripts hurt performance by creating unnecessary HTTP requests and wasted JavaScript execution.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;Unnecessary HTTP requests happen in Internet Explorer, but not in Firefox. In Internet Explorer, if an external script is included twice and is not cacheable, it generates two HTTP requests during page loading. Even if the script is cacheable, extra HTTP requests occur when the user reloads the page.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;In addition to generating wasteful HTTP requests, time is wasted evaluating the script multiple times. This redundant JavaScript execution happens in both Firefox and Internet Explorer, regardless of whether the script is cacheable.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;One way to avoid accidentally including the same script twice is to implement a script management module in your templating system. The typical way to include a script is to use the SCRIPT tag in your HTML page.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;&lt;pre&gt;      &amp;lt;script type="text/javascript" src="menu_1.0.17.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/pre&gt; &lt;br /&gt;&lt;p&gt;An alternative in PHP would be to create a function called &lt;code&gt;insertScript&lt;/code&gt;.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;&lt;pre&gt;      &amp;lt;?php insertScript("menu.js") ?&amp;gt;&lt;/pre&gt; &lt;br /&gt;&lt;p&gt;In addition to preventing the same script from being inserted multiple times, this function could handle other issues with scripts, such as dependency checking and adding version numbers to script filenames to support far future Expires headers.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt; | &lt;a href="http://developer.yahoo.net/blog/archives/2007/07/high_performanc_10.html"&gt;discuss this rule&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="etags"&gt;Configure ETags&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: server&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;Entity tags (ETags) are a mechanism that web servers and browsers use to determine whether the component in the browser's cache matches the one on the origin server. (An "entity" is another word a "component": images, scripts, stylesheets, etc.) ETags were added to provide a mechanism for validating entities that is more flexible than the last-modified date. An ETag is a string that uniquely identifies a specific version of a component. The only format constraints are that the string be quoted. The origin server specifies the component's ETag using the &lt;code&gt;ETag&lt;/code&gt; response header.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;&lt;pre&gt;      HTTP/1.1 200 OK&lt;br /&gt;      Last-Modified: Tue, 12 Dec 2006 03:03:59 GMT&lt;br /&gt;      ETag: "10c24bc-4ab-457e1c1f"&lt;br /&gt;      Content-Length: 12195&lt;/pre&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt;Later, if the browser has to validate a component, it uses the &lt;code&gt;If-None-Match&lt;/code&gt; header to pass the ETag back to the origin server. If the ETags match, a 304 status code is returned reducing the response by 12195 bytes for this example.&lt;br /&gt;&lt;p&gt;&lt;pre&gt;      GET /i/yahoo.gif HTTP/1.1&lt;br /&gt;      Host: us.yimg.com&lt;br /&gt;      If-Modified-Since: Tue, 12 Dec 2006 03:03:59 GMT&lt;br /&gt;      If-None-Match: "10c24bc-4ab-457e1c1f"&lt;br /&gt;      HTTP/1.1 304 Not Modified&lt;/pre&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt;The problem with ETags is that they typically are constructed using attributes that make them unique to a specific server hosting a site. ETags won't match when a browser gets the original component from one server and later tries to validate that component on a different server, a situation that is all too common on Web sites that use a cluster of servers to handle requests. By default, both Apache and IIS embed data in the ETag that dramatically reduces the odds of the validity test succeeding on web sites with multiple servers.&lt;br /&gt;&lt;p&gt;The ETag format for Apache 1.3 and 2.x is &lt;code&gt;inode-size-timestamp&lt;/code&gt;. Although a given file may reside in the same directory across multiple servers, and have the same file size, permissions, timestamp, etc., its inode is different from one server to the next.&lt;br /&gt;&lt;p&gt;IIS 5.0 and 6.0 have a similar issue with ETags. The format for ETags on IIS is &lt;code&gt;Filetimestamp:ChangeNumber&lt;/code&gt;. A &lt;code&gt;ChangeNumber&lt;/code&gt; is a counter used to track configuration changes to IIS. It's unlikely that the &lt;code&gt;ChangeNumber&lt;/code&gt; is the same across all IIS servers behind a web site.&lt;br /&gt;&lt;p&gt;The end result is ETags generated by Apache and IIS for the exact same component won't match from one server to another. If the ETags don't match, the user doesn't receive the small, fast 304 response that ETags were designed for; instead, they'll get a normal 200 response along with all the data for the component. If you host your web site on just one server, this isn't a problem. But if you have multiple servers hosting your web site, and you're using Apache or IIS with the default ETag configuration, your users are getting slower pages, your servers have a higher load, you're consuming greater bandwidth, and proxies aren't caching your content efficiently. Even if your components have a far future &lt;code&gt;Expires&lt;/code&gt; header, a conditional GET request is still made whenever the user hits Reload or Refresh.&lt;br /&gt;&lt;p&gt;If you're not taking advantage of the flexible validation model that ETags provide, it's better to just remove the ETag altogether. The &lt;code&gt;Last-Modified&lt;/code&gt; header validates based on the component's timestamp. And removing the ETag reduces the size of the HTTP headers in both the response and subsequent requests. This &lt;a href="http://support.microsoft.com/?id=922733"&gt;Microsoft Support article&lt;/a&gt; describes how to remove ETags. In Apache, this is done by simply adding the following line to your Apache configuration file:&lt;br /&gt;&lt;pre&gt;      FileETag none&lt;/pre&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt; | &lt;a href="http://developer.yahoo.net/blog/archives/2007/07/high_performanc_11.html"&gt;discuss this rule&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="cacheajax"&gt;Make Ajax Cacheable&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: content&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;One of the cited benefits of Ajax is that it provides instantaneous feedback to the user because it requests information asynchronously from the backend web server. However, using Ajax is no guarantee that the user won't be twiddling his thumbs waiting for those asynchronous JavaScript and XML responses to return. In many applications, whether or not the user is kept waiting depends on how Ajax is used. For example, in a web-based email client the user will be kept waiting for the results of an Ajax request to find all the email messages that match their search criteria. It's important to remember that "asynchronous" does not imply "instantaneous".&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;To improve performance, it's important to optimize these Ajax responses. The most important way to improve the performance of Ajax is to make the responses cacheable, as discussed in &lt;a href="#expires"&gt;Add an Expires or a Cache-Control Header&lt;/a&gt;. Some of the other rules also apply to Ajax:&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;ul&gt; &lt;br /&gt;  &lt;li class="bullist"&gt; &lt;a href="#gzip"&gt;Gzip Components&lt;/a&gt;&lt;br /&gt; &lt;br /&gt;  &lt;li class="bullist"&gt; &lt;a href="#dns_lookups"&gt;Reduce DNS Lookups&lt;/a&gt;&lt;br /&gt; &lt;br /&gt;  &lt;li class="bullist"&gt; &lt;a href="#minify"&gt;Minify JavaScript&lt;/a&gt;&lt;br /&gt; &lt;br /&gt;  &lt;li class="bullist"&gt; &lt;a href="#redirects"&gt;Avoid Redirects&lt;/a&gt;&lt;br /&gt; &lt;br /&gt;  &lt;li class="bullist"&gt; &lt;a href="#etags"&gt;Configure ETags&lt;/a&gt;&lt;br /&gt; &lt;br /&gt;&lt;/ul&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;Let's look at an example. A Web 2.0 email client might use Ajax to download the user's address book for autocompletion. If the user hasn't modified her address book since the last time she used the email web app, the previous address book response could be read from cache if that Ajax response was made cacheable with a future Expires or Cache-Control header. The browser must be informed when to use a previously cached address book response versus requesting a new one. This could be done by adding a timestamp to the address book Ajax URL indicating the last time the user modified her address book, for example, &lt;code&gt;&amp;amp;t=1190241612&lt;/code&gt;. If the address book hasn't been modified since the last download, the timestamp will be the same and the address book will be read from the browser's cache eliminating an extra HTTP roundtrip. If the user has modified her address book, the timestamp ensures the new URL doesn't match the cached response, and the browser will request the updated address book entries.&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;Even though your Ajax responses are created dynamically, and might only be applicable to a single user, they can still be cached. Doing so will make your Web 2.0 apps faster.&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt; | &lt;a href="http://developer.yahoo.net/blog/archives/2007/09/high_performanc_12.html"&gt;discuss this rule&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="flush"&gt;Flush the Buffer Early&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: server&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt; When users request a page, it can take anywhere from 200 to 500ms for the backend server to stitch together the HTML page.&lt;br /&gt; During this time, the browser is idle as it waits for the data to arrive.&lt;br /&gt; In PHP you have the function &lt;a href="http://php.net/flush"&gt;flush()&lt;/a&gt;.&lt;br /&gt; It allows you to send your partially ready HTML response to the browser so that&lt;br /&gt; the browser can start fetching components while your backend is busy with the rest of the HTML page.&lt;br /&gt; The benefit is mainly seen on busy backends or light frontends.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    A good place to consider flushing is right after the HEAD because the HTML for the head is&lt;br /&gt;    usually easier to produce and it allows you to include any CSS and JavaScript&lt;br /&gt;    files for the browser to start fetching in parallel while the backend is still processing.&lt;br /&gt; &lt;br /&gt;&lt;p&gt;Example:&lt;/p&gt; &lt;br /&gt;&lt;pre&gt; &lt;br /&gt;      ... &amp;lt;!-- css, js --&amp;gt;&lt;br /&gt;    &amp;lt;/head&amp;gt;&lt;br /&gt;    &lt;span class="hilite"&gt;&amp;lt;?php flush(); ?&amp;gt;&lt;/span&gt; &lt;br /&gt;    &amp;lt;body&amp;gt;&lt;br /&gt;      ... &amp;lt;!-- content --&amp;gt;&lt;br /&gt;&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="http://search.yahoo.com"&gt;Yahoo! search&lt;/a&gt; pioneered research and real user testing to prove the benefits of using this technique.&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="ajax_get"&gt;Use GET for AJAX Requests&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: server&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    The &lt;a href="http://mail.yahoo.com"&gt;Yahoo! Mail&lt;/a&gt; team found that when using &lt;code&gt;XMLHttpRequest&lt;/code&gt;, POST is implemented in the browsers as a two-step process:&lt;br /&gt;    sending the headers first, then sending data. So it's best to use GET, which only takes one TCP packet to send (unless you have a lot of cookies).&lt;br /&gt;    The maximum URL length in IE is 2K, so if you send more than 2K data you might not be able to use GET.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt;An interesting side affect is that POST without actually posting any data behaves like GET.&lt;br /&gt;Based on the &lt;a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html"&gt;HTTP specs&lt;/a&gt;, GET is meant for retrieving information, so it&lt;br /&gt;        makes sense (semantically) to use GET when you're only requesting data, as opposed to sending data to be stored server-side.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="postload"&gt;Post-load Components&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: content&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    You can take a closer look at your page and ask yourself: "What's absolutely required in order to render the page initially?".&lt;br /&gt;    The rest of the content and components can wait.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    JavaScript is an ideal candidate for splitting before and after the onload event. For example&lt;br /&gt;    if you have JavaScript code and libraries that do drag and drop and animations, those can wait,&lt;br /&gt;    because dragging elements on the page comes after the initial rendering.&lt;br /&gt;    Other places to look for candidates for post-loading include hidden content (content that appears after a user action) and images below the fold.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    Tools to help you out in your effort: &lt;a href="http://developer.yahoo.com/yui/imageloader/"&gt;YUI Image Loader&lt;/a&gt; allows you to delay images&lt;br /&gt;    below the fold and the &lt;a href="http://developer.yahoo.com/yui/get/"&gt;YUI Get utility&lt;/a&gt; is an easy way to include JS and CSS on the fly.&lt;br /&gt;    For an example in the wild take a look at &lt;a href="http://www.yahoo.com"&gt;Yahoo! Home Page&lt;/a&gt; with Firebug's Net Panel turned on.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    It's good when the performance goals are inline with other&lt;br /&gt;    web development best practices. In this case, the idea of progressive enhancement tells us that JavaScript, when supported, can&lt;br /&gt;    improve the user experience but you have to make sure the page works even without JavaScript. So after you've made sure the page&lt;br /&gt;    works fine, you can enhance it with some post-loaded scripts that give you more bells and whistles such as drag and drop and animations.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="preload"&gt;Preload Components&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: content&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    Preload may look like the opposite of post-load, but it actually has a different goal.&lt;br /&gt;    By preloading components you can take advantage of the time the browser is idle and request components&lt;br /&gt;    (like images, styles and scripts) you'll need in the future.&lt;br /&gt;    This way when the user visits the next page, you could have most of the components already in&lt;br /&gt;    the cache and your page will load much faster for the user.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    There are actually several types of preloading:&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;&lt;ul&gt; &lt;br /&gt;    &lt;li class="bullist"&gt;&lt;em&gt;Unconditional&lt;/em&gt; preload - as soon as onload fires, you go ahead and fetch some extra components.&lt;br /&gt;        Check google.com for an example of how a sprite image is requested onload. This sprite image is&lt;br /&gt;        not needed on the google.com homepage, but it is needed on the consecutive search result page.&lt;/li&gt; &lt;br /&gt;    &lt;li class="bullist"&gt;&lt;em&gt;Conditional&lt;/em&gt; preload - based on a user action you make an educated guess where the user is headed next and preload accordingly.&lt;br /&gt;        On &lt;a href="http://search.yahoo.com"&gt;search.yahoo.com&lt;/a&gt; you can see how some extra components are requested&lt;br /&gt;        after you start typing in the input box.&lt;/li&gt; &lt;br /&gt;    &lt;li class="bullist"&gt;&lt;em&gt;Anticipated&lt;/em&gt; preload - preload in advance before launching a redesign. It often happens after a redesign that you hear:&lt;br /&gt;        "The new site is cool, but it's slower than before". Part of the problem could be that the users were visiting your old site with a&lt;br /&gt;        full cache, but the new one is always an empty cache experience. You can mitigate this side effect by preloading some&lt;br /&gt;        components before you even launched the redesign. Your old site can use the time the browser is idle and request images and scripts&lt;br /&gt;        that will be used by the new site&lt;/li&gt; &lt;br /&gt;&lt;/ul&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="min_dom"&gt;Reduce the Number of DOM Elements&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: content&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    A complex page means more bytes to download and it also means slower DOM access in JavaScript. It makes a difference&lt;br /&gt;    if you loop through 500 or 5000 DOM elements on the page when you want to add an event handler for example.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    A high number of DOM elements can be a symptom that there's something that should be improved with the markup&lt;br /&gt;    of the page without necessarily removing content.&lt;br /&gt;    Are you using nested tables for layout purposes?&lt;br /&gt;    Are you throwing in more &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;s only to fix layout issues?&lt;br /&gt;    Maybe there's a better and more semantically correct way to do your markup.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    A great help with layouts are the &lt;a href="http://developer.yahoo.com/yui/"&gt;YUI CSS utilities&lt;/a&gt;:&lt;br /&gt;    grids.css can help you with the overall layout, fonts.css and reset.css&lt;br /&gt;    can help you strip away the browser's defaults formatting.&lt;br /&gt;    This is a chance to start fresh and think about your markup,&lt;br /&gt;    for example use &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;s only when it makes sense semantically, and not because it renders a new line.&lt;br /&gt; &lt;br /&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    The number of DOM elements is easy to test, just type in Firebug's console:&lt;br /&gt; &lt;br /&gt;        &lt;code&gt;document.getElementsByTagName('*').length&lt;/code&gt; &lt;br /&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    And how many DOM elements are too many? Check other similar pages that have good markup.&lt;br /&gt;    For example the &lt;a href="http://www.yahoo.com"&gt;Yahoo! Home Page&lt;/a&gt; is a pretty busy page and still under 700 elements (HTML tags).&lt;br /&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="split"&gt;Split Components Across Domains&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: content&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    Splitting components allows you to maximize parallel downloads. Make sure you're using&lt;br /&gt;    not more than 2-4 domains because of the DNS lookup penalty.&lt;br /&gt;    For example, you can host your HTML and dynamic content&lt;br /&gt;    on &lt;code&gt;www.example.org&lt;/code&gt; &lt;br /&gt;    and split static components between &lt;code&gt;static1.example.org&lt;/code&gt; and &lt;code&gt;static2.example.org&lt;/code&gt; &lt;br /&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    For more information check&lt;br /&gt;    "&lt;a href="http://yuiblog.com/blog/2007/04/11/performance-research-part-4/"&gt;Maximizing Parallel Downloads in the Carpool Lane&lt;/a&gt;" by Tenni Theurer and Patty Chi.&lt;br /&gt; &lt;br /&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="iframes"&gt;Minimize the Number of iframes&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: content&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    Iframes allow an HTML document to be inserted in the parent document.&lt;br /&gt;    It's important to understand how iframes work so they can be used effectively.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    &lt;code&gt;&amp;lt;iframe&amp;gt;&lt;/code&gt; pros:&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;    &lt;ul&gt; &lt;br /&gt;      &lt;li class="bullist"&gt;Helps with slow third-party content like badges and ads&lt;/li&gt; &lt;br /&gt;      &lt;li class="bullist"&gt;Security sandbox&lt;/li&gt; &lt;br /&gt;      &lt;li class="bullist"&gt;Download scripts in parallel&lt;/li&gt; &lt;br /&gt;    &lt;/ul&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    &lt;code&gt;&amp;lt;iframe&amp;gt;&lt;/code&gt; cons:&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;    &lt;ul&gt; &lt;br /&gt;      &lt;li class="bullist"&gt;Costly even if blank&lt;/li&gt; &lt;br /&gt;      &lt;li class="bullist"&gt;Blocks page onload&lt;/li&gt; &lt;br /&gt;      &lt;li class="bullist"&gt;Non-semantic&lt;/li&gt; &lt;br /&gt;    &lt;/ul&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="no404"&gt;No 404s&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: content&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    HTTP requests are expensive so making an HTTP request and getting a useless response (i.e. 404 Not Found)&lt;br /&gt;    is totally unnecessary and will slow down the user experience without any benefit.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    Some sites have helpful 404s "Did you mean X?", which is great for the user&lt;br /&gt;    experience but also wastes server resources (like database, etc).&lt;br /&gt;    Particularly bad is when the link to an external JavaScript is wrong and the result is a 404.&lt;br /&gt;    First, this download will block parallel downloads. Next the browser may try to parse&lt;br /&gt;    the 404 response body as if it were JavaScript code, trying to find something usable in it.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="cookie_size"&gt;Reduce Cookie Size&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: cookie&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    HTTP cookies are used for a variety of reasons such as authentication and personalization.&lt;br /&gt;    Information about cookies is exchanged in the HTTP headers between web servers and browsers.&lt;br /&gt;    It's important to keep the size of cookies as low as possible to minimize the impact on the user's response time.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    For more information check&lt;br /&gt;    &lt;a href="http://yuiblog.com/blog/2007/03/01/performance-research-part-3/"&gt;"When the Cookie Crumbles"&lt;/a&gt; by Tenni Theurer and Patty Chi.&lt;br /&gt;    The take-home of this research:&lt;br /&gt;&lt;p&gt; &lt;br /&gt;&lt;ul&gt; &lt;br /&gt;    &lt;li class="bullist"&gt;Eliminate unnecessary cookies&lt;/li&gt; &lt;br /&gt;    &lt;li class="bullist"&gt;Keep cookie sizes as low as possible to minimize the impact on the user response time&lt;/li&gt; &lt;br /&gt;    &lt;li class="bullist"&gt;Be mindful of setting cookies at the appropriate domain level so other sub-domains are not affected&lt;/li&gt; &lt;br /&gt;    &lt;li class="bullist"&gt;Set an Expires date appropriately. An earlier Expires date or none removes the cookie sooner, improving the user response time&lt;/li&gt; &lt;br /&gt;&lt;/ul&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="cookie_free"&gt;Use Cookie-free Domains for Components&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: cookie&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    When the browser makes a request for a static image and sends cookies together with the request,&lt;br /&gt;    the server doesn't have any use for those cookies. So they only create network traffic for no good&lt;br /&gt;    reason. You should make sure static components are requested with cookie-free requests. Create&lt;br /&gt;    a subdomain and host all your static components there.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    If your domain is &lt;code&gt;www.example.org&lt;/code&gt;, you can host your static components&lt;br /&gt;    on &lt;code&gt;static.example.org&lt;/code&gt;. However, if you've already set cookies on the top-level domain&lt;br /&gt;    &lt;code&gt;example.org&lt;/code&gt; as opposed to &lt;code&gt;www.example.org&lt;/code&gt;, then all the requests to&lt;br /&gt;    &lt;code&gt;static.example.org&lt;/code&gt; will include those cookies. In this case, you can buy a whole new domain, host your static&lt;br /&gt;    components there, and keep this domain cookie-free. Yahoo! uses &lt;code&gt;yimg.com&lt;/code&gt;, YouTube uses &lt;code&gt;ytimg.com&lt;/code&gt;,&lt;br /&gt;    Amazon uses &lt;code&gt;images-amazon.com&lt;/code&gt; and so on.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    Another benefit of hosting static components on a cookie-free domain is that some proxies might refuse to cache&lt;br /&gt;    the components that are requested with cookies.&lt;br /&gt;    On a related note, if you wonder if you should use example.org or www.example.org for your home page, consider the cookie impact.&lt;br /&gt;    Omitting www leaves you no choice but to write cookies to &lt;code&gt;*.example.org&lt;/code&gt;, so for performance reasons it's best to use the&lt;br /&gt;    www subdomain and&lt;br /&gt;    write the cookies to that subdomain.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="dom_access"&gt;Minimize DOM Access&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: javascript&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    Accessing DOM elements with JavaScript is slow so in order to have a more responsive page, you should:&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;&lt;ul&gt; &lt;br /&gt;    &lt;li class="bullist"&gt;Cache references to accessed elements&lt;/li&gt; &lt;br /&gt;    &lt;li class="bullist"&gt;Update nodes "offline" and then add them to the tree&lt;/li&gt; &lt;br /&gt;    &lt;li class="bullist"&gt;Avoid fixing layout with JavaScript&lt;/li&gt; &lt;br /&gt;&lt;/ul&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    For more information check the YUI theatre's&lt;br /&gt;    &lt;a href="http://yuiblog.com/blog/2007/12/20/video-lecomte/"&gt;"High Performance Ajax Applications"&lt;/a&gt; &lt;br /&gt;    by Julien Lecomte.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="events"&gt;Develop Smart Event Handlers&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: javascript&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    Sometimes pages feel less responsive because of too many event handlers attached to different&lt;br /&gt;    elements of the DOM tree which are then executed too often. That's why using &lt;em&gt;event delegation&lt;/em&gt; is a good approach.&lt;br /&gt;    If you have 10 buttons inside a &lt;code&gt;div&lt;/code&gt;, attach only one event handler to the div wrapper, instead of&lt;br /&gt;    one handler for each button. Events bubble up so you'll be able to catch the event and figure out which button it originated from.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    You also don't need to wait for the onload event in order to start doing something with the DOM tree.&lt;br /&gt;    Often all you need is the element you want to access to be available in the tree. You don't have to wait for all images to be downloaded.&lt;br /&gt; &lt;br /&gt;    &lt;code&gt;DOMContentLoaded&lt;/code&gt; is the event you might consider using instead of onload, but until it's available in all browsers, you&lt;br /&gt;    can use the &lt;a href="http://developer.yahoo.com/yui/event/"&gt;YUI Event&lt;/a&gt; utility, which has an &lt;code&gt;&lt;a href="http://developer.yahoo.com/yui/event/#onavailable"&gt;onAvailable&lt;/a&gt;&lt;/code&gt; method.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    For more information check the YUI theatre's&lt;br /&gt;    &lt;a href="http://yuiblog.com/blog/2007/12/20/video-lecomte/"&gt;"High Performance Ajax Applications"&lt;/a&gt; &lt;br /&gt;    by Julien Lecomte.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="csslink"&gt;Choose &amp;lt;link&amp;gt; over @import&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: css&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    One of the previous best practices states that CSS should be at the top in order to allow for&lt;br /&gt;    progressive rendering.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    In IE &lt;code&gt;@import&lt;/code&gt; behaves the same as using &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; at the bottom of the page, so it's best not to use it.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="no_filters"&gt;Avoid Filters&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: css&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    The IE-proprietary &lt;code&gt;AlphaImageLoader&lt;/code&gt; filter aims to fix a problem with semi-transparent true color PNGs in IE versions &amp;lt; 7.&lt;br /&gt;    The problem with this filter is that it blocks rendering and freezes the browser while the image is being downloaded.&lt;br /&gt;    It also increases memory consumption and is applied per element, not per image, so the problem is multiplied.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    The best approach is to avoid &lt;code&gt;AlphaImageLoader&lt;/code&gt; completely and use gracefully degrading PNG8 instead, which are fine in IE.&lt;br /&gt;    If you absolutely need &lt;code&gt;AlphaImageLoader&lt;/code&gt;, use the underscore hack &lt;code&gt;_filter&lt;/code&gt; as to not penalize your IE7+ users.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="opt_images"&gt;Optimize Images&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: images&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    After a designer is done with creating the images for your web page, there are still some things you can try before you&lt;br /&gt;    FTP those images to your web server.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;&lt;ul&gt; &lt;br /&gt;    &lt;li class="bullist"&gt;You can check the GIFs and see if they are using a palette size corresponding&lt;br /&gt;        to the number of colors in the image. Using &lt;a href="http://www.imagemagick.org"&gt;imagemagick&lt;/a&gt; it's easy to check using&lt;br /&gt;        &lt;br /&gt; &lt;br /&gt;        &lt;code&gt;identify -verbose image.gif&lt;/code&gt; &lt;br /&gt;        &lt;br /&gt; &lt;br /&gt;        When you see an image useing 4 colors and a 256 color "slots" in the palette, there is room for improvement.&lt;br /&gt;    &lt;/li&gt; &lt;br /&gt;    &lt;li class="bullist"&gt; &lt;br /&gt;        Try converting GIFs to PNGs and see if there is a saving. More often than not, there is.&lt;br /&gt;        Developers often hesitate to use PNGs due to the limited support in browsers, but this is now a thing of the past.&lt;br /&gt;        The only real problem is alpha-transparency in true color PNGs, but then again, GIFs are not true color and don't&lt;br /&gt;        support variable transparency either.&lt;br /&gt;        So anything a GIF can do, a palette PNG (PNG8) can do too (except for animations).&lt;br /&gt;        This simple imagemagick command results in totally safe-to-use&lt;br /&gt;        PNGs:&lt;br /&gt; &lt;br /&gt;        &lt;code&gt;convert image.gif image.png&lt;/code&gt; &lt;br /&gt;        &lt;br /&gt; &lt;br /&gt;        "All we are saying is: Give PiNG a Chance!"&lt;br /&gt;    &lt;/li&gt; &lt;br /&gt;    &lt;li class="bullist"&gt; &lt;br /&gt;        Run &lt;a href="http://pmt.sourceforge.net/pngcrush/"&gt;pngcrush&lt;/a&gt; (or any other PNG optimizer tool) on all your PNGs. Example:&lt;br /&gt;        &lt;br /&gt; &lt;br /&gt;        &lt;code&gt;pngcrush image.png -rem alla -reduce -brute result.png&lt;/code&gt; &lt;br /&gt;    &lt;/li&gt; &lt;br /&gt;    &lt;li class="bullist"&gt; &lt;br /&gt;        Run jpegtran on all your JPEGs. This tool does lossless JPEG operations such as rotation and can also be used to optimize&lt;br /&gt;        and remove comments and other useless information (such as EXIF information) from your images.&lt;br /&gt;        &lt;br /&gt; &lt;br /&gt;        &lt;code&gt;jpegtran -copy none -optimize -perfect src.jpg dest.jpg&lt;/code&gt; &lt;br /&gt;    &lt;/li&gt; &lt;br /&gt;&lt;/ul&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="opt_sprites"&gt;Optimize CSS Sprites&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: images&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;ul&gt; &lt;br /&gt;    &lt;li class="bullist"&gt;Arranging the images in the sprite horizontally as opposed to vertically usually results in a smaller file size.&lt;/li&gt; &lt;br /&gt;    &lt;li class="bullist"&gt;Combining similar colors in a sprite helps you keep the color count low, ideally under 256 colors so to fit in a PNG8.&lt;/li&gt; &lt;br /&gt;    &lt;li class="bullist"&gt;"Be mobile-friendly" and don't leave big gaps between the images in a sprite. This doesn't affect the file size as much&lt;br /&gt;        but requires less memory for the user agent to decompress the image into a pixel map.&lt;br /&gt;        100x100 image is 10 thousand pixels, where 1000x1000 is 1 million pixels&lt;br /&gt;        &lt;/li&gt; &lt;br /&gt;&lt;/ul&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="no_scale"&gt;Don't Scale Images in HTML&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: images&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt; &lt;br /&gt;    Don't use a bigger image than you need just because you can set the width and height in HTML.&lt;br /&gt;    If you need &lt;br /&gt; &lt;br /&gt;        &lt;code&gt;&amp;lt;img width="100" height="100" src="mycat.jpg" alt="My Cat" /&amp;gt;&lt;/code&gt; &lt;br /&gt;    &lt;br /&gt; &lt;br /&gt;    then your image (mycat.jpg) should be 100x100px rather than a scaled down 500x500px image.&lt;br /&gt; &lt;br /&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="favicon"&gt;Make favicon.ico Small and Cacheable&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: images&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    The favicon.ico is an image that stays in the root of your server.&lt;br /&gt;    It's a necessary evil because even if you don't care about it the&lt;br /&gt;    browser will still request it, so it's better not to respond with a &lt;code&gt;404 Not Found&lt;/code&gt;.&lt;br /&gt;    Also since it's on the same server, cookies are sent every time it's requested.&lt;br /&gt;    This image also interferes with the download sequence, for example in IE when you request&lt;br /&gt;    extra components in the onload, the favicon will be downloaded before these extra components.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    So to mitigate the drawbacks of having a favicon.ico make sure:&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;&lt;ul&gt; &lt;br /&gt;    &lt;li class="bullist"&gt;It's small, preferably under 1K.&lt;/li&gt; &lt;br /&gt;    &lt;li class="bullist"&gt;Set Expires header with what you feel comfortable (since you cannot rename it if you decide to change it).&lt;br /&gt;        You can probably safely set the Expires header a few months in the future.&lt;br /&gt;        You can check the last modified date of your current favicon.ico to make an informed decision.&lt;br /&gt;    &lt;/li&gt; &lt;br /&gt;&lt;/ul&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    &lt;a href="http://www.imagemagick.org"&gt;Imagemagick&lt;/a&gt; can help you create small favicons&lt;br /&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="under25"&gt;Keep Components under 25K&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: mobile&lt;/p&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    This restriction is related to the fact that iPhone won't cache components bigger than 25K.&lt;br /&gt;    Note that this is the &lt;em&gt;uncompressed&lt;/em&gt; size. This is where minification is important&lt;br /&gt;    because gzip alone may not be sufficient.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    For more information check "&lt;a href="http://yuiblog.com/blog/2008/02/06/iphone-cacheability/"&gt;Performance Research, Part 5: iPhone Cacheability - Making it Stick&lt;/a&gt;" by Wayne Shea and Tenni Theurer.&lt;br /&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="#page-nav"&gt;top&lt;/a&gt;&lt;/p&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3 id="multipart"&gt;Pack Components into a Multipart Document&lt;/h3&gt; &lt;br /&gt; &lt;br /&gt;&lt;p class="date"&gt;tag: mobile&lt;/p&gt; &lt;br /&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;    Packing components into a multipart document is like an email with attachments,&lt;br /&gt;    it helps you fetch several components with one HTTP request (remember: HTTP requests are expensive).&lt;br /&gt;    When you use this technique, first check if the user agent supports it (iPhone does not).&lt;br /&gt; &lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-5830409070821564921?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/5830409070821564921/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=5830409070821564921&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/5830409070821564921'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/5830409070821564921'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/05/mostly-used-practises-to-speed-up-your.html' title='Mostly used Practises to Speed up your website'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-8895052538745216670</id><published>2009-05-14T00:18:00.002+05:30</published><updated>2009-05-14T00:24:44.614+05:30</updated><title type='text'>How To Save Traffic With Apache's mod_deflate</title><content type='html'>In this tutorial I will describe how to install and configure mod_deflate on an Apache2 web server. mod_deflate allows Apache2 to compress files and deliver them to clients (e.g. browsers) that can handle compressed content which most modern browsers do. With mod_deflate, you can compress HTML, text or XML files to approx. 20 - 30% of their original sizes, thus saving you server traffic and making your modem users happier.&lt;br /&gt;&lt;br /&gt;Compressing files causes a slightly higher load on the server, but in my experience this is compensated by the fact that the clients' connection times to your server decrease a lot. For example, a modem user that needed seven seconds to download an uncompressed HTML file might now only need two seconds for the same, but compressed file.&lt;br /&gt;&lt;br /&gt;By using mod_deflate you don't have to be afraid that you exclude users with older browsers that cannot handle compressed content. The browser negotiates with the server before any file is transferred, and if the browser does not have the capability to handle compressed content, the server delivers the files uncompressed.&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span class="system"&gt;mod_deflate&lt;/span&gt; has replaced Apache 1.3's &lt;span class="system"&gt;mod_gzip&lt;/span&gt; in Apache2. If you want to serve compressed files with Apache 1.3, take a look at this tutorial:                                                                                                                               &lt;a mce_real_href="http://www.howtoforge.com/linux_apache_mod_gzip" href="http://www.howtoforge.com/linux_apache_mod_gzip"&gt;mod_gzip - serving compressed content by the Apache webserver&lt;/a&gt;&lt;/p&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;1 Enable mod_deflate&lt;/h3&gt; &lt;br /&gt;&lt;p&gt;If you have Apache2 installed, &lt;span class="system"&gt;mod_deflate&lt;/span&gt; should also already be installed on your system. Now we have to enable it. On Linux with apache 2.2 installed, we can do it by setting the line in httpd.conf:&lt;/p&gt; &lt;br /&gt;&lt;p class="command"&gt; SetOutputFilter DEFLATE &lt;/p&gt; &lt;br /&gt;&lt;p&gt;Then restart Apache2:&lt;/p&gt; &lt;br /&gt;&lt;p class="command"&gt;/etc/init.d/httpd restart&lt;/p&gt; &lt;br /&gt;&lt;p&gt;On other distributions you might have to edit Apache2's configuration manually to enable &lt;span class="system"&gt;mod_deflate&lt;/span&gt;. You might have to add a line like this to the &lt;span class="system"&gt;LoadModule&lt;/span&gt; section:&lt;/p&gt; &lt;br /&gt;&lt;table class="" align="center" bgcolor="#cccccc" border="1" bordercolor="#000000" cellpadding="2" cellspacing="0" width="90%"&gt; &lt;br /&gt;      &lt;tbody&gt;&lt;tr&gt; &lt;br /&gt;        &lt;td class=""&gt; &lt;br /&gt;      &lt;pre&gt;LoadModule deflate_module /usr/lib/apache2/modules/mod_deflate.so&lt;/pre&gt; &lt;br /&gt;&lt;/td&gt;&lt;/tr&gt; &lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;br /&gt;&lt;p&gt;Make sure you adjust the path to &lt;span class="system"&gt;mod_deflate.so&lt;/span&gt;, and restart Apache2 afterwards.  &lt;/p&gt; &lt;br /&gt;&lt;p&gt; &lt;/p&gt; &lt;br /&gt;&lt;h3&gt;2 Configure mod_deflate&lt;/h3&gt; &lt;br /&gt;&lt;p&gt;The compression of files can be configured in one of two ways: either explicit exclusion of files by extension or explicit inclusion of files by MIME type. You can enable &lt;span class="system"&gt;mod_deflate&lt;/span&gt; for your whole Apache2 server, or just for specific virtual sites. Depending on this, either open &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; your Apache2's global server configuration section now or just the vhost configuration section where you want to enable &lt;span class="system"&gt;mod_deflate&lt;/span&gt;. &lt;/p&gt; &lt;br /&gt;&lt;p&gt; &lt;/p&gt; &lt;br /&gt;&lt;h4&gt;2.1 Explicit Inclusion Of Files By MIME Type&lt;/h4&gt; &lt;br /&gt;&lt;p&gt;If you want to compress HTML, text, and XML files only, add this line to your configuration: &lt;/p&gt; &lt;br /&gt;&lt;table class="" align="center" bgcolor="#cccccc" border="1" bordercolor="#000000" cellpadding="2" cellspacing="0" width="90%"&gt; &lt;br /&gt;      &lt;tbody&gt;&lt;tr&gt; &lt;br /&gt;        &lt;td class=""&gt; &lt;br /&gt;      &lt;pre&gt;AddOutputFilterByType DEFLATE text/html text/plain text/xml&lt;/pre&gt; &lt;br /&gt;&lt;/td&gt;&lt;/tr&gt; &lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;br /&gt;&lt;p&gt;This is the configuration I'm using because I don't want to compress images or PDF files or already compressed files such as zip files. &lt;/p&gt; &lt;br /&gt;&lt;p&gt; &lt;/p&gt; &lt;br /&gt;&lt;h4&gt;2.2 Explicit Exclusion Of Files By Extension&lt;/h4&gt; &lt;br /&gt;&lt;p&gt;If you want to compress all file types and exclude just a few, you would add something like this to your configuration (instead of the line from section 2.1):&lt;/p&gt; &lt;br /&gt;&lt;table class="" align="center" bgcolor="#cccccc" border="1" bordercolor="#000000" cellpadding="2" cellspacing="0" width="90%"&gt; &lt;br /&gt;      &lt;tbody&gt;&lt;tr&gt; &lt;br /&gt;        &lt;td class=""&gt; &lt;br /&gt;      &lt;pre&gt;SetOutputFilter DEFLATE&lt;br /&gt;SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ \&lt;br /&gt;    no-gzip dont-vary&lt;br /&gt;SetEnvIfNoCase Request_URI \&lt;br /&gt;    \.(?:exe|t?gz|zip|bz2|sit|rar)$ \&lt;br /&gt;    no-gzip dont-vary&lt;br /&gt;SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary&lt;/pre&gt; &lt;br /&gt;&lt;/td&gt;&lt;/tr&gt; &lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;br /&gt;&lt;p&gt;This would compress all files except images (gif, jpg, and png), already compressed files (like zip and tar.gz) and PDF files which makes sense because you do not gain much by compressing these file types.&lt;/p&gt;&lt;div id="adrectangleb"&gt;&lt;/div&gt; &lt;br /&gt;&lt;p&gt; &lt;/p&gt; &lt;br /&gt;&lt;h4&gt;2.3 Further Configuration Directives&lt;/h4&gt; &lt;br /&gt;&lt;p&gt;Regardless whether you use the configuration from section 2.1 or 2.2, you should add these lines to your configuration:  &lt;/p&gt; &lt;br /&gt;&lt;table class="" align="center" bgcolor="#cccccc" border="1" bordercolor="#000000" cellpadding="2" cellspacing="0" width="90%"&gt; &lt;br /&gt;      &lt;tbody&gt;&lt;tr&gt; &lt;br /&gt;        &lt;td class=""&gt; &lt;br /&gt;      &lt;pre&gt;BrowserMatch ^Mozilla/4 gzip-only-text/html&lt;br /&gt;BrowserMatch ^Mozilla/4\.0[678] no-gzip&lt;br /&gt;BrowserMatch \bMSIE !no-gzip !gzip-only-text/html&lt;/pre&gt; &lt;br /&gt;&lt;/td&gt;&lt;/tr&gt; &lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;br /&gt;&lt;p&gt;These lines are for some older browsers that do not support compression of files other than HTML documents.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;The configuration is now finished, and you must now restart Apache2. On Debian, you do it like this:&lt;/p&gt; &lt;br /&gt;&lt;p class="command"&gt;/etc/init.d/apache2 restart&lt;/p&gt; &lt;br /&gt;&lt;p&gt;To learn about further configuration directives, take a look at &lt;a mce_real_href="http://httpd.apache.org/docs/2.0/mod/mod_deflate.html" target="_blank" href="http://httpd.apache.org/docs/2.0/mod/mod_deflate.html"&gt;Apache Module mod_deflate&lt;/a&gt;.&lt;/p&gt; &lt;br /&gt;&lt;p&gt; &lt;/p&gt; &lt;br /&gt;&lt;h3&gt;3 Testing&lt;/h3&gt; &lt;br /&gt;&lt;p&gt;To test our compression, we add a few directives to our &lt;span class="system"&gt;mod_deflate&lt;/span&gt; configuration that log the compression ratio of delivered files. Open your &lt;span class="system"&gt;mod_deflate&lt;/span&gt; configuration and add the following lines: &lt;/p&gt; &lt;br /&gt;&lt;table class="" align="center" bgcolor="#cccccc" border="1" bordercolor="#000000" cellpadding="2" cellspacing="0" width="90%"&gt; &lt;br /&gt;      &lt;tbody&gt;&lt;tr&gt; &lt;br /&gt;        &lt;td class=""&gt; &lt;br /&gt;      &lt;pre&gt;DeflateFilterNote Input input_info&lt;br /&gt;DeflateFilterNote Output output_info&lt;br /&gt;DeflateFilterNote Ratio ratio_info&lt;br /&gt;LogFormat '"%r" %{output_info}n/%{input_info}n (%{ratio_info}n%%)' deflate&lt;br /&gt;CustomLog /var/log/apache2/deflate_log deflate&lt;/pre&gt; &lt;br /&gt;&lt;/td&gt;&lt;/tr&gt; &lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;br /&gt;&lt;p&gt;Make sure you replace &lt;span class="system"&gt;/var/log/apache2&lt;/span&gt; with your Apache2's log directory. This could be &lt;span class="system"&gt;/var/log/httpd&lt;/span&gt;, &lt;span class="system"&gt;/var/log/httpd2&lt;/span&gt;, etc. &lt;/p&gt; &lt;br /&gt;&lt;p&gt;Then restart Apache2. On Debian, do it like this:&lt;/p&gt; &lt;br /&gt;&lt;p class="command"&gt;/etc/init.d/apache2 restart&lt;/p&gt; &lt;br /&gt;&lt;p&gt;Now whenever a file is requested this will be logged in &lt;span class="system"&gt;/var/log/apache2/deflate_log&lt;/span&gt; (or to whatever file you changed it to). A typical log line looks like this:&lt;/p&gt; &lt;br /&gt;&lt;table class="" align="center" bgcolor="#cccccc" border="1" bordercolor="#000000" cellpadding="2" cellspacing="0" width="90%"&gt; &lt;br /&gt;      &lt;tbody&gt;&lt;tr&gt; &lt;br /&gt;        &lt;td class=""&gt; &lt;br /&gt;      &lt;pre&gt;"GET /info.php HTTP/1.1" 7621/45430 (16%)&lt;/pre&gt; &lt;br /&gt;&lt;/td&gt;&lt;/tr&gt; &lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;br /&gt;&lt;p&gt;You see that the file info.php was requested and delivered. Its original size was 45430 bytes, and it was compressed to 7621 bytes or 16% of its original size! This is a great result, and if your web site mostly consists out of HTML, text, and XML files, &lt;span class="system"&gt;mod_deflate&lt;/span&gt; will save you a lot of traffic, and for users with a low-bandwidth connection your site will load much faster. &lt;/p&gt; &lt;br /&gt;&lt;p&gt;If you don't need the logging after your tests anymore, you can undo the changes from section 3 and restart Apache2. &lt;/p&gt; &lt;br /&gt;&lt;p&gt; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-8895052538745216670?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/8895052538745216670/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=8895052538745216670&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/8895052538745216670'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/8895052538745216670'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/05/how-to-save-traffic-with-apaches.html' title='How To Save Traffic With Apache&apos;s mod_deflate'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-2405022147206933763</id><published>2009-05-12T17:44:00.001+05:30</published><updated>2009-05-12T17:47:07.983+05:30</updated><title type='text'>Over Rs 50,000 crore spent on Lok Sabha poll campaign</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Though attempts were made to check the spiralling amounts of money spent during the campaign for Lok Sabha polls, neither the political parties nor the Election Commission have attained the desired results in the run-up to the 2009 Parliamentary elections.&lt;br /&gt;&lt;br /&gt;According to rough estimates, the actual cost of running the campaign has crossed the staggering sum of &lt;span style="font-weight:bold;"&gt;Rs 50,000 crore&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;According to insiders in the Congress and the BJP, both parties spent over &lt;span style="font-weight:bold;"&gt;Rs 20 crore&lt;/span&gt; in merely ferrying their leaders across India during the campaign. While the Congress had hired 21 helicopters and 18 executive jets, the BJP had hired 21 helicopters and 14 jets. These parties had to shell out &lt;span style="font-weight:bold;"&gt;Rs 80,000&lt;/span&gt; per hour on each helicopter, plus the landing charges. &lt;br /&gt;&lt;br /&gt;Prime Minister Manmohan Singh , Congress president Sonia Gandhi  and Bharatiya Janata Party's  prime ministerial candidate L K Advani  were allowed to use Air Force planes to travel to their election rallies across India.&lt;br /&gt;&lt;br /&gt;The political parties have reportedly spent &lt;span style="font-weight:bold;"&gt;Rs 3000 crore&lt;/span&gt; on advertisement campaigns. The Congress spent &lt;span style="font-weight:bold;"&gt;Rs one crore&lt;/span&gt; just to buy the rights of superhit song Jai Ho, but it failed to click with the masses. &lt;br /&gt;&lt;br /&gt;Even smaller parties like the Samajwadi Party and the Rashtriya Janata Dal also spent a considerable amount of money on the campaign trail.&lt;br /&gt;&lt;br /&gt;The Election Commission's budget for the 2009 elections is &lt;span style="font-weight:bold;"&gt;Rs 1,300 crore&lt;/span&gt;, which includes the conduct of polls plus transportation and movement of security forces. The state governments and other government agencies have earmarked &lt;span style="font-weight:bold;"&gt;Rs 700 crore&lt;/span&gt; for photo identity cards, electronic voting machines and setting up polling booths.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Though attempts were made to check the spiralling amounts of money spent during the campaign for Lok Sabha polls, neither the political parties nor the Election Commission have attained the desired results in the run-up to the 2009 Parliamentary elections.&lt;br /&gt;&lt;br /&gt;According to rough estimates, the actual cost of running the campaign has crossed the staggering sum of Rs &lt;span style="font-weight:bold;"&gt;50,000 crore&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;According to insiders in the Congress and the BJP, both parties spent over Rs 20 crore in merely ferrying their leaders across India during the campaign. While the Congress had hired 21 helicopters and 18 executive jets, the BJP had hired 21 helicopters and 14 jets. These parties had to shell out Rs 80,000 per hour on each helicopter, plus the landing charges. &lt;br /&gt;&lt;br /&gt;Prime Minister Manmohan Singh , Congress president Sonia Gandhi  and Bharatiya Janata Party's  prime ministerial candidate L K Advani  were allowed to use Air Force planes to travel to their election rallies across India.&lt;br /&gt;&lt;br /&gt;The political parties have reportedly spent &lt;span style="font-weight:bold;"&gt;Rs 3000 crore&lt;/span&gt; on advertisement campaigns. The Congress spent Rs one crore just to buy the rights of superhit song Jai Ho, but it failed to click with the masses. &lt;br /&gt;&lt;br /&gt;Even smaller parties like the Samajwadi Party and the Rashtriya Janata Dal also spent a considerable amount of money on the campaign trail.&lt;br /&gt;&lt;br /&gt;The Election Commission's budget for the 2009 elections is &lt;span style="font-weight:bold;"&gt;Rs 1,300 crore&lt;/span&gt;, which includes the conduct of polls plus transportation and movement of security forces. The state governments and other government agencies have earmarked &lt;span style="font-weight:bold;"&gt;Rs 700 crore&lt;/span&gt; for photo identity cards, electronic voting machines and setting up polling booths.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-2405022147206933763?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/2405022147206933763/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=2405022147206933763&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/2405022147206933763'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/2405022147206933763'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/05/over-rs-50000-crore-spent-on-lok-sabha.html' title='Over Rs 50,000 crore spent on Lok Sabha poll campaign'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-2929659354554093257</id><published>2009-05-12T17:40:00.001+05:30</published><updated>2009-05-12T17:42:31.065+05:30</updated><title type='text'>Mayawati moves SC against Varun verdict</title><content type='html'>&lt;span style="font-weight:bold;"&gt;The Uttar Pradesh  government today moved the Supreme Court challenging advisory board's decision of revoking charges against BJP leader Varun Gandhi  under the stringent NSA for his alleged hate speeches.&lt;br /&gt;&lt;br /&gt;The advisory board on May 8 held that it neither found "plausible and convincing" grounds for the National Security Act being invoked against Varun nor was it satisfied by the explanation given by the Pilibhit  District Magistrate.&lt;br /&gt;&lt;br /&gt;29-year-old Varun, who is BJP's Lok Sabha candidate from Pilibhit, is currently on parole following a Supreme Court order after remaining in jail for nearly three weeks.&lt;br /&gt;&lt;br /&gt;He was released from Etah jail on April 16. His parole expires on May 14. Varun was let off by a three-member Advisory board headed by senior judge of the Lucknow  bench of Allahabad High Court Justice Pradeep Kant which went into the maintainability of Varun's detention by the UP government under the NSA imposed on March 29.&lt;br /&gt;&lt;/span&gt;The Uttar Pradesh  government today moved the Supreme Court challenging advisory board's decision of revoking charges against BJP leader Varun Gandhi  under the stringent NSA for his alleged hate speeches.&lt;br /&gt;&lt;br /&gt;The advisory board on May 8 held that it neither found "plausible and convincing" grounds for the National Security Act being invoked against Varun nor was it satisfied by the explanation given by the Pilibhit  District Magistrate.&lt;br /&gt;&lt;br /&gt;29-year-old Varun, who is BJP's Lok Sabha candidate from Pilibhit, is currently on parole following a Supreme Court order after remaining in jail for nearly three weeks.&lt;br /&gt;&lt;br /&gt;He was released from Etah jail on April 16. His parole expires on May 14. Varun was let off by a three-member Advisory board headed by senior judge of the Lucknow  bench of Allahabad High Court Justice Pradeep Kant which went into the maintainability of Varun's detention by the UP government under the NSA imposed on March 29.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-2929659354554093257?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/2929659354554093257/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=2929659354554093257&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/2929659354554093257'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/2929659354554093257'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/05/mayawati-moves-sc-against-varun-verdict.html' title='Mayawati moves SC against Varun verdict'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-1893026712798521632</id><published>2009-05-12T17:39:00.000+05:30</published><updated>2009-05-12T17:40:27.358+05:30</updated><title type='text'>Microsoft may lay off more if warranted: Ballmer</title><content type='html'>Microsoft, which has announced laying off 5,000 employees including 55 in India, said on Tuesday it may look at more layoffs if the economic downturn dramatically worsens again.&lt;br /&gt;&lt;br /&gt;"Presuming the economy hopefully stays as bad as it is and doesn't get dramatically worse, we will finish our plan, but if it gets dramatically worse again, we will look at things again," Microsoft Corporation CEO Steve Ballmer, told reporters in Mumbai.&lt;br /&gt;&lt;br /&gt;The Redmond-based company had announced in January it would axe 5,000 jobs globally amid the ongoing slowdown.&lt;br /&gt;&lt;br /&gt;It announced on Monday slashing one per cent of its 5,500-strong Indian workforce, amounting to 55 layoffs, in a bid to realign its business in the country.&lt;br /&gt;&lt;br /&gt;It added that it would continue to hire and create employment opportunities in line with the recovery and growth of the Indian economy.&lt;br /&gt;&lt;br /&gt;"We had said that we would lay-off about 5,000 people. We are still filling other jobs. We are mostly through that process globally and there is still some work to do," Ballmer said.&lt;br /&gt;&lt;br /&gt;"There are areas where we are continuing to add people. As I said, these are global additions, so it is a little hard to separate our work globally from our work in India," he added.&lt;br /&gt;&lt;br /&gt;Ballmer said Microsoft is the second largest foreign IT employer in India and he doesn't see a change in that.&lt;br /&gt;&lt;br /&gt;In the second round of job cuts effected on May 5, the software major said it would lay off 3,000 employees. In January, Microsoft had laid off 1,350-1,400 people, largely in the US.&lt;br /&gt;&lt;br /&gt;The Bill Gates-led firm said it would make strategic investments, which are best suited to the current economic environment.&lt;br /&gt;&lt;br /&gt;Ballmer said Microsoft is the second largest foreign IT employer in India and he doesn't see a change in that.&lt;br /&gt;&lt;br /&gt;In the second round of job cuts effected on May 5, the software major said it would lay off 3,000 employees. In January, Microsoft had laid off 1,350-1,400 people, largely in the US.&lt;br /&gt;&lt;br /&gt;The Bill Gates-led firm said it would make strategic investments, which are best suited to the current economic environment.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-1893026712798521632?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/1893026712798521632/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=1893026712798521632&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/1893026712798521632'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/1893026712798521632'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/05/microsoft-may-lay-off-more-if-warranted.html' title='Microsoft may lay off more if warranted: Ballmer'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-7750551587691073084</id><published>2009-05-08T17:13:00.001+05:30</published><updated>2009-05-08T17:30:26.878+05:30</updated><title type='text'>vSphere 4: Forerunner to a Data Center Revolution?</title><content type='html'>&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;&lt;br /&gt;"The cloud" is a term that serves as a catchall for a variety of technology offerings that have Internet hosting as their common bond. Yet these services come in an unlimited variety of shapes and sizes. As the cloud begins to take on a less-wispy form, its potential is becoming clear. VMware imagines that it might one day function as a robust, complex virtual data center, with its own OS at the center.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Cloud computing has been a central subject and strategy for IT vendors of every sort, but the actual meaning of "cloud" remains hazy.&lt;br /&gt;&lt;br /&gt;For Web-based information aggregators like Google (Nasdaq: GOOG)  and Yahoo (Nasdaq: YHOO) , the cloud offers a mechanism for delivering advertising-driven content and services.&lt;br /&gt;&lt;br /&gt;For Software as a Service (SaaS) vendors, including Salesforce.com (NYSE: CRM) , cloud infrastructures offer a highly efficient platform for hosting business applications and processes.&lt;br /&gt;&lt;br /&gt;For service providers, the cloud provides the means for supporting emerging and yet-to-be-defined business and consumer offerings.&lt;br /&gt;&lt;br /&gt;If one assumes there to be some cloud commonality among IT vendors, one would be largely incorrect. Not surprisingly, many storage vendors see the cloud as a way of supporting storage/data-centric consumer and business services.&lt;br /&gt;&lt;br /&gt;Multi-platform systems vendors tend to define at least part of their cloud value propositions according to the capabilities of proprietary server platforms.&lt;br /&gt;&lt;br /&gt;However, there are some similarities in x86/64 server-based cloud-specific products, largely because those systems are capable of commonly leveraging technologies from virtualization vendors such as VMware (NYSE: VMW), Microsoft (Nasdaq: MSFT)   and Citrix (Nasdaq: CTXS) .&lt;br /&gt;&lt;br /&gt;This last point provides the context for VMware's vSphere 4, which is essentially designed to drive forward the company's cloud computing strategy.&lt;br /&gt;&lt;br /&gt;Driving Force&lt;br /&gt;&lt;br /&gt;VMware has a different cloud vision: Rather than seeing a mechanism for simply delivering new or emerging service offerings, VMware imagines the enterprise data center as a highly flexible, scalable and changeable environment in which virtualization plays the central role in aggregating, integrating, managing and provisioning enormous pools of processor, server, storage and networking assets.&lt;br /&gt;&lt;br /&gt;The company's view of the cloud appears to have struck a chord among its server vendor partners, whose executives offered their support on video or in person at the recent vSphere launch event at VMware headquarters in Palo Alto, Calif.&lt;br /&gt;&lt;br /&gt;Cisco's (Nasdaq: CSCO)  John Chambers, Dell's (Nasdaq: DELL) Michael Dell, EMC's (NYSE: EMC)  Joe Tucci, HP's (NYSE: HPQ) James Munton and Intel's (Nasdaq: INTC)  Pat Gelsinger were palpably enthusiastic about vSphere, and with good reason. If the effort succeeds to the extent that VMware and others expect, it will provide the driving force behind next-generation data centers.&lt;br /&gt;&lt;br /&gt;Why? Because vSphere 4 is not just about cloud computing. While x86/64-based solutions have led server volume sales for several years, their overall performance and utilization have tended to suffer in comparison to Unix and mainframe systems.&lt;br /&gt;&lt;br /&gt;Virtualization has helped to correct the traditionally woeful system utilization of x86/64 servers. Indeed, without virtualization, x86/64-based technologies would not be sustainable data center solutions.&lt;br /&gt;&lt;br /&gt;Ushering In a New Age&lt;br /&gt;&lt;br /&gt;VMware produced some eye-opening vSphere performance metrics -- including sustained 300,000 IOPS and up to 9,000 transactions per second on single systems -- that suggest a fundamental shift in performance that will allow x86/64 systems to fully inhabit every corner of the enterprise.&lt;br /&gt;&lt;br /&gt;This, combined with other new features, including VMware Fault Tolerance, makes the platform eminently suitable for supporting business-critical applications and what VMware CEO Paul Maritz calls the "Big Computer" and the "21st Century Mainframe."&lt;br /&gt;&lt;br /&gt;In other words, VMware considers vSphere 4 the key to ushering in an age in which highly virtualized, highly integrated industry standard x86/64 systems take over the jobs currently held by legacy enterprise systems.&lt;br /&gt;&lt;br /&gt;Is this scenario remotely possible? Perhaps so. One could point to the emergence of x86/64 as the platform of choice in the vast majority of supercomputing installations -- a market once dominated by proprietary systems and technologies -- as an example of what is possible with innovative x86/64 development.&lt;br /&gt;&lt;br /&gt;Is vSphere 4, then, poised to initiate the coming data center revolution?&lt;br /&gt;&lt;br /&gt;Not quite. It is highly powerful and flexible, but VMware's new offering is a work in progress -- even though it is definitely several steps ahead of previous company offerings.&lt;br /&gt;&lt;br /&gt;That said, if VMware delivers as promised on its product road map, vSphere 4 could become the platform to beat in x86/64 virtualization, and it will play an elemental role in how the company's customers and partners design, develop and deploy 21st century cloud computing data centers.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-7750551587691073084?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/7750551587691073084/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=7750551587691073084&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/7750551587691073084'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/7750551587691073084'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/05/vsphere-4-forerunner-to-data-center.html' title='vSphere 4: Forerunner to a Data Center Revolution?'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-1407592660588385357</id><published>2009-05-08T17:07:00.002+05:30</published><updated>2009-05-08T17:10:40.395+05:30</updated><title type='text'>Gadgets on the Run: Keeping Tabs on Moving IT Assets</title><content type='html'>&lt;p class="story-summary"&gt;As enterprises deploy growing ranks of mobile, remote and telecommuting employees, keeping track of the many mobile devices they use has introduced new headaches for IT managers. Mobile asset management is a part of the larger IT asset management strategy and should not be viewed as a separate type of asset management program.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="story-body"&gt;It's no secret that the business world is going mobile. Companies are beginning to move to a virtual environment -- especially sales teams who have to be on the road more often. The trend of telecommuting is also starting to catch on. With this in mind, IT managers are faced with a new headache: managing what they can't see. Companies are struggling to create and understand mobile IT strategy.&lt;/p&gt; &lt;br /&gt;&lt;span id="intelliTxt"&gt;&lt;p&gt;IT asset managers are faced with the challenge of managing mobile "moving assets" in a variety of scenarios including, but not limited to:&lt;/p&gt;&lt;ul&gt; &lt;br /&gt;&lt;li&gt;geographically dispersed offices (including multi-national organizations)&lt;/li&gt; &lt;br /&gt;&lt;li&gt;larger number of mobile devices than ever before&lt;/li&gt; &lt;br /&gt;&lt;li&gt;growing trends toward telecommuting&lt;/li&gt; &lt;br /&gt;&lt;li&gt;virtualization technologies and &lt;a href="http://en.wikipedia.org/wiki/Application_service_provider" target="_blank"&gt;ASP&lt;/a&gt; (hosted) services&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt;While mobile and remote workforces are nothing new, moving assets can cost companies millions (even billions) of dollars when not accounted for, and they can put organizations at even greater risk. While physical hardware usually has a shelf life of three to five years, mobile assets have a much shorter lifespan. &lt;br /&gt;&lt;br /&gt;&lt;h2 class="subhead"&gt; &lt;br /&gt;Special Attention&lt;br /&gt;&lt;/h2&gt; &lt;br /&gt;&lt;p&gt; &lt;br /&gt;There are a number of activities that enterprise IT staffs need to pay special attention to if they want to effectively manage these moving assets:&lt;/p&gt;&lt;ol&gt; &lt;br /&gt;&lt;li&gt;Define your mobile IT strategy. The tendency is to start with the technology and work backwards to try to solve the business problem. Accounting for mobile assets within your organization's regular ITAM (IT asset management) program should be the norm. However, mobile assets are likely the most difficult to track and manage, and -- most often -- the type of asset that is most often unaccounted for.&lt;/li&gt; &lt;br /&gt;&lt;li&gt;Identify the right tool set for managing mobile IT. There are many solutions out there, from scanning tagged hardware to automating software asset management solutions.  There are many options available, but finding the right one is imperative. Ideally, whatever type of solution you use, it would be best to integrate it with other systems, such as your financial systems, to provide better trend and cost analysis, geographic mapping and more robust reporting, as well as to enable better ROI (return on investment) tracking against monies spent. Some tools that are helpful for managing mobile assets:&lt;/p&gt;&lt;ul&gt; &lt;br /&gt;&lt;li&gt;Automated Solutions. Like IT asset management, mobile asset management needs discovery and ongoing management. From tracking hardware -- such as PCs, Macs, laptops, PDAs, smart phones and many other moving assets -- to tracking the software and user license sitting within the hardware -- from MS Office Suite to &lt;a class="story-keyword-offsite" href="http://www.adobe.com" onclick="window.open('http://www.adobe.com'); return false;"&gt;Adobe&lt;/a&gt; (Nasdaq: ADBE) &lt;a class="story-keyword-search" href="/perl/search.pl?query=Adobe&amp;amp;scope=network"&gt;&lt;img src="/images/2009/icon-inline-search.gif" width="10" height="10" border="0" title="More about Adobe" alt="More about Adobe" /&gt;&lt;/a&gt; -- having an automated asset tracking system can eliminate costly and time-consuming site visits. In the case of moving assets, an automated ITAM tracking system with a discovery feature would be extremely useful for reporting enterprise software and hardware assets on each of the moving assets without doing a physical "roll call."&lt;/li&gt; &lt;br /&gt;&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/RFID" target="_blank"&gt;RFID&lt;/a&gt;. For the large enterprise, this can be extremely useful in tracking hardware -- from PDAs (personal data assistants) to laptops to servers. When the information from the barcode/scanning technology is integrated into the whole ITAM program, it can initially give you some powerful ROI.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/li&gt; &lt;br /&gt;&lt;li&gt;Deal with leased and inactive mobile devices. How often do you realize that one of your employees has three BlackBerrys or two laptops? (Of course, he or she is only using one, while the other is propping the office door open). A simple solution is to run a quarterly report for missing leased equipment -- from laptops to mobile PDAs -- and review which computers have not connected to the network within 30 days or more. Assuming that you're following ITAM best practices, you'll be able to quickly find your missing and inactive items for redeployment within your organization or to retire the IT asset (instead of letting it become a dust catcher).&lt;/li&gt; &lt;br /&gt;&lt;li&gt;Manage software licenses -- reduce cost and decrease your risk. Software licenses on mobile assets allow vendors to pull in millions of dollars during vendor audits. Software licenses are usually licensed by usage and tracked via discovery. Similar to mobile devices, unused licenses should also be taken into account via usage analysis. By proactively managing software licenses and usage on mobile assets, you can reduce risk and costs.&lt;/li&gt; &lt;br /&gt;&lt;li&gt;Get in step with the greening of technology. While green technology does exist, it's in its infancy and it's expensive. However, IT disposal -- especially of mobile devices -- can be utilized for a company's green program (if one exists) or even for charitable donations (there are a lot of programs taking cell phones, laptops, PDAs and the like). Fundamentally, disposing of your mobile assets could be looked upon as a way of "doing good."&lt;/li&gt;&lt;/ol&gt;&lt;p&gt; &lt;br /&gt;&lt;h2 class="subhead"&gt; &lt;br /&gt;Bigger Picture&lt;br /&gt;&lt;/h2&gt; &lt;br /&gt;If nothing else, remember these three things:&lt;/p&gt;&lt;ol&gt; &lt;br /&gt;&lt;li&gt;Effective management of mobile assets is a part of the larger IT asset management strategy and should not be viewed as a separate type of asset management program.&lt;/li&gt; &lt;br /&gt;&lt;li&gt;One major advantage of proper management of mobile devices -- as well as fixed assets in general -- is the ability to show a quick return on investment in terms of dollars, savings and business gaps throughout the organization, especially with multi-location and multinational companies. This always scores points with the senior executives and may put some dollars back in the budget, as you can build a real case on savings with real dollars. Mobile devices certainly would account for a percentage of savings from retaining, recovering, deploying or retiring "moving" IT assets. &lt;/li&gt; &lt;br /&gt;&lt;li&gt;Because mobile devices are not always top of mind with the IT folks or senior management and rarely (if ever) tracked properly, it's imperative to create policies and processes -- and enforce them.&lt;br /&gt;&lt;img src="http://www.ectnews.com/images/end-enn.gif" width="21" height="10" border="0" /&gt; &lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-1407592660588385357?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/1407592660588385357/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=1407592660588385357&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/1407592660588385357'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/1407592660588385357'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/05/gadgets-on-run-keeping-tabs-on-moving.html' title='Gadgets on the Run: Keeping Tabs on Moving IT Assets'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-4881809024251669077</id><published>2009-05-08T16:50:00.001+05:30</published><updated>2009-05-08T16:50:42.728+05:30</updated><title type='text'>Tata, SBI among world's most reputable firms</title><content type='html'>The Tata Group has been named the world's eleventh most reputed company, according to a study compiled by United States-based Reputation Institute.&lt;br /&gt;&lt;br /&gt;Not just that, the Tata Group, whose Global Pulse Score was put at 80.89, has been ranked above global giants like Google, Microsoft, General Electric, Toyota, Coca-Cola, Intel, Univler, et cetera.&lt;br /&gt;&lt;br /&gt;The Reputation Institute's Global Pulse is a measure of corporate reputation calculated by averaging perceptions of four main indicators -- trust, esteem, admiration, and good feeling -- obtained from a representative sample of at least 100 respondents in the companies' home countries. The Global Pulse scores are on a scale of 0 to 100.&lt;br /&gt;&lt;br /&gt;Tata Group is one of India's largest industrial conglomerates and runs more than 98 firms.&lt;br /&gt;&lt;br /&gt;For the record, Italian confectioner Ferrero has been ranked the world's most reputable business entity.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-4881809024251669077?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/4881809024251669077/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=4881809024251669077&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/4881809024251669077'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/4881809024251669077'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/05/tata-sbi-among-worlds-most-reputable.html' title='Tata, SBI among world&apos;s most reputable firms'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-3090512607790833545</id><published>2009-05-07T17:13:00.001+05:30</published><updated>2009-05-07T17:13:58.885+05:30</updated><title type='text'>Is Barack Obama right about Bangalore?</title><content type='html'>Before anyone in India gets hot under the collar about US President Barack Obama's tax proposals, because they might seem targeted at job creation in 'Bangalore,' it is important to understand what he is trying to do. For, on any rational basis, it is hard to be critical.&lt;br /&gt;&lt;br /&gt;American companies that invest abroad have been tax-exempt on the profits from such businesses until they bring the profits back into the US; however, they have been allowed to claim a set-off on the expenses related to such investment. &lt;br /&gt;&lt;br /&gt;This has been an open invitation to invest overseas and not in the home market, especially if the money is routed through tax havens so that the firms pay no tax on their profits anywhere. Mr Obama has called this a 'scam,' a term to which American businessmen have taken umbrage, but it is hard to think of it in any other terms.&lt;br /&gt;&lt;br /&gt;The figures trotted out, showing that effective tax rates on such investments have been in the 2-3 percentage points range, support the president's drive to raise the effective level of tax on such corporate activity, at a time when he is running a gigantic deficit and needs money for other programmes.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-3090512607790833545?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/3090512607790833545/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=3090512607790833545&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/3090512607790833545'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/3090512607790833545'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/05/is-barack-obama-right-about-bangalore.html' title='Is Barack Obama right about Bangalore?'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-2991781363077438062</id><published>2009-05-04T18:51:00.000+05:30</published><updated>2009-05-04T18:53:43.781+05:30</updated><title type='text'>Dhoni to lead Team India in T20 World Cup</title><content type='html'>Mahendra Singh Dhoni will lead a 15-member Indian squad in the ICC Twenty20 World Championship in England next month.&lt;br /&gt;&lt;br /&gt;Virender Sehwag has been named the vice captain for the series.&lt;br /&gt;&lt;br /&gt;Apart from Dhoni and Sehwag, Paceman R P Singh was on Monday rewarded for his consistent performance in the ongoing IPL with a recall while fellow speedster Munaf Patel  was dropped from India's 15-member squad for next month's Twenty20  World Cup in England .&lt;br /&gt;&lt;br /&gt;Wicketkeeper-batsman Dinesh Karthik , who figured in India's squad that played the last Twenty20 in New Zealand  in February end, has also been dropped from the squad which has no major surprises. Hard-hitting batsman Robin Uthappa  was also omitted.&lt;br /&gt;&lt;br /&gt;India, who won the inaugural edition of the championship in South Africa  in 2007, will be led by Mahendra Singh Dhoni  while Virender Sehwag  has been named his deputy.&lt;br /&gt;&lt;br /&gt;The squad includes five specialist batsmen, five specialist pacers, two spinners, two all-rounders and a wicket-keeper in Dhoni.&lt;br /&gt;&lt;br /&gt;The selectors had earlier announced a list of 30 probables for the event, to be held in England from June 5 to 21, and today pruned it to the final 15. All participating teams have to submit the final squad by Tuesday as per the ICC  rules.&lt;br /&gt;&lt;br /&gt;As expected, there are no major surprises in the squad which was picked up by the selection panel, headed by former India captain Krishnamachari Srikkanth via teleconference.&lt;br /&gt;&lt;br /&gt;Among others who could not make it to the final 15 are Tamil Nadu opener M Vijay, Mumbai  trio of Ajinkya Rahane, Dhawal Kulkarni and Abhishek Nayar , Tamil Nadu batsman S Badrinath, Delhi  batsman Virat Kohli , Bengal duo of Manoj Tiwary and Wriddhiman Saha, Haryana leggie Amit Mishra , Tamil Nadu pacer L Balaji  and Madhya Pradesh  stumper Naman Ojha.&lt;br /&gt;&lt;br /&gt;Tamil Nadu off-spinner R Ashwin, who was named back-up for Harbhajan Singh , also failed to survive the pruning exercise.&lt;br /&gt;&lt;br /&gt;Youngsters Abhishek Raut, who plays for Rajasthan Royals , and Bangalore's Shrivats Goswami also could not make the cut despite their decent showing in the Indian Premier League .&lt;br /&gt;&lt;br /&gt;Joginder Sharma, who is remembered for his last over in the inaugural edition of the Twenty20 World Cup, could not find a place in the 30-member list of probables, along with Piyush Chawla  and S Sreesanth .&lt;br /&gt;&lt;br /&gt;Sreesanth is recovering from a back injury and has not played competitive cricket for the last few months.&lt;br /&gt;&lt;br /&gt;Sachin Tendulkar  had opted out of the Twenty20 World Cup in 2007 and continues to remain away from the shortest format of the game despite his good form in recent time.&lt;br /&gt;&lt;br /&gt;Squad: M S Dhoni (c), Virender Sehwag (v-c), Gautam Gambhir , Suresh Raina , Yuvraj Singh , Yusuf Pathan , Rohit Sharma , Harbhajan Singh, Zaheer Khan , Ishant Sharma , Praveen Kumar, RP Singh, Ravindra Jadeja , Pragyan Ojha  and Irfan Pathan .&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-2991781363077438062?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/2991781363077438062/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=2991781363077438062&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/2991781363077438062'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/2991781363077438062'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/05/dhoni-to-lead-team-india-in-t20-world.html' title='Dhoni to lead Team India in T20 World Cup'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-8710978521797242406</id><published>2009-05-03T13:50:00.002+05:30</published><updated>2009-05-03T13:53:34.027+05:30</updated><title type='text'>India orders 250,000 OLPC laptops</title><content type='html'>The '$10, world's cheapest laptop', developed in India has been given a quiet burial with the government placing an order for 250,000 XO laptops from the Nicholas Negroponte-led One Laptop Per Child (OLPC) Foundation.&lt;br /&gt;&lt;br /&gt;The $10 'laptop' had turned into a major bone of contention with the global IT industry and experts blasting the device that was earlier projected as a challenger to the $100 laptop of the OLPC project.&lt;br /&gt;&lt;br /&gt;Meanwhile, Satish Jha, OLPC India president and CEO, was quoted in the media as saying that the OLPC XO laptops "have been ordered for 1,500 schools (throughout the country) and the deliveries will begin in June."&lt;br /&gt;&lt;br /&gt;Now lets have a look on the fake scheme of government ignoring the below key points:&lt;br /&gt;&lt;br /&gt;This is one of the biggest fraud waiting to come.&lt;br /&gt;&lt;br /&gt;1. Whats point in procuring laptop for schoolkids when p[rimary education DO NOT need any computer / laptop.&lt;br /&gt;&lt;br /&gt;2. If at all laptops are baught, which operaing system it will work on? Who will pay license fee?&lt;br /&gt;&lt;br /&gt;3. WHat applications will be there on laptop for use ? WHat value will they add ?&lt;br /&gt;&lt;br /&gt;4. If procured, how distribution will take place? Why only 1500 schools, what about other thousands of schools?&lt;br /&gt;&lt;br /&gt;5. We dont give funds for primary education to rural areas. Why waste funds for unnecessary laptops in urban areas? &lt;br /&gt;&lt;br /&gt;This is just to eat commission. FRAUD. FRAUD. FRAUD. FRAUD.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-8710978521797242406?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/8710978521797242406/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=8710978521797242406&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/8710978521797242406'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/8710978521797242406'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/05/india-orders-250000-olpc-laptops.html' title='India orders 250,000 OLPC laptops'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-4267956563950579248</id><published>2009-05-02T13:43:00.002+05:30</published><updated>2009-05-02T13:48:58.105+05:30</updated><title type='text'>Harshad Mehta's Reborn Version: Nirmal Kotecha and his Techniques</title><content type='html'>&lt;span style="font-weight:bold;"&gt;The man who follows Harshad Mehta's technique:Nirmal Kotecha&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The son of an LIC agent who also ran a medical shop in Kochi, Nirmal Kotecha hasn't done too badly for himself. At 32, he is estimated to be worth about Rs 500 crore (Rs 5 billion).&lt;br /&gt;&lt;br /&gt;His acquaintances have many adjectives for him: From 'genius' to a man wildly passionate about the stock markets to someone who was in a tearing hurry to make money etc.&lt;br /&gt;&lt;br /&gt;Last week, he earned another sobriquet -- 'the mastermind and the main beneficiary of the Pyramid Saimira forgery'-- from the capital market regulator.&lt;br /&gt;&lt;br /&gt;The April 23 order by the regulator said Kotecha had masterminded the forgery of a Securities and Exchange Board of India letter ordering directors of Pyramid, which runs a chain of theatres, to make an open offer to shareholders.&lt;br /&gt;&lt;br /&gt;Since the forgery was aimed at manipulating the company's share price, Sebi barred 230 people and entities from trading.&lt;br /&gt;&lt;br /&gt;The regulator also suspects that Kotecha used several front companies to trade in various stocks, and that there are indications of massive fund rotation among these front entities.&lt;br /&gt;&lt;br /&gt;In a way, this wasn't a surprise. Kotecha has had the distinction of being on the Sebi's watch list on at least two other price manipulation cases -- Atlanta Ltd and SEL Manufacturing.&lt;br /&gt;&lt;br /&gt;The modus operandus in both cases was similar to that of Pyramid: As Sebi discovered, Kotecha bought stakes in the companies at throwaway prices from the promoters, rigged the prices and then dumped the stock.&lt;br /&gt;&lt;br /&gt;This may sound boringly familiar; many operators do just this frequently in the Indian stock markets, but Kotecha did it with finesse that would have made his self-confessed inspiration -- Harshad Mehta -- proud. He started investing in the market in 1993 at the age of 16, when Harshad Mehta's scam came to light and the young Kotecha was one of his ardent admirers.&lt;br /&gt;&lt;br /&gt;By the time Mehta's cookie crumbled, Kotecha was deeply into investing and became a sub-broker at the Kochi Stock Exchange at the age of 18. Kotecha made his real big money during the technology boom in 2000.&lt;br /&gt;&lt;br /&gt;He shifted to the Mumbai market soon after.&lt;br /&gt;&lt;br /&gt;In the process, he opened many companies -- Skyz Financial Consultant and Kotecha Capital were just two of them.&lt;br /&gt;&lt;br /&gt;As Sebi found, he was also using a large number of front accounts, including those of his relatives, to manipulate the securities market and to route the funds through several layers -- a reason the regulator has requested the Reserve Bank of India, Financial Intelligence Unit and the income tax department to look into possible money laundering.&lt;br /&gt;&lt;br /&gt;All through, Kotecha seems to have used his early contacts with many promoters of small gems and jewellery companies well (he had invested in many of their IPOs as well). No wonder 43 of the 230 entities in the Sebi order belong to the gems and jewellery sector.&lt;br /&gt;&lt;br /&gt;Though he has been known to be dealing in small IPOs to make mega bucks, many agree he perhaps went too far this time.&lt;br /&gt;&lt;br /&gt;First, he forged a Sebi letter in which the regulator directed the promoters to make an open offer for Pyramid Saimira -- potential market-moving information.&lt;br /&gt;&lt;br /&gt;Then he and his partners in the Pyramid case also planted a fake company secretary and gave this person's number to journalists who were sent the forged letter. When journalists called for confirmation, this person impersonating the company secretary claimed that Pyramid had indeed received such a letter from the regulator!&lt;br /&gt;&lt;br /&gt;So when the Pyramid stock price surged after the forged letter became public, Kotecha went for the kill and reduced his holding from 24 per cent to just 0.24 per cent in just three months, making a massive profit.&lt;br /&gt;&lt;br /&gt;Of late, Kotecha had shifted his attention to private equity too. For example, his PE firm Kotecha Capital picked up 49 per cent stake in the Bangalore-based US Pizza.&lt;br /&gt;&lt;br /&gt;Although the exact valuation of the deal isn't known, media reports said Kotecha will invest over Rs 500 crore (Rs 5 billion), including debt, as the fast food chain plans to expand at a furious pace.&lt;br /&gt;&lt;br /&gt;But many people say it would be a mistake to write off Kotecha. After all, Sebi's order is just an interim one and Kotecha will obviously challenge it. He was let off on two earlier occasions. Will it be third time lucky for the market player?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-4267956563950579248?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/4267956563950579248/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=4267956563950579248&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/4267956563950579248'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/4267956563950579248'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/05/harshad-mehtas-reborn-version-nirmal.html' title='Harshad Mehta&apos;s Reborn Version: Nirmal Kotecha and his Techniques'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-8029066501590500228</id><published>2009-05-02T13:32:00.002+05:30</published><updated>2009-05-02T13:36:44.108+05:30</updated><title type='text'>What is Swine FLU ?</title><content type='html'>Swine influenza (also called swine flu, hog flu, and pig flu) refers to influenza caused by those strains of influenza virus that usually infect pigs and are called swine influenza virus (SIV). Swine influenza is common in pigs in the midwestern United States (and occasionally in other states), Mexico, Canada, South America, Europe (including the United Kingdom, Sweden, and Italy), Kenya, Mainland China, Taiwan, Japan and other parts of eastern Asia.&lt;br /&gt;&lt;br /&gt;Transmission of SIV from pigs to humans is not common. When it results in human influenza, it is called zoonotic swine flu. People who work with pigs, especially people with intense exposures, are at risk of catching swine flu. However, only about fifty such transmissions have been recorded since the mid-20th Century, when identification of influenza subtypes became possible. (Importantly, eating pork does not pose a risk of infection.) Rarely, these strains of swine flu can pass from human to human. In humans, the symptoms of swine flu are similar to those of influenza and of influenza-like illness in general, namely chills, fever, sore throat, muscle pains, severe headache, coughing, weakness and general discomfort.&lt;br /&gt;&lt;br /&gt;The 2009 flu outbreak in humans that is widely known as "swine flu" is due to a new strain of influenza A virus subtype H1N1 that was produced by reassortment from one strain of human influenza virus, one strain of avian influenza virus, and two separate strains of SIV. The origin of this new strain is unknown, and the World Organization for Animal Health (OIE) reports that this strain has not been isolated in pigs.[2] It passes with apparent ease from human to human, an ability attributed to an as-yet unidentified mutation.[3] This 2009 H1N1 strain causes the normal symptoms of influenza, such as fever, coughing and headache.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-8029066501590500228?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/8029066501590500228/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=8029066501590500228&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/8029066501590500228'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/8029066501590500228'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/05/what-is-swine-flu.html' title='What is Swine FLU ?'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-1324708821646973292</id><published>2009-04-29T12:17:00.001+05:30</published><updated>2009-04-29T12:17:30.329+05:30</updated><title type='text'>HP unviels PRO-BOOK laptop Line</title><content type='html'>Hewlett-Packard Co , the world’s top PC maker, is launching a new line of inexpensive business laptops with fresh features targeting users at small and medium-size companies.&lt;br /&gt;The HP ProBook s-series, which starts shipping globally on Tuesday, is the company’s new mainstream business notebook, following the release of its higher-end, lightweight EliteBook line last year.&lt;br /&gt;The ProBook replaces the HP Compaq line, although the Compaq name will continue to be used as a master brand name in other PCs.&lt;br /&gt;The ProBook offers users a number of new features, including an optional Linux-based operating system pre-installed -- Novell Inc’s SuSE Linux Enterprise Desktop 11 -- for those seeking an alternative to the dominant Microsoft Corp Windows platform.&lt;br /&gt;It is HP’s first-ever Linux pre-install on a standard business laptop, the company said. The PC maker does offer some netbooks with .&lt;br /&gt;“It’s pretty much a natural evolution,” said Carol Hess- Nickels, HP’s director of marketing for worldwide business notebooks.&lt;br /&gt;“We want to provide a different option ... it’s probably a little time yet before we’ll know exactly what the demand is, but we did think it was something worth trying.”&lt;br /&gt;The ProBooks come with 14-inch, 15.6-inch and 17.3-inch screen sizes, with prices starting at $529. In another first for an HP business notebook, buyers will be able to add a color finish -- “merlot” -- if they choose.&lt;br /&gt;Some models will also feature Qualcomm Inc’s Gobi technology, allowing them to use a single module to access different mobile broadband network technologies and mobile operators.&lt;br /&gt;HP will also bring higher-end durability features, like its 3D DriveGuard -- which protects the hard drive if a laptop is dropped -- and a spill-resistant keyboard to the ProBook.&lt;br /&gt;HP is the world’s No. 1 PC vendor, with a first-quarter global market share of more than 20 percent, according to research house IDC, well ahead of second-place Dell Inc. HP also took over the top spot in the US market from Dell in the first quarter.&lt;br /&gt;The shares of Palo Alto, California-based HP closed the regular session down 35 cents at $35.45 on the New York Stock Exchange on Monday.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-1324708821646973292?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/1324708821646973292/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=1324708821646973292&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/1324708821646973292'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/1324708821646973292'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/04/hp-unviels-pro-book-laptop-line.html' title='HP unviels PRO-BOOK laptop Line'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-2050879930568238661</id><published>2009-04-29T12:02:00.001+05:30</published><updated>2009-04-29T12:05:00.853+05:30</updated><title type='text'>The Negative Voting Option: Elections</title><content type='html'>In the forthcoming general election, as has become the practice in India, the choice you will probably get to exercise will be between voting for either Tweedledum or Tweedledee. It’s bad enough that it’s barely a choice. Worse still, though, both Tweedledum and Tweedledee may turn out to be murderers or rapists, as has been the reality in some constituencies of late. Vote we must, but the question is for whom, if the choice happens to be between the devil and the deep sea.&lt;br /&gt;&lt;br /&gt;Why do we have to choose between two evils? Behind the noisy and colourful facade of elections, political parties decide on which candidates they will field regardless of the background, criminal or otherwise, of the candidate. The most recent example of this phenomenon is from the Tamar constituency in Jharkhand which earned laurels for defeating Shibu Soren in January. What is perhaps not widely known is that Gopal Krishna Patar, who defeated Soren, is an accused out on bail; Patar faces a criminal case under various sections of the Indian Penal Code, including attempt to murder. &lt;br /&gt;What could the voters in the Tamar constituency do if they did not want to vote for either Soren, found guilty of murder in 2006, or Patar? There is no option currently; but there could easily be one. This option is popularly called “None of the above”, or Nota.&lt;br /&gt;Though the idea of Nota captured the popular imagination after the citizen protests in the wake of 26/11, it is not new. The Law Commission of India first recommended it in May 1999, in its 170th report on electoral reforms.&lt;br /&gt;In its report, the Law Commission submitted its recommendation for Nota in combination with the electoral requirement that a candidate gain at least 50%+1 of the votes cast to be declared the winner. These provisions, according to the commission, would go “a long way in ensuring purity of elections, keeping out criminals and other undesirable elements and also serve to minimize the role and importance of caste and religion”.&lt;br /&gt;The report noted that such provisions would achieve two objectives. The first would be “to cut down or, at any rate, to curtail the significance and role played by caste factor in the electoral process… This means that a candidate has to carry with him several castes and communities, to succeed.” This would certainly work to reduce the caste-based fragmentation of the polity and help develop holistic and pluralistic perspectives.&lt;br /&gt;&lt;br /&gt;The second objective would be “to put moral pressure on political parties not to put forward candidates with undesirable record i.e., criminals, corrupt elements and persons with unsavoury background… It also acts as a powerful disincentive against voter intimidation.” Given that the last election put 125 candidates with pending criminal cases into the Lok Sabha, discouraging candidates with dubious backgrounds is essential.&lt;br /&gt;There are, no doubt, practical difficulties in implementing these provisions, which the Law Commission observed. “If electronic voting machines (EVM) are introduced throughout the country, it will become a little more easier to implement this,” the report said.&lt;br /&gt;The Election Commission of India supported these suggestions in its recommendations to the government on 10 December 2001, and reiterated then again in a letter from the then chief election commissioner to the Prime Minister on 4 July 2004.&lt;br /&gt;Despite such clear and specific recommendations, and having had electronic voting machines in use for quite a few years, the government has not considered it fit to implement this provision. The Law Commission seems to have foreseen this when it said in 1999 that, “problems arise because of...lack of requisite standards of behaviour and also of cooperation and understanding among the political parties to ensure a peaceful poll. As a matter of fact, the election offences are not decreasing but are increasing, with every passing election.” Technology and a maturing democracy are supposed to make things easier; but it’s the reverse in India.&lt;br /&gt;Voters having to vote without having a real choice is not really democratic.&lt;br /&gt;It is under the above circumstances that an option of “None of the above” or “I do not vote for any of the above candidates” has the potential of giving voters some real choice, thus taking us closer to real democracy. It can nudge political parties to select better candidates. In case the Nota option gets the highest number of votes cast, the law would require repolling, that too with the earlier candidates not being allowed to recontest. There will be some costs to repolls, though much less now with EVMs. But democracy needs and deserves such investments. If the return is an improvement in the quality of candidates, the investment would be well worth it.&lt;br /&gt;Even without a repoll, some moral pressure may be applied on political parties. When the Nota option is repeatedly exercised across India, parties are sure to learn the lesson. The purpose of the exercise is not to ask voters to “not vote”, but rather to nudge political parties to select better candidates.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-2050879930568238661?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/2050879930568238661/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=2050879930568238661&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/2050879930568238661'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/2050879930568238661'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/04/negative-voting-option-elections.html' title='The Negative Voting Option: Elections'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-977306216994183685</id><published>2009-04-27T13:05:00.002+05:30</published><updated>2009-04-27T13:08:36.179+05:30</updated><title type='text'>Gigabyte Launches 3 WinMob Handsets in India</title><content type='html'>In Feb of this year, GIGABYTE Communications Inc. had announced its foray into the rapidly growing mobile phone market with the launch of its award winning new generation GSmart phones that included the MS820 touchscreen handset with GPS. They have now introduced two new models of touch screen Windows Mobile PDA phones for the Indian market along with the MS820 and - the MW702 and MW700. &lt;br /&gt;&lt;br /&gt;The GSmart mobile phones being launched in India run on a Windows Mobile 6.1 Professional OS and come equipped with features that also include built-in GPS, Autofocus cameras some of which include Face Detection, Wi-Fi and Bluetooth as well as external memory support via microSD cards.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div align="center"&gt;&lt;div align="center"&gt;&lt;a href="http://tech2.in.com/media/images/2009/Apr/img_137272_new_handsets.jpg" target="_blank"&gt;&lt;img src="http://tech2.in.com/media/images/2009/Apr/img_137272_new_handsets_450x360.jpg" border="0" alt="" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The GSmart MS820, according to the company is capable of working virtually with all audio, video and image formats and features - &lt;br /&gt;&lt;ul&gt;&lt;li&gt;3.5G: HSDPA 7.2Mbps, WCDMA 2100, EDGE, GPRS, GSM Tri-band&lt;/li&gt;&lt;li&gt;Modem: QUALCOMM MSM 6280&lt;/li&gt;&lt;li&gt;CPU: Marvell PXA270, 520MHz&lt;/li&gt;&lt;li&gt;2.8-inch VGA TFT LCD touch panel&lt;/li&gt;&lt;li&gt;5M camera with Face Detection&lt;/li&gt;&lt;li&gt;Smart sensor accelerometer&lt;/li&gt;&lt;li&gt;Built-in GPS: SiRF Star III&lt;/li&gt;&lt;/ul&gt;The MW702 comes with &amp;ndash;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;2.75G: EDGE, GPRS, GSM 900, 1800, 1900&lt;/li&gt;&lt;li&gt;CPU: Marvell PXA270, 520MHz&lt;/li&gt;&lt;li&gt;Modem: Qualcomm 6235&lt;/li&gt;&lt;li&gt;2.8-inch full touch panel with high resolution screen&lt;/li&gt;&lt;li&gt;&amp;nbsp;&amp;ldquo;Smart Touch&amp;rdquo; Personal finger-touch UI&lt;/li&gt;&lt;li&gt;3.0 Mega pixels with Auto Focus Camera&lt;/li&gt;&lt;li&gt;Built-in GPS: SiRF III Built-in&lt;/li&gt;&lt;/ul&gt;The third in the set, the MW700 will feature &amp;ndash; &lt;br /&gt;&lt;ul&gt;&lt;li&gt;EDGE, GPRS, GSM tri-band&lt;/li&gt;&lt;li&gt;Built-in GPS: SiRF Star III&lt;/li&gt;&lt;li&gt;14.95mm thin&lt;/li&gt;&lt;li&gt;Video Telephony&lt;/li&gt;&lt;li&gt;Modem: QUALCOMM MSM6235&lt;/li&gt;&lt;li&gt;CPU: Marvell PXA270, 520MHz&lt;/li&gt;&lt;li&gt;2.8-inch TFT LCD touch panel&lt;/li&gt;&lt;li&gt;2M camera with auto focus&lt;/li&gt;&lt;/ul&gt;The Smart Touch interface will allow easy management of the main function menu while the multimedia center has a photo editor, music player and FM radio. The GPS tracking feature enables users to download online maps and edit traveling paths to create personal traveling journals. Photographs can be tagged with GPS to record the location where they were taken.&lt;br /&gt;&lt;br /&gt;The MS820, MW702 and MW700 are also available in the country for purchase and are priced at Rs. 36, 999, Rs. 29, 999 and Rs. 16, 999 respectively. &lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-977306216994183685?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/977306216994183685/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=977306216994183685&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/977306216994183685'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/977306216994183685'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/04/gigabyte-launches-3-winmob-handsets-in.html' title='Gigabyte Launches 3 WinMob Handsets in India'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-2859497768411012471</id><published>2009-04-27T13:02:00.001+05:30</published><updated>2009-04-27T13:03:30.251+05:30</updated><title type='text'>Yahoo Pulls the Plug on GeoCities</title><content type='html'>Yahoo Inc is shutting down GeoCities, a free service that hosts personal home pages for consumers, which it acquired for more than $4 billion 10 years ago during the heyday of the dotcom boom. A posting on a Yahoo Help page for GeoCities on Thursday said the service was no longer accepting new customers and that it will be closing later this year, with more details about how individuals can save their data coming this summer. The move comes a few days after Yahoo said it would lay off nearly 700 workers, or 5 percent of its workforce. &lt;br /&gt;&lt;br /&gt;Since Chief Executive Carol Bartz took the reins in January, Yahoo has pruned various products and properties to cut costs and focus on fundamentals, as it seeks to revive growth in a tough economy and fierce competition from Google Inc. Last week, Yahoo said it was shutting down Jumpcut, an online service for editing videos. Yahoo acquired GeoCities in 1999 in a stock deal valued at roughly $4.6 billion, Reuters reported at the time.&lt;br /&gt;GeoCities was among the first companies to build online communities, with more than 3.5 million websites hosted on its service in the late 1990s. But GeoCities fell out of favor in recent years, as a generation of social network sites such as Facebook and News Corp's Myspace have become popular among Web users.&lt;br /&gt;&lt;br /&gt;"We have decided to discontinue the process of allowing new customers to sign up for GeoCities accounts as we focus on helping our customers explore and build new relationships online in other ways," Yahoo said in a statement. "As part of Yahoo's ongoing effort to build products and services that deliver the best possible experiences for consumers and results for advertisers, we are increasing investment in some areas while scaling back in others." Shares of Yahoo were up a penny to $14.49 in afternoon trading on the Nasdaq.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-2859497768411012471?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/2859497768411012471/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=2859497768411012471&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/2859497768411012471'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/2859497768411012471'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/04/yahoo-pulls-plug-on-geocities.html' title='Yahoo Pulls the Plug on GeoCities'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-8190083191849603062</id><published>2009-04-27T12:57:00.000+05:30</published><updated>2009-04-27T12:58:18.633+05:30</updated><title type='text'>Actor Feroz Khan passes away</title><content type='html'>Bollywood actor Feroz Khan on Monday lost his battle with cancer and passed away at his farmhouse in Bangalore.&lt;br /&gt;&lt;br /&gt;The 69-year-old actor-filmmaker died at 1:30 am at his farmhouse, family sources said. Khan is survived by actor-son Fardeen Khan and daughter Laila Khan.&lt;br /&gt;&lt;br /&gt;He was diagnosed with cancer and was being treated at a Mumbai hospital for a long time. His funeral will take place later in the day in Bangalore, sources said.&lt;br /&gt;&lt;br /&gt;The actor was born and brought up in Bangalore. The Bollywood actor of yesteryear was known for his hit films of the 70s and 80s which include 'Dharmatama', 'Qurbani' and 'Jaanbaz'.&lt;br /&gt;&lt;br /&gt;The latest film he featured in was the blockbuster hit Welcome in 2007.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-8190083191849603062?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/8190083191849603062/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=8190083191849603062&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/8190083191849603062'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/8190083191849603062'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/04/actor-feroz-khan-passes-away.html' title='Actor Feroz Khan passes away'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-3644816120569537256</id><published>2009-04-26T19:03:00.000+05:30</published><updated>2009-04-26T19:04:43.597+05:30</updated><title type='text'>SP rules out alliance with Third front or Left</title><content type='html'>Ruling out any post-poll tie-up with the Third Front or the Left parties as long as the Bahujan Samaj Party is with them, the Samajwadi Party on Sunday said it was, however, not averse to an alliance with the Congress. &lt;br /&gt;&lt;br /&gt;"As long as our arch rival BSP chief Mayawati is with the Left parties or the Third Front, we are not going for any post-poll alliance them," SP general secretary Amar Singh told media-persons in Kolkata on Sunday. However, the party is not averse to an alliance with the Congress, he said. &lt;br /&gt;&lt;br /&gt;"The Congress-led United Progressive Alliance ran the government for the last one year with our help after the Left parties withdrew support on the signing of the civil nuclear deal but they turned down our offer of 17 seats in Uttar Pradesh. We had never been so ungrateful...however, we are not averse to a tie-up with the Congress in post-poll scenario if the situation demand," Singh said. &lt;br /&gt;&lt;br /&gt;Launching a scathing attack against the Communist Party of India-Marxist leadership, Singh said, "We had good relation with the CPM during the time of Harkishen Singh Surjeet, but Prakash Karat is altogether a different person." On the question of prime ministership, he said, "The emerging situation will decide who will be the prime minister. Let the Congress first win the confidence of magic number."&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-3644816120569537256?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/3644816120569537256/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=3644816120569537256&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/3644816120569537256'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/3644816120569537256'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/04/sp-rules-out-alliance-with-third-front.html' title='SP rules out alliance with Third front or Left'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-5989659314245422430</id><published>2009-04-26T18:54:00.000+05:30</published><updated>2009-04-26T18:55:33.332+05:30</updated><title type='text'>10 don'ts for smart stock market investing</title><content type='html'>This is a great check list of 10 habits, impulses and tendencies you steer clear of in order to keep your investments healthy.&lt;br /&gt;&lt;br /&gt;1. Don't be arrogant&lt;br /&gt;&lt;br /&gt;The market teaches humility and that is how you must approach it. As soon as you believe you know why the market acts the way it does, you will be proven wrong. Arrogance can kill a portfolio. You must be able to admit defeat and preserve enough capital to fight again.&lt;br /&gt;&lt;br /&gt;Following point and figure charts, which depict the battle between supply and demand, helps keep you out of the 'I know why' attitude of investing.&lt;br /&gt;&lt;br /&gt;2. Don't wait until you feel comfortable to buy when a sector reverses up&lt;br /&gt;&lt;br /&gt;Falling into the waiting trap is a great way to ensure that you buy the stock at a higher price. When sectors reverse up from oversold levels, it is often when the news is the most dire.&lt;br /&gt;&lt;br /&gt;Conventional wisdom would suggest this is the last place in the world you would want to invest. Buying at this time is gut wrenching, but to be successful you must act with complete confidence.&lt;br /&gt;&lt;br /&gt;As the sector moves higher, the comfort level increases. If you use comfort level as your guidance, however, you will for sure leave a lot of money on the table, or worse, buy as the sector peaks.&lt;br /&gt;&lt;br /&gt;3. Don't be afraid to buy strong stocks&lt;br /&gt;&lt;br /&gt;Don't avoid stocks just because they have gone up. Doing so will keep you out of the long-term winners. In the United States, for example, this mentality would have kept you out of General Electric, which was up 188 per cent between January 1995 and December 1997 only to see it rally another 96 per cent by the end of 2000. It also would have kept you out of Cisco, which was up 376 per cent between January 1995 and December 1997, and then it moved up another 312 per cent by the end of 2000. These are only two examples, but there are many others.&lt;br /&gt;&lt;br /&gt;More important than how much the stock is up is its supply and demand relationship. By evaluating the point and figure chart, you can gain insight into this relationship and whether or not the stock is likely to move higher. Stocks that double can easily double again. Don't miss out on these great opportunities.&lt;br /&gt;&lt;br /&gt;4. Don't sell a stock simply because it has gone up&lt;br /&gt;&lt;br /&gt;Doing this cuts profits short. Buying a stock right is only half the battle. You have to be able to sell it right to win the war. Just because a stock has rallied 30 per cent or 50 per cent, don't be tempted to take your trade off for that reason alone.&lt;br /&gt;&lt;br /&gt;Consider trimming the position and leave part on the table to continue in the uptrend. Let profits run.&lt;br /&gt;&lt;br /&gt;5. Don't buy stocks in extended sectors because 'it's different this time'&lt;br /&gt;&lt;br /&gt;On the surface, the stock market appears different all the time. The leadership changes: in come new stocks into the Nifty 50, and then out they go. Small-cap stocks outperform for a while, then it's back to the large caps.&lt;br /&gt;&lt;br /&gt;However, the underlying forces that drive the stock market are always the same. They are true and time-tested and do not change. They are supply and demand. That's why buying sectors that are extended (overbought) will not be different this time.&lt;br /&gt;&lt;br /&gt;6. Don't try to bottom fish a stock in a downtrend&lt;br /&gt;&lt;br /&gt;'The trend is your friend' is a true statement. So don't go against it without some inkling that the trend has changed.&lt;br /&gt;&lt;br /&gt;Bottom fishing a stock in a downtrend is the opposite of being afraid to buy strong stocks. Do not buy a stock just because it fell sharply. You want to buy a stock that is likely to move higher, not one that is not likely to fall further.&lt;br /&gt;&lt;br /&gt;At a minimum, wait for the stock to show a sign that demand is back in control and suggesting higher prices. That may be a simple buy signal on the chart or a reversal back to the upside after holding an area of support. Also remember why you initiated the position. Be careful not to let a trade turn into something else.&lt;br /&gt;&lt;br /&gt;7. Don't buy a stock simply because it is a 'good value'&lt;br /&gt;&lt;br /&gt;These days, value is in the eyes of the holder, and therefore it is a subjective term at best. If a stock has become a good value, ask why. This is important, because a stock can stay a good value by not moving for the next decade, or worse, become a better value by dropping another 20 per cent.&lt;br /&gt;&lt;br /&gt;The true value of a stock is determined by its capital appreciation potential, not numbers on a balance sheet. The basis for capital appreciation lies in the supply and demand relationship of the stock. Appreciation can occur only if demand grows stronger for the stock and buyers are willing to pay a higher price. Watch the point and figure charts to determine if a stock is likely to move higher in price and become a good value.&lt;br /&gt;&lt;br /&gt;8. Don't hold on to losing stocks and hope they come back&lt;br /&gt;&lt;br /&gt;Hope is eternal, but your portfolio is not. Holding on to a losing stock is the best way to let your losses run. Combine this mistake with selling a stock that has gone up and you can create a portfolio of dogs.&lt;br /&gt;&lt;br /&gt;When buying stocks, there will always be some losers: Count on it. However, how you manage that loss often determines the success or failure of the overall portfolio. Keep losses small so that you have the capital to play again. Hanging on to losing positions, hoping that they will come back, can be deadly.&lt;br /&gt;&lt;br /&gt;A $50 stock that is stopped out at $40 is a 20 per cent loss. It's a bad trade, but it is manageable. In order to recoup that loss you would have to make 25 per cent on a $40 stock. What if you held on to that $50 stock, hoping that strong earnings would come in and turn it around, but instead it continued lower to $25?&lt;br /&gt;&lt;br /&gt;Finally, you decide to exit, but now it takes a 100 per cent return from a $25 stock just to get back to even. Those results are hard to find, and if you are able to find one, you don't want to waste it on getting back to even&lt;br /&gt;&lt;br /&gt;Learn to recognize your losing positions for what they are. If a stock cannot trade above its support line or is not outperforming the averages, find one that is and swap it.&lt;br /&gt;&lt;br /&gt;9. Don't pursue perfection&lt;br /&gt;&lt;br /&gt;There are two types of mistakes to discuss here. The first is the constant belief that there is a better system out there, and you need to find it.&lt;br /&gt;&lt;br /&gt;Using a new system to invest each week will not get you to your goal. You will become good at nothing and moderate to bad at everything. To be good requires that you stay focused, disciplined, and skilled at whatever methodology you choose.&lt;br /&gt;&lt;br /&gt;You need to have the strength of conviction in your chosen discipline to learn from mistakes rather than to run away from them and find another methodology. There is no Holy Grail in investing.&lt;br /&gt;&lt;br /&gt;The second mistake is to wait for the perfect trade. There is no such thing. If you only buy stocks that have all positive attributes you will maintain a portfolio of cash. Rarely, if ever, do you find a stock that has all the pluses on its side.&lt;br /&gt;&lt;br /&gt;Look for the big ones like relative strength, trend, and signal. Also remember that 80 per cent of the cause of price movement in a stock is based on the market and sector. You are better off being approximately right than precisely wrong.&lt;br /&gt;&lt;br /&gt;10. Don't do anything based on a magazine cover&lt;br /&gt;&lt;br /&gt;Following the hot news that appears on magazine covers is a shortcut to the poor-house. Why should you follow the advice of someone who has just moved from the society pages to the business section?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-5989659314245422430?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/5989659314245422430/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=5989659314245422430&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/5989659314245422430'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/5989659314245422430'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/04/10-donts-for-smart-stock-market.html' title='10 don&apos;ts for smart stock market investing'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-5655916109039875772</id><published>2009-04-20T16:41:00.000+05:30</published><updated>2009-04-20T19:01:08.068+05:30</updated><title type='text'>Feudalism responsible for Satyam fiasco: N R Narayana Murthy</title><content type='html'>Technology services titan and founder chairman of Infosys Technologies N R Narayana Murthy has had a deep impact on the &lt;br /&gt;&lt;br /&gt;$60 billion IT industry which grew on the back of global sourcing of services. Over the years Mr Murthy has delivered over a 100 lectures on various fora spanning the world. Some of those select lectures on topics ranging from globalization, corporate governance, leadership and entrepreneurship are now part of the just published book: A Better India A Better World. In a 72-minute interview with ET at the company's guest house in South Delhi, Mr Murthy talks about the book, the political scene, the Satyam episode and its impact on India Inc and what the country now needs and more. Excerpts from the interview: &lt;br /&gt;&lt;br /&gt;What all have you touched upon in this book and how are the lectures relevant now? &lt;br /&gt;&lt;br /&gt;While the country has made considerable progress in the last 18 years after the first wave of economic reforms we are still lagging. We have one of the highest GDP growths in the world, our exports are much larger than what they were 10 years ago, our software industry has brought tremendous laurels to India, we have done well in technology industry, production and even in sports. &lt;br /&gt;&lt;br /&gt;Yet we have been unable to redeem the pledge that our founding fathers took when India got independence. That is to provide decent access to education, nutrition, healthcare and welfare to the poorest of the poor. India has the largest mass of illiterates in the world, largest mass of poor people in the world, 250 million people don't have access to safe drinking water, 650 million people do not have access to decent sanitation. So this whole paradigm of 8-9% GDP growth becomes somewhat irrelevant when you look at these aspects. &lt;br /&gt;&lt;br /&gt;So the real challenge we have is to bring inclusive growth. In order to bring inclusive growth in a country like India we need to solve three pieces of development -- first is creating a public opinion that values good work ethic, honesty, discipline, secularism. Second, we need to develop a cadre of leadership who espouse these values and serve as role models and demonstrate leadership by example. Third, we need the determination of the elite and the powerful in the society to eschew creation of asymmetry of benefits in their favour vis-à-vis the common man. Only when these three conditions are fulfilled will we be able to create a fair, just, equitable and inclusive growth in our society. In essence this is the fundamental thesis on which the book is based. &lt;br /&gt;&lt;br /&gt;I have all along said that people practicing values, leaders leading by example and the elite and the powerful relating to the realities are absolutely essential for a country and a company to make progress. In some sense, on a very small, simple canvas I have painted a very simple drawing at Infosys and that painting has been reasonably successful. &lt;br /&gt;&lt;br /&gt;Based on that experience I have been talking to people, students, in India and abroad, to enlightened citizens on various issues within this framework of values and leadership and those pieces form the basic gist of this book.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-5655916109039875772?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/5655916109039875772/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=5655916109039875772&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/5655916109039875772'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/5655916109039875772'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/04/feudalism-responsible-for-satyam-fiasco.html' title='Feudalism responsible for Satyam fiasco: N R Narayana Murthy'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-5134714058654298851</id><published>2009-04-20T16:38:00.001+05:30</published><updated>2009-04-20T16:41:28.008+05:30</updated><title type='text'>India launches spy satellite RISAT</title><content type='html'>Aiming to enhance India's defence surveillance capabilities, ISRO on Monday morning launched its first Radar Imaging Satellite (RISAT) &lt;br /&gt;&lt;br /&gt;from Sriharikota. &lt;br /&gt;&lt;br /&gt;As per specifications, RISAT is different from previous remote sensing satellites as it uses Synthetic Aperture Radar (SAR), equipped with many antennas to receive signals that are processed into high-resolution pictures. &lt;br /&gt;&lt;br /&gt;The SAR, developed by Israel Aerospace Industries, gives RISAT defence capabilities.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-5134714058654298851?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/5134714058654298851/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=5134714058654298851&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/5134714058654298851'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/5134714058654298851'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/04/india-launches-spy-satellite-risat.html' title='India launches spy satellite RISAT'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-7544114492444120825</id><published>2009-04-20T16:36:00.000+05:30</published><updated>2009-04-20T16:38:17.187+05:30</updated><title type='text'>Cyber-squatting: The new gateway to identity theft</title><content type='html'>NEW DELHI: That old scrounge, cyber-squatting, is back with a vengeance especially for a host of global brands in India. With domain name prices &lt;br /&gt;&lt;br /&gt;falling and more top-level domains (such as .biz, .cn, .mob and lately .in) getting accredited, cyber squatters are back in business full time. &lt;br /&gt;&lt;br /&gt;Global brands across categories –– Monster Jobs, PepsiCo, SonyEricsson, Siemens, McAfee or search giant Google — have of late been at the receiving end of squatters. Take for instance, world’s largest job site Monster.com which was squatted in the name of one Usha Rani, a Hyderbad-based squatter which registered Monster.in and Monsterjobs.in. &lt;br /&gt;&lt;br /&gt;The global jobsite filed a case with the .in registry saying that “the respondent had registered the domain in bad faith which impugned its brand.” After a resolution process, the domains were taken away and allotted to Monster India. “We have a fast track dispute resolution process where by decisions are transferred within 30 days of filing a complaint,” says a National Internet Exchange of India (NIXI) official, which handles the .in registry. &lt;br /&gt;&lt;br /&gt;With little disincentive for squatting under Indian cyber laws, even Pepsico.in, Siemens.in and Sonyeriscsson.in were squatted recently. “There is no provision in the current or proposed IT act in India to punish cyber-squatters. At best, the domain name can be take back,” says cyber lawyer Pavan Duggal, who has dealt with several squatting cases. &lt;br /&gt;&lt;br /&gt;With domain name prices falling to as low as Rs 200, squatters seem to be on a domain binging spree. Apart from global brands, celebrities domains are also targeted by squatters. For instance, AmitabhBachchan.in is currently undergoing an auction on the internet, with a minimum price bid of $1,000. Similarly, Soniagandhi.com is registered by Indianmagazine.com a news and views website. Indian film actor Gul Panag is also facing tough time to get her domain back. “I’m not going to pay the squatters $20,000 which they are demanding for GulPanag.com,” she was quoted as saying recently. &lt;br /&gt;&lt;br /&gt;Other global brands have also been targeted. Netgear.co.in, Ushaworld.in, Baccarat.in were all squatted and won back recently by respective companies. Indian internet companies whose identities were squatted are Agencyfaqs.com and Rediff.in While Google suffered the squatting of Gmail.in. Mcafee.co.in was also squatted. &lt;br /&gt;&lt;br /&gt;One of the world’s largest Flash memory maker Kingston also suffered with its Kingston.in and Kingston.co.in being squatted in India. Though there is no legal compensation under IT Act, .in registry has taken proactive steps to grant compensation to victim companies to deter squatters from further stealing domains. Most squatters however operate under guise of obscure names.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-7544114492444120825?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/7544114492444120825/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=7544114492444120825&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/7544114492444120825'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/7544114492444120825'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/04/cyber-squatting-new-gateway-to-identity.html' title='Cyber-squatting: The new gateway to identity theft'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-40287536569360867</id><published>2009-04-18T09:51:00.000+05:30</published><updated>2009-04-18T09:52:33.355+05:30</updated><title type='text'>Pirate Bay founders found guilty</title><content type='html'>"Frederik Neij, Gottfrid Svartholm Warg, Carl Lundstrom and Peter Sunde were found guilty of breaking copyright law and were sentenced to a year in jail.&lt;br /&gt;"They were also ordered to pay $4.5m (£3m) in damages.&lt;br /&gt;&lt;br /&gt;"Record companies welcomed the verdict but the men are to appeal and Sunde said they would refuse to pay the fine.&lt;br /&gt;&lt;br /&gt;"Speaking at an online press conference, he described the verdict as "bizarre.""&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-40287536569360867?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/40287536569360867/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=40287536569360867&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/40287536569360867'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/40287536569360867'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/04/pirate-bay-founders-found-guilty.html' title='Pirate Bay founders found guilty'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-3742456038442252846</id><published>2009-04-18T09:40:00.000+05:30</published><updated>2009-04-18T09:44:44.161+05:30</updated><title type='text'>New Linux rootkit technique presented</title><content type='html'>Anthony Lineberry, a Linux expert, announced during his presentation, "Alice in User-Land: Hijacking the Linux Kernel via /dev/mem", at the &lt;a href="http://www.blackhat.com/"&gt;Black Hat&lt;/a&gt; security conference now taking place in Amsterdam that he will shortly be publishing the &lt;a href="http://dtors.org/index/code-injection-via-dev-mem"&gt;libmemrk&lt;/a&gt; library. He says Libmemrk works in both 32-bit and 64-bit environments.&lt;br /&gt;This offers rootkit developers a new way to hide files or processes, or interfere with network traffic. The trick is that, without requiring extensive rights, libmemrk uses the /dev/mem device driver to write arbitrary code from userspace into main memory. /dev/mem is an interface that enables use of the physically addressable memory. For example XServer and DOSEmu, both use it. Lineberry says introducing rootkits via /dev/mem is also less obvious than the established route via loadable kernel modules (LKMs).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The library relieves a rootkit programmer of the "laborious" work of translating virtual memory addresses to physical ones and identifying a memory range that can be exploited for the attack. An attacker can't overwrite the existing system calls and replace them with his own code until the suitable ranges, normally used by the kernel, have been located. The real contents written into memory by the kernel are meanwhile shifted into a buffer.&lt;br /&gt;&lt;br /&gt;The detailed steps required for a successful attack, which are handled by libmemrk, are described by Lineberry in his white paper, &lt;a href="http://dtors.org/papers/malicious-code-injection-via-dev-mem.pdf"&gt;Malicious Code Injection via /dev/mem&lt;/a&gt;. However, Lineberry states there that an attack fails in virtual environments because the hypervisor behaves differently from unvirtualised hardware. Lineberry asks his audience to bear in mind that, regardless of libmemrk, the whole attack must be hand-programmed in assembly language. In future, Lineberry intends that libcc will be used in order to at least reduce the impact of this hurdle.&lt;br /&gt;&lt;br /&gt;Lineberry also gives some tips on how the Linux world can protect itself against rootkits of this kind. He believes it should be enough to modify the memory driver so that it doesn't allow the write/read pointer lseek to look for more than 16 kilobytes in the memory area. Current versions of Red Hat and Fedora are inherently secure, because their kernel already incorporates the features of SELinux (Security Enhanced Linux).&lt;br /&gt;Lineberry says there are also corresponding improvements in version 2.6.26 of the mainline kernel. For that purpose, the kernel was given two new functions: range_is_allowed() and devmem_is_allowed(). But this protection, he says, won't be effective unless the preprocessor directive CONFIG_STRICT_DEVMEM has been enabled when the kernel is compiled. Otherwise, range_is_allowed() always gives returns success. Lineberry says that the kernel configuration setting STRICT_DEVMEM, which sets CONFIG_STRICT_DEVMEM, is not activated by default during kernel compilation. He was unable to say when libmemrk would be available for downloading, as he was still engaged in eliminating its last weaknesses.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The technique of using the /dev/mem interface is not totally new. An article on &lt;a href="http://www.phrack.com/issues.html?issue=58&amp;id=7"&gt;Linux on-the-fly kernel patching without LKM&lt;/a&gt; appeared in Phrack back in 2001, describing a similar method using /dev/kmem/. The authors were already thinking about possible uses for /dev/mem then, but didn't go on to check them out.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-3742456038442252846?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/3742456038442252846/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=3742456038442252846&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/3742456038442252846'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/3742456038442252846'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/04/new-linux-rootkit-technique-presented.html' title='New Linux rootkit technique presented'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-6608803916400944666</id><published>2009-04-18T09:39:00.001+05:30</published><updated>2009-04-18T09:39:16.666+05:30</updated><title type='text'>3 Minutes to 3 Terabytes: VIA ARTiGO and FreeNAS Store Terabytes in a Shoebox</title><content type='html'>It truly is a beautiful thing when something just works. This is especially true with computers. High capacity storage has become almost a commodity with the price of an external 1 TB USB hovering around $100. All you have to do is plug in the power and connect the USB cable, and you've got instant storage expansion. Works great for a single computer, and you could even unplug it from one and plug it into another. While that does work, it tends to get old after a while, and if you're using that method for backups, you will more than likely end up forgetting or just quitting altogether at some point.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://www.linuxplanet.com/graphics/screenshots/artigo-front_1.jpg" alt="" /&gt;&lt;br /&gt;&lt;br /&gt;Network Attached Storage (NAS) is one answer to sharing large storage devices over a network. You could buy a NAS device from your favorite local or Internet supplier, but chances are you'll wind up with something less than what a "real" NAS has to offer. That's where VIA's ARTiGO A2000 comes in. The A2000 fits a full-featured computer with space for two 3.5" SATA drives in a package about the size of a shoebox. Add to the hardware the FreeNAS open source software and you've got a really capable storage solution.&lt;br /&gt;&lt;br /&gt;Installation&lt;br /&gt;&lt;br /&gt;Assembling the hardware couldn't be simpler. The ARTiGO A2000 has one screw on the rear of the box holding the case shell in place. Once that's out you can remove the front clip-on cover with two fingers. That exposes two slots for SATA hard drives and the CompactFlash slot. The hard drives slide easily on the rails and plug right into a connector at the back of the drive bay. Tighten two screws on each side to secure the drive to the frame, and you're all done. We used two Seagate Barracuda 7200.11 1.5 TB drives for this review.&lt;br /&gt;&lt;br /&gt;Getting the software up and running is a little more involved but not much. Step one is to download the FreeNAS software image from the project &lt;a href="http://www.freenas.org/index.php?option=com_versions&amp;Itemid=51"&gt;download page&lt;/a&gt;. The one you want is the latest FreeNAS Image file. For the VIA ARTiGO you'll need the i386 version. While you're on the download page you can also get a copy of the Quick Start Guide and User Manual. Once you have the image downloaded you must write the image to a CompactFlash (CF) device. The image itself is a little under 30 MB, so you could use an old 64 MB device if you happen to have one lying around.&lt;br /&gt;&lt;br /&gt;Writing the image to the CF disk requires root privileges. The trick is to know that the .img file is actually compressed, requiring a gunzip command before writing to the disk. You can do it with one command as follows:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;root@anand-ubuntu:~/ gunzip -c FreeNAS-i386-embedded-0.69.4276.img | sudo dd of=/dev/sdc&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The key here is the name of your CF device. In our case we used a small USB multi-card reader which assigns a unique device name for all the different slots. The CF slot shows up as /dev/sdc. With that piece of information you're ready to blast your image using the command line string above. You can also use the dmesg command to check yourself after inserting the CF card as in:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;dmesg | tail -n 24&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;That will show you the last 24 kernel messages and should contain a few lines that indicate the device name of the card you just attached.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-6608803916400944666?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/6608803916400944666/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=6608803916400944666&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/6608803916400944666'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/6608803916400944666'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/04/3-minutes-to-3-terabytes-via-artigo-and.html' title='3 Minutes to 3 Terabytes: VIA ARTiGO and FreeNAS Store Terabytes in a Shoebox'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-7065324956572356484</id><published>2009-04-16T18:36:00.000+05:30</published><updated>2009-04-16T18:37:17.256+05:30</updated><title type='text'>Infosys cuts variable pay</title><content type='html'>Infosys has cut the variable pay for employees, with the cuts being deeper at the higher levels. For senior executives, the variable pa &lt;br /&gt;y, which constitutes nearly 50 per cent of their total compensation, has been slashed by 58 per cent. &lt;br /&gt;&lt;br /&gt;“Some boardroom executives have even taken a 70 per cent to 85 per cent variable pay cut,” said T V Mohandas Pai, head of HR in Infosys. The company's hiring has been steadily declining. &lt;br /&gt;&lt;br /&gt;In Q4, it added (net) only 1,772 people, compared to 2,772 in Q3, and 2,586 in Q4 of 2007-08. In the whole of 2008-09, it hired (net) 13,663 people, down from 18,946 in the year before. &lt;br /&gt;&lt;br /&gt;The company maintained that it will not seek to trim its payroll by laying off software professionals. There will, however, be no salary hike this year, as the company plans to keep its operational costs under control. &lt;br /&gt;&lt;br /&gt;“We are not laying off anybody and there are no such plans,” said Infosys Technologies HR-director, TV Mohandas Pai. &lt;br /&gt;&lt;br /&gt;Infosys plans to hire 18,000 professionals in the current fiscal, including almost 16,000 fresh graduates and experienced hires. It will also recruit around 1,000 non-Indians outside the country to increase the number of foreign professionals in its workforce.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-7065324956572356484?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/7065324956572356484/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=7065324956572356484&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/7065324956572356484'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/7065324956572356484'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/04/infosys-cuts-variable-pay.html' title='Infosys cuts variable pay'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-6992781677727484249</id><published>2009-04-16T18:31:00.001+05:30</published><updated>2009-04-16T18:31:52.799+05:30</updated><title type='text'>India exercises its ballot, amid bullets and blasts</title><content type='html'>Round one of India's Election 2009 ended Thursday with millions queuing up in 17 states and union territories to vote in a new government  &lt;br /&gt;amid Maoist violence that marred the democratic exercise in several places and left at least 17 dead. &lt;br /&gt;&lt;br /&gt;The world's largest democratic exercise began early at 7 a.m. and ended at most places at 5 pm. A majority of the states reported moderate turnout despite the Maoist attacks on polling centres and security personnel. &lt;br /&gt;&lt;br /&gt;Indians voted in 124 constituencies to pick a new 545-seat Lok Sabha in the first step of a four-phased exercise that is widely expected to throw up a split verdict. The Maoist violence affected a dozen constituencies. &lt;br /&gt;&lt;br /&gt;About 143 million of India's 714 million voters were eligible to exercise their franchise in the first of five rounds in 185,552 polling centres. A total of 1,715 candidates were in the fray, with over 300,000 electronic voting machines used. &lt;br /&gt;&lt;br /&gt;Tens of thousands of election staff and security personnel kept vigil as people voted in all the constituencies of Kerala, Arunachal Pradesh, Meghalaya, Mizoram, Nagaland, Chhattisgarh, Andaman and Nicobar Island and Lakshwadeep. Andhra Pradesh, Assam, Bihar, Uttar Pradesh, Jammu and Kashmir, Maharashtra, Manipur, Orissa and Jharkhand saw partial voting. &lt;br /&gt;&lt;br /&gt;But it was a bloody start to the ambitious exercise with Bihar, Chhattisgarh, Orissa, Jharkhand and Maharashtra seeing violence and intimidation as Maoist guerrillas tried to implement their election boycott through the barrel of the gun. &lt;br /&gt;&lt;br /&gt;At least 17 people were killed as cadres of the outlawed Communist Party of India-Maoist, which seeks to carry out an agrarian-based revolution, targeted polling officials and security personnel across the insurgency hit states. &lt;br /&gt;&lt;br /&gt;Landmine blasts in Chhattisgarh and Jharkhand saw 14 people getting killed. In Jharkhand's Latehar area, seven Border Security Force (BSF) personnel and two others heading to an election centre were killed when their bus was blown up. &lt;br /&gt;&lt;br /&gt;In neighbouring Chhattisgarh, five polling officials died when Maoists detonated a landmine in Rajnandgaon district. A paramilitary trooper was shot dead in an exchange of bullets in the Maoist stronghold Dantewada. &lt;br /&gt;&lt;br /&gt;In adjoining Bihar, a policeman and a Home Guard were killed when over a dozen Maoists opened fire at a polling station in Gaya district. &lt;br /&gt;&lt;br /&gt;Reports of gun battles, booths being raided, voters being attacked and electronic voting machines being torched came in from several places in the affected states. &lt;br /&gt;&lt;br /&gt;But voters braved it all at the end of the day. &lt;br /&gt;&lt;br /&gt;In Andhra Pradesh, once a Maoist bastion, there was 60-65 percent voter turnout, 65 percent in the three parliamentary constituencies of Assam and 60-70 percent in Mizoram, Nagaland, Meghalaya and Arunachal Pradesh, also in the northeast. Manipur was lower at 40 to 50 percent. &lt;br /&gt;&lt;br /&gt;In violence-hit Chhattisgarh, Jharkhand and Bihar, about 50 percent of the voters turned to cast their franchise. &lt;br /&gt;&lt;br /&gt;Long queues were seen outside booths in Kerala with officials estimating that the turnout would be about 60 percent. It was highest in Ernakulam with 67.5 percent and surprisingly low in Thiruvananthapuram, where the Congress fielded star debutant, former UN under-secretary general Shashi Tharoor, with 45.4 percent. &lt;br /&gt;&lt;br /&gt;With 124 of 543 seats going to the polls, the day was decisive for the main political parties battling for power with several key leaders in the fray. &lt;br /&gt;&lt;br /&gt;One of them was Railway Minister and Rashtriya Janata Dal (RJD) chief Lalu Prasad, who accused the rivals of intimidating voters in his constituency in Saran in Bihar. &lt;br /&gt;&lt;br /&gt;Cabinet minister and Nationalist Congress Party (NCP) leader Civil Aviation Minister Praful Patel said in his constituency Bhandara-Gondia in Maharashtra: "We are with the Congress as alliance partners. That does not stop us from having good relations with the Left. In fact, we may need them later." &lt;br /&gt;&lt;br /&gt;Finally, Thursday was all about the struggle to reach the coveted seat of power in Delhi. &lt;br /&gt;&lt;br /&gt;As defence minister and Congress leader A.K. Antony said: "Gone are the days of a single party ruling the country. Hence, even though there are secular parties contesting against us in states, when it comes to forming a government in Delhi we will seek the support of all secular parties." &lt;br /&gt;&lt;br /&gt;And this is how BJP general secretary Arun Jaitley put it: "The way the campaign progressed and looking at the voting trends in all the states where we are in strength, we are going to improve our performance." &lt;br /&gt;&lt;br /&gt;The exercise was also about the people and their determination to vote, no matter what. &lt;br /&gt;&lt;br /&gt;Like Kamla Devi, 102, who came to vote at Gurah Brahamana in Jammu region. It was the 20th time she was doing so and the canny voter refused to disclose who she had supported. &lt;br /&gt;&lt;br /&gt;But all will be told on May 16 when the millions of votes will be counted.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-6992781677727484249?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/6992781677727484249/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=6992781677727484249&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/6992781677727484249'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/6992781677727484249'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/04/india-exercises-its-ballot-amid-bullets.html' title='India exercises its ballot, amid bullets and blasts'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-6795924655691047133</id><published>2009-04-15T16:53:00.000+05:30</published><updated>2009-04-15T16:54:07.079+05:30</updated><title type='text'>Sonia calls Advani 'a slave of RSS'</title><content type='html'>Describing the Bharatiya Janata Party's [Images] prime ministerial candidate L K Advani [Images] as a 'slave of the Rashtriya Swayamsevak Sangh', Congress president Sonia Gandhi [Images] on Wednesday said the saffron leader could not take any decision 'without the fear of the RSS'.&lt;br /&gt;&lt;br /&gt;"It is Advani who is a slave of the RSS because he wants to protect his chair. This is the reason why he panders to each and every wish of the RSS," Gandhi told an election rally in Bidar, Karnataka.&lt;br /&gt;&lt;br /&gt;Dismissing Advani's oft-repeated comment about Manmohan Singh [Images] being a weak prime minister, she asked whether the senior BJP leader could take any decision on his own 'without the fear of the RSS'.&lt;br /&gt;&lt;br /&gt;Gandhi said that when Advani was the BJP president, he had given a 'secular certificate' to Jinnah during his visit to Pakistan, which created a furore in the RSS and ultimately led to his resignation from the post.&lt;br /&gt;&lt;br /&gt;"Advani must remember that a prime minister does not belong to one party but to the whole nation and an insult to him is an insult to the whole country," she said.&lt;br /&gt;&lt;br /&gt;"Now the choice is left to the people. They have to decide who is weak, whether it is Prime Minister Manmohan Singh or BJP leader L K Advani," Gandhi said.&lt;br /&gt;&lt;br /&gt;Accusing the BJP of 'being sympathetic towards terrorists', Gandhi said it was during the National Democratic Alliance's rule that 'terrorists were released and escorted to Kandahar'.&lt;br /&gt;&lt;br /&gt;She said it was the "efficient and diplomatic tackling of the Mumbai terror attacks [Images] by the United Progressive Alliance government which compelled Pakistan to concede responsibility in the issue".&lt;br /&gt;&lt;br /&gt;"We will not tolerate any such attack against India," Gandhi said.&lt;br /&gt;&lt;br /&gt;Attacking the BJP government in Karnataka for 'improper utilisation' of central funds allotted for development work, she said "we gave crores of Rupees to Karnataka. We really do not know how the funds have been utilised".&lt;br /&gt;&lt;br /&gt;She also came down on the saffron party for the 'rampant corruption' in the state and appealed to the people to cast their votes judiciously.&lt;br /&gt;&lt;br /&gt;Highlighting the achievements of the Congress government since Independence, Gandhi said whether it is industrialisation or modernisation of the country, nationalisation of banks, empowerment of women through Panchayat Raj institutions or signing the nuclear agreement, it is the Congress which has always taken the lead.&lt;br /&gt;&lt;br /&gt;"The people have to take all this into account and make an informed choice," she said.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-6795924655691047133?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/6795924655691047133/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=6795924655691047133&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/6795924655691047133'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/6795924655691047133'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/04/sonia-calls-advani-slave-of-rss.html' title='Sonia calls Advani &apos;a slave of RSS&apos;'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-2862887242097187676</id><published>2009-04-15T16:51:00.000+05:30</published><updated>2009-04-15T16:52:05.510+05:30</updated><title type='text'>Build a centralized log management and monitoring system</title><content type='html'>Seasoned system administrators know that routinely reading system logs is an important task, but reading endless lines from logs is both time-consuming and boring, especially if you are responsible for a large number of busy servers. In this article I will show you how to set up a system that gathers and archives system logs from many network hosts and emails only important or irregular system events to administrators.&lt;br /&gt;The majority of GNU/Linux distributions uses the good old syslogd system logger by default, which is based on the original 4.3BSD syslogd daemon. Syslogd is a fine system logger, but it lacks some advanced features modern alternatives offer. We will use syslog-ng instead, which provides all the functionality of the traditional syslogd along with some nice enhancements. Among others, it provides powerful filtering capabilities based on message content, and can also be used in a firewalled environment without problems.&lt;br /&gt;&lt;br /&gt;Installation is a breeze since most distributions provide binary packages. If you prefer to manually build the program, check the INSTALL file included in the source tarball, which outlines all the necessary steps. Make sure to uninstall syslogd before installing syslog-ng.&lt;br /&gt;&lt;br /&gt;The syntax of the configuration file might seem peculiar and complex compared to the traditional syslog.conf syntax, but it offers almost limitless customization options. Make sure to read the syslog-ng.conf man page for information on how to use it.&lt;br /&gt;&lt;br /&gt;Since our logging system will gather logs from other hosts, we need to instruct it to listen for network connections. Syslog-ng supports both the TCP and UDP protocols. IANA has assigned the 514/udp port to the syslog service, so we will use that port for maximum compatibility with syslogd and network devices such as routers. If you use syslog-ng on all your hosts, it's better to use the TCP protocol, which is more reliable and firewall-friendly.&lt;br /&gt;&lt;br /&gt;Add the following lines to your /etc/syslog-ng/syslog-ng.conf to the appropriate sections indicated by comments (lines starting with #) to enable listening for network connections on a specific IP address, and to archive logs from remote hosts as /var/log/$HOST/$FACILITY (e.g. /var/log/mailserver/mail):&lt;br /&gt;&lt;br /&gt;## add this to the options section&lt;br /&gt;create_dirs(yes);&lt;br /&gt;long_hostnames(off);&lt;br /&gt;keep_hostname(yes);&lt;br /&gt;&lt;br /&gt;# uncomment the following line only on a LAN with working DNS&lt;br /&gt;#use_dns(yes);&lt;br /&gt;&lt;br /&gt;## add this to the source section&lt;br /&gt;source s_udp {&lt;br /&gt; udp ( ip(192.168.1.2) ); # replace with your system's IP address&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;## add this to the destination section&lt;br /&gt;destination df_udp {&lt;br /&gt;        file ("/var/log/$HOST/$FACILITY");&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;## add this to the log section&lt;br /&gt;log {&lt;br /&gt;        source(s_udp);&lt;br /&gt;        destination (df_udp);&lt;br /&gt;};&lt;br /&gt;On the remote hosts add the following lines in /etc/syslog-ng/syslog-ng.conf or /etc/syslog.conf, depending on whether they run syslog-ng or syslogd respectively:&lt;br /&gt;&lt;br /&gt;## /etc/syslog-ng/syslog-ng.conf&lt;br /&gt;&lt;br /&gt;## add this to the destination section&lt;br /&gt;destination remote_udp { udp("192.168.1.2"); }; # replace with your log server's IP address&lt;br /&gt;&lt;br /&gt;## add this to the log section&lt;br /&gt;log { source(src); destination(remote_udp); };&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;## /etc/syslog.conf&lt;br /&gt;&lt;br /&gt;# use tabs instead of space&lt;br /&gt;*.* @192.168.1.2 # replace with your log server's IP address&lt;br /&gt;You can add additional filters to better suit your needs or even log to a database like PostgreSQL. Note that syslog traffic between hosts is unencrypted; if you want to gather logs from remote hosts over the Internet, create SSH tunnels first, for security.&lt;br /&gt;&lt;br /&gt;Logcheck&lt;br /&gt;&lt;br /&gt;At this point you have configured a full-featured syslog server that gathers and archives logs from multiple servers, but so far you still have to read those logs manually. Now we'll add logcheck to the equation.&lt;br /&gt;&lt;br /&gt;Logcheck is an excellent program that parses log files, filters out expected, normal events based on pre-defined regular expressions, then summarizes the remaining entries and emails them to the system administrator's account. Logcheck was previously part of the Sentry tools suite, but since it had been unmaintained for a long time, it was forked by Debian developers, who have done a wonderful job integrating logcheck into the system. Most network daemon packages include logcheck rules out of the box.&lt;br /&gt;&lt;br /&gt;To install logcheck on a Debian-based system simply apt-get install the logcheck, logtail, and logcheck-database packages; the last of the three provides lots of ready-made rules for various system events. To install it on other distributions, download the source tarball and read the INSTALL file. Since it is just a shell script it does not need any compilation.&lt;br /&gt;&lt;br /&gt;Configuration is simple. First enter which log files you want to be checked by logcheck in /etc/logcheck/logcheck.logfiles. Logcheck supports three levels of filtering: paranoid, server, and workstation. Each level uses a directory named /etc/logcheck/ignore.d.level_name that includes filtering rules files with different verbosity levels. Paranoid produces highly verbose output and should be used only on high-security systems running a minimum number of services. Server should be fine for most systems and is used by default. Workstation filters out most of the messages and thus produces the least verbose output of the three. You can define which filtering level should be used in /etc/logcheck/logcheck.conf, along with other parameters, such as the recipient email address and the subject of the emails.&lt;br /&gt;&lt;br /&gt;Logcheck uses standard regular expressions to filter logs. It's not difficult to write custom rules; read the WRITING RULES paragraph of the docs/README.logcheck-database file in the source tarball (or /usr/share/doc/logcheck-database/README.logcheck-database.gz in Debian) for more information. If you're new to regular expressions, this guide might be useful. As an example, check this filter file for Dovecot:&lt;br /&gt;&lt;br /&gt;^\w{3} [ :0-9]{11} [._[:alnum:]-]+ imap-login: Login: [.[:alnum:]-]+ \[[0-9.]+\]$&lt;br /&gt;^\w{3} [ :0-9]{11} [._[:alnum:]-]+ imap-login: Disconnected \[[0-9.]+\]$&lt;br /&gt;^\w{3} [ :0-9]{11} [._[:alnum:]-]+ imap\([^[:space:]]+\): File isn't in mbox format: [^[:space:]]+$&lt;br /&gt;Logcheck runs periodically from cron. The default cron job installed by the Debian package (/etc/cron.d/logcheck) runs logcheck every hour or when the system reboots. Unless you want 24 logcheck email messages per day, you should adjust how often it should run by editing the file. I prefer to run it on a daily basis.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-2862887242097187676?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/2862887242097187676/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=2862887242097187676&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/2862887242097187676'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/2862887242097187676'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/04/build-centralized-log-management-and.html' title='Build a centralized log management and monitoring system'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-5583670526149593704</id><published>2009-04-15T16:49:00.001+05:30</published><updated>2009-04-15T16:49:51.538+05:30</updated><title type='text'>EC order gags media on poll eve coverage</title><content type='html'>THE Election Commission said on Tuesday that the electronic media cannot telecast anything related to elections which can influence voters in areas where polls are to take place, 48 hours preceding voting. &lt;br /&gt;&lt;br /&gt;The Election Commissioner said, TV channels were barred from telecasting poll-related programmes like interviews, discussions and poll analyses and surveys that could influence voters 48-hour before polling day. &lt;br /&gt;&lt;br /&gt;In a separate order issued under section 126 of the Representation of People's Act that prohibits displaying any election matter on television or any related medium 48 hours before poll, EC has also banned dissemination of results of opinion and exit polls by the media. The gag on electronic media is seen as unsuitable for multi-phase elections as well as innocent of the ways the media functions. &lt;br /&gt;&lt;br /&gt;The official said, "the rule applies even to national channels. During this period, national channels are not allowed to telecast such programmes about Andhra Pradesh. Even animation programmes that could influence voters should not be screened."&lt;br /&gt;&lt;br /&gt;Mr Rao explained that with the first phase polling scheduled for April 16, TV channels would not even be allowed to air poll-related analyses of seats going to the polls on April 23. Failure to comply would mean imprisonment up to two years or fine or both.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-5583670526149593704?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/5583670526149593704/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=5583670526149593704&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/5583670526149593704'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/5583670526149593704'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/04/ec-order-gags-media-on-poll-eve.html' title='EC order gags media on poll eve coverage'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-1525814659955651738</id><published>2009-04-14T15:17:00.002+05:30</published><updated>2009-04-14T15:18:03.419+05:30</updated><title type='text'>SC seeks undertaking from Varun, hearing put off</title><content type='html'>THE Supreme Court has adjourned the hearing on Varun Gandhi&amp;#8217;s bail plea till Thursday, which means the BJP leader will have to spend a few more days in jail.&lt;br /&gt;&lt;br /&gt;The apex court said that Varun can be free provided he gives in writing to the court that he will make no provocative speeches during his campaign. Varun's lawyer told the court that he would give the undertaking.&lt;br /&gt;&lt;br /&gt;Now, the SC has asked the Uttar Pradesh government if Varun gives an undertaking, will it be acceptable to the UP government. &lt;br /&gt;&lt;br /&gt;Varun Gandhi, who has been detained in the Etah jail, has challenged his detention under the National Security Act (NSA) by the Uttar Pradesh government.&lt;br /&gt;&lt;br /&gt;The apex court bench headed by Chief Justice KG Balakrishnan will consider the plea for Varun's release to enable him to file his nomination papers as well as to contest elections from Pilibhit. The 29-year old was arrested under section 153 A of the Indian Penal Code for delivering a communal speech during an election rally in March The NSA was slapped on him following violence in Pilbhit during his surrender before the court. &lt;br /&gt;&lt;br /&gt;While Varun's lawyers are likely to argue that the CD containing the hate speech is doctored, and therefore inadmissible as material evidence to book him under the NSA, the Uttar Pradesh government is expected to take a stand that Varun&amp;#8217;s release would pose a threat to peace and could lead to a serious law and order problem in the state.&lt;br /&gt;&lt;br /&gt;In its affidavit, the Mayawati government has described Varun as a "national threat to communal peace and harmony", thereby defending its action of invoking the NSA.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-1525814659955651738?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/1525814659955651738/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=1525814659955651738&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/1525814659955651738'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/1525814659955651738'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/04/sc-seeks-undertaking-from-varun-hearing.html' title='SC seeks undertaking from Varun, hearing put off'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-1051173510463756107</id><published>2009-04-14T15:17:00.001+05:30</published><updated>2009-04-14T15:17:33.880+05:30</updated><title type='text'>Laloo-Mulayam-Paswan claim to be kingmakers</title><content type='html'>THE strong political formation among foes-turned-friends, Laloo, Mulayam and Ram Vilas Paswan are almost confident that they would be able to have a significant say in the government formation process at the Centre after the elections. &lt;br /&gt;&lt;br /&gt;Speaking at its first show as the 'Fourth Front' in Uttar Pradesh, the three leaders addressed a joint rally at Saifai in Etawah district of Uttar Pradesh on Thursday, claiming that the next government at the Centre cannot be formed without them. &lt;br /&gt;&lt;br /&gt;The troika, comprising RJD, LJP and SP, was formed in March 2009, and will contest 120 seats in the three states. The leaders repeatedly said that the new coalition is part of the UPA, and will work together to stop communal forces from coming to power.&lt;br /&gt;&lt;br /&gt;In the rally, Laloo Prasad Yadav said,"Three brothers have come together, not only to win Lok Sabha elections, but also to fight communalism. We will show our strength in the cow belt." &lt;br /&gt;&lt;br /&gt;The three joined hands after the Congress said it would not have a nationwide alliance. After Saifai, they are planning to hold joint rallies in Varanasi, Lucknow and several places in Bihar.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-1051173510463756107?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/1051173510463756107/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=1051173510463756107&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/1051173510463756107'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/1051173510463756107'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/04/laloo-mulayam-paswan-claim-to-be.html' title='Laloo-Mulayam-Paswan claim to be kingmakers'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-5068184312866853994</id><published>2009-04-14T15:16:00.001+05:30</published><updated>2009-04-14T15:16:53.762+05:30</updated><title type='text'>Indian Elections - Varun Gandhi's Hate Speech</title><content type='html'>[Note to non-Indian visitors and unacquainted Indians: Varun Gandhi, 29, is the nephew of Sonia Gandhi and grandson of Indira Gandhi, former Indian Prime Minister. However, unlike Sonia and Indira who were in the Indian National Congress Party, Varun is in the Hindu nationalist Bharatiya Janta Party (translated into the Indian People&amp;#8217;s Party). This is the first time he is running for office. BJP is not new to inciting religious violence against Muslims (to be fair, some Indian Muslim groups are often involved in acts that give the BJP &amp;#8216;excuses&amp;#8217; to do what they do. However, the BJP and its sister and mother organizations, the Bajrang Dal, Vishva Hindu Parishad and the RSS, are no less and they are collectively &amp;#8216;guilty&amp;#8217; at times). In India, Hindu and Muslim fundamentalism feed each other. A regressive Islamic philosophy has met a bigoted Hindu Nationalist one. The BJP derives its cadres from those who believe the Congress &amp;#8220;appeases&amp;#8221; the minorities (read, &amp;#8220;Muslims&amp;#8221;) at the expense of &amp;#8220;Hindu interests&amp;#8221;.]&lt;br /&gt;&lt;br /&gt;Here are portions of the speech made by Varun Gandhi in Pilibhit amid a crowd that was reeling in anti-Muslim hatred due to certain incidents in recent local history, as appeared in the Indian Express, March 18 &amp;#8217;09:&lt;br /&gt;&lt;br /&gt;&lt;img src="http://bigotblog.files.wordpress.com/2009/03/varun-gandhi.jpg?w=500&amp;h=1043" alt="" /&gt;&lt;br /&gt;&lt;br /&gt;I would add here that if the people of that region had really seen outrages by the Muslim community, the campaigning leaders should have spoken about bringing law-and-order and justice to the region. To call for the heads of Muslims is nothing short of barbaric.&lt;br /&gt;&lt;br /&gt;After a CD was released of this speech by some private entities, presumably political rivals, Varun denied making any of those statements claiming that the speech was doctored and the voice isn&amp;#8217;t his. On TV today, he gave an example of the doctoring. He said he never referred to Muslims as &amp;#8220;Katuas&amp;#8221; (derogatory term for a Muslim referring to their circumcision &amp;#8211; equivalent to calling an African American as &amp;#8216;nigger&amp;#8217;) and instead was referring to &amp;#8220;vote Katuas&amp;#8221; which he claims means those non-serious political candidates who run in elections to &amp;#8220;cut votes&amp;#8221; of popular candidates. However yesterday, in the Indian Express, he claimed he was referring to &amp;#8220;galat tatvas&amp;#8221; roughly meaning &amp;#8220;anti-social elements&amp;#8221;, and not &amp;#8220;Katuas&amp;#8221;. He claimed that was added later. Two explanations in two days. And to top that, claims that he &amp;#8220;never spoke those words&amp;#8221;.&lt;br /&gt;&lt;br /&gt;He seems guilty on the face of it. The video doesn&amp;#8217;t seem doctored. However, I would be wrong to call him that until and unless he is proven guilty in a court of law. Innocent unless proven otherwise. But hunch is that he isn&amp;#8217;t innocent.&lt;br /&gt;&lt;img src="http://bigotblog.files.wordpress.com/2009/03/4dda3158-1e26-4505-bf98-f176a21af14e.jpg?w=320&amp;h=380" alt="" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-5068184312866853994?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/5068184312866853994/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=5068184312866853994&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/5068184312866853994'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/5068184312866853994'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/04/indian-elections-varun-gandhis-hate.html' title='Indian Elections - Varun Gandhi&apos;s Hate Speech'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-3932798740466329669</id><published>2009-04-14T15:15:00.000+05:30</published><updated>2009-04-14T15:16:09.308+05:30</updated><title type='text'>India election 2009 : world's biggest democracy</title><content type='html'>The General elections in India are the elections by which the Indian electorate chooses the diverse members of the Lok Sabha in the Parliament for the subsequently term of five years. The voters also ultimately votes for the Prime Minister as the head chosen by the majority party or the majority alliance becomes the next Prime Minister.&lt;br /&gt;&lt;img src="http://4.bp.blogspot.com/_dN1Et-_8nYg/SdyWoM1tc3I/AAAAAAAAFrQ/WNDnfd0JubU/s400/India+election+2009.gif" alt="Indian Constitution" /&gt;&lt;br /&gt;&lt;br /&gt;The General elections is the prime election work out in the world. With the dawn of EVMs, the election process has become more protected and swift.&lt;br /&gt;Indian general election, 2009&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;All 543 seats in the Lok Sabha&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;An election is a administrative process by which a inhabitants chooses an character to hold recognized office. This is the natural device by which present representative democracy fills offices in the legislature, sometimes in the executive and judiciary, and for regional and local government. This course of action is also used in many other privileged and business organizations, from clubs to voluntary associations and corporations.&lt;br /&gt;The worldwide use of elections as a contrivance for selecting legislature in modern democracies is in contrast with the follow in the democratic archetype, ancient Athens. Elections were well thought-out an oligarchic institution and most political offices were onthe top using sortition, also known as allowance, by which officeholders were chosen by lot.&lt;br /&gt;Electoral reform describes the process of introducing pale electoral systems where they are not in position, or humanizing the fairness or usefulness of existing systems. Psephology is the study of results and other statistics relating to elections.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="http://3.bp.blogspot.com/_l2kjH2fC6p0/Sdxb_ps22JI/AAAAAAAAAD4/pU1AFgUoqeQ/s400/130px-Manmohansinghindia.jpg" alt="Manmohan Singh" /&gt;&lt;br /&gt;&lt;strong&gt;Leader:- Manmohan Singh&lt;br /&gt;Last election:- 145 seats, 26.7%&lt;br /&gt;Leader's seat:- Assam (Rajya Sabha)&lt;br /&gt;Party:- Congress&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;img src="http://2.bp.blogspot.com/_l2kjH2fC6p0/SdxdG9jU17I/AAAAAAAAAEA/7v9OBKkf9rg/s400/145px-Advani.jpg" alt="L.K.Advani" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Leader:- Lal Krishna Advani&lt;br /&gt;Last election:- 138 seats, 22.2%&lt;br /&gt;Leader's seat:- Gandhinagar&lt;br /&gt;Party:- BJP&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;India will seize general elections to the 15th Lok Sabha in 5 phases on April 16, April 22, April 23, April 30, May 7 and May 13, 2009. The outcome of the election will be announced in single phase on May 16, 2009.&lt;br /&gt;&lt;br /&gt;According to the Indian Constitution, elections in India for the Lok Sabha (the national parliament) must be seized at least every five years under conventional circumstances. With the last elections held in 2004, the term of the 14th Lok Sabha expires on June 1, 2009.&lt;br /&gt;The election is conducted by the Election Commission of India, which estimates an electorate of 714 million voters, an increase of 43 million over the 2004 election. During the financial plan presented in February 2009, Rupees 1,120 Crores (Approx. EUR 180 M) was budgeted for election operating expense.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Think Twice before you choose.&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-3932798740466329669?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/3932798740466329669/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=3932798740466329669&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/3932798740466329669'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/3932798740466329669'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/04/india-election-2009-worlds-biggest.html' title='India election 2009 : world&apos;s biggest democracy'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_dN1Et-_8nYg/SdyWoM1tc3I/AAAAAAAAFrQ/WNDnfd0JubU/s72-c/India+election+2009.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-5865238255416357950</id><published>2009-04-14T15:14:00.000+05:30</published><updated>2009-04-14T15:15:12.962+05:30</updated><title type='text'>India Election '09</title><content type='html'>&lt;p&gt;Election campaigning is in full swing in India and amidst all the frenzy, the &lt;a href="http://en.wikipedia.org/wiki/Pilibhit"&gt;Pilbhit&lt;/a&gt; constituency in &lt;a href="http://en.wikipedia.org/wiki/Uttar_Pradesh"&gt;Uttar Pradesh&lt;/a&gt;, has come under the scanner after one of its young BJP candidates, &lt;a href="http://en.wikipedia.org/wiki/Varun_Gandhi"&gt;Varun Gandhi&lt;/a&gt; courted controversy over his allegedly communal and inflammatory campaign speeches during election rallies in his constituency on March 6th and 8th, 2009.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;Over the next few weeks, video footage of Varun Gandhi&amp;#39;s speeches were repeatedly splashed across TV channels. When questioned by the media and the &lt;a href="http://eci.nic.in/"&gt;Election Commission&lt;/a&gt;. Varun stated that the audio in the footage had been doctored and it was a ploy against him. Unmoved by his denial, the Election Commission sent him a show cause notice for violating the &lt;a href="http://eci.nic.in/Model_Code_Conduct.pdf"&gt;Model Code of Conduct&lt;/a&gt;, and later, on 22 March 2009, found him guilty of making &amp;#8216;hate speeches&amp;#39;.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;A spate of criminal cases  lodged against him, on 29th March, Varun Gandhi surrendered before a local court in Pilbhit. He was arrested and jailed. The State Government has now &lt;a href="http://www.expressindia.com/latest-news/up-govt-confirms-nsa-on-varun/444953/"&gt;booked him&lt;/a&gt; under the &lt;a href="http://www.mha.nic.in/pdfs/National_Security_Act1980.pdf"&gt;National Security Act (NSA)&lt;/a&gt; on &lt;em&gt;&amp;#8220;charges of inciting communal passion by making provocative and inflammatory speeches during [election campaign] meetings&amp;#8221;.&lt;/em&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt;As of today, Varun Gandhi continues to be in the eye of the storm as various political parties and their leaders try to gain maximum mileage out of the incident. The &lt;a href="http://en.wikipedia.org/wiki/Rashtriya_Janata_Dal"&gt;Rashtriya Janata Dal&lt;/a&gt; supremo &lt;a href="http://en.wikipedia.org/wiki/Laloo_Prasad_Yadav"&gt;Lalu Prasad Yadav &lt;/a&gt;has gone as far as to &lt;a href="http://www.indianexpress.com/news/lalus-roller-over-varun-remark-fir-warrant-out/444556/"&gt;court controversy&lt;/a&gt; himself after making a speech berating Varun. The BJP on the other hand, has &lt;a href="http://www.expressbuzz.com/edition/story.aspx?Title=BJP+president+to+meet+Varun+in+Etah+jai&amp;amp;artid=2BwQC8x7k6I=&amp;amp;SectionID=b7ziAYMenjw=&amp;amp;MainSectionID=fyV9T2jIa4A=&amp;amp;SectionName=pWehHe7IsSU=&amp;amp;SEO=BJP%20president;%20Rajnath%20Singh;%20Uttar%20Pradesh;%20Etah"&gt;renewed it&amp;#39;s stance&lt;/a&gt; of backing it&amp;#39;s protege Varun Gandhi with both political and legal aid.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;The blogosphere too has been abuzz with opinions on the Varun Gandhi controversy.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;&lt;a href="http://www.youthkiawaaz.com/2009/03/varun-gandhi-new-face-of-indian.html"&gt;Youth ki Awaaz&lt;/a&gt; writes:&lt;/p&gt; &lt;br /&gt;&lt;blockquote&gt;&lt;p&gt;&lt;em&gt;&lt;span id="fullpost"&gt;If young leaders like Varun give such defamatory remarks, what can we expect from the others? The fact that India is a country with communal diversity makes it mandatory for each and every citizen to have a feeling of brotherhood.&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;br /&gt;&lt;p&gt;Blogger &lt;em&gt;ak&lt;/em&gt; too is apprehensive about young candidates like Varun Gandhi, who could also be tomorrow&amp;#39;s leaders spewing such rhetoric. &lt;a href="http://dreamer-1987.blogspot.com/2009/04/hate-is-word.html"&gt;He says&lt;/a&gt;:&lt;/p&gt; &lt;br /&gt;&lt;blockquote&gt;&lt;p&gt;&lt;em&gt;To hear someone so young like Varun Gandhi give out that hate speech against the muslims in such mean tones was just shameful. Are these the young leaders that is going to takle(sic) India forward??&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;br /&gt;&lt;p&gt;Another blogger &lt;em&gt;Vijay Vikram&lt;/em&gt; &lt;a href="http://vijayum.blogspot.com/2009/03/varun-gandhi-controversry.html"&gt;discusses&lt;/a&gt; what he feels was the motivation behind Varun&amp;#39;s rhetoric.&lt;/p&gt; &lt;br /&gt;&lt;blockquote&gt;&lt;p&gt;&lt;em&gt;It is a sad fact of Indian - for that matter all democratic polity - that aspiring statesmen have to appeal to the lowest common denominator for electoral gains. That is precisely what Varun Gandhi was doing. Varun Gandhi&amp;#39;s remarks were borne out of political necessity, nothing else.&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;br /&gt;&lt;p&gt;On the other hand, some bloggers have come out in support of Varun Gandhi, seeing him as a scapegoat in the drama of India&amp;#39;s minority-vote politics.  &lt;em&gt;Sreekrishnan Venkatesan&lt;/em&gt; &lt;a href="http://sreekrishnan.blogspot.com/2009/03/varun-gandhi.html"&gt;writes&lt;/a&gt;:&lt;/p&gt; &lt;br /&gt;&lt;blockquote&gt;&lt;p&gt;&lt;em&gt;i did not find anything wrong in Varun Gandhi&amp;#39;s speech. He warned any other religious fanatics killing Hindus, which to me looked very much normal. In fact this isn&amp;#39;t as bad like congress which goes all out to playing the communal card, with non hindu religions. Hypocrisy in all its strength. Supporting a minority religious community is &amp;#8220;Secular&amp;#8221; while supporting Hindus is &amp;#8220;communal&amp;#8221;.&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;br /&gt;&lt;p&gt;In this entire controversy, the role of the MSM has also come under scrutiny. &lt;a href="http://media-mad-ia.blogspot.com/2009/04/did-repeat-telecasts-of-varuns-speech.html"&gt;Shahid Siddiqui of Media-Mania&lt;/a&gt; wonders why the TV channels devoted as much as over 22.57 hrs of prime time playing back the video footage. He asks:&lt;/p&gt; &lt;br /&gt;&lt;blockquote&gt;&lt;p&gt;&lt;em&gt;If the media really believed that Varun Gandhi&amp;#8217;s speech would cause unrest among a section of the people, did the repeat telecasts of the speech make any sense?&amp;#8230;All the TV channels have overplayed the issue. It was not even authenticated if the CD was original. As per the ethics of journalism, it should not have been played as it has been done, especially during the elections&amp;#8230;.The role of media is certainly open to question. While reporting that it was a &amp;#8220;hate speech&amp;#8221; &amp;#8220;blatantly communal&amp;#8221; etc, did the media behave responsibly by telecasting the tape umpteen times a day for the last few days?&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;br /&gt;&lt;p&gt;Bloggers are also discussing whether Varun Gandhi should have been booked under the NSA.  Many of them seem to echo the words of the Chief Minister of Jammu &amp;amp; Kashmir, Omar Abdullah, who &lt;a href="http://www.ptinews.com/pti%5Cptisite.nsf/0/4C5D06566F420B3A6525758C0032725B?OpenDocument"&gt;stated&lt;/a&gt; that &lt;em&gt;&amp;#8220;The hate speech of BJP&amp;#39;s Lok Sabha candidate Varun Gandhi did not threaten national security and a law other than the National Security Act could have been invoked to deal with it&amp;#8221;.&lt;/em&gt; In this context,&lt;em&gt;Vinay&lt;/em&gt; &lt;a href="http://win2vin.wordpress.com/2009/04/03/is-it-right-to-punish-varun-gandhi-under-national-security-act1980/"&gt;writes&lt;/a&gt;:&lt;/p&gt; &lt;br /&gt;&lt;blockquote&gt; &lt;br /&gt;&lt;p class="MsoNormal"&gt;&lt;em&gt;&amp;#8230; punishing him under NSA is unwarranted. Even though his speech had the potential to disturb public order, the warning by election Commission and subsequent FIRs under Representation of People Act were sufficient.&lt;/em&gt;&lt;/p&gt; &lt;br /&gt;&lt;p class="MsoNormal"&gt;&lt;em&gt;The CD containing his speech came into light some 15 days later after he gave it. It means his speech did not lead to any violence immediately, which is actually case in most of the instances.&lt;/em&gt;&lt;/p&gt; &lt;br /&gt;&lt;p class="MsoNormal"&gt;&lt;em&gt;Listening to his speech one can say that it was more of rhetoric in spite of being venomous.&lt;/em&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt;&lt;em&gt;Nonetheless he deserves punishment, but not under NSA.&lt;/em&gt;&lt;/p&gt; &lt;br /&gt;&lt;p class="MsoNormal"&gt;&lt;em&gt;He has been arrested under the preventive detention clause of NSA, which is clearly doctored to prevent him from contesting elections.&lt;/em&gt;&lt;/p&gt; &lt;br /&gt;&lt;/blockquote&gt; &lt;br /&gt;&lt;p&gt;Varun&amp;#39;s lawyers have challenged his detention in the Supreme Court. The case will come up for hearing on April 13th.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-5865238255416357950?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/5865238255416357950/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=5865238255416357950&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/5865238255416357950'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/5865238255416357950'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/04/india-election-09.html' title='India Election &apos;09'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-388167135779168363</id><published>2009-04-14T15:13:00.000+05:30</published><updated>2009-04-14T15:14:43.597+05:30</updated><title type='text'>Script to Install CentOS 5 on Amazon</title><content type='html'>#!/bin/bash -e&lt;br /&gt;# Copyright (c) 2007 RightScale Inc. &lt;br /&gt;#  &lt;br /&gt;# Permission is hereby granted, free of charge, to any person obtaining &lt;br /&gt;# a copy of this software and associated documentation files (the &lt;br /&gt;# "Software"), to deal in the Software without restriction, including &lt;br /&gt;# without limitation the rights to use, copy, modify, merge, publish, &lt;br /&gt;# distribute, sublicense, and/or sell copies of the Software, and to &lt;br /&gt;# permit persons to whom the Software is furnished to do so, subject to &lt;br /&gt;# the following conditions: &lt;br /&gt;#  &lt;br /&gt;# The above copyright notice and this permission notice shall be &lt;br /&gt;# included in all copies or substantial portions of the Software. &lt;br /&gt;#  &lt;br /&gt;# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, &lt;br /&gt;# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF &lt;br /&gt;# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND &lt;br /&gt;# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE &lt;br /&gt;# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION &lt;br /&gt;# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION &lt;br /&gt;# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.&lt;br /&gt;#&lt;br /&gt;# Uncomment and edit these for production use&lt;br /&gt;# the full pathname is required for the certificates and &lt;br /&gt;# private keys. Examples are below. &lt;br /&gt;#&lt;br /&gt;#export EC2_CERT=/home/ec2/etc/cert.pem&lt;br /&gt;#export EC2_HOME=/home/ec2 &lt;br /&gt;#export EC2_PRIVATE_KEY=/home/ec2/etc/pk.pem&lt;br /&gt;#export AWS_ACCOUNT_NUMBER=&lt;br /&gt;#export AWS_ACCESS_KEY_ID= &lt;br /&gt;#export AWS_SECRET_ACCESS_KEY=&lt;br /&gt;#export AWS_BUCKET=&lt;br /&gt;#export IMAGE_NAME=&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;echo "Hello $USER, Lets get started installing CentOS 5"&lt;br /&gt;&lt;br /&gt;echo "........................................" &lt;br /&gt;showOpts () {&lt;br /&gt; echo "Please Select an Option or 8 to quit"&lt;br /&gt; echo "0) Set EC2 Variables"&lt;br /&gt; echo "1) Create and Mount Image"&lt;br /&gt; echo "2) Installing Yum and CentOS 5 Base"&lt;br /&gt; echo "3) Install Additional Packages"&lt;br /&gt; echo "4) Install RightScale Customizations"&lt;br /&gt; echo "5) Clean Up FileSystem and Bundle Image"&lt;br /&gt; echo "6) Upload Image"&lt;br /&gt; echo "7) Clean Up"&lt;br /&gt; echo "8) Quit"&lt;br /&gt;}&lt;br /&gt;showEC2Opts () {&lt;br /&gt;&lt;br /&gt; echo "Please Select an Option or 4 to quit"&lt;br /&gt; echo "1) Set EC2 Variables"&lt;br /&gt; echo "2) Show EC2 Variables"&lt;br /&gt; echo "3) Set AWS Bucket &amp; Image Name"&lt;br /&gt; echo "4) Back"&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;while [ 1 ] &lt;br /&gt;do&lt;br /&gt; showOpts&lt;br /&gt; read CHOICE&lt;br /&gt; case "$CHOICE" in&lt;br /&gt;  "0")&lt;br /&gt;   while [ 1 ]&lt;br /&gt;   do&lt;br /&gt;   showEC2Opts&lt;br /&gt;   read EC2CHOICE&lt;br /&gt;   case "$EC2CHOICE" in&lt;br /&gt;    "1")&lt;br /&gt;     echo "Warning !!!"&lt;br /&gt;     echo "The full pathname is required for the Certificate"&lt;br /&gt;     echo "and Private Keys to work properly"&lt;br /&gt;     echo " "&lt;br /&gt;        echo "Please Enter Your Certificate Path"&lt;br /&gt;        read EC2_CERT_PATH&lt;br /&gt;        export EC2_CERT=$EC2_CERT_PATH&lt;br /&gt;        echo "Please Enter You Private Key Path"&lt;br /&gt;        read EC2_PRIVATE_KEY_PATH&lt;br /&gt;        export EC2_PRIVATE_KEY=$EC2_PRIVATE_KEY_PATH&lt;br /&gt;        echo "Please Enter Your AWS Account Number"&lt;br /&gt;        read  AWS_ACCOUNT_NUMBER_TEMP&lt;br /&gt;        export AWS_ACCOUNT_NUMBER=$AWS_ACCOUNT_NUMBER_TEMP&lt;br /&gt;        echo "Please Enter Your AWS Access Key"&lt;br /&gt;        read AWS_ACCESS_KEY_ID_TEMP&lt;br /&gt;        export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID_TEMP&lt;br /&gt;        echo "Please Enter Your AWS Secret Access Key"&lt;br /&gt;        read AWS_SECRET_ACCESS_KEY_TEMP&lt;br /&gt;        export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY_TEMP&lt;br /&gt;        echo "Done"&lt;br /&gt;                &lt;br /&gt;        ;;&lt;br /&gt;       "2")&lt;br /&gt;        echo "------------Parameters-----------------------"&lt;br /&gt;        echo "EC2 Certificate Path:" $EC2_CERT&lt;br /&gt;        echo "EC2 Private Key Path:" $EC2_PRIVATE_KEY&lt;br /&gt;        echo "AWS Account Number:" $AWS_ACCOUNT_NUMBER&lt;br /&gt;        echo "AWS Access Key:" $AWS_ACCESS_KEY_ID&lt;br /&gt;        echo "AWS Secret Access Key:" $AWS_SECRET_ACCESS_KEY&lt;br /&gt;        echo "AWS Bucket:" $AWS_BUCKET&lt;br /&gt;        echo "Image Name:" $IMAGE_NAME&lt;br /&gt;        echo "------------End Parameters-------------------"&lt;br /&gt;        echo ""&lt;br /&gt;        ;;&lt;br /&gt;     &lt;br /&gt;    "3")&lt;br /&gt;     echo "Please enter in the AWS Bucket"&lt;br /&gt;        read AWS_BUCKET_TEMP&lt;br /&gt;        export AWS_BUCKET=$AWS_BUCKET_TEMP&lt;br /&gt;        echo "Please Enter Your Image Name ex: myfc6.img"&lt;br /&gt;        read IMAGE_NAME_TEMP&lt;br /&gt;        export IMAGE_NAME=$IMAGE_NAME_TEMP&lt;br /&gt;     showEC2Opts&lt;br /&gt;     ;;&lt;br /&gt;    "4")&lt;br /&gt;     break&lt;br /&gt;     ;;&lt;br /&gt;   esac&lt;br /&gt;   done&lt;br /&gt;   ;;&lt;br /&gt;  "1")&lt;br /&gt;   echo "Creating 10GB Image"&lt;br /&gt;   mkdir /mnt/image&lt;br /&gt;   dd if=/dev/zero of=/mnt/image/$IMAGE_NAME bs=1M count=10240&lt;br /&gt;   echo "Creating File System"&lt;br /&gt;   mke2fs -F -j /mnt/image/$IMAGE_NAME&lt;br /&gt;   mkdir /mnt/ec2-fs&lt;br /&gt;   echo "Mounting File System in /mnt/ec2-fs"&lt;br /&gt;   mount -o loop /mnt/image/$IMAGE_NAME /mnt/ec2-fs&lt;br /&gt;   mkdir /mnt/ec2-fs/dev&lt;br /&gt;   /sbin/MAKEDEV -d /mnt/ec2-fs/dev -x console&lt;br /&gt;   /sbin/MAKEDEV -d /mnt/ec2-fs/dev -x null&lt;br /&gt;   /sbin/MAKEDEV -d /mnt/ec2-fs/dev -x zero&lt;br /&gt;   mkdir /mnt/ec2-fs/proc&lt;br /&gt;   mount -t proc none /mnt/ec2-fs/proc&lt;br /&gt;   mkdir /mnt/ec2-fs/etc&lt;br /&gt;   cat &lt; &lt;EOL &gt; /mnt/ec2-fs/etc/fstab&lt;br /&gt;/dev/sda1  /         ext3    defaults        1 1&lt;br /&gt;/dev/sda2  /mnt      ext3    defaults        1 2&lt;br /&gt;/dev/sda3  swap      swap    defaults        0 0&lt;br /&gt;none       /dev/pts  devpts  gid=5,mode=620  0 0&lt;br /&gt;none       /dev/shm  tmpfs   defaults        0 0&lt;br /&gt;none       /proc     proc    defaults        0 0&lt;br /&gt;none       /sys      sysfs   defaults        0 0&lt;br /&gt;EOL&lt;br /&gt;   echo "Finished Step 1" &lt;br /&gt;   ;;&lt;br /&gt;  "2")&lt;br /&gt;   echo "Installing Yum 3.0"&lt;br /&gt;   wget http://linux.duke.edu/projects/yum/download/3.0/yum-3.0.5.tar.gz&lt;br /&gt;   tar -xvzf yum-3.0.5.tar.gz&lt;br /&gt;   cd yum-3.0.5&lt;br /&gt;   make DESTDIR=/ install&lt;br /&gt;   echo "Creating Yum Confuration"&lt;br /&gt;   mkdir -p /mnt/ec2-fs/sys/block&lt;br /&gt;   mkdir -p /mnt/ec2-fs/var/&lt;br /&gt;   mkdir -p /mnt/ec2-fs/var/log/&lt;br /&gt;   touch /mnt/ec2-fs/var/log/yum.log&lt;br /&gt;   cat &lt; &lt;EOL &gt; /mnt/image/yum.conf&lt;br /&gt;[main]&lt;br /&gt;cachedir=/var/cache/yum&lt;br /&gt;debuglevel=2&lt;br /&gt;logfile=/var/log/yum.log&lt;br /&gt;exclude=*-debuginfo&lt;br /&gt;gpgcheck=0&lt;br /&gt;obsoletes=1&lt;br /&gt;pkgpolicy=newest&lt;br /&gt;distroverpkg=redhat-release&lt;br /&gt;tolerant=1&lt;br /&gt;exactarch=1&lt;br /&gt;reposdir=/dev/null&lt;br /&gt;metadata_expire=1800&lt;br /&gt;&lt;br /&gt;[base]&lt;br /&gt;name=CentOS 5 - $basearch - Base&lt;br /&gt;baseurl=http://mirrors.kernel.org/centos/5.0/os/x86_64/&lt;br /&gt;        http://mirror.rightscale.com/centos/5/os/x86_64/&lt;br /&gt;enabled=1&lt;br /&gt;&lt;br /&gt;[updates-released]&lt;br /&gt;name=CentOS 5 - $basearch - Released Updates&lt;br /&gt;baseurl=http://mirrors.kernel.org/centos/5.0/updates/x86_64/&lt;br /&gt;        http://mirror.rightscale.com/centos/5/updates/x86_64/&lt;br /&gt;enabled=1&lt;br /&gt;&lt;br /&gt;[extras]&lt;br /&gt;name=CentOS 5 Extras $releasever - $basearch&lt;br /&gt;baseurl=http://mirror.centos.org/centos/5/extras/x86_64/&lt;br /&gt;enabled=1&lt;br /&gt;&lt;br /&gt;[epel]&lt;br /&gt;name=Extra Packages for Enterprise Linux 5 - $basearch&lt;br /&gt;baseurl=http://download.fedora.redhat.com/pub/epel/5/x86_64&lt;br /&gt;mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&amp;arch=x86_64&lt;br /&gt;failovermethod=priority&lt;br /&gt;enabled=1&lt;br /&gt;&lt;br /&gt;EOL&lt;br /&gt;   echo "Running Yum"&lt;br /&gt;   yum -c /mnt/image/yum.conf --installroot=/mnt/ec2-fs -y groupinstall Base&lt;br /&gt;   echo "Finished Step 2"&lt;br /&gt;   ;;&lt;br /&gt;  "3")&lt;br /&gt;   echo "Starting Secondary Install"&lt;br /&gt;   yum -c /mnt/image/yum.conf --installroot=/mnt/ec2-fs -y install wget mlocate nano logrotate ruby* postfix openssl openssh openssh-askpass openssh-clients openssh-server curl gcc* zip unzip bison flex compat-libstdc++-296 cvs subversion autoconf automake libtool compat-gcc-34-g77 mutt sysstat rpm-build fping rrdtool rrdtool-devel rrdtool-doc rrdtool-perl rrdtool-python rrdtool-tcl vim-common vim-enhanced&lt;br /&gt;   yum -c /mnt/image/yum.conf --installroot=/mnt/ec2-fs -y clean packages&lt;br /&gt;   cat &lt; &lt;EOL &gt; /mnt/ec2-fs/etc/sysconfig/network&lt;br /&gt;NETWORKING=yes&lt;br /&gt;HOSTNAME=localhost.localdomain&lt;br /&gt;EOL&lt;br /&gt;&lt;br /&gt;   cat &lt; &lt;EOL &gt; /mnt/ec2-fs/etc/sysconfig/network-scripts/ifcfg-eth0&lt;br /&gt;ONBOOT=yes&lt;br /&gt;DEVICE=eth0&lt;br /&gt;BOOTPROTO=dhcp&lt;br /&gt;EOL&lt;br /&gt;&lt;br /&gt;   cat &lt; &lt;EOL &gt;&gt; /mnt/ec2-fs/etc/rc.local&lt;br /&gt;touch /var/lock/subsys/local&lt;br /&gt;# Update the EC2 AMI creation tools&lt;br /&gt;echo " + Updating ec2-ami-tools"&lt;br /&gt;curl -o /tmp/ec2-ami-tools.noarch.rpm http://s3.amazonaws.com/ec2-downloads/ec2-ami-tools.noarch.rpm &amp;&amp; \&lt;br /&gt;rpm -Uvh /tmp/ec2-ami-tools.noarch.rpm &amp;&amp; \&lt;br /&gt;echo " + Updated ec2-ami-tools"&lt;br /&gt;if [ ! -d /root/.ssh ] ; then&lt;br /&gt;          mkdir -p /root/.ssh&lt;br /&gt;          chmod 700 /root/.ssh&lt;br /&gt;fi&lt;br /&gt;# Fetch public key using HTTP&lt;br /&gt;curl -f http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key &gt; /tmp/my-key&lt;br /&gt;if [ $? -eq 0 ] ; then&lt;br /&gt;  cat /tmp/my-key &gt;&gt; /root/.ssh/authorized_keys&lt;br /&gt;  chmod 600 /root/.ssh/authorized_keys&lt;br /&gt;  rm /tmp/my-key&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;EOL&lt;br /&gt;   cat &lt; &lt;EOL &gt;&gt; /mnt/ec2-fs/etc/ssh/sshd_config&lt;br /&gt;UseDNS  no&lt;br /&gt;PermitRootLogin without-password&lt;br /&gt;EOL&lt;br /&gt;&lt;br /&gt;   echo "Finished Step 3"&lt;br /&gt;   ;;&lt;br /&gt;  "4")&lt;br /&gt;   echo "Adding RightScale"&lt;br /&gt;   mkdir -p /tmp/updates&lt;br /&gt;   mkdir -p /mnt/ec2-fs/opt/rightscale/&lt;br /&gt;   mkdir -p /mnt/ec2-fs/opt/rightscale/bin&lt;br /&gt;   mkdir -p /mnt/ec2-fs/opt/rightscale/etc&lt;br /&gt;   mkdir -p /mnt/ec2-fs/opt/rightscale/etc/init.d&lt;br /&gt;   mkdir -p /mnt/ec2-fs/opt/rightscale/lib&lt;br /&gt;   mkdir -p /mnt/ec2-fs/var/spool/ec2/&lt;br /&gt;   mkdir -p /mnt/ec2-fs/var/spool/ec2/meta-data   &lt;br /&gt;   curl -o /tmp/updates/ec2-ami-tools.noarch.rpm http://s3.amazonaws.com/ec2-downloads/ec2-ami-tools.noarch.rpm&lt;br /&gt;   rpm -Uvh /tmp/updates/ec2-ami-tools.noarch.rpm --force --nodeps&lt;br /&gt;   #fetch needed packages&lt;br /&gt;   echo "Fetch Needed Packages"&lt;br /&gt;   curl -o /tmp/updates/linux-2.6.16.33-ec2.tgz http://s3.amazonaws.com/ec2-downloads/linux-2.6.16.33-ec2.tgz&lt;br /&gt;   curl -o /tmp/updates/kernel-modules.2.6.16-xenU.tgz http://s3.amazonaws.com/rightscale_software/kernel-modules-2.6.16.33-xenU.tgz &lt;br /&gt;   tar -xvzf /tmp/updates/kernel-modules.2.6.16-xenU.tgz -C /mnt/ec2-fs/lib/modules/&lt;br /&gt;   #chroot Section&lt;br /&gt;   echo "Chroot Time"&lt;br /&gt;   mkdir -p /mnt/ec2-fs/tmp/updates&lt;br /&gt;   touch /mnt/ec2-fs/etc/mtab&lt;br /&gt;   cp -R /tmp/updates/ /mnt/ec2-fs/tmp/&lt;br /&gt;   #get rrd-tool &lt;br /&gt;   #curl -o /mnt/ec2-fs/tmp/updates/rrdtool-1.2.23-5.i386.rpm http://s3.amazonaws.com/rightscale_software/centos/rrdtool-1.2.23-5.i386.rpm&lt;br /&gt;   #curl -o /mnt/ec2-fs/tmp/updates/rrdtool-devel-1.2.23-5.i386.rpm http://s3.amazonaws.com/rightscale_software/centos/rrdtool-devel-1.2.23-5.i386.rpm&lt;br /&gt;   #curl -o /mnt/ec2-fs/tmp/updates/rrdtool-doc-1.2.23-5.i386.rpm http://s3.amazonaws.com/rightscale_software/centos/rrdtool-doc-1.2.23-5.i386.rpm&lt;br /&gt;   #curl -o /mnt/ec2-fs/tmp/updates/rrdtool-perl-1.2.23-5.i386.rpm http://s3.amazonaws.com/rightscale_software/centos/rrdtool-perl-1.2.23-5.i386.rpm&lt;br /&gt;   #curl -o /mnt/ec2-fs/tmp/updates/rrdtool-php-1.2.23-5.i386.rpm http://s3.amazonaws.com/rightscale_software/centos/rrdtool-php-1.2.23-5.i386.rpm&lt;br /&gt;   #curl -o /mnt/ec2-fs/tmp/updates/rrdtool-python-1.2.23-5.i386.rpm http://s3.amazonaws.com/rightscale_software/centos/rrdtool-python-1.2.23-5.i386.rpm&lt;br /&gt;   #curl -o /mnt/ec2-fs/tmp/updates/rrdtool-ruby-1.2.23-5.i386.rpm http://s3.amazonaws.com/rightscale_software/centos/rrdtool-ruby-1.2.23-5.i386.rpm&lt;br /&gt;   #curl -o /mnt/ec2-fs/tmp/updates/rrdtool-tcl-1.2.23-5.i386.rpm http://s3.amazonaws.com/rightscale_software/centos/rrdtool-tcl-1.2.23-5.i386.rpm&lt;br /&gt;   #get EPEL&lt;br /&gt;   curl -o /mnt/ec2-fs/tmp/updates/epel-release-5-2.noarch.rpm http://s3.amazonaws.com/rightscale_scripts/epel-release-5-2.noarch.rpm&lt;br /&gt;&lt;br /&gt;   cat &lt; &lt;'EOL' &gt; /mnt/ec2-fs/tmp/updates/install-script&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;echo "starting install"&lt;br /&gt;echo "127.0.0.1  localhost  localhost.localdomain" &gt; /etc/hosts&lt;br /&gt;authconfig --enableshadow --useshadow --enablemd5 --updateall&lt;br /&gt;mv /lib/tls /lib/tls.disabled&lt;br /&gt;echo "Disabling TTYs"&lt;br /&gt;perl -p -i -e 's/(.*tty2)/#\1/' /etc/inittab&lt;br /&gt;perl -p -i -e 's/(.*tty3)/#\1/' /etc/inittab&lt;br /&gt;perl -p -i -e 's/(.*tty4)/#\1/' /etc/inittab&lt;br /&gt;perl -p -i -e 's/(.*tty5)/#\1/' /etc/inittab&lt;br /&gt;perl -p -i -e 's/(.*tty6)/#\1/' /etc/inittab&lt;br /&gt;perl -p -i -e 's/PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config &lt;br /&gt;perl -p -i -e 's/#ClientAliveInterval 0/ClientAliveInterval 60/' /etc/ssh/sshd_config&lt;br /&gt;perl -p -i -e 's/#ClientAliveCountMax 3/ClientAliveCountMax 240/' /etc/ssh/sshd_config&lt;br /&gt;service network start&lt;br /&gt;echo "Fetching RightScale"&lt;br /&gt;cat &lt; &lt;'SSH' &gt;/etc/init.d/getsshkey&lt;br /&gt;#!/bin/bash&lt;br /&gt;# chkconfig: 4 11 11&lt;br /&gt;# description: This script fetches the ssh key early. \&lt;br /&gt;#&lt;br /&gt;&lt;br /&gt;# Source function library.&lt;br /&gt;. /etc/rc.d/init.d/functions&lt;br /&gt;&lt;br /&gt;# Source networking configuration.&lt;br /&gt;[ -r /etc/sysconfig/network ] &amp;&amp; . /etc/sysconfig/network&lt;br /&gt;&lt;br /&gt;# Check that networking is up.&lt;br /&gt;[ "${NETWORKING}" = "no" ] &amp;&amp; exit 1&lt;br /&gt;&lt;br /&gt;start() {&lt;br /&gt;  if [ ! -d /root/.ssh ] ; then&lt;br /&gt;          mkdir -p /root/.ssh&lt;br /&gt;          chmod 700 /root/.ssh&lt;br /&gt;  fi&lt;br /&gt;  # Fetch public key using HTTP&lt;br /&gt;  curl -f http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key &gt; /tmp/my-key&lt;br /&gt;  if [ $? -eq 0 ] ; then&lt;br /&gt;          cat /tmp/my-key &gt;&gt; /root/.ssh/authorized_keys&lt;br /&gt;          chmod 600 /root/.ssh/authorized_keys&lt;br /&gt;          rm /tmp/my-key&lt;br /&gt;  fi&lt;br /&gt;  # or fetch public key using the file in the ephemeral store:&lt;br /&gt;  if [ -e /mnt/openssh_id.pub ] ; then&lt;br /&gt;          cat /mnt/openssh_id.pub &gt;&gt; /root/.ssh/authorized_keys&lt;br /&gt;          chmod 600 /root/.ssh/authorized_keys&lt;br /&gt;  fi&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;stop() {&lt;br /&gt;  echo "Nothing to do here"&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;restart() {&lt;br /&gt;  stop&lt;br /&gt;  start&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;# See how we were called.&lt;br /&gt;case "$1" in&lt;br /&gt;  start)&lt;br /&gt;    start&lt;br /&gt;    ;;&lt;br /&gt;  stop)&lt;br /&gt;    stop&lt;br /&gt;    ;;&lt;br /&gt;  restart)&lt;br /&gt;    restart&lt;br /&gt;    ;;&lt;br /&gt;  *)&lt;br /&gt;    echo $"Usage: $0 {start|stop}"&lt;br /&gt;    exit 1&lt;br /&gt;esac&lt;br /&gt;&lt;br /&gt;exit $?&lt;br /&gt;&lt;br /&gt;SSH&lt;br /&gt;chmod +x /etc/init.d/getsshkey&lt;br /&gt;&lt;br /&gt;rpm -Uvh http://s3.amazonaws.com/rightscale_scripts/syslog-ng-1.6.12-1.x86_64.rpm&lt;br /&gt;curl -o /opt/rightscale_scripts.tgz http://s3.amazonaws.com/rightscale_scripts/rightscale_scripts.tgz&lt;br /&gt;tar -xvzf /opt/rightscale_scripts.tgz -C /opt/ &lt;br /&gt;ln /opt/rightscale/etc/init.d/rightscale /etc/init.d/rightscale&lt;br /&gt;chmod +x /opt/rightscale/etc/init.d/rightscale&lt;br /&gt;chmod +x /etc/init.d/rightscale&lt;br /&gt;echo "Modifying Services"&lt;br /&gt;chkconfig --add rightscale&lt;br /&gt;chkconfig --add postfix&lt;br /&gt;chkconfig --add getsshkey&lt;br /&gt;chkconfig --level 4 getsshkey on&lt;br /&gt;chkconfig --level 4 rightscale on&lt;br /&gt;chkconfig --level 4 postfix on &lt;br /&gt;chkconfig --level 4 psacct on&lt;br /&gt;chkconfig --level 4 syslog-ng on&lt;br /&gt;chkconfig --level 4 smartd off&lt;br /&gt;chkconfig --level 4 anacron off&lt;br /&gt;chkconfig --level 4 avahi-daemon off&lt;br /&gt;chkconfig --level 4 avahi-dnsconfd off&lt;br /&gt;chkconfig --level 4 apmd off&lt;br /&gt;chkconfig --level 4 acpid off&lt;br /&gt;chkconfig --level 4 auditd off&lt;br /&gt;chkconfig --level 4 irqbalance off&lt;br /&gt;chkconfig --level 4 mdmpd off&lt;br /&gt;chkconfig --level 4 portmap off&lt;br /&gt;chkconfig --level 4 nfslock off&lt;br /&gt;chkconfig --level 4 syslog off&lt;br /&gt;chkconfig --level 4 sendmail off&lt;br /&gt;chkconfig --level 4 cpuspeed off&lt;br /&gt;chkconfig --level 4 cups off&lt;br /&gt;chkconfig --level 4 autofs off&lt;br /&gt;chkconfig --level 4 bluetooth off&lt;br /&gt;chkconfig --level 4 rpcidmapd off&lt;br /&gt;chkconfig --level 4 rpcsvcgssd off&lt;br /&gt;chkconfig --level 4 rpcgssd off&lt;br /&gt;chkconfig --level 4 pcscd off&lt;br /&gt;chkconfig --level 4 gpm off&lt;br /&gt;chkconfig --level 4 hidd off&lt;br /&gt;chkconfig --level 4 xfs off&lt;br /&gt;chkconfig --level 4 yum-updatesd off&lt;br /&gt;chkconfig --del avahi-daemon&lt;br /&gt;chkconfig --del acpid&lt;br /&gt;chkconfig --del auditd&lt;br /&gt;chkconfig --del irqbalance&lt;br /&gt;chkconfig --del mdmpd&lt;br /&gt;chkconfig --del avahi-dnsconfd&lt;br /&gt;chkconfig --del NetworkManager&lt;br /&gt;chkconfig --del NetworkManagerDispatcher&lt;br /&gt;chkconfig --del dhcdbd&lt;br /&gt;chkconfig --del dund&lt;br /&gt;chkconfig --del firstboot&lt;br /&gt;chkconfig --del irda&lt;br /&gt;chkconfig --del apmd&lt;br /&gt;chkconfig --del smartd&lt;br /&gt;chkconfig --del kudzu&lt;br /&gt;chkconfig --del hidd&lt;br /&gt;chkconfig --del gpm&lt;br /&gt;chkconfig --del pcscd&lt;br /&gt;chkconfig --del bluetooth&lt;br /&gt;chkconfig --del cpuspeed&lt;br /&gt;chkconfig --del cups&lt;br /&gt;chkconfig --del rdisc&lt;br /&gt;chkconfig --del sendmail&lt;br /&gt;chkconfig --del readahead_later&lt;br /&gt;chkconfig --del syslog&lt;br /&gt;chkconfig --del wpa_supplicant&lt;br /&gt;chkconfig --del pand&lt;br /&gt;chkconfig --del netplugd&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;echo "Fetching Java"&lt;br /&gt;curl -o /tmp/updates/jdk-6u2-linux-amd64.rpm http://s3.amazonaws.com/rightscale_software/jdk-6u2-linux-amd64.rpm&lt;br /&gt;curl -o /tmp/updates/sun-javadb-client-10.2.2-0.1.i386.rpm http://s3.amazonaws.com/rightscale_software/sun-javadb-client-10.2.2-0.1.i386.rpm&lt;br /&gt;curl -o /tmp/updates/sun-javadb-common-10.2.2-0.1.i386.rpm http://s3.amazonaws.com/rightscale_software/sun-javadb-common-10.2.2-0.1.i386.rpm&lt;br /&gt;curl -o /tmp/updates/sun-javadb-core-10.2.2-0.1.i386.rpm http://s3.amazonaws.com/rightscale_software/sun-javadb-core-10.2.2-0.1.i386.rpm&lt;br /&gt;curl -o /tmp/updates/sun-javadb-demo-10.2.2-0.1.i386.rpm http://s3.amazonaws.com/rightscale_software/sun-javadb-demo-10.2.2-0.1.i386.rpm&lt;br /&gt;curl -o /tmp/updates/sun-javadb-docs-10.2.2-0.1.i386.rpm http://s3.amazonaws.com/rightscale_software/sun-javadb-docs-10.2.2-0.1.i386.rpm&lt;br /&gt;curl -o /tmp/updates/sun-javadb-javadoc-10.2.2-0.1.i386.rpm http://s3.amazonaws.com/rightscale_software/sun-javadb-javadoc-10.2.2-0.1.i386.rpm&lt;br /&gt;echo "Installing Software"&lt;br /&gt;cd /tmp/updates&lt;br /&gt;curl -o /tmp/updates/bwm-ng-0.5-1.x86_64.rpm http://s3.amazonaws.com/rightscale_software/bwm-ng-0.5-1.x86_64.rpm&lt;br /&gt;rpm -Uvh /tmp/updates/*.rpm --nodeps --force&lt;br /&gt;tar -xvzf linux-2.6.16.33-ec2.tgz&lt;br /&gt;mv linux-2.6.16.33-xenU/ /usr/src/&lt;br /&gt;ln -sf /usr/src/linux-2.6.16.33-xenU/include/acpi /usr/include/acpi&lt;br /&gt;ln -sf /usr/src/linux-2.6.16.33-xenU/include/asm /usr/include/asm&lt;br /&gt;ln -sf /usr/src/linux-2.6.16.33-xenU/include/asm /usr/include/asm-generic&lt;br /&gt;ln -sf /usr/src/linux-2.6.16.33-xenU/include/config /usr/include/config&lt;br /&gt;ln -sf /usr/src/linux-2.6.16.33-xenU/include/keys /usr/include/keys&lt;br /&gt;ln -sf /usr/src/linux-2.6.16.33-xenU/include/linux /usr/include/linux&lt;br /&gt;ln -sf /usr/src/linux-2.6.16.33-xenU/include/math-emu /usr/include/math-emu&lt;br /&gt;ln -sf /usr/src/linux-2.6.16.33-xenU/include/media /usr/include/media&lt;br /&gt;ln -sf /usr/src/linux-2.6.16.33-xenU/include/mtd /usr/include/mtd&lt;br /&gt;ln -sf /usr/src/linux-2.6.16.33-xenU/include/pcmcia /usr/include/pcmcia&lt;br /&gt;ln -sf /usr/src/linux-2.6.16.33-xenU/include/rdma /usr/include/rdma&lt;br /&gt;ln -sf /usr/src/linux-2.6.16.33-xenU/include/rxrpc /usr/include/rxrpc&lt;br /&gt;ln -sf /usr/src/linux-2.6.16.33-xenU/include/sound /usr/include/sound&lt;br /&gt;ln -sf /usr/src/linux-2.6.16.33-xenU/include/video /usr/include/video&lt;br /&gt;ln -sf /usr/src/linux-2.6.16.33-xenU/include/xen /usr/include/xen&lt;br /&gt;&lt;br /&gt;echo "Configuring Java Home" &lt;br /&gt;echo "export JAVA_HOME=/usr/java/default" &gt;&gt; /etc/profile.d/java.sh&lt;br /&gt;chmod +x /etc/profile.d/java.sh&lt;br /&gt;echo "Add EC2 Tools"&lt;br /&gt;mkdir /home/ec2&lt;br /&gt;mkdir /home/ec2/etc&lt;br /&gt;curl -o /tmp/ec2-api-tools.zip http://s3.amazonaws.com/rightscale_software/ec2-api-tools.zip&lt;br /&gt;unzip /tmp/ec2-api-tools.zip -d /tmp/&lt;br /&gt;mv /tmp/ec2-api-tools-1.2-13740/* /home/ec2/&lt;br /&gt;ln -sf /usr/lib/site_ruby/aes/ /usr/lib/ruby/site_ruby/1.8/aes&lt;br /&gt;rm -fr /tmp/ec2*&lt;br /&gt;&lt;br /&gt;chmod -R o-w /home/ec2&lt;br /&gt;&lt;br /&gt;echo "More EC2 Mods"&lt;br /&gt;cat &lt; &lt;'PROMPT'&gt; /etc/profile.d/prompt.sh&lt;br /&gt;PS1="[\u@\h:\w] " &lt;br /&gt;PROMPT&lt;br /&gt;chmod +x /etc/profile.d/prompt.sh&lt;br /&gt;cat &lt; &lt;'EC2'&gt; /etc/profile.d/ec2.sh&lt;br /&gt;export EC2_HOME=/home/ec2 &lt;br /&gt;export EC2_CERT=&lt;br /&gt;export EC2_PRIVATE_KEY=&lt;br /&gt;export AWS_ACCOUNT_NUMBER=&lt;br /&gt;export AWS_ACCESS_KEY_ID=&lt;br /&gt;export AWS_SECRET_ACCESS_KEY=&lt;br /&gt;export PATH=$PATH:/home/ec2/bin/&lt;br /&gt;EC2&lt;br /&gt;&lt;br /&gt;chmod +x /etc/profile.d/ec2.sh&lt;br /&gt;ln -f /opt/rightscale/etc/motd /etc/motd&lt;br /&gt;echo "RubyGems"&lt;br /&gt;wget http://rubyforge.org/frs/download.php/20989/rubygems-0.9.4.tgz&lt;br /&gt;tar -xvzf rubygems-0.9.4.tgz&lt;br /&gt;cd rubygems-0.9.4&lt;br /&gt;ruby setup.rb&lt;br /&gt;gem update&lt;br /&gt;gem source -a http://mirror.rightscale.com&lt;br /&gt;&lt;br /&gt;#cat &lt; &lt;'GEM'&gt; /root/.gemrc&lt;br /&gt;#gem: --source http://mirror.rightscale.com&lt;br /&gt;#GEM&lt;br /&gt;&lt;br /&gt;mkdir -p /tmp/updates&lt;br /&gt;curl -o /tmp/updates/s3sync.gem http://s3.amazonaws.com/rightscale_software/s3sync-1.1.4.gem&lt;br /&gt;gem install /tmp/updates/s3sync.gem&lt;br /&gt;gem install xml-simple net-ssh net-sftp -y&lt;br /&gt;updatedb&lt;br /&gt;cat &lt; &lt;AMI&gt; /etc/cron.daily/do_amitools_update.sh&lt;br /&gt;#!/bin/bash&lt;br /&gt;#&lt;br /&gt;# do_amitools_update.sh: updates ami-tools to the latest version.. &lt;br /&gt;#&lt;br /&gt;## Include Files:&lt;br /&gt;. /var/spool/ec2/meta-data.sh&lt;br /&gt;. /var/spool/ec2/user-data.sh&lt;br /&gt;&lt;br /&gt;# Update the EC2 AMI creation tools&lt;br /&gt;echo " + Updating ec2-ami-tools"&lt;br /&gt;curl -o /tmp/ec2-ami-tools.noarch.rpm http://s3.amazonaws.com/ec2-downloads/ec2-ami-tools.noarch.rpm &amp;&amp; \&lt;br /&gt;rpm -Uvh /tmp/ec2-ami-tools.noarch.rpm &amp;&amp; \&lt;br /&gt;echo " + Updated ec2-ami-tools"&lt;br /&gt;&lt;br /&gt;## Cleanup FileSystem&lt;br /&gt;rm -f /tmp/ec2-ami-tools.noarch.rpm&lt;br /&gt;rm -f /tmp/ec2-ami-tools.noarch.rpm.*&lt;br /&gt;&lt;br /&gt;AMI&lt;br /&gt;&lt;br /&gt;chmod +x /etc/cron.daily/do_amitools_update.sh&lt;br /&gt;&lt;br /&gt;cat &lt; &lt;'YUM'&gt; /etc/yum.repos.d/CentOS-Base.repo&lt;br /&gt;&lt;br /&gt;# CentOS-Base.repo&lt;br /&gt;#&lt;br /&gt;# This file uses a new mirrorlist system developed by Lance Davis for CentOS.&lt;br /&gt;# The mirror system uses the connecting IP address of the client and the&lt;br /&gt;# update status of each mirror to pick mirrors that are updated to and&lt;br /&gt;# geographically close to the client.  You should use this for CentOS updates&lt;br /&gt;# unless you are manually picking other mirrors.&lt;br /&gt;#&lt;br /&gt;# If the mirrorlist= does not work for you, as a fall back you can try the &lt;br /&gt;# remarked out baseurl= line instead.&lt;br /&gt;#&lt;br /&gt;#&lt;br /&gt;&lt;br /&gt;[base]&lt;br /&gt;name=CentOS-$releasever - Base&lt;br /&gt;baseurl=http://mirror.rightscale.com/centos/$releasever/os/$basearch/&lt;br /&gt;         http://mirrors.kernel.org/centos/$releasever/os/$basearch/&lt;br /&gt;mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=os&lt;br /&gt;failovermethod=priority&lt;br /&gt;gpgcheck=1&lt;br /&gt;enabled=1&lt;br /&gt;gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5&lt;br /&gt;&lt;br /&gt;[updates]&lt;br /&gt;name=CentOS-$releasever - Updates&lt;br /&gt;baseurl=http://mirror.rightscale.com/centos/$releasever/updates/$basearch/&lt;br /&gt;        http://mirrors.kernel.org/centos/$releasever/updates/$basearch/&lt;br /&gt;mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=updates&lt;br /&gt;failovermethod=priority&lt;br /&gt;enabled=1&lt;br /&gt;gpgcheck=1&lt;br /&gt;gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5&lt;br /&gt;&lt;br /&gt;#packages used/produced in the build but not released&lt;br /&gt;[addons]&lt;br /&gt;name=CentOS-$releasever - Addons&lt;br /&gt;mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=addons&lt;br /&gt;#baseurl=http://mirror.centos.org/centos/$releasever/addons/$basearch/&lt;br /&gt;gpgcheck=1&lt;br /&gt;gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5&lt;br /&gt;&lt;br /&gt;#additional packages that may be useful&lt;br /&gt;[extras]&lt;br /&gt;name=CentOS-$releasever - Extras&lt;br /&gt;mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=extras&lt;br /&gt;#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/&lt;br /&gt;gpgcheck=1&lt;br /&gt;gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5&lt;br /&gt;&lt;br /&gt;#additional packages that extend functionality of existing packages&lt;br /&gt;[centosplus]&lt;br /&gt;name=CentOS-$releasever - Plus&lt;br /&gt;mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=centosplus&lt;br /&gt;#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/&lt;br /&gt;gpgcheck=1&lt;br /&gt;enabled=0&lt;br /&gt;gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5&lt;br /&gt;&lt;br /&gt;#contrib - packages by Centos Users&lt;br /&gt;[contrib]&lt;br /&gt;name=CentOS-$releasever - Contrib&lt;br /&gt;mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=contrib&lt;br /&gt;#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/&lt;br /&gt;gpgcheck=1&lt;br /&gt;enabled=0&lt;br /&gt;gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5&lt;br /&gt;&lt;br /&gt;YUM&lt;br /&gt;&lt;br /&gt;cat &lt; &lt;'EOF'&gt; /root/.bashrc&lt;br /&gt;# .bashrc&lt;br /&gt;&lt;br /&gt;# User specific aliases and functions&lt;br /&gt;&lt;br /&gt;alias rm='rm -i'&lt;br /&gt;alias cp='cp -i'&lt;br /&gt;alias mv='mv -i'&lt;br /&gt;&lt;br /&gt;# Source global definitions&lt;br /&gt;if [ -f /etc/bashrc ]; then&lt;br /&gt;        . /etc/bashrc&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;EOF&lt;br /&gt;&lt;br /&gt;cat &lt; &lt;'EOF'&gt; /root/.bash_profile&lt;br /&gt;# .bash_profile&lt;br /&gt;&lt;br /&gt;# Get the aliases and functions&lt;br /&gt;if [ -f ~/.bashrc ]; then&lt;br /&gt;        . ~/.bashrc&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;# User specific environment and startup programs&lt;br /&gt;&lt;br /&gt;PATH=$PATH:$HOME/bin&lt;br /&gt;&lt;br /&gt;export PATH&lt;br /&gt;unset USERNAME&lt;br /&gt;&lt;br /&gt;EOF&lt;br /&gt;&lt;br /&gt;cat &lt; &lt;'EOF'&gt; /root/.bash_logout&lt;br /&gt;# ~/.bash_logout&lt;br /&gt;&lt;br /&gt;clear&lt;br /&gt;&lt;br /&gt;EOF&lt;br /&gt;&lt;br /&gt;touch /root/.bash_logout&lt;br /&gt;&lt;br /&gt;exit &lt;br /&gt;&lt;br /&gt;EOL&lt;br /&gt;   &lt;br /&gt;   chmod +x /mnt/ec2-fs/tmp/updates/install-script&lt;br /&gt;   chroot /mnt/ec2-fs/ /tmp/updates/install-script&lt;br /&gt;   echo "all Done"&lt;br /&gt;   echo "Cleaning up Image"&lt;br /&gt;   rm -fr /mnt/ec2-fs/tmp/updates  &lt;br /&gt;   echo "Finished Step 4"&lt;br /&gt;   ;;&lt;br /&gt;  "5")&lt;br /&gt;   echo "Prepping for upload"&lt;br /&gt;   sync&lt;br /&gt;   #umount -dlf /mnt/ec2-fs/proc&lt;br /&gt;   #umount -dlf /mnt/ec2-fs&lt;br /&gt;   echo "Bundling Image"&lt;br /&gt;   #ec2-bundle-image -i /mnt/image/$IMAGE_NAME -k $EC2_PRIVATE_KEY -c $EC2_CERT -u $AWS_ACCOUNT_NUMBER&lt;br /&gt;   mkdir -p /mnt/tmp&lt;br /&gt;   ec2-bundle-vol -v /mnt/ec2-fs -d /mnt/tmp -p $IMAGE_NAME -k $EC2_PRIVATE_KEY -c $EC2_CERT -u $AWS_ACCOUNT_NUMBER&lt;br /&gt;   echo "Finished Step 5"&lt;br /&gt;   ;;&lt;br /&gt;  "6")&lt;br /&gt;   echo "Uploading"&lt;br /&gt;   ec2-upload-bundle -b $AWS_BUCKET -m /mnt/tmp/$IMAGE_NAME.manifest.xml -a $AWS_ACCESS_KEY_ID -s $AWS_SECRET_ACCESS_KEY&lt;br /&gt;   echo "Finished Step 6"&lt;br /&gt;   ;;&lt;br /&gt;  "7")&lt;br /&gt;   echo "Cleanup"&lt;br /&gt;   umount /mnt/ec2-fs/proc&lt;br /&gt;   umount /mnt/ec2-fs&lt;br /&gt;   rm -fr /mnt/image/&lt;br /&gt;   rm -fr /mnt/ec2-fs&lt;br /&gt;   echo "File System Cleaned"&lt;br /&gt;   echo "Finished Step 7"&lt;br /&gt;   ;;&lt;br /&gt;  "8")&lt;br /&gt;   exit&lt;br /&gt;   ;;&lt;br /&gt; esac &lt;br /&gt;done&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-388167135779168363?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/388167135779168363/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=388167135779168363&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/388167135779168363'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/388167135779168363'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2009/04/script-to-install-centos-5-on-amazon.html' title='Script to Install CentOS 5 on Amazon'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-3441104264934821985</id><published>2008-05-22T13:28:00.003+05:30</published><updated>2008-05-22T18:17:18.940+05:30</updated><title type='text'>PERL ONE LINERS</title><content type='html'>Level: Introductory&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;This article, as regular readers may have guessed, is the sequel to "One-liners 101," which appeared in a previous installment of "Cultured Perl". The earlier article is an absolute requirement for understanding the material here, so please take a look at it before you continue.&lt;br /&gt;&lt;br /&gt;The goal of this article, as with its predecessor, is to show legible and reusable code, not necessarily the shortest or most efficient version of a program. With that in mind, let's get to the code!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Awk is commonly used for basic tasks such as breaking up text into fields; Perl excels at text manipulation by design. Thus, we come to our first one-liner, intended to add two columns in the text input to the script.&lt;br /&gt;&lt;br /&gt;Listing 1. Like awk?&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;# add first and penultimate columns&lt;br /&gt;# NOTE the equivalent awk script: &lt;br /&gt;# awk '{i = NF - 1; print $1 + $i}'&lt;br /&gt;perl -lane 'print $F[0] + $F[-2]'&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So what does it do? The magic is in the switches. The -n and -a switches make the script a wrapper around input that splits the input on whitespace into the @F array; the -e switch adds an extra statement into the wrapper. The code of interest actually produced is:&lt;br /&gt;&lt;br /&gt;Listing 2: The full Monty&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;while (&lt;&gt;) &lt;br /&gt;{&lt;br /&gt;  @F = split(' ');&lt;br /&gt;  print $F[0] + $F[-2]; # offset -2 means "2nd to last element of the array"&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Another common task is to print the contents of a file between two markers or between two line numbers.&lt;br /&gt;&lt;br /&gt;Listing 3: Printing a range of lines&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;# 1. just lines 15 to 17&lt;br /&gt;perl -ne 'print if 15 .. 17'&lt;br /&gt;&lt;br /&gt;# 2. just lines NOT between line 10 and 20&lt;br /&gt;perl -ne 'print unless 10 .. 20'&lt;br /&gt;&lt;br /&gt;# 3. lines between START and END&lt;br /&gt;perl -ne 'print if /^START$/ .. /^END$/'&lt;br /&gt;&lt;br /&gt;# 4. lines NOT between START and END&lt;br /&gt;perl -ne 'print unless /^START$/ .. /^END$/'&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;A problem with the first one-liner in Listing 3 is that it will go through the whole file, even if the necessary range has already been covered. The third one-liner does not have that problem, because it will print all the lines between the START and END markers. If there are eight sets of START/END markers, the third one-liner will print the lines inside all eight sets.&lt;br /&gt;&lt;br /&gt;Preventing the inefficiency of the first one-liner is easy: just use the $. variable, which tells you the current line. Start printing if $. is over 15 and exit if $. is greater than 17.&lt;br /&gt;&lt;br /&gt;Listing 4: Printing a numeric range of lines more efficiently&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;# just lines 15 to 17, efficiently&lt;br /&gt;perl -ne 'print if $. &gt;= 15; exit if $. &gt;= 17;'&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Enough printing, let's do some editing. Needless to say, if you are experimenting with one-liners, especially ones intended to modify data, you should keep backups. You wouldn't be the first programmer to think a minor modification couldn't possibly make a difference to a one-liner program; just don't make that assumption while editing the Sendmail configuration or your mailbox.&lt;br /&gt;&lt;br /&gt;Listing 5: In-place editing&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;# 1. in-place edit of *.c files changing all foo to bar&lt;br /&gt;perl -p -i.bak -e 's/\bfoo\b/bar/g' *.c&lt;br /&gt;&lt;br /&gt;# 2. delete first 10 lines&lt;br /&gt;perl -i.old -ne 'print unless 1 .. 10' foo.txt&lt;br /&gt;&lt;br /&gt;# 3. change all the isolated oldvar occurrences to newvar&lt;br /&gt;perl -i.old -pe 's{\boldvar\b}{newvar}g' *.[chy]&lt;br /&gt;&lt;br /&gt;# 4. increment all numbers found in these files&lt;br /&gt;perl -i.tiny -pe 's/(\d+)/ 1 + $1 /ge' file1 file2 ....&lt;br /&gt;&lt;br /&gt;# 5. delete all but lines between START and END&lt;br /&gt;perl -i.old -ne 'print unless /^START$/ .. /^END$/' foo.txt&lt;br /&gt;&lt;br /&gt;# 6. binary edit (careful!)&lt;br /&gt;perl -i.bak -pe 's/Mozilla/Slopoke/g' /usr/local/bin/netscape&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Why does 1 .. 10 specify line numbers 1 through 10? Read the "perldoc perlop" manual page. Basically, the .. operator iterates through a range. Thus, the script does not count 10 lines, it counts 10 iterations of the loop generated by the -n switch (see "perldoc perlrun" and Listing 2 for an example of that loop).&lt;br /&gt;&lt;br /&gt;The magic of the -i switch is that it replaces each file in @ARGV with the version produced by the script's output on that file. Thus, the -i switch makes Perl into an editing text filter. Do not forget to use the backup option to the -i switch. Following the i with an extension will make a backup of the edited file using that extension.&lt;br /&gt;&lt;br /&gt;Note how the -p and -n switch are used. The -n switch is used when you want explicitly to print out data. The -p switch implicitly inserts a print $_ statement in the loop produced by the -n switch. Thus, the -p switch is better for full processing of a file, while the -n switch is better for selective file processing, where only specific data needs to be printed.&lt;br /&gt;&lt;br /&gt;Examples of in-place editing can also be found in the "One-liners 101" article.&lt;br /&gt;&lt;br /&gt;Reversing the contents of a file is not a common task, but the following one-liners show than the -n and -p switches are not always the best choice when processing an entire file.&lt;br /&gt;&lt;br /&gt;Listing 6: Reversal of files' fortunes&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;# 1. command-line that reverses the whole input by lines&lt;br /&gt;#    (printing each line in reverse order)&lt;br /&gt;perl -e 'print reverse &lt;&gt;' file1 file2 file3 ....&lt;br /&gt;&lt;br /&gt;# 2. command-line that shows each line with its characters backwards&lt;br /&gt;perl -nle 'print scalar reverse $_' file1 file2 file3 ....&lt;br /&gt;&lt;br /&gt;# 3. find palindromes in the /usr/dict/words dictionary file&lt;br /&gt;perl -lne '$_ = lc $_; print if $_ eq reverse' /usr/dict/words&lt;br /&gt;&lt;br /&gt;# 4. command-line that reverses all the bytes in a file&lt;br /&gt;perl -0777e 'print scalar reverse &lt;&gt;' f1 f2 f3 ...&lt;br /&gt;&lt;br /&gt;# 5. command-line that reverses each paragraph in the file but prints&lt;br /&gt;#    them in order&lt;br /&gt;perl -00 -e 'print reverse &lt;&gt;' file1 file2 file3 ....&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The -0 (zero) flag is very useful if you want to read a full paragraph or a full file into a single string. (It also works with any character number, so you can use a special character as a marker.) Be careful when reading a full file in one command (-0777), because a large file will use up all your memory. If you need to read the contents of a file backwards (for instance, to analyze a log in reverse order), use the CPAN module File::ReadBackwards. Also see "One-liners 101," which shows an example of log analysis with File::ReadBackwards.&lt;br /&gt;&lt;br /&gt;Note the similarity between the first and second scripts in Listing 6. The first one, however, is completely different from the second one. The difference lies in using &lt;&gt; in scalar context (as -n does in the second script) or list context (as the first script does).&lt;br /&gt;&lt;br /&gt;The third script, the palindrome detector, did not originally have the $_ = lc $_; segment. I added that to catch those palindromes like "Bob" that are not the same backwards.&lt;br /&gt;&lt;br /&gt;My addition can be written as $_ = lc; as well, but explicitly stating the subject of the lc() function makes the one-liner more legible, in my opinion.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Listing 7: Rewrite with a random number&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;# replace string XYZ with a random number less than 611 in these files&lt;br /&gt;perl -i.bak -pe "s/XYZ/int rand(611)/e" f1 f2 f3&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This is a filter that replaces XYZ with a random number less than 611 (that number is arbitrarily chosen). Remember the rand() function returns a random number between 0 and its argument.&lt;br /&gt;&lt;br /&gt;Note that XYZ will be replaced by a different random number every time, because the substitution evaluates "int rand(611)" every time.&lt;br /&gt;&lt;br /&gt;Listing 8: Revealing the files' base nature&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;# 1. Run basename on contents of file&lt;br /&gt;perl -pe "s@.*/@@gio" INDEX&lt;br /&gt;&lt;br /&gt;# 2. Run dirname on contents of file&lt;br /&gt;perl -pe 's@^(.*/)[^/]+@$1\n@' INDEX&lt;br /&gt;&lt;br /&gt;# 3. Run basename on contents of file&lt;br /&gt;perl -MFile::Basename -ne 'print basename $_' INDEX&lt;br /&gt;&lt;br /&gt;# 4. Run dirname on contents of file&lt;br /&gt;perl -MFile::Basename -ne 'print dirname $_' INDEX&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;One-liners 1 and 2 came from Paul, while 3 and 4 were my rewrites of them with the File::Basename module. Their purpose is simple, but any system administrator will find these one-liners useful.&lt;br /&gt;&lt;br /&gt;Listing 9: Moving or renaming, it's all the same in UNIX&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;# 1. write command to mv dirs XYZ_asd to Asd&lt;br /&gt;# (you may have to preface each '!' with a '\' depending on your shell)&lt;br /&gt;ls | perl -pe 's!([^_]+)_(.)(.*)!mv $1_$2$3 \u$2\E$3!gio'&lt;br /&gt;&lt;br /&gt;# 2. Write a shell script to move input from xyz to Xyz&lt;br /&gt;ls | perl -ne 'chop; printf "mv $_ %s\n", ucfirst $_;'&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For regular users or system administrators, renaming files based on a pattern is a very common task. The scripts above will do two kinds of job: either remove the file name portion up to the _ character, or change each filename so that its first letter is uppercased according to the Perl ucfirst() function.&lt;br /&gt;&lt;br /&gt;There is a UNIX utility called "mmv" by Vladimir Lanin that may also be of interest. It allows you to rename files based on simple patterns, and it's surprisingly powerful. See the Resources section for a link to this utility.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Some of mine&lt;br /&gt;&lt;br /&gt;The following is not a one-liner, but it's a pretty useful script that started as a one-liner. It is similar to Listing 7 in that it replaces a fixed string, but the trick is that the replacement itself for the fixed string becomes the fixed string the next time.&lt;br /&gt;&lt;br /&gt;The idea came from a newsgroup posting a long time ago, but I haven't been able to find original version. The script is useful in case you need to replace one IP address with another in all your system files -- for instance, if your default router has changed. The script includes $0 (in UNIX, usually the name of the script) in the list of files to rewrite.&lt;br /&gt;&lt;br /&gt;As a one-liner it ultimately proved too complex, and the messages regarding what is about to be executed are necessary when system files are going to be modified.&lt;br /&gt;&lt;br /&gt;Listing 10: Replace one IP address with another one&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;#!/usr/bin/perl -w&lt;br /&gt;&lt;br /&gt;use Regexp::Common qw/net/; # provides the regular expressions for IP matching&lt;br /&gt;&lt;br /&gt;my $replacement = shift @ARGV; # get the new IP address&lt;br /&gt;&lt;br /&gt;die "You must provide $0 with a replacement string for the IP 111.111.111.111"&lt;br /&gt; unless $replacement;&lt;br /&gt;&lt;br /&gt;# we require that $replacement be JUST a valid IP address&lt;br /&gt;die "Invalid IP address provided: [$replacement]"&lt;br /&gt; unless $replacement =~ m/^$RE{net}{IPv4}$/;&lt;br /&gt;&lt;br /&gt;# replace the string in each file&lt;br /&gt;foreach my $file ($0, qw[/etc/hosts /etc/defaultrouter /etc/ethers], @ARGV)&lt;br /&gt;{&lt;br /&gt; # note that we know $replacement is a valid IP address, so this is&lt;br /&gt; # not a dangerous invocation&lt;br /&gt; my $command = "perl -p -i.bak -e 's/111.111.111.111/$replacement/g' $file";&lt;br /&gt;&lt;br /&gt; print "Executing [$command]\n"; &lt;br /&gt; system($command);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Note the use of the Regexp::Common module, an indispensable resource for any Perl programmer today. Without Regexp::Common, you will be wasting a lot of time trying to match a number or other common patterns manually, and you're likely to get it wrong.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-3441104264934821985?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/3441104264934821985/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=3441104264934821985&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/3441104264934821985'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/3441104264934821985'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2008/05/handy-one-liners-perl.html' title='PERL ONE LINERS'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-2209014088966943367</id><published>2008-05-22T12:40:00.000+05:30</published><updated>2008-05-22T13:28:47.143+05:30</updated><title type='text'>Handy One Liners for SED COmmand</title><content type='html'>Handy one-liners for SED&lt;br /&gt;&lt;br /&gt;HANDY ONE-LINERS FOR SED (Unix stream editor)&lt;br /&gt;&lt;br /&gt;Latest version of this file is usually at:&lt;br /&gt;   http://www.student.northpark.edu/pemente/sed/sed1line.txt&lt;br /&gt;   http://www.cornerstonemag.com/sed/sed1line.txt&lt;br /&gt;&lt;br /&gt;FILE SPACING:&lt;br /&gt;&lt;br /&gt; # double space a file&lt;br /&gt; sed G&lt;br /&gt;&lt;br /&gt; # double space a file which already has blank lines in it. Output file&lt;br /&gt; # should contain no more than one blank line between lines of text.&lt;br /&gt; sed '/^$/d;G'&lt;br /&gt;&lt;br /&gt; # triple space a file&lt;br /&gt; sed 'G;G'&lt;br /&gt;&lt;br /&gt; # undo double-spacing (assumes even-numbered lines are always blank)&lt;br /&gt; sed 'n;d'&lt;br /&gt;&lt;br /&gt;NUMBERING:&lt;br /&gt;&lt;br /&gt; # number each line of a file (simple left alignment). Using a tab (see&lt;br /&gt; # note on '\t' at end of file) instead of space will preserve margins.&lt;br /&gt; sed = filename | sed 'N;s/\n/\t/'&lt;br /&gt;&lt;br /&gt; # number each line of a file (number on left, right-aligned)&lt;br /&gt; sed = filename | sed 'N; s/^/     /; s/ *\(.\{6,\}\)\n/\1  /'&lt;br /&gt;&lt;br /&gt; # number each line of file, but only print numbers if line is not blank&lt;br /&gt; sed '/./=' filename | sed '/./N; s/\n/ /'&lt;br /&gt;&lt;br /&gt; # count lines (emulates "wc -l")&lt;br /&gt; sed -n '$='&lt;br /&gt;&lt;br /&gt;TEXT CONVERSION AND SUBSTITUTION:&lt;br /&gt;&lt;br /&gt; # IN UNIX ENVIRONMENT: convert DOS newlines (CR/LF) to Unix format&lt;br /&gt; sed 's/.$//'               # assumes that all lines end with CR/LF&lt;br /&gt; sed 's/^M$//'              # in bash/tcsh, press Ctrl-V then Ctrl-M&lt;br /&gt; sed 's/\x0D$//'            # gsed 3.02.80, but top script is easier&lt;br /&gt;&lt;br /&gt; # IN UNIX ENVIRONMENT: convert Unix newlines (LF) to DOS format&lt;br /&gt; sed "s/$/`echo -e \\\r`/"            # command line under ksh&lt;br /&gt; sed 's/$'"/`echo \\\r`/"             # command line under bash&lt;br /&gt; sed "s/$/`echo \\\r`/"               # command line under zsh&lt;br /&gt; sed 's/$/\r/'                        # gsed 3.02.80&lt;br /&gt;&lt;br /&gt; # IN DOS ENVIRONMENT: convert Unix newlines (LF) to DOS format&lt;br /&gt; sed "s/$//"                          # method 1&lt;br /&gt; sed -n p                             # method 2&lt;br /&gt;&lt;br /&gt; # IN DOS ENVIRONMENT: convert DOS newlines (CR/LF) to Unix format&lt;br /&gt; # Cannot be done with DOS versions of sed. Use "tr" instead.&lt;br /&gt; tr -d \r &lt;infile &gt;outfile            # GNU tr version 1.22 or higher&lt;br /&gt;&lt;br /&gt; # delete leading whitespace (spaces, tabs) from front of each line&lt;br /&gt; # aligns all text flush left&lt;br /&gt; sed 's/^[ \t]*//'                    # see note on '\t' at end of file&lt;br /&gt;&lt;br /&gt; # delete trailing whitespace (spaces, tabs) from end of each line&lt;br /&gt; sed 's/[ \t]*$//'                    # see note on '\t' at end of file&lt;br /&gt;&lt;br /&gt; # delete BOTH leading and trailing whitespace from each line&lt;br /&gt; sed 's/^[ \t]*//;s/[ \t]*$//'&lt;br /&gt;&lt;br /&gt; # insert 5 blank spaces at beginning of each line (make page offset)&lt;br /&gt; sed 's/^/     /'&lt;br /&gt;&lt;br /&gt; # align all text flush right on a 79-column width&lt;br /&gt; sed -e :a -e 's/^.\{1,78\}$/ &amp;/;ta'  # set at 78 plus 1 space&lt;br /&gt;&lt;br /&gt; # center all text in the middle of 79-column width. In method 1,&lt;br /&gt; # spaces at the beginning of the line are significant, and trailing&lt;br /&gt; # spaces are appended at the end of the line. In method 2, spaces at&lt;br /&gt; # the beginning of the line are discarded in centering the line, and&lt;br /&gt; # no trailing spaces appear at the end of lines.&lt;br /&gt; sed  -e :a -e 's/^.\{1,77\}$/ &amp; /;ta'                     # method 1&lt;br /&gt; sed  -e :a -e 's/^.\{1,77\}$/ &amp;/;ta' -e 's/\( *\)\1/\1/'  # method 2&lt;br /&gt;&lt;br /&gt; # substitute (find and replace) "foo" with "bar" on each line&lt;br /&gt; sed 's/foo/bar/'             # replaces only 1st instance in a line&lt;br /&gt; sed 's/foo/bar/4'            # replaces only 4th instance in a line&lt;br /&gt; sed 's/foo/bar/g'            # replaces ALL instances in a line&lt;br /&gt; sed 's/\(.*\)foo\(.*foo\)/\1bar\2/' # replace the next-to-last case&lt;br /&gt; sed 's/\(.*\)foo/\1bar/'            # replace only the last case&lt;br /&gt;&lt;br /&gt; # substitute "foo" with "bar" ONLY for lines which contain "baz"&lt;br /&gt; sed '/baz/s/foo/bar/g'&lt;br /&gt;&lt;br /&gt; # substitute "foo" with "bar" EXCEPT for lines which contain "baz"&lt;br /&gt; sed '/baz/!s/foo/bar/g'&lt;br /&gt;&lt;br /&gt; # change "scarlet" or "ruby" or "puce" to "red"&lt;br /&gt; sed 's/scarlet/red/g;s/ruby/red/g;s/puce/red/g'   # most seds&lt;br /&gt; gsed 's/scarlet\|ruby\|puce/red/g'                # GNU sed only&lt;br /&gt;&lt;br /&gt; # reverse order of lines (emulates "tac")&lt;br /&gt; # bug/feature in HHsed v1.5 causes blank lines to be deleted&lt;br /&gt; sed '1!G;h;$!d'               # method 1&lt;br /&gt; sed -n '1!G;h;$p'             # method 2&lt;br /&gt;&lt;br /&gt; # reverse each character on the line (emulates "rev")&lt;br /&gt; sed '/\n/!G;s/\(.\)\(.*\n\)/&amp;\2\1/;//D;s/.//'&lt;br /&gt;&lt;br /&gt; # join pairs of lines side-by-side (like "paste")&lt;br /&gt; sed '$!N;s/\n/ /'&lt;br /&gt;&lt;br /&gt; # if a line ends with a backslash, append the next line to it&lt;br /&gt; sed -e :a -e '/\\$/N; s/\\\n//; ta'&lt;br /&gt;&lt;br /&gt; # if a line begins with an equal sign, append it to the previous line&lt;br /&gt; # and replace the "=" with a single space&lt;br /&gt; sed -e :a -e '$!N;s/\n=/ /;ta' -e 'P;D'&lt;br /&gt;&lt;br /&gt; # add commas to numeric strings, changing "1234567" to "1,234,567"&lt;br /&gt; gsed ':a;s/\B[0-9]\{3\}\&gt;/,&amp;/;ta'                     # GNU sed&lt;br /&gt; sed -e :a -e 's/\(.*[0-9]\)\([0-9]\{3\}\)/\1,\2/;ta'  # other seds&lt;br /&gt;&lt;br /&gt; # add commas to numbers with decimal points and minus signs (GNU sed)&lt;br /&gt; gsed ':a;s/\(^\|[^0-9.]\)\([0-9]\+\)\([0-9]\{3\}\)/\1\2,\3/g;ta'&lt;br /&gt;&lt;br /&gt; # add a blank line every 5 lines (after lines 5, 10, 15, 20, etc.)&lt;br /&gt; gsed '0~5G'                  # GNU sed only&lt;br /&gt; sed 'n;n;n;n;G;'             # other seds&lt;br /&gt;&lt;br /&gt;SELECTIVE PRINTING OF CERTAIN LINES:&lt;br /&gt;&lt;br /&gt; # print first 10 lines of file (emulates behavior of "head")&lt;br /&gt; sed 10q&lt;br /&gt;&lt;br /&gt; # print first line of file (emulates "head -1")&lt;br /&gt; sed q&lt;br /&gt;&lt;br /&gt; # print the last 10 lines of a file (emulates "tail")&lt;br /&gt; sed -e :a -e '$q;N;11,$D;ba'&lt;br /&gt;&lt;br /&gt; # print the last 2 lines of a file (emulates "tail -2")&lt;br /&gt; sed '$!N;$!D'&lt;br /&gt;&lt;br /&gt; # print the last line of a file (emulates "tail -1")&lt;br /&gt; sed '$!d'                    # method 1&lt;br /&gt; sed -n '$p'                  # method 2&lt;br /&gt;&lt;br /&gt; # print only lines which match regular expression (emulates "grep")&lt;br /&gt; sed -n '/regexp/p'           # method 1&lt;br /&gt; sed '/regexp/!d'             # method 2&lt;br /&gt;&lt;br /&gt; # print only lines which do NOT match regexp (emulates "grep -v")&lt;br /&gt; sed -n '/regexp/!p'          # method 1, corresponds to above&lt;br /&gt; sed '/regexp/d'              # method 2, simpler syntax&lt;br /&gt;&lt;br /&gt; # print the line immediately before a regexp, but not the line&lt;br /&gt; # containing the regexp&lt;br /&gt; sed -n '/regexp/{g;1!p;};h'&lt;br /&gt;&lt;br /&gt; # print the line immediately after a regexp, but not the line&lt;br /&gt; # containing the regexp&lt;br /&gt; sed -n '/regexp/{n;p;}'&lt;br /&gt;&lt;br /&gt; # print 1 line of context before and after regexp, with line number&lt;br /&gt; # indicating where the regexp occurred (similar to "grep -A1 -B1")&lt;br /&gt; sed -n -e '/regexp/{=;x;1!p;g;$!N;p;D;}' -e h&lt;br /&gt;&lt;br /&gt; # grep for AAA and BBB and CCC (in any order)&lt;br /&gt; sed '/AAA/!d; /BBB/!d; /CCC/!d'&lt;br /&gt;&lt;br /&gt; # grep for AAA and BBB and CCC (in that order)&lt;br /&gt; sed '/AAA.*BBB.*CCC/!d'&lt;br /&gt;&lt;br /&gt; # grep for AAA or BBB or CCC (emulates "egrep")&lt;br /&gt; sed -e '/AAA/b' -e '/BBB/b' -e '/CCC/b' -e d    # most seds&lt;br /&gt; gsed '/AAA\|BBB\|CCC/!d'                        # GNU sed only&lt;br /&gt;&lt;br /&gt; # print paragraph if it contains AAA (blank lines separate paragraphs)&lt;br /&gt; # HHsed v1.5 must insert a 'G;' after 'x;' in the next 3 scripts below&lt;br /&gt; sed -e '/./{H;$!d;}' -e 'x;/AAA/!d;'&lt;br /&gt;&lt;br /&gt; # print paragraph if it contains AAA and BBB and CCC (in any order)&lt;br /&gt; sed -e '/./{H;$!d;}' -e 'x;/AAA/!d;/BBB/!d;/CCC/!d'&lt;br /&gt;&lt;br /&gt; # print paragraph if it contains AAA or BBB or CCC&lt;br /&gt; sed -e '/./{H;$!d;}' -e 'x;/AAA/b' -e '/BBB/b' -e '/CCC/b' -e d&lt;br /&gt; gsed '/./{H;$!d;};x;/AAA\|BBB\|CCC/b;d'         # GNU sed only&lt;br /&gt;&lt;br /&gt; # print only lines of 65 characters or longer&lt;br /&gt; sed -n '/^.\{65\}/p'&lt;br /&gt;&lt;br /&gt; # print only lines of less than 65 characters&lt;br /&gt; sed -n '/^.\{65\}/!p'        # method 1, corresponds to above&lt;br /&gt; sed '/^.\{65\}/d'            # method 2, simpler syntax&lt;br /&gt;&lt;br /&gt; # print section of file from regular expression to end of file&lt;br /&gt; sed -n '/regexp/,$p'&lt;br /&gt;&lt;br /&gt; # print section of file based on line numbers (lines 8-12, inclusive)&lt;br /&gt; sed -n '8,12p'               # method 1&lt;br /&gt; sed '8,12!d'                 # method 2&lt;br /&gt;&lt;br /&gt; # print line number 52&lt;br /&gt; sed -n '52p'                 # method 1&lt;br /&gt; sed '52!d'                   # method 2&lt;br /&gt; sed '52q;d'                  # method 3, efficient on large files&lt;br /&gt;&lt;br /&gt; # beginning at line 3, print every 7th line&lt;br /&gt; gsed -n '3~7p'               # GNU sed only&lt;br /&gt; sed -n '3,${p;n;n;n;n;n;n;}' # other seds&lt;br /&gt;&lt;br /&gt; # print section of file between two regular expressions (inclusive)&lt;br /&gt; sed -n '/Iowa/,/Montana/p'             # case sensitive&lt;br /&gt;&lt;br /&gt;SELECTIVE DELETION OF CERTAIN LINES:&lt;br /&gt;&lt;br /&gt; # print all of file EXCEPT section between 2 regular expressions&lt;br /&gt; sed '/Iowa/,/Montana/d'&lt;br /&gt;&lt;br /&gt; # delete duplicate, consecutive lines from a file (emulates "uniq").&lt;br /&gt; # First line in a set of duplicate lines is kept, rest are deleted.&lt;br /&gt; sed '$!N; /^\(.*\)\n\1$/!P; D'&lt;br /&gt;&lt;br /&gt; # delete duplicate, nonconsecutive lines from a file. Beware not to&lt;br /&gt; # overflow the buffer size of the hold space, or else use GNU sed.&lt;br /&gt; sed -n 'G; s/\n/&amp;&amp;/; /^\([ -~]*\n\).*\n\1/d; s/\n//; h; P'&lt;br /&gt;&lt;br /&gt; # delete the first 10 lines of a file&lt;br /&gt; sed '1,10d'&lt;br /&gt;&lt;br /&gt; # delete the last line of a file&lt;br /&gt; sed '$d'&lt;br /&gt;&lt;br /&gt; # delete the last 2 lines of a file&lt;br /&gt; sed 'N;$!P;$!D;$d'&lt;br /&gt;&lt;br /&gt; # delete the last 10 lines of a file&lt;br /&gt; sed -e :a -e '$d;N;2,10ba' -e 'P;D'   # method 1&lt;br /&gt; sed -n -e :a -e '1,10!{P;N;D;};N;ba'  # method 2&lt;br /&gt;&lt;br /&gt; # delete every 8th line&lt;br /&gt; gsed '0~8d'                           # GNU sed only&lt;br /&gt; sed 'n;n;n;n;n;n;n;d;'                # other seds&lt;br /&gt;&lt;br /&gt; # delete ALL blank lines from a file (same as "grep '.' ")&lt;br /&gt; sed '/^$/d'                           # method 1&lt;br /&gt; sed '/./!d'                           # method 2&lt;br /&gt;&lt;br /&gt; # delete all CONSECUTIVE blank lines from file except the first; also&lt;br /&gt; # deletes all blank lines from top and end of file (emulates "cat -s")&lt;br /&gt; sed '/./,/^$/!d'          # method 1, allows 0 blanks at top, 1 at EOF&lt;br /&gt; sed '/^$/N;/\n$/D'        # method 2, allows 1 blank at top, 0 at EOF&lt;br /&gt;&lt;br /&gt; # delete all CONSECUTIVE blank lines from file except the first 2:&lt;br /&gt; sed '/^$/N;/\n$/N;//D'&lt;br /&gt;&lt;br /&gt; # delete all leading blank lines at top of file&lt;br /&gt; sed '/./,$!d'&lt;br /&gt;&lt;br /&gt; # delete all trailing blank lines at end of file&lt;br /&gt; sed -e :a -e '/^\n*$/{$d;N;ba' -e '}'  # works on all seds&lt;br /&gt; sed -e :a -e '/^\n*$/N;/\n$/ba'        # ditto, except for gsed 3.02*&lt;br /&gt;&lt;br /&gt; # delete the last line of each paragraph&lt;br /&gt; sed -n '/^$/{p;h;};/./{x;/./p;}'&lt;br /&gt;&lt;br /&gt;SPECIAL APPLICATIONS:&lt;br /&gt;&lt;br /&gt; # remove nroff overstrikes (char, backspace) from man pages. The 'echo'&lt;br /&gt; # command may need an -e switch if you use Unix System V or bash shell.&lt;br /&gt; sed "s/.`echo \\\b`//g"    # double quotes required for Unix environment&lt;br /&gt; sed 's/.^H//g'             # in bash/tcsh, press Ctrl-V and then Ctrl-H&lt;br /&gt; sed 's/.\x08//g'           # hex expression for sed v1.5&lt;br /&gt;&lt;br /&gt; # get Usenet/e-mail message header&lt;br /&gt; sed '/^$/q'                # deletes everything after first blank line&lt;br /&gt;&lt;br /&gt; # get Usenet/e-mail message body&lt;br /&gt; sed '1,/^$/d'              # deletes everything up to first blank line&lt;br /&gt;&lt;br /&gt; # get Subject header, but remove initial "Subject: " portion&lt;br /&gt; sed '/^Subject: */!d; s///;q'&lt;br /&gt;&lt;br /&gt; # get return address header&lt;br /&gt; sed '/^Reply-To:/q; /^From:/h; /./d;g;q'&lt;br /&gt;&lt;br /&gt; # parse out the address proper. Pulls out the e-mail address by itself&lt;br /&gt; # from the 1-line return address header (see preceding script)&lt;br /&gt; sed 's/ *(.*)//; s/&gt;.*//; s/.*[:&lt;] *//'&lt;br /&gt;&lt;br /&gt; # add a leading angle bracket and space to each line (quote a message)&lt;br /&gt; sed 's/^/&gt; /'&lt;br /&gt;&lt;br /&gt; # delete leading angle bracket &amp; space from each line (unquote a message)&lt;br /&gt; sed 's/^&gt; //'&lt;br /&gt;&lt;br /&gt; # remove most HTML tags (accommodates multiple-line tags)&lt;br /&gt; sed -e :a -e 's/&lt;[^&gt;]*&gt;//g;/&lt;/N;//ba'&lt;br /&gt;&lt;br /&gt; # extract multi-part uuencoded binaries, removing extraneous header&lt;br /&gt; # info, so that only the uuencoded portion remains. Files passed to&lt;br /&gt; # sed must be passed in the proper order. Version 1 can be entered&lt;br /&gt; # from the command line; version 2 can be made into an executable&lt;br /&gt; # Unix shell script. (Modified from a script by Rahul Dhesi.)&lt;br /&gt; sed '/^end/,/^begin/d' file1 file2 ... fileX | uudecode   # vers. 1&lt;br /&gt; sed '/^end/,/^begin/d' "$@" | uudecode                    # vers. 2&lt;br /&gt;&lt;br /&gt; # zip up each .TXT file individually, deleting the source file and&lt;br /&gt; # setting the name of each .ZIP file to the basename of the .TXT file&lt;br /&gt; # (under DOS: the "dir /b" switch returns bare filenames in all caps).&lt;br /&gt; echo @echo off &gt;zipup.bat&lt;br /&gt; dir /b *.txt | sed "s/^\(.*\)\.TXT/pkzip -mo \1 \1.TXT/" &gt;&gt;zipup.bat&lt;br /&gt;&lt;br /&gt;TYPICAL USE: Sed takes one or more editing commands and applies all of&lt;br /&gt;them, in sequence, to each line of input. After all the commands have&lt;br /&gt;been applied to the first input line, that line is output and a second&lt;br /&gt;input line is taken for processing, and the cycle repeats. The&lt;br /&gt;preceding examples assume that input comes from the standard input&lt;br /&gt;device (i.e, the console, normally this will be piped input). One or&lt;br /&gt;more filenames can be appended to the command line if the input does&lt;br /&gt;not come from stdin. Output is sent to stdout (the screen). Thus:&lt;br /&gt;&lt;br /&gt; cat filename | sed '10q'        # uses piped input&lt;br /&gt; sed '10q' filename              # same effect, avoids a useless "cat"&lt;br /&gt; sed '10q' filename &gt; newfile    # redirects output to disk&lt;br /&gt;&lt;br /&gt;For additional syntax instructions, including the way to apply editing&lt;br /&gt;commands from a disk file instead of the command line, consult "sed &amp;&lt;br /&gt;awk, 2nd Edition," by Dale Dougherty and Arnold Robbins (O'Reilly,&lt;br /&gt;1997; http://www.ora.com), "UNIX Text Processing," by Dale Dougherty&lt;br /&gt;and Tim O'Reilly (Hayden Books, 1987) or the tutorials by Mike Arst&lt;br /&gt;distributed in U-SEDIT2.ZIP (many sites). To fully exploit the power&lt;br /&gt;of sed, one must understand "regular expressions." For this, see&lt;br /&gt;"Mastering Regular Expressions" by Jeffrey Friedl (O'Reilly, 1997).&lt;br /&gt;The manual ("man") pages on Unix systems may be helpful (try "man&lt;br /&gt;sed", "man regexp", or the subsection on regular expressions in "man&lt;br /&gt;ed"), but man pages are notoriously difficult. They are not written to&lt;br /&gt;teach sed use or regexps to first-time users, but as a reference text&lt;br /&gt;for those already acquainted with these tools.&lt;br /&gt;&lt;br /&gt;QUOTING SYNTAX: The preceding examples use single quotes ('...')&lt;br /&gt;instead of double quotes ("...") to enclose editing commands, since&lt;br /&gt;sed is typically used on a Unix platform. Single quotes prevent the&lt;br /&gt;Unix shell from intrepreting the dollar sign ($) and backquotes&lt;br /&gt;(`...`), which are expanded by the shell if they are enclosed in&lt;br /&gt;double quotes. Users of the "csh" shell and derivatives will also need&lt;br /&gt;to quote the exclamation mark (!) with the backslash (i.e., \!) to&lt;br /&gt;properly run the examples listed above, even within single quotes.&lt;br /&gt;Versions of sed written for DOS invariably require double quotes&lt;br /&gt;("...") instead of single quotes to enclose editing commands.&lt;br /&gt;&lt;br /&gt;USE OF '\t' IN SED SCRIPTS: For clarity in documentation, we have used&lt;br /&gt;the expression '\t' to indicate a tab character (0x09) in the scripts.&lt;br /&gt;However, most versions of sed do not recognize the '\t' abbreviation,&lt;br /&gt;so when typing these scripts from the command line, you should press&lt;br /&gt;the TAB key instead. '\t' is supported as a regular expression&lt;br /&gt;metacharacter in awk, perl, and HHsed, sedmod, and GNU sed v3.02.80.&lt;br /&gt;&lt;br /&gt;VERSIONS OF SED: Versions of sed do differ, and some slight syntax&lt;br /&gt;variation is to be expected. In particular, most do not support the&lt;br /&gt;use of labels (:name) or branch instructions (b,t) within editing&lt;br /&gt;commands, except at the end of those commands. We have used the syntax&lt;br /&gt;which will be portable to most users of sed, even though the popular&lt;br /&gt;GNU versions of sed allow a more succinct syntax. When the reader sees&lt;br /&gt;a fairly long command such as this:&lt;br /&gt;&lt;br /&gt;   sed -e '/AAA/b' -e '/BBB/b' -e '/CCC/b' -e d&lt;br /&gt;&lt;br /&gt;it is heartening to know that GNU sed will let you reduce it to:&lt;br /&gt;&lt;br /&gt;   sed '/AAA/b;/BBB/b;/CCC/b;d'      # or even&lt;br /&gt;   sed '/AAA\|BBB\|CCC/b;d'&lt;br /&gt;&lt;br /&gt;In addition, remember that while many versions of sed accept a command&lt;br /&gt;like "/one/ s/RE1/RE2/", some do NOT allow "/one/! s/RE1/RE2/", which&lt;br /&gt;contains space before the 's'. Omit the space when typing the command.&lt;br /&gt;&lt;br /&gt;OPTIMIZING FOR SPEED: If execution speed needs to be increased (due to&lt;br /&gt;large input files or slow processors or hard disks), substitution will&lt;br /&gt;be executed more quickly if the "find" expression is specified before&lt;br /&gt;giving the "s/.../.../" instruction. Thus:&lt;br /&gt;&lt;br /&gt;   sed 's/foo/bar/g' filename         # standard replace command&lt;br /&gt;   sed '/foo/ s/foo/bar/g' filename   # executes more quickly&lt;br /&gt;   sed '/foo/ s//bar/g' filename      # shorthand sed syntax&lt;br /&gt;&lt;br /&gt;On line selection or deletion in which you only need to output lines&lt;br /&gt;from the first part of the file, a "quit" command (q) in the script&lt;br /&gt;will drastically reduce processing time for large files. Thus:&lt;br /&gt;&lt;br /&gt;   sed -n '45,50p' filename           # print line nos. 45-50 of a file&lt;br /&gt;   sed -n '51q;45,50p' filename       # same, but executes much faster&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Anand Shah&lt;br /&gt;Rediff.com&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-2209014088966943367?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/2209014088966943367/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=2209014088966943367&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/2209014088966943367'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/2209014088966943367'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2008/05/handy-one-liners-for-sed-command.html' title='Handy One Liners for SED COmmand'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-7113313928527833840</id><published>2008-03-26T22:16:00.002+05:30</published><updated>2008-03-26T22:21:33.579+05:30</updated><title type='text'>How does ssl work</title><content type='html'>&lt;a href="http://bp2.blogger.com/_bEin5MXNtT8/R-p-IaGVX_I/AAAAAAAAATQ/V2Nwu6WgpT4/s1600-h/ssl_figure_1.gif"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://bp2.blogger.com/_bEin5MXNtT8/R-p-IaGVX_I/AAAAAAAAATQ/V2Nwu6WgpT4/s320/ssl_figure_1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5182093004153118706" /&gt;&lt;/a&gt;&lt;br /&gt;Internet communication typically runs through multiple program layers on a server before getting to the requested data such as a web page or cgi scripts.  &lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;The outer layer is the first to be hit by the request.  This is the high level protocols such as HTTP (web server), IMAP (mail server), and FTP (file transfer).  &lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Determining which outer layer protocol will handle the request depends on the type of request made by the client.  This high level protocol then processes the request through the Secure Sockets Layer.  If the request is for a non-secure connection it passes through to the TCP/IP layer and the server application or data.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;If the client requested a secure connection the ssl layer initiates a handshake to begin the secure communication process.  Depending on the SSL setup on the server, it may &lt;i&gt;require&lt;/i&gt; that a secure connection be made before allowing communication to pass through to the TCP/IP layer in which case a non-secure request will send back an error asking for them to retry securely (or simply deny the non-secure connection).&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;div style="border-style: solid; border-width:1; border-color: #000000; margin:10px 3px 10px 3px; padding: 10; background-color:#eeeeee"&gt;&lt;br /&gt;&lt;font face="Arial, Helvetica, sans-serif" size=2 color="#000000"&gt;This is a good time to answer a question we periodically get: &lt;b&gt;&lt;i&gt;"what does ssl encrypt?"&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;This question is usually geared toward whether or not the path and query string is encrypted in an HTTPS "get" request (this is where form field responses or program variables are tagged on to the end of the url).  These fields &lt;i&gt;are&lt;/i&gt; stripped off of the URL when creating the routing information in the https packaging process by the browser and are included in the encrypted data block.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;The page data (form, text, and query string) are passed in the encrypted block &lt;i&gt;after&lt;/i&gt; the encryption methods are determined and the handshake completes.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;A related issue that frequently comes up is whether or not form data is transmited with encryption if the blank form is displayed without https.  If the form "action" is set to use https then the ssl handshake will take place before the data is sent.  Whether or not the original form is displayed using https has little to do with the form submission unless the form action uses a relative path, in which case the default will be to use the protocol that was used to display the form.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-7113313928527833840?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/7113313928527833840/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=7113313928527833840&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/7113313928527833840'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/7113313928527833840'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2008/03/how-does-ssl-work.html' title='How does ssl work'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp2.blogger.com/_bEin5MXNtT8/R-p-IaGVX_I/AAAAAAAAATQ/V2Nwu6WgpT4/s72-c/ssl_figure_1.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-1511161954612986292</id><published>2008-03-26T22:11:00.000+05:30</published><updated>2008-03-26T22:12:24.861+05:30</updated><title type='text'>PHP SESSION HANDLING EXAMPLE</title><content type='html'>The below code is a very simple example of Session.&lt;br /&gt;Please note that the "session_start" statement *must* be the first line of your code.&lt;br /&gt;To see the example at work, please review:&lt;br /&gt;&lt;br /&gt;        http://www.xn--ovg.com/session&lt;br /&gt;&lt;br /&gt;tedd&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;--- copy below and save as session1.php -----&lt;br /&gt;&lt;?php&lt;br /&gt;session_start();&lt;br /&gt;?&gt;&lt;br /&gt;&lt;br /&gt;&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"&lt;br /&gt;"http://www.w3.org/TR/html4/strict.dtd"&gt;&lt;br /&gt;&lt;html&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;    &lt;meta http-equiv="content-type" content="text/html;charset=ISO-8859-1"&gt;&lt;br /&gt;    &lt;title&gt;Stuff by tedd&lt;/title&gt;       &lt;br /&gt;&lt;/head&gt;&lt;br /&gt;&lt;br /&gt;&lt;body&gt;&lt;br /&gt;&lt;br /&gt;    &lt;h1&gt;Anand's session stuff (page 1)&lt;/h1&gt;&lt;br /&gt;    &lt;hr&gt;&lt;br /&gt;        &lt;h3&gt;PHPSESSID = &lt;?php echo session_id(); ?&gt;&lt;/h3&gt;&lt;br /&gt;    &lt;hr&gt;&lt;br /&gt;    &lt;h2&gt;Click the next page and see numbr of visits during this visit.&lt;/h2&gt;   &lt;br /&gt;    &lt;a href="session2.php?&lt;?php echo( SID ); ?&gt;"&gt;Next page&lt;/a&gt;&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;--- copy below and save as session2.php -----&lt;br /&gt;&lt;br /&gt;&lt;?php&lt;br /&gt;session_start();&lt;br /&gt;($_SESSION['count']) ? $_SESSION['count']++ : $_SESSION['count'] = 1;&lt;br /&gt;?&gt;&lt;br /&gt;&lt;br /&gt;&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"&lt;br /&gt;"http://www.w3.org/TR/html4/strict.dtd"&gt;&lt;br /&gt;&lt;html&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;    &lt;meta http-equiv="content-type" content="text/html;charset=ISO-8859-1"&gt;&lt;br /&gt;    &lt;title&gt;Stuff by tedd&lt;/title&gt;       &lt;br /&gt;&lt;/head&gt;&lt;br /&gt;&lt;br /&gt;&lt;body&gt;&lt;br /&gt;    &lt;h1&gt;Anand's session stuff (page 2)&lt;/h1&gt;&lt;br /&gt;    &lt;hr&gt;&lt;br /&gt;        &lt;h3&gt;PHPSESSID = &lt;?php echo session_id(); ?&gt;&lt;/h3&gt;&lt;br /&gt;    &lt;hr&gt;&lt;br /&gt;    &lt;h2&gt;You have been here &lt;?php echo( $_SESSION['count'] ); ?&gt; times in this session.&lt;/h2&gt;   &lt;br /&gt;    &lt;a href="session1.php?&lt;?php echo( SID ); ?&gt;"&gt;Previous page&lt;/a&gt;&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;&lt;/html&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-1511161954612986292?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/1511161954612986292/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=1511161954612986292&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/1511161954612986292'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/1511161954612986292'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2008/03/php-session-handling-example.html' title='PHP SESSION HANDLING EXAMPLE'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-5101481606057932971</id><published>2008-03-26T22:03:00.000+05:30</published><updated>2008-03-26T22:04:27.385+05:30</updated><title type='text'>Test the SMTP Service on WIndows</title><content type='html'>&lt;strong&gt;&lt;h3&gt;Test the SMTP Service&lt;/h3&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;To test the SMTP service, follow these steps:&lt;br /&gt;1. On a computer running Windows Server 2003, type Telnet at a command prompt, and then press ENTER.&lt;br /&gt;2. At the telnet prompt, type set LocalEcho, press ENTER, and then type open &lt;machinename&gt; 25, and then press ENTER.&lt;br /&gt;&lt;br /&gt;The output resembles the following:&lt;br /&gt;&lt;br /&gt;220 computername.microsoft.com ESMTP Server (Microsoft Exchange Internet Mail Service 5.5.2651.58) ready&lt;br /&gt;     &lt;br /&gt;&lt;br /&gt;3. Type helo me, and then press ENTER.&lt;br /&gt;&lt;br /&gt;The output resembles the following:&lt;br /&gt;&lt;br /&gt;250 OK&lt;br /&gt;     &lt;br /&gt;&lt;br /&gt;4. Type mail from:email@domain.com, and then press ENTER.&lt;br /&gt;&lt;br /&gt;The output resembles the following:&lt;br /&gt;&lt;br /&gt;250 OK - mail from &lt;email@domain.com&gt;&lt;br /&gt;     &lt;br /&gt;&lt;br /&gt;5. Type rcpt to:youremail@yourdomain.com, and then press ENTER.&lt;br /&gt;&lt;br /&gt;The output resembles the following:&lt;br /&gt;&lt;br /&gt;250 OK - Recipient &lt;youremail@yourdomain.com&gt;&lt;br /&gt;     &lt;br /&gt;&lt;br /&gt;6. Type Data, and then press ENTER.&lt;br /&gt;&lt;br /&gt;The output resembles the following:&lt;br /&gt;&lt;br /&gt;354 Send data.  End with CRLF.CRLF&lt;br /&gt;     &lt;br /&gt;&lt;br /&gt;7. Type Subject:This is a test, and then press ENTER two times.&lt;br /&gt;8. Type Testing, and then press ENTER.&lt;br /&gt;9. Press ENTER, type a period (.), and then press ENTER.&lt;br /&gt;&lt;br /&gt;The output resembles the following:&lt;br /&gt;&lt;br /&gt;250 OK&lt;br /&gt;     &lt;br /&gt;&lt;br /&gt;10. Type quit, and then press ENTER.&lt;br /&gt;The output resembles the following:&lt;br /&gt;&lt;br /&gt;221 Closing Port / Mail queued for delivery&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-5101481606057932971?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/5101481606057932971/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=5101481606057932971&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/5101481606057932971'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/5101481606057932971'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2008/03/test-smtp-service-on-windows.html' title='Test the SMTP Service on WIndows'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-1914041492046551058</id><published>2008-03-26T22:02:00.000+05:30</published><updated>2008-03-26T22:03:03.938+05:30</updated><title type='text'>Disallow download .MDB file</title><content type='html'>&lt;strong&gt;&lt;h2&gt;Disallow download of certain file type &lt;/h2&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If what you want to do is prevent a download of your .mdb file,&lt;br /&gt;just create an App_Data directory and place the Access database in it.&lt;br /&gt;&lt;br /&gt;Files stored in the App_Data folder are not returned in response to direct HTTP requests,&lt;br /&gt;which makes the App_Data folder the recommended location for data stored with your&lt;br /&gt;application, including .mdf (SQL Server Express Edition), .mdb (Microsoft Access), or XML files.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-1914041492046551058?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/1914041492046551058/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=1914041492046551058&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/1914041492046551058'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/1914041492046551058'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2008/03/disallow-download-mdb-file.html' title='Disallow download .MDB file'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-2754739078484959229</id><published>2008-03-26T21:58:00.001+05:30</published><updated>2008-03-26T22:00:28.144+05:30</updated><title type='text'>Command Line Examples linux</title><content type='html'>&lt;strong&gt;&lt;h1&gt;Linux command line reference for common operations.&lt;/h1&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;This is a linux command line reference for common operations.&lt;br /&gt;Examples marked with • are valid/safe to paste without modification into a terminal, so&lt;br /&gt;you may want to keep a terminal window open while reading this so you can cut &amp; paste.&lt;br /&gt;All these commands have been tested both on Fedora and Ubuntu.&lt;br /&gt;&lt;br /&gt;Command Description&lt;br /&gt;• apropos whatis Show commands pertinent to string. See also threadsafe&lt;br /&gt;• man -t man | ps2pdf - &gt; man.pdf make a pdf of a manual page&lt;br /&gt;  which command Show full path name of command&lt;br /&gt;  time command See how long a command takes&lt;br /&gt;• time cat Start stopwatch. Ctrl-d to stop. See also sw&lt;br /&gt;• nice info Run a low priority command (The "info" reader in this case)&lt;br /&gt;• renice 19 -p $$ Make shell (script) low priority. Use for non interactive tasks&lt;br /&gt;dir navigation&lt;br /&gt;• cd - Go to previous directory&lt;br /&gt;• cd Go to $HOME directory&lt;br /&gt;  (cd dir &amp;&amp; command) Go to dir, execute command and return to current dir&lt;br /&gt;• pushd . Put current dir on stack so you can popd back to it&lt;br /&gt;file searching&lt;br /&gt;• alias l='ls -l --color=auto' quick dir listing&lt;br /&gt;• ls -lrt List files by date. See also newest and find_mm_yyyy&lt;br /&gt;• ls /usr/bin | pr -T9 -W$COLUMNS Print in 9 columns to width of terminal&lt;br /&gt;  find -name '*.[ch]' | xargs grep -E 'expr' Search 'expr' in this dir and below. See also findrepo&lt;br /&gt;  find -type f -print0 | xargs -r0 grep -F 'example' Search all regular files for 'example' in this dir and below&lt;br /&gt;  find -maxdepth 1 -type f | xargs grep -F 'example' Search all regular files for 'example' in this dir&lt;br /&gt;  find -maxdepth 1 -type d | while read dir; do echo $dir; echo cmd2; done Process each item with multiple commands (in while loop)&lt;br /&gt;• find -type f ! -perm -444 Find files not readable by all (useful for web site)&lt;br /&gt;• find -type d ! -perm -111 Find dirs not accessible by all (useful for web site)&lt;br /&gt;• locate -r 'file[^/]*\.txt' Search cached index for names. This re is like glob *file*.txt&lt;br /&gt;• look reference Quickly search (sorted) dictionary for prefix&lt;br /&gt;• grep --color reference /usr/share/dict/words Highlight occurances of regular expression in dictionary&lt;br /&gt;archives and compression&lt;br /&gt;  gpg -c file Encrypt file&lt;br /&gt;  gpg file.gpg Decrypt file&lt;br /&gt;  tar -c dir/ | bzip2 &gt; dir.tar.bz2 Make compressed archive of dir/&lt;br /&gt;  bzip2 -dc dir.tar.bz2 | tar -x Extract archive (use gzip instead of bzip2 for tar.gz files)&lt;br /&gt;  tar -c dir/ | gzip | gpg -c | ssh user@remote 'dd of=dir.tar.gz.gpg' Make encrypted archive of dir/ on remote machine&lt;br /&gt;  find dir/ -name '*.txt' | tar -c --files-from=- | bzip2 &gt; dir_txt.tar.bz2 Make archive of subset of dir/ and below&lt;br /&gt;  find dir/ -name '*.txt' | xargs cp -a --target-directory=dir_txt/ --parents Make copy of subset of dir/ and below&lt;br /&gt;  ( tar -c /dir/to/copy ) | ( cd /where/to/ &amp;&amp; tar -x -p ) Copy (with permissions) copy/ dir to /where/to/ dir&lt;br /&gt;  ( cd /dir/to/copy &amp;&amp; tar -c . ) | ( cd /where/to/ &amp;&amp; tar -x -p ) Copy (with permissions) contents of copy/ dir to /where/to/&lt;br /&gt;  ( tar -c /dir/to/copy ) | ssh -C user@remote 'cd /where/to/ &amp;&amp; tar -x -p'  Copy (with permissions) copy/ dir to remote:/where/to/ dir&lt;br /&gt;  dd bs=1M if=/dev/sda | gzip | ssh user@remote 'dd of=sda.gz' Backup harddisk to remote machine&lt;br /&gt;rsync (Use the --dry-run option for testing)&lt;br /&gt;  rsync -P rsync://rsync.server.com/path/to/file file Only get diffs. Do multiple times for troublesome downloads&lt;br /&gt;  rsync --bwlimit=1000 fromfile tofile Locally copy with rate limit. It's like nice for I/O&lt;br /&gt;  rsync -az -e ssh --delete ~/public_html/ remote.com:'~/public_html' Mirror web site (using compression and encryption)&lt;br /&gt;  rsync -auz -e ssh remote:/dir/ . &amp;&amp; rsync -auz -e ssh . remote:/dir/ Synchronize current directory with remote one&lt;br /&gt;ssh (Secure SHell)&lt;br /&gt;  ssh $USER@$HOST command Run command on $HOST as $USER (default command=shell)&lt;br /&gt;• ssh -f -Y $USER@$HOSTNAME xeyes Run GUI command on $HOSTNAME as $USER&lt;br /&gt;  scp -p -r $USER@$HOST: file dir/ Copy with permissions to $USER's home directory on $HOST&lt;br /&gt;  ssh -g -L 8080:localhost:80 root@$HOST Forward connections to $HOSTNAME:8080 out to $HOST:80&lt;br /&gt;  ssh -R 1434:imap:143 root@$HOST Forward connections from $HOST:1434 in to imap:143&lt;br /&gt;wget (multi purpose download tool)&lt;br /&gt;• (cd cli &amp;&amp; wget -nd -pHEKk http://www.pixelbeat.org/cmdline.html) Store local browsable version of a page to the current dir&lt;br /&gt;  wget -c http://www.example.com/large.file Continue downloading a partially downloaded file&lt;br /&gt;  wget -r -nd -np -l1 -A '*.jpg' http://www.example.com/dir/ Download a set of files to the current directory&lt;br /&gt;  wget ftp://remote/file[1-9].iso/ FTP supports globbing directly&lt;br /&gt;• wget -q -O- http://www.pixelbeat.org/timeline.html | grep 'a href' | head Process output directly&lt;br /&gt;  echo 'wget url' | at 01:00 Download url at 1AM to current dir&lt;br /&gt;  wget --limit-rate=20k url Do a low priority download (limit to 20KB/s in this case)&lt;br /&gt;  wget -nv --spider --force-html -i bookmarks.html Check links in a file&lt;br /&gt;  wget --mirror http://www.example.com/ Efficiently update a local copy of a site (handy from cron)&lt;br /&gt;networking (Note ifconfig, route, mii-tool, nslookup commands are obsolete)&lt;br /&gt;  ethtool eth0 Show status of ethernet interface eth0&lt;br /&gt;  ethtool --change eth0 autoneg off speed 100 duplex full Manually set ethernet interface speed&lt;br /&gt;  iwconfig eth1 Show status of wireless interface eth1&lt;br /&gt;  iwconfig eth1 rate 1Mb/s fixed Manually set wireless interface speed&lt;br /&gt;• iwlist scan List wireless networks in range&lt;br /&gt;• ip link show List network interfaces&lt;br /&gt;  ip link set dev eth0 name wan Rename interface eth0 to wan&lt;br /&gt;  ip link set dev eth0 up Bring interface eth0 up (or down)&lt;br /&gt;• ip addr show List addresses for interfaces&lt;br /&gt;  ip addr add 1.2.3.4/24 brd + dev eth0 Add (or del) ip and mask (255.255.255.0)&lt;br /&gt;• ip route show List routing table&lt;br /&gt;  ip route add default via 1.2.3.254 Set default gateway to 1.2.3.254&lt;br /&gt;• tc qdisc add dev lo root handle 1:0 netem delay 20msec Add 20ms latency to loopback device (for testing)&lt;br /&gt;• tc qdisc del dev lo root Remove latency added above&lt;br /&gt;• host pixelbeat.org Lookup DNS ip address for name or vice versa&lt;br /&gt;• hostname -i Lookup local ip address (equivalent to host `hostname`)&lt;br /&gt;• whois pixelbeat.org Lookup whois info for hostname or ip address&lt;br /&gt;• netstat -tupl List internet services on a system&lt;br /&gt;• netstat -tup List active connections to/from system&lt;br /&gt;windows networking (Note samba is the package that provides all this windows specific networking support)&lt;br /&gt;• smbtree Find windows machines. See also findsmb&lt;br /&gt;  nmblookup -A 1.2.3.4 Find the windows (netbios) name associated with ip address&lt;br /&gt;  smbclient -L windows_box List shares on windows machine or samba server&lt;br /&gt;  mount -t smbfs -o fmask=666,guest //windows_box/share /mnt/share Mount a windows share&lt;br /&gt;  echo 'message' | smbclient -M windows_box Send popup to windows machine (off by default in XP sp2)&lt;br /&gt;text manipulation (Note sed uses stdin and stdout, so if you want to edit files, append &lt;oldfile &gt;newfile)&lt;br /&gt;  sed 's/string1/string2/g' Replace string1 with string2&lt;br /&gt;  sed 's/\(.*\)1/\12/g' Modify anystring1 to anystring2&lt;br /&gt;  sed '/ *#/d; /^ *$/d' Remove comments and blank lines&lt;br /&gt;  sed ':a; /\\$/N; s/\\\n//; ta' Concatenate lines with trailing \&lt;br /&gt;  sed 's/[ \t]*$//' Remove trailing spaces from lines&lt;br /&gt;  sed 's/\([\\`\\"$\\\\]\)/\\\1/g' Escape shell metacharacters active within double quotes&lt;br /&gt;• seq 10 | sed "s/^/      /; s/ *\(.\{7,\}\)/\1/" Right align numbers&lt;br /&gt;  sed -n '1000p;1000q' Print 1000th line&lt;br /&gt;  sed -n '10,20p;20q' Print lines 10 to 20&lt;br /&gt;  sed -n 's/.*(title)\(.*\)&lt;\/title&gt;.*/\1/ip;T;q' Extract title from HTML web page&lt;br /&gt;  sort -t. -k1,1n -k2,2n -k3,3n -k4,4n Sort IPV4 ip addresses&lt;br /&gt;• echo 'Test' | tr '[:lower:]' '[:upper:]' Case conversion&lt;br /&gt;• tr -dc '[:print:]' &lt; /dev/urandom Filter non printable characters&lt;br /&gt;• history | wc -l Count lines&lt;br /&gt;set operations (Note you can export LANG=C for speed. Also these assume no duplicate lines within a file)&lt;br /&gt;  sort file1 file2 | uniq Union of unsorted files&lt;br /&gt;  sort file1 file2 | uniq -d Intersection of unsorted files&lt;br /&gt;  sort file1 file1 file2 | uniq -u Difference of unsorted files&lt;br /&gt;  sort file1 file2 | uniq -u Symmetric Difference of unsorted files&lt;br /&gt;  join -a1 -a2 file1 file2 Union of sorted files&lt;br /&gt;  join file1 file2 Intersection of sorted files&lt;br /&gt;  join -v2 file1 file2 Difference of sorted files&lt;br /&gt;  join -v1 -v2 file1 file2 Symmetric Difference of sorted files&lt;br /&gt;math&lt;br /&gt;• echo '(1 + sqrt(5))/2' | bc -l Quick math (Calculate φ). See also bc&lt;br /&gt;• echo 'pad=20; min=64; (100*10^6)/((pad+min)*8)' | bc More complex (int) e.g. This shows max FastE packet rate&lt;br /&gt;• echo 'pad=20; min=64; print (100E6)/((pad+min)*8)' | python Python handles scientific notation&lt;br /&gt;• echo 'pad=20; plot [64:1518] (100*10**6)/((pad+x)*8)' | gnuplot -persist Plot FastE packet rate vs packet size&lt;br /&gt;• echo 'obase=16; ibase=10; 64206' | bc Base conversion (decimal to hexadecimal)&lt;br /&gt;• echo $((0x2dec)) Base conversion (hex to dec) ((shell arithmetic expansion))&lt;br /&gt;• units -t '100m/9.74s' 'miles/hour' Unit conversion (metric to imperial)&lt;br /&gt;• units -t '500GB' 'GiB' Unit conversion (SI to IEC prefixes)&lt;br /&gt;• units -t '1 googol' Definition lookup&lt;br /&gt;• seq 100 | (tr '\n' +; echo 0) | bc Add a column of numbers. See also add and funcpy&lt;br /&gt;calendar&lt;br /&gt;• cal -3 Display a calendar&lt;br /&gt;• cal 9 1752 Display a calendar for a particular month year&lt;br /&gt;• date -d fri What date is it this friday. See also day&lt;br /&gt;• date --date='25 Dec' +%A What day does xmas fall on, this year&lt;br /&gt;• date --date '1970-01-01 UTC 2147483647 seconds' Convert number of seconds since the epoch to a date&lt;br /&gt;• TZ=':America/Los_Angeles' date What time is it on West coast of US (use tzselect to find TZ)&lt;br /&gt;  echo "mail -s 'get the train' P@draigBrady.com &lt; /dev/null" | at 17:45 Email reminder&lt;br /&gt;• echo "DISPLAY=$DISPLAY xmessage cooker" | at "NOW + 30 minutes" Popup reminder&lt;br /&gt;locales&lt;br /&gt;• printf "%'d\n" 1234 Print number with thousands grouping appropriate to locale&lt;br /&gt;• BLOCK_SIZE=\'1 ls -l get ls to do thousands grouping appropriate to locale&lt;br /&gt;• echo "I live in `locale territory`" Extract info from locale database&lt;br /&gt;• LANG=en_IE.utf8 locale int_prefix Lookup locale info for specific country. See also ccodes&lt;br /&gt;• locale | cut -d= -f1 | xargs locale -kc | less List fields available in locale database&lt;br /&gt;recode (Obsoletes iconv, dos2unix, unix2dos)&lt;br /&gt;• recode -l | less Show available conversions (aliases on each line)&lt;br /&gt;  recode windows-1252.. file_to_change.txt Windows "ansi" to local charset (auto does CRLF conversion)&lt;br /&gt;  recode utf-8/CRLF.. file_to_change.txt Windows utf8 to local charset&lt;br /&gt;  recode iso-8859-15..utf8 file_to_change.txt Latin9 (western europe) to utf8&lt;br /&gt;  recode ../b64 &lt; file.txt &gt; file.b64 Base64 encode&lt;br /&gt;  recode /qp.. &lt; file.txt &gt; file.qp Quoted printable decode&lt;br /&gt;  recode ..HTML &lt; file.txt &gt; file.html Text to HTML&lt;br /&gt;• recode -lf windows-1252 | grep euro Lookup table of characters&lt;br /&gt;• echo -n 0x80 | recode latin-9/x1..dump Show what a code represents in latin-9 charmap&lt;br /&gt;• echo -n 0x20AC | recode ucs-2/x2..latin-9/x Show latin-9 encoding&lt;br /&gt;• echo -n 0x20AC | recode ucs-2/x2..utf-8/x Show utf-8 encoding&lt;br /&gt;CDs&lt;br /&gt;  gzip &lt; /dev/cdrom &gt; cdrom.iso.gz Save copy of data cdrom&lt;br /&gt;  mkisofs -V LABEL -r dir | gzip &gt; cdrom.iso.gz Create cdrom image from contents of dir&lt;br /&gt;  mount -o loop cdrom.iso /mnt/dir Mount the cdrom image at /mnt/dir (read only)&lt;br /&gt;  cdrecord -v dev=/dev/cdrom blank=fast Clear a CDRW&lt;br /&gt;  gzip -dc cdrom.iso.gz | cdrecord -v dev=/dev/cdrom - Burn cdrom image (use dev=ATAPI -scanbus to confirm dev)&lt;br /&gt;  cdparanoia -B Rip audio tracks from CD to wav files in current dir&lt;br /&gt;  cdrecord -v dev=/dev/cdrom -audio *.wav Make audio CD from all wavs in current dir (see also cdrdao)&lt;br /&gt;  oggenc --tracknum='track' track.cdda.wav -o 'track.ogg' Make ogg file from wav file&lt;br /&gt;disk space (See also FSlint)&lt;br /&gt;• ls -lSr Show files by size, biggest last&lt;br /&gt;• du -s * | sort -k1,1rn | head Show top disk users in current dir. See also dutop&lt;br /&gt;• df -h Show free space on mounted filesystems&lt;br /&gt;• df -i Show free inodes on mounted filesystems&lt;br /&gt;• fdisk -l Show disks partitions sizes and types (run as root)&lt;br /&gt;• rpm -q -a --qf '%10{SIZE}\t%{NAME}\n' | sort -k1,1n List all packages by installed size (Bytes) on rpm distros&lt;br /&gt;• dpkg-query -W -f='${Installed-Size;10}\t${Package}\n' | sort -k1,1n List all packages by installed size (KBytes) on deb distros&lt;br /&gt;• dd bs=1 seek=2TB if=/dev/null of=ext3.test Create a large test file (taking no space). See also truncate&lt;br /&gt;monitoring/debugging&lt;br /&gt;• tail -f /var/log/messages Monitor messages in a log file&lt;br /&gt;• strace -c ls &gt;/dev/null Summarise/profile system calls made by command&lt;br /&gt;• strace -f -e open ls &gt;/dev/null List system calls made by command&lt;br /&gt;• ltrace -f -e getenv ls &gt;/dev/null List library calls made by command&lt;br /&gt;• lsof -p $$ List paths that process id has open&lt;br /&gt;• lsof ~ List processes that have specified path open&lt;br /&gt;• tcpdump not port 22 Show network traffic except ssh. See also tcpdump_not_me&lt;br /&gt;• ps -e -o pid,args --forest List processes in a hierarchy&lt;br /&gt;• ps -e -o pcpu,cpu,nice,state,cputime,args --sort pcpu | sed '/^ 0.0 /d' List processes by % cpu usage&lt;br /&gt;• ps -e -orss=,args= | sort -b -k1,1n | pr -TW$COLUMNS List processes by mem usage. See also ps_mem.py&lt;br /&gt;• ps -C firefox-bin -L -o pid,tid,pcpu,state List all threads for a particular process&lt;br /&gt;• ps -p 1,2 List info for particular process IDs&lt;br /&gt;• last reboot Show system reboot history&lt;br /&gt;• free -m Show amount of (remaining) RAM (-m displays in MB)&lt;br /&gt;• watch -n1 'cat /proc/interrupts' Watch changeable data continuously&lt;br /&gt;system information (see also sysinfo) ('#' means root access is required)&lt;br /&gt;• uname -a Show kernel version and system architecture&lt;br /&gt;• head -n1 /etc/issue Show name and version of distribution&lt;br /&gt;• cat /proc/partitions Show all partitions registered on the system&lt;br /&gt;• grep MemTotal /proc/meminfo Show RAM total seen by the system&lt;br /&gt;• grep "model name" /proc/cpuinfo Show CPU(s) info&lt;br /&gt;• lspci -tv Show PCI info&lt;br /&gt;• lsusb -tv Show USB info&lt;br /&gt;• mount | column -t List mounted filesystems on the system (and align output)&lt;br /&gt;# dmidecode -q | less Display SMBIOS/DMI information&lt;br /&gt;# smartctl -A /dev/sda | grep Power_On_Hours How long has this disk (system) been powered on in total&lt;br /&gt;# hdparm -i /dev/sda Show info about disk sda&lt;br /&gt;# hdparm -tT /dev/sda Do a read speed test on disk sda&lt;br /&gt;# badblocks -s /dev/sda Test for unreadable blocks on disk sda&lt;br /&gt;interactive (see also linux keyboard shortcuts)&lt;br /&gt;• readline Line editor used by bash, python, bc, gnuplot, ...&lt;br /&gt;• screen Virtual terminals with detach capability, ...&lt;br /&gt;• mc Powerful file manager that can browse rpm, tar, ftp, ssh, ...&lt;br /&gt;• gnuplot Interactive/scriptable graphing&lt;br /&gt;• links Web browser&lt;br /&gt;miscellaneous&lt;br /&gt;• alias hd='od -Ax -tx1z -v' Handy hexdump. (usage e.g.: • hd /proc/self/cmdline | less)&lt;br /&gt;• alias realpath='readlink -f' Canonicalize path. (usage e.g.: • realpath ~/../$USER)&lt;br /&gt;• set | grep $USER Search current environment&lt;br /&gt;  touch -c -t 0304050607 file Set file timestamp (YYMMDDhhmm)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;####################################################################################&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-2754739078484959229?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/2754739078484959229/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=2754739078484959229&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/2754739078484959229'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/2754739078484959229'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2008/03/command-line-examples-linux.html' title='Command Line Examples linux'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-586145785817986775</id><published>2008-03-26T21:56:00.000+05:30</published><updated>2008-03-26T21:58:01.400+05:30</updated><title type='text'>World of FIND Commands in LINUX</title><content type='html'>&lt;strong&gt;&lt;h2&gt;&lt;br /&gt;FIND COMMANDS&lt;/h2&gt; &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;sudo find / -type f -name *.jpg  -exec cp {} . \;&lt;br /&gt;&lt;br /&gt;find . -type f -size +10000 -exec ls -al {} \;&lt;br /&gt;find . -atime +1 -type f -exec mv {} TMP \; # mv files older then 1 day to dir TMP&lt;br /&gt;find . -name "-F" -exec rm {} \;   # a script error created a file called -F &lt;br /&gt;find . -exec grep -i "vds admin" {} \;&lt;br /&gt;find . \! -name "*.Z" -exec compress -f {} \;&lt;br /&gt;find . -type f \! -name "*.Z" \! -name ".comment" -print | tee -a /tmp/list&lt;br /&gt;find . -name *.ini&lt;br /&gt;find . -exec chmod 775 {} \;&lt;br /&gt;find . -user xuser1 -exec chown -R user2 {} \;&lt;br /&gt;find . -name ebtcom*&lt;br /&gt;find . -name mkbook&lt;br /&gt;find . -exec grep PW0 {} \;&lt;br /&gt;find . -exec grep -i "pw0" {} \;&lt;br /&gt;find . -atime +6&lt;br /&gt;find . -atime +6 -exec ll | more&lt;br /&gt;find . -atime +6 -exec ll | more \;&lt;br /&gt;find . -atime +6 -exec ll \;&lt;br /&gt;find . -atime +6 -exec ls \;&lt;br /&gt;find . -atime +30 -exec ls \;&lt;br /&gt;find . -atime +30 -exec ls \; | wc -l&lt;br /&gt;find . -name auth*&lt;br /&gt;find . -exec grep -i plotme10 {};&lt;br /&gt;find . -exec grep -i plotme10 {} \;&lt;br /&gt;find . -ls -exec grep 'PLOT_FORMAT 22' {} \;&lt;br /&gt;find . -print -exec grep 'PLOT_FORMAT 22' {} \;&lt;br /&gt;find . -print -exec grep 'PLOT_FORMAT' {} \;&lt;br /&gt;find . -print -exec grep 'PLOT_FORMAT' {} \;&lt;br /&gt;find ./machbook -exec chown 184 {} \;&lt;br /&gt;find . \! -name '*.Z' -exec compress {} \;&lt;br /&gt;find . \! -name "*.Z" -exec compress -f {} \;&lt;br /&gt;find /raid/03c/ecn -xdev -type f -print&lt;br /&gt;find /raid/03c/ecn -xdev -path -type f -print&lt;br /&gt;find / -name .ssh* -print | tee -a ssh-stuff&lt;br /&gt;find . -name "*font*"&lt;br /&gt;find . -name hpmcad*&lt;br /&gt;find . -name *fnt*&lt;br /&gt;find . -name hp_mcad* -print&lt;br /&gt;find . -grep Pld {} \;&lt;br /&gt;find . -exec grep Pld {} \;&lt;br /&gt;find . -exec grep Pld {} \;&lt;br /&gt;find . -exec grep PENWIDTH {} \; | more&lt;br /&gt;find . -name config.pro&lt;br /&gt;find . -name config.pro&lt;br /&gt;find /raid -type d ".local_sd_customize" -print&lt;br /&gt;find /raid -type d -name ".local_sd_customize" -print&lt;br /&gt;find /raid -type d -name ".local_sd_customize" -ok cp /raid/04d/MCAD-apps/I_Custom/SD_custom/site_sd_customize/user_filer_project_dirs {} \;&lt;br /&gt;find /raid -type d -name ".local_sd_customize" -exec cp /raid/04d/MCAD-apps/I_Custom/SD_custom/site_sd_customize/user_filer_project_dirs {} \;&lt;br /&gt;find . -name xeroxrelease&lt;br /&gt;find . -exec grep xeroxrelease {} \;&lt;br /&gt;find . -name xeroxrelease&lt;br /&gt;find . -name xeroxrelease* -print 2&gt;/dev/null&lt;br /&gt;find . -name "*release*" 2&gt;/dev/null&lt;br /&gt;find / -name "*xerox*" 2&gt;/dev/null&lt;br /&gt;find . -exec grep -i xeroxrelease {} \;&lt;br /&gt;find . -print -exec grep -i xeroxrelease {} \;&lt;br /&gt;find . -print -exec grep -i xeroxrelease {} \; &gt; xeroxrel.lis&lt;br /&gt;find . -exec grep -i xeroxrel {} \;&lt;br /&gt;find . -print -exec grep -i xeroxrel {} \;&lt;br /&gt;find . -print -exec grep -i xeroxrel {} \; | more&lt;br /&gt;find /raid/03c/inwork -xdev -type f -print &gt;&gt; /raid/04d/user_scripts/prt_list.tmp&lt;br /&gt;find . -exec grep '31.53' {} \;&lt;br /&gt;find . -ls -exec grep "31/.53" {} \; &gt; this.lis&lt;br /&gt;find . -print -exec grep "31/.53" {} \; &gt; this.lis&lt;br /&gt;find . -print -exec grep 31.53 {} \; &gt; this.lis&lt;br /&gt;find . -exec grep -i pen {} /;&lt;br /&gt;find . -exec grep -i pen {} \;&lt;br /&gt;find . -print -exec grep -i pen {} \; | more&lt;br /&gt;find . -exec grep -i pen {} \;&lt;br /&gt;find . -atime +6 -exec ll | more \;&lt;br /&gt;find . -atime +6 -exec ll \;&lt;br /&gt;find . -atime +6 -exec ls \;&lt;br /&gt;find . -atime +30 -exec ls \;&lt;br /&gt;find . -atime +30 -exec ls \; | wc -l&lt;br /&gt;find . \! -name '*.Z' -exec compress -f {} \;&lt;br /&gt;find . -name 'cache*' -depth -exec rm {} \;&lt;br /&gt;find . -name 'cache*' -depth -print | tee -a /tmp/cachefiles&lt;br /&gt;find . -name 'cache[0-9][0-9]*' -depth -print | tee -a /tmp/cachefiles&lt;br /&gt;find . -name 'hp_catfile' 'hp_catlock' -depth -print | tee -a /tmp/hp.cats&lt;br /&gt;find . -name 'hp_catfile' -name 'hp_catlock' -depth -print | tee -a /tmp/hp.cats&lt;br /&gt;find . -name 'hp_cat*' -depth -print | tee -a /tmp/hp.cats&lt;br /&gt;find . -name 'hp_cat[fl]*' -depth -print | tee -a /tmp/hp.cats&lt;br /&gt;find /raid -name 'hp_cat[fl]*' -depth -print&lt;br /&gt;find . \! -name '*.Z' -exec compress -f {} \;&lt;br /&gt;find . -name '*' -exec compress -f {} \;&lt;br /&gt;find . -xdev -name "wshp1*" -print&lt;br /&gt;find . -xdev -name "wagoneer*" -print&lt;br /&gt;find . -name "xcmd" -depth -print&lt;br /&gt;find /usr/contrib/src -name "xcmd" -depth -print&lt;br /&gt;find /raid -type d -name ".local_sd_customize" -exec ls {} \; &lt;br /&gt;find /raid -type d -name ".local_sd_customize" \&lt;br /&gt;   -exec cp /raid/04d/MCAD-apps/I_Custom/SD_custom/site_sd_customize/user_filer_project_dirs {} \;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-586145785817986775?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/586145785817986775/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=586145785817986775&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/586145785817986775'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/586145785817986775'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2008/03/world-of-find-commands-in-linux.html' title='World of FIND Commands in LINUX'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-9069932135832674565</id><published>2008-03-26T21:47:00.004+05:30</published><updated>2008-03-26T21:54:58.588+05:30</updated><title type='text'>Qmail Tip sand Tricks 2</title><content type='html'>&lt;strong&gt;&lt;h1&gt;Mail to Valid Users Is Bouncing or Disappearing&lt;/h1&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;If you use users/assign as described in Chapter 15, a common mistake is to add a user to the system without updating the users file. Fortunately, this oversight is easily remedied:&lt;br /&gt;&lt;br /&gt;# cd /var/qmail/users; make&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;h1&gt;Delivering Mail on Intermittent Connections&lt;/h1&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If your qmail system is a hub host for remote systems that connect intermittently by dialup, it is straightforward but messy to deliver the mail while the remote systems are connected.&lt;br /&gt;&lt;br /&gt;One approach is to create a flag file in a known directory when a host connects and delete the file when the host disconnects. Then run a script periodically from cron that loops over all of the flag files to push out mail to currently connected hosts.&lt;br /&gt;&lt;br /&gt;To flesh out this example, assume there are three dialup hosts called red.example.com, blue.example.com, and green.example.com. Create virtualdomains that give them different virtual domain prefixes:&lt;br /&gt;&lt;br /&gt;red.example.com:alias-dial-red&lt;br /&gt;blue.example.com:alias-dial-blue&lt;br /&gt;green.example.com:alias-dial-green&lt;br /&gt;&lt;br /&gt;You can put all of the alias-dial mail into one Maildir since the Delivered-To: prefixes keep them separate. To put all the mail for the three hosts into ~alias/dialmail/, create ~alias/.qmail-dial-default containing the line ./dialmail/.&lt;br /&gt;&lt;br /&gt;To track the currently connected hosts, put the flag files into ~alias/dialflags and have the dialup connection script create a file with the host's simple name (red, blue, or green) in that directory containing the host's current IP address. Then run this script from cron to push out the mail to whichever hosts are currently connected:&lt;br /&gt;&lt;br /&gt;#!/bin/sh&lt;br /&gt;#  run this every 15 minutes from cron to push out the mail&lt;br /&gt;&lt;br /&gt;cd /var/qmail/alias/dialflags&lt;br /&gt;&lt;br /&gt;for hn in *&lt;br /&gt;do&lt;br /&gt;  ip=$(cat $hn) # IP address in the flag file&lt;br /&gt;  &lt;br /&gt;  setlock ../$hn.lock \  # lock deliveries to this host&lt;br /&gt;       maildirsmtp /var/qmail/alias/dialmail \&lt;br /&gt;         alias-dial-$hn- $ip my.example.com 2&gt;&amp;1 |&lt;br /&gt;      splogger serial&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;If you also want to push out any waiting mail as soon as a host connects, also put a call to maildirsmtp into the host's connection script. Be sure to use the same lock file to avoid confusion if the cron job happens to run at the same time. If you add another host called purple, you only need to add another line to virtualdomains:&lt;br /&gt;&lt;br /&gt;purple.example.com:alias-dial-purple&lt;br /&gt;&lt;br /&gt;The remote hosts can use a similar setup to forward their mail to the main host, using a single smarthost entry in virtualdomains.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;h1&gt;Code in extra.h to copy everything to log&lt;/h1&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#define QUEUE_EXTRA "Tlog\0"&lt;br /&gt;#define QUEUE_EXTRALEN 5&lt;br /&gt;&lt;br /&gt;Now every message will be copied to the address log, so you can create ~alias/.qmail-log to save the mail:&lt;br /&gt;&lt;br /&gt;./logmaildir/&lt;br /&gt;&lt;br /&gt;The .qmail file must save the mail but cannot forward it. Why not? Because forwarding mail invokes qmail-queue again, which will redeliver the mail to log, creating a nasty mail loop.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;h1&gt;Deleting Stale Mail&lt;/h1&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;cd /home&lt;br /&gt;{&lt;br /&gt;   # unread mail over a month old  &lt;br /&gt;   find /home/*/Maildir/new -type f -mtime +30 -p&lt;br /&gt;   # read mail over three months&lt;br /&gt;   find /home/*/Maildir/cur -type f -mtime +90 -p    &lt;br /&gt;   # any mail marked deleted&lt;br /&gt;   find */Maildir -type f -name "*:2,*T*" -print&lt;br /&gt;   # any mail in Trash/new or cur&lt;br /&gt;   find */Maildir/.Trash/??? -type f -print&lt;br /&gt;} | xargs -t rm&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;h1&gt;Web Sites&lt;/h1&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;There are several excellent sources of qmail information online.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;http://cr.yp.to&lt;br /&gt;&lt;br /&gt;    Dan Bernstein's web site, the official source for qmail and all of his ad-on packages.&lt;br /&gt;&lt;br /&gt;http://www.qmail.org&lt;br /&gt;&lt;br /&gt;    Russ Nelson's qmail resource site, intended to have links to all of the other resources on the Web.&lt;br /&gt;&lt;br /&gt;http://qmail.gurus.com&lt;br /&gt;&lt;br /&gt;    The author's companion site for this book, containing scripts, updates and corrections, links to other resources, and ordering info for more copies.&lt;br /&gt;&lt;br /&gt;http://www.lifewithqmail.org&lt;br /&gt;&lt;br /&gt;    Dave Sill's Life with qmail, an online guide to setting up and using qmail. It offers specific advice about where to install qmail, and where to put all of the files and directories that qmail needs. This is by far the most widely used setup and the one that qmail experts are the most familiar with, so it's the one you should use. The file and directory locations used in this book are consistent with these.&lt;br /&gt;&lt;br /&gt;http://www.lifewithqmail.org/ldap/&lt;br /&gt;&lt;br /&gt;    Henning Brauer's Life with qmail-ldap, a guide to setting up qmail-ldap. Indispensable for qmail-ldap users.&lt;br /&gt;&lt;br /&gt;http://www.ezmlm.org&lt;br /&gt;&lt;br /&gt;    The home page for the ezmlm-idx mailing list manager, with software and documentation.&lt;br /&gt;&lt;br /&gt;http://tinydns.org&lt;br /&gt;&lt;br /&gt;    Russ Nelson's site for Dan Bernstein's djbdns, a DNS package that relates to BIND roughly as qmail relates to sendmail. Not required for qmail, but if you're setting up a DNS server along with your mail server, it's probably the software you want to use.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-9069932135832674565?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/9069932135832674565/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=9069932135832674565&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/9069932135832674565'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/9069932135832674565'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2008/03/qmail-tip-sand-tricks-2.html' title='Qmail Tip sand Tricks 2'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-7388262617893153828</id><published>2008-03-26T21:42:00.003+05:30</published><updated>2008-03-26T21:46:51.410+05:30</updated><title type='text'>Qmail Tips and Tricks</title><content type='html'>&lt;strong&gt;&lt;h1&gt;Qmail Won't Compile&lt;/h1&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;You have unpacked the qmail sources and typed make, but it won't compile. If you're receiving error messages about errno, you've run into a compatibility problem between qmail and recent versions of the GNU C library. The fix is very simple. See Building with Recent GLIBC and Fixing the errno Problem in Chapter 3.&lt;br /&gt;&lt;br /&gt;(This is the number one question on the qmail mailing list, so frequent that there's an autoresponder that mails back the answer to any message that contains the word "errno".)&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;h1&gt;Why Qmail Is Delivering Mail Very Slowly&lt;/h1&gt;&lt;/strong&gt;&lt;br /&gt;If qmail seems to wait about half a minute to do anything when you inject mail, the problem is almost certainly that the lock/trigger file used to communicate between qmail-queue and qmail-send is messed up. That file should be a named pipe:&lt;br /&gt;&lt;br /&gt;# ls -l /var/qmail/queue/lock/trigger&lt;br /&gt;prw--w--w-  1 qmails  qmail  0 Nov  7 03:02 /var/qmail/queue/lock/trigger&lt;br /&gt;&lt;br /&gt;If it's a regular file or anything other than a pipe, you have a problem. Fortunately, it's a problem that's easy to fix:&lt;br /&gt;&lt;br /&gt;# svc -td /service/qmail-send   # shut qmail down for a minute&lt;br /&gt;# tail -f /service/qmail-send/log/main/current&lt;br /&gt;# # wait until the log says that it's exited&lt;br /&gt;# rm /var/qmail/queue/lock/trigger  # remove bogus trigger&lt;br /&gt;# cd wherever you built qmail from source&lt;br /&gt;# make setup check   # recreates all the crucial files including trigger&lt;br /&gt;# svc -u /service/qmail-send    # restart qmail&lt;br /&gt;&lt;br /&gt;This is the second most frequently asked question on the qmail mailing list, and tends to get aggrieved responses pointing out that the answer is in the archives about a hundred times. So don't ask it, because now you know the answer.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;h1&gt;Daemons Won't Start, or They Start and Crash Every Few Seconds&lt;/h1&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Starting a daemon under svscan and supervise is simple in concept, although the details can bite you. The super-daemon is started at system boot time by running /command/svscanboot. It runs svscan to control daemons and the useful but obscure readproctitle, which takes any error messages from svscan and puts them into its command area so that ps will show it.[1]&lt;br /&gt;&lt;br /&gt;    [1] This odd way of displaying error messages is intended to work even in the presence of serious configuration screwups like disks that should be mounted but aren't and directories that are supposed to be writable but aren't.&lt;br /&gt;&lt;br /&gt;Every five seconds svscan looks at all of the subdirectories of /service and starts up a supervise process on any that don't have one running. In the usual case that the subdirectory in turn has a subdirectory called log, it starts a second supervise process in the subdirectory and pipes the output from the first process to the second.&lt;br /&gt;&lt;br /&gt;When supervise starts up a daemon, it runs the file run in the daemon's directory. That file has to be a runnable program that either is or, more commonly, exec's the daemon itself. That means that run has to have its execute bits set and, if it's a shell script, start with #!/bin/sh so that it's runnable. If either of those isn't the case, there is a failed attempt to start the daemon every five seconds. A ps l that shows readproctitle should reveal the error messages and give hints about what needs to be fixed.&lt;br /&gt;&lt;br /&gt;The run script generally sets up the program environment and then exec's the actual daemon. If you become super-user and type ./run, the daemon should start. If that works, the daemon still doesn't start, and you don't use full program paths in the run file, the problem is most likely that the search path that supervise uses isn't the same as the one you're using. Look at /command/svscanboot to see the search patch that it uses. Most notably, it does not include /var/qmail/bin unless you edit the file yourself to include it.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;h1&gt;Nothing Gets Logged&lt;/h1&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Sometimes the daemon runs but nothing's going into the log files. This generally is due to either file protection problems or an incorrect set of multilog options. The usual way to run multilog is to create a subdirectory called main in which it rotates log files. It's safer to run daemons as a user other than root, so when possible, use qmaill, the qmail log user. A common error is to forget to change the ownership of the log file directory to qmaill (or whatever the log user is). When multilog starts successfully, it creates a current log file in the directory, so if there's no main/current, the most likely problem is directory ownership or protection.&lt;br /&gt;&lt;br /&gt;If multilog is running but there's nothing logged, the most likely problems are that the daemon isn't sending anything to log, or that multilog's options are telling it to discard everything. Because the daemon and the logger are connected with a regular Unix pipe, only messages sent to the daemon's standard output go to the logger. In particular, anything sent to standard error shows up in readproctitle, not the log. If, as is usually the case, you want to log the errors a daemon reports, just redirect the error output to the standard output in the run script with the standard shell redirect 2&gt;&amp;1. (That redirect is at the end of just about every run script example in this book.)&lt;br /&gt;&lt;br /&gt;If the daemon is a program originally intended to run as a standalone daemon rather than under daemontools, it probably sends its reports to syslog, not to standard output or standard error. In most cases, there is an option to send messages to stdout or stderr.&lt;br /&gt;&lt;br /&gt;If you are using multilog options to select what to log, be sure that you're selecting what you think you are. In particular, its pattern language resembles shell wildcards but is in fact considerably weaker because it doesn't move ahead or back up on a failed match. (Patterns do resemble shell wildcards closely enough that they should always be quoted to keep the shell from messing with them.) The pattern must match the whole line, and stars stop matching the moment they see the following character in the pattern. If a pattern is, say, +'+*: status: *', it will match one: status: two, but it will not match one: two: status: three, because the star will stop at the first colon and won't look for the second one. If the pattern didn't have the star at the end, it wouldn't match anything useful because it wouldn't match any lines with anything after the status:. In practice, most log file messages have a pretty simple syntax, and it's not hard to come up with adequate patterns if you keep in mind the limitations of the pattern-matching language. For debugging, start with no patterns to be sure that the stream of messages going into the log files contains what you expect, then add one or two patterns at a time and restart multilog with svc -t and see what's going into main/current each time until it looks right.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;h1&gt;Daemons Are Running but Making No Progress&lt;/h1&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;One of the most baffling problems occurs when the daemon seems OK, the logger seems OK, but the daemon's not doing anything. What's wrong? Usually the problem is that the disk to which the log files are written has filled up or is mounted read-only. Because multilog is designed not to lose any log data, if it can't write to the disk, it just waits and retries until it can. This means that the pipe between the daemon and multilog fills up and the daemon stalls waiting to be able to write to the pipe. The solution is to delete some files and fix whatever it was that filled up the disk so it doesn't happen again. If the disk is full of files written by various multilog loggers, adding or adjusting s and n options to set the maximum size and number of log files can help.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;h1&gt;Mail Rejected with Stray Newline Reports&lt;/h1&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The SMTP spec says that the way that each line of text in an SMTP session ends is with a carriage return/line feed pair (0d 0a in hex or \r\n in C.) Some buggy MUAs and MTAs only try to send mail that contains linefeeds with no preceding carriage return. Qmail's SMTP daemon normally rejects such mail with a log message like Stray newline from 10.2.3.4 because there's no way to tell whether the bare linefeed is just missing a carriage return or it's some kind of malformed binary data.&lt;br /&gt;&lt;br /&gt;If you're seeing stray newline entries in your logs and you're reasonably sure that they're being sent by MTAs or MUAs that intend them to be handled as an end-of-line, use the fixcrio program from the ucspi-tcp package to placate the SMTP daemon. Modify the run script for qmail-smtpd so that it pipes mail through fixcrio, as shown in Example 18-1:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;h3&gt;Example SMTP daemon that forgives stray newlines&lt;/h3&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt; 1. #!/bin/sh&lt;br /&gt; 2. limit datasize 3m&lt;br /&gt; 3. exec tcpserver \&lt;br /&gt; 4.    -u000 -g000 -v -p -R \&lt;br /&gt; 5.      0 25 \&lt;br /&gt; 6. /usr/local/bin/fixcrio | /var/qmail/bin/qmail-smtpd" 2&gt;&amp;1&lt;br /&gt;&lt;br /&gt;Line 6 is the modified one, starting up fixcrio and qmail-smtpd. When fixcrio runs, it passes the input and output of qmail-smtpd through pipes so it can add missing carriage returns in front of newlines as needed. In the longer run, see if you can persuade your correspondents to upgrade their SMTP clients to newer, less buggy versions.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-7388262617893153828?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/7388262617893153828/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=7388262617893153828&amp;isPopup=true' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/7388262617893153828'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/7388262617893153828'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2008/03/qmail-tips-and-tricks.html' title='Qmail Tips and Tricks'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-5830151643074858714</id><published>2008-02-28T16:27:00.002+05:30</published><updated>2008-02-28T16:29:16.287+05:30</updated><title type='text'>How Do I Enable remote access to MySQL database server?</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Step # 1: Login over ssh if server is outside your IDC&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;First, login over ssh to remote MySQL database server&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Step # 2: Enable networking&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Once connected you need edit the mysql configuration file my.cfg using text editor such as vi.&lt;br /&gt;&lt;br /&gt;    * If you are using Debian Linux file is located at /etc/mysql/my.cnf location&lt;br /&gt;    * If you are using Red Hat Linux/Fedora Linux file is located at /etc/my.cnf location&lt;br /&gt;    * If you are using FreeBSD you need to create a file /var/db/mysql/my.cnf&lt;br /&gt;&lt;br /&gt;# vi /etc/my.cnf&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Step # 3: Once file open, locate line that read as&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;[mysqld]&lt;br /&gt;Make sure line skip-networking is commented (or remove line) and add following line&lt;br /&gt;bind-address=YOUR-SERVER-IP&lt;br /&gt;&lt;br /&gt;For example, if your MySQL server IP is 65.55.55.2 then entire block should be look like as follows:&lt;br /&gt;[mysqld]&lt;br /&gt;user = mysql&lt;br /&gt;pid-file = /var/run/mysqld/mysqld.pid&lt;br /&gt;socket = /var/run/mysqld/mysqld.sock&lt;br /&gt;port = 3306&lt;br /&gt;basedir = /usr&lt;br /&gt;datadir = /var/lib/mysql&lt;br /&gt;tmpdir = /tmp&lt;br /&gt;language = /usr/share/mysql/English&lt;br /&gt;bind-address = 65.55.55.2&lt;br /&gt;# skip-networking&lt;br /&gt;....&lt;br /&gt;..&lt;br /&gt;....Where,&lt;br /&gt;&lt;br /&gt;    * bind-address : IP address to bind to.&lt;br /&gt;    * skip-networking : Don’t listen for TCP/IP connections at all. All interaction with mysqld must be made via Unix sockets. This option is highly recommended for systems where only local requests are allowed. Since you need to allow remote connection this line should removed from file or put it in comment state.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Step# 4 Save and Close the file&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Restart your mysql service to take change in effect:# /etc/init.d/mysql restart&lt;br /&gt;Step # 5 Grant access to remote IP address&lt;br /&gt;&lt;br /&gt;# mysql -u root -p mysqlGrant access to new database&lt;br /&gt;If you want to add new database called foo for user bar and remote IP 202.54.10.20 then you need to type following commands at mysql&gt; prompt:mysql&gt; CREATE DATABASE foo;&lt;br /&gt;mysql&gt; GRANT ALL ON foo.* TO bar@'202.54.10.20' IDENTIFIED BY 'PASSWORD';&lt;br /&gt;How Do I Grant access to existing database?&lt;br /&gt;&lt;br /&gt;Let us assume that you are always making connection from remote IP called 202.54.10.20 for database called webdb for user webadmin, To grant access to this IP address type the following command At mysql&gt; prompt for existing database:mysql&gt; update db set Host='202.54.10.20' where Db='webdb';&lt;br /&gt;mysql&gt; update user set Host='202.54.10.20' where user='webadmin';&lt;br /&gt;Step # 5: Logout of MySQL&lt;br /&gt;&lt;br /&gt;Type exit command to logout mysql:mysql&gt; exit&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Step # 6: Test it&lt;/span&gt;&lt;br /&gt;From remote system type command:&lt;br /&gt;&lt;br /&gt;$ mysql -u webadmin –h 65.55.55.2 –p&lt;br /&gt;&lt;br /&gt;Where,&lt;br /&gt;&lt;br /&gt;    * -u webadmin: webadmin is MySQL username&lt;br /&gt;    * -h IP or hostname: 65.55.55.2 is MySQL server IP address or hostname (FQDN)&lt;br /&gt;    * -p : Prompt for password&lt;br /&gt;&lt;br /&gt;You can also use telnet to connect to port 3306 for testing purpose:&lt;br /&gt;$ telnet 65.55.55.2 3306&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-5830151643074858714?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/5830151643074858714/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=5830151643074858714&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/5830151643074858714'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/5830151643074858714'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2008/02/step-1-login-over-ssh-if-server-is.html' title='How Do I Enable remote access to MySQL database server?'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-4667849080292614335</id><published>2008-02-28T16:21:00.002+05:30</published><updated>2008-02-28T16:26:22.097+05:30</updated><title type='text'>SMTP and POP with SSL (ucspi-tls-qmail-howto)</title><content type='html'>&lt;h1&gt;Why You Want To Use UCSPI-TLS&lt;/h1&gt;  &lt;p&gt;&lt;a href="http://www.suspectclass.com/%7Esgifford/ucspi-tls/"&gt;UCSPI-TLS&lt;/a&gt; is a &lt;a href="http://www.suspectclass.com/%7Esgifford/ucspi-tls/ucspi-tls.txt"&gt;protocol&lt;/a&gt; for adding "delayed encryption" to Dan Bernstein's Unix Client/Server Program Interface protocol.  "Delayed encryption" means a session starts off in plaintext, then a command is issued to turn on encryption, encryption is negotiated, and the session restart.  This has become a very common way to handle encryption, because it simplifies client configuration and requires only one TCP port.  &lt;/p&gt;&lt;p&gt;These are the goals of UCSPI-TLS:  &lt;/p&gt;&lt;ul&gt;&lt;li&gt;Simple, UCSPI-compatible use.  &lt;/li&gt;&lt;li&gt;Support for both traditional SSL and delayed encryption through STARTTLS or similar.  &lt;/li&gt;&lt;li&gt;All SSL/TLS code in one place.  &lt;/li&gt;&lt;li&gt;Minimal changes required for each server.  &lt;/li&gt;&lt;li&gt;Support for "privilege separation", so that encryption can happen in a low-privilege subprocess.  &lt;/li&gt;&lt;/ul&gt;  &lt;p&gt;In particular, I believe the privilege separation feature increases your system's security significantly.  It creates a dedicated process to handle each encrypted connection, and this process can change its root directory and switch to a low-privilege user and group.  Because of its complexity, OpenSSL has had its share of security bugs.  Doing encryption in a low-privilege process ensures that the impact of any security bugs is minimized.    &lt;/p&gt;&lt;h1&gt;How to install UCSPI-TLS for netqmail-1.05&lt;/h1&gt;  UCSPI-TLS is currently implemented as patches to existing programs. To install it, first download the programs you want to use, apply the UCSPI-TLS patches, install the programs as you normally would, and finally make the appropriate changes to your configuration files.  &lt;p&gt;Here are more details on doing this with netqmail version 1.05.  &lt;/p&gt;&lt;ol&gt;&lt;li&gt;Become &lt;tt&gt;root&lt;/tt&gt;, using &lt;tt&gt;su&lt;/tt&gt; or &lt;tt&gt;sudo bash&lt;/tt&gt;. Some of these steps require you to have superuser privileges, and its easier just to get them now than to switch back and forth throughout the process.  &lt;h2&gt;Do a base qmail install&lt;/h2&gt; &lt;/li&gt;&lt;li&gt;Install qmail according to &lt;a href="http://www.lifewithqmail.org/lwq.html"&gt;Life with qmail&lt;/a&gt; , and make sure everything works with a standard setup.  &lt;h2&gt;Install a patched ucspi-ssl+tls&lt;/h2&gt;  &lt;/li&gt;&lt;li&gt;Make sure you have a recent version of OpenSSL installed on your system, along with the files required for development with the library.  If you don't already have it installed, this should be available from your OS install CDs, with a name like libssl-dev or openssl-devel.  If all else fails, you can &lt;a href="http://www.openssl.org/"&gt;download OpenSSL&lt;/a&gt; and compile it yourself.  &lt;/li&gt;&lt;li&gt;Download &lt;a href="http://www.superscript.com/ucspi-ssl/ucspi-ssl-0.70.tar.gz"&gt;ucspi-ssl 0.70&lt;/a&gt;, and unpack it.  It will create a directory &lt;tt&gt;host/superscript.com/net/ucspi-ssl-0.70&lt;/tt&gt;; &lt;tt&gt;cd&lt;/tt&gt; into this directory.  Here's some commands to cut-n-paste:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;wget http://www.superscript.com/ucspi-ssl/ucspi-ssl-0.70.tar.gz&lt;br /&gt;gunzip -cd ucspi-ssl-0.70.tar.gz |tar xf -&lt;br /&gt;cd host/superscript.com/net/ucspi-ssl-0.70&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt; &lt;/li&gt;&lt;li&gt;Download &lt;a href="http://www.suspectclass.com/%7Esgifford/ucspi-tls/files/ucspi-ssl-0.70-ucspitls-0.1.patch"&gt;ucspi-tls patch to ucspi-ssl&lt;/a&gt; (you can also read the &lt;a href="http://www.suspectclass.com/%7Esgifford/ucspi-tls/files/ucspi-ssl-0.70-ucspitls-0.1.readme"&gt;ucspitls for ucsp-ssl patch README&lt;/a&gt;), and apply the patch:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;wget http://www.suspectclass.com/~sgifford/ucspi-tls/files/ucspi-ssl-0.70-ucspitls-0.1.patch&lt;br /&gt;patch -p1 &lt; ucspi-ssl-0.70-ucspitls-0.1.patch&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;  &lt;/li&gt;&lt;li&gt;If anything is already using an older copy of &lt;tt&gt;sslserver&lt;/tt&gt;, shut it off now.  &lt;/li&gt;&lt;li&gt;Compile and install the patched ucspi-ssl+tls, by running &lt;tt&gt;package/compile base&lt;/tt&gt; then &lt;tt&gt;package/install base&lt;/tt&gt;:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;package/compile base&lt;br /&gt;package/install base&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt; You now have a patched copy of &lt;tt&gt;sslserver&lt;/tt&gt; in &lt;tt&gt;/usr/local/bin/sslserver&lt;/tt&gt;.  Congratulations!  &lt;h2&gt;Patch qmail&lt;/h2&gt;  &lt;/li&gt;&lt;li&gt;The next step is to patch qmail to add TLS support to its SMTP and POP servers.  If you followed &lt;i&gt;Life with qmail&lt;/i&gt; religiously, your qmail source code will be in &lt;tt&gt;/usr/local/src/netqmail-1.05/netqmail-1.05&lt;/tt&gt;.  &lt;tt&gt;cd&lt;/tt&gt; to that directory, or wherever you have the qmail source:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;cd /usr/local/src/netqmail-1.05/netqmail-1.05&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;  &lt;/li&gt;&lt;li&gt;Now download &lt;a href="http://www.suspectclass.com/%7Esgifford/ucspi-tls/files/netqmail-1.05-ucspitls-0.3.patch"&gt;the ucspi-tls patch to netqmail&lt;/a&gt; (and read the &lt;a href="http://www.suspectclass.com/%7Esgifford/ucspi-tls/files/netqmail-1.05-ucspitls-0.3.readme"&gt;ucspitls patch for netqmail README&lt;/a&gt;), and apply the patch:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;wget http://www.suspectclass.com/~sgifford/ucspi-tls/files/netqmail-1.05-ucspitls-0.3.patch&lt;br /&gt;patch -p2 &lt; netqmail-1.05-ucspitls-0.3.patch&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;  &lt;/li&gt;&lt;li&gt;If qmail is running, shut it down.  On a &lt;i&gt;Life with qmail&lt;/i&gt; setup, you do this by running:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;/var/qmail/bin/qmailctl stop&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;  &lt;/li&gt;&lt;li&gt;Recompile and re-install qmail by running &lt;tt&gt;make setup check&lt;/tt&gt;:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;make setup check&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt; You now have a copy of qmail-smtpd and qmail-popup with TLS support  &lt;h2&gt;Make your certificates&lt;/h2&gt;  &lt;/li&gt;&lt;li&gt;Next you'll need SSL certificates.  These certificates contain the encryption keys used to communicate with your servers, and possibly a signature from a trusted authority confirming your server's identity. The first thing you'll need is a place to store them.  Let's put them in &lt;tt&gt;/var/qmail/ssl&lt;/tt&gt;:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;mkdir /var/qmail/ssl&lt;br /&gt;chown root /var/qmail/ssl&lt;br /&gt;chmod 700 /var/qmail/ssl&lt;br /&gt;cd /var/qmail/ssl&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;  &lt;/li&gt;&lt;li&gt;Create the SSL keys for your system.  We'll store the certificate     in a file named &lt;tt&gt;cert&lt;/tt&gt;, and the key in &lt;tt&gt;key&lt;/tt&gt;.  If     you already have certificates you'd like to use, separate out the     certificate part (the &lt;tt&gt;key&lt;/tt&gt; part will generally be labeled     &lt;tt&gt;RSA PRIVATE KEY&lt;/tt&gt;, and the &lt;tt&gt;cert&lt;/tt&gt; part &lt;tt&gt;CERTIFICATE&lt;/tt&gt;.  You can just copy these sections from your certificate file, and paste them into the appropriate files.      &lt;p&gt;You'll have to decide whether you want to use an unsigned certificate or a certificate signed by a Certificate Authority (CA). If you hire a CA to verify your identity and sign your certificate, clients are more likely to accept this certificate without prompting the user.  If you use your own unsigned certificate, clients may have to confirm that they trust your certificate.      &lt;/p&gt;&lt;p&gt;If you'd like to use a signed certificate, choose a CA, and follow their directions to obtain a signed certificate.  Save the certificate in a file called &lt;tt&gt;cert&lt;/tt&gt;, and the key in a file called &lt;tt&gt;key&lt;/tt&gt;.  If you just have one file containing both of these, see the beginning of this step for suggestions on how to split it up.      &lt;/p&gt;&lt;p&gt;If you'd like to use an unsigned certificate, follow these steps:       &lt;/p&gt;&lt;ol&gt;&lt;li&gt; Make sure openssl is installed on your system.          &lt;/li&gt;&lt;li&gt; Set a &lt;tt&gt;umask&lt;/tt&gt; that will keep your files protected, by running:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;umask 077&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;          &lt;/li&gt;&lt;li&gt; Generate a certificate by running:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;openssl req -new -x509 -keyout key.enc -out cert -days 360&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt; Answer the questions you're asked.  Your password is temporary, so it doesn't matter what it is as long as you remember it for a few minutes; you can even write it down.  Make sure you use the server's host name, as clients will be configured to connect to it, as the "Common Name" for the certificate.  &lt;b&gt;Note that this certificate will expire in 360 days&lt;/b&gt;, and you'll have to create a new one before then.  &lt;p&gt;You'll now have a file called &lt;tt&gt;key.enc&lt;/tt&gt; containing your encrypted key, and a file called &lt;tt&gt;cert&lt;/tt&gt; containing your certificate.          &lt;/p&gt;&lt;/li&gt;&lt;li&gt; Remove the password from your certificate, so the server can start automatically.  You can do this by running:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;openssl rsa -in key.enc -out key&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt; Enter the password you chose above, and you'll have a file called &lt;tt&gt;key&lt;/tt&gt; containing an unencrypted copy of your key.      &lt;/li&gt;&lt;/ol&gt;  &lt;/li&gt;&lt;li&gt;Create a Diffie-Hellman parameter file.  I usually create 1024-bit &lt;tt&gt;dhparam&lt;/tt&gt; files, but I'll admit I don't know exactly what they do.  I should probably find out and put it here.  You can use the command&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;openssl dhparam -out dhparam 1024&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt; to generate a 1024-bit Diffie-Hellman parameter file.  &lt;/li&gt;&lt;li&gt;Add a user and group for SSL to drop privileges too; name them both &lt;tt&gt;ssl&lt;/tt&gt;.  How to do this depends on your OS and what tools it provides; you can find some examples in the &lt;tt&gt;qmail&lt;/tt&gt; source directory in a file called &lt;tt&gt;INSTALL.ids&lt;/tt&gt;.  For example, on Linux you would run:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;groupadd ssl&lt;br /&gt;useradd -g ssl -d /var/qmail ssl&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;  If you can't figure out any OS-specific commands, edit the &lt;tt&gt;/etc/group&lt;/tt&gt; and &lt;tt&gt;/etc/passwd&lt;/tt&gt; files directly, using the file format described in the system manpages for group(5) and passwd(5).  &lt;/li&gt;&lt;li&gt;Create a file to set shell variables in &lt;tt&gt;/var/qmail/ssl/env&lt;/tt&gt;.  Put these lines in that file:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;# Set these three&lt;br /&gt;SSL_USER=ssl&lt;br /&gt;SSL_GROUP=ssl&lt;br /&gt;SSL_DIR=/var/qmail/ssl&lt;br /&gt;# Enable UCSPI-TLS&lt;br /&gt;UCSPITLS=1&lt;br /&gt;# The rest are set based on the above three&lt;br /&gt;SSL_CHROOT="$SSL_DIR"&lt;br /&gt;CERTFILE="$SSL_DIR/cert"&lt;br /&gt;KEYFILE="$SSL_DIR/key"&lt;br /&gt;DHFILE="$SSL_DIR/dhparam"&lt;br /&gt;SSL_UID=`id -u "$SSL_USER"`&lt;br /&gt;if [ $? -ne 0 ]; then echo "No such user '$SSL_USER'" &gt;&amp;2; exit; fi&lt;br /&gt;SSL_GID=`id -g "$SSL_GROUP"`&lt;br /&gt;if [ $? -ne 0 ]; then echo "No such group '$SSL_GROUP'" &gt;&amp;2; exit; fi&lt;br /&gt;# Export the variables used by other scripts&lt;br /&gt;export SSL_CHROOT SSL_UID SSL_GID UCSPITLS CERTFILE KEYFILE DHFILE&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;  &lt;/li&gt;&lt;li&gt;Now set your &lt;tt&gt;umask&lt;/tt&gt; back to something more usable, like &lt;tt&gt;022&lt;/tt&gt;:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;umask 022&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;  &lt;h2&gt;Set up qmail-smtpd&lt;/h2&gt; &lt;/li&gt;&lt;li&gt;Edit the &lt;tt&gt;qmail-smtpd&lt;/tt&gt; run file, in &lt;tt&gt;/var/qmail/supervise/qmail-smtpd/run&lt;/tt&gt;.  There are three changes required: &lt;ul&gt;&lt;li&gt;  The top of the file has several variable settings.  Below these lines, include the SSL environment variable script we created above, using the shell's "dot" command, typed as a single period:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;. /var/qmail/ssl/env&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;  &lt;/li&gt;&lt;li&gt;On the line that contains &lt;tt&gt;softlimit&lt;/tt&gt;, add 10MB (10,000,000) the number after the &lt;tt&gt;-m&lt;/tt&gt; flag.  This allows &lt;tt&gt;qmail-smtpd&lt;/tt&gt; to use the extra memory required for SSL.  For example, if it's currently &lt;tt&gt;2000000&lt;/tt&gt;, you would have for that line:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;exec /usr/local/bin/softlimit -m 12000000 \&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;  &lt;/li&gt;&lt;li&gt;On the line that contains &lt;tt&gt;tcpserver&lt;/tt&gt;, change &lt;tt&gt;tcpserver&lt;/tt&gt; to &lt;tt&gt;sslserver -e -n&lt;/tt&gt;, leaving all of the other flags in place.  The line will now look something like:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;/usr/local/bin/sslserver -e -n -v -R -l "$LOCAL" -x /etc/tcp.smtp.cdb -c "$MAXSMTPD" \&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;  &lt;/li&gt;&lt;/ul&gt;   &lt;/li&gt;&lt;li&gt;Restart qmail to use the new configuration:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;/var/qmail/bin/qmailctl restart&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;  &lt;/li&gt;&lt;li&gt;Now we'll try a few tests to make sure everything works.  If any of these steps fails, double-check the steps above, look for errors in the error logs, and use your common sense to see what's going wrong.  Look in the logs to see if there are any errors:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;tail /var/log/qmail/smtpd/current&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt; You should see something like this:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;@40000000431fb29d10e09c2c sslserver: cafile 32655&lt;br /&gt;@40000000431fb29d10e120fc sslserver: ccafile 32655&lt;br /&gt;@40000000431fb29d10e14bf4 sslserver: cadir 32655 /usr/local/ssl/certs&lt;br /&gt;@40000000431fb29d10e176ec sslserver: cert 32655 /var/qmail/ssl/cert&lt;br /&gt;@40000000431fb29d10e1a9b4 sslserver: key 32655 /var/qmail/ssl/key&lt;br /&gt;@40000000431fb29d10e1d4ac sslserver: param 32655 /var/qmail/ssl/dh 512&lt;br /&gt;@40000000431fb29d10e226b4 sslserver: status: 0/20&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;  &lt;/li&gt;&lt;li&gt;Make sure the server is now offering TLS.  To test this, you can connect to the server on port 25 and issue an "extended HELO" command (&lt;tt&gt;EHLO&lt;/tt&gt;) and see what extensions the server offers.  To do this, start at a shell and type in the lines marked below with &lt;tt&gt;*&lt;/tt&gt;:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;  * telnet localhost 25&lt;br /&gt;   Trying 127.0.0.1...&lt;br /&gt;   Connected to localhost.&lt;br /&gt;   Escape character is '^]'.&lt;br /&gt;   220 host.example.com ESMTP&lt;br /&gt; * EHLO there&lt;br /&gt;   250-host.example.com&lt;br /&gt;   250-PIPELINING&lt;br /&gt;   250-8BITMIME&lt;br /&gt;   250 STARTTLS&lt;br /&gt; * QUIT&lt;br /&gt;   221 host.example.com&lt;br /&gt;&lt;/pre&gt;  The line that says &lt;tt&gt;STARTTLS&lt;/tt&gt; after you type &lt;tt&gt;EHLO&lt;/tt&gt; means that the server has TLS configured.  &lt;li&gt;Now test with a client to make sure things basically work. First start watching the logfile for errors:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;tail --follow=name /var/qmail/supervise/qmail-smtpd/log/main/current&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;  &lt;p&gt;Unfortunately the client included with &lt;tt&gt;sslserver&lt;/tt&gt; doesn't support TLS.  If you have a copy of &lt;tt&gt;stunnel&lt;/tt&gt; version 3 lying around, you can do something like this:&lt;br /&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;pre&gt;stunnel -r localhost:25 -f -c -n smtp -D debug -P none&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt; Otherwise, just skip this test and try the test in the next step.  &lt;/li&gt;&lt;li&gt;Finally, try turning on TLS in the mail clients you'll be using and sending a test message.  Make sure there are no errors from the client or in the logs, and that the messages arrives successfully. &lt;p&gt;If this step works, you've set everything up correctly. Congratulations!   &lt;/p&gt;&lt;h2&gt;Set up qmail-pop3d&lt;/h2&gt;  If you want to run a POP3 server, make sure you've set up qmail-pop3d as described in &lt;i&gt;Life with qmail&lt;/i&gt;, then continue to follow these steps.  If you're not running a POP3 server, you can skip this entire section.  &lt;/li&gt;&lt;li&gt; Edit the &lt;tt&gt;qmail-pop3d&lt;/tt&gt; run file, in &lt;tt&gt;/var/qmail/supervise/qmail-pop3d/run&lt;/tt&gt;.  There are three changes required: &lt;ul&gt;&lt;li&gt; Near the top of the file, between the &lt;tt&gt;#!/bin/sh&lt;/tt&gt; line and the line that begins with &lt;tt&gt;exec&lt;/tt&gt;, include the SSL environment variable script we created above, using the shell's "dot" command, typed as a single period:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;. /var/qmail/ssl/env&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt; &lt;/li&gt;&lt;li&gt;On the line that contains &lt;tt&gt;softlimit&lt;/tt&gt;, add 10MB (10,000,000) the number after the &lt;tt&gt;-m&lt;/tt&gt; flag.  This allows &lt;tt&gt;qmail-smtpd&lt;/tt&gt; to use the extra memory required for SSL.  For example, if it's currently &lt;tt&gt;2000000&lt;/tt&gt;, you would have for that line:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;exec /usr/local/bin/softlimit -m 12000000 \&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt; &lt;/li&gt;&lt;li&gt;On the line that contains &lt;tt&gt;tcpserver&lt;/tt&gt;, change &lt;tt&gt;tcpserver&lt;/tt&gt; to &lt;tt&gt;sslserver -e -n&lt;/tt&gt;, leaving all of the other flags in place.  The line will now look something like:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;/usr/local/bin/sslserver -e -n -v -R -H -l 0 0 110 /var/qmail/bin/qmail-popup \&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt; &lt;/li&gt;&lt;/ul&gt;  &lt;/li&gt;&lt;li&gt;Restart qmail to use the new configuration:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;/var/qmail/bin/qmailctl restart&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;  &lt;/li&gt;&lt;li&gt;Now we'll try a few tests to make sure everything works.  If any of these steps fails, double-check the steps above, look for errors in the error logs, and use your common sense to see what's going wrong.  Look in the logs to see if there are any errors:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;tail /var/log/qmail/pop3d/current&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt; You should see something like this:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;@40000000431fb29d10e09c2c sslserver: cafile 32655&lt;br /&gt;@40000000431fb29d10e120fc sslserver: ccafile 32655&lt;br /&gt;@40000000431fb29d10e14bf4 sslserver: cadir 32655 /usr/local/ssl/certs&lt;br /&gt;@40000000431fb29d10e176ec sslserver: cert 32655 /var/qmail/ssl/cert&lt;br /&gt;@40000000431fb29d10e1a9b4 sslserver: key 32655 /var/qmail/ssl/key&lt;br /&gt;@40000000431fb29d10e1d4ac sslserver: param 32655 /var/qmail/ssl/dh 512&lt;br /&gt;@40000000431fb29d10e226b4 sslserver: status: 0/20&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;  &lt;/li&gt;&lt;li&gt;Make sure the server is now offering TLS.  To test this, you can connect to the server on port 110, then ask for a list of its capabilities.  To do this, start at a shell, and type in the lines marked below with &lt;tt&gt;*&lt;/tt&gt;:&lt;br /&gt;&lt;pre&gt;  * telnet localhost 110&lt;br /&gt;   Trying 127.0.0.1...&lt;br /&gt;   Connected to localhost.&lt;br /&gt;   Escape character is '^]'.&lt;br /&gt;   +OK&lt;br /&gt; * CAPA&lt;br /&gt;   +OK capability list follows&lt;br /&gt;   STLS&lt;br /&gt;   .&lt;br /&gt; * QUIT&lt;br /&gt;   +OK&lt;br /&gt;   Connection closed by foreign host.&lt;br /&gt;&lt;/pre&gt; &lt;p&gt;The &lt;tt&gt;STLS&lt;/tt&gt; line after you type &lt;tt&gt;CAPA&lt;/tt&gt; indicates that the server supports TLS.  &lt;/p&gt;&lt;/li&gt;&lt;li&gt;Now test with a client to make sure things basically work. First start watching the logfile for errors:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;tail --follow=name /var/qmail/supervise/qmail-pop3d/log/main/current&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt; &lt;p&gt;Unfortunately the client included with &lt;tt&gt;sslserver&lt;/tt&gt; doesn't support TLS.  If you have a copy of &lt;tt&gt;stunnel&lt;/tt&gt; version 3 lying around, you can do something like this:&lt;br /&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;pre&gt;stunnel -r localhost:110 -f -c -n pop3 -D debug -P none&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt; Otherwise, just skip this test and try the test in the next step.  &lt;/li&gt;&lt;li&gt;Finally, try turning on TLS in the mail clients you'll be using and receiving some test messages.  Make sure there are no errors from the client or in the logs, and that the messages arrives successfully. &lt;p&gt;If this step works, you've set everything up correctly. Congratulations!  &lt;/p&gt;&lt;/li&gt;&lt;/blockquote&gt;&lt;/li&gt;&lt;/ol&gt;  &lt;h2&gt;Optional Step: If desired, set up SSL servers&lt;/h2&gt;  If you'd like to support SSL (not delayed encryption through TLS), you can still use the modified &lt;tt&gt;sslserver&lt;/tt&gt;, and get the security advantages of &lt;tt&gt;chroot&lt;/tt&gt; and privilege separation.  &lt;p&gt;These steps will help you create an SSL service from a TLS service. The instructions are for &lt;tt&gt;qmail-smtpd&lt;/tt&gt;; they will work for &lt;tt&gt;qmail-pop3d&lt;/tt&gt; if you simply replace &lt;tt&gt;smtpd&lt;/tt&gt; with &lt;tt&gt;pop3d&lt;/tt&gt; everywhere.  &lt;/p&gt;&lt;ol&gt;&lt;li&gt; Change directory to &lt;tt&gt;/var/qmail/supervise&lt;/tt&gt;:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;cd /var/qmail/supervise&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt; &lt;/li&gt;&lt;li&gt; Create a service directory and log directory:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;mkdir -p qmail-smtpd-ssl/log&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;  &lt;/li&gt;&lt;li&gt; Copy the run file from the original service, and make it executable:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;cp qmail-smtpd/run qmail-smtpd-ssl/&lt;br /&gt;chmod 755 qmail-smtpd-ssl/run&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;  &lt;/li&gt;&lt;li&gt;Edit the run file (&lt;tt&gt;qmail-smtpd-ssl/run&lt;/tt&gt;) in the following ways: &lt;ul&gt;&lt;li&gt;On the line after &lt;tt&gt;. /var/qmail/ssl/env&lt;/tt&gt;, add &lt;tt&gt;unset UCSPITLS&lt;/tt&gt; &lt;/li&gt;&lt;li&gt;On the line that contains &lt;tt&gt;sslserver&lt;/tt&gt; line, remove the &lt;tt&gt;-n&lt;/tt&gt; flag. &lt;/li&gt;&lt;li&gt;On the next line, which will contain something like &lt;tt&gt;0 smtp&lt;/tt&gt;, change &lt;tt&gt;smtp&lt;/tt&gt; to &lt;tt&gt;smtps&lt;/tt&gt;; that tells &lt;tt&gt;sslserver&lt;/tt&gt; to listen on the appropriate port for the SSL version of this service. &lt;/li&gt;&lt;/ul&gt;  &lt;/li&gt;&lt;li&gt;Set up a logging directory for this new service:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;mkdir /var/log/qmail/smtpd-ssl&lt;br /&gt;chown qmaill /var/log/qmail/smtpd-ssl&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;  &lt;/li&gt;&lt;li&gt;Set up the logging program for this new service, by creating a file in &lt;tt&gt;qmail-smtpd-ssl/log/run&lt;/tt&gt; with these contents:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;#!/bin/sh&lt;br /&gt;exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t \&lt;br /&gt;      /var/log/qmail/smtpd-ssl&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt; Make sure the script is executable:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;chmod 755 qmail-smtpd-ssl/log/run&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;  &lt;/li&gt;&lt;li&gt;Link the new service into the &lt;tt&gt;/service&lt;/tt&gt; directory, to have it start automatically on boot:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;ln -s /var/qmail/supervise/qmail-smtpd-ssl /service&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;  &lt;/li&gt;&lt;li&gt; Add the following to qmailctl's "start" section:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;if svok /service/qmail-smtpd-ssl ; then&lt;br /&gt; svc -u /service/qmail-smtpd-ssl /service/qmail-smtpd-ssl/log&lt;br /&gt;else&lt;br /&gt; echo qmail-smtpd-ssl supervise not running&lt;br /&gt;fi&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;  &lt;/li&gt;&lt;li&gt;Add the following to qmailctl's "stop" section:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;echo "  qmail-smtpd-ssl"&lt;br /&gt;svc -d /service/qmail-smtpd-ssl /service/qmail-smtpd-ssl/log&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;  &lt;/li&gt;&lt;li&gt;Add the following to qmailctl's "stat" section:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;svstat /service/qmail-smtpd-ssl&lt;br /&gt;svstat /service/qmail-smtpd-ssl/log&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;  &lt;/li&gt;&lt;li&gt;Add the following to qmailctl's "pause" section:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;echo "Pausing qmail-smtpd-ssl"&lt;br /&gt;svc -p /service/qmail-smtpd-ssl&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;  &lt;/li&gt;&lt;li&gt;Add the following to qmailctl's "cont" section:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;echo "Continuing qmail-smtpd-ssl"&lt;br /&gt;svc -c /service/qmail-smtpd-ssl&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;  &lt;/li&gt;&lt;li&gt;Add the following to qmailctl's "restart" section:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;echo "* Restarting qmail-smtpd-ssl."&lt;br /&gt;svc -t /service/qmail-smtpd-ssl /service/qmail-smtpd-ssl/log&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;  &lt;/li&gt;&lt;li&gt;To test, use an SSL-enabled mail client, or use &lt;tt&gt;stunnel&lt;/tt&gt; version 3:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;stunnel -r localhost:smtps -f -c -D debug -P none&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;  &lt;/li&gt;&lt;/ol&gt;  &lt;h2&gt;Optional Step: If desired, set up other servers&lt;/h2&gt;  If you have any other TLS or SSL servers you'd like to set up, such as an IMAP server, you should be able to use the above steps as a template to get you started.  &lt;h2&gt;Required Step: Sleep better at night&lt;/h2&gt;  Knowing your TLS- and SSL-protected mail server is secure.  &lt;h1&gt;Thanks&lt;/h1&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-4667849080292614335?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/4667849080292614335/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=4667849080292614335&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/4667849080292614335'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/4667849080292614335'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2008/02/smtp-and-pop-with-ssl-ucspi-tls-qmail.html' title='SMTP and POP with SSL (ucspi-tls-qmail-howto)'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-3426848414362073934</id><published>2008-02-28T16:19:00.001+05:30</published><updated>2008-02-28T16:21:44.589+05:30</updated><title type='text'>Rbldns How to</title><content type='html'>&lt;script language="JavaScript" src="http://www.gvisit.com/record.php?sid=47f6ca945f7cc194b717fe5e8f74a771" type="text/javascript"&gt;&lt;/script&gt;  &lt;h1 class="title"&gt;What is this document?&lt;/h1&gt; &lt;p&gt;I wrote this HOWTO so that others can have one place to stop and see how to setup their own private RBL list. The information is out there, but scattered all over the place. &lt;/p&gt; &lt;p&gt;The color convention I use is to have the headlines in &lt;span class="gray"&gt;gray&lt;/span&gt; and the code / shell scripts in &lt;span class="yellow"&gt;yellow&lt;/span&gt; &lt;/p&gt; &lt;h1 class="title"&gt;What is rbldns?&lt;/h1&gt;   &lt;p&gt;   &lt;a href="http://cr.yp.to/djbdns/rbldns.html"&gt;Rbldns&lt;/a&gt; is a suite of  programs in conjunction with dnscache to provide RBL service. In a nutshell  IPs put into the rbldns data file show up as 127.0.0.1 responses to a specially  crafted DNS query.   &lt;/p&gt;   &lt;p&gt;   The IP address go into the file in the normal readable way, ie 192.168.0.1,  and you query for them by reversing the address, like 1.0.168.192.example.com   &lt;/p&gt; &lt;h1 class="title"&gt;How do I use rbldns?&lt;/h1&gt;   &lt;p&gt; Normally you don't use it directly, you have a program query an RBL server and based on the result of the query it either runs or doesn't run the program following it. &lt;/p&gt;   &lt;p&gt;  For example with Qmail you'll change your qmail-smtpd/run file from &lt;br /&gt;  tcpserver 0 smtp /var/qmail/bin/qmail-smtpd &lt;br /&gt;to&lt;br /&gt;tcpserver 0 smtp /usr/local/bin/rblsmtpd -a whitelist.example.com -r blacklist.example.com -r relays.ordb.org /var/qmail/bin/qmail-smtpd &lt;/p&gt;   &lt;p&gt;  According to the rblsmtpd man page, the -r and -a switches mean: &lt;br /&gt;&lt;br /&gt; &lt;table&gt; &lt;tbody&gt;&lt;tr&gt; &lt;th&gt;Switch&lt;/th&gt; &lt;th&gt;If successful, do this&lt;/th&gt; &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;-r&lt;/td&gt; &lt;td&gt;Quit&lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;-a&lt;/td&gt; &lt;td&gt;Don't do other lookups, and continue on&lt;/td&gt;  &lt;/tr&gt;  &lt;/tbody&gt;&lt;/table&gt; &lt;br /&gt;&lt;br /&gt; In this case the steps are: &lt;br /&gt;1. Do a lookup against whitelist.example.com, if sucessful then skip the other lookups and go on to accepting the smtp request &lt;br /&gt;2. Do a lookup against blacklist.example.com, if that's successful then quit out printing a "RBL denied" message to the client. &lt;br /&gt;3. Same as #2 but against relays.ordb.org  &lt;/p&gt; &lt;h1 class="title"&gt;How do I make my own RBL?&lt;/h1&gt;   &lt;p&gt;  You should know how to setup &lt;a href="http://cr.yp.to/dnscache.html"&gt;Dnscache&lt;/a&gt; before trying to do this.  The steps are pretty  easy, but its helpful if you know your way around   &lt;/p&gt;   &lt;p&gt;   Setting up the rbldns is pretty easy, just follow the directions on the   &lt;a href="http://cr.yp.to/djbdns/rbldns-conf.html"&gt;RBLdns-conf&lt;/a&gt; page:   &lt;br /&gt; &lt;/p&gt;&lt;pre class="code"&gt; rbldns-conf rbldns dnslog /etc/rbldns/black 127.0.0.2 rbl.example.com&lt;br /&gt;rbldns-conf rbldns dnslog /etc/rbldns/white 127.0.0.3 whitelist.example.com&lt;/pre&gt;    &lt;p&gt; This says to setup a RBL on 127.0.0.2 that answers queries for *.rbl.example.com, and and RBL on 127.0.0.3 that answers for *.whitelist.example.com &lt;/p&gt;  &lt;p&gt;   Note: the 'rbl' and 'whitelist' names are arbitrary.  RBLdns doesn't know  if this is a 'good' or a 'bad' list of addresses -- it just knows that if  someone asks for 1.0.168.192.bad.example.com on IP 127.0.0.2 it should answer  with a 127.0.0.1 if it has it, or nothing if it doesn't.  &lt;/p&gt;  &lt;p&gt;   Start these services up like all of DJB's other daemons: &lt;br /&gt; &lt;/p&gt;&lt;pre class="code"&gt; ln -s /etc/rbldns/black /service&lt;br /&gt;ln -s /etc/rbldns/white /service&lt;/pre&gt; &lt;br /&gt;&lt;br /&gt;To see if they are running, do a   &lt;pre class="code"&gt; lsof -n -i:53&lt;/pre&gt; &lt;br /&gt;&lt;br /&gt;And you should see listeners on 127.0.0.2 and 127.0.0.3   &lt;h1 class="title"&gt;Why would I want to use a local RBL?&lt;/h1&gt;   &lt;p&gt;   Why shouldn't you just relay on publically available RBLs?  For a couple of reasons:   &lt;br /&gt;1. You know a couple of IPs are good and you don't want to waste bandwith by checking them against an RBL on the internet &lt;br /&gt;2. Same thing for bad ones &lt;br /&gt;3. You know your friend has a DSL line at home and an RBL blocks all home DSL users, you want to continue using the service but want to accept his mail.&lt;br /&gt;4. You want to keep a 2nd source of information about who is sending mail to your server   &lt;/p&gt;   &lt;p&gt;  So part of this is being a good netizen.  If you know you're getting a lot of   email from a handful of IPs, you should put those in your own whitelist so  that you're not continously asking the public RBLs if they are okay   &lt;/p&gt; &lt;h1 class="title"&gt;How to resolve *.(whitelist|rbl).example.com -- DNScache way&lt;/h1&gt;   &lt;p&gt; Now that we have the RBL service ready to go we have to be able to query it. Like we told dnscache to send all queries for *.example.com to the local tinydns IP address, we're going to do that for the RBL service. &lt;/p&gt;  &lt;p&gt; This is the part that took me a while to think about: how do I serve both *.example.com and *.rbl.example.com? Well the same way you've already done it: through a dnscache setting. &lt;/p&gt;  &lt;p&gt;Add two entries to your dnscache "forwarding" information:  &lt;br /&gt; &lt;/p&gt;&lt;pre class="code"&gt; cd /service/dnscache/root/servers&lt;br /&gt;echo 127.0.0.2 &gt; rbl.example.com&lt;br /&gt;echo 127.0.0.3 &gt; whitelist.example.com&lt;br /&gt;svc -h /service/dnscache&lt;/pre&gt; &lt;br /&gt;&lt;br /&gt; This tells dnscache that when it gets a query for *.whitelist.example.com  to send it off to the server on 127.0.0.3, *.rbl.example.com queries should  go to 127.0.0.2.  If you're setup TinyDns this should be familiar   &lt;h1 class="title"&gt;How to resolve *.(whitelist|rbl).example.com -- TinyDns way&lt;/h1&gt;   &lt;p&gt; This might be a little cleaner if you're already serving up *.example.com results. You put in your tinydns file pointers to the (rbl|whitelist) lists:&lt;br /&gt; &lt;/p&gt;&lt;pre class="code"&gt; cd /service/tinydns/root/&lt;br /&gt;echo "&amp;amp;rbl.example.com:127.0.0.2:a" &gt;&gt; data&lt;br /&gt;echo "&amp;amp;whitelist.example.com:127.0.0.3:a" &gt;&gt; data&lt;br /&gt;make&lt;br /&gt;svc -h /service/tinydns&lt;/pre&gt;    &lt;p&gt; So now when your tinydns server is queried for 1.0.168.192.rbl.example.com it will look at its file and say "That's handled by 127.0.0.2 and I'll ask it" &lt;/p&gt;   &lt;h1 class="title"&gt;How do I add entries to my RBL?&lt;/h1&gt;  &lt;p&gt; Scenerio: a spammer is continously sending us email from 192.168.5.100 while our friend is sending from 192.168.6.56. We would like to avoid using public RBL servers for these two addresses. &lt;/p&gt;  &lt;p&gt;Step 1: add the spammer to your spam list: &lt;br /&gt; &lt;/p&gt;&lt;pre class="code"&gt; cd /service/rbl/black/root&lt;br /&gt;echo 192.168.5.100 &gt;&gt; data&lt;br /&gt;make&lt;/pre&gt;    &lt;p&gt;Step 2: Add your friend to your good list: &lt;br /&gt; &lt;/p&gt;&lt;pre class="code"&gt; cd /service/rbl/white/root&lt;br /&gt;echo 192.168.6.56 &gt;&gt; data&lt;br /&gt;make&lt;/pre&gt;    &lt;p&gt;  Now query to see if they are in there: &lt;br /&gt; &lt;/p&gt;&lt;pre class="code"&gt; dnsip 100.5.168.192.rbl.example.com&lt;br /&gt;dnsip 100.5.168.192.whitelist.example.com&lt;br /&gt;dnsip 56.6.168.192.rbl.example.com&lt;br /&gt;dnsip 56.6.168.192.whitelist.example.com&lt;/pre&gt;    &lt;p&gt;  Notice I queried both sets of databases to make sure we didn't screw up who is a spamer versus who is our friend.  &lt;/p&gt;  &lt;p&gt;If you &lt;b&gt;don't&lt;/b&gt; get a 127.0.0.1 result from a query when you think you should, HUP the appropriate daemon: &lt;br /&gt; &lt;/p&gt;&lt;pre class="code"&gt; svc -h /service/rbl/black&lt;br /&gt;svc -h /service/rbl/white&lt;/pre&gt;   &lt;h1 class="title"&gt;How do I now use an RBL service?&lt;/h1&gt;  &lt;p&gt;  Now that you have the local RBLdns server(s) working through simple queries, modify your other scripts to use them.  With &lt;a href="http://qmail.org/"&gt;qmail&lt;/a&gt; you do that like this: &lt;br /&gt; &lt;/p&gt;&lt;pre class="code"&gt;exec /usr/local/bin/tcpserver -R -v -p \&lt;br /&gt;  -x /var/qmail/control/tcp.smtp.cdb \&lt;br /&gt;  -u $QMAILUID -g $QMAILGID \&lt;br /&gt;  mail.example.com smtp \&lt;br /&gt;  /usr/local/bin/rblsmtpd \&lt;br /&gt;  -a whitelist.example.com \&lt;br /&gt;  -r rbl.example.com \&lt;br /&gt;  -r relays.ordb.org \&lt;br /&gt;  -r bl.spamcop.net \&lt;br /&gt;  /var/qmail/bin/qmail-smtpd 2&gt;&amp;amp;1&lt;/pre&gt;    &lt;p&gt;This is what your implementation will probably look like: an initial test against your goodlist, if that passes the continue on to the qmail-smtpd part. If that fails, then test against your local bad list. If that is sucessful then quit out. If not, continue on to your 2nd and 3rd RBLs. &lt;/p&gt; &lt;h1 class="title"&gt;How do I test my RBL?&lt;/h1&gt;  &lt;p&gt;You test an RBL by sending it a query. If it is in the database then it should return with a 127.0.0.x (1 or 2) answer. If it isn't in there, then nothing comes back. &lt;/p&gt;  &lt;p&gt;The trick is to remember to reverse your IP address, so that 192.168.0.1 becomes 1.0.168.192.myrbldomain.com  &lt;/p&gt;  &lt;p&gt;Here's a simple program to check names fed on stdin:  &lt;/p&gt;&lt;pre class="code"&gt; #!/usr/bin/perl&lt;br /&gt;&lt;br /&gt;use Net::DNS;&lt;br /&gt;use strict;&lt;br /&gt;my ($res, @rbls);&lt;br /&gt;&lt;br /&gt;@rbls = qw (rbl.example.com whitelist.example.com);&lt;br /&gt;&lt;br /&gt;$res  = Net::DNS::Resolver-&gt;new;&lt;br /&gt;while (&lt;&gt;) {&lt;br /&gt; my ($rev, $ip);&lt;br /&gt; chomp;&lt;br /&gt; $ip = $_;&lt;br /&gt; $rev = (join ".", reverse (split /\./, $ip) );  # ie 4.3.2.1.&lt;br /&gt; foreach my $rbl (@rbls) {&lt;br /&gt;  my $query = $res-&gt;search("$rev.$rbl");&lt;br /&gt;  next unless ($query);&lt;br /&gt;  my $hit;&lt;br /&gt;  foreach my $rr ($query-&gt;answer) {&lt;br /&gt;   next unless $rr-&gt;type eq "A";&lt;br /&gt;   $hit = $rr-&gt;address;&lt;br /&gt;   last;&lt;br /&gt;  }&lt;br /&gt;  next unless $hit;&lt;br /&gt;  printf "%-20s %-20s $hit\n", $ip, $rbl;&lt;br /&gt; }&lt;br /&gt;}&lt;/pre&gt;   &lt;p&gt; &lt;/p&gt;&lt;h1 class="title"&gt;How do I contact you?&lt;/h1&gt; If you have any questions or comments, or just want to say thanks, drop me a line at &lt;a href="mailto:cwilkes-rbl@ladro.com"&gt;anand.shah@coolaquarius.com&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-3426848414362073934?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/3426848414362073934/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=3426848414362073934&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/3426848414362073934'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/3426848414362073934'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2008/02/rbldns-how-to.html' title='Rbldns How to'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-7773500482443290696</id><published>2007-09-19T19:00:00.000+05:30</published><updated>2007-09-19T19:01:41.858+05:30</updated><title type='text'>Easy steps to preventing spam</title><content type='html'>&lt;div align="left"&gt;&lt;a title="Easy steps to preventing spam" href="http://www.simplehelp.net/2006/07/11/easy-steps-to-preventing-spam/" rel="bookmark"&gt;&lt;span style="font-size:180%;"&gt;Easy steps to preventing spam&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The following 10 steps offer a very common sense (though often overlooked) approach to avoiding spam. If you follow these guidelines, you’ll notice a drastic decrease in the number of annoying messages that make it into your inbox… &lt;a id="more-74"&gt;&lt;/a&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;br /&gt;01. Give your primary email address to friends and family only. Give a different address to others on the Internet. Although this second address will be more likely to receive unwanted emails, it is more disposable and can allow you to better control the emails you receive. Your ISP almost certainly offers multiple email addresses, and &lt;a onclick="javascript:urchinTracker('/outbound/mail.yahoo.com');" href="http://mail.yahoo.com/"&gt;Yahoo&lt;/a&gt;, &lt;a onclick="javascript:urchinTracker('/outbound/www.hotmail.com');" href="http://www.hotmail.com/"&gt;Microsoft&lt;/a&gt; and &lt;a onclick="javascript:urchinTracker('/outbound/www.google.com');" href="http://www.google.com/gmail"&gt;Google&lt;/a&gt; all offer free web based email accounts. These are great to use as disposable addresses.&lt;br /&gt;&lt;/div&gt;&lt;div align="left"&gt;02. Make sure your email address is difficult to guess. Don’t use just a common name or common word(s). Spammers use software programs to generate random email addresses based on common names and words in the dictionary.&lt;br /&gt;It is NOT uncommon for a brand new email address to start receiving spam almost immediately after it has been created. This happens because even though the address is new, spammers will take a previously used user name (eg. jdoe@whatever.com) and apply it to a different domain (eg. jdoe@another_domain.com).&lt;br /&gt;In addition, common email addresses may have been used previously and may still be on old mailing lists.&lt;br /&gt;&lt;/div&gt;&lt;div align="left"&gt;03. Do not post your primary email address in newsgroups, bulletin boards or chat rooms. Spammers use software programs, often referred to as spiders or bots, to search for and harvest email addresses from public forums. To prevent this, use a secondary email address or alter the primary address so that it is not deliverable in that format. For example, if your email address is jdoe@whatever.com, you could post it as jdoe@TAKE-THIS-OUT.whatever.com or “jdoe at whatever dot com”.&lt;br /&gt;&lt;/div&gt;&lt;div align="left"&gt;04. Do not post your primary email address on a Web site. Spiders also scan Web sites for email addresses. You can alter your email address to help protect it but remember that email harvesting software can read HTML code, so be sure to remove the “mailto:” tag.&lt;br /&gt;&lt;/div&gt;&lt;div align="left"&gt;05. Do not reply to unsolicited emails. If the email does not appear to be from a trustworthy or legitimate source, delete it without replying. A federal anti-spam law called The Can Spam Act, went into effect January 1, 2004, requiring a functioning “opt out” link or a legitimate “reply to unsubscribe” email address. Some unscrupulous spammers have ignored this law and continue to trick recipients into unwittingly responding to a fake “opt out” link, which actually verifies their email address as a valid one. Therefore, it is still strongly recommended that recipients of unsolicited email carefully consider whether an “opt out” or “reply to unsubscribe” seems legitimate and act accordingly.&lt;br /&gt;&lt;/div&gt;&lt;div align="left"&gt;06. Consider using an alternate email address when signing up for services, filling out forms or taking surveys on the Internet. Read the privacy policy of these sites. Keep in mind, if the service is “free” they often need to generate revenue in some manner and advertising is often used to do this.&lt;br /&gt;&lt;/div&gt;&lt;div align="left"&gt;07. When signing up for a mailing list, read the terms and policies. Signing up should result in wanted or solicited email, but the list provider should disclose whether signing up will result in the sale or trade of your email address to other parties.&lt;br /&gt;&lt;/div&gt;&lt;div align="left"&gt;08. Let friends and family know that you do not wish to have them share your email address.&lt;br /&gt;&lt;/div&gt;&lt;div align="left"&gt;09. Keep your PCs anti-virus software up-to-date and install a firewall. Unprotected high-speed Internet connections are vulnerable to infection by viruses that are programmed to open gateways, also known as proxies, to relay spam. By not keeping your PC secure, you may unwittingly be a courier for spam. There’s a good chance your ISP offers free or discounted security software - &lt;a href="http://www.simplehelp.net/2006/07/05/how-to-speed-up-your-pcs-performance-5-quick-tips/#vir"&gt;this article&lt;/a&gt; can help you figure out if yours does.&lt;br /&gt;&lt;/div&gt;&lt;div align="left"&gt;10. Check “sent mail” folders for suspicious messages. Take responsibility for your PC by checking your “sent mail” folder regularly to ensure that all sent mail is really being sent by you and not by a spammer using an open gateway (proxy) on your computer.&lt;/div&gt;&lt;div align="center"&gt; &lt;/div&gt;&lt;div align="center"&gt; &lt;/div&gt;&lt;div align="center"&gt; &lt;/div&gt;&lt;div align="left"&gt;Anand Shah&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-7773500482443290696?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/7773500482443290696/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=7773500482443290696&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/7773500482443290696'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/7773500482443290696'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2007/09/easy-steps-to-preventing-spam.html' title='Easy steps to preventing spam'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-462997261126604001</id><published>2007-09-19T18:53:00.000+05:30</published><updated>2007-09-19T18:55:28.108+05:30</updated><title type='text'>Block IP how to in Windows IIS and Apache</title><content type='html'>&lt;div align="center"&gt;&lt;span style="font-size:180%;"&gt;&lt;strong&gt;Block IP How To&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;The following tutorial explainss how you can block IP addresses from viewing your website in Windows IIS and Linux/Unix Apache. Blocking IP addresses prevents users from seeing your website during construction, limits access to specific users, or to blocks users attempting to connect to your site maliciously.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;strong&gt;Block IP how to in Windows IIS&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To block an IP address from viewing your website, please follow these steps:&lt;br /&gt;1. Login to your server through Terminal Services or Remote Desktop Connection. 2. Click Start, select Programs, and then click Administrative Tools.    For IIS 5.0 click Internet Services Manager.    For IIS 6.0 click Internet Information Services.3. In the left column you will see the Server Name.     In IIS 5.0, expand the Server Name to find the domain name.     In IIS 6.0, expand the Server Name and then Web Sites to find the domain name.4. Right-click on the domain name and select Properties.5. On the Directory Security Tab under IP Address and Domain Name Restrictions click Edit.You have two options, you can grant access to all computers and restrict individual IP's or you can deny access to all computers and grant access to specific IP's. By default, all users will be granted access to your site except the IP addresses you specify.To add an IP address to the restriction list, please follow these steps: 1. Click Add.2. Select the type:    Single Computer - add a single IP Address.    Group of Computers - add a block IP Address using the starting IP address of the block and the appropriate subnet mask.    Domain Name - add a domain name (this method is not recommended). 3. Click Ok.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Block IP how to in Linux/Unix Apache&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You can also block (or admit) users based on their incoming IP address: &lt;ifmodule&gt;    RewriteEngine on    RewriteMap     block dbm:/www/conf/my.block     RewriteCond     ${block:%{REMOTE_ADDR}OK}     !^OK$    RewriteRule     ^/.*     http://%{REMOTE_ADDR}/     [L]&lt;/ifmodule&gt;&lt;br /&gt;You create my.block.db from a file (named blocklist) that looks like this: xxx.xxx.xxx.xxx block&lt;br /&gt;and piping it to./db_create my.block.db &lt; blocklist&lt;br /&gt;You can add additional entries on the fly: echo "xxx.xxx.xxx.xxy block"  ./db_create&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Anand Shah&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-462997261126604001?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/462997261126604001/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=462997261126604001&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/462997261126604001'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/462997261126604001'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2007/09/block-ip-how-to-in-windows-iis-and.html' title='Block IP how to in Windows IIS and Apache'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-8710515062227203770</id><published>2007-09-19T18:50:00.000+05:30</published><updated>2007-09-19T18:53:05.080+05:30</updated><title type='text'>Blocking Spam with Sendmail</title><content type='html'>Like a great many people on the net, I found myself increasingly annoyed by the rising tide of spam. By which I do not mean the delectible Hormel canned meat product (which the little lady especially likes fried in a fried egg sandwich), but the phenomenon of unsolicited commercial email.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;Spam is unlike regular junk mail from the post office for several reasons:&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Normal junk mail costs money to send. Spam does not. The cost is born by the recipients and by the servers in between. While normal junk mail is a revenue source for the post office and actually helps to pay for delivering regular mail, spam pays for nothing. Spam can hence be viewed as theft of services.&lt;br /&gt;&lt;br /&gt;Spam has detrimental effects. Historically Internet mail servers have passed along email between third parties as a gesture of friendship and good will. Much like tossing your neighbor's paper over the fence if the paperboy misses his throw. This is happening less and less because spammers take advantage of it.&lt;br /&gt;&lt;br /&gt;Spam reduces the utility of email. People become discouraged about checking their mailboxes if they are always cluttered with spam.&lt;br /&gt;&lt;br /&gt;Enough ranting. I decided to do something. Being the sort who favors technical fixes over legal ones, I started doing some research on the web, ordered a copy of the Bat book, and spent some time reading my sendmail configuration and scratching my head. I present here the result.&lt;br /&gt;First, if you're not using sendmail I can't help you. Second, you need the latest version of sendmail or these tricks won't work. And finally, we had several conditions that had to be met:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;We wanted to be able to block spam by domain name, network number, or by specific address for maximum flexibility.&lt;br /&gt;&lt;br /&gt;We needed to be able to allow spam to selected mailboxes for customers who do not want spam blocked. I may disagree with them, but they are paying for a service and it is, after all, their mail. Spam blocking had to be a value added service that could be turned off.&lt;br /&gt;&lt;br /&gt;We host a number of "virtual domains" and needed to be able to route email for them to the proper mailboxes. We had already been doing that, but it was a factor that had to be considered in our antispam measures so that spam could be blocked or not as desired by the mailbox owners.&lt;br /&gt;&lt;br /&gt;We wanted to stop "third party relay" going through our mail server while allowing for exceptions for customers with their own domains and mail servers or for roaming customers.&lt;br /&gt;&lt;br /&gt;I think I have come up with a set of sendmail rules which accomplish this.&lt;br /&gt;First, we need to add a few entries in the local configuration section:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;LOCAL_CONFIG&lt;br /&gt;&lt;br /&gt;Fw/etc/vdomain.cw&lt;br /&gt;Kvdomain hash /etc/vdomain&lt;br /&gt;&lt;br /&gt;# list of people who like spam&lt;br /&gt;F{fools} /etc/WantSpam&lt;br /&gt;&lt;br /&gt;# list of known spammers&lt;br /&gt;Kjunk hash -a@JUNK /etc/spammers&lt;br /&gt;&lt;br /&gt;# List of network addresses we will relay for&lt;br /&gt;F{LocalIP} /etc/LocalIP&lt;br /&gt;&lt;br /&gt;# List of domains we will relay to&lt;br /&gt;F{RelayTo} /etc/RelayTo&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Click on the filename of any of these files for an explanation of its purpose and contents.&lt;br /&gt;Now we get to the rules themselves. First, an entry must be added to your local rule zero, like so:&lt;br /&gt;&lt;br /&gt;LOCAL_RULE_0&lt;br /&gt;R$* $: $&gt;vmap $1&lt;br /&gt;&lt;br /&gt;Not very interesting, is it? It just calls another rule set, named "vmap", which handles virtual domain address mapping. Note: I don't know what the "right way" is to do these things, but it works to just list all the rest of these rulesets right under LOCAL_RULE_0, so that's what I do. Here then is the "vmap" ruleset:&lt;br /&gt;Svmap&lt;br /&gt;R$+ &lt; @ $+ . &gt; $: $1 &lt; @ $2 &gt; .&lt;br /&gt;R$+ &lt; @ $+ &gt; $* $: $(vdomain $1@$2 $: $1 &lt; @ $2 &gt; $3 $)&lt;br /&gt;R$+ &lt; @ $+ &gt; $* $: $(vdomain $2 $: $1 &lt; @ $2 &gt; $3 $)&lt;br /&gt;R$+ &lt; @ $+ &gt; . $: $1 &lt; @ $2 . &gt;&lt;br /&gt;&lt;br /&gt;I made this a separate ruleset since I do it again in the rest of the rules, as you will see. I have obscure reasons for not just calling local rule zero as needed.&lt;br /&gt;Next I define a "junk" ruleset to look up a domain name or email address in the /etc/spammers.db database:&lt;br /&gt;&lt;br /&gt;Sjunk&lt;br /&gt;R$* $: $(junk $1$) look for host in spammer list&lt;br /&gt;R$+@JUNK $@ $1@JUNK return message if found&lt;br /&gt;R@JUNK $@ Spam refused @JUNK generic message&lt;br /&gt;R$-.$+ $: $1 . $&gt;junk $2 retry skipping lead subdomain&lt;br /&gt;R$-.$+@JUNK $@ $2@JUNK return message if found&lt;br /&gt;&lt;br /&gt;Next, a "junkIP" ruleset to look up an IP address or network number in the /etc/spammers.db database:&lt;br /&gt;SjunkIP&lt;br /&gt;R$* $: $(junk $1$) look for host in spammer list&lt;br /&gt;R$+@JUNK $@ $1@JUNK return message if found&lt;br /&gt;R@JUNK $@ Spam refused @JUNK generic message&lt;br /&gt;R$+.$- $: $2 . $&gt;junkIP $1 retry without trailing number&lt;br /&gt;R$-.$+@JUNK $@ $2@JUNK return message if found&lt;br /&gt;R$-.$+ $@ $2.$1 fix order if not spammer&lt;br /&gt;&lt;br /&gt;Now for the heart of it, the "check_rcpt" ruleset. Spam blocking is more often done in the "check_mail" ruleset, but we can't do it that way since we need to check the recipient to see if they want spam. Hence, this ruleset gets a bit long.&lt;br /&gt;Scheck_rcpt&lt;br /&gt;R$* $: $&gt;vmap $&gt;3 $1 normalize address&lt;br /&gt;&lt;br /&gt;# Refuse to relay mail between nonlocal systems&lt;br /&gt;R$* $: $(dequote "" $&amp;amp;{client_addr} $) $ $1&lt;br /&gt;R0 $ $* $@ ok no client addr: directly invoked&lt;br /&gt;R$={LocalIP}$* $ $* $@ ok from here&lt;br /&gt;R$* $ $* $: $2 not from local, check recipient&lt;br /&gt;R$*&lt;@$=w.&gt;$* $&gt;3 $1 $3 remove our aliases, maybe repeatedly&lt;br /&gt;R$*&lt;@$*$={RelayTo}.&gt;$* $&gt;3 $1 $4 remove domains we relay to&lt;br /&gt;# still something left?&lt;br /&gt;R$*&lt;@$+&gt;$* $#error $@ 5.5.4 $: "554 we do not relay from " $&amp;amp;{client_name} " to " $1@$2$3&lt;br /&gt;&lt;br /&gt;# Allow mail to fools who like spam, and otherwise block spammers&lt;br /&gt;R$={fools} $@ ok recipient listed as wanting spam&lt;br /&gt;&lt;br /&gt;# Block by host or domain name&lt;br /&gt;R$* $: $(dequote "" $&amp;amp;{client_name} $)&lt;br /&gt;R$* $: $&gt;junk $1&lt;br /&gt;R$*@JUNK $#error $@ 5.5.4 $: "554 " $1 ": " $&amp;amp;{client_name}&lt;br /&gt;&lt;br /&gt;# Block by network or host IP address&lt;br /&gt;R$* $: $(dequote "" $&amp;amp;{client_addr} $)&lt;br /&gt;R$* $: $&gt;junkIP $1&lt;br /&gt;R$*@JUNK $#error $@ 5.5.4 $: "554 " $1 ": " $&amp;amp;{client_addr}&lt;br /&gt;&lt;br /&gt;# Block by specific email address&lt;br /&gt;R$* $: $(dequote "" $&amp;amp;f $)&lt;br /&gt;R$* $: $&gt;junk $1&lt;br /&gt;R$*@JUNK $#error $@ 5.5.4 $: "554 " $1 ": " $&amp;amp;f&lt;br /&gt;R$* @ $* $: $1 @ $&gt;junk $2&lt;br /&gt;R$* @ $*@JUNK $#error $@ 5.5.4 $: "554 " $2 ": " $&amp;amp;f&lt;br /&gt;&lt;br /&gt;# Block mail from invalid addresses&lt;br /&gt;R$* $: $&gt;3 $1 make domain canonical&lt;br /&gt;R$* &lt; @ $+ .&gt; $* $@ ok name resolved ok&lt;br /&gt;# Killer case -- single token domain&lt;br /&gt;R$* &lt; @ $- &gt; $* $#error $@ 5.5.1 $: "551 Invalid host name: " $2&lt;br /&gt;# Delay case -- domain doesn't resolve&lt;br /&gt;R$* &lt; @ $+ &gt; $* $#error $@ 4.5.1 $: "451 Unknown domain: " $2&lt;br /&gt;&lt;br /&gt;And that's it. If you'd like, you can download a text version of this for easier editing.&lt;br /&gt;Oh, one last thing. The rejection messages all get logged in /var/log/maillog (at least on our system). Here's a PERL script for maillog.scan that gives us a nightly report of spam blocks:&lt;br /&gt;&lt;br /&gt;#!/usr/bin/perl&lt;br /&gt;&lt;br /&gt;while($lt;$gt;) {&lt;br /&gt;if(/rejection:.*\.\.\. ? ?(.*)/) {&lt;br /&gt;$spam{$1} += 1;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;print "\nSpam blocks:\n\n";&lt;br /&gt;&lt;br /&gt;foreach $msg (sort keys %spam) {&lt;br /&gt;printf "%5d %s\n", $spam{$msg}, $msg;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;print "\n";&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Anand Shah&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6328520688270940312-8710515062227203770?l=shahanand.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shahanand.blogspot.com/feeds/8710515062227203770/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6328520688270940312&amp;postID=8710515062227203770&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/8710515062227203770'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6328520688270940312/posts/default/8710515062227203770'/><link rel='alternate' type='text/html' href='http://shahanand.blogspot.com/2007/09/blocking-spam-with-sendmail.html' title='Blocking Spam with Sendmail'/><author><name>Anand Shah</name><uri>http://www.blogger.com/profile/06981794335628820024</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6328520688270940312.post-4878079786005635206</id><published>2007-09-19T18:44:00.000+05:30</published><updated>2007-09-19T18:49:48.881+05:30</updated><title type='text'>Understanding QMAIL</title><content type='html'>&lt;strong&gt;README_SPAMCONTROL&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;Objective&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SPAMCONTROL is an extension for qmail. It provides the following features:&lt;br /&gt;&lt;br /&gt;Enhancements for qmail-smtpd:&lt;br /&gt;&lt;br /&gt;ESMTP enhancements &lt;br /&gt;Strict RFC 2821 conformance. &lt;br /&gt;Reference 'Mail From:' parameter parser, supporting SIZE (RFC 1870) and AUTH options. &lt;br /&gt;Customizable SMTP Authentication (RFC 2554) support for LOGIN, PLAIN, and CRAM-MD5. &lt;br /&gt;Optional STARTTLS (RFC 2487) support in conjunction with sslserver. +) &lt;br /&gt;Mail From Verification (MAV) allows relaying only of verified/authorized addresse. +) &lt;br /&gt;SMTP envelope Anti-Spam-Tools &lt;br /&gt;Wildmat Filters for the HELO/EHLO greeting and the 'Mail From: &lt;Return-Path&gt;' in Split-Horizon fashion. &lt;br /&gt;DNS Lookup for the HELO/EHLO greeting (A/MX) and the domain part of the 'Mail From:' (MX). &lt;br /&gt;Customizable HELO/EHLO greeting checks. &lt;br /&gt;Tarpitting and Smart Rejection in case of too many invalid Recipients. &lt;br /&gt;Enhanced badmailfrom support &lt;br /&gt;Wildmat filter. &lt;br /&gt;Additional 'badmailfromunknown' capabilities. #) &lt;br /&gt;Anti-spoofing of own addresses. #) &lt;br /&gt;Recipients extensions &lt;br /&gt;badrcptto wildmat filter.&lt;br /&gt;Restricting the number of allowed 'Rcpt To:' per SMTP session. &lt;br /&gt;Whitelisting: Controlling the reception of mails not only on a rcpthosts base but rather on the complete &lt;Forwarding-Path&gt; with fast and extensible cdb-lookup, domain-wildlisting and VERP support. &lt;br /&gt;Customizable 550 or 450 return messages. #) &lt;br /&gt;Virus prevention &lt;br /&gt;Reference badmimetypes implementation. &lt;br /&gt;Additional badloadertypes filter. &lt;br /&gt;Qmail High Performance Scanner Interface (QHPSI). &lt;br /&gt;Customizable SMTP 554 Reply Message. &lt;br /&gt;Logging &lt;br /&gt;Extensible logging format. &lt;br /&gt;Logging for failed and accepted SMTP sessions. &lt;br /&gt;Enhancements for qmail-remote:&lt;br /&gt;&lt;br /&gt;SMTP Authentication &lt;br /&gt;Supported are Auth types LOGIN and PLAIN. &lt;br /&gt;Additional authsenders control file. &lt;br /&gt;Fast delivery &lt;br /&gt;Delivery to any DNS listed MX for that domain instead just the primary. &lt;br /&gt;Increased read buffer for delivery. &lt;br /&gt;Enhancements for qmail-pop3d:&lt;br /&gt;&lt;br /&gt;STARTTLS support &lt;br /&gt;Enhancements for qmail-queue:&lt;br /&gt;&lt;br /&gt;High speed virus scanner by means of QHPSI &lt;br /&gt;Additional QMAILQUEUE usage &lt;br /&gt;Optional BIGTODO support &lt;br /&gt;Enhancements for qmail-send:&lt;br /&gt;&lt;br /&gt;Bounce control &lt;br /&gt;Restricting the size of bounces. &lt;br /&gt;Doublebouncetrim. &lt;br /&gt;Additional recognition of local IP addresses &lt;br /&gt;moreipme &lt;br /&gt;notipme &lt;br /&gt;With SPAMCONTROL, qmail-smtpd can stand the two most common threats:&lt;br /&gt;&lt;br /&gt;Lexical and/or dictionary Spam attacks in particular to none-existing &lt;Forwarding-Path&gt; and the subsequent generation of bounce 
