<?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; Programming</title>
	<atom:link href="https://www.farhad.ca/category/programming/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>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>I&#8217;m back</title>
		<link>https://www.farhad.ca/2011/06/08/im-back/</link>
		<comments>https://www.farhad.ca/2011/06/08/im-back/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 10:08:49 +0000</pubDate>
		<dc:creator>Farhad Malekpour</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.farhad.ca/?p=35</guid>
		<description><![CDATA[It&#8217;s been a while, busy doing some projects. To name a few: Major improvements on List 4 All web site, specially in members area. Design a complete management system called Say5 for Hosting Linux servers including installation, root, reseller and end user control panels, a web server and 22 other web related daemons all written [...]]]></description>
				<content:encoded><![CDATA[<p>It&#8217;s been a while, busy doing some projects. To name a few:</p>
<ul>
<li>Major improvements on List 4 All web site, specially in members area.</li>
<li>Design a complete management system called <a title="Say5" href="http://www.say5.com" target="_blank">Say5</a> for Hosting Linux servers including installation, root, reseller and end user control panels, a web server and 22 other web related daemons all written either directly by PHP or with C + Zend. It&#8217;s in production and at the time of this writing, we are serving about 2500 sites with it.</li>
<li>Design and programming a live customer support system called <a title="LiveAdmin" href="http://www.liveadmin.net" target="_blank">LiveAdmin</a> with PHP for server side and JavaScript on client side, it&#8217;s in production now.</li>
<li><a title="phpOnline" href="http://www.phponline.ca/" target="_blank">phpOnline</a> which is a very simple customer support script written with PHP for server side and Flash for client side has its own web site.</li>
<li>Design series of classified sites like <a title="Vancouver Classified" href="http://www.vancouver-classified.com" target="_blank">vancouver-classified.com</a>, <a title="Toronto Classified" href="http://www.toronto-classified.com" target="_blank">toronto-classified.com</a> and 54 other cities in North America.</li>
<li>Design series of directory sites like <a title="Vancouver Directory" href="http://www.vancouver-directory.info" target="_blank">vancouver-directory.info</a>, <a title="Chicago Directory" href="http://www.chicago-directory.info" target="_blank">chicago-directory.info</a>, <a title="Ottawa Directory" href="http://www.ottawa-directory.info" target="_blank">ottawa-directory.info</a>, and other cities.</li>
<li>Design and programming about 30 applications for iPhone and iPad, some of them can be found in <a title="BejBej" href="http://www.bejbej.info" target="_blank">www.bejbej.info</a>.</li>
</ul>
<p>and some other small sites and projects. My latest project was a CPanel interface for iPhone and iPad. It&#8217;s awaiting approval by Apple. When they approved it, I&#8217;ll post a detail description here (hopefully).</p>
]]></content:encoded>
			<wfw:commentRss>https://www.farhad.ca/2011/06/08/im-back/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Affiliate System</title>
		<link>https://www.farhad.ca/2002/08/02/affiliate-system/</link>
		<comments>https://www.farhad.ca/2002/08/02/affiliate-system/#comments</comments>
		<pubDate>Fri, 02 Aug 2002 21:47:09 +0000</pubDate>
		<dc:creator>Farhad Malekpour</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.farhad.ca/?p=21</guid>
		<description><![CDATA[Aug 2002 Dayana Networks A fully automated system for those who want to earn money by referring others to Dayana Networks. Flexible commission and direct payment using PayPal. Use cookie for tracking sales and referrals. Use mySQL for database and Perl for code.]]></description>
				<content:encoded><![CDATA[<p>Aug 2002<br />
Dayana Networks</p>
<p>A fully automated system for those who want to earn money by referring others to Dayana Networks. Flexible commission and direct payment using PayPal. Use cookie for tracking sales and referrals. Use mySQL for database and Perl for code.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.farhad.ca/2002/08/02/affiliate-system/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Multipart Account Activation System</title>
		<link>https://www.farhad.ca/2002/07/02/multipart-account-activation-system/</link>
		<comments>https://www.farhad.ca/2002/07/02/multipart-account-activation-system/#comments</comments>
		<pubDate>Tue, 02 Jul 2002 21:31:05 +0000</pubDate>
		<dc:creator>Farhad Malekpour</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.farhad.ca/?p=20</guid>
		<description><![CDATA[Jul 2002 Dayana Networks As a part of my new e-commerce web site this web-based application control user payments in a secure SSL tunnel, then open account for hosting instantly. I use Perl/PHP for programming and mySQL for databases. All parts of this application have been written on RedHat Linux 7.3. This process use multi [...]]]></description>
				<content:encoded><![CDATA[<p>Jul 2002<br />
Dayana Networks</p>
<p>As a part of my new e-commerce web site this web-based application control user payments in a secure SSL tunnel, then open account for hosting instantly. I use Perl/PHP for programming and mySQL for databases. All parts of this application have been written on RedHat Linux 7.3.</p>
<p>This process use multi way payments, basically it has these abilities:</p>
<ol>
<li>Accept Direct Credit Card payment in a SSL environment.</li>
<li>Accept payments by PayPal.</li>
<li>Tracking user activities by assigning a 16 digit unique order number.</li>
<li>Accept 3 levels of accounts, Personal, Business and Reseller.</li>
<li>Daily sales values for administration uses.</li>
<li>Track refunds.</li>
<li>Fraud Protection System on Credit Card payments.</li>
<li>Customer Support Tracking System.</li>
<li>Report any illegal access to administrator email and cell-phone (text messaging)</li>
<li>Ability to open account on different Linux server.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>https://www.farhad.ca/2002/07/02/multipart-account-activation-system/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wireless Networks Solutions</title>
		<link>https://www.farhad.ca/2002/06/02/wireless-networks-solutions/</link>
		<comments>https://www.farhad.ca/2002/06/02/wireless-networks-solutions/#comments</comments>
		<pubDate>Sun, 02 Jun 2002 21:28:55 +0000</pubDate>
		<dc:creator>Farhad Malekpour</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.farhad.ca/?p=19</guid>
		<description><![CDATA[Feb 2002 to Jun 2002 Parsian Networks After using AVAYA, ORINOCO, Cisco and Lucent wireless solutions I prepared to start a new project for building some wireless devices, at the end of project these devices were ready to sell: General Access Point (Prism + Linux Box) (save up to 90%) AP + Bandwidth Manager AP [...]]]></description>
				<content:encoded><![CDATA[<p>Feb 2002 to Jun 2002<br />
Parsian Networks</p>
<p>After using AVAYA, ORINOCO, Cisco and Lucent wireless solutions I prepared to start a new project for building some wireless devices, at the end of project these devices were ready to sell:</p>
<ul>
<li>General Access Point (Prism + Linux Box) (save up to 90%)</li>
<li>AP + Bandwidth Manager</li>
<li>AP + Bridge</li>
<li>AP + Firewall</li>
<li>AP + BWM + Bridge + Firewall (save up to 95% on a $10,000 device!)</li>
</ul>
<p>And of course we soled more than 10 boxes of them.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.farhad.ca/2002/06/02/wireless-networks-solutions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FSG Telephony Server &#8211; Phone to Phone for private use</title>
		<link>https://www.farhad.ca/2002/02/02/fsg-telephony-server-phone-to-phone-for-private-use/</link>
		<comments>https://www.farhad.ca/2002/02/02/fsg-telephony-server-phone-to-phone-for-private-use/#comments</comments>
		<pubDate>Sat, 02 Feb 2002 21:28:06 +0000</pubDate>
		<dc:creator>Farhad Malekpour</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.farhad.ca/?p=18</guid>
		<description><![CDATA[Apr, 2001 to Feb 2002 Parsian Networks In this big project I wrote a server/client that work thru TCP/IP between two or more points. At the first phase I initialize this system from Iran to UAE, each part have 160 phone lines for both calling and answering. Also a base server controls the phone lines [...]]]></description>
				<content:encoded><![CDATA[<p>Apr, 2001 to Feb 2002<br />
Parsian Networks</p>
<p>In this big project I wrote a server/client that work thru TCP/IP between two or more points. At the first phase I initialize this system from Iran to UAE, each part have 160 phone lines for both calling and answering. Also a base server controls the phone lines from a high speed internet connection.Â  At this time my base server is located at Iran but I will change the location of the server to Canada or USA for better performance. In this server there is no limit on number of servers.<br />
Also I design all of its hardware parts and now it can be soled to anyone interested to be a gateway for us. Each box can handle 8 phone line and a price of 6000 USD.<br />
At this time this system required 8kb/s for each user but I&#8217;m in research to reach a lower bandwidth about 2.3kb/s for each user. The main idea is now complete but it takes 20 percent of an Intel Pentium III 600 CPU time for each user and it&#8217;s too high. I should resolve this problem and produce a new version of my server.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.farhad.ca/2002/02/02/fsg-telephony-server-phone-to-phone-for-private-use/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FSG Telephony Server &#8211; Phone to Phone in long distance &#8211; gateway</title>
		<link>https://www.farhad.ca/2001/03/02/fsg-telephony-server-phone-to-phone-in-long-distance-gateway/</link>
		<comments>https://www.farhad.ca/2001/03/02/fsg-telephony-server-phone-to-phone-in-long-distance-gateway/#comments</comments>
		<pubDate>Fri, 02 Mar 2001 21:27:27 +0000</pubDate>
		<dc:creator>Farhad Malekpour</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.farhad.ca/?p=17</guid>
		<description><![CDATA[Mar, 2001 Parsian Networks This server can worked under WinNT4.0 or Win2K and can answer the call, then take user pid and a password from caller, then it can gave him/her a free line for connecting. At this time (25/5/2001) it uses Go2Call service for its long distance. I use my own Language and Interpreter [...]]]></description>
				<content:encoded><![CDATA[<p>Mar, 2001<br />
Parsian Networks</p>
<p>This server can worked under WinNT4.0 or Win2K and can answer the call, then take user pid and a password from caller, then it can gave him/her a free line for connecting. At this time (25/5/2001) it uses Go2Call service for its long distance. I use my own Language and Interpreter for this server.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.farhad.ca/2001/03/02/fsg-telephony-server-phone-to-phone-in-long-distance-gateway/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FSG Telephony Server (VOIP) &#8211; Language and Interpreter</title>
		<link>https://www.farhad.ca/2001/02/02/fsg-telephony-server-voip-language-and-interpreter/</link>
		<comments>https://www.farhad.ca/2001/02/02/fsg-telephony-server-voip-language-and-interpreter/#comments</comments>
		<pubDate>Fri, 02 Feb 2001 21:26:45 +0000</pubDate>
		<dc:creator>Farhad Malekpour</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.farhad.ca/?p=16</guid>
		<description><![CDATA[Feb, 2001 Parsian Networks This language is designed be myself. Also an interpreter is designed. The main reason for this Object Oriented language is to controlling modems and does what ever I need to do with them generally in voice mode. With this language any one can design and developed many useful modem voice based [...]]]></description>
				<content:encoded><![CDATA[<p>Feb, 2001<br />
Parsian Networks</p>
<p>This language is designed be myself. Also an interpreter is designed. The main reason for this Object Oriented language is to controlling modems and does what ever I need to do with them generally in voice mode. With this language any one can design and developed many useful modem voice based applications like an Answering Machine. This is an Object Oriented language and its ready now for using by any one and of coerce first of all is me!</p>
]]></content:encoded>
			<wfw:commentRss>https://www.farhad.ca/2001/02/02/fsg-telephony-server-voip-language-and-interpreter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ICQ Bomb</title>
		<link>https://www.farhad.ca/2000/11/15/icq-bomb/</link>
		<comments>https://www.farhad.ca/2000/11/15/icq-bomb/#comments</comments>
		<pubDate>Wed, 15 Nov 2000 22:25:44 +0000</pubDate>
		<dc:creator>Farhad Malekpour</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.farhad.ca/?p=15</guid>
		<description><![CDATA[Nov, 2000 Parsian Networks This tiny software can send a message to a couple of ICQ members. Generally this tool is useful for advertisement, but I think it&#8217;s not legal, so this program has never published and I wrote it only for testing.]]></description>
				<content:encoded><![CDATA[<p>Nov, 2000<br />
Parsian Networks</p>
<p>This tiny software can send a message to a couple of ICQ members. Generally this tool is useful for advertisement, but I think it&#8217;s not legal, so this program has never published and I wrote it only for testing.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.farhad.ca/2000/11/15/icq-bomb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web based Accounting</title>
		<link>https://www.farhad.ca/2000/11/02/web-based-accounting/</link>
		<comments>https://www.farhad.ca/2000/11/02/web-based-accounting/#comments</comments>
		<pubDate>Thu, 02 Nov 2000 21:25:09 +0000</pubDate>
		<dc:creator>Farhad Malekpour</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.farhad.ca/?p=14</guid>
		<description><![CDATA[Nov, 2000 Parsian Networks This web based application can do all of our office needs in accounting for them. Has two part, first part is an http server that serve up to 1024 clients at a time and second part is an accounting software using Borland Database Engine.]]></description>
				<content:encoded><![CDATA[<p>Nov, 2000<br />
Parsian Networks</p>
<p>This web based application can do all of our office needs in accounting for them. Has two part, first part is an http server that serve up to 1024 clients at a time and second part is an accounting software using Borland Database Engine.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.farhad.ca/2000/11/02/web-based-accounting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
