<?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>AquilaX's development blog &#187; Pascal</title>
	<atom:link href="http://dev.horemag.net/category/pascal/feed/" rel="self" type="application/rss+xml" />
	<link>http://dev.horemag.net</link>
	<description>code and so on...</description>
	<lastBuildDate>Thu, 02 Feb 2012 08:29:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>DateSerial</title>
		<link>http://dev.horemag.net/2008/03/06/dateserial/</link>
		<comments>http://dev.horemag.net/2008/03/06/dateserial/#comments</comments>
		<pubDate>Thu, 06 Mar 2008 08:14:03 +0000</pubDate>
		<dc:creator>AquilaX</dc:creator>
				<category><![CDATA[Delphi]]></category>

		<guid isPermaLink="false">http://dev.horemag.net/2008/03/06/dateserial/</guid>
		<description><![CDATA[Working with MS Access's date/time type is a total headache. Which goes first the month or the day, or it depends on the values of the month and the day, or maybe on the Regional settings? There's a medicine for this illness and it's called DateSerial. Fortunately it works for INSERT as well as SELECT [...]]]></description>
			<content:encoded><![CDATA[<p>Working with MS Access's date/time type is a total headache. Which goes first the month or the day, or it depends on the values of the month and the day, or maybe on the Regional settings? There's a medicine for this illness and it's called <a href="http://office.microsoft.com/en-us/access/HA012288131033.aspx" onclick="javascript:urchinTracker('/outbound/article/http://office.microsoft.com/en-us/access/HA012288131033.aspx');">DateSerial</a>. Fortunately it works for INSERT as well as SELECT statements so i use this simple function in Delphi deal with date/time.</p>
<pre class="pascal">&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> DateToSQL<span style="color: #66cc66;">&#40;</span>FDate:TDate<span style="color: #66cc66;">&#41;</span>:<span style="color: #993333;">String</span>;
<span style="color: #b1b100;">begin</span>
  Result := <span style="color: #ff0000;">'DateSerial('</span>+FormatDateTime<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'yyyy,mm,dd'</span>, FDate<span style="color: #66cc66;">&#41;</span>+<span style="color: #ff0000;">')'</span>;
<span style="color: #b1b100;">end</span>;
&nbsp;</pre>
]]></content:encoded>
			<wfw:commentRss>http://dev.horemag.net/2008/03/06/dateserial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Greatest Common Divisor in Pascal</title>
		<link>http://dev.horemag.net/2007/12/12/greatest-common-divisor-in-pascal/</link>
		<comments>http://dev.horemag.net/2007/12/12/greatest-common-divisor-in-pascal/#comments</comments>
		<pubDate>Wed, 12 Dec 2007 10:24:14 +0000</pubDate>
		<dc:creator>AquilaX</dc:creator>
				<category><![CDATA[Pascal]]></category>
		<category><![CDATA[GCD]]></category>
		<category><![CDATA[greatest common divison]]></category>
		<category><![CDATA[Math]]></category>
		<category><![CDATA[Pascal; Euler Totient]]></category>

		<guid isPermaLink="false">http://dev.horemag.net/2007/12/12/greatest-common-divisor-in-pascal/</guid>
		<description><![CDATA[A short iterational algorithm for calculating the greatest common divisor using the Euclidean algorithm.
&#160;
function gcd&#40;a, b:Longword&#41;:Longword;
var
  t:Longword;
begin
  while b &#60;&#62; 0 do
  begin
    t := b;
    b := a mod b;
    a := t;
  end;
  gcd := a;
end;
&#160;
This function can be [...]]]></description>
			<content:encoded><![CDATA[<p>A short iterational algorithm for calculating the greatest common divisor using the <a href="http://en.wikipedia.org/wiki/Euclidean_algorithm" onclick="javascript:urchinTracker('/outbound/article/http://en.wikipedia.org/wiki/Euclidean_algorithm');">Euclidean algorithm</a>.</p>
<pre class="pascal">&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> gcd<span style="color: #66cc66;">&#40;</span>a, b:Longword<span style="color: #66cc66;">&#41;</span>:Longword;
<span style="color: #b1b100;">var</span>
  t:Longword;
<span style="color: #b1b100;">begin</span>
  <span style="color: #b1b100;">while</span> b &lt;&gt; <span style="color: #cc66cc;">0</span> <span style="color: #b1b100;">do</span>
  <span style="color: #b1b100;">begin</span>
    t := b;
    b := a <span style="color: #b1b100;">mod</span> b;
    a := t;
  <span style="color: #b1b100;">end</span>;
  gcd := a;
<span style="color: #b1b100;">end</span>;
&nbsp;</pre>
<p>This function can be used for calculating <a href="http://en.wikipedia.org/wiki/Euler's_totient_function" onclick="javascript:urchinTracker('/outbound/article/http://en.wikipedia.org/wiki/Euler's_totient_function');">Euler's Totient</a> function:</p>
<pre class="pascal">&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> fi<span style="color: #66cc66;">&#40;</span>a:Longword<span style="color: #66cc66;">&#41;</span>:Longword;
<span style="color: #b1b100;">var</span>
  i:Longword;
  count:Longword;
<span style="color: #b1b100;">begin</span>
  <span style="color: #b1b100;">if</span> a = <span style="color: #cc66cc;">1</span> <span style="color: #b1b100;">then</span>
  <span style="color: #b1b100;">begin</span>
    count := <span style="color: #cc66cc;">1</span>;
    Exit
  <span style="color: #b1b100;">end</span>;
  count := <span style="color: #cc66cc;">0</span>;
  <span style="color: #b1b100;">for</span> i := <span style="color: #cc66cc;">1</span> <span style="color: #b1b100;">to</span> a <span style="color: #b1b100;">do</span>
  <span style="color: #b1b100;">begin</span>
    <span style="color: #b1b100;">if</span> gcd<span style="color: #66cc66;">&#40;</span>i, a<span style="color: #66cc66;">&#41;</span> = <span style="color: #cc66cc;">1</span> <span style="color: #b1b100;">then</span>
      count := count <span style="color: #cc66cc;">+1</span>;
  <span style="color: #b1b100;">end</span>;
  fi := count;
<span style="color: #b1b100;">end</span>;
&nbsp;</pre>
<p><strong>N.B.</strong> Keep in mind that this algorithms are far from optimal.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.horemag.net/2007/12/12/greatest-common-divisor-in-pascal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Datecs FP-550T</title>
		<link>http://dev.horemag.net/2007/11/04/datecs-fp-550t/</link>
		<comments>http://dev.horemag.net/2007/11/04/datecs-fp-550t/#comments</comments>
		<pubDate>Sat, 03 Nov 2007 23:05:07 +0000</pubDate>
		<dc:creator>AquilaX</dc:creator>
				<category><![CDATA[Delphi]]></category>

		<guid isPermaLink="false">http://dev.horemag.net/2007/11/04/datecs-fp-550t/</guid>
		<description><![CDATA[If you're planning to develop for FP-550T Fiscal printer through the COM Server, don't download it from the website. Get it from Datecs' FTP Server: ftp.datecs.bg. The version on the website is obsolete and doesn't work correctly.
This may save you a support call.  
]]></description>
			<content:encoded><![CDATA[<p>If you're planning to develop for FP-550T Fiscal printer through the COM Server, don't download it from the website. Get it from Datecs' FTP Server: <a href="ftp://ftp.datecs.bg/PUBLISH/POS/FISCAL_PRINTER_SOFTWARE/PC" onclick="javascript:urchinTracker('/outbound/article/ftp://ftp.datecs.bg/PUBLISH/POS/FISCAL_PRINTER_SOFTWARE/PC');">ftp.datecs.bg</a>. The version on the website is obsolete and doesn't work correctly.<br />
This may save you a support call. <img src='http://dev.horemag.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://dev.horemag.net/2007/11/04/datecs-fp-550t/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

