<?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>PoundBangWhack.com &#187; How To</title>
	<atom:link href="http://www.poundbangwhack.com/category/how-to/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.poundbangwhack.com</link>
	<description>A web development/programming blog providing info, tips, and tricks on programming languages, scripting, Linux, MySQL and more</description>
	<lastBuildDate>Sat, 17 Jul 2010 05:17:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to reset the bash IFS variable</title>
		<link>http://www.poundbangwhack.com/2010/07/09/how-to-reset-the-bash-ifs-variable/</link>
		<comments>http://www.poundbangwhack.com/2010/07/09/how-to-reset-the-bash-ifs-variable/#comments</comments>
		<pubDate>Fri, 09 Jul 2010 23:53:11 +0000</pubDate>
		<dc:creator>Mark Stoecker</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[SSH/Command Line]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://www.poundbangwhack.com/?p=1381</guid>
		<description><![CDATA[Here&#8217;s a quick tip for everyone.  I was working on a one-liner today at work that involved parsing through a file with some data in it.  The data had spaces in it which can cause problems with the default $IFS variable (Internal File Separator). nixCraft has an excellent tutorial on working with the [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick tip for everyone.  I was working on a one-liner today at work that involved parsing through a file with some data in it.  The data had spaces in it which can cause problems with the default $IFS variable (Internal File Separator). <a href="http://www.cyberciti.biz/tips/handling-filenames-with-spaces-in-bash.html">nixCraft has an excellent tutorial on working with the $IFS variable.</a><br />
<span id="more-1381"></span><br />
As I was test iterations of my one-liner, I was setting resetting the $IFS variable.  While I was smart enough to save it first:</p>
<pre name="code" class="bash">
 OLDIFS=$IFS
</pre>
<p>I forgot to set it back at the end of my one-liner, which caused some problems for me.  I tried checking another server to see what the default is, but if you just run the command</p>
<pre name="code" class="bash">
# echo $IFS
#
</pre>
<p>you see that you just get a blank line.  The way to show all non-printing characters is to pipe the output into <span class="code">cat</span> with a couple of switches.</p>
<pre name="code" class="bash">
# echo "$IFS" | cat -vTE
 ^I$
$
#
</pre>
<p>The switches stand for the following:</p>
<dl>
<dt>-v, &#8211;show-nonprinting</dt>
<dd>use ^ and M- notation, except for LFD and TAB</dd>
<dt>-T, &#8211;show-tabs</dt>
<dd>display TAB characters as ^I</dd>
<dt>-E, &#8211;show-ends</dt>
<dd>display $ at end of each line</dt>
</dl>
<p>**Note -t can be substituted for -vT; -e can be substituted for -vE</p>
<p>So our output above, indicates that <strong>the default setting for the $IFS variable is: a space, followed by a tab, followed by a new line character.</strong></p>
<p>Once I had this information, it was very easy to then <strong>reset the $IFS variable back to it&#8217;s default</strong>.  While trying to set this, I had problems with the tab (for some reason it wasn&#8217;t registering) so I just wrote it as &#8216;^I&#8217;.  Once set, run the </p>
<pre name="code" class="bash">
echo "$IFS" | cat -vTE
</pre>
<p>command again to verify and make sure it matches the output above and you&#8217;ll be all set.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.poundbangwhack.com/2010/07/09/how-to-reset-the-bash-ifs-variable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery tabbed content switcher</title>
		<link>http://www.poundbangwhack.com/2010/06/27/jquery-tabbed-content-switcher/</link>
		<comments>http://www.poundbangwhack.com/2010/06/27/jquery-tabbed-content-switcher/#comments</comments>
		<pubDate>Mon, 28 Jun 2010 05:08:13 +0000</pubDate>
		<dc:creator>Mark Stoecker</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[JavaScript Scripts]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Content Switcher]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Tabs]]></category>

		<guid isPermaLink="false">http://www.poundbangwhack.com/?p=1304</guid>
		<description><![CDATA[I was working on a new web design <del>last night</del> early this morning I found myself struggling (probably more than I should have been) with creating tabbed content switcher (hover over one element changes the content of another).  I knew <a href="http://jquery.com" target="_blank">the right way to go was jQuery</a>, and I wanted to avoid downloading a plugin as that would likely end up with more code and another HTTP request to the server.  As I was working on the content switcher, I had one of those "Let's try this and see if it works" moments (those tend to work all to often for me).  It turned out that it did half of what I needed, so I removed another line and voila! I had my content switcher.]]></description>
			<content:encoded><![CDATA[<p>Eat your heart out <a href="http://en.wikipedia.org/wiki/Alexander_Fleming" target="_blank">Sir Alexander Fleming</a>!  While my accidental invention of a <strong>jQuery tabbed content switcher</strong> may not be up there with <a href="http://popularemails.com/accidentalinventions.htm">penicillin, the pacemaker, and post-it notes</a>, it sure did wonders for my latest web design project.<br />
<span id="more-1304"></span></p>
<p>I was working on a new web design <del>last night</del> early this morning I found myself struggling (probably more than I should have been) with creating tabbed content switcher (hover over one element changes the content of another).  I knew <a href="http://jquery.com" target="_blank">the right way to go was jQuery</a>, and I wanted to avoid downloading a plugin as that would likely end up with more code and another HTTP request to the server.  As I was working on the content switcher, I had one of those &#8220;Let&#8217;s try this and see what it does&#8221; moments (those tend to work all to often for me).  It turned out that it did half of what I needed, so I removed another line and voila! I had my content switcher.  So without further ado, here it is.</p>
<h3>The Story</h3>
<p>This project was a site I took over from another developer.  My responsibilities were to finish the project and clean things up.  The previous developer went 95 yards, I needed to put the ball in the end zone.  For legal reasons, I can not show a screenshot of the full comp unfortunately. I initially was just going to clean up code and fix validation, CSS, and jQuery.  However, I quickly realized that would end up making it harder.  So I decided to rewrite the HTML and CSS and duplicate the look and feel of the previous version.  An added benefit to rewriting the code my own way, in addition to being more familiar with the code and all the CSS hooks, is that I could focus on reducing code bloat and cut down on the amount of images being used to help deliver a better performing site to the client.  Here is a look at the tabs themselves.  Hovering over each tab changes the content below:</p>
<p><img src="http://www.poundbangwhack.com/wp-content/uploads/tabbed_content.jpg" alt="" title="tabbed_content" width="547" height="197" class="aligncenter size-full wp-image-1307" /></p>
<h3>The HTML</h3>
<p>My first goal was to create the tabs and still make them SEO friendly by having all the content actually in the markup, and not added/removed as needed.  The markup for the tabs are as follows:</p>
<pre name="code" class="html">
     &lt;div id="main_middle">
      &lt;ul>
       &lt;li id="tab-1">&lt;a href="#" class="active_tab">Tab 1&lt;/a>&lt;/li>
       &lt;li id="tab-2">&lt;a href="#">Tab 2&lt;/a>&lt;/li>
       &lt;li id="tab-3">&lt;a href="#">Tab 3&lt;/a>&lt;/li>
       &lt;li id="tab-4">&lt;a href="#">Tab 4&lt;/a>&lt;/li>
       &lt;li id="tab-5">&lt;a href="#">Tab 5&lt;/a>&lt;/li>
      &lt;/ul>
      &lt;p class="active_tab_content">Content 1 - Lorem ipsum dolor sit amet, consectetur adipiscing elit.&lt;/p>
      &lt;p>Content 2 - Mauris ornare suscipit lacus eget lobortis. Vestibulum quis purus metus, sed condimentum magna.&lt;/p>
      &lt;p>Content 3 - Nunc et turpis laoreet mi dapibus pulvinar. Nunc a facilisis mauris. Nulla facilisi. Morbi sed volutpat elit. Cras varius sollicitudin mi at imperdiet.&lt;/p>
      &lt;p>Content 4 - Ut a consectetur quam. Nulla ut consequat metus. Nunc molestie erat sit amet tortor faucibus elementum. Praesent eu luctus nulla.&lt;/p>
      &lt;p>Content 5 - Proin porttitor mattis erat eget ullamcorper. Lorem ipsum dolor sit amet, consectetur adipiscing elit.&lt;/p>
     &lt;/div>
</pre>
<p>As you can see, the HTML is only 14 lines long: a container element, an unordered list, and paragraph elements (one for each tab).  This is a far cry from the 47 lines of HTML with divs nested 3 deep the previous developer was using.  Additionally, the container has an id as well as each tab, plus a class for the active tab and paragraph and that&#8217;s it.  This can be done without the id&#8217;s, I have them in there for <a href="http://www.poundbangwhack.com/2009/05/15/decrease-your-web-site-load-times-using-css-sprites/">CSS sprite</a> functionality.  The active_tab class is not required, again it&#8217;s something I use for my sprites.</p>
<h3>The CSS</h3>
<p>Here is the pertinent CSS to making this work.  I have a bunch extra for my sprites, but that&#8217;s beside the point:</p>
<pre name="code" class="css">
#main_middle ul li {
 display: -moz-inline-stack;
 display: inline-block;
 zoom: 1;
 *display: inline;
 text-align: center;
 vertical-align: text-top;
}

#main_middle ul li a {
 display: block;
 width: 100%;
 height: 100%;
}

#main_middle p {
 background: url(../images/tab_content_bg.png) 50% 0 no-repeat transparent;
 display: none;
}

#main_middle .active_tab_content {
 display: -moz-inline-stack;
 display: inline-block;
 zoom: 1;
 *display: inline;
}

#main_middle ul #tab-2 a { /* Example of Sprite Usage */
 background-position: -95px 0;
}

#main_middle ul #tab-2 .active_tab { /* Example of Sprite Usage  */
 background-position: -95px -79px;
</pre>
<p>The display/zoom lines is for <a href="http://blog.mozilla.com/webdev/2009/02/20/cross-browser-inline-block/"  target="_blank">cross-browser inline-block display</a>.  The code for the anchor elements simply sets them to a block the full size of the list item parent.  Next, all paragraph elements are hidden and only the one with the &#8220;active_tab_content&#8221; class is displayed.  The background is set for all the paragraph elements, although I could&#8217;ve just as easily set it for just the display content only.</p>
<p>Here is my sprite so you get the idea of what I&#8217;m doing with that code:<br />
<img src="http://www.poundbangwhack.com/wp-content/uploads/mid_icons.jpg" alt="" title="mid_icons" width="475" height="158" class="aligncenter size-full wp-image-1330" /></p>
<h3>The jQuery</h3>
<p>The biggest problem I was encountering while writing the jQuery was that when the user stops mousing over the tabs, the last tab moused over should remain visible, and not revert back to the &#8220;active_tab&#8221; and &#8220;active_tab_content&#8221; tab.</p>
<pre name="code" class="js">
$(function() {
 $("#main_middle ul li a").each(function(index) {
  $(this).hover(function() {
   $("#main_middle ul li a").each(function() { $(this).removeClass("active_tab"); });
   $("#main_middle p").each(function() { $(this).removeClass("active_tab_content"); });
   $(this).addClass("active_tab");
   $("#main_middle p:eq("+index+")").addClass("active_tab_content");
  });
 });
});
</pre>
<p>The jQuery code loops through each of the anchor elements and assigns a hover function to them.  The first thing this hover function does is loops through all anchors (tabs) and all paragraphs (tab content) and removes the classes.  It then adds the &#8220;active_tab&#8221; class to the current tab and the &#8220;active_tab_content&#8221; class to the respective paragraph.  It does this through the use of indexes.  One each pass through the anchors, the current element index is passed through the function and then used to select the paragraph with the equivalent index via the <a href="http://api.jquery.com/eq-selector/" target="_blank">eq selector.</a>  And that&#8217;s it.  My mistake that I kept running into, was assigning second function to the hover() to activate on mouseout.  This function was removing the classes that were being added.  This was my moment of <del>brilliance</del> luck when I removed that code by chance and everything worked.</p>
<h3><a href="http://www.poundbangwhack.com/scripts_source/tabbed_content_switcher/demo.html">See the code in action here</a></h3>
<p></p>
<p>You can use this code to make as many tabs as you need.  Just make sure you have as many paragraph elements as you do list elements and that the content for list item 1 corresponds with the content for paragraph 1.  I used inline tabs, but this can easily be done with vertical tabs as well, the logic is still the same.  Feel free to copy/use this code for your own purposes.  Share a link to your implementations in the comments below and/or how you would have done this differently.  Comments are welcome and enjoyed.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.poundbangwhack.com/2010/06/27/jquery-tabbed-content-switcher/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to append values to an array in bash</title>
		<link>http://www.poundbangwhack.com/2010/02/04/how-to-append-values-to-an-array-in-bash/</link>
		<comments>http://www.poundbangwhack.com/2010/02/04/how-to-append-values-to-an-array-in-bash/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 20:14:08 +0000</pubDate>
		<dc:creator>Mark Stoecker</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[SSH/Command Line]]></category>
		<category><![CDATA[Shell Scripts]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://www.poundbangwhack.com/?p=1257</guid>
		<description><![CDATA[Last week I was working on a bash script for a project at work.  The script parsed through a log file with server load and disk usage statistics at regular intervals.  The script was calculating the average CPU idle time, disk utilization, and disk usage for servers.  After calculating the averages for [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I was working on a bash script for a project at work.  The script parsed through a log file with server load and disk usage statistics at regular intervals.  The script was calculating the average CPU idle time, disk utilization, and disk usage for servers.  After calculating the averages for each of these three metrics, I then proceeded to loop through all the lines in the file and create an array of all the times when the CPU idle time was below average, or the disk utilization or usage was above average.<br />
<span id="more-1257"></span><br />
The code that I used was originally taken from the article <a href="http://fvue.nl/wiki/Bash:_Append_to_array_using_while-loop" target="_blank">Bash: Append to array using while-loop</a> by Freddy Vulto. The concept that Freddy used is essentially the same as what I was doing.  I was using a <span class="pre">for</span> loop to scan a file, and if certain values in the file met a condition, the date was added to an array which was printed at the end of the script execution.  The code to achieve this is as follows:</p>
<p><code>array=( ${array[@]-} $(echo "$variable") )</code></p>
<p>The code above reads as follows:</p>
<p><span class="pre">array=( &#8230;.. )</span> : Set your array variable named, appropriately enough: <em>array</em>.</p>
<p><span class="pre">${array[@]-}</span> : Read all variables from the array <em>array</em>.  The hyphen at the end prevents an &#8220;unbound variable&#8221; error when <span class="code">-u</span> or <span class="code">-o nounset</span> is set and <em>array</em> is an empty array.  This is useful for appending the first value to an empty array in the event that one of the aforementioned flags is set.</p>
<p><span class="pre">$(echo &#8220;$variable&#8221;)</span> : Add the variable <em>$variable</em> to the array through the use of command substitution <span class="code">$(&#8230;)</span> by reading the output of <span class="code">echo &#8220;$variable&#8221;</span> as the input value for the array.  The reason for command substitution is that if you try it without the <span class="code">$(&#8230;)</span>, bash will read <span class="code">echo</span> and <span class="code">&#8220;$variable&#8221;</span> as separate entries into the array instead of just the value of <em>$variable</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.poundbangwhack.com/2010/02/04/how-to-append-values-to-an-array-in-bash/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>mysqldump: Got error: 2008: MySQL client run out of memory when retrieving data from server</title>
		<link>http://www.poundbangwhack.com/2009/12/07/mysqldump-got-error-2008-mysql-client-run-out-of-memory-when-retrieving-data-from-server/</link>
		<comments>http://www.poundbangwhack.com/2009/12/07/mysqldump-got-error-2008-mysql-client-run-out-of-memory-when-retrieving-data-from-server/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 20:44:57 +0000</pubDate>
		<dc:creator>Mark Stoecker</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[mysqldump]]></category>

		<guid isPermaLink="false">http://www.poundbangwhack.com/?p=1138</guid>
		<description><![CDATA[I came across this error today while at work.  While trying to process a MySQL dump of a database of approximately 8 GB in size, I got the following error:
mysqldump: Got error: 2008: MySQL client run out of memory when retrieving data from server
This occurred on a MySQL 4.1 server.  To get around [...]]]></description>
			<content:encoded><![CDATA[<p>I came across this error today while at work.  While trying to process a MySQL dump of a database of approximately 8 GB in size, I got the following error:<br />
<code>mysqldump: Got error: 2008: MySQL client run out of memory when retrieving data from server</code><br />
This occurred on a MySQL 4.1 server.  To get around this, you will need to use the <span class="pre">-q</span> switch as part of your <span class="pre">mysqldump</span> command.</p>
<blockquote cite="http://dev.mysql.com/doc/refman/4.1/en/mysqldump.html#option_mysqldump_quick"><p>This option is useful for dumping large tables. It forces mysqldump to retrieve rows for a table from the server a row at a time rather than retrieving the entire row set and buffering it in memory before writing it out.</p>
<p><em style="font-size: smaller;">(source: <a href="http://dev.mysql.com/doc/refman/4.1/en/mysqldump.html#option_mysqldump_quick" target="_blank">MySQL ::   MySQL 3.23, 4.0, 4.1 Reference Manual :: 4.5.4 mysqldump — A Database Backup Program</a>)</em></p></blockquote>
<p>Your full command should look something like this:<br />
<code>$ mysqldump -u <em>user</em> -p <em>password</em> -q <em>database</em> > <em>outfile.sql</em></code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.poundbangwhack.com/2009/12/07/mysqldump-got-error-2008-mysql-client-run-out-of-memory-when-retrieving-data-from-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to fix a &#8216;403 Forbidden&#8217; error on your website</title>
		<link>http://www.poundbangwhack.com/2009/09/04/how-to-fix-a-403-forbidden-error-on-your-website/</link>
		<comments>http://www.poundbangwhack.com/2009/09/04/how-to-fix-a-403-forbidden-error-on-your-website/#comments</comments>
		<pubDate>Fri, 04 Sep 2009 19:07:30 +0000</pubDate>
		<dc:creator>Mark Stoecker</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[Permissions]]></category>

		<guid isPermaLink="false">http://www.poundbangwhack.com/?p=1011</guid>
		<description><![CDATA[So you're working on your website and you go to test it and you get a big nasty message that says something to the effect of 
<code><strong>Forbidden</strong><br />
You don't have permission to access / on this server.</code>
What did you do? Better yet, what <strong>do</strong> you do.  ]]></description>
			<content:encoded><![CDATA[<p>So you&#8217;re working on your website and you go to test it and you get a big nasty message that says something to the effect of<br />
<code><strong>Forbidden</strong><br />
You don't have permission to access / on this server.</code><br />
What did you do? Better yet, what <strong>do</strong> you do.<br />
<span id="more-1011"></span><br />
Fret not, this is a very easy error to fix.  As the error says, this is often caused by a permissions issue.  The most common problem is that the directory you are trying to access does not have a valid index page in it (index.html, index.php, etc) and Directory Browsing is not enabled in your httpd.conf file or .htaccess file.  Make sure you have a valid index file, as defined by your httpd.conf file.  To enable Directory browsing (not the safest thing to do) make the following changes to either the .htaccess file of your domain or the httpd.conf file&#8217;s Virtual Host setting for this domain:</p>
<p><strong>.htaccess</strong><br />
<code>Options Indexes</code><br />
<strong>httpd.conf</strong><br />
<code>&lt;Directory /your/domain/directory/&gt;<br />
Options Indexes<br />
&lt;/Directory&gt;</code></p>
<p>If you have a valid index file and you&#8217;re still getting the 403 Forbidden error, next check for an .htaccess file as the directives in there could likely be causing problems.  The easiest way to check this is to rename your .htaccess file to something else like <em>.htaccess.backup</em>.  Check your site now.  If you no longer get the error, you know it&#8217;s something in your .htaccess file.</p>
<p>If you have a valid index file and no .htaccess file and you still have the 403 Forbidden error, one last thing to check is the permissions on the public_html directory of your domain.  This directory should be set to 755 permissions (rwxr-xr-x) to enable web browsing.  The world user <strong>needs</strong> read and execute permissions for web users to be able to access your site.  You will also want to make sure that the files themselves that are being accessed have the proper permissions on them, typically 644 for files (rw-r&#8211;r&#8211;), unless they are CGI files (Perl, Python, Ruby) which need to have execute permissions and shoud be set to 755 (rwx-r-xr-x).</p>
<p>These are the most common issues that can cause a 403 Forbidden error on your website and should be able to resolve 99% of 403 errors you see.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.poundbangwhack.com/2009/09/04/how-to-fix-a-403-forbidden-error-on-your-website/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Read Email Headers</title>
		<link>http://www.poundbangwhack.com/2009/06/19/how-to-read-email-headers/</link>
		<comments>http://www.poundbangwhack.com/2009/06/19/how-to-read-email-headers/#comments</comments>
		<pubDate>Sat, 20 Jun 2009 05:10:59 +0000</pubDate>
		<dc:creator>Mark Stoecker</dc:creator>
				<category><![CDATA[Email]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Troubleshooting]]></category>

		<guid isPermaLink="false">http://www.poundbangwhack.com/?p=814</guid>
		<description><![CDATA[Sooner or later, people who run their own server, or email server, are going to run into email issues.  In earlier posts, I discussed how to configure an alternate port for Qmail as well as how to test if your email server is working.  This post touches on <strong>how to read email headers</strong> which can be useful when your email delivery is delayed to find out where the delay is occurring.]]></description>
			<content:encoded><![CDATA[<p>Sooner or later, people who run their own server, or email server, are going to run into email issues.  In earlier posts, I discussed <a href="http://www.poundbangwhack.com/2009/06/11/how-to-configure-an-alternate-port-for-qmail/">how to configure an alternate port for Qmail</a> as well as <a href="http://www.poundbangwhack.com/2009/06/08/2-surefire-ways-to-test-if-your-email-is-working/">how to test if your email server is working.</a>  This post touches on <strong>how to read email headers</strong> which can be useful when your email delivery is delayed to find out where the delay is occurring.<br />
<span id="more-814"></span><br />
The first thing about reading email headers, is that they read backwards &#8211; bottom to top.  Each new entry in the headers get&#8217;s added at the top as the headers continue to grow.  Now, the majority of the information you want to look at when troubleshooting a delivery delay is in the <strong>Received</strong> sections.  The information above and below that, while useful for other purposes, is not really necessary for what we&#8217;re looking for here.  For an example, I have provided the headers from a test email I sent between two different accounts I have on two different mail servers.  I have stricken out the information I was discussing above that is not necessary to us:</p>
<p><code><strike>From - Mon Jun 22 15:43:01 2009<br />
X-Account-Key: account6<br />
X-UIDL: UID52-1242085352<br />
X-Mozilla-Status: 0001<br />
X-Mozilla-Status2: 00000000<br />
X-Mozilla-Keys:</strike><br />
Received: (qmail 11994 invoked from network); 22 Jun 2009 15:42:58 -0700<br />
Received: from smtpauth01.prod.mesa1.secureserver.net (64.202.165.181)<br />
  by ip-97-74-114-123.ip.secureserver.net with SMTP; 22 Jun 2009 15:42:58 -0700<br />
Received: (qmail 12509 invoked from network); 22 Jun 2009 22:42:57 -0000<br />
Received: from unknown (172.21.44.241)<br />
  by smtpauth01.prod.mesa1.secureserver.net (64.202.165.181) with ESMTP; 22 Jun 2009 22:42:57 -0000<br />
Message-ID: &lt;4A4008F1.8020205@desertwebdesigns.com&gt;<br />
Date: Mon, 22 Jun 2009 15:42:57 -0700<br />
<strike>From: Mark Stoecker &lt;webmaster@desertwebdesigns.com&gt;<br />
User-Agent: Thunderbird 2.0.0.21 (Windows/20090302)<br />
MIME-Version: 1.0<br />
To: admin@poundbangwhack.com<br />
Subject: Test Email<br />
Content-Type: text/plain; charset=ISO-8859-1; format=flowed<br />
Content-Transfer-Encoding: 7bit</strike></code></p>
<p>When troubleshooting email delays, the first thing you want to do is get all your times in the same time zone.  Some servers will timestamp based on their current time, some will timestamp based on <acronym title="Greenwich Mean Time">GMT.</acronym>  It will be easier to read if they are all the same timezone.  In the example above, there are 6 timestamps we need to be concerned with, 2 of which are in <acronym title="Greenwich Mean Time">GMT.</acronym></p>
<p>After getting all your times sorted out, the next thing you want to do is follow the delivery path (from bottom to top).  Each server that the message passes through will stamp it.  The tricky thing about reading the <span class="pre">Received:</span> lines is that they list first the sender, then the recipient: <code>Received: from smtpauth01.prod.mesa1.secureserver.net (64.202.165.181)<br />
  by ip-97-74-114-123.ip.secureserver.net with SMTP; 22 Jun 2009 15:42:58 -0700</code>  As you can see here, the message was received <strong>from</strong> smtpauth01.prod.mesa1.secureserver.net <strong>by</strong> ip-97-74-114-123.ip.secureserver.net.  If this gets confusing, just rearrange it to make it easier: <code>Received <strong>by</strong> ip-97-74-114-123.ip.secureserver.net <strong>from</strong> smtpauth01.prod.mesa1.secureserver.net</code>  Now it makes a bit more sense.  </p>
<p>So if we were to take the critical delivery points in the chain, fix the timestamps, rearrange the delivery notices, and re-order the server stamps so it reads top-to-bottom like we do, our headers would read something like this:<code>Date: Mon, 22 Jun 2009 <strong>15:42:57</strong> -0700<br />
Received: by smtpauth01.prod.mesa1.secureserver.net (64.202.165.181) from unknown (172.21.44.241) with ESMTP @ 22 Jun 2009 <strong>15:42:57</strong> -0700<br />
Received: (qmail 12509 invoked from network) @ 22 Jun 2009 <strong>15:42:57</strong> -0700<br />
Received: by ip-97-74-114-123.ip.secureserver.net from smtpauth01.prod.mesa1.secureserver.net (64.202.165.181) with SMTP @ 22 Jun 2009 <strong>15:42:58</strong> -0700<br />
Received: (qmail 11994 invoked from network) @ 22 Jun 2009 <strong>15:42:58</strong> -0700<br />
From - Mon Jun 22 <strong>15:43:01</strong> 2009</code>  If you compare the two &#8220;headers&#8221; carefully, you will see that all I did was change the timestamps to MST, swap the &#8220;Received From&#8221; and &#8220;Received By&#8221;, and ordered them top-to-bottom instead of bottom-to-top.  Looking at the headers now, there was obviously no delay in this message.  However, had one of the timestamps been off by 30-40+ minutes, looking at the headers this way will help us determine where the delay is.  We would know that when the message came in late at one step, the server it came from is having the problem.</p>
<p>There are plenty of other uses for reviewing mail headers that are too numerous to count in this post.  However, if you&#8217;re email is not delivering in a timely manner, this will help you track down the cause.  Once you get the hang of reading email headers, you&#8217;ll be able to read them as they&#8217;re printed without having to rewrite them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.poundbangwhack.com/2009/06/19/how-to-read-email-headers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Post to Twitter from a Linux Shell</title>
		<link>http://www.poundbangwhack.com/2009/06/18/how-to-post-to-twitter-from-a-linux-shell/</link>
		<comments>http://www.poundbangwhack.com/2009/06/18/how-to-post-to-twitter-from-a-linux-shell/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 23:08:59 +0000</pubDate>
		<dc:creator>Mark Stoecker</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[SSH/Command Line]]></category>
		<category><![CDATA[Shell Scripts]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[Command-Line]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://www.poundbangwhack.com/?p=784</guid>
		<description><![CDATA[I had a little downtime today at work and decided to write a shell script that I could use to tweet from the shell of my Linux server.  The reason is that Twitter is one of many social networking sites that is blocked at my workplace.  However, I do have access to my [...]]]></description>
			<content:encoded><![CDATA[<p>I had a little downtime today at work and decided to write a shell script that I could use to tweet from the shell of my Linux server.  The reason is that <strong>Twitter is one of many social networking sites</strong> that is blocked at my workplace.  However, I do have access to my server and <a href="http://www.commandlinefu.com/commands/view/176/update-twitter-via-curl" target="_blank">found a great one-liner on commandlinefu.com to update twitter via curl</a>.  I decided to expand on this a bit and wrote a shell script that offers a bit more than merely posting a tweet.  <a href="http://www.poundbangwhack.com/shell/post-to-twitter/">Check out my shell script to post to Twitter here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.poundbangwhack.com/2009/06/18/how-to-post-to-twitter-from-a-linux-shell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Create a File of a Specific Size on Linux</title>
		<link>http://www.poundbangwhack.com/2009/06/16/how-to-create-a-file-of-a-specific-size-on-linux/</link>
		<comments>http://www.poundbangwhack.com/2009/06/16/how-to-create-a-file-of-a-specific-size-on-linux/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 04:47:38 +0000</pubDate>
		<dc:creator>Mark Stoecker</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[SSH/Command Line]]></category>
		<category><![CDATA[dd]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://www.poundbangwhack.com/?p=705</guid>
		<description><![CDATA[Finding a file that just happens to be about 10 MB, 20 MB, 50 MB, etc is not the easiest thing to do, unless you have <abbr title="Secure Shell">SSH</abbr>/Command Line access on a Linux OS. To create a file of a specific size, run the following command from a shell prompt: <code>dd if=/dev/zero of=testfile.txt bs=1M count=10</code>  The above command will create an "empty" 10 MB file named <em>testfile.txt</em>.  I say "empty" because <span class="pre">/dev/zero</span> will actually write as many NUL (null) characters as requested, in our case, 10 MB.]]></description>
			<content:encoded><![CDATA[<p>I was doing some testing the other night of a web-based file uploader I had built into one of the websites I had developed.  The website is hosted on a <a href="http://www.jdoqocy.com/click-3525344-10378494" target="_blank" onmouseover="window.status='http://www.godaddy.com';return true;" onmouseout="window.status=' ';return true;">GoDaddy.com shared hosting account</a><br />
<img src="http://www.awltovhc.com/image-3525344-10378494" width="1" height="1" alt="GoDaddy.com Shared Hosting" /> and allows my client to upload images, videos, and documents to her website directly through the browser.  We had been running into a problem though with some files not uploading properly and I had a feeling it had to do with <abbr title="PHP Hypertext Preprocessor">PHP</abbr> limits imposed by the server.  Even though I had raised the limits in a php.ini file, I thought those might be getting overwritten by the server.<br />
<span id="more-705"></span><br />
To test this, I needed some files of specific sizes to test out the limits.  Finding a file that just happens to be about 10 MB, 20 MB, 50 MB, etc is not the easiest thing to do, unless you have <strong><abbr title="Secure Shell">SSH</abbr>/Command Line access on a Linux OS</strong>. To create a file of a specific size, run the following command from a shell prompt: <code>dd if=/dev/zero of=testfile.txt bs=1M count=10</code>  The above command will create an &#8220;empty&#8221; 10 MB file named <em>testfile.txt</em>.  I say &#8220;empty&#8221; because <span class="pre">/dev/zero</span> will actually write as many NUL (null) characters as requested, in our case, 10 MB.  If content matters (and if you just need a file for the size, it shouldn&#8217;t) you can use <span class="pre">/dev/urandom</span> as the input file instead and you will get 10 MB worth of gibberish.  The output of this command will look something like this: <code>[root@hostname ~]# dd if=/dev/zero of=testfile.txt bs=1M count=10<br />
10+0 records in<br />
10+0 records out<br />
10485760 bytes (10 MB) copied, 0.021345 s, 491 MB/s<br />
<span style="line-height: 20px;"></span><br />
[root@hostname ~]# ls -lh | grep testfile<br />
-rw-r--r-- 1 root root  10M Jun 17 22:21 testfile.txt<br />
</code></p>
<p>The input parameters are as follow:</p>
<ul>
<li><strong>if</strong>: Input File &#8211; force <span class="pre">dd</span> to read from the file specified, in this case /dev/zero (or /dev/urandom) instead of standard input</li>
<li><strong>of</strong>: Output File &#8211; force <span class="pre">dd</span> to write to the specified file instead of standard output</li>
<li><strong>bs</strong>: Byte Size &#8211; force <span class="pre">dd</span> to use the specified amount of bytes at a time for both input and output (in this case 1 MB at a time)</li>
<li><strong>count</strong>: Count &#8211; tell <span class="pre">dd</span> to copy the specified number of input blocks at a time (in our case 10 blocks of 1 MB)</li>
</ul>
<p><strong>Important Note: If you don&#8217;t know what you&#8217;re doing, you can do some serious damage with the dd command with the wrong parameters specified, such as erase an entire disk partition.  The above commands are provided for informational purposes only.  I am not responsible for any damage done by executing such commands incorrectly on your system.  If you are unsure about executing this command, please, by all means, verify the information provided before executing it.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.poundbangwhack.com/2009/06/16/how-to-create-a-file-of-a-specific-size-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Insert Google Ads into the Content of your WordPress Post</title>
		<link>http://www.poundbangwhack.com/2009/06/15/how-to-insert-google-ads-into-the-content-of-your-wordpress-post/</link>
		<comments>http://www.poundbangwhack.com/2009/06/15/how-to-insert-google-ads-into-the-content-of-your-wordpress-post/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 05:26:59 +0000</pubDate>
		<dc:creator>Mark Stoecker</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Wordpress Plugins]]></category>
		<category><![CDATA[Wordpress Themes]]></category>
		<category><![CDATA[Adsense]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.poundbangwhack.com/?p=662</guid>
		<description><![CDATA[Have you ever wondered how to get your Google Ads inside your post content like I have below?  A couple of days ago, I was trying to figure out <strong>how to insert Google Adsense Ads directly into my post content</strong> without pasting the whole Adsense code.  I came across an article that detailed exactly what I was looking for: <a href="http://www.flexijourney.com/blog/insert-google-adsense-code-anywhere-in-your-wordpress-article/" taret="_blank">Insert Google Adsense Code Anywhere In Your Wordpress Article</a>.]]></description>
			<content:encoded><![CDATA[<p>Have you ever wondered how to get your Google Ads inside your post content like I have below?  A couple of days ago, I was trying to figure out <strong>how to insert Google Adsense Ads directly into my post content</strong> without pasting the whole Adsense code.  I came across an article that detailed exactly what I was looking for: <a href="http://www.flexijourney.com/blog/insert-google-adsense-code-anywhere-in-your-wordpress-article/" taret="_blank">Insert Google Adsense Code Anywhere In Your Wordpress Article</a>.<br />
<span id="more-662"></span></p>
<p class="post_ad_box"><!--Adsense2--></p>
<p>Phillip made a very easy function (posted below) that allows you to insert code for multiple Adsense units into your blog theme&#8217;s functions.php file and then call it with the comment-style tag <span class="pre">&lt;!&#8211;Adsense1&#8211;&gt;</span> (a la <span class="pre">&lt;!&#8211;more&#8211;&gt;</span>).  After modifying the functions.php file, you only need to modify the single.php file to call the function in order to get return the Ads.</p>
<p>The beauty of the function is not only that you can create additional adsense units and call which specific one you need, but that if you happen to place your <span class="pre">&lt;!&#8211;Adsense1&#8211;&gt;</span> code before the <span class="pre">&lt;!&#8211;more&#8211;&gt;</span> tag or within the post excerpt, it will be read as a regular HTML comment since the index.php or archive.php files do not recognize <span class="pre">&lt;!&#8211;Adsense1&#8211;&gt;</span> as a WordPress tag.</p>
<p>Check back on my blog or <a href="http://feeds2.feedburner.com/PoundBangWhack">subscribe to my feed</a> as I plan on turning this function into a WordPress plugin to streamline the installation and use even more.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Edit your theme&#8217;s functions.php file by appending the following lines to the end of the file.  Your functions.php file is located at <strong>/wp-content/themes/[your theme name]/functions.php</strong>.  If you do not have a functions.php file, you can create one with this code (make sure you replace your Adsense Code)</p>
<pre name="code" class="php">function get_the_content_with_formatting ($more_link_text='', $stripteaser=0, $more_file='')
{
   $content = get_the_content($more_link_text, $stripteaser, $more_file);
   $content = apply_filters('the_content', $content);
   $content = str_replace(']]&gt;', ']]&gt;', $content);
   return $content;
}

function AddGoogleAds ($content)
{
$Adsense1_1 = &lt;&lt;&lt;ADSCODE1
&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "pub-9999999999999999";
google_ad_slot = "0000000000";
google_ad_width = 250;
google_ad_height = 250;

//--&gt;
&lt;/script&gt;
&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;
ADSCODE1;

$Adsense2 = &lt;&lt;&lt;ADSCODE2
&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "pub-9999999999999999";
google_ad_slot = "1111111111";
google_ad_width = 336;
google_ad_height = 280;

//--&gt;
&lt;/script&gt;
&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;ADSCODE2;

$content = str_replace(array('&lt;p&gt;&lt;!--Adsense1--&gt;&lt;/p&gt;','&lt;!--Adsense1--&gt;'),$Adsense1,$content);
$content = str_replace(array('&lt;p&gt;&lt;!--Adsense2--&gt;&lt;/p&gt;','&lt;!--Adsense2--&gt;'),$Adsense2,$content);
return $content;
}
</pre>
<p><a href="http://www.flexijourney.com/blog/insert-google-adsense-code-anywhere-in-your-wordpress-article/" target="_blank">(source: Philip Ze)</a></p>
<p>After you have made the above changes, make the following changes to your single.php file, again in your theme&#8217;s directory.  Find the line with the tag <span class="pre">the_content(<em>parameters</em>)</span> and replace it with the content below:</p>
<pre name="code" class="php">&lt;?php
   $cont = get_the_content_with_formatting();
   $cont = AddGoogleAds($cont);
   echo $cont ;
?&gt;
&lt;?php /* the_content('(more)'); */ ?&gt;</pre>
<p>Again, to insert your ads into your post content, place the tag <span class="pre">&lt;!&#8211;Adsense1&#8211;&gt;</span> or <span class="pre">&lt;!&#8211;Adsense2&#8211;&gt;</span> into your content.  You can continue adding more Adsense units to your functions.php file following the same templaye as what is currently there.  </p>
<p><script language="javascript">
dp.SyntaxHighlighter.ClipboardSwf = 'http://www.poundbangwhack.com/wp-content/uploads/clipboard.swf';
dp.SyntaxHighlighter.HighlightAll('code');
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.poundbangwhack.com/2009/06/15/how-to-insert-google-ads-into-the-content-of-your-wordpress-post/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Configure an Alternate Port for Qmail</title>
		<link>http://www.poundbangwhack.com/2009/06/11/how-to-configure-an-alternate-port-for-qmail/</link>
		<comments>http://www.poundbangwhack.com/2009/06/11/how-to-configure-an-alternate-port-for-qmail/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 14:00:31 +0000</pubDate>
		<dc:creator>Mark Stoecker</dc:creator>
				<category><![CDATA[Email]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Port]]></category>
		<category><![CDATA[Qmail]]></category>
		<category><![CDATA[SMTP]]></category>
		<category><![CDATA[vi]]></category>

		<guid isPermaLink="false">http://www.poundbangwhack.com/?p=628</guid>
		<description><![CDATA[A couple days ago I wrote about <a href="http://www.poundbangwhack.com/2009/06/08/2-surefire-ways-to-test-if-your-email-is-working/">how to troubleshoot an email server when it isn't working</a>.  This post isn't necessarily follow-up to that, but more of a corollary.  One of the things I didn't mention in that post is what to do if you are running an email server and your <acronym title="Internet Service Provider">ISP</acronym> does not allow outgoing connections over port 25, the standard <acronym title="Simple Mail Transfer Protocol">SMTP</acronym> port.  Many <acronym title="Internet Service Provider">ISP's</acronym> have this policy to cust down on Spam sent through their servers, mine included.  So when I tried to connect to my email the other day through Mozilla Thunderbird, I ran into a problem.  I knew what I had to do.  I had to <strong>configure Qmail to use an alternate port.</strong>]]></description>
			<content:encoded><![CDATA[<p class="post_ad_box"><!--Adsense1--></p>
<p><em>I had initially posted instructions on how to change the default Qmail port.  However, an associate of mine pointed out the fallacy in my instructions.  Changing the default Qmail port will prevent email from being delivered to your server as foreign mail servers will try to connect to your server on port 25 and if you change it, you won&#8217;t be able to receive email.  I completely forgot about that little side effect when I posted this and have thus changed this post to only show <strong>how to configure an alternate port for Qmail.</strong></em></p>
<p>A couple days ago I wrote about <a href="http://www.poundbangwhack.com/2009/06/08/2-surefire-ways-to-test-if-your-email-is-working/">how to troubleshoot an email server when it isn&#8217;t working</a>.  This post isn&#8217;t necessarily follow-up to that, but more of a corollary.  One of the things I didn&#8217;t mention in that post is what to do if you are running an email server and your <acronym title="Internet Service Provider">ISP</acronym> does not allow outgoing connections over port 25, the standard <acronym title="Simple Mail Transfer Protocol">SMTP</acronym> port.  Many <acronym title="Internet Service Provider">ISP&#8217;s</acronym> have this policy to cust down on Spam sent through their servers, mine included.  So when I tried to connect to my email the other day through <a href="http://www.mozillamessaging.com/en-US/thunderbird/" target="_blank" title="Mozilla Thunderbird">Mozilla Thunderbird</a>, I ran into a problem.  I knew what I had to do.  I had to <strong>configure Qmail to use an alternate port.</strong><br />
<span id="more-628"></span><br />
The first thing you will need to do is locate the service script for your email service.  In my case, since I use <a href="http://www.qmailrocks.org/" target="_blank" title="QmailRocks.org">Qmail</a> with <a href="http://www.parallels.com" target="_blank" title="Plesk Home">Plesk</a>, my script was located at <strong>/etc/xinetd.d/smtp_psa</strong>.  You will most likely have another one for <acronym title="Simple Mail Transfer Protocol">SMTP</acronym> over <acronym title="Secure Sockets Layer">SSL</acronym> named smtps_psa (or something close to).  Next, you need to see what ports your server is currently listening on so you do not assign it to the same port as another service and cause problems.  To do that, run the following command<br />
<code>netstat -tulpn | grep tcp</code>  That will show all current running services, the port their using, and filter out <acronym title="Transmission Control Protocol">TCP</acronym> only (so as not to see duplicate ports in the <acronym title="User Datagram Protocol">UDP</acronym> section.  You will be concerned with the column labeled &#8220;Local Address&#8221; as that will show the IP (0:0:0:0 or ::: means all IPs) and the port in use.  Pick a random port number not in use for your <acronym title="Simple Mail Transfer Protocol">SMTP</acronym> configuration.  I chose 2525.</p>
<h3>How to configure Qmail to use an alternate port</h3>
<p>To configure an alternate qmail port, you will need to first copy the default smtp service file to create an alternate configuration.  I did this with the following code <code>cp /etc/xinetd.d/smtp_psa /etc/xinetd.d/smtp_alt_psa</code>  You will then need to open your alternate service file and configure the alternate service name.  Using a text editor of your choice (I like vi), type <code>vi /etc/xinetd.d/smtp_alt_psa</code>  The first line should look something like <code>service smtp</code>  That line will need to be changed so we don&#8217;t have two services with the same name.  Hit <em>i</em> to enter insert mode and change the first line to read <code>service smtp_alt</code>  Hit <em>Esc</em>, type <span class="pre">:wq</span> to write and quit.</p>
<p>We now need to edit the <strong>/etc/services</strong> file to set the port.  Make sure the service name you use matches the service name you entered in the alternate configuration file above.  I added these lines right below the original <acronym title="Simple Mail Transfer Protocol">SMTP</acronym> lines.  Hit <em>i</em> again for insert mode and write in the two following lines <code>smtp_alt        2525/tcp        mail<br />
  smtp_alt        2525/udp        mail</code>  Your <strong>/etc/services</strong> file should look something like this <code>smtp            25/tcp          mail<br />
smtp            25/udp          mail<br />
smtp_alt        2525/tcp        mail<br />
smtp_alt        2525/udp        mail</code>  Hit <em>Esc</em>, type <span class="pre">:wq</span> to write and quit.  Now restart your email service.  Again, here was my code to do that <code>service xinetd restart</code>  Run the <span class="pre">netstat -tulpn | grep tcp</span> command again to verify that your email service is now listening on port 25 and 2525.</p>
<p>That&#8217;s all there is to it.  You should now be able to connect through your email client to your server on your alternate port.  Questions? Comments? Problems? Post them below and I&#8217;ll do my best to help out.</p>
<p><em>For more help on using the vi/vim text editor, visit our <a href="http://www.poundbangwhack.com/linux-command-line-cheat-sheet/">Linux command line cheat sheet</a> with extensive information on using vi.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.poundbangwhack.com/2009/06/11/how-to-configure-an-alternate-port-for-qmail/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
