<?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>Farhad MalekpourFarhad Malekpour &#187; How To</title>
	<atom:link href="https://www.farhad.ca/category/how-to/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.farhad.ca</link>
	<description>Professional Work Weblog</description>
	<lastBuildDate>Tue, 02 Feb 2021 10:16:51 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Charge iPad with PC</title>
		<link>https://www.farhad.ca/2012/08/23/charge-ipad-with-pc/</link>
		<comments>https://www.farhad.ca/2012/08/23/charge-ipad-with-pc/#comments</comments>
		<pubDate>Thu, 23 Aug 2012 22:08:38 +0000</pubDate>
		<dc:creator>Farhad Malekpour</dc:creator>
				<category><![CDATA[How To]]></category>

		<guid isPermaLink="false">http://www.farhad.ca/?p=62</guid>
		<description><![CDATA[I searched a lot about finding a way to charge my iPad with regular USB port of the PC. So far there is no way to do that unless USB port of the PC provide at least 1.2 Amp of current which most of the mother boards does not support that. So I start looking [...]]]></description>
				<content:encoded><![CDATA[<p>I searched a lot about finding a way to charge my iPad with regular USB port of the PC. So far there is no way to do that unless USB port of the PC provide at least 1.2 Amp of current which most of the mother boards does not support that. So I start looking for a USB Hub to do that job. Unfortunately most of the USB Hubs, even those with separated power supply only provide standard 500 ma which is useless for charging iPad.</p>
<p>Then I found this <a href="http://www.dlink.com.au/products/?pid=149" target="_blank">DUB-h7 DLink hub</a>, bough it from <a href="http://www.tigerdirect.ca/applications/SearchTools/item-details.asp?EdpNo=547772&amp;CatId=4756" target="_blank">Tiger Direct</a> for less than $30. This hub has 7 ports in total, two of them marked for high current which can charge the iPad. Tried one of the ports and vola, iPad is charging, but when I connected the hub to PC, iPad stopped charging again.</p>
<p>It seems, there is a software that you need to install on your PC in order to have both iPad connection and charging at the same time. Finding the software was not easy as DLink removed the link from their web site. I found it anyway and installed it on my Win7-64 and everything work perfectly fine. Now I can sync my iPad with PC while charging it at the same time.</p>
<p>Link to DLink iPad Change Utility:<br />
<a href="http://discontinued-software.googlecode.com/files/iPad_Charge_Utility_1.07.exe" target="_blank">http://discontinued-software.googlecode.com/files/iPad_Charge_Utility_1.07.exe</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://www.farhad.ca/2012/08/23/charge-ipad-with-pc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>3TB Hard Drive on Intel Matrix/Rapid Storage</title>
		<link>https://www.farhad.ca/2012/05/04/3tb-hard-drive-on-intel-matrixrapid-storage/</link>
		<comments>https://www.farhad.ca/2012/05/04/3tb-hard-drive-on-intel-matrixrapid-storage/#comments</comments>
		<pubDate>Fri, 04 May 2012 19:52:30 +0000</pubDate>
		<dc:creator>Farhad Malekpour</dc:creator>
				<category><![CDATA[How To]]></category>

		<guid isPermaLink="false">http://www.farhad.ca/?p=53</guid>
		<description><![CDATA[Yesterday I had to upgrade my system for larger storage, So I decided to go with a pair of 3TB hard drives to be in RAID1 (mirror). After backup and make sure I have copy of everything I started to remove old hard drives and install new ones. In BIOS I surprised to see that [...]]]></description>
				<content:encoded><![CDATA[<p>Yesterday I had to upgrade my system for larger storage, So I decided to go with a pair of 3TB hard drives to be in RAID1 (mirror). After backup and make sure I have copy of everything I started to remove old hard drives and install new ones. In BIOS I surprised to see that Intel Matrix Storage does not recognize the 3TB space on drives, just 740GB!</p>
<p>Searching for a solution didn&#8217;t go anywhere, I have an ASUS P7P55D-E mobo which is not old and should have all required modules with latest BIOS flashed from ASUS. But for some reasons ASUS is not up-to-date with latest BIOS modules. Latest BIOS for my mobo has Intel Matrix Storage version 8.x while current version according to Intel is 10.x!</p>
<p>Installing the Intel Rapid Storage in windows didn&#8217;t fix the problem, although that software could recognize the hard drives as 3TB, but unable to create the RAID volume.</p>
<p>So I started to search and search and then more search. There is a handy utility called MMTool, it can modify contents of a BIOS BIN file. That allows me to replace the old version of IMS with new one. Here are the steps:</p>
<ol>
<li>Download <a href="http://www.farhad.ca/wp-content/uploads/2012/05/MMTool_3.19.exe">MMTool_3.19</a>.</li>
<li>Download latest version of BIOS from ASUS web site. Mine was P7P55D-E, so I searched for the BIOS in ASUS web site and download.</li>
<li>Download copy of the Intel Martix/Rapid Storage ROM. Download it fromÂ  <a href="http://www.farhad.ca/wp-content/uploads/2012/05/8086-2822_10511070.zip">8086-2822_10511070</a>. It&#8217;s a zip file, extract it to get the .BIN file.</li>
<li>Run MMTool and open the BIOS file.</li>
<li>Look for the module having:<br />
ID: 20<br />
Vendor ID: 8086<br />
Device ID: 2822</li>
<li>Select &#8216;Replace&#8217; from top, browse to location of the BIN file (8086-2822_10511070.BIN), make sure module ID is 20, Vendor ID is 8086 and Device ID is 2822. Then click &#8216;Replace&#8217;</li>
<li>&#8216;Save ROM As&#8230;&#8217;, give it a new name, then load it to your motherboard using a BIOS flash utility or the BIOS itself if it support the flash tool (mine does).</li>
<li>Restart the system and I can see that new Intel Matrix/Rapid Storage is in place and recognize the drives as 2.7TB.</li>
</ol>
<p>&nbsp;</p>
<p><a href="http://www.farhad.ca/wp-content/uploads/2012/05/bf3_03-2012-05-04-12.50.39.jpg"><img class="alignnone size-full wp-image-58" title="bf3_03 2012-05-04 12.50.39" src="https://www.farhad.ca/wp-content/uploads/2012/05/bf3_03-2012-05-04-12.50.39.jpg" alt="" width="596" height="498" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://www.farhad.ca/2012/05/04/3tb-hard-drive-on-intel-matrixrapid-storage/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>RBL Based IP to Location</title>
		<link>https://www.farhad.ca/2011/06/15/rbl-based-ip-to-location/</link>
		<comments>https://www.farhad.ca/2011/06/15/rbl-based-ip-to-location/#comments</comments>
		<pubDate>Thu, 16 Jun 2011 05:40:18 +0000</pubDate>
		<dc:creator>Farhad Malekpour</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://www.farhad.ca/?p=46</guid>
		<description><![CDATA[I needed a very fast and effective way of fining geographical location of an IP address. I&#8217;ve already implemented a very nice interface located at Dayana Host IP Location, but due to web based system it&#8217;s not fast enough for what I need. Basically I&#8217;m trying to block access to login to certain mail boxes [...]]]></description>
				<content:encoded><![CDATA[<p>I needed a very fast and effective way of fining geographical location of an IP address. I&#8217;ve already implemented a very nice interface located at <a title="IP 2 Location" href="http://www.dayanahost.com/ip_location.cfm" target="_blank">Dayana Host IP Location</a>, but due to web based system it&#8217;s not fast enough for what I need.</p>
<p>Basically I&#8217;m trying to block access to login to certain mail boxes (managed by exim) from some countries. Routine is in Perl, so I can easily find IP address of a host using DNS lookup. All I needed was a service to give the location based on incoming IP address. I used <a title="RblDNSd" href="http://www.corpit.ru/mjt/rbldnsd.html" target="_blank">rbldnsd</a> and modified it to accept MaxMind country database and wola, it works as expected.</p>
<p>To use, first reverse the IP, just like what you do with RBL based spam lists. For instance 204.50.14.1 will be 1.14.50.204, then combine it with <strong>.rbloc.dayanadns.com</strong> and make a DNS query to find IP address, for example:</p>
<pre class="brush:plain">$host 1.14.50.204.rbloc.dayanadns.com</pre>
<p>That will give you two records, an A record and a TXT record.</p>
<p>&#8216;A&#8217; record will be in form of 127.0.X.Y wherre X is the ASCII code of the first letter of country code and Y is the second letter. For our example returned IP is 127.0.67.65 which means &#8216;CA&#8217; (C=&gt; 67, A=&gt;65).</p>
<p>TXT record is the complete country name, i.e. &#8216;Canada&#8217;.</p>
<p>Here is a sample perl script to get the country code:</p>
<pre class="brush:perl">#!/usr/bin/perl

use Socket;

$packed_ip = gethostbyname('1.14.50.204.rbloc.dayanadns.com');
if (defined $packed_ip)
{
    $ip_address = inet_ntoa($packed_ip);
    my(undef, undef, $d1, $d2) = split(/\./, $ip_address);
    $country_code = chr($d1).chr($d2);
}
print "Result address: ".$ip_address."\n";
print "Country code: ".$country_code."\n";</pre>
<p>and this one is in PHP:</p>
<pre class="brush:php">&lt;?php

$ip_address = gethostbyname('1.14.50.204.rbloc.dayanadns.com');
list($d1,$d2,$d3,$d4) = explode('.',$ip_address);
$country_code = chr($d3).chr($d4);

print "Result address: ".$ip_address."\n";
print "Country code: ".$country_code."\n";

?&gt;</pre>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://www.farhad.ca/2011/06/15/rbl-based-ip-to-location/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to disable delayed bounce back messages in exim</title>
		<link>https://www.farhad.ca/2006/07/27/how-to-disable-delayed-bounce-back-messages-in-exim/</link>
		<comments>https://www.farhad.ca/2006/07/27/how-to-disable-delayed-bounce-back-messages-in-exim/#comments</comments>
		<pubDate>Thu, 27 Jul 2006 23:37:45 +0000</pubDate>
		<dc:creator>Farhad Malekpour</dc:creator>
				<category><![CDATA[How To]]></category>

		<guid isPermaLink="false">http://www.farhad.ca/2006/07/27/how-to-disable-delayed-bounce-back-messages-in-exim/</guid>
		<description><![CDATA[Problem: When a mail server accepts a message and later decides that it can&#8217;t deliver the message, it is required to send back a bounce email to the sender of the original message. These bounce emails are often misdirected. For many MTAs there are solutions, so here is my solution for exim: Solution: This solution [...]]]></description>
				<content:encoded><![CDATA[<p><span style="font-weight: bold;">Problem:</span> When a mail server accepts a  message and later decides that it can&#8217;t deliver the message, it is required to  send back a bounce email to the sender of the original message. These bounce  emails are often misdirected.</p>
<p>For many MTAs there are solutions, so here is my solution for exim:</p>
<p>Solution: This solution uses filtering to discard bounced back emails. So  your exim should have a central filter. Such filter can be configured in  exim.conf configuration file like this:</p>
<pre class="brush:plain">system_filter = /etc/antivirus.exim</pre>
<p>Where antivirus.exim is the filter file, Format of this file described in  exim documentation:</p>
<p><a title="http://www.exim.org/exim-html-4.62/doc/html/filter.html" href="http://www.exim.org/exim-html-4.62/doc/html/filter.html" target="_blank"> http://www.exim.org/exim-html-4.62/doc/html/filter.html</a></p>
<p>Most CPanel boxes have this filter already set and working. Usually default  filter file has these lines at the beginning</p>
<blockquote>
<pre class="brush:vb">if not first_delivery
then
finish
endif</pre>
</blockquote>
<p>That means rest of the filter conditions will be ignored if that&#8217;s not the  first delivery. To make sure you should put the bounce filter <span style="font-weight: bold;">before</span> those conditions or filter may  not work properly.</p>
<p>Now the bounce conditions itself. Here is the code:</p>
<blockquote>
<pre class="brush:vb">if $sender_address is ""
then
if ${lookup{${extract{2}{@}{$recipients}}}lsearch{/etc/localdomains}{yes}{no}} is "no"
then
fail text "Delayed bounce message ignored"
seen finish
endif
endif</pre>
</blockquote>
<p>This will discard any delayed bounce message. If you want to receive a copy  of the discarded message (just to make sure it works) use this code:</p>
<blockquote>
<pre class="brush:vb">if $sender_address is ""
then
if ${lookup{${extract{2}{@}{$recipients}}}lsearch{/etc/localdomains}{yes}{no}} is "no"
then
headers add "Old-Subject: $h_subject:"
headers remove "Subject"
headers add "Subject: [Delayed Bounce]$h_old-subject:"
headers remove "Old-Subject"
deliver "abuse@yourdomain.com"
fail text "Delayed bounce message ignored"
seen finish
endif
endif</pre>
</blockquote>
<p>Make sure to replace the abuse@yourdomain.com with your email address.<br />
Hope that helps someone.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.farhad.ca/2006/07/27/how-to-disable-delayed-bounce-back-messages-in-exim/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
