<?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>Jonathan L Brown &#187; Programming Notes</title>
	<atom:link href="http://www.jonathanlbrown.com/category/programming-notes/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jonathanlbrown.com</link>
	<description>Developer, Entrepreneur</description>
	<lastBuildDate>Thu, 08 Dec 2011 00:33:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Code in CPAN</title>
		<link>http://www.jonathanlbrown.com/2011/12/07/code-in-cpan/</link>
		<comments>http://www.jonathanlbrown.com/2011/12/07/code-in-cpan/#comments</comments>
		<pubDate>Thu, 08 Dec 2011 00:33:34 +0000</pubDate>
		<dc:creator>jonathan</dc:creator>
				<category><![CDATA[Programming Notes]]></category>

		<guid isPermaLink="false">http://www.jonathanlbrown.com/?p=64</guid>
		<description><![CDATA[Well, there you have it: My Perl integration library is indexed into CPAN: http://search.cpan.org/~jonatayah/Captcha-AreYouAHuman-0.00003/lib/Captcha/AreYouAHuman.pm Search &#8220;CAPTCHA&#8221;.]]></description>
			<content:encoded><![CDATA[<p>Well, there you have it: My Perl integration library is indexed into CPAN:</p>
<p><a href="http://search.cpan.org/~jonatayah/Captcha-AreYouAHuman-0.00003/lib/Captcha/AreYouAHuman.pm">http://search.cpan.org/~jonatayah/Captcha-AreYouAHuman-0.00003/lib/Captcha/AreYouAHuman.pm</a></p>
<p>Search &#8220;CAPTCHA&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jonathanlbrown.com/2011/12/07/code-in-cpan/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TCPDF: Paging those MultiCells</title>
		<link>http://www.jonathanlbrown.com/2011/07/17/tcpdf-paging-those-multicells/</link>
		<comments>http://www.jonathanlbrown.com/2011/07/17/tcpdf-paging-those-multicells/#comments</comments>
		<pubDate>Sun, 17 Jul 2011 17:26:53 +0000</pubDate>
		<dc:creator>jonathan</dc:creator>
				<category><![CDATA[Programming Notes]]></category>

		<guid isPermaLink="false">http://www.jonathanlbrown.com/?p=51</guid>
		<description><![CDATA[Here&#8217;s something that I ran into: Let&#8217;s say you need to write out some tables to a PDF that you are dynamically building.  You grab the multicell command, everything looks good, and then you get an automatic page break.  Suddenly, your PDF looks like puke on a plate: the cells overwrite each other, rows are [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s something that I ran into:</p>
<p>Let&#8217;s say you need to write out some tables to a PDF that you are dynamically building.  You grab the multicell command, everything looks good, and then you get an automatic page break.  Suddenly, your PDF looks like puke on a plate: the cells overwrite each other, rows are on top of rows, rows stretch awkwardly across the page break.</p>
<p>Here&#8217;s a way to make MultiCell page breaks look good.  I tried this in TCPDF 5 &#8212; the use of the current page function was not working for me.  (You&#8217;re not writing in iTextSharp anymore!)</p>
<pre>
protected function writeMulticells($cell_array) {
    $this-&gt;pdf-&gt;setAutoPageBreak(false);
    $this-&gt;pdf-&gt;startTransaction();
    foreach ($cell_array as $row) {
        $this-&gt;pdf-&gt;MultiCell($row[0], $row[1],
                                    $row[2], $row[3],
                                    $row[4], $row[5],
                                    $row[6]);
    }
    $this-&gt;pdf-&gt;ln(); </code>

    if ($this-&gt;pdf-&gt;getY() &gt; $this-&gt;pdf-&gt;getPageHeight() - 30) {
        $this-&gt;pdf-&gt;rollbackTransaction(true);
        $this-&gt;pdf-&gt;AddPage();
        foreach ($cell_array as $row) {
            $this-&gt;pdf-&gt;MultiCell($row[0], $row[1], $row[2],
               $row[3], $row[4], $row[5], $row[6]);
        }
        $this-&gt;pdf-&gt;ln();
    }
    $this-&gt;pdf-&gt;commitTransaction();
    $this-&gt;pdf-&gt;setAutoPageBreak(true, 30);
}
</pre>
<p>(I just happened to have this inside a CodeIgniter model, hence the protected function.)</p>
<p>What we do is the following:</p>
<ol>
<li> Disable auto page breaks. </li>
<li> Start a transaction. </li>
<li> Write the row. </li>
<li> If you would have crossed into the footer, roll back, make a new page, and write the row again. </li>
<li> Commit the transaction. </li>
<li> Re-enable auto page breaks. </li>
</ol>
<p>All of the examples I could find suggested using the getPage function, but that didn&#8217;t work all of the time in my particular application.  Your mileage may vary, of course, but here&#8217;s an alternative option.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jonathanlbrown.com/2011/07/17/tcpdf-paging-those-multicells/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AIM Authorize.Net Integration Hiccup</title>
		<link>http://www.jonathanlbrown.com/2010/01/30/aim-authorize-net-integration-hiccup/</link>
		<comments>http://www.jonathanlbrown.com/2010/01/30/aim-authorize-net-integration-hiccup/#comments</comments>
		<pubDate>Sat, 30 Jan 2010 10:10:09 +0000</pubDate>
		<dc:creator>jonathan</dc:creator>
				<category><![CDATA[Programming Notes]]></category>

		<guid isPermaLink="false">http://www.jonathanlbrown.com/?p=19</guid>
		<description><![CDATA[Two hiccups while attempting to configure Authorize.Net AIM method, and how I fixed them: Using Curl, I was submitting by POST with an array.  This caused it to use multipart/form-data encoding, which sure looks like it doesn&#8217;t work.  To get it to use www-form-urlencode, I had to urlencode the arguments myself and pass the argument [...]]]></description>
			<content:encoded><![CDATA[<p>Two hiccups while attempting to configure Authorize.Net AIM method, and how I fixed them:</p>
<ul>
<li>Using Curl, I was submitting by POST with an array.  This caused it to use multipart/form-data encoding, which sure looks like it doesn&#8217;t work.  To get it to use www-form-urlencode, I had to urlencode the arguments myself and pass the argument string, not the array.</li>
<li>The ampersand (&amp;) is not a field separator &#8212; it&#8217;s a stop character.  The spec calls for all key/value pairs to end in an ampersand.  If you pull out any old library that will do the previous one &#8212; or, let&#8217;s say you had one homebrewed&#8230; &#8212; you might not have put an ampersand on the end.  Without the ampersand, you&#8217;ll get that dreaded (92) error.</li>
</ul>
<p>Do that, and, like magic, it works.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jonathanlbrown.com/2010/01/30/aim-authorize-net-integration-hiccup/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

