<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Shekhar Govindarajan's Blog &#187; Tips N Tricks</title>
	<atom:link href="http://www.shekhargovindarajan.com/category/tips-n-tricks/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.shekhargovindarajan.com</link>
	<description>My Notepad on the Web</description>
	<lastBuildDate>Thu, 29 Jul 2010 05:58:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<atom:link rel="hub" href="http://pubsubhubbub.appspot.com/" />
			<item>
		<title>Solved: Images load up partially when served by Apache Web Server</title>
		<link>http://www.shekhargovindarajan.com/tips-n-tricks/solved-images-load-up-partially-when-served-by-apache-web-server/?&amp;owa_from=feed&amp;owa_sid=&amp;utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=solved-images-load-up-partially-when-served-by-apache-web-server</link>
		<comments>http://www.shekhargovindarajan.com/tips-n-tricks/solved-images-load-up-partially-when-served-by-apache-web-server/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 18:00:39 +0000</pubDate>
		<dc:creator>Shekhar</dc:creator>
				<category><![CDATA[Tips N Tricks]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[cifs]]></category>
		<category><![CDATA[enablesendfile]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[nfs]]></category>
		<category><![CDATA[samba]]></category>
		<category><![CDATA[smb]]></category>

		<guid isPermaLink="false">http://www.shekhargovindarajan.com/?p=1647</guid>
		<description><![CDATA[This was a very strange issue which showed up at one of my client&#8217;s Web application. The application is hosted on a Apache Web server and serves JPEG images. These JPEG files reside on a different server and mounted via CIFS (loosely called Samba mount) on the Linux machine running the Web server.
Now the issue [...]]]></description>
			<content:encoded><![CDATA[<p>This was a very strange issue which showed up at one of my client&#8217;s Web application. The application is hosted on a Apache Web server and serves JPEG images. These JPEG files reside on a different server and mounted via CIFS (loosely called Samba mount) on the Linux machine running the Web server.</p>
<p>Now the issue was, many JPEG images, especially the larger ones, loaded up only partially in a Web browser (both Internet Explorer and Firefox). What made them load fully was pressing CTRL+R or clicking on Refresh/Reload several times. Bandwidth wasn&#8217;t an issue here, since this problem occurred even when browsing the JPEGs from the local network.<span id="more-1647"></span></p>
<p>At first, I doubted that it could be an issue with the way the JPEGs are produced, something related to the progressive rendering et al. But then I came across an instance (too involved to explain it here) which proved me wrong.</p>
<p>Testing the case further, I found that the JPEGs load absolutely fine in the Web browser, when opened up via File&gt;Open &#8211; instead of hitting the Web Server. This made me turn my eyes onto the Apache Web server. Googling around and reading the comments in the Apache configuration file gave a few hints. With some hit-n-trial, the solution that worked for me is as follows:</p>
<ul>
<li>Login as root</li>
<li>Open the httpd.conf file (the configuration file of Apache Web server) in a text editor (like vi). On RedHat/Fedora/CentOS Linux, this file can be found in the directory /etc/httpd/conf</li>
<li>Append the following line to the end of the file:EnableSendfile off</li>
<li>Save the file.</li>
<li>Reload or restart the web server. On a RedHat/Fedora/CentOS Linux the command &#8217;service httpd reload&#8217; can be used for the same.</li>
</ul>
<p>The EnableSendFile directive in Apache is documented as: &#8220;Control whether the sendfile kernel support is used to deliver files (assuming that the OS supports it). The default is on; turn this off if you serve from NFS-mounted filesystems.&#8221;</p>
<p>What caught my attention was &#8220;turn this off if you serve from NFS-mounted filesystems&#8221;. But, in my case, the JPEG files were mounted via CIFS and not NFS. But reading more about the EnableSendFile directive at <a href="http://httpd.apache.org/docs/2.2/mod/core.html#enablesendfile">http://httpd.apache.org/docs/2.2/mod/core.html#enablesendfile</a>, reveals the it affects even SMB (and hence CIFS) or any other network mounted files. Following is the snippet from the document:</p>
<p><em>With a network-mounted DocumentRoot (e.g., NFS or SMB), the kernel may be unable to serve the network file through its own cache.</em></p>
<p>Also, I guess, this solution is not specific to JPEG files. The above mentioned issue and the solution should be applicable to other file types too, which are served from a network mounted drive.</p>
<img src="http://www.shekhargovindarajan.com/?ak_action=api_record_view&id=1647&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.shekhargovindarajan.com/tips-n-tricks/solved-images-load-up-partially-when-served-by-apache-web-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Replacement battery for Android Dev Phone 1</title>
		<link>http://www.shekhargovindarajan.com/tips-n-tricks/replacement-battery-for-android-dev-phone-1/?&amp;owa_from=feed&amp;owa_sid=&amp;utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=replacement-battery-for-android-dev-phone-1</link>
		<comments>http://www.shekhargovindarajan.com/tips-n-tricks/replacement-battery-for-android-dev-phone-1/#comments</comments>
		<pubDate>Mon, 28 Jun 2010 18:05:19 +0000</pubDate>
		<dc:creator>Shekhar</dc:creator>
				<category><![CDATA[Tips N Tricks]]></category>
		<category><![CDATA[adp1]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[battery]]></category>
		<category><![CDATA[brightstar]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[htc]]></category>
		<category><![CDATA[mugen power]]></category>

		<guid isPermaLink="false">http://www.shekhargovindarajan.com/?p=1598</guid>
		<description><![CDATA[This is a long pending post that I wanted to write. In April, after about a year of purchase of my Android Dev Phone 1 (a.k.a. ADP1), its battery started draining out. It became so bad that that I had to keep the phone always on charging. While at home/office, I used to charge it [...]]]></description>
			<content:encoded><![CDATA[<p>This is a long pending post that I wanted to write. In April, after <a href="http://www.shekhargovindarajan.com/google/anroid-to-india-a-shipping-faq/" target="_blank">about a year of purchase</a> of my Android Dev Phone 1 (a.k.a. ADP1), its battery started draining out. It became so bad that that I had to keep the phone always on charging. While at home/office, I used to charge it using USB/AC power. While driving, I kept it charging using <a href="http://twitter.com/shekharg/statuses/7306761717" target="_blank">a nifty car adapter</a>.</p>
<p>After about a week of frustration and laziness (to search for a fix), I decided to buy a replacement battery. But the question was, whom do I contact for the replacement battery? HTC? Google? or Brightstar (the distributor) ? Phew&#8230;.<span id="more-1598"></span></p>
<p>While I was Googling around to find an answer, I came across the site of Mugen Power <a href="http://www.mugen-power-batteries.com/">http://www.mugen-power-batteries.com/</a>. It looked interesting enough to try shipping a replacement battery from here. So I decided to chuck out Google, HTC and Brightstar and go for Mugen Power. But it wasn&#8217;t a joy ride to start with. The first stumbling block was as follows:</p>
<p><strong>Will Mugen Power&#8217;s &#8216;TMobile G1 Dream battery&#8217; work for ADP1?</strong><br />
The battery that Mugen Power sells is labelled for TMobile G1 Dream. While TMobile G1 Dream and ADP1 are the same hardware, I didn&#8217;t want to take any chances.</p>
<p>So, I filled up the <a href="http://www.mugen-power-batteries.com/contacts/" target="_blank">Contact Us</a> form on the website asking whether the same battery will work for my ADP1. I got an E-mail reply within 4 hours asking me to send the photographs of the phone&#8217;s battery. After sending the photographs, I got a reply within 7 hours confirming that the T-Mobile G1&#8217;s battery will fit in my ADP1. The E-mail also mentioned the link <a href="http://www.mugen-power-batteries.com/htc/htc-dream.html" target="_blank">http://www.mugen-power-batteries.com/htc/htc-dream.html</a> from where I could buy the battery.</p>
<p>The take home from the above are:</p>
<ul>
<li>While the responses were coming from a Gmail address <img src='http://www.shekhargovindarajan.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  , Mugen Power&#8217;s support is quick and effective.</li>
<li><strong>The battery for T-Mobile&#8217;s G1, sold by Mugen Power, fits in and works for an Android Dev Phone 1.</strong></li>
</ul>
<p><strong>The shipping experience</strong><br />
Following the link, I bought &#8220;<a href="http://www.mugen-power-batteries.com/htc/htc-dream/mugen-power-htc-dream-t-mobile-google-phone-g1-1200mah-extra-eros-akkumulator.html" target="_blank">Mugen Power HTC Dream T-mobile Google Phone G1 1200mAh Extended Replacement Battery [HLI-G1SL]</a>&#8220;. Sorry for the long name, but that&#8217;s what it is called.</p>
<p>Note that I went for the 1200 mAh battery. The battery which ships with ADP1 is a 1150 mAh &#8211; so this Mugen Battery was hardly an extended battery. But, one can also go for 2400 or the 3900 mAh batteries which will keep your phone powered up for days! But note that the 2400 and 3900 mAh options need a extended battery cover due to the size of the battery. Fortunately the battery cover is shipped alongwith.</p>
<p>Coming back to my shipping experience, I ordered the 1200 mAh battery priced @ $26.95. I went for Free Shipping and not for the Speedpost option. The latter costs $36.13 (more than the cost of the battery!) but promises delivery within 2-6 business days. Free shipping quoted a delivery within 10-15 business days. But guess what, I received the battery in 8 days! I placed the order on 29 April and it got delivered to my residence at New Delhi, India on 8 May.</p>
<p>Seems I was lucky because one of my friends who ordered an extended battery for his HTC Touch, received the battery after 15 days at Gurgaon, Haryana, India.</p>
<p>Note that there were no import or customs duty to pay. That is, I owned the  battery at the cost of $26.95 (all inclusive).</p>
<p>To sum up, the Mugen Power battery came to rescue when I was desperate. When fully charged, the battery keeps the phone alive for about 7-8 hours under heavy usage &#8211; Twitter, Facebook and E-mail sync, WiFi and GPS at times, screen at its full brightness and active wallpaper! This performance is almost same as that of the ADP1&#8217;s battery &#8211; which it shipped with. My phone is powered by Mugen Power battery for more than a month now.</p>
<img src="http://www.shekhargovindarajan.com/?ak_action=api_record_view&id=1598&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.shekhargovindarajan.com/tips-n-tricks/replacement-battery-for-android-dev-phone-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Solved: &#8216;requires bundle org.eclipse.wst.xml.core&#8217; error, while installing Google Plugin in Fedora Eclipse</title>
		<link>http://www.shekhargovindarajan.com/tips-n-tricks/solved-requires-bundle-org-eclipse-wst-xml-core-error-while-installing-google-plugin-in-fedora-eclipse/?&amp;owa_from=feed&amp;owa_sid=&amp;utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=solved-requires-bundle-org-eclipse-wst-xml-core-error-while-installing-google-plugin-in-fedora-eclipse</link>
		<comments>http://www.shekhargovindarajan.com/tips-n-tricks/solved-requires-bundle-org-eclipse-wst-xml-core-error-while-installing-google-plugin-in-fedora-eclipse/#comments</comments>
		<pubDate>Sat, 12 Jun 2010 14:42:08 +0000</pubDate>
		<dc:creator>Shekhar</dc:creator>
				<category><![CDATA[Tips N Tricks]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Fedora 12]]></category>
		<category><![CDATA[Fedora 13]]></category>
		<category><![CDATA[Google App Engine]]></category>
		<category><![CDATA[google plugin]]></category>
		<category><![CDATA[google wave]]></category>
		<category><![CDATA[google web toolkit]]></category>

		<guid isPermaLink="false">http://www.shekhargovindarajan.com/?p=1585</guid>
		<description><![CDATA[The simplest way to get started with developing for Google App Engine, Google Web Toolkit and Google Wave is to use the Google Plugin for the Eclipse IDE. This plugin installs the SDK as well. Eclipse&#8217;s built-in wizard to add new software (plugin) makes it very easy to install the Google plugin. This wizard can [...]]]></description>
			<content:encoded><![CDATA[<p>The simplest way to get started with developing for Google App Engine, Google Web Toolkit and Google Wave is to use the <a href="http://code.google.com/eclipse/" target="_blank">Google Plugin</a> for the <a href="http://www.eclipse.org/" target="_blank">Eclipse</a> IDE. This plugin installs the SDK as well. Eclipse&#8217;s built-in wizard to add new software (plugin) makes it very easy to install the Google plugin. This wizard can be supplied with a URL (http://dl.google.com/eclipse/plugin/3.5 in this case) to a download site. Henceforth, Eclipse takes care of downloading and installing the plugin, along with associated dependencies, bundle or required software.</p>
<p>However, for me, installing the Google Plugin didn&#8217;t go as smooth as expected. I have been using <a href="http://fedoraproject.org/" target="_blank">Fedora</a> Linux on my laptop since the last 5+ years. Fedora ships with the Eclipse IDE. When I tried installing the Google Plugin in Fedora Eclipse, I faced the following error.<span id="more-1585"></span> This error surfaced with Eclipse 3.5 on Fedora 12 and Fedora 13.</p>
<pre>Cannot complete the install because one or more required items could not be found.

  Software being installed: Google Plugin for Eclipse 3.5 1.3.2.v201003242055
                                        (com.google.gdt.eclipse.suite.e35.feature.feature.group 1.3.2.v201003242055)

  Missing requirement: Google App Engine Plugin 1.3.2.v201003242055
                                   (com.google.appengine.eclipse.core 1.3.2.v201003242055)
                                   requires 'bundle org.eclipse.wst.xml.core 0.0.0' but it could not be found

  Cannot satisfy dependency:
              From: Google Plugin for Eclipse 3.5 1.3.2.v201003242055
              (com.google.gdt.eclipse.suite.e35.feature.feature.group 1.3.2.v201003242055)
              To: com.google.appengine.eclipse.core [1.3.2.v201003242055]</pre>
<p>Googling around gives numerous solutions &#8211; from using a third party repository (with a broken link <img src='http://www.shekhargovindarajan.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ) to installing &#8220;Eclipse IDE for Java EE Developers&#8221; from www.eclipse.org. But the solution that worked for me was the simplest. Please note that this issue and the following solution could be specific to Eclipse on Fedora and Google Plugin.</p>
<p><strong>The Solution</strong><br />
Launch Eclipse. Click on Help&gt;Install New Software.  On the subsequent window titled “Available Software”, click on blue link &#8216;Available Software Sites&#8217;. Look for the URL http://download.eclipse.org/releases/galileo in the list of Software Sites. Select and click on Enable (button on the right). Click on OK.</p>
<div id="attachment_1594" class="wp-caption alignleft" style="width: 310px"><a href="http://www.shekhargovindarajan.com/wp-content/uploads/2010/06/Enable-the-Galileo-software-site-before-installing-the-Google-Plugin.png"><img class="size-medium wp-image-1594" title="Enable the Galileo software site before installing the Google Plugin" src="http://www.shekhargovindarajan.com/wp-content/uploads/2010/06/Enable-the-Galileo-software-site-before-installing-the-Google-Plugin-300x222.png" alt="Enable the Galileo software site before installing the Google Plugin" width="300" height="222" /></a><p class="wp-caption-text">Enable the Galileo software site before installing the Google Plugin</p></div>
<p>Back on the “Available Software” window, type the URL  http://dl.google.com/eclipse/plugin/3.5  in the field labeled “Work with:” . Click on Add. This will show Plugin and SDKs in the bottom pane. Check the boxes against them and click on Next. Follow the onscreen instructions. This will install the Google plugin and SDK. When prompted, restart Eclipse.</p>
<p><strong>A few Troubleshooting Tips</strong><br />
On a freshly installed Eclipse, all software sites are disabled by default. This may not be true, if you have been updating or installing other plugins in Eclipse. I recall that, on Fedora 12, I faced the issue of numerous conflicts till I disabled all but the http://download.eclipse.org/releases/galileo site. Bottom line: before installing the Google Plugin, make sure that you only have the Galileo site enabled.</p>
<p>Second, this happened to me once that, even after following the above steps I got the same error. It seemed that Eclipse had problem in downloading the required software and ended up throwing the same error, instead of reporting a failed download. In this case, restart Eclipse, else you may keep getting the same error on retries. After restart, follow the steps mentioned in <strong>The Solution</strong> again.</p>
<img src="http://www.shekhargovindarajan.com/?ak_action=api_record_view&id=1585&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.shekhargovindarajan.com/tips-n-tricks/solved-requires-bundle-org-eclipse-wst-xml-core-error-while-installing-google-plugin-in-fedora-eclipse/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Solved: Garbled text in Putty</title>
		<link>http://www.shekhargovindarajan.com/tips-n-tricks/solved-garbled-text-in-putty/?&amp;owa_from=feed&amp;owa_sid=&amp;utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=solved-garbled-text-in-putty</link>
		<comments>http://www.shekhargovindarajan.com/tips-n-tricks/solved-garbled-text-in-putty/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 07:19:17 +0000</pubDate>
		<dc:creator>Shekhar</dc:creator>
				<category><![CDATA[Tips N Tricks]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[gallery link=]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Microsoft Windows]]></category>
		<category><![CDATA[ncurses]]></category>
		<category><![CDATA[putty]]></category>
		<category><![CDATA[Secure Shell]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[utf8]]></category>

		<guid isPermaLink="false">http://www.shekhargovindarajan.com/?p=1426</guid>
		<description><![CDATA[Putty is a popular and free Linux terminal/shell client for Windows. It allows one to connect to a Linux server using SSH (Secure Shell) or Telnet. I have been using it for as long as I can recall. But this issue of garbled text in Putty is what I have been ignoring, until yesterday.
Yesterday, I had setup Paradox database [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/" target="_blank">Putty</a> is a popular and free Linux terminal/shell client for Windows. It allows one to connect to a Linux server using SSH (Secure Shell) or Telnet. I have been using it for as long as I can recall. But this issue of garbled text in Putty is what I have been ignoring, until yesterday.</p>
<p>Yesterday, I had setup <a href="http://en.wikipedia.org/wiki/Paradox_(database)" target="_blank">Paradox</a> database using <a href="http://www.dosemu.org/" target="_blank">DOSEMU</a> on Linux, for a client. On Putty, the Paradox interface showed garbled making it unusable for the client. My instant suspect was DOSEMU. A quick check revealed that it&#8217;s happening with other apps too - those with a <a href="http://en.wikipedia.org/wiki/Ncurses" target="_blank">ncurses</a> or text based user interface.<span id="more-1426"></span>For example: The garbled text, around the borders of UI elements, showed in ntsysv (as shown in the screenshots). ntsysv is a nifty console app, found in RedHat/CentOS/Fedora Linux, to start services during boot up.
<a href='http://www.shekhargovindarajan.com/tips-n-tricks/solved-garbled-text-in-putty/attachment/before-ntsysv-showing-garbled-text-in-putty/' title='Before - ntsysv showing garbled text in Putty'><img width="150" height="150" src="http://www.shekhargovindarajan.com/wp-content/uploads/2010/03/Before-ntsysv-showing-garbled-text-in-Putty-150x150.png" class="attachment-thumbnail" alt="Before - ntsysv showing garbled text in Putty" title="Before - ntsysv showing garbled text in Putty" /></a>
<a href='http://www.shekhargovindarajan.com/tips-n-tricks/solved-garbled-text-in-putty/attachment/putty-settings-to-fix-garbled-text/' title='Putty settings to fix garbled text'><img width="150" height="150" src="http://www.shekhargovindarajan.com/wp-content/uploads/2010/03/Putty-settings-to-fix-garbled-text-150x150.png" class="attachment-thumbnail" alt="Putty settings to fix garbled text" title="Putty settings to fix garbled text" /></a>
<a href='http://www.shekhargovindarajan.com/tips-n-tricks/solved-garbled-text-in-putty/attachment/after-ntsysv-after-the-change-in-settings-in-putty/' title='After - ntsysv after the change in settings in Putty'><img width="150" height="150" src="http://www.shekhargovindarajan.com/wp-content/uploads/2010/03/After-ntsysv-after-the-change-in-settings-in-Putty-150x150.png" class="attachment-thumbnail" alt="After - ntsysv after the change in settings in Putty" title="After - ntsysv after the change in settings in Putty" /></a>
</p>
<p><strong>The Solution<br />
</strong>Launch Putty. On the Category pane (on the left), click on Windows&gt;Translation. For the dropdown labeled &#8220;Received data assumed to be in which character set&#8221;, select UTF-8. To save this setting, click on Sessions (in the Category pane). On the right pane, select &#8220;Default Settings&#8221; and click on the button labeled Save. This is what worked for me with Putty version 0.60.</p>
<img src="http://www.shekhargovindarajan.com/?ak_action=api_record_view&id=1426&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.shekhargovindarajan.com/tips-n-tricks/solved-garbled-text-in-putty/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Drupal 6: Different Page Templates for different Content Types</title>
		<link>http://www.shekhargovindarajan.com/tips-n-tricks/drupal-6-different-page-templates-for-different-content-types/?&amp;owa_from=feed&amp;owa_sid=&amp;utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=drupal-6-different-page-templates-for-different-content-types</link>
		<comments>http://www.shekhargovindarajan.com/tips-n-tricks/drupal-6-different-page-templates-for-different-content-types/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 18:00:39 +0000</pubDate>
		<dc:creator>Shekhar</dc:creator>
				<category><![CDATA[Tips N Tricks]]></category>
		<category><![CDATA[Administrator]]></category>
		<category><![CDATA[content type]]></category>
		<category><![CDATA[designer]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[drupal 6]]></category>
		<category><![CDATA[page template]]></category>
		<category><![CDATA[page.tpl.php]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.shekhargovindarajan.com/?p=1412</guid>
		<description><![CDATA[Given the flexibility of Drupal, a different page template depending on the Content Type is not very demanding. The good news is, it is very much possible. The bad news is you may have to struggle like me to find the simplest, neatest and working method to achieve it.
Reading the documentation and Googling would result [...]]]></description>
			<content:encoded><![CDATA[<p>Given the flexibility of Drupal, a different page template depending on the Content Type is not very demanding. The good news is, it is very much possible. The bad news is you may have to struggle like me to find the simplest, neatest and working method to achieve it.</p>
<p>Reading the documentation and Googling would result in many methods &#8211; some are confusing, some are not so neat and others apply to earlier versions of Drupal. Following is my favourite method to setup different page templates, depending on the Content Type, in Drupal 6.<span id="more-1412"></span></p>
<p><strong>What is a Page Template<br />
</strong>This is the template which contains a Node. This must not be mistaken with the node template, for example, a Story node which displays the title, teaser, images, comment form and et al. In Drupal, the default page template is written in the file named page.tpl.php (and the node template is in node.tpl.php).</p>
<p>It is the page template with which you can display three columns for certain content types and two columns for others. It is the page template using which you can dictate the column which will show a Story, a Blog entry, a Forum topic or a <a href="http://drupal.org/project/webform" target="_blank">Webform</a>. This template is where you insert the Regions for Blocks and Views.</p>
<p><strong>A Neat Solution</strong><br />
Append or write the following code in a file named template.php in your theme&#8217;s directory:</p>
<pre>&lt;?php
function &lt;theme-name&gt;_preprocess_page(&amp; $vars) {
	if (isset ($vars['node']) &amp;&amp; $vars['node']-&gt;type == "blog") {
		$vars['template_files'] = array();
		$vars['template_files'][] = 'page-blog';
	}

	if (isset ($vars['node']) &amp;&amp; $vars['node']-&gt;type == "forum") {
		$vars['template_files'] = array();
		$vars['template_files'][] = 'page-forum';
	}

	if (isset ($vars['node']) &amp;&amp; $vars['node']-&gt;type == "webform") {
		$vars['template_files'] = array();
		$vars['template_files'][] = 'page-webform';
	}
}
?&gt;
</pre>
<p>In the above code replace &lt;theme-name&gt;, in the name of the function, with the name of your Theme&#8217;s directory. For example, suppose the name of your Theme&#8217;s directory is &#8220;blue&#8221;, then:</p>
<pre>function blue_preprocess_page(&amp; $vars)</pre>
<p>Now all you need to do is what you are most creative at. Write the templates for each content type. Drop files in your theme&#8217;s directory named page-blog.tpl.php, page-forum.tpl.php and page-webform.tpl.php for the Blog entry, Form topic and Webform  respectively. Feel free to set different page layouts and Regions in these files. Note that any Content Type which is not specified in the above code will use page.tpl.php &#8211; the default page template. For example, in this case, the Story content type will use page.tpl.php.</p>
<p><strong>Important: </strong>Log into Drupal as admin and goto Administrator&gt;Site configuration&gt;Performance and click on the button &#8220;Clear cached data&#8221; (at the bottom).</p>
<p>I prefer this solution because the template selection logic goes separated into a different file, leaving the Page templates friendly for a designer. Plus, template.php is the logical place to add overrides or specific behaviour. Most likely a seasoned Drupal developer will first look into this file for customizations.</p>
<p>Created or added a new content type? All you need is to add another IF block in the above code and drop a new page template. Before concluding that it is not working for you, do remember to clear the cache.</p>
<img src="http://www.shekhargovindarajan.com/?ak_action=api_record_view&id=1412&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.shekhargovindarajan.com/tips-n-tricks/drupal-6-different-page-templates-for-different-content-types/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Kindle to India: Frequently Asked Questions</title>
		<link>http://www.shekhargovindarajan.com/tips-n-tricks/kindle-to-india-frequently-asked-questions/?&amp;owa_from=feed&amp;owa_sid=&amp;utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=kindle-to-india-frequently-asked-questions</link>
		<comments>http://www.shekhargovindarajan.com/tips-n-tricks/kindle-to-india-frequently-asked-questions/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 10:35:25 +0000</pubDate>
		<dc:creator>Shekhar</dc:creator>
				<category><![CDATA[Tips N Tricks]]></category>
		<category><![CDATA[Amazon]]></category>
		<category><![CDATA[Amazon Book Store]]></category>
		<category><![CDATA[Amazon Store]]></category>
		<category><![CDATA[Amazon.com]]></category>
		<category><![CDATA[auto-confirm at amazon dot com]]></category>
		<category><![CDATA[browse/search]]></category>
		<category><![CDATA[built-in Web browser]]></category>
		<category><![CDATA[cellular telephone]]></category>
		<category><![CDATA[ebook]]></category>
		<category><![CDATA[ebook reader]]></category>
		<category><![CDATA[free Internet connection]]></category>
		<category><![CDATA[Global Wireless]]></category>
		<category><![CDATA[global wirless]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[india]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[kindle]]></category>
		<category><![CDATA[kindle 1]]></category>
		<category><![CDATA[kindle 2]]></category>
		<category><![CDATA[kindle dx]]></category>
		<category><![CDATA[Kindle Global Wireless]]></category>
		<category><![CDATA[mobi]]></category>
		<category><![CDATA[mobile phone network]]></category>
		<category><![CDATA[multi-purpose and bulkier device]]></category>
		<category><![CDATA[New Delhi]]></category>
		<category><![CDATA[nifty device]]></category>
		<category><![CDATA[PayPal]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[search fails]]></category>
		<category><![CDATA[search works]]></category>
		<category><![CDATA[ship-confirm at amazon dot com]]></category>
		<category><![CDATA[txt]]></category>
		<category><![CDATA[United States]]></category>
		<category><![CDATA[USD]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[web browsing]]></category>
		<category><![CDATA[wireless connection works]]></category>
		<category><![CDATA[wireless network]]></category>

		<guid isPermaLink="false">http://www.shekhargovindarajan.com/?p=1112</guid>
		<description><![CDATA[I ordered an Amazon Kindle for a friend of mine.  Before ordering the Kindle, there were various doubts and apprehensions about it&#8217;s functionality, cost and shipping to India. It took me numerous Google searches to conclude that Kindle is a safe and good buy for someone in India.
Subsequently, I placed an order on behalf of [...]]]></description>
			<content:encoded><![CDATA[<p>I ordered an Amazon Kindle for a friend of mine.  Before ordering the Kindle, there were various doubts and apprehensions about it&#8217;s functionality, cost and shipping to India. It took me numerous Google searches to conclude that Kindle is a safe and good buy for someone in India.</p>
<div id="attachment_1154" class="wp-caption alignleft" style="width: 242px"><a href="http://www.shekhargovindarajan.com/wp-content/uploads/2010/01/240px-Kindle_2_-_Front.jpg"><img class="size-medium wp-image-1154 " title="240px-Kindle_2_-_Front" src="http://www.shekhargovindarajan.com/wp-content/uploads/2010/01/240px-Kindle_2_-_Front-232x300.jpg" alt="You cannot browse the Web using Kindle (Global Wireless) in India. Image source: Wikipedia.org" width="232" height="300" /></a><p class="wp-caption-text">Kindle (Global Wireless) Image source: Wikipedia.org</p></div>
<p>Subsequently, I placed an order on behalf of my friend and the Kindle was shipped to New Delhi, India to my residence in about 2 days. I got to setup, configure and play with this nifty device, before I could hand it over to my friend.<span id="more-1112"></span></p>
<p>I thought it would be a good idea to share my experience of the ordering, shipping, and how well Kindle behaves in India. Instead of writing the entire experience chronologically, I jot it down as FAQs (Frequently Asked Questions).</p>
<ol>
<li><strong>Where did you order the Kindle from?<br />
</strong><a href="http://www.amazon.com/" target="_blank">Amazon.com</a><strong> </strong></li>
<li><strong>Which version of Kindle did you order? Kindle 1, Kindle 2, Kindle DX or Kindle Global Wireless &#8230; ?<br />
</strong> The officially available and latest models are called Kindle (Global Wireless) and Kindle DX (Global Wireless). I bought Kindle (Global Wireless).</li>
<li><strong>What does Global Wireless mean?</strong><br />
With Global Wireless versions, you can browse/search through the Amazon Book Store and Wikipedia through a free Internet connection. This connection (which uses the mobile phone network) is pre-paid by Amazon and you do not have to pay any bills for the aforementioned browsing/searching.</li>
<li><strong>Why did you buy Kindle and not Kindle DX ?<br />
</strong>Kindle DX is almost double the price of Kindle <strong><br />
</strong></li>
<li><strong>What is the total cost of Kindle?</strong><br />
$378.57 (USD)</li>
<li><strong>Why do I have to pay so much ?</strong><br />
This cost includes the shipping and the duty. Following is the bifurcation :<br />
<em>Cost of the device:</em> $259.00<br />
<em>Import Duty:</em> $98.59<br />
<em>Shipping and Handling:</em> $20.98</li>
<li><strong>Can I reduce the cost by opting for an alternate shipping option, even if it takes longer to ship ?</strong><br />
No, alternate shipping option is offered for shipping to India.</li>
<li><strong>Is there any hidden cost ?</strong><br />
No.</li>
<li><strong>What is the mode of payment ?</strong><br />
Credit/Debit Card</li>
<li><strong>Can I pay through <a href="http://www.paypal.com">Paypal</a> ?</strong><br />
No.</li>
<li><strong>How much time does it take to ship the Kindle to India ?</strong><br />
2 days<br />
Note: I ordered the Kindle on 18th January at 21:00 IST  and got it on 21st January, around 11:00 IST. It was a Monday evening when I ordered and got the Kindle on Thursday morning. Note that the device was shipping during business days. If holidays or weekends fall in between, the shipping may be delayed.</li>
<li><strong>Will  I be notified about the order and the shipping status ?</strong><br />
You will get notified by two  E-mails sent from <strong><em>auto-confirm at amazon dot com </em></strong>and<strong><em> Amazon.com (ship-confirm at amazon dot com)</em></strong>. The first E-mail is sent after a successful order with the order details. The second E-mail is sent as soon as the Kindle is dispatched for shipping and includes the tracking number to track the device in transit.</li>
<li><strong>How much time does it take to dispatch the Kindle for shipping after a successful order ?</strong><br />
Less than 24 hours.</li>
<li><strong>How can I track my shipping ?</strong><br />
You can track the device by logging into your Amazon account &#8211; which you used to order the Kindle.</li>
<li><strong>What are the contents of the box that gets delivered<br />
</strong>The Kindle device, a getting started manual, a USB cable and a power adapter &#8211; U.S. or United States style, two pin plug.</li>
<li><strong>How do I charge the Kindle?</strong><br />
The USB cable can be plugged into the power socket for charging through AC power. For this you will need a U.S. to India power plug converter. Else you can charge the Kindle using your laptop/PC, using the USB cable.</li>
<li><strong>The wireless connection works without any configuration?</strong><br />
Yes. But for the very first time, when I tried searching through the Amazon Store, the Kindle complained about &#8220;no connection&#8221; and suggested to reboot. After a reboot the connection was up. Ever since. the connection has always been on and working.</li>
<li><strong>Can I browse the Web using Kindle?<br />
</strong>No. Kindle does have a built-in Web browser which is suppose to work well for text-only or low-graphics Websites. But when I try to browse to a Website, the browser shows an error saying &#8220;Due to local restrictions, web browsing is not available for all countries&#8221;.   <strong> </strong></li>
<li><strong>Can I Google using Kindle?<br />
</strong>No. The search fails with the message saying &#8220;Due to local restrictions, web browsing is not available for all countries&#8221;. Only Wikipedia and Amazon Store search works, over the wireless network (refer to FAQ 3)</li>
<li><strong>Does Kindle support PDFs?</strong><br />
This question is not specific to India but to the device. Yet the answer is yes, Kindle supports PDF. But you cannot zoom or enlarge the text/font size of a PDF document. This makes some PDFs unreadable on Kindle.</li>
<li><strong>Can I transfer my own documents or books to the Kindle?</strong><br />
This question is not specific to India but to the device. Yes, you can transfer any Kindle supported documents on the device. I have myself transferred and read .pdf, .txt, and .mobi formats on the Kindle.</li>
<li><strong>Can I transfer and read pirated E-Books, downloaded via Torrents, on the Kindle?</strong><br />
Sorry, this blog is not a place to ask this question.</li>
<li><strong>I have heard that not all books are available for Indian users<br />
</strong>I have heard that too. Will keep this post updated when I comes across such titles.</li>
<li><strong>Instead of Kindle, why you did not recommend an Apple iPad to your friend?<br />
</strong>The launch of iPad was uncertain. As of this writing, its launch and pricing in India is not known. Also iPad is a multi-purpose and bulkier device.</li>
</ol>
<p>Hope this FAQ helps my countrymen in going ahead and bringing home an Amazing Kindle!</p>
<p><strong>Disclaimer: The above FAQ is strictly based on my personal buying and usage experience. Any or all information may be different in your case</strong>.</p>
<p><strong>Update (March 30, 2010): </strong>Received an E-mail from Amazon today, informing about a refund of $36.93 on the export charges. No doubt, it means refund against the import duty. This reduces the total cost of the Kindle to $341.64 ($378.57−$36.93). The E-mail says that the refund has been processed and it may take about 10 business days for it to reflect in the Credit Card statement. Note that, this E-mail on the refund is received after about 2 months since the Kindle was shipped (refer to FAQ 11).</p>
<img src="http://www.shekhargovindarajan.com/?ak_action=api_record_view&id=1112&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.shekhargovindarajan.com/tips-n-tricks/kindle-to-india-frequently-asked-questions/feed/</wfw:commentRss>
		<slash:comments>110</slash:comments>
		</item>
		<item>
		<title>Joomla: Hide breadcrumb on the Home page</title>
		<link>http://www.shekhargovindarajan.com/tips-n-tricks/joomla-hide-breadcrumb-on-the-home-page/?&amp;owa_from=feed&amp;owa_sid=&amp;utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=joomla-hide-breadcrumb-on-the-home-page</link>
		<comments>http://www.shekhargovindarajan.com/tips-n-tricks/joomla-hide-breadcrumb-on-the-home-page/#comments</comments>
		<pubDate>Fri, 08 Jan 2010 11:11:42 +0000</pubDate>
		<dc:creator>Shekhar</dc:creator>
				<category><![CDATA[Tips N Tricks]]></category>
		<category><![CDATA[breadcrumb]]></category>
		<category><![CDATA[frontpage]]></category>
		<category><![CDATA[Joomla]]></category>
		<category><![CDATA[joomla 1.5]]></category>
		<category><![CDATA[Manager From]]></category>
		<category><![CDATA[Module Manager]]></category>
		<category><![CDATA[mod_breadcrumbs]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.shekhargovindarajan.com/?p=959</guid>
		<description><![CDATA[Typical requirement this is. You want to display the breadcrumb on the top of every page but the home page &#8211; also called the default page or the frontpage in Joomla. This is because you don&#8217;t just want the text &#8220;HOME&#8221; hanging on the top of your Joomla&#8217;s home page.
The &#8220;Home&#8221; may be already highlighted [...]]]></description>
			<content:encoded><![CDATA[<p>Typical requirement this is. You want to display the breadcrumb on the top of every page but the home page &#8211; also called the default page or the frontpage in Joomla. This is because you don&#8217;t just want the text &#8220;HOME&#8221; hanging on the top of your Joomla&#8217;s home page.</p>
<p>The &#8220;Home&#8221; may be already highlighted in the main menu, visitors know that they are on the home page and the breadcrumb is not aiding any navigation. Unfortunately, the breadcrumb module (called mod_breadcrumbs) in Joomla 1.5 does not provide any option to hide it on home page and show it on other pages.<span id="more-959"></span>If like me, you are convinced about this issue and are adamant to fix it, the solution is quite simple and requires minimal understanding of Joomla templates. Here you go:</p>
<ul>
<li>Login to Joomla admin panel, goto Extensions&gt;Module Manager</li>
<li>From the &#8220;-Select Type-&#8221; dropdown, select mod_breadcrumbs</li>
<li>Note the Position of the mod_breadcrumbs module. Typically, the position will be called &#8220;breadcrumb&#8221;. It may also be &#8220;top&#8221; or &#8220;header&#8221;. In the latter case, we may get into some trouble, as I will explain later.</li>
</ul>
<p>Corresponding to the noted down position, you will have a tag in the file named index.php, found in &lt;joomla-directory&gt;/templates/&lt;theme-name&gt;:</p>
<p><em>&lt;jdoc:include type=&#8221;modules&#8221; name=&#8221;breadcrumb&#8221; /&gt;</em></p>
<p>Substitute this line with the following lines:</p>
<p><em>&lt;?php<br />
$menu = &amp; JSite::getMenu();<br />
if (!($menu-&gt;getActive() === $menu-&gt;getDefault())) {<br />
?&gt;<br />
</em></p>
<p><em>&lt;jdoc:include type=&#8221;modules&#8221; name=&#8221;breadcrumb&#8221; /&gt;</em></p>
<p><em>&lt;?php<br />
}<br />
?&gt;</em></p>
<p>The above lines of code shows the breadcrumb only when the page is not the default page i.e. not the home page. That&#8217;s it!</p>
<p>But, this works only if the breadcumb module, is the only module, published in the position. If you have other modules published in the same position, you will end up hiding all of them on the home page. Some templates include the breadcrumb module in the positions like &#8220;top&#8221; or &#8220;header&#8221; along with Main Menu module. This will hide the menu on the home page. In this case, you may seek the help of a person who understands Joomla templates and separate out the breadcrumb module to a unique position.</p>
<img src="http://www.shekhargovindarajan.com/?ak_action=api_record_view&id=959&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.shekhargovindarajan.com/tips-n-tricks/joomla-hide-breadcrumb-on-the-home-page/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>FTP Backups made easy</title>
		<link>http://www.shekhargovindarajan.com/tips-n-tricks/ftp-backups-made-easy/?&amp;owa_from=feed&amp;owa_sid=&amp;utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=ftp-backups-made-easy</link>
		<comments>http://www.shekhargovindarajan.com/tips-n-tricks/ftp-backups-made-easy/#comments</comments>
		<pubDate>Thu, 12 Nov 2009 11:54:23 +0000</pubDate>
		<dc:creator>Shekhar</dc:creator>
				<category><![CDATA[Tips N Tricks]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[incremental]]></category>
		<category><![CDATA[lftp]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mirror]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[scheduled]]></category>
		<category><![CDATA[Secure Shell]]></category>
		<category><![CDATA[shared hosted server]]></category>
		<category><![CDATA[wget]]></category>
		<category><![CDATA[www.mysite.com]]></category>

		<guid isPermaLink="false">http://www.shekhargovindarajan.com/?p=862</guid>
		<description><![CDATA[I do not recall backing up data over FTP (File Transfer Protocol) in the near past. Thanks to the SSH (Secure SHell) suite of programs like SCP (Secure Copy) and SFTP (Secure FTP), and RSync. But recently I had to setup a scheduled and unattended backup of data lying on a shared hosted server using [...]]]></description>
			<content:encoded><![CDATA[<p>I do not recall backing up data over FTP (File Transfer Protocol) in the near past. Thanks to the SSH (Secure SHell) suite of programs like <a href="http://en.wikipedia.org/wiki/Secure_copy" target="_blank">SCP (Secure Copy)</a> and <a href="http://en.wikipedia.org/wiki/SSH_file_transfer_protocol" target="_blank">SFTP (Secure FTP)</a>, and <a href="http://en.wikipedia.org/wiki/Rsync" target="_blank">RSync</a>. But recently I had to setup a scheduled and unattended backup of data lying on a shared hosted server using FTP &#8211; the only available option at my disposal.<a href="http://en.wikipedia.org/wiki/Wget" target="_blank"></a></p>
<p><a href="http://en.wikipedia.org/wiki/Wget" target="_blank">Wget</a> is a popular and obvious choice to try out for FTP backups. But it didn&#8217;t work for me and threw an error saying cannot find .listing file. While I was about to dwell more into wget, I spotted the forgotten hero &#8211; lftp. <span id="more-862"></span>lftp is described as a &#8220;Sophisticated file transfer program&#8221;. Do not mistake sophistication with complexity. I found it simple to use for my task. I had to backup the data from the hosting server to a Linux based machine (running <a href="http://en.wikipedia.org/wiki/CentOS" target="_blank">CentOS</a>). I found lftp preinstalled on the machine. If not found installed, one can install it on a <a href="http://en.wikipedia.org/wiki/Red_Hat" target="_blank">RedHat</a>/<a href="http://en.wikipedia.org/wiki/Fedora_%28operating_system%29" target="_blank">Fedora</a>/CentOS based Linux by using the following command:</p>
<p><em>yum install lftp</em></p>
<p>To backup using lftp, the syntax is:</p>
<p><em>lftp  -p &lt;FTP-Port&gt; -u &#8216;&lt;FTP-Username&gt;&#8217;,'&lt;FTP-Password&gt;&#8217; -e &#8216;mirror &#8211;verbose &lt;FTP-Directory&gt; &lt;Local-Directory&gt; ;quit&#8217;   &lt;FTP-Host&gt;</em></p>
<p>For example:</p>
<p><em>lftp  -p 21 -u &#8217;shekhar&#8217;,&#8217;secret&#8217; -e &#8216;mirror &#8211;verbose /public_html /backup/website ;quit&#8217;   www.mysite.com</em></p>
<p>The above command will backup the subdirectories and files in the directory public_html of the website www.mysite.com to a directory named /backup/website on the local machine (on which the lftp command is executed). lftp will automatically create the local directory if it does not exist.</p>
<p>Note that the &#8220;mirror&#8221; option will backup only the files which have changed. This means for the first time, lftp will download/backup all the files from the site. But subsequently, lftp will backup only the new or edited files and directories. This option saves bandwidth by not re-downloading files, if the backup is up to date.</p>
<p>For scheduled and attended backups you can easily schedule a <a href="http://en.wikipedia.org/wiki/Cron" target="_blank">Cron</a> job with the above command. It&#8217;s simple, it works!</p>
<img src="http://www.shekhargovindarajan.com/?ak_action=api_record_view&id=862&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.shekhargovindarajan.com/tips-n-tricks/ftp-backups-made-easy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Postfix: Log E-mails&#8217; Subject</title>
		<link>http://www.shekhargovindarajan.com/tips-n-tricks/postfix-log-e-mails-subject/?&amp;owa_from=feed&amp;owa_sid=&amp;utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=postfix-log-e-mails-subject</link>
		<comments>http://www.shekhargovindarajan.com/tips-n-tricks/postfix-log-e-mails-subject/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 14:56:03 +0000</pubDate>
		<dc:creator>Shekhar</dc:creator>
				<category><![CDATA[Tips N Tricks]]></category>
		<category><![CDATA[Append]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[E-mail]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Find]]></category>
		<category><![CDATA[header_checks]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[mail server]]></category>
		<category><![CDATA[maillog]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[production mail server]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[subject]]></category>
		<category><![CDATA[text editor]]></category>

		<guid isPermaLink="false">http://www.shekhargovindarajan.com/?p=731</guid>
		<description><![CDATA[In Linux, you can view the statistics of incoming and outgoing E-mails by peeking into a log file called maillog (typically found in /var/log directory). Maillog provides the general information about the mails, for example, the sender and recipient(s), status &#8211; sent, rejected, bounced etc. I typically use maillog to check the destiny of mails. [...]]]></description>
			<content:encoded><![CDATA[<p>In Linux, you can view the statistics of incoming and outgoing E-mails by peeking into a log file called maillog (typically found in /var/log directory). Maillog provides the general information about the mails, for example, the sender and recipient(s), status &#8211; sent, rejected, bounced etc. I typically use maillog to check the destiny of mails. At times, it becomes difficult to spot a particular mail due to the sheer volume of mails being logged &#8211; especially on a production mail server.</p>
<p>For example: what if we need to check whether a particular mail sent by Person A has been delivered to Person B. Note that Person A might be sending lots of mails to Person B but we need to spot that one particular mail &#8211; say the one, which was sent by Person A but did not reach Person B. The only identifier, to identify a particular mail, in the maillog is the cryptic message ID. A better and more readable identifier would be the subject of an E-mail.Unfortunately, the subject of the mails is not logged, by default, in the maillog. But we can configure a mail server like Postfix to log the subject line.<span id="more-731"></span></p>
<p><a href="http://www.postfix.org/" target="_blank">Postfix</a> is a popular E-mail server a.k.a. MTA (Mail Transfer Agent) in the Linux world. With Postfix, it is easy to dump the subject line of every E-mail (incoming and outgoing) in the maillog. Assuming that you have a setup, configured and running Postfix, following is how to achieve it. Note that the path of the configuration files mentioned below are typical to <a href="http://www.redhat.com/" target="_blank">RedHat</a>, <a href="http://www.centos.org/" target="_blank">CentOS</a> and <a href="http://fedoraproject.org/" target="_blank">Fedora</a> Linux.</p>
<ul>
<li>Open the file called main.cf, found in /etc/postfix, in a text editor</li>
<li>Find and uncomment (by removing the preceding #) the line which says:<em>header_checks = regexp:/etc/postfix/header_checks<br />
</em></li>
<li>Save the file</li>
<li>Next, open the file named header_checks, found in the directory /etc/postfix, in a text editor</li>
<li>Append the following line to the file:/^Subject:/ WARN</li>
<li>Save the file and activate the Postfix&#8217;s configuration changes by issuing &#8217;service postfix reload&#8217;</li>
</ul>
<p>That&#8217;s it. Now in the maillog,  you will see the subject line of every incoming and outgoing mail. It will show  as follows:</p>
<p>Jun 29 06:16:28 mailer postfix/cleanup[473]: 1A96CD40CA: warning: header Subject: It Works! from mailsrv.foo.com[10.1.1.50]; from=&lt;personA@foo.com&gt; to=&lt;personB@foo1.com&gt; &#8230;</p>
<p>Note that the Subject (&#8220;It Works!&#8221; in this case) is logged in the maillog to identify the E-mail quite easily.</p>
<img src="http://www.shekhargovindarajan.com/?ak_action=api_record_view&id=731&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.shekhargovindarajan.com/tips-n-tricks/postfix-log-e-mails-subject/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Secure File Transfer without Secure Shell</title>
		<link>http://www.shekhargovindarajan.com/tips-n-tricks/secure-file-transfer-without-secure-shell/?&amp;owa_from=feed&amp;owa_sid=&amp;utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=secure-file-transfer-without-secure-shell</link>
		<comments>http://www.shekhargovindarajan.com/tips-n-tricks/secure-file-transfer-without-secure-shell/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 12:20:34 +0000</pubDate>
		<dc:creator>Shekhar</dc:creator>
				<category><![CDATA[Tips N Tricks]]></category>
		<category><![CDATA[access]]></category>
		<category><![CDATA[barred]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[denied]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[scp]]></category>
		<category><![CDATA[scponly]]></category>
		<category><![CDATA[Secure Shell]]></category>
		<category><![CDATA[sftp]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[text editor]]></category>

		<guid isPermaLink="false">http://www.shekhargovindarajan.com/?p=625</guid>
		<description><![CDATA[FTP (File Transfer Protocol) is the de-facto but unsecure method to transfer files. SSH (Secure Shell) and its family of services like SCP (Secure Copy) and SFTP (Secure FTP) allows you shell (telnet like) access as well as file transfer via SCP and SFTP, securely. By &#8220;securely&#8221; I mean the data is that flows across [...]]]></description>
			<content:encoded><![CDATA[<p>FTP (File Transfer Protocol) is the de-facto but unsecure method to transfer files. SSH (Secure Shell) and its family of services like SCP (Secure Copy) and SFTP (Secure FTP) allows you shell (telnet like) access as well as file transfer via SCP and SFTP, securely. By &#8220;securely&#8221; I mean the data is that flows across is encrypted including the username and password. SSH is a popular protocol for shell access and file transfer in the Linux world.</p>
<p>So given a choice, SCP/SFTP is a better option in terms of &#8220;security&#8221;. But enabling SFTP/SCP enables, by default, shell access too. Recently for one of my clients, the requirement was to use SCP instead of FTP while blocking shell access so that no user is able to login, in curiosity, nor could execute any program/script on the server, even by mistake. All they could do is to copy files across &#8211; from their desktop to the server and vice versa.  But, I could not find anything in  SSH configuration that barred SSH, while still allowing SCP.<span id="more-625"></span></p>
<p>The solution lied outside SSH and was trivial. It is called <strong>scponly</strong>. scponly is a shell program, just like Bash, Ksh which barrs shell access via SSH. I had <a href="http://www.centos.org/" target="_blank">CentOS</a> 5.2 running on the client&#8217;s server. scponly RPM was not available from the CentOS repositories. I then setup the <a href="https://rpmrepo.org/RPMforge/Using" target="_blank">RPMForge repository</a> as follows:</p>
<p><em> rpm -ivh http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm</em></p>
<p>Note that the above setup is specific to CentOS 5. Subsequently, I installed scponly as:</p>
<p><em>yum install scponly</em></p>
<p>Next, the shell of all the users, who are barred SSH access, must be set to /usr/bin/scponly. For existing users there are two ways to do it:</p>
<p><strong>Method 1: Using usermod (Recommended)<br />
</strong>Login as root and issue the following command:</p>
<p><em>usermod &#8211;shell /usr/bin/scponly &lt;username&gt;</em></p>
<p>Substitue &lt;username&gt; with the name of the user who will be barred shell access</p>
<p><strong>Method 2: Edit /etc/passwd<br />
</strong>Login as root and open the file named passwd, found in /etc directory, in a text editor. The file contains entry for each user on a seperate line along with their shell name. For example:</p>
<p><em>&lt;username&gt;:x:506:508::/home/&lt;username&gt;:/bin/bash</em></p>
<p>Replace /bin/bash with /usr/bin/scponly. Save the file. This will change the shell of the user named &lt;username&gt; to scponly.</p>
<p><strong>For new users<br />
</strong>For new users you can set the shell to scponly while creating the user via useradd command:</p>
<p><em>useradd &#8211;shell /usr/bin/scponly &lt;username&gt;</em></p>
<p>Once done, when one (who is barred the shell access) tries to SSH, he/she will be able to proceed upto the point of the password prompt. At the prompt, even after supplying a correct password, he/she will not be dropped into a shell. In fact it will appear as if the SSH login has hung &#8211; no errors, no access denied messages.</p>
<img src="http://www.shekhargovindarajan.com/?ak_action=api_record_view&id=625&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.shekhargovindarajan.com/tips-n-tricks/secure-file-transfer-without-secure-shell/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
