<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.andrewheiss.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">
 
 <title>AndrewHeiss.com</title>
 
 <link href="http://www.andrewheiss.com/" />
 <updated>2012-05-22T23:45:29-06:00</updated>
 <id>http://www.andrewheiss.com/</id>
 <author>
   <name>Andrew Heiss</name>
   <email>andrew@andrewheiss.com</email>
 </author>
 
 
 <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.andrewheiss.com/AndrewHeiss" /><feedburner:info uri="andrewheiss" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry>
   <title>Install R, RStudio, and R Commander in Windows and OS X</title>
   <link href="http://feeds.andrewheiss.com/~r/AndrewHeiss/~3/7IE9qgNH6e4/" />
   <updated>2012-04-17T00:00:00-06:00</updated>
   <id>http://www.andrewheiss.com/blog/2012/04/17/install-r-rstudio-r-commander-windows-osx</id>
   <content type="html">&lt;p&gt;&lt;a href='http://www.r-project.org/'&gt;R&lt;/a&gt; is an incredibly powerful open source program for statistics and graphics. It can run on pretty much any computer and has a very active and friendly support community online. Graphics created by R are extremely extensible and are used in high level publications like the New York Times (as explained by &lt;a href='http://book.flowingdata.com/'&gt;this former NYT infographic designer&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;&lt;a href='http://rstudio.org/'&gt;RStudio&lt;/a&gt; is an integrated development environment (IDE) for R. It&amp;#8217;s basically a nice front-end for R, giving you a console, a scripting window, a graphics window, and an R workspace, among other options.&lt;/p&gt;

&lt;p&gt;&lt;a href='http://socserv.mcmaster.ca/jfox/Misc/Rcmdr/'&gt;R Commander&lt;/a&gt; is a basic graphical user interface (GUI) for R. It provides a series of menus that allow you to run lots of statistic tests and create graphics without typing a line of code. More advanced features of R aren&amp;#8217;t accessible through R Commander, but you can use it for the majority of your statistics. &lt;em&gt;(Lots of people (like me) use R Commander as a crutch for a few months before they get the hang of the R language. As intimidating as it might be to constantly type stuff at the console, it really is a lot faster.)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;However, as is the case with lots of free and open source software, it can be a little tricky to install all of these different programs and get them to work nicely together. The simple instructions below explain how to get everything working right.&lt;/p&gt;

&lt;h3 id='install_r_rstudio_and_r_commander_in_windows'&gt;Install R, RStudio, and R Commander in Windows&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Download R from &lt;a href='http://cran.us.r-project.org/'&gt;http://cran.us.r-project.org/&lt;/a&gt; (click on &amp;#8220;Download R for Windows&amp;#8221; &amp;gt; &amp;#8220;base&amp;#8221; &amp;gt; &amp;#8220;Download R 2.x.x for Windows&amp;#8221;)&lt;/li&gt;

&lt;li&gt;Install R. Leave all default settings in the installation options.&lt;/li&gt;

&lt;li&gt;Download RStudio from &lt;a href='http://rstudio.org/download/desktop'&gt;http://rstudio.org/download/desktop&lt;/a&gt; and install it. Leave all default settings in the installation options.&lt;/li&gt;

&lt;li&gt;Open RStudio.&lt;/li&gt;

&lt;li&gt;Go to the &amp;#8220;Packages&amp;#8221; tab and click on &amp;#8220;Install Packages&amp;#8221;. The first time you&amp;#8217;ll do this you&amp;#8217;ll be prompted to choose a CRAN mirror. R will download all necessary files from the server you select here. Choose the location closest to you (probably &amp;#8220;USA CA 1&amp;#8221; or &amp;#8220;USA CA 2&amp;#8221;, which are housed at UC Berkeley and UCLA, respectively).&lt;br /&gt;&lt;img src='http://files.andrewheiss.com/images/install_r_commander/install_packages_win.png' alt='Install packages in Windows' /&gt;&lt;/li&gt;

&lt;li&gt;Start typing &amp;#8220;Rcmdr&amp;#8221; until you see it appear in a list. Select the first option (or finish typing Rcmdr), ensure that &amp;#8220;Install dependencies&amp;#8221; is checked, and click &amp;#8220;Install&amp;#8221;.&lt;br /&gt;&lt;img src='http://files.andrewheiss.com/images/install_r_commander/install_packages_win_1.png' alt='Install Rcmdr in Windows' /&gt;&lt;/li&gt;

&lt;li&gt;Wait while all the parts of the R Commander package are installed.&lt;/li&gt;

&lt;li&gt;If you get permission errors while installing packages, close R Studio and reopen it with administrator privileges.&lt;br /&gt;&lt;img src='http://files.andrewheiss.com/images/install_r_commander/run_as_administrator.png' alt='Run as administrator in Windows' /&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id='install_r_rstudio_and_r_commander_in_mac_os_x'&gt;Install R, RStudio, and R Commander in Mac OS X&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Download R from &lt;a href='http://cran.us.r-project.org/'&gt;http://cran.us.r-project.org/&lt;/a&gt; (click on &amp;#8220;Download R for Mac OS X&amp;#8221; &amp;gt; &amp;#8220;R-2.x.x.pkg (latest version)&amp;#8221;)&lt;/li&gt;

&lt;li&gt;Install R.&lt;/li&gt;

&lt;li&gt;Download RStudio from &lt;a href='http://rstudio.org/download/desktop'&gt;http://rstudio.org/download/desktop&lt;/a&gt;.&lt;/li&gt;

&lt;li&gt;Install RStudio by dragging the application icon to your Applications folder.&lt;/li&gt;

&lt;li&gt;Download Tcl/Tk from &lt;a href='http://cran.r-project.org/bin/macosx/tools/'&gt;http://cran.r-project.org/bin/macosx/tools/&lt;/a&gt; (click on &lt;code&gt;tcltk-8.x.x-x11.dmg&lt;/code&gt;; OS X needs this to run R Commander.)&lt;/li&gt;

&lt;li&gt;Install Tcl/Tk.&lt;/li&gt;

&lt;li&gt;Go to your Applications folder and find a folder named Utilities. Verify that you have a program named &amp;#8220;X11&amp;#8221; there. If not, go to &lt;a href='http://xquartz.macosforge.org/'&gt;http://xquartz.macosforge.org/&lt;/a&gt; and download and install the latest version of XQuartz.&lt;br /&gt;&lt;img src='http://files.andrewheiss.com/images/install_r_commander/x11_utilities.png' alt='X11 in Applications/Utilities' /&gt;&lt;/li&gt;

&lt;li&gt;Open RStudio.&lt;/li&gt;

&lt;li&gt;Go to the &amp;#8220;Packages&amp;#8221; tab and click on &amp;#8220;Install Packages&amp;#8221;. The first time you&amp;#8217;ll do this you&amp;#8217;ll be prompted to choose a CRAN mirror. R will download all necessary files from the server you select here. Choose the location closest to you (probably &amp;#8220;USA CA 1&amp;#8221; or &amp;#8220;USA CA 2&amp;#8221;, which are housed at UC Berkeley and UCLA, respectively).&lt;br /&gt;&lt;img src='http://files.andrewheiss.com/images/install_r_commander/install_packages_mac.png' alt='Install packages in OS X' /&gt;&lt;/li&gt;

&lt;li&gt;Start typing &amp;#8220;Rcmdr&amp;#8221; until you see it appear in a list. Select the first option (or finish typing Rcmdr), ensure that &amp;#8220;Install dependencies&amp;#8221; is checked, and click &amp;#8220;Install&amp;#8221;.&lt;br /&gt;&lt;img src='http://files.andrewheiss.com/images/install_r_commander/install_packages_mac_1.png' alt='Install Rcmdr in OS X' /&gt;&lt;/li&gt;

&lt;li&gt;Wait while all the parts of the R Commander package are installed.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id='open_r_commander_in_windows_and_os_x'&gt;Open R Commander in Windows and OS X&lt;/h3&gt;

&lt;p&gt;Once you&amp;#8217;ve installed R Commander, you won&amp;#8217;t have to go through all those steps again! Running R Commander from this point on is simple—follow the instructions below.&lt;/p&gt;

&lt;p&gt;If you decide to stop using R Commander and just stick with R, all you ever need to do is open RStudio—even simpler!&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open R Studio&lt;/li&gt;

&lt;li&gt;In the console, type &lt;code&gt;windows()&lt;/code&gt; if using Windows, &lt;code&gt;quartz()&lt;/code&gt; if using Mac OS X. (This tells R Commander to output all graphs to a new window). If you don&amp;#8217;t do this, R Commander graphs will be output to the graphics window in RStudio.&lt;/li&gt;

&lt;li&gt;Go to the &amp;#8220;Packages&amp;#8221; tab, scroll down to &amp;#8220;Rcmdr,&amp;#8221; and check the box to load the plugin. (Alternatively, type &lt;code&gt;library(Rcmdr)&lt;/code&gt; at the console.)&lt;/li&gt;
&lt;/ol&gt;&lt;img src="http://feeds.feedburner.com/~r/AndrewHeiss/~4/7IE9qgNH6e4" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://www.andrewheiss.com/blog/2012/04/17/install-r-rstudio-r-commander-windows-osx/</feedburner:origLink></entry>
 
 <entry>
   <title>World-Ready Composer not Perfect</title>
   <link href="http://feeds.andrewheiss.com/~r/AndrewHeiss/~3/aQZKrIJI5Kk/" />
   <updated>2011-06-25T00:00:00-06:00</updated>
   <id>http://www.andrewheiss.com/blog/2011/06/25/world-ready-composer-not-perfect</id>
   <content type="html">&lt;p&gt;Although Adobe has included the world-ready composer in InDesign CS4 and 5, &lt;a href='http://www.andrewheiss.com/blog/2011/06/24/using-arabic-in-indesign-cs5-without-indesign-me/'&gt;like I said in my previous post&lt;/a&gt;, it&amp;#8217;s not documented or supported at all. It&amp;#8217;s still buggy and unfinished, unfortunately.&lt;/p&gt;

&lt;p&gt;Here&amp;#8217;s a little example of how buggy it really is. I typeset the same sentence in Arabic in different fonts I have installed on my computer. As you can see, most of the fonts work flawlessly (yay!), with two exceptions. Traditional Arabic can&amp;#8217;t display short vowels—they break up the connecting letters—and Geeza Pro is a sad, sad little font.&lt;/p&gt;

&lt;p&gt;&lt;a href='http://files.andrewheiss.com/PDFs/Arabic%20Samples.pdf'&gt;Download PDF of sample&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src='http://files.andrewheiss.com/images/Arabic-Samples.png' alt='Arabic typographic samples' /&gt;&lt;/p&gt;

&lt;p&gt;I don&amp;#8217;t know if this is a problem with the fonts themselves or with the composer. &lt;del&gt;Traditional Arabic was specially designed for Office 2007 to be a high quality Arabic font, and it comes with thousands of extra glyphs for every position possible, so it would seem like it *should* be able to display correctly.&lt;/del&gt; Just kidding. Arabic Typesetting is the special Office 2007 font and it works just fine (it has a nice Naskh-y feel to it). Traditional Arabic has been included with Windows since Windows 2000 and apparently isn&amp;#8217;t very well made (?). Or maybe the composer is just buggy (?).&lt;/p&gt;

&lt;p&gt;Geeza Pro, on the other hand, definitely has a problem with the font itself. &lt;a href='http://forum.redlers.com/viewtopic.php?f=1&amp;amp;t=2180'&gt;This forum&lt;/a&gt; says that the version of Geeza Pro in Snow Leopard is faulty and doesn&amp;#8217;t connect. Hopefully Lion fixes that…&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AndrewHeiss/~4/aQZKrIJI5Kk" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://www.andrewheiss.com/blog/2011/06/25/world-ready-composer-not-perfect/</feedburner:origLink></entry>
 
 <entry>
   <title>Using Arabic in InDesign CS5 without InDesign ME</title>
   <link href="http://feeds.andrewheiss.com/~r/AndrewHeiss/~3/M2R2o6O_ol4/" />
   <updated>2011-06-24T00:00:00-06:00</updated>
   <id>http://www.andrewheiss.com/blog/2011/06/24/using-arabic-in-indesign-cs5-without-indesign-me</id>
   <content type="html">&lt;p&gt;Nearly four years ago, &lt;a href='http://www.andrewheiss.com/blog/2007/09/17/using-arabic-in-indesign-without-indesign-me/'&gt;I posted a workaround for InDesign CS3&amp;#8217;s lack of support for RTL support.&lt;/a&gt; The only way to get proper Arabic or Hebrew text back then was to type backwards—something trivial (and scriptable) for Hebrew, but far more complicated for Arabic, with all its different letter forms that change depending on their position in the word. Rather than &lt;em&gt;type&lt;/em&gt; backwards, you had to &lt;em&gt;manually&lt;/em&gt; insert glyphs from the glyphs panel backwards. While this was extraordinarily tedious, it worked for times when you only needed to deal with a few words—maybe a short sentence.&lt;/p&gt;

&lt;p&gt;For my job I&amp;#8217;ve been using InDesign CS3 ME with Tasmeem and have fallen in love with the super advanced typographic tools that it provides. But, I&amp;#8217;m not planning on keeping that job forever (I&amp;#8217;m graduating in less than a year!), and I don&amp;#8217;t want to go back to hunting for glyphs. I&amp;#8217;ve been spoiled :)&lt;/p&gt;

&lt;p&gt;I heard rumors that CS4 and CS5 had a mysterious RTL editing mode that was only accessible through scripting, but I was in Egypt for both launches and wasn&amp;#8217;t able to get the educational upgrade. I finally upgraded to CS5 a couple days ago and immediately got to work figuring out this rumored Arabic mode.&lt;/p&gt;

&lt;p&gt;Starting with CS4, Adobe began including a new &amp;#8220;world ready&amp;#8221; paragraph composer, which provides many of the same typographic controls offered by Winsoft&amp;#8217;s Middle Eastern editions. However, CS4 shipped before Adobe could polish off any of the controls. The internet world hoped that there&amp;#8217;d be some new world ready panel for CS5, but to no avail. The world ready composer was included (and improved?) with CS5, but is still mostly inaccessible.&lt;/p&gt;

&lt;p&gt;Unless you do a cool trick :)&lt;/p&gt;

&lt;p&gt;You can programmatically create paragraph styles that use the world ready composer, allowing you to typeset Arabic, Hebrew, Thai, Devangari-like languages, and a ton of other more complex scripts. Here&amp;#8217;s how you can enable native Arabic typography inside CS5 (courtesy of &lt;a href='http://www.thomasphinney.com/2009/01/adobe-world-ready-composer/'&gt;Thomas Phinney&lt;/a&gt;):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href='http://www.thomasphinney.com/wp-content/uploads/2009/01/r2l_scripts_for_id_cs4.zip'&gt;Download these scripts&lt;/a&gt; by Thomas Phinney and Peter Kahrel and &lt;a href='http://www.danrodney.com/scripts/directions-installingscripts.html'&gt;install them&lt;/a&gt; in your script folder.&lt;/li&gt;

&lt;li&gt;Run the &amp;#8220;r2l Paragraph Style Arabic&amp;#8221; script from the Scripts panel. A new paragraph style named &amp;#8220;RTL Arabic&amp;#8221; should appear in your Paragraph Styles panel.&lt;/li&gt;

&lt;li&gt;Check the style settings and verify that the &amp;#8220;Adobe World-Ready Paragraph Composer&amp;#8221; is being used for the style.&lt;br /&gt;&lt;img src='http://files.andrewheiss.com/images/world-ready.png' alt='World-Ready Composer' /&gt;&lt;/li&gt;

&lt;li&gt;Start using Arabic text!&lt;/li&gt;

&lt;li&gt;&lt;em&gt;Bonus:&lt;/em&gt; To use the composer in other documents you can either run the script again or just copy the style. The composer is activated by the style. Theoretically you could save the Arabic style to a new template and never have to run the script again.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is definitely &lt;em&gt;not&lt;/em&gt; a full replacement for Winsoft&amp;#8217;s CS5 InDesign ME, since it doesn&amp;#8217;t give you any graphical control over kashidas, digits, diacritic positions, or any of the other more detailed options available in the world ready composer. You can edit the script, change the options around, and create a new style, but you&amp;#8217;d need to know the API for the world ready composer. Phinney&amp;#8217;s script, for example, sets the default digits for the style as Arabic digits with &lt;code&gt;ps.digitsType = DigitsTypeOptions.arabicDigits;&lt;/code&gt;. If you knew the option for Farsi-style numbers, you could edit the script. Unfortunately the whole composer is completely undocumented and unsupported. &lt;a href='http://indesigning.net/right-to-left-arabic-hebrew-hindi-in-indesign-cs4-none-me'&gt;This site&lt;/a&gt; includes many of the hidden options—you&amp;#8217;d just need to guess about how to use them in the script. Maybe Adobe will finally make all these options accessible in CS6?&lt;/p&gt;

&lt;p&gt;There are a couple options for more graphical control over the hidden settings, but they cost money. &lt;a href='https://sites.google.com/site/adoberighttoleft/Home'&gt;idRTL&lt;/a&gt; created a plugin that provides a useful panel to edit all the hidden Middle Eastern settings. It&amp;#8217;s $50 and says it&amp;#8217;s made for CS4, although I&amp;#8217;m assuming it&amp;#8217;ll work with CS5 too. &lt;a href='http://in-tools.com/products/plugins/world-tools/'&gt;Word Tools&lt;/a&gt; creates a similar panel, costs $100, and supports CS5.&lt;/p&gt;

&lt;p&gt;So, even though activating the world ready composer can be a little tricky, it&amp;#8217;s a fantastic little trick that lets you use real RTL text without tedious backward typing.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AndrewHeiss/~4/M2R2o6O_ol4" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://www.andrewheiss.com/blog/2011/06/24/using-arabic-in-indesign-cs5-without-indesign-me/</feedburner:origLink></entry>
 
 <entry>
   <title>Fake CloudApp with Dropbox and Quicksilver</title>
   <link href="http://feeds.andrewheiss.com/~r/AndrewHeiss/~3/BqQV9lq710k/" />
   <updated>2011-06-19T00:00:00-06:00</updated>
   <id>http://www.andrewheiss.com/blog/2011/06/19/fake-cloud-app-dropbox</id>
   <content type="html">&lt;p&gt;Recently a friend showed me &lt;a href='http://getcloudapp.com/'&gt;CloudApp&lt;/a&gt;, a fantastic little app that sits in your menu bar and lets you share files almost instantly. With a quick keystroke you upload a file to their servers and get a public URL to share with anyone. Neato.&lt;/p&gt;

&lt;p&gt;However, with a basic (free) CloudApp account you are limited in the size and number of uploads you can make each month. I&amp;#8217;m also really picky about what goes in my menu bar, and I didn&amp;#8217;t really like having an extra app running just for when I need to upload something.&lt;/p&gt;

&lt;p&gt;My current workflow for uploading and sending files is to drag a file into my Dropbox public folder, navigate to it, right click it, and copy its public Dropbox URL. I like this because Dropbox is already running on my computer (no need for extra menu bar apps) and because I feel like I have more control over the fate of my file than with CloudApp (regardless of &lt;a href='http://daringfireball.net/linked/2011/05/17/dropbox-encryption'&gt;Dropbox&amp;#8217;s recent legal issues&lt;/a&gt;). Plus there aren&amp;#8217;t any arbitrary upload or storage space restrictions.&lt;/p&gt;

&lt;p&gt;The one downside to this workflow is that it&amp;#8217;s long and convoluted and lacks the magic instantaneousness of CloudApp. So I decided to make my own magical CloudApp-esque instant upload + public URL system with programs I&amp;#8217;m already running: Dropbox and Quicksilver.&lt;/p&gt;

&lt;p&gt;Here&amp;#8217;s how to do it:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Download the &lt;a href='http://dropboxwiki.com/Dropbox_Service'&gt;&amp;#8220;Post to Dropox&amp;#8221;&lt;/a&gt; OS X service.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Unzip and open the Copy to Dropbox service in Automator.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;em&gt;Optional:&lt;/em&gt; If you don&amp;#8217;t want to clutter your public folder with random files, you can change the &amp;#8220;Copy Finder Items&amp;#8221; action in Automator to point to a subfolder in your public folder. Mine is set to &amp;#8220;~/Dropbox/Public/Uploaded,&amp;#8221; so I can periodically go and clear out any out of date uploads, like one-off screenshots and the like.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;In the Run Shell Script section, replace &lt;code&gt;&amp;lt;DROPBOX-ID&amp;gt;&lt;/code&gt; with your Dropbox user ID (the one from your public URLs, not your e-mail address).&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;If you want to use the Move to Dropbox service as well (I use both), open it and type your user ID there as well.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Move both services to ~/Library/Services. You can now access them from the system wide services menu. Right click on any file, go to &amp;#8220;Services&amp;#8221; and easily move or copy any file to your public Dropbox folder &lt;em&gt;and&lt;/em&gt; get the URL for that file placed automatically in your clipboard.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;While these services eliminate most of the clicking and dragging I was doing before, they still require three clicks (select the file, right click to navigate to the services menu, click on the service). Luckily Quicksilver simplifies the process even more. You could probably use other Quicksilver-esque programs like Alfred and the like to get the universal service keyboard shortcuts.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Enable the &amp;#8220;Services Menu Module&amp;#8221; in Quicksliver&amp;#8217;s plug-ins sheet in its preferences (⌘ + ,).&lt;br /&gt;&lt;img src='http://files.andrewheiss.com/images/qs-plugins_500.png' alt='Quicksilver plugin menu' /&gt;&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Go to Preferences and make sure &amp;#8220;Enable advanced features&amp;#8221; is checked.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Go to Catalog &amp;gt; Quicksilver and check &amp;#8220;Proxy Objects&amp;#8221;&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Create a new trigger to pipe the current selection through each of the services. I use ⌃⌥⌘U for Copy to Dropbox and ⌃⌥⇧⌘U (essentially mashing down the whole corner of my keyboard :) ) for Move to Dropbox. &lt;br /&gt;&lt;img src='http://files.andrewheiss.com/images/trigger_500.png' alt='Setting a trigger in Quicksilver' /&gt;&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Select a file, press your new keyboard shortcut, and voila—the file is instantly copied to Dropbox and you have a URL ready to paste somewhere. Pure magic :)&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;One of the only differences between this and CloudApp is that there&amp;#8217;s no response after you use the service. There&amp;#8217;s nothing to let you know that it actually happened. However, you can easily add a sound or Growl notification to the Automator service if you want some sort of response.&lt;/p&gt;

&lt;p&gt;So there it is. Magic CloudApp functionality using Dropbox and Quicksilver!&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AndrewHeiss/~4/BqQV9lq710k" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://www.andrewheiss.com/blog/2011/06/19/fake-cloud-app-dropbox/</feedburner:origLink></entry>
 
 <entry>
   <title>In Tahrir Square</title>
   <link href="http://feeds.andrewheiss.com/~r/AndrewHeiss/~3/58UIrIakB3s/" />
   <updated>2011-02-03T00:00:00-07:00</updated>
   <id>http://www.andrewheiss.com/blog/2011/02/03/in-tahrir-square</id>
   <content type="html">&lt;p&gt;My awesome wife &lt;a href='http://www.heissatopia.com/2011/02/in-tahrir-square.html'&gt;just wrote up a fantastic poem&lt;/a&gt; dedicated to the &amp;#35;Jan25 Tahrir protestors. This past week has been riveting and emotional for us, even though we live far from Egypt now. Cairo was our home for two years—we drank from the Nile (شربنا من النيل) and feel part of it. This horrific carnage is absolutely sickening.&lt;/p&gt;

&lt;p&gt;Ta7ya Masr!&lt;/p&gt;
&lt;hr /&gt;
&lt;h3 id='in_tahrir_square'&gt;In Tahrir Square&lt;/h3&gt;

&lt;p&gt;In Tahrir Square the people fight&lt;br /&gt;For freedom, truth, and human rights&lt;br /&gt;We all should have; While here I sit&lt;br /&gt;And watch the robins peck and flit&lt;br /&gt;Not knowing what went on last night.&lt;/p&gt;

&lt;p&gt;How many dead? We&amp;#8217;ll never know.&lt;br /&gt;The guns, the knives, the bombs aglow&lt;br /&gt;Seek and will seek to thwart hearts knit&lt;br /&gt;In Tahrir square.&lt;/p&gt;

&lt;p&gt;Take up their quarrel with the foe:&lt;br /&gt;To you from failing hands they fling&lt;br /&gt;The torch; be yours to hold it high.&lt;br /&gt;If ye break faith with those who die&lt;br /&gt;They shall not sleep, when silence rings&lt;br /&gt;In Tahrir Square.&lt;/p&gt;

&lt;p&gt;Nancy Heiss &lt;br /&gt;February 3, 2011&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(With thanks to &lt;a href='http://en.wikipedia.org/wiki/In_Flanders_Fields'&gt;John McCrae&lt;/a&gt;)&lt;/em&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AndrewHeiss/~4/58UIrIakB3s" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://www.andrewheiss.com/blog/2011/02/03/in-tahrir-square/</feedburner:origLink></entry>
 
 <entry>
   <title>Mona Prince on #jan25 Egyptian Protests</title>
   <link href="http://feeds.andrewheiss.com/~r/AndrewHeiss/~3/BM5HYXkJ4P0/" />
   <updated>2011-01-27T00:00:00-07:00</updated>
   <id>http://www.andrewheiss.com/blog/2011/01/27/mona-prince-on-egyptian-revolution</id>
   <content type="html">&lt;p&gt;Egyptian novelist and professor Mona Prince just sent me this personal report on her experience with the &lt;a href='http://en.wikipedia.org/wiki/2011_Egyptian_protests'&gt;#jan25 protests&lt;/a&gt;. I&amp;#8217;m reposting it here in its entirety.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;strong&gt;a personal testimony on police brutality during protests: jan 26 2011 down town cairo&amp;#8211;mona prince&lt;/strong&gt;&lt;br /&gt;round 6.30 pm down town cairo, i joined the demonstration on qasr el nil street along with some friends and other people whom i don&amp;#8217;t know. the protesters were marching peacefully and politely and decently from one street to another evading the security forces who were some how at a loss at how to stop us, especially when we took to shawarbi street, we were at the back, and the police officers behind and front talking in their walki talki, we could hear them saying they don&amp;#8217;t know how to besiege us. we kept on moving and more people were joining us from the streets and shops, young men and women. we were chanting the requests of egyptian people &amp;#8221; leave &amp;#8221; and &amp;#8221; egyptian people want the regime out &amp;#8220;. we didn&amp;#8217;t attack any body, or destroy any shops or cars&amp;#8230; we were moving in the middle of streets without blocking the traffic, just slowing it down until we reached sherif street and we were heading towards 26 july street, then the security forces appeared from behind and front. we started running, and security police in civilian clothes started grabbing randomly many young men and women. i saw them grab and beat a young innocent man, pushed him to the ground and kept kicking. i protested against the beating up, and kept screaming at them to stop acting like animals, 4 or 5 huge giant men grabbed me from my hair and said &amp;#8221; well join him you bitch &amp;#8221; and slapped me on the face , beat me up, kicked me, and cornered me next to the young man and kept hitting me on my head, arm, shoulder, back , stepping on my head with their shoes until i bled from my mouth and could not speak any more on the ground. they kept their shoes on my head, kicked me every few seconds,calling me the dirtiest names ever the they dragged me all along the street to 26 july and threw me in one of those microbuses without number plates. they have also dragged the other young man who completely fainted and others too and threw us all in the microbus. and while pushing me inside they were trying to pull off my clothes and sexually harassed me,one grabbed my breasts , another held me my waste, and another grabbed my bottom. i tried to call friends discreetly, but they saw me, so they pull me out of the car and said &amp;#8221; get off &amp;#8221; but 3 of them were blocking the door, and they grabbed the mobile from me, then threw me to the asphalt road. despite the pain, i will go on protesting mona prince egyptian writer and university professor cairo january 27 2011&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;شهادة عن وحشية بلطجية الامن في المظاهرات- وسط القاهرة ٢٦ يناير ٢٠١١ مني برنس&lt;/strong&gt; في حوالي السادسة و نصف مساء يوم الاربعاء ٢٦ يناير ٢٠١١، انضممت انا و أصدقاء و آخرين لا اعرفهم الى مسيرة سلمية احتجاجية في منطقة وسط المدينة، في شارع قصر النيل. و كان المتظاهرون يسيرون بكل ادب من شارع الي اخر في محاولة للهرب و تجنب قوات الامن المركزي الذين بدوا في حيرة و ارتباك حول كيفية محاصرتنا و تفريقنا، خاصة بعدما توجهنا الى شارع الشواربي. كنت انا و المجموعة التي معي في الخلف، و من امامنا و خلفنا ضباط الامن يتكلمون في اجهزتهم اللاسلكية و سمعناهم يقولون ما مفاده انهم لا يعرفون كيف يحاصروننا. استمررنا في السير بشجاعة و دون خوف، و اضم الينا الكثير من الشباب و البنات من الشوارع الجانبية و المحلات، و كنا نردد &amp;#8221; ارحل &amp;#8221; و &amp;#8221; الشعب يريد اسقاط النظام &amp;#8221; لم نعتدي على منشآت او سيارات و لم نهاجم احدا. كنا نسير و سط الشوارع دون أن نمنع مرور السيارات و ان كنا أبطأنا سيرها باتجاه شارع ٢٦ يوليو. ثم ظهرت قوات الامن المركزي من الامام و الخلف ر بدأت تجري نحونا بقوة، فجرينا متفرقين محاولين الاحتماء بالمحلات. و فجأة بدأ بلطجية الامن و وزارة الداخلية الذين يرتدون ملابس مدنية في القبض العشوائي علي الشباب و البنات و ضربهم بقوة. رأيتهم يقبضون على شاب كان يسير أمامي و لم يفعل اي شيء سوى الهتاف مثلنا، دفعوه بزخذيتهم و القوا به الي الأرض و انهالوا عليه ضربا و ركلا و لكما حتى اغمي عليه. اعترضت على ما يفعلون و صرخت فيهم الا يتصرفوا مثل الحيوانات و انهم ليسوا رجال و ليسوا بني آدمين، فاندفع نحوي ٤ او ٥ رجال ضخام الحجم و جروني من شعري، ضربوني علي و جهي، أخذوا يضربونني بعنف و يركلونني ثم القوا بي الى الآرض بجانب الشاب الذي فقد وعيه و هم يقولون &amp;#8221; طب يللا حصليه يا بنت القحبة &amp;#8220;. فرد اخر &amp;#8221; مرة قحبة &amp;#8221; و استمروا في ضربي و ركلي بضعة دقائق و يدوسون علي رأسي و جسدي بأحذيتهم حتى سال الدم من فمي و هم يسبونني بأقذر السباب و الصفات، الى ان سكت و لم استطع الكلام. ثم جرجروني و هم ما يزالرن يركلونني و يسبونني الى شارع ٢٦ يوليو ثم القوا في واحد من تلك الميكروباصات التي لا تحمل لوحة ارقام. و فعلوا نفس الشيء مع شباب اخرين و القوا بهم الى داخل نفس السيارة، من بينهم الشاب الذي كنت ادافع عنه و فقد وعيه. و في اثناء محاولتهم حشري داخل السيارة، كانوا يتحرشون بي جنسيا، و يحاولون تعريتي واحد مسكني من صدري، و الحر من وسطي و شخص اخر مسكني من اسفل ظهري ثم دفعوني الى الداخل. كان هناك نحو ٥ او ٦ و ربما اكثر شباب داخل السيارة. حاولت الاتصال بأصدقاء بشكل هامس و بعيد عن اعين الامن لكنهم رأوومي. سحبوني من داخل الميكروباص و امروني بالنزول و هم يسبونني و في نفس الوقت يسدون باب السيارة &amp;#8221; بتكلمي مين يا بنت &amp;#8230;.&amp;#8221; و خطفوا مني التلفون المحمول بالقوة ثم شدوني خارج السيارة و القوا بي الي الاسفلت.&lt;/p&gt;

&lt;p&gt;رغم الألم سوف استمر في الاحتجاج منى برنس كاتبة مصرية و استاذة بالجامعة القاهرة ٢٧ يناير ٢٠١١&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AndrewHeiss/~4/BM5HYXkJ4P0" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://www.andrewheiss.com/blog/2011/01/27/mona-prince-on-egyptian-revolution/</feedburner:origLink></entry>
 
 <entry>
   <title>iOS 4, Multitasking, and Battery Life</title>
   <link href="http://feeds.andrewheiss.com/~r/AndrewHeiss/~3/1_yM4806YDE/" />
   <updated>2010-09-24T00:00:00-06:00</updated>
   <id>http://www.andrewheiss.com/blog/2010/09/24/ios4-multitasking-battery-life</id>
   <content type="html">&lt;p&gt;I recently got a brand new 4G iPod Touch for my initial foray into the amazing world of iOS. I&amp;#8217;ve been sitting on the sidelines far too long and I&amp;#8217;m &lt;a href='http://twitter.com/#!/andrewheiss/status/25170167865'&gt;so excited&lt;/a&gt; to finally have an almost-iPhone.&lt;/p&gt;

&lt;p&gt;However, I ran into my first hitch this morning and my Google skills have proven useless to solve it. I&amp;#8217;ve been using the iPod as an alarm clock for the past few days since its UI is superior to the ancient digital clock in our bedroom :). When I went to bed last night the battery was probably at 80% capacity. &lt;a href='http://www.apple.com/ipodtouch/specs.html'&gt;Apple touts&lt;/a&gt; that the new iPod has 40 hours of battery life when playing music—quite impressive. I had put the iPod in airplane mode, turning off the WiFi so that I wouldn&amp;#8217;t get any mail or Facebook notifications. With no internet, no music, and no apps (supposedly) running, the iPod&amp;#8217;s battery theoretically should have lasted for months—or even years :)&lt;/p&gt;

&lt;p&gt;However, I didn&amp;#8217;t wake up to the iPod&amp;#8217;s alarm this morning. I woke up to Rachel pulling on my arm and saying &amp;#8220;Wake up, Dad! I want cereal!&amp;#8221; 1.5 hours later than when I was planning to wake up.&lt;/p&gt;

&lt;p&gt;The iPod&amp;#8217;s battery had died in less than 7 hours.&lt;/p&gt;

&lt;p&gt;I&amp;#8217;m assuming this is linked to the new multitasking system in iOS 4, where apps that aren&amp;#8217;t running are put into memory so you can open them where you left off. Sure enough, I had like 25 apps in the multitasking tray, which I quickly cleared out after plugging in the depleted iPod.&lt;/p&gt;

&lt;p&gt;So, iOS users out there: what experience have you had with multitasking and battery life? Is there an easy way to &amp;#8220;officially&amp;#8221; quit an application rather than send it to the tray? What should I do avoid something like this again?&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AndrewHeiss/~4/1_yM4806YDE" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://www.andrewheiss.com/blog/2010/09/24/ios4-multitasking-battery-life/</feedburner:origLink></entry>
 
 <entry>
   <title>Queen Rania at AUC</title>
   <link href="http://feeds.andrewheiss.com/~r/AndrewHeiss/~3/GrnxGDGS9bU/" />
   <updated>2010-02-28T00:00:00-07:00</updated>
   <id>http://www.andrewheiss.com/blog/2010/02/28/queen-rania-at-auc</id>
   <content type="html">&lt;p&gt;This morning AUC&amp;#8217;s &lt;a href='http://www.aucegypt.edu/ResearchatAUC/rc/gerhartcenter/Pages/default.aspx' title='Gerhart Center'&gt;John D. Gerhart Center for Civic Engagement&lt;/a&gt; hosted a lecture by &lt;a href='http://www.queenrania.jo/'&gt;Queen Rania al-Abdullah&lt;/a&gt; of Jordan. Queen Rania is famous for being intensely involved in the public sphere and, according to the venerable &lt;a href='http://en.wikipedia.org/wiki/Queen_Rania_of_Jordan'&gt;Wikipedia&lt;/a&gt;, is considered one of the &lt;a href='http://www.forbes.com/lists/2009/11/power-women-09_Queen-Rania_VZPS.html'&gt;world&amp;#8217;s most powerful women&lt;/a&gt;. She&amp;#8217;s involved with a ton of foundations and NGOs that cover a wide range of goals, from advocating for improvement in girls&amp;#8217; education and employment, promoting dialogue between the US and the Arab world, and calling for what became the buzzword of today&amp;#8217;s lecture: civic engagement. She uses technology to promote her agenda of social improvement and is active on &lt;a href='http://www.youtube.com/user/QueenRania'&gt;YouTube&lt;/a&gt;, &lt;a href='http://twitter.com/QueenRania'&gt;Twitter&lt;/a&gt;, and &lt;a href='http://www.facebook.com/QueenRania'&gt;Facebook&lt;/a&gt;. Basically a beautiful, famous, powerful world leader.&lt;/p&gt;

&lt;p&gt;Queen Rania focused primarily on the need for native grassroots movements in the Arab world, stating that civic engagement is an essential element of societal reform—changes so desperately needed in this region, where poverty and corruption are rampant. She stated that it is the responsibility of all citizens to take an interest in developing and improving their own country. Calling on Arabs to &amp;#8220;look up&amp;#8221; and think of others, she cited the example of one of AUC&amp;#8217;s homegrown NGOs, &lt;a href='http://www.ayb-sd.org/#history'&gt;Alashanek Ya Balady&lt;/a&gt;, which is heavily involved in promoting sustainable development in Egypt&amp;#8217;s poorest neighborhoods. The efforts of AYB and dozens of other organizations constitute a laudable homegrown effort to reform Egyptian society, and they have had lots of success so far.&lt;/p&gt;

&lt;p&gt;The queen then went on to decry the current state of civic laziness in the Arab world, saying that many Arabs confuse the responsibilities of &amp;#8220;citizenship&amp;#8221; with &amp;#8220;sitizenship,&amp;#8221; opting to sit still, sit back, and complain rather than take their own initiative to change society. This is not because Arabs are disconnected, emotionless people—far from it. &amp;#8220;We&amp;#8217;re all passionate about food, family, football, and &lt;a href='http://en.wikipedia.org/wiki/Palestinian_territories'&gt;Filistin&lt;/a&gt;,&amp;#8221; she said, but those passions need to be refocused on bringing about change instead of complacently complaining about the backwardness of Arab governments and societies.&lt;/p&gt;

&lt;p&gt;She developed this theme by responding to a series of preselected questions that followed her main motivational speech, declaring that universities and academia are responsible for remaining engaged with society and not remain isolated in academia. Too often the educated class remains cynically aloof from the rest of the world and fails to contribute real change or instill the culture of civic engagement in their pupils. She also noted the role of Islam in developing this culture of engagement, saying that Islam inherently advocates civic reform and grassroots movements. She called on the audience to &amp;#8220;recapture those compassionate values of Islam&amp;#8221; that have been hijacked by Western media and use the power of faith to help improve society.&lt;/p&gt;

&lt;p&gt;Essentially, she concluded, if we want to see any reform and improvement in the region, the onus is on citizens. Change in the Middle East cannot come from governments, since they are inherently inefficient. Real change can only come about with a change in attitude and an increase in engagement. Regular citizens are the driving factor for this change.&lt;/p&gt;

&lt;p&gt;In the end it was a pretty motivating and inspiring speech, and I agree with most of what she said. Real, lasting change in the Middle East will need to come from some type of bottom-up popular movement, especially when the reforms so desperately needed reduce the power of the ruling class. However, repressive governments throughout the Arab world (including Rania’s Jordan) severely limit what progressive movements can do, and Middle Eastern dictatorships last for decades.&lt;/p&gt;

&lt;p&gt;For example, Egypt’s current president, &lt;a href='http://en.wikipedia.org/wiki/Hosni_Mubarak'&gt;Hosni Mubarak&lt;/a&gt;, has been in power for almost 30 years. He ran the country uncontestedly until 2005, when, after pressure from George W. Bush, Mubarak amended the constitution to allow candidates from parties other than the ruling National Democratic Party (NDP) to run in presidential elections. The first “free and fair” elections were held that year. Despite a somewhat large grassroots political opposition movement, &lt;a href='http://news.bbc.co.uk/2/hi/middle_east/4709011.stm'&gt;Kifaya&lt;/a&gt;, Mubarak won handily and his opponent, &lt;a href='http://en.wikipedia.org/wiki/Ayman_Nour'&gt;Ayman Nour&lt;/a&gt;, was arrested and sentenced to prison for five years. Today Kifaya, a native grassroots movement, is detoothed and powerless. Good thing civic engagement worked…&lt;/p&gt;

&lt;p&gt;The next Egyptian presidential elections are slated for 2011, but since Mubarak is getting on in years (he’s 81!), he’s probably not going to run. Instead, it seems that his son, Gamal Mubarak, will inherit his father’s place. Sure, he’ll go through the farce of the election process, but the NDP politicos and thugs will pretty much guarantee his victory.&lt;/p&gt;

&lt;p&gt;Understandably, there is a growing anti-Gamal movement in Egypt, and it’s even homegrown and grassrooty. It got a huge boost last week when &lt;a href='http://en.wikipedia.org/wiki/Mohamed_ElBaradei'&gt;Mohamed ElBaradei&lt;/a&gt;, former head of the IAEA and winner of a Nobel Prize, returned to Cairo after a decades-long pseudo-exile. He has announced that he would consider running for president in 2011 if circumstances allowed for it. He already has a large base of support and even an official-ish &lt;a href='http://www.elbaradei2011.com/'&gt;campaign website&lt;/a&gt;. &lt;a href='http://www.npr.org/templates/story/story.php?storyId=124087093&amp;amp;ft=1&amp;amp;f=1009'&gt;American media&lt;/a&gt; is picking up on him, too. He has a lot of international clout and could present a real threat to the Mubarak dynasty. He might have the potential of becoming the Egyptian Obama—“Yes we can!”&lt;/p&gt;

&lt;p&gt;But (and this is a pretty big but…), he can’t even legally run—he’s not constitutionally permitted to run for president. For him to become president, Mubarak would first have to amend the constitution to open the field for more opposition parities. Then ElBaradei would actually have to win in elections run by the NDP. Yeah. Good luck there.&lt;/p&gt;

&lt;p&gt;While the possibility of an ElBaradei run &lt;a href='http://baheyya.blogspot.com/2010/02/wildcard_25.html'&gt;has Mubarak somewhat scared&lt;/a&gt;, the cards are really stacked against him. This growing popular movement faces the impossible task of forcing a constitutional amendment. It’s a native movement, just like Queen Rania wants, but it is severely limited. Egyptians remain &lt;a href='http://egyptianchronicles.blogspot.com/2010/02/elbaradei-let-keep-him-hope.html'&gt;hopeful&lt;/a&gt;, but sadly, Gamal will most likely take over in 2011.&lt;/p&gt;

&lt;p&gt;While Jordan, as a monarchy, doesn’t face these issues of presidential elections, it has its own slew of problems with citizenship. Although Rania herself is a Palestinian, the Jordanian government &lt;a href='http://www.hrw.org/en/news/2010/02/01/jordan-stop-withdrawing-nationality-palestinian-origin-citizens'&gt;regularly withdraws Jordanian nationality and rights from Palestinian refugees&lt;/a&gt;. How can native, grassroots Jordanian organizations reform when the government makes them stateless?&lt;/p&gt;

&lt;p&gt;In her speech Rania exhorted AUCians: “Don’t wait for governments to change and reform. &lt;em&gt;You&lt;/em&gt; must be the change you want to see.” Um. She’s &lt;em&gt;in&lt;/em&gt; the Jordanian government. She’s the queen! She surely has some influence on the Jordanian political scene. Can’t she help the &lt;em&gt;government&lt;/em&gt; change so that these popular groups can actually do something? Arab governments tolerate, even embrace, NGOs like AYB or the queen’s water projects in Jordan—they love this type of civic engagement. But heaven forbid these civically engaged movements threaten their despotic power, though.&lt;/p&gt;

&lt;p&gt;Can real governmental and societal change happen in the Middle East solely through “civic engagement.” No way. Arab governments must make changes if any popular movements want to make substantial change.&lt;/p&gt;

&lt;p&gt;So, while Queen Rania’s speech &lt;em&gt;was&lt;/em&gt; inspiring and motivational on the surface, it was full of &lt;em&gt;kalaam fadi&lt;/em&gt;—empty words.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AndrewHeiss/~4/GrnxGDGS9bU" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://www.andrewheiss.com/blog/2010/02/28/queen-rania-at-auc/</feedburner:origLink></entry>
 
 <entry>
   <title>flashbakectl released</title>
   <link href="http://feeds.andrewheiss.com/~r/AndrewHeiss/~3/P_0SnrH2wZE/" />
   <updated>2009-09-23T00:00:00-06:00</updated>
   <id>http://www.andrewheiss.com/blog/2009/09/23/flashbakectl-released</id>
   <content type="html">&lt;p&gt;Adding to my apparent &lt;a href='http://www.andrewheiss.com/blog/2009/08/18/itunes-plugin-for-flashbake/' title='iTunes plugin for Flashbake  &amp;amp;#8211;   AndrewHeiss.com'&gt;series of Flashbake addons&lt;/a&gt;, I&amp;#8217;ve just released &lt;a href='http://github.com/andrewheiss/flashbakectl' title='andrewheiss&amp;apos;s flashbakectl at master - GitHub'&gt;&lt;code&gt;flashbakectl&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Normally to run &lt;a href='http://wiki.github.com/commandline/flashbake' title='Home - flashbake - GitHub'&gt;Flashbake&lt;/a&gt; consistently you need to set up a cron job. While OS X is built on Unix and has cron, Apple recommends using &lt;code&gt;launchd&lt;/code&gt; and property list (plist) files to run system agents and daemons. &lt;code&gt;flashbakectl&lt;/code&gt; is a handy little script that loads and unloads a plist for you.&lt;/p&gt;

&lt;p&gt;Before working on your project, run &lt;code&gt;flashbakectl -l&lt;/code&gt; to load the plist and start the daemon, which will commit your unsaved changes every 15 minutes (or whatever you set it to). When you&amp;#8217;re done for the day, run &lt;code&gt;flashbakectl -u&lt;/code&gt; to stop the daemon, saving your computer from unnecessarily running Flashbake &lt;em&gt;ad infinitum&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;flashbakectl&lt;/code&gt; only works on Mac OS X. &lt;a href='http://github.com/andrewheiss/flashbakectl' title='andrewheiss&amp;apos;s flashbakectl at master - GitHub'&gt;You can get it at GitHub&lt;/a&gt;. Enjoy!&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AndrewHeiss/~4/P_0SnrH2wZE" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://www.andrewheiss.com/blog/2009/09/23/flashbakectl-released/</feedburner:origLink></entry>
 
 <entry>
   <title>iTunes plugin for Flashbake</title>
   <link href="http://feeds.andrewheiss.com/~r/AndrewHeiss/~3/XANhDXneKuE/" />
   <updated>2009-08-18T00:00:00-06:00</updated>
   <id>http://www.andrewheiss.com/blog/2009/08/18/itunes-plugin-for-flashbake</id>
   <content type="html">&lt;p&gt;&lt;a href='http://wiki.github.com/commandline/flashbake' title='Home - flashbake - GitHub'&gt;Flashbake&lt;/a&gt; is a fantastic script &lt;a href='http://lifehacker.com/5232049/flashbake-automates-version-control-for-nerdy-writers' title='Flashbake Automates Version Control for (Nerdy) Writers - Downloads - Lifehacker'&gt;for nerdy writers&lt;/a&gt; (like me) that periodically commits changes to a Git repository and can optionally append various metadata to the commit message, allowing you to &lt;a href='http://www.boingboing.net/2009/02/13/flashbake-free-versi.html' title='Flashbake: Free version-control for writers using git - Boing Boing'&gt;annotate the entire creative process&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Flashbake includes several plugins for adding recent tweets, weather, the current time zone, and other random information. There&amp;#8217;s even a plugin for the Banshee music player for Linux. There&amp;#8217;s nothing for iTunes, however, which is unfortunate since I&amp;#8217;m always listening to something when I write or code.&lt;/p&gt;

&lt;p&gt;So I hacked together a little plugin for Flashbake that uses AppleScript to get the current track information from iTunes and add it to the commit message. It&amp;#8217;s admittedly a &amp;#8220;frankenscript&amp;#8221; and only works on Mac OS X (since it relies on AppleScript), but it works great.&lt;/p&gt;

&lt;p&gt;&lt;a href='http://github.com/andrewheiss/Flashbake-iTunes/' title='andrewheiss&amp;apos;s Flashbake-iTunes at master - GitHub'&gt;You can get it at GitHub&lt;/a&gt;. Enjoy!&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AndrewHeiss/~4/XANhDXneKuE" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://www.andrewheiss.com/blog/2009/08/18/itunes-plugin-for-flashbake/</feedburner:origLink></entry>
 
 <entry>
   <title>Using Google Voice and Gizmo Project Together</title>
   <link href="http://feeds.andrewheiss.com/~r/AndrewHeiss/~3/htElGO4tpak/" />
   <updated>2009-08-01T00:00:00-06:00</updated>
   <id>http://www.andrewheiss.com/blog/2009/08/01/using-google-voice-and-gizmo-project-together-internationally</id>
   <content type="html">&lt;p class='confirmation question'&gt;See update below &lt;a href='#update'&gt;(skip to update)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href='http://www.google.com/voice' title='Google Voice'&gt;Google Voice&lt;/a&gt;, the Google-ized incarnation of GrandCentral, is a fantastic service that aims to become your virtual phone switchboard. It gives you a free phone number that can receive regular phone calls and route them to any other actual phones you have connected to your account. Powerful stuff.&lt;/p&gt;

&lt;p&gt;Unfortunately, though, its forwarding abilities are limited to US phones. Using some &lt;abbr title='Voice over IP'&gt;VoIP&lt;/abbr&gt; magic, though, you can create a semblance of international forwarding and get free (or nearly free) phone calls to the US while abroad. If you&amp;#8217;re not in a foreign country, you can harness the same &lt;abbr title='Voice over IP'&gt;VoIP&lt;/abbr&gt; magic to get a nearly free phone service.&lt;!--more--&gt;&lt;/p&gt;

&lt;h3 id='the_gizmo_projectbackground'&gt;The Gizmo Project&amp;#8211;background&lt;/h3&gt;

&lt;p&gt;&lt;a href='http://gizmo5.com/pc/' title='Gizmo5 - Make free internet calls from your mobile phone and computer - Home'&gt;Gizmo&lt;/a&gt; is normally a &lt;a href='http://en.wikipedia.org/wiki/Voip' title='Voice over Internet Protocol - Wikipedia, the free encyclopedia'&gt;&lt;abbr title='Voice over IP'&gt;VoIP&lt;/abbr&gt;&lt;/a&gt; provider that lets you make free (or super cheap&amp;#8211;something like $0.019 a minute) phone calls. When you sign up for an account you get a special phone number in the 747 area code as your &lt;abbr title='Voice over IP'&gt;VoIP&lt;/abbr&gt;/Gizmo username. While any phone on the Gizmo network can call your 747 number for free, regular phones can&amp;#8217;t connect to it.&lt;/p&gt;

&lt;p&gt;Gizmo offers a Call In service that lets you buy a phone number in most US area codes (or one of dozens of countries), which then lets you receive phone calls from standard phones. Call In numbers start at $35 a year (or $12 a year for three months), but prices can be higher depending on demand.&lt;/p&gt;

&lt;p&gt;Gizmo touts itself primarily as software&amp;#8211;it provides a &amp;#8220;soft phone&amp;#8221; program that you run on your computer. As long as the program is open you can make and receive phone calls (much like an IM program or Skype) using a microphone and your computer&amp;#8217;s speakers or headphones.&lt;/p&gt;

&lt;h3 id='gizmo_without_a_computer'&gt;Gizmo without a computer&lt;/h3&gt;

&lt;p&gt;It&amp;#8217;s impractical to keep your computer on all the time and it can be awkward to use your computer as a phone. You can get around this limitation by buying an &lt;a href='http://en.wikipedia.org/wiki/Analog_telephony_adapter' title='Analog telephony adapter - Wikipedia, the free encyclopedia'&gt;&lt;abbr title='Analog telephony adapter'&gt;ATA&lt;/abbr&gt; adapter&lt;/a&gt;&amp;#8211;a little box that plugs into your network with the sole purpose of running phone services. It&amp;#8217;s essentially a hardware version of the Gizmo soft phone.&lt;/p&gt;

&lt;p&gt;Fancy corporate &lt;abbr title='Voice over IP'&gt;VoIP&lt;/abbr&gt; phones (&lt;a href='http://en.wikipedia.org/wiki/File:Cisco_7960_IP_Phone.JPG' title='File:Cisco 7960 IP Phone.JPG - Wikipedia, the free encyclopedia'&gt;like the ubiquitous Cisco ones&lt;/a&gt;) have &lt;abbr title='Analog telephony adapter'&gt;ATA&lt;/abbr&gt;s built in (kind of. The real ATA is somewhere on the network letting these computer-phones connect to it). You don&amp;#8217;t need a fancy &lt;abbr title='Voice over IP'&gt;VoIP&lt;/abbr&gt; phone, though. Standard consumer &lt;abbr title='Analog telephony adapter'&gt;ATA&lt;/abbr&gt;s let you plug regular phones directly into the adapter.&lt;/p&gt;

&lt;p&gt;After configuring the &lt;abbr title='Analog telephony adapter'&gt;ATA&lt;/abbr&gt; with your Gizmo information you can make and receive calls using your Call In number. Rather than pay $40+ a month for regular phone service, you can have a fully featured phone that only costs $35 a year plus &amp;#60;$0.02 a minute.&lt;/p&gt;

&lt;h3 id='before_google_voice'&gt;Before Google Voice&lt;/h3&gt;

&lt;p&gt;For the past three years we&amp;#8217;ve been using Gizmo as our full-time phone. We bought a &lt;a href='https://www.voipsupply.com/linksys-pap2t-na'&gt;Linksys/Sipura &lt;abbr title='Analog telephony adapter'&gt;ATA&lt;/abbr&gt;&lt;/a&gt; (our model, the SPA1000 is no longer manufactured), got a $10 phone from Target, and bought a Utah county 801 Call In number. The phone worked perfectly. I could plug the &lt;abbr title='Analog telephony adapter'&gt;ATA&lt;/abbr&gt; in to any internet connection and get cheap/free phone service.&lt;/p&gt;

&lt;p&gt;Our system even works (mostly) in Egypt. I have two phones on my desk: the $10 Target phone plugged into the &lt;abbr title='Analog telephony adapter'&gt;ATA&lt;/abbr&gt; (which is plugged into the router) and a 20 EGP neon pink phone (plugged into our Egyptian phone line). Family, friends, and unsuspecting telemarketers can reach us at our Utah number and pay only what it costs them to call an 801 number.&lt;/p&gt;

&lt;p&gt;&lt;img src='http://www.andrewheiss.com/images/2009/08/current_phone_set_up.jpg' alt='Current phone set up' /&gt;&lt;br /&gt;&lt;em&gt;Our current phone set up&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The only problem with the system our system in Egypt is a bizarre limitation with Egyptian (or at least Link.net&amp;#8217;s) internet infrastructure. We don&amp;#8217;t have any bandwidth issues when someone calls us, but when we call out, the connection drops within the first ten seconds of the call 90% of the time. To get around this, we used some SkypeOut credits&amp;#8211;we&amp;#8217;d call someone in the States with Skype (using my computer), tell them to call us on our Utah number, hang up, and wait for their call.&lt;/p&gt;

&lt;p&gt;This worked when we called actual people, but doesn&amp;#8217;t work when calling banks, insurance companies, airline companies, or anything else with a phone tree&amp;#8211;phone trees can&amp;#8217;t call you back. SkypeOut works for those, but it&amp;#8217;s more expensive than Gizmo.&lt;/p&gt;

&lt;p&gt;Google Voice changes all this.&lt;/p&gt;

&lt;h3 id='enter_gizmo_voice'&gt;Enter Gizmo Voice&lt;/h3&gt;

&lt;p&gt;Google and Gizmo have joined up to let you hook Google Voice directly into your Gizmo account. Rather than buy a Gizmo Call In number, I can use my free Google Voice number with my Gizmo Account. After &lt;a href='http://www.gizmovoice.com/' title='Introducing Gizmo Voice‎(GizmoVoice)‎'&gt;following Gizmo&amp;#8217;s instructions on connecting the two accounts&lt;/a&gt;, now when people call my Google Voice number, the call is routed to the normally inaccessible 747 Gizmo number, which is already associated with my &lt;abbr title='Analog telephony adapter'&gt;ATA&lt;/abbr&gt; box.&lt;/p&gt;

&lt;p&gt;This means I can stop paying $35 a year for my Call In number. The only thing I pay for is the phone use itself. Gizmo just changed their phone rates for users using Google Voice&amp;#8211;apparently all calls under three minutes are free, while longer phone calls follow their normal low rates.&lt;/p&gt;

&lt;p&gt;Additionally, now that I can have my Gizmo phone connected to my Google Voice account, my bizarre issue with calling out on Egyptian internet can be solved. In order to call people and have your Google Voice phone number appear on their caller IDs, you need to use Google Voice as an intermediary. You type in the number you want to call on their website and they&amp;#8217;ll call one of your linked phones. When you pick up, your phone will start dialing the outbound number. Since Google calls my Gizmo phone now to make outbound calls, Link.net considers it an inbound call and it doesn&amp;#8217;t get cut off.&lt;/p&gt;

&lt;p&gt;So now, Gizmo combined with Google Voice gives me free short calls and cheap long calls to the US and a free US number that can replace my Gizmo Call In number. Everything works both in the States and internationally. It&amp;#8217;s a nearly perfect system.&lt;/p&gt;

&lt;h3 id='_now_tested'&gt;&lt;del datetime='2009-08-03T18:54:39+00:00'&gt;Still untested&lt;/del&gt; Now tested&amp;#8230;&lt;/h3&gt;

&lt;p&gt;In theory, since I have my Gizmo and GV accounts linked, my Google Voice number should show up on the recipient&amp;#8217;s caller ID when I call out with my US phone, circumventing the need to use the Google Voice web site as the middleman. &lt;del datetime='2009-08-03T18:47:13+00:00'&gt;I can't test it, though, since my internet connection won't let me make any outbound calls with my ATA. I'll keep trying over the next week, since I can make like 10&amp;ndash;15 second calls 10% of the time.&lt;/del&gt;&lt;/p&gt;

&lt;p&gt;It works! My Google Voice number shows up, just like it should&amp;#8230;&lt;/p&gt;
&lt;h4 id='update'&gt;Update&lt;/h4&gt;
&lt;p&gt;&lt;a href='http://lifehacker.com/5400534/google-acquires-gizmo5-voip-service-voip-coming-to-google-voice'&gt;Google has acquired Gizmo5&lt;/a&gt;, which hopefully means that the link between Gizmo and GV will be more permanent and more official. Awesome.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AndrewHeiss/~4/htElGO4tpak" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://www.andrewheiss.com/blog/2009/08/01/using-google-voice-and-gizmo-project-together-internationally/</feedburner:origLink></entry>
 
 <entry>
   <title>Alexandria Train Crash</title>
   <link href="http://feeds.andrewheiss.com/~r/AndrewHeiss/~3/Wtg-xfDJmpI/" />
   <updated>2009-07-30T00:00:00-06:00</updated>
   <id>http://www.andrewheiss.com/blog/2009/07/30/alexandria-train-crash</id>
   <content type="html">&lt;p class='confirmation question'&gt;See update below &lt;a href='#update'&gt;(skip to update)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;After almost a year of being in Egypt, we finally decided to go up to Alexandria today. We took the 9:00 AM train from Cairo and the ride went smooth until we were just outside the final Mahatat Misr station, where we were delayed for over an hour until pulling up to a platform.&lt;/p&gt;

&lt;p&gt;Immediately after we got off the train we saw the reason for the delay. A train had rammed into the station, apparently at full speed, derailing the first three cars—the engine, the generator, and the first actual cabin. Part of the station itself was damaged, as was, ironically enough, a parked fire truck.&lt;/p&gt;
&lt;a href='http://www.andrewheiss.com/images/2009/07/general_train_wreck_chaos.jpg'&gt;&lt;img src='http://www.andrewheiss.com/images/2009/07/general_train_wreck_chaos.jpg' alt='General train wreck chaos' width='600px' /&gt;&lt;/a&gt;
&lt;p&gt;&lt;em&gt;Click to enlarge&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The train crashed at around 8 AM and was empty. By 12:30 (when we got there), Egyptian Railway repair crews were lifting the damaged cabin off the tracks.&lt;/p&gt;
&lt;a href='http://www.andrewheiss.com/images/2009/07/detail_of_fire_truck_train_station_damage.jpg'&gt;&lt;img src='http://www.andrewheiss.com/images/2009/07/detail_of_fire_truck_train_station_damage.jpg' alt='Detail of fire truck/train station damage' width='600px' /&gt;&lt;/a&gt;&lt;a href='http://www.andrewheiss.com/images/2009/07/silhouette_of_repairs.jpg'&gt;&lt;img src='http://www.andrewheiss.com/images/2009/07/silhouette_of_repairs.jpg' alt='Silhouette of repairs' width='600px' /&gt;&lt;/a&gt;
&lt;p&gt;By 6:00 PM, when we arrived back at the station to return to Cairo, the repairmen were working on lifting the engine and had apparently already extricated the generator car.&lt;/p&gt;
&lt;a href='http://www.andrewheiss.com/images/2009/07/detail_of_damaged_engine.jpg'&gt;&lt;img src='http://www.andrewheiss.com/images/2009/07/detail_of_damaged_engine.jpg' alt='Detail of damaged engine' width='600px' /&gt;&lt;/a&gt;
&lt;p&gt;Since two platforms were out of commission, trains were shuffled around all day, causing major delays. Our train ride back to Cairo took over four hours instead of the usual two.&lt;/p&gt;

&lt;p&gt;As far as I know, nobody was killed as the train was empty. I don&amp;#8217;t know about injuries, since I arrived on the scene several hours after the actual accident.&lt;/p&gt;

&lt;p&gt;Needless to say, it was exciting—in a macabre sort of way. I&amp;#8217;ve read so much about Egyptian train crashes—I got to see the aftermath of one. :)&lt;/p&gt;
&lt;p&gt;&lt;del datetime='2009-08-01T06:21:25+00:00'&gt;I'll post the full set of pictures tomorrow on Flickr.&lt;/del&gt;&lt;/p&gt;&lt;h4 id='update'&gt;Update&lt;/h4&gt;
&lt;p&gt;I posted our photos of the accident at &lt;a href='http://www.flickr.com/photos/andrewheiss/sets/72157621785548829/'&gt;Flickr&lt;/a&gt;. They are licensed under a &lt;a href='http://creativecommons.org/licenses/by/3.0/'&gt;Creative Commons Attribution license&lt;/a&gt;, so you can use them however you want.&lt;/p&gt;

&lt;p&gt;Nancy has also blogged about the accident at our &lt;a href='http://www.heissatopia.com/2009/07/alexandria-train-wreck-30-july-2009.html'&gt;family blog&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Additionally, the online Egyptian news site Youm7 has &lt;a href='http://www.youm7.com/News.asp?NewsID=123211'&gt;posted an update&lt;/a&gt; (in Arabic). According to their report, the accident was caused by a brake failure as the train travelled from the nearby Sidi Gaber train station. It was indeed empty, fortunately, and there were no fatalities. Two of the crew members were injured in addition to a vendor—since there are snack booths at the end of each platform, he must have gotten smashed. There are conflicting statements as to the cause of the accident. Some claim neglect and disrepair; others sabotage. I&amp;#8217;m leaning towards neglect—those trains are ancient.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AndrewHeiss/~4/Wtg-xfDJmpI" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://www.andrewheiss.com/blog/2009/07/30/alexandria-train-crash/</feedburner:origLink></entry>
 
 <entry>
   <title>Installing pdftk-php</title>
   <link href="http://feeds.andrewheiss.com/~r/AndrewHeiss/~3/24aq44NZFJo/" />
   <updated>2009-07-29T00:00:00-06:00</updated>
   <id>http://www.andrewheiss.com/blog/2009/07/29/installing-pdftk-php</id>
   <content type="html">&lt;p&gt;Upon popular request, I&amp;#8217;ve decided to update the original tutorial for populating a LiveCycle PDF with PHP to apply to the new release of pdftk-php. The installation instructions should be mostly clear in the readme and in the inline comments in the example included with the script; this post is merely supplemental.&lt;/p&gt;

&lt;h3 id='basic_usage'&gt;Basic usage&lt;/h3&gt;

&lt;h4 id='initial_set_up'&gt;Initial set up&lt;/h4&gt;

&lt;p&gt;&lt;a href='http://github.com/andrewheiss/pdftk-php/tree/master' title='andrewheiss&amp;apos;s pdftk-php at master - GitHub'&gt;Download the most recent version of pdftk-php from GitHub&lt;/a&gt; and &lt;a href='http://www.accesspdf.com/pdftk/' title='pdftk - the pdf toolkit'&gt;download and install pdftk&lt;/a&gt; on your server.&lt;/p&gt;

&lt;p&gt;Unzip the download from GitHub and place the folder on your server. I&amp;#8217;ve placed mine in a folder called &lt;code&gt;pdftk-php&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Create a MySQL user and database and run the SQL found in &lt;code&gt;/example/database.sql&lt;/code&gt; in a MySQL client (like phpMyAdmin) to create the sample database.&lt;/p&gt;

&lt;p class='full'&gt;&lt;img class='captify' src='http://www.andrewheiss.com/images/2009/07/example_query_in_phpmyadmin.png' alt='Example Query in phpMyAdmin' /&gt;&lt;/p&gt;

&lt;p&gt;Modify the information in &lt;code&gt;example/_dbConfig.php&lt;/code&gt; so that the application can connect to your database.&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='php'&gt;&lt;span class='nv'&gt;$host&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;localhost&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;;&lt;/span&gt; 
&lt;span class='nv'&gt;$username&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;pdftk-user&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;;&lt;/span&gt; 
&lt;span class='nv'&gt;$password&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;supersecure&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;;&lt;/span&gt; 
&lt;span class='nv'&gt;$db_name&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;pdftk-php&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Browse to the example site (in my case, &lt;a href='http://localhost/pdftk-php/example/index.php' title='pdftk-php'&gt;http://localhost/pdftk-php/example/index.php&lt;/a&gt;) and add some entries to populate the database a little.&lt;/p&gt;

&lt;h4 id='set_up_the_script'&gt;Set up the script&lt;/h4&gt;

&lt;p&gt;Open &lt;code&gt;pdftk-php.php&lt;/code&gt; and insert the full path to your working pdftk installation at the beginning part of the &lt;code&gt;passthru()&lt;/code&gt; command near line 71. Here are some examples for different scenarios on server platforms:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='php'&gt;&lt;span class='c1'&gt;// On a typical Unix-based installation&lt;/span&gt;
&lt;span class='nb'&gt;passthru&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;/usr/local/bin/pdftk ...&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;);&lt;/span&gt;

&lt;span class='c1'&gt;// On Windows, with an absolute path&lt;/span&gt;
&lt;span class='nb'&gt;passthru&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;c:\pdftk\pdftk.exe ...&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;);&lt;/span&gt;

&lt;span class='c1'&gt;// On Windows, with a relative path (useful if you place pdftk.exe in the server folder structure)&lt;/span&gt;
&lt;span class='nb'&gt;passthru&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;../pdftk.exe ...&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;If you&amp;#8217;re on a Unix-based server and don&amp;#8217;t know where pdftk is, type one of the following commands, which should result in the absolute path to the program:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='sh'&gt;which pdftk
&lt;span class='c'&gt;# or&lt;/span&gt;
whereis pdftk
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;In &lt;code&gt;example/download.php&lt;/code&gt; verify that the path to the required &lt;code&gt;pdftk-php.php&lt;/code&gt; is correct, near line 18. In the example, &lt;code&gt;pdftk-php.php&lt;/code&gt; is located a directory below the example directory. If you like to store your included files elsewhere, make sure that you modify the &lt;code&gt;require()&lt;/code&gt; path here.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;pdftk-php.php&lt;/code&gt; needs to be able to write to a temporary directory on your server in order to create a temporary FDF file. This directory is specified near line 58, with the &lt;code&gt;tempnam()&lt;/code&gt; function.&lt;/p&gt;

&lt;p&gt;If you are on a Windows server you should already be able to write to pretty much any directory (I think&amp;#8230; I&amp;#8217;ve never worked with IIS permissions), so you should be good to go. If you are on a Unix-based server you&amp;#8217;ll need to be more explicit with directory permissions. To make things easier, create a temporary folder on your server and give it write permissions:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='sh'&gt;&lt;span class='nb'&gt;cd &lt;/span&gt;pdftk-php
mkdir tmp
chmod 777 tmp
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Then set the path in &lt;code&gt;tempnam()&lt;/code&gt; to the new temporary folder.&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='php'&gt;&lt;span class='c1'&gt;// If at the same level as download.php&lt;/span&gt;
&lt;span class='nv'&gt;$fdf_fn&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='nb'&gt;tempnam&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;tmp&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;fdf&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;);&lt;/span&gt;

&lt;span class='c1'&gt;// If one directory behind download.php&lt;/span&gt;
&lt;span class='nv'&gt;$fdf_fn&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='nb'&gt;tempnam&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;../tmp&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;fdf&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;);&lt;/span&gt;

&lt;span class='c1'&gt;// You can also use an absolute path&lt;/span&gt;
&lt;span class='nv'&gt;$fdf_fn&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='nb'&gt;tempnam&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;/Library/WebServer/www/pdftk-php/tmp&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;fdf&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h4 id='set_up_the_pdf'&gt;Set up the PDF&lt;/h4&gt;

&lt;p&gt;Create a fillable form in either Acrobat Professional or LiveCycle Designer, or use the included example PDF form. Give each field a unique and significant name so that you can work with the form more easily later on. You can modify field attributes by double clicking on the field using the Forms toolbar in Acrobat; in LiveCycle, use the Object panel.&lt;/p&gt;

&lt;p class='full'&gt;&lt;img class='captify' src='http://www.andrewheiss.com/images/2009/07/acrobat_form_field_options.png' alt='Acrobat Form Field Options' /&gt;&lt;/p&gt;

&lt;p class='full'&gt;&lt;img class='captify' src='http://www.andrewheiss.com/images/2009/07/livecycle_form_field_options.png' alt='LiveCycle Form Field Options' /&gt;&lt;/p&gt;

&lt;p&gt;If you are using LiveCycle, you&amp;#8217;ll need to save the final PDF as a &lt;strong&gt;static&lt;/strong&gt; form compatible with Acrobat 7. pdftk doesn&amp;#8217;t work with dynamic forms or PDFs from later versions of Acrobat.&lt;/p&gt;

&lt;p class='full'&gt;&lt;img class='captify' src='http://www.andrewheiss.com/images/2009/07/livecycle_save_options.png' alt='LiveCycle Save Options' /&gt;&lt;/p&gt;

&lt;h4 id='connect_pdf_to_script'&gt;Connect PDF to script&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;example/download.php&lt;/code&gt; connects to your database, retrieves a row based on a passed GET variable, saves the data from the fetched row into variables, finally calling &lt;code&gt;pdftk-php.php&lt;/code&gt;, which does the heavy lifting of creating an FDF file and injecting it into the PDF.&lt;/p&gt;

&lt;p&gt;Starting at around line 30 the script assigns the fetched values to variables. Each of those retrieved variables needs to be paired with a form field in your PDF (near line 39). In a basic Acrobat form this is simple:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='php'&gt;&lt;span class='nv'&gt;$fdf_data_strings&lt;/span&gt;&lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='k'&gt;array&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s1'&gt;&amp;#39;firstname&amp;#39;&lt;/span&gt; &lt;span class='o'&gt;=&amp;gt;&lt;/span&gt; &lt;span class='nv'&gt;$pdf_firstname&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt;  &lt;span class='s1'&gt;&amp;#39;lastname&amp;#39;&lt;/span&gt; &lt;span class='o'&gt;=&amp;gt;&lt;/span&gt; &lt;span class='nv'&gt;$pdf_lastname&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='s1'&gt;&amp;#39;email&amp;#39;&lt;/span&gt; &lt;span class='o'&gt;=&amp;gt;&lt;/span&gt; &lt;span class='nv'&gt;$pdf_email&lt;/span&gt;&lt;span class='p'&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;LiveCycle tends to complicate the form names slightly. You can use pdftk from the command line to retrieve the official form field names. Run this command from the directory containing your PDF file:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='sh'&gt;pdftk form.pdf dump_data_fields &amp;gt; form-fields.txt
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;When you open the resultant &lt;code&gt;.txt&lt;/code&gt; file you should see a report of all the fields&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='text'&gt;...
---
FieldType: Text
FieldName: form1[0].#subform[0].firstname[0]
FieldNameAlt: First name&amp;amp;#9;
FieldFlags: 0
FieldJustification: Left
---
...
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Use those long, hairy &lt;code&gt;FieldName&lt;/code&gt;s in the &lt;code&gt;$fdf_data_strings&lt;/code&gt; array, like so:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='php'&gt;&lt;span class='nv'&gt;$fdf_data_strings&lt;/span&gt;&lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='k'&gt;array&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s1'&gt;&amp;#39;form1[0].#subform[0].#area[0].FirstName[0]&amp;#39;&lt;/span&gt; &lt;span class='o'&gt;=&amp;gt;&lt;/span&gt; &lt;span class='nv'&gt;$pdf_firstname&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='s1'&gt;&amp;#39;form1[0].#subform[0].#area[0].LastName[0]&amp;#39;&lt;/span&gt; &lt;span class='o'&gt;=&amp;gt;&lt;/span&gt; &lt;span class='nv'&gt;$pdf_lastname&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='s1'&gt;&amp;#39;form1[0].#subform[0].#area[0].EMail[0]&amp;#39;&lt;/span&gt; &lt;span class='o'&gt;=&amp;gt;&lt;/span&gt; &lt;span class='nv'&gt;$pdf_email&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='p'&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Finally, check the values of &lt;code&gt;$pdf_filename&lt;/code&gt; and &lt;code&gt;$pdf_original&lt;/code&gt; near lines 62 and 65.&lt;/p&gt;

&lt;p&gt;Go to &lt;a href='http://localhost/pdftk-php/example/view.php' title='pdftk-php - List of submitted forms'&gt;http://localhost/pdftk-php/example/view.php&lt;/a&gt; and click on the download links for one of entries. You should be prompted to download a PDF file, dynamically generated using &lt;code&gt;pdftk-php.php&lt;/code&gt;. Success!&lt;/p&gt;

&lt;h3 id='advanced_customization'&gt;Advanced customization&lt;/h3&gt;

&lt;h4 id='using_checkboxes_or_radio_buttons'&gt;Using checkboxes or radio buttons&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;$fdf_data_strings&lt;/code&gt; works great for text fields, but can&amp;#8217;t handle radio buttons or check boxes. For that you&amp;#8217;ll need to use the &lt;code&gt;$fdf_data_names&lt;/code&gt; array near line 49.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;NB: The logic for manipulating the form data in PHP and MySQL might be a little convoluted and could easily be optimized, but it works for clear demonstration purposes.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;To demonstrate this how to do this, we&amp;#8217;ll add a checkbox to our form and extend the database. Run this query in a MySQL client to add a couple columns to our table:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='sql'&gt;&lt;span class='k'&gt;ALTER&lt;/span&gt; &lt;span class='k'&gt;TABLE&lt;/span&gt; &lt;span class='o'&gt;`&lt;/span&gt;&lt;span class='n'&gt;users&lt;/span&gt;&lt;span class='o'&gt;`&lt;/span&gt; &lt;span class='k'&gt;ADD&lt;/span&gt; &lt;span class='o'&gt;`&lt;/span&gt;&lt;span class='n'&gt;option1&lt;/span&gt;&lt;span class='o'&gt;`&lt;/span&gt; &lt;span class='n'&gt;TINYINT&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt; &lt;span class='mi'&gt;1&lt;/span&gt; &lt;span class='p'&gt;)&lt;/span&gt; &lt;span class='k'&gt;NOT&lt;/span&gt; &lt;span class='k'&gt;NULL&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='k'&gt;ADD&lt;/span&gt; &lt;span class='o'&gt;`&lt;/span&gt;&lt;span class='n'&gt;option2&lt;/span&gt;&lt;span class='o'&gt;`&lt;/span&gt; &lt;span class='n'&gt;TINYINT&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt; &lt;span class='mi'&gt;1&lt;/span&gt; &lt;span class='p'&gt;)&lt;/span&gt; &lt;span class='k'&gt;NOT&lt;/span&gt; &lt;span class='k'&gt;NULL&lt;/span&gt; &lt;span class='p'&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Open &lt;code&gt;/example/example.pdf&lt;/code&gt; in Acrobat Professional and add two checkbox fields named &lt;code&gt;option1&lt;/code&gt; and &lt;code&gt;option2&lt;/code&gt;.&lt;/p&gt;

&lt;p class='full'&gt;&lt;img class='captify' src='http://www.andrewheiss.com/images/2009/07/ridiculously_huge_checkboxes_better.png' alt='Huge Checkboxes' /&gt;&lt;/p&gt;

&lt;p&gt;We need to modify our web form and the table that displays the data, just to make sure everything is getting saved to the database correctly.&lt;/p&gt;

&lt;p&gt;First, make a couple changes to &lt;code&gt;example/index.php&lt;/code&gt; After the section near lines 104&amp;#8211;107, add&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='html'&gt;&lt;span class='nt'&gt;&amp;lt;p&amp;gt;&lt;/span&gt;
	&lt;span class='nt'&gt;&amp;lt;label&lt;/span&gt; &lt;span class='na'&gt;for=&lt;/span&gt;&lt;span class='s'&gt;&amp;quot;option1&amp;quot;&lt;/span&gt;&lt;span class='nt'&gt;&amp;gt;&lt;/span&gt;Option 1&lt;span class='nt'&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
	&lt;span class='nt'&gt;&amp;lt;input&lt;/span&gt; &lt;span class='na'&gt;type=&lt;/span&gt;&lt;span class='s'&gt;&amp;quot;checkbox&amp;quot;&lt;/span&gt; &lt;span class='na'&gt;name=&lt;/span&gt;&lt;span class='s'&gt;&amp;quot;option1&amp;quot;&lt;/span&gt; &lt;span class='na'&gt;value=&lt;/span&gt;&lt;span class='s'&gt;&amp;quot;1&amp;quot;&lt;/span&gt; &lt;span class='na'&gt;id=&lt;/span&gt;&lt;span class='s'&gt;&amp;quot;option1&amp;quot;&lt;/span&gt; &lt;span class='nt'&gt;/&amp;gt;&lt;/span&gt;
&lt;span class='nt'&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;span class='nt'&gt;&amp;lt;p&amp;gt;&lt;/span&gt;
	&lt;span class='nt'&gt;&amp;lt;label&lt;/span&gt; &lt;span class='na'&gt;for=&lt;/span&gt;&lt;span class='s'&gt;&amp;quot;option2&amp;quot;&lt;/span&gt;&lt;span class='nt'&gt;&amp;gt;&lt;/span&gt;Option 2&lt;span class='nt'&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
	&lt;span class='nt'&gt;&amp;lt;input&lt;/span&gt; &lt;span class='na'&gt;type=&lt;/span&gt;&lt;span class='s'&gt;&amp;quot;checkbox&amp;quot;&lt;/span&gt; &lt;span class='na'&gt;name=&lt;/span&gt;&lt;span class='s'&gt;&amp;quot;option2&amp;quot;&lt;/span&gt; &lt;span class='na'&gt;value=&lt;/span&gt;&lt;span class='s'&gt;&amp;quot;1&amp;quot;&lt;/span&gt; &lt;span class='na'&gt;id=&lt;/span&gt;&lt;span class='s'&gt;&amp;quot;option2&amp;quot;&lt;/span&gt; &lt;span class='nt'&gt;/&amp;gt;&lt;/span&gt;
&lt;span class='nt'&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Then, up near the top of &lt;code&gt;example/index.php&lt;/code&gt; after line 34, add this:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='php'&gt;&lt;span class='k'&gt;if&lt;/span&gt; &lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nv'&gt;$_POST&lt;/span&gt;&lt;span class='p'&gt;[&lt;/span&gt;&lt;span class='s1'&gt;&amp;#39;option1&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;]&lt;/span&gt; &lt;span class='o'&gt;==&lt;/span&gt; &lt;span class='mi'&gt;1&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt; &lt;span class='p'&gt;{&lt;/span&gt;
	&lt;span class='nv'&gt;$option1&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='mi'&gt;1&lt;/span&gt;&lt;span class='p'&gt;;&lt;/span&gt;
&lt;span class='p'&gt;}&lt;/span&gt; &lt;span class='k'&gt;else&lt;/span&gt; &lt;span class='p'&gt;{&lt;/span&gt;
	&lt;span class='nv'&gt;$option1&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='mi'&gt;0&lt;/span&gt;&lt;span class='p'&gt;;&lt;/span&gt;
&lt;span class='p'&gt;}&lt;/span&gt;

&lt;span class='k'&gt;if&lt;/span&gt; &lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nv'&gt;$_POST&lt;/span&gt;&lt;span class='p'&gt;[&lt;/span&gt;&lt;span class='s1'&gt;&amp;#39;option2&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;]&lt;/span&gt; &lt;span class='o'&gt;==&lt;/span&gt; &lt;span class='mi'&gt;1&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt; &lt;span class='p'&gt;{&lt;/span&gt;
	&lt;span class='nv'&gt;$option2&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='mi'&gt;1&lt;/span&gt;&lt;span class='p'&gt;;&lt;/span&gt;
&lt;span class='p'&gt;}&lt;/span&gt; &lt;span class='k'&gt;else&lt;/span&gt; &lt;span class='p'&gt;{&lt;/span&gt;
	&lt;span class='nv'&gt;$option2&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='mi'&gt;0&lt;/span&gt;&lt;span class='p'&gt;;&lt;/span&gt;
&lt;span class='p'&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;This checks the value of the submitted checkboxes and sets the &lt;code&gt;$optionx&lt;/code&gt; variables to either 1 or 0, which fit into the &lt;code&gt;TINYINT&lt;/code&gt; columns in our table. You could use actual text as well and set the columns to &lt;code&gt;VARCHAR&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Change the SQL query from&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='php'&gt;&lt;span class='nv'&gt;$sql&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;INSERT INTO users (firstname, lastname, email) VALUES (&amp;#39;&lt;/span&gt;&lt;span class='si'&gt;$firstname&lt;/span&gt;&lt;span class='s2'&gt;&amp;#39;, &amp;#39;&lt;/span&gt;&lt;span class='si'&gt;$lastname&lt;/span&gt;&lt;span class='s2'&gt;&amp;#39;, &amp;#39;&lt;/span&gt;&lt;span class='si'&gt;$email&lt;/span&gt;&lt;span class='s2'&gt;&amp;#39;)&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;to&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='php'&gt;&lt;span class='nv'&gt;$sql&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;INSERT INTO users (firstname, lastname, email, option1, option2) VALUES (&amp;#39;&lt;/span&gt;&lt;span class='si'&gt;$firstname&lt;/span&gt;&lt;span class='s2'&gt;&amp;#39;, &amp;#39;&lt;/span&gt;&lt;span class='si'&gt;$lastname&lt;/span&gt;&lt;span class='s2'&gt;&amp;#39;, &amp;#39;&lt;/span&gt;&lt;span class='si'&gt;$email&lt;/span&gt;&lt;span class='s2'&gt;&amp;#39;, &amp;#39;&lt;/span&gt;&lt;span class='si'&gt;$option1&lt;/span&gt;&lt;span class='s2'&gt;&amp;#39;, &amp;#39;&lt;/span&gt;&lt;span class='si'&gt;$option2&lt;/span&gt;&lt;span class='s2'&gt;&amp;#39;)&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Go ahead and insert some dummy submissions with boxes checked and unchecked to make sure everything is working.&lt;/p&gt;

&lt;p&gt;Optionally we need to modify &lt;code&gt;example/view.php&lt;/code&gt; to show the stored values. Add the following table header cells after line 29:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='html'&gt;&lt;span class='c'&gt;&amp;lt;!-- Already here --&amp;gt;&lt;/span&gt;&lt;span class='nt'&gt;&amp;lt;th&amp;gt;&lt;/span&gt;E-mail Address&lt;span class='nt'&gt;&amp;lt;/th&amp;gt;&lt;/span&gt;
   &lt;span class='nt'&gt;&amp;lt;th&amp;gt;&lt;/span&gt;Option 1&lt;span class='nt'&gt;&amp;lt;/th&amp;gt;&lt;/span&gt;
   &lt;span class='nt'&gt;&amp;lt;th&amp;gt;&lt;/span&gt;Option 2&lt;span class='nt'&gt;&amp;lt;/th&amp;gt;&lt;/span&gt;
&lt;span class='c'&gt;&amp;lt;!-- Already here --&amp;gt;&lt;/span&gt;&lt;span class='nt'&gt;&amp;lt;th&amp;gt;&lt;/span&gt;Download PDF&lt;span class='nt'&gt;&amp;lt;/th&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;In the &lt;code&gt;while&lt;/code&gt; loop a few lines later, add this code:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='php'&gt;&lt;span class='o'&gt;&amp;lt;!--&lt;/span&gt; &lt;span class='nx'&gt;Already&lt;/span&gt; &lt;span class='nx'&gt;here&lt;/span&gt; &lt;span class='o'&gt;--&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class='nx'&gt;td&lt;/span&gt;&lt;span class='o'&gt;&amp;gt;&amp;lt;?&lt;/span&gt;&lt;span class='nx'&gt;php&lt;/span&gt; &lt;span class='k'&gt;echo&lt;/span&gt; &lt;span class='nv'&gt;$user&lt;/span&gt;&lt;span class='p'&gt;[&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;lastname&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;];&lt;/span&gt; &lt;span class='cp'&gt;?&amp;gt;&lt;/span&gt;&lt;span class='x'&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
&lt;span class='x'&gt;&amp;lt;td&amp;gt;&lt;/span&gt;&lt;span class='cp'&gt;&amp;lt;?php&lt;/span&gt; &lt;span class='k'&gt;echo&lt;/span&gt; &lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nv'&gt;$user&lt;/span&gt;&lt;span class='p'&gt;[&lt;/span&gt;&lt;span class='s1'&gt;&amp;#39;option1&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;]&lt;/span&gt; &lt;span class='o'&gt;==&lt;/span&gt; &lt;span class='mi'&gt;1&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt; &lt;span class='o'&gt;?&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;Yes&amp;quot;&lt;/span&gt; &lt;span class='o'&gt;:&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;No&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;;&lt;/span&gt; &lt;span class='cp'&gt;?&amp;gt;&lt;/span&gt;&lt;span class='x'&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
&lt;span class='x'&gt;&amp;lt;td&amp;gt;&lt;/span&gt;&lt;span class='cp'&gt;&amp;lt;?php&lt;/span&gt; &lt;span class='k'&gt;echo&lt;/span&gt; &lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nv'&gt;$user&lt;/span&gt;&lt;span class='p'&gt;[&lt;/span&gt;&lt;span class='s1'&gt;&amp;#39;option2&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;]&lt;/span&gt; &lt;span class='o'&gt;==&lt;/span&gt; &lt;span class='mi'&gt;1&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt; &lt;span class='o'&gt;?&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;Yes&amp;quot;&lt;/span&gt; &lt;span class='o'&gt;:&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;No&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;;&lt;/span&gt; &lt;span class='cp'&gt;?&amp;gt;&lt;/span&gt;&lt;span class='x'&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
&lt;span class='x'&gt;&amp;lt;!-- Already here --&amp;gt;&amp;lt;td&amp;gt;&lt;/span&gt;&lt;span class='cp'&gt;&amp;lt;?php&lt;/span&gt; &lt;span class='k'&gt;echo&lt;/span&gt; &lt;span class='nv'&gt;$user&lt;/span&gt;&lt;span class='p'&gt;[&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;email&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;];&lt;/span&gt; &lt;span class='cp'&gt;?&amp;gt;&lt;/span&gt;&lt;span class='x'&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;This is just PHP ternary notation, which essentially says that if the value of &lt;code&gt;optionx&lt;/code&gt; is equal to one, echo &amp;#8220;Yes,&amp;#8221; otherwise, echo &amp;#8220;No&amp;#8221;.&lt;/p&gt;

&lt;p&gt;Finally we need to modify &lt;code&gt;example/download.php&lt;/code&gt; to handle our checkboxes. Like I said above, the &lt;code&gt;$fdf_data_names&lt;/code&gt; variable handles checkbox and radio button data. In PDF forms, the two allowed values for checkboxes are &amp;#8220;Yes&amp;#8221; and &amp;#8220;Off&amp;#8221; (not really opposites, but oh well), so you&amp;#8217;ll need to set variables accordingly. Replace &lt;code&gt;$fdf_data_names = array();&lt;/code&gt; near line 49, with this, which checks the values of &lt;code&gt;optionx&lt;/code&gt; and sets &lt;code&gt;$pdf_optionx&lt;/code&gt; to either &amp;#8220;Yes&amp;#8221; or &amp;#8220;Off&amp;#8221; and then defines the &lt;code&gt;$fdf_data_names&lt;/code&gt; array appropriately:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='php'&gt;&lt;span class='k'&gt;if&lt;/span&gt; &lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nv'&gt;$data&lt;/span&gt;&lt;span class='p'&gt;[&lt;/span&gt;&lt;span class='s1'&gt;&amp;#39;option1&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;]&lt;/span&gt; &lt;span class='o'&gt;==&lt;/span&gt; &lt;span class='mi'&gt;1&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt; &lt;span class='p'&gt;{&lt;/span&gt;
	&lt;span class='nv'&gt;$pdf_option1&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;Yes&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;;&lt;/span&gt;
&lt;span class='p'&gt;}&lt;/span&gt; &lt;span class='k'&gt;else&lt;/span&gt; &lt;span class='p'&gt;{&lt;/span&gt;
	&lt;span class='nv'&gt;$pdf_option1&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;Off&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;;&lt;/span&gt;
&lt;span class='p'&gt;}&lt;/span&gt;

&lt;span class='k'&gt;if&lt;/span&gt; &lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nv'&gt;$data&lt;/span&gt;&lt;span class='p'&gt;[&lt;/span&gt;&lt;span class='s1'&gt;&amp;#39;option2&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;]&lt;/span&gt; &lt;span class='o'&gt;==&lt;/span&gt; &lt;span class='mi'&gt;1&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt; &lt;span class='p'&gt;{&lt;/span&gt;
	&lt;span class='nv'&gt;$pdf_option2&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;Yes&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;;&lt;/span&gt;
&lt;span class='p'&gt;}&lt;/span&gt; &lt;span class='k'&gt;else&lt;/span&gt; &lt;span class='p'&gt;{&lt;/span&gt;
	&lt;span class='nv'&gt;$pdf_option2&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;Off&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;;&lt;/span&gt;
&lt;span class='p'&gt;}&lt;/span&gt;

&lt;span class='nv'&gt;$fdf_data_names&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='k'&gt;array&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s1'&gt;&amp;#39;option1&amp;#39;&lt;/span&gt; &lt;span class='o'&gt;=&amp;gt;&lt;/span&gt; &lt;span class='nv'&gt;$pdf_option1&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='s1'&gt;&amp;#39;option2&amp;#39;&lt;/span&gt; &lt;span class='o'&gt;=&amp;gt;&lt;/span&gt; &lt;span class='nv'&gt;$pdf_option2&lt;/span&gt;&lt;span class='p'&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;And that should do it! Visit &lt;a href='http://localhost/pdftk-php/example/view.php' title='pdftk-php - List of submitted forms'&gt;http://localhost/pdftk-php/example/view.php&lt;/a&gt; and download one of the forms. The checkboxes should populate perfectly.&lt;/p&gt;

&lt;h4 id='other_types_of_form_fields'&gt;Other types of form fields&lt;/h4&gt;

&lt;p&gt;Combo boxes and radio buttons act similarly to checkboxes. If you run the &lt;code&gt;dump_data_fields&lt;/code&gt; command with pdftk again on a form with these more advanced options, you&amp;#8217;ll see a few differences in the results.&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='text'&gt;FieldType: Text
FieldName: email
FieldFlags: 0
FieldJustification: Left
---
FieldType: Button
FieldName: option1
FieldFlags: 0
FieldValue: Yes
FieldJustification: Left
FieldStateOption: Off
FieldStateOption: Yes
---
FieldType: Choice
FieldName: favoriteColor
FieldFlags: 131072
FieldValue: blue
FieldValueDefault: red
FieldJustification: Left
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;You can see the &amp;#8220;Yes&amp;#8221; vs. &amp;#8220;Off&amp;#8221; values in our checkbox (called &amp;#8220;Button&amp;#8221; in PDF lingo). Drop down lists (&amp;#8220;Choice&amp;#8221; in PDF-speak) have multiple values, specified by you when you create the field.&lt;/p&gt;

&lt;p class='full'&gt;&lt;img class='captify' src='http://www.andrewheiss.com/images/2009/07/combo_box_properties.png' alt='Combo box properties' /&gt;&lt;/p&gt;

&lt;p&gt;Radio buttons are hybrids. They are considered &amp;#8220;Buttons,&amp;#8221; like checkboxes, but can have custom values, like drop down lists.&lt;/p&gt;

&lt;p&gt;Your final PHP script will need to take these different values into account and assign the correct values in the &lt;code&gt;$fdf_data_names&lt;/code&gt; array.&lt;/p&gt;

&lt;h3 id='conclusion'&gt;Conclusion&lt;/h3&gt;

&lt;p&gt;You can do a ton with the &lt;code&gt;pdftk-php.php&lt;/code&gt; class once you get it set up initially and get past the slight learning curve. If you have any questions, feel free to ask in the comments. If you find any problems, comment here or &lt;a href='http://github.com/andrewheiss/pdftk-php/issues' title='Issues - andrewheiss/pdftk-php - GitHub'&gt;open an issue at the GitHub project page&lt;/a&gt;. Additionally, you can &lt;a href='http://github.com/andrewheiss/pdftk-php/tree/master' title='andrewheiss&amp;apos;s pdftk-php at master - GitHub'&gt;fork the project&lt;/a&gt; and contribute.&lt;/p&gt;

&lt;p&gt;Good luck!&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AndrewHeiss/~4/24aq44NZFJo" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://www.andrewheiss.com/blog/2009/07/29/installing-pdftk-php/</feedburner:origLink></entry>
 
 <entry>
   <title>On narrowing and redefining research</title>
   <link href="http://feeds.andrewheiss.com/~r/AndrewHeiss/~3/35WwH_K5weY/" />
   <updated>2009-07-28T00:00:00-06:00</updated>
   <id>http://www.andrewheiss.com/blog/2009/07/28/on-narrowing-and-redefining-research</id>
   <content type="html">&lt;p&gt;I&amp;#8217;ve been in Egypt for almost a year now, studiously working towards my MA in Middle East Studies. The supposed capstone of my time here at AUC—my thesis—now looms ahead somewhat menacingly. I get to spend the next several months researching and writing what will end up being my largest research project to date. It&amp;#8217;ll also set the foundation for my (hopefully) future PhD plans.&lt;/p&gt;

&lt;p&gt;There&amp;#8217;s only one problem: I don&amp;#8217;t quite know what I&amp;#8217;m writing it on.&lt;/p&gt;

&lt;p&gt;At BYU I double majored in Middle East Studies/Arabic (MESA) and Italian—an odd mix of modern history, political science, and renaissance poetry. Most of my research focused on finding literary and historic connections between the Middle East and Italy. I looked at the role of Sufism in the birth of Catholic mysticism, especially with Jacopone da Todi and St. Francis of Assisi. I looked at the Young Ottomans and their reliance on Mazzini&amp;#8217;s &lt;em&gt;Giovine Italia&lt;/em&gt; ideology. I even &lt;a href='http://www.heissatopia.com/2007/03/symposium-humanitatum-2007.html' title='Heissatopia: Symposium Humanitatum 2007'&gt;presented a paper&lt;/a&gt; at a conference about the role of Mohammed in &lt;em&gt;Inferno XXVIII&lt;/em&gt; in Dante&amp;#8217;s &lt;em&gt;Divine Comedy,&lt;/em&gt; connecting it to proto-orientalism.&lt;/p&gt;

&lt;p&gt;Fun times :)&lt;/p&gt;

&lt;p&gt;At the same time, though, there was an inherent conflict in my research interests. I wrote my MESA capstone paper on the media coverage of the 2006 Israel/Lebanon war, where no Italian literature was involved :). I love media—I&amp;#8217;m obsessed with the news, the internet, blogs, Twitter; anything shiny, new, and exciting.&lt;/p&gt;

&lt;p&gt;I started my MA with the assumption that I&amp;#8217;d have to choose one of these tracks—history or media. I dove headlong into the history track, writing a huge literature review on the history of the Italians in Egypt at the beginning of the 20th century. Large Italian communities in Cairo, Alexandria, and Ismailiyya sprang up after Napoleon&amp;#8217;s 1798 invasion. Thousands of Italians were born and raised abroad in these cities, and many took part in the Egyptian nationalist movement, considering themselves more Egyptian than Italian, thus earning themselves the nickname &lt;em&gt;mutamasirun&lt;/em&gt; (those who try to be Egyptian).&lt;/p&gt;

&lt;p&gt;I was excited about this research until a new shiny thing took my attention away—Twitter. I started using Twitter more or less full time in January, which then introduced me to the large Egyptian Twitter community. Many of the Egyptian twitterers are also activist bloggers who have been arrested multiple times. I began to see the power and potential of the internet in political reform and change in the Middle East and switched research gears to focus on the Middle Eastern blogosphere. It was fascinating stuff, but I felt like I had turned my back on history :) Further complicating things, I had an amazing history seminar last semester that resulted in some awesomely fun archival research. I had a blast writing the paper. The primeval dichotomy of history vs. media reared its ugly head again.&lt;/p&gt;

&lt;p&gt;Since I&amp;#8217;m nearing the end of my MA, I&amp;#8217;m looking at different PhD programs to go to once I&amp;#8217;m done here. There are lots that look at bloggers and politics—even ones that look at bloggers and politics and the Middle East—but none do it with a historical approach (fancy that&amp;#8230; blogs have been around for something like four years and it&amp;#8217;s not history yet :) ). I sent out dozens of e-mails to different professors asking about graduate programs and my potential research. Most responses were confused; &lt;code&gt;history != new media&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;However, one professor at Cornell responded positively. He studies media in modern Egyptian history, specifically in the time period of my Italian &lt;em&gt;mutamasirun&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;I think I may have found a way to bridge the history/media studies gap. Now I just need to figure out exactly how to do it.&lt;/p&gt;

&lt;p&gt;Awesome. :)&lt;/p&gt;

&lt;p&gt;So, sorry bloggers—I&amp;#8217;ll keep following you as a tangential fascination, but my heart lies in history.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AndrewHeiss/~4/35WwH_K5weY" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://www.andrewheiss.com/blog/2009/07/28/on-narrowing-and-redefining-research/</feedburner:origLink></entry>
 
 <entry>
   <title>Import a Blogger Blog to InDesign with Perl</title>
   <link href="http://feeds.andrewheiss.com/~r/AndrewHeiss/~3/pYffIc9HmLo/" />
   <updated>2009-07-19T00:00:00-06:00</updated>
   <id>http://www.andrewheiss.com/blog/2009/07/19/converting-a-blogger-blog-to-indesign-tagged-text</id>
   <content type="html">&lt;p&gt;Our family has a fairly sizable &lt;a href='http://www.heissatopia.com' title='Heissatopia'&gt;blog&lt;/a&gt; that we (actually, mostly my wife, Nancy) have kept updated for several years. Since it contains so much family history we wanted an easy way to preserve it in print form, just in case Blogger gets the boot from Google some day (not that that will ever really happen…).&lt;/p&gt;

&lt;p&gt;Since we&amp;#8217;re both hobbyist graphic designers—I taught a couple print layout and design classes as an undergrad at BYU and have made several books at &lt;a href='http://www.lulu.com' title='Lulu.com'&gt;Lulu.com&lt;/a&gt;—we decided to layout and print each year of our blog, to keep for posterity.&lt;/p&gt;

&lt;p&gt;A couple years ago Nancy attempted this with our smaller &lt;a href='http://andrewheiss.blogspot.com' title='Adventures in Jordan'&gt;Jordan blog&lt;/a&gt; for a print publishing class she took at BYU. We spent the bulk of our time manually copying and pasting each post and the subsequent comments into a huge Word document. She then ran a long series of find/replaces to clean up the messy, inconsistent typography, and then finally placed it into Quark (that evil program). Through a series of unfortunate events, Quark crashed repeatedly and corrupted her file multiple times—she was lucky to get her first draft turned in for her final project (she got an A, though. Phew!).&lt;/p&gt;

&lt;p&gt;I knew there had to be a faster, more efficient way to wrangle all the blog text, but this was back in 2006, before Blogger had an open API or options to backup a blog. Primitive, dark days indeed :).&lt;/p&gt;

&lt;p&gt;However, last year, Blogger introduced a fantastic new option—the ability to backup and export your entire blog, comments and all. Blogger spits out an Atom-formatted XML file that you can use to recreate your blog later on (or possibly import onto other platforms, like WordPress, I think). This was the key to simplifying the daunting task of collecting the text for our blog books. All we needed was a way to mangle the text in the XML file to create an InDesign-ready file.&lt;/p&gt;

&lt;p&gt;So, I whipped up a semi-complicated Perl script that can parse an Atom-formatted XML file from Blogger and create a text file using InDesign Tagged Text to preapply paragraph and character styles. It also cleans up the typographic elements of the text, adding em and en dashes, removing empty paragraphs, etc. Additionally, it can add hidden index entries for each tag, essentially creating a barebones index for your book. And it only takes 10ish seconds to run on a large blog. It&amp;#8217;s not perfect and could stand some good optimization, but it works.&lt;/p&gt;

&lt;p&gt;Additionally, since InDesign tagged text works with, well, text, it won&amp;#8217;t place your images for you. Instead it will insert the location of the image (the &lt;code&gt;src=whatever.jpg&lt;/code&gt; of the &lt;code&gt;img&lt;/code&gt; tags) in between curly braces &lt;code&gt;{ }&lt;/code&gt;. You&amp;#8217;ll then need to manually place all the images later, deleting the braced text.&lt;/p&gt;

&lt;p&gt;In the future, the script could be changed to output XML, which does let you include pictures, but you&amp;#8217;d have to have all your images on your hard drive already. The script could go and download all the linked images, but it&amp;#8217;s not really a good idea to place low resolution, web-optimized images in a print document. In our case we have high-res copies of all the pictures on the blog stored on an external hard drive, so we just have to go and find and place the images we want. It takes more time, but it makes better quality documents in the end.&lt;/p&gt;

&lt;p&gt;Also, links are preserved as footnotes—all &lt;code&gt;href=&amp;quot;whatever.html&amp;quot;&lt;/code&gt;s show up as the footnote text.&lt;/p&gt;

&lt;h3 id='how_to_use_the_script'&gt;How to use the script&lt;/h3&gt;

&lt;p&gt;First, download the script and its supporting files from &lt;a href='http://github.com/andrewheiss/Blogger-XML-to-InDesign/tree/master' title='andrewheiss&amp;apos;s Blogger-XML-to-InDesign at master - GitHub'&gt;Github&lt;/a&gt;. If you&amp;#8217;re using Mac OS or Linux, make sure the main script file, &lt;code&gt;format_for_id.pl&lt;/code&gt; is executable—type &lt;code&gt;chmod +x format_for_id.pl&lt;/code&gt; at the terminal.&lt;/p&gt;

&lt;p&gt;Next, make sure you have Perl installed on your system. If you are using Linux or Mac OS X, you&amp;#8217;re good to go. If you&amp;#8217;re using Windows, download and install &lt;a href='http://strawberryperl.com/' title='Strawberry Perl'&gt;Strawberry Perl for Windows&lt;/a&gt;. You can also use &lt;a href='http://www.activestate.com/activeperl/' title='ActivePerl'&gt;ActivePerl&lt;/a&gt;, but installing modules is a little more difficult.&lt;/p&gt;

&lt;p&gt;The script uses several additional &lt;a href='http://en.wikipedia.org/wiki/Cpan' title='CPAN - Wikipedia, the free encyclopedia'&gt;CPAN modules&lt;/a&gt; that you&amp;#8217;ll need to install. You&amp;#8217;ll need to use the CPAN shell to do so.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;On Windows with Strawberry Perl: open the packaged CPAN client in the Start Menu folder&lt;/li&gt;

&lt;li&gt;On Windows with ActivePerl: Good luck. There is a large repository of specially compiled CPAN modules for ActiveState, and reportedly there is a kind of CPAN shell, but I haven&amp;#8217;t gotten either to work too well. Stick with Strawberry Perl. It&amp;#8217;s better :)&lt;/li&gt;

&lt;li&gt;On Mac OS X: type &lt;code&gt;perl -MCPAN -e shell&lt;/code&gt; at a terminal window&lt;/li&gt;

&lt;li&gt;On Linux: type &lt;code&gt;sudo cpan&lt;/code&gt; at a terminal window&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(If it&amp;#8217;s your first time running the CPAN shell you&amp;#8217;ll be asked to configure the installation environment. Choose the option to automatically configure everything.)&lt;/p&gt;

&lt;p&gt;Once everything is set up and you see the &lt;code&gt;cpan&lt;/code&gt;&amp;#62; shell prompt, type &lt;code&gt;install Package::Name&lt;/code&gt; (eg. &lt;code&gt;install Date::Format&lt;/code&gt;) for each of the dependent CPAN packages listed at the beginning of &lt;code&gt;format_for_id.pl&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Log in to your &lt;a href='http://www.blogger.com/home' title='Blogger.com'&gt;Blogger Dashboard&lt;/a&gt; and export your blog as an XML file by going to Settings &amp;#62; Basic &amp;#62; Export blog. Place the XML file in the script folder.&lt;/p&gt;

&lt;p&gt;Open &lt;code&gt;config.cfg&lt;/code&gt; with a text editor and change the settings as needed. Set the input file to your newly downloaded XML file, choose the year you want to extract, set an output file, and set the file header, either &amp;#60;&lt;code&gt;UNICODE-MAC&lt;/code&gt;&amp;#62; or &amp;#60;&lt;code&gt;UNICODE-WIN&lt;/code&gt;&amp;#62;, depending on what platform you use InDesign on.&lt;/p&gt;

&lt;p&gt;For now, leave all the style tags as they are so you can place the text into the example InDesign file and see how everything works. You can change them later and rerun the script&lt;/p&gt;

&lt;p&gt;Finally, using the terminal or command prompt, navigate to the folder with the script and and run it by typing &lt;code&gt;perl format_for_id.pl&lt;/code&gt;. If everything goes well you should have an output file at the location you specified, full of InDesign tags.&lt;/p&gt;

&lt;p&gt;Open up &lt;code&gt;Example.indd&lt;/code&gt; in InDesign CS3 or above and place the generated text file. All the text should come in perfectly with all the needed paragraph and character styles applied. Bravo!&lt;/p&gt;

&lt;h3 id='advanced_usage'&gt;Advanced usage&lt;/h3&gt;

&lt;p&gt;Obviously you&amp;#8217;ll want to make some changes to the format of the output text. You might not want the post URL right after the tag—you might want it at the end, or not want it at all. With a little knowledge of Perl, you can edit the main script directly, mostly the &lt;code&gt;combineSortClean()&lt;/code&gt; sub near the end of the script, to change the order of the output elements.&lt;/p&gt;

&lt;p&gt;You can also disable tag indexing and allow the tags to be output with a paragraph style. Just comment and uncomment the appropriate sections in the code. The same goes for the author-specific character styles—comment and uncomment the needed lines in the script.&lt;/p&gt;

&lt;p&gt;You can rename the styles and use your own—just make sure the styles exist in your InDesign document before you place the output file. InDesign will throw away any tags that don&amp;#8217;t already exist in the document.&lt;/p&gt;

&lt;p&gt;I made the script for our specific blog, so it doesn&amp;#8217;t take every possible paragraph or character style into account. If you want additional functionality, you&amp;#8217;ll have to add it. Feel free to fork the project off of GitHub and add to/improve it. That&amp;#8217;s why it&amp;#8217;s open source :)&lt;/p&gt;

&lt;p&gt;If you have any questions, ask in the comments. Report any issues at the &lt;a href='http://github.com/andrewheiss/Blogger-XML-to-InDesign/issues' title='Issues - andrewheiss/Blogger-XML-to-InDesign - GitHub'&gt;project GitHub page&lt;/a&gt;. I&amp;#8217;ll try to respond quickly—I generally do, as evidenced by my &lt;a href='http://www.andrewheiss.com/blog/2007/10/06/populating-a-livecycle-pdf-with-php-and-mysql/' title='Populating a LiveCycle PDF with PHP and MySQL  –   AndrewHeiss.com'&gt;pdftk-php project&lt;/a&gt; :)&lt;/p&gt;

&lt;p&gt;Good luck!&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AndrewHeiss/~4/pYffIc9HmLo" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://www.andrewheiss.com/blog/2009/07/19/converting-a-blogger-blog-to-indesign-tagged-text/</feedburner:origLink></entry>
 
 <entry>
   <title>pdftk-php Officially Released</title>
   <link href="http://feeds.andrewheiss.com/~r/AndrewHeiss/~3/Uzlv_NIgoP8/" />
   <updated>2009-06-19T00:00:00-06:00</updated>
   <id>http://www.andrewheiss.com/blog/2009/06/19/pdftk-php-officially-released</id>
   <content type="html">&lt;p&gt;Wow. It&amp;#8217;s been almost two years since I wrote &lt;a href='http://www.andrewheiss.com/blog/2007/10/06/populating-a-livecycle-pdf-with-php-and-mysql/' title='Populating a LiveCycle PDF with PHP and MySQL'&gt;a little tutorial&lt;/a&gt; on how to use LiveCycle, PHP, and MySQL together to make a web application that served dynamic PDF forms. Since then it has become the number one page on this site. I still get a substantial number of comments a week here on the blog and via e-mail—many of those comments are stuck in my inbox, sent to me before I rebuilt my site on WordPress and enabled commenting.&lt;/p&gt;

&lt;p&gt;Unfortunately, though, I wrote that tutorial as my first foray into the world of PHP/MySQL web development and had little idea of what I was really doing. Since then, however, I&amp;#8217;ve done a fair amount of real-world web design and development, and even implemented this pdftk form system into a live, public-facing &lt;a href='http://mmlab.lib.byu.edu' title='HBLL Multimedia Lab'&gt;application&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In the interim, I&amp;#8217;ve refined my system and released it as an open source PHP class, named &lt;a href='http://github.com/andrewheiss/pdftk-php/' title='pdftk-php on GitHub'&gt;&lt;code&gt;pdftk-php&lt;/code&gt;&lt;/a&gt;. The project is hosted at &lt;a href='http://github.com' title='GitHub'&gt;GitHub&lt;/a&gt;, a brilliant hosting service for collaborative projects, which uses Git, the best version control software I&amp;#8217;ve ever used. Anyone can check out, or clone, the project, make any edits to the core set of classes, and merge those with the main project branch—it is now a true community project. If you don&amp;#8217;t want to contribute, you can still &lt;a href='http://github.com/andrewheiss/pdftk-php/downloads' title='Download pdftk-php at GitHub'&gt;download it from GitHub&lt;/a&gt; as a &lt;code&gt;.zip&lt;/code&gt; or &lt;code&gt;.tar&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;Included in the project is a (hopefully) extensively documented example application that you can set up on your own server. You can try a live working example at &lt;a href='http://pdftk-php.andrewheiss.com/' title='Working pdftk-php example'&gt;pdftk-php.andrewheiss.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I&amp;#8217;m working on writing a new step-by-step tutorial on how to set everything up, akin to the old one. In theory, the new &lt;code&gt;pdftk-php&lt;/code&gt; should work with PDFs created in any program, not just LiveCycle. In the meantime, download &lt;code&gt;pdftk-php&lt;/code&gt;, try it out, and report any bugs here on the blog or &lt;a href='http://github.com/andrewheiss/pdftk-php/issues' title='Report an issue at GitHub'&gt;directly at GitHub&lt;/a&gt; (where I hope to keep everything related to &lt;code&gt;pdftk-php&lt;/code&gt; from now on). Fork the project and contribute if you feel like it, too!&lt;/p&gt;

&lt;p&gt;Thanks and good luck!&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AndrewHeiss/~4/Uzlv_NIgoP8" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://www.andrewheiss.com/blog/2009/06/19/pdftk-php-officially-released/</feedburner:origLink></entry>
 
 <entry>
   <title>A Tale of Three Taxis</title>
   <link href="http://feeds.andrewheiss.com/~r/AndrewHeiss/~3/5PRTf6ZbRc8/" />
   <updated>2009-05-14T00:00:00-06:00</updated>
   <id>http://www.andrewheiss.com/blog/2009/05/14/a-tale-of-three-taxis</id>
   <content type="html">&lt;p&gt;Traffic in Cairo is horrible, especially when all the taxi drivers, the ubiquitous life-blood of the Egyptian streets, have a deathwish for you.&lt;/p&gt;

&lt;p&gt;Read about my recent near misses at my post at our family blog, &lt;a href='http://www.heissatopia.com/2009/05/tale-of-three-taxis.html' title='Heissatopia: A tale of three taxis'&gt;Heissatopia&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AndrewHeiss/~4/5PRTf6ZbRc8" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://www.andrewheiss.com/blog/2009/05/14/a-tale-of-three-taxis/</feedburner:origLink></entry>
 
 <entry>
   <title>Google Profile Business Cards</title>
   <link href="http://feeds.andrewheiss.com/~r/AndrewHeiss/~3/3DiN-A9tzk8/" />
   <updated>2009-05-01T00:00:00-06:00</updated>
   <id>http://www.andrewheiss.com/blog/2009/05/01/google-profile-business-cards</id>
   <content type="html">&lt;p&gt;Look what I just ordered, for free:&lt;/p&gt;

&lt;p&gt;&lt;img src='http://www.andrewheiss.com/images/2009/05/google-profile-business-card.png' alt='Google Profile Business Card' /&gt;&lt;/p&gt;

&lt;p&gt;Awesome :)&lt;/p&gt;

&lt;p&gt;Google is giving packs of 25 of these away for free to promote their new &lt;a href='http://www.google.com/profiles/andrewheiss' title='Andrew Heiss - Google Profile'&gt;Google Profiles&lt;/a&gt; service. I think the profile idea is great—it makes finding people online so much easier and &lt;a href='http://lifehacker.com/5221323/google-profiles-give-you-control-over-what-google-says-about-you' title='Lifehacker - Google Profiles Give You Control Over What Google Says About You - Google Profiles'&gt;gives you more control over what Google says about you.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Too bad I won&amp;#8217;t get these until August when my mother-in-law comes to visit.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AndrewHeiss/~4/3DiN-A9tzk8" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://www.andrewheiss.com/blog/2009/05/01/google-profile-business-cards/</feedburner:origLink></entry>
 
 <entry>
   <title>Typing transliterated Arabic quickly</title>
   <link href="http://feeds.andrewheiss.com/~r/AndrewHeiss/~3/EQ4nL9y-Omw/" />
   <updated>2009-04-26T00:00:00-06:00</updated>
   <id>http://www.andrewheiss.com/blog/2009/04/26/typing-transliterated-arabic-quickly</id>
   <content type="html">&lt;p&gt;Since Arabic doesn&amp;#8217;t use the Latin alphabet, and lots of the letters don&amp;#8217;t have Latin equivalents (خ, ع, ق, ط, for example), transliteration is necessary to show Arabic words and sounds in English writing. There is an easy way to type transliterated Arabic quickly, though, using macros to locate hidden Unicode characters used by many of the standard transliteration systems.&lt;/p&gt;

&lt;p&gt;Unfortunately, there is no universally standard system for transliteration, and most systems use letters that aren&amp;#8217;t found on normal keyboards. One of the rising systems in the Middle East, nicknamed &lt;a href='http://en.wikipedia.org/wiki/Arabic_Chat_Alphabet'&gt;Franco Arab&lt;/a&gt; in Egypt, is my least favorite. It only uses standard English letters, meaning it&amp;#8217;s useful for texting, e-mailing, and other things where it&amp;#8217;s difficult to write in real Arabic script. Biggest problem: it&amp;#8217;s ugly and hard to read.&lt;/p&gt;

&lt;p&gt;For example, the name Great Britain (بريطانيا العظمى) uses several non-Latin letters. Written in Franco it looks like this: &lt;em&gt;bri6ania al3o&amp;#8217;6ma&lt;/em&gt;. For readers unfamiliar with Arabic (or even those who are, like me), it&amp;#8217;s always hard to remember what the random uppercase letters and numbers mean.&lt;/p&gt;

&lt;p&gt;Fortunately, there are better systems. Here&amp;#8217;s Great Britain written using the &lt;a href='http://www8.georgetown.edu/departments/history/ijmes/'&gt;IJMES&lt;/a&gt; (International Journal of Middle East Studies) &lt;a href='http://www8.georgetown.edu/departments/history/ijmes/Translit_Chart.pdf'&gt;system&lt;/a&gt;, also used in the Encyclopedia of Islam: &lt;em&gt;Brīṭānīyā al-ʿuẓmá&lt;/em&gt;. Much easier to read.&lt;/p&gt;

&lt;p&gt;Since the nonstandard Latin letters use Unicode glyphs, you need to use a font that has a full set of Unicode glyphs, like Times, Arial, Helvetica, and other standard fonts. You also have to hunt down all the special characters either in Word&amp;#8217;s Insert Special Character dialog or in the Glyphs panel in InDesign.&lt;/p&gt;

&lt;p&gt;You can speed up the process of hunting for and inserting special characters by using a text substitution app like &lt;a href='http://lifehacker.com/software/texter/lifehacker-code-texter-windows-238306.php'&gt;Texter&lt;/a&gt; for Windows (free, &lt;a href='http://github.com/adampash/texter/tree/master'&gt;open source&lt;/a&gt;) or &lt;a href='http://www.ergonis.com/products/typinator/'&gt;Typinator&lt;/a&gt; for Mac (not free). These programs can replace abbreviations that you type with preset phrases. For example, if you wanted to quickly type today&amp;#8217;s date you could set up a shortcut that would replace %date with the full date.&lt;/p&gt;

&lt;p&gt;I set up a list of text replacements in my copy of Typinator that automatically change certain combinations of characters into IJMES standard transliterated rules. Here&amp;#8217;s my list of text transformation rules (all with the prefix -ij, short for IJMES):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;-ij&amp;#8217; = &amp;#703;&lt;/li&gt;

&lt;li&gt;-ij` = &amp;#702;&lt;/li&gt;

&lt;li&gt;-ija = &amp;#257;&lt;/li&gt;

&lt;li&gt;-ijd = &amp;#7693;&lt;/li&gt;

&lt;li&gt;-ijh = &amp;#7717;&lt;/li&gt;

&lt;li&gt;-iji = &amp;#299;&lt;/li&gt;

&lt;li&gt;-ijs = &amp;#7779;&lt;/li&gt;

&lt;li&gt;-ijt = &amp;#7789;&lt;/li&gt;

&lt;li&gt;-iju = &amp;#363;&lt;/li&gt;

&lt;li&gt;-ijz = &amp;#7827;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here&amp;#8217;s a (very) quick example of this in action:&lt;/p&gt;
&lt;p&gt;&lt;object height='300' width='400'&gt;&lt;param name='allowfullscreen' value='true' /&gt;&lt;param name='allowscriptaccess' value='always' /&gt;&lt;param name='movie' value='http://vimeo.com/moogaloop.swf?clip_id=4337233&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1' /&gt;&lt;embed src='http://vimeo.com/moogaloop.swf?clip_id=4337233&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1' allowfullscreen='true' type='application/x-shockwave-flash' allowscriptaccess='always' height='300' width='400' /&gt;&lt;/object&gt;&lt;/p&gt;
&lt;p&gt;You could set up similar rules for transliteration with different systems (even Franco), or even different languages. Typing IJMES transliterated words for academic papers just got infinitely easier.&lt;/p&gt;
&lt;p class='confirmation warning'&gt;You will probably only want to use IJMES transliteration in print because of font encoding issues on different platforms and browsers. For online text you'll have to stick with Franco or something like it.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AndrewHeiss/~4/EQ4nL9y-Omw" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://www.andrewheiss.com/blog/2009/04/26/typing-transliterated-arabic-quickly/</feedburner:origLink></entry>
 
 <entry>
   <title>Libya, obsolete paradigms, and Rip Van Winkle</title>
   <link href="http://feeds.andrewheiss.com/~r/AndrewHeiss/~3/E_qzZmX-doI/" />
   <updated>2009-03-18T00:00:00-06:00</updated>
   <id>http://www.andrewheiss.com/blog/2009/03/18/libya-obsolete-paradigms-and-rip-van-winkle</id>
   <content type="html">&lt;p&gt;I’m still experimenting with what I’m going to blog about here. I’m thinking of sticking with an odd mixture of technology and academia, which might work out well since I’m considering doing my upcoming thesis on technology in the Middle East, specifically blogging. So, here’s a purely academic post to start things off.&lt;/p&gt;

&lt;p&gt;On Tuesday Dr. Lisa Anderson, AUC’s Provost and former professor at Columbia University, came to speak at a faculty seminar at the Middle East Studies Center. She’s a political scientist by training and started her academic career by studying Libya. Her talk focused on the role of traditional social studies disciplines in the study of the Middle East.&lt;/p&gt;

&lt;p&gt;General social studies separated into more specialized disciplines in the early 1900s as progressive governments in the US and Europe became increasingly interested in understanding the dynamics of the social “here and now.” New disciplines of social studies emerged with the explicit purpose of improving governance, public administration, and economy. Economists researched and theorized how to stabilize and grow a capitalist economy; political scientists looked at the processes that created a stable democracy; sociologists tackled the dynamics of the changing progressive societies. Social scientists not explicitly concerned with the issues of “here and now” also emerged; those not interested in “here” entered anthropology while those not interested in “now” created the discipline of history.&lt;/p&gt;

&lt;p&gt;Over the past century, scholarship in these disciplines has been rather entrenched along this foundational paradigm: research to improve capitalism and democracy. Because of this disciplinary emphasis and paradigm of US/Western-style economics and political systems, any research on other systems of government or economies are always done in terms of the “Western” social science paradigm.&lt;/p&gt;

&lt;p&gt;For example, every class I’ve taken on Middle East politics always focuses on the processes of democratization and the persistence of authoritarianism. Elections (fair or not), development of civil society, the emergence of political parties—these are signs of “political development” for a political scientist. Economists look at how liberalized a state’s economy is—how open for investment and primed for capitalism it is. In a way, strict disciplinary social studies of societies outside the US and Europe seem to place other countries on a linear progressive timeline; studies of Egyptian politics reveal how democratized Egypt is or isn’t.&lt;/p&gt;

&lt;p&gt;Not all countries—not even Egypt—fit into this standard disciplinary framework. Did Nasser really care if his Arab Socialist revolution fit into a future program of democratization? No way. He didn’t even think of it. Arab political scientists don’t generally look at it that way.&lt;/p&gt;

&lt;p&gt;This theme of trying to fit the Middle Eastern peg in the academic square is well pronounced in Libya, which, because international sanctions for the past few decades, has been pretty isolated. According to Dr. Anderson, the case of Libya shows the limits of traditional Western social sciences.&lt;/p&gt;

&lt;p&gt;&lt;a href='http://en.wikipedia.org/wiki/Muammar_al-Qaddafi'&gt;Muammar Qaddafi&lt;/a&gt;, the crazy Libyan dictator surrounded by &lt;a href='http://lallalydia.blogspot.com/2007/12/modern-day-amazons-colonel-qaddafis.html'&gt;female bodyguards&lt;/a&gt; and who &lt;a href='http://en.wikipedia.org/wiki/Jamahiriya'&gt;made up his country’s name&lt;/a&gt;, has ruled Libya for 40 years. He’s been operating with a unique paradigm of political and economic theory that doesn’t jive with the standard Western view. He published a three volume exposition of his political and social views in 1975 called &lt;a href='http://en.wikipedia.org/wiki/The_Green_Book'&gt;&lt;em&gt;The Green Book&lt;/em&gt;&lt;/a&gt;. Qaddafi’s view of Libya’s political paradigm is completely different from Western disciplinary political science. For Qaddafi, the ideal political system is more of a radical, romantic, Rousseauian world where each individual represents themselves and has an innate skepticism of the state. His theory of the Libyan economy makes no mention of the market, the main protagonist of “standard” economics. Sociologically, the individual in Qaddafi’s Libya is not the fundamental unit of analysis—the family or tribe is. In practice there are no political parties or parliaments in Libya; each community runs itself with town hall-esque meetings. His social theory seems to be working for the most part.&lt;/p&gt;

&lt;p&gt;In the 80s, because of different international incidents involving Libya, including &lt;a href='http://en.wikipedia.org/wiki/Pan_Am_flight_103'&gt;the bombing of Pan Am Flight 103 over Lockerbie&lt;/a&gt;, America and most of the international community imposed strict sanctions on Libya, aimed at isolating and punishing them. All relations between America and Libya were effectively destroyed and Libya entered what she called a &lt;a href='http://en.wikipedia.org/wiki/Rip_Van_Winkle'&gt;“Rip Van Winkle”&lt;/a&gt; era; life continued in total isolation in Libya under Qaddafi’s political and social theory.&lt;/p&gt;

&lt;p&gt;In 2004 (about 20 years later…just like Rip Van Winkle, oddly enough) the sanctions eased and American and the rest of the world began diplomatic and academic contacts again. Because of the sanctions, Libya had missed out on the techno-political revolution of the internet. There were no banks; nobody knew what a credit card was. Dr. Anderson visited several universities in 2004 after this long isolation and found a globe in the center of the reference area of the library—North Asia was still labeled as the USSR.&lt;/p&gt;

&lt;p&gt;Don’t go under international sanctions on the eve of a technological revolution. It’s not a good idea. At all.&lt;/p&gt;

&lt;p&gt;As the conflict and tension between Libya and the rest of the world began to thaw, American social scientists got excited. They could finally observe Libya’s progress in democratization and economic liberalization; Libya was on &lt;em&gt;the&lt;/em&gt; path. Once the sanctions ended, Libya started assimilating into the new world order. It officially apologized for its limited involvement in the Lockerbie crash. It disbanded all attempts at a nuclear weapons program. It was given a rotating seat on the UN security council. Condoleezza Rice even visited and on the eve of George Bush’s presidency, in January 2009, the US and Libya exchanged ambassadors.&lt;/p&gt;

&lt;p&gt;However, despite all this apparent liberalization and openness in Libyan politics and the subsequent disciplinary excitement in political science, Libyan experts like Lisa Anderson see a different reality. Qaddafi is following his own trajectory, totally outside the traditional paradigm. He’s not progressing towards democracy—he’s already got a pseduodemocratic Era of the Masses political and economic system and is happy with it. He’s realized that in order to continue with his social revolution, he has to be somewhat involved with the world, and so he presents a facade of integration.&lt;/p&gt;

&lt;p&gt;For example, when the Libyans ended their WMD program in 2006 and turned over all their nuclear material, all the machinery was still boxed up in crates. American politicians and political scientists applauded the IAEA for catching and stopping Libya before they could unpack anything. A widespread rumor/theory in both Libya and in academic and political circles, though, claims that Libya never had a program for WMD development. Their infrastructure and level of development couldn’t have handled such a large project. According to this theory, Libya bought the materials from North Korea so they could have something to turn over to the UN and the USA. So, they announced their weapons program, were condemned by the international community, bought some nuclear machinery from Korea, turned themselves in, reduced international sanctions, and improved their reputation in the world.&lt;/p&gt;

&lt;p&gt;The same theory applies to the Lockerbie apology. Two Libyans were partially responsible for the bombing, so the majority of the blame was placed on Libya, despite several other claims of responsibility from other international non-state actors. Most Libyans today fully believe that Libya had no real connection to the bombing, yet Libya settled on a large payout with the families of the victims and offered a full apology. Following the apology sanctions were further lightened.&lt;/p&gt;

&lt;p&gt;Libya was merely paying cynical lip service to the absurd US-led world order. As Dr. Anderson stated:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you’re playing the game that cynically, are you really playing the game? Libya is just playing the game; they think it’s just nonsense.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you’re studying a country that considers the “standard” world political, economic, and social system as an absurd game, can you really fully understand it if you study it using disciplines created by that system for the explicit purpose of improving the system? Standard Western political science is still stuck looking at the “here and now” of the early 1900s. Libya doesn’t fit the social science mold at all—traditional social sciences therefore fall flat on their faces.&lt;/p&gt;

&lt;p&gt;I’ve found that the same principle can be applied to other countries in the Middle East. When Egypt held elections in 2005, President Mubarak allowed a second candidate to run for the first time ever. Disciplinary political scientists praised his move as an important step towards liberal democratization. Mubarak won by a landslide through rigged elections and imprisoned his opposing candidate, Ayman Nour.&lt;/p&gt;

&lt;p&gt;Great big step towards democracy, or false expectations rooted in a skewed and incorrect social science paradigm?&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AndrewHeiss/~4/E_qzZmX-doI" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://www.andrewheiss.com/blog/2009/03/18/libya-obsolete-paradigms-and-rip-van-winkle/</feedburner:origLink></entry>
 
 <entry>
   <title>Do not succumb to economic stupidity</title>
   <link href="http://feeds.andrewheiss.com/~r/AndrewHeiss/~3/rvZK4Q2e5f0/" />
   <updated>2009-03-15T00:00:00-06:00</updated>
   <id>http://www.andrewheiss.com/blog/2009/03/15/do-not-succumb-to-economic-stupidity</id>
   <content type="html">&lt;p&gt;Yikes. It’s been a week since I launched my new site and blog and I haven’t posted yet. I think this is partially because I don’t know what I’m going to be focusing on with this blog. Middle East Studies? Technology? Hmmm…&lt;/p&gt;

&lt;p&gt;I’ve had this blog post on my mind for a while, though, so I’d better post it. The best part is that it has nothing to do with MES or tech topics.&lt;/p&gt;

&lt;p&gt;I’ve felt somewhat immune and aloof from all the American economic troubles. We moved to Egypt in August, a few months after the Bear Stern collapse, but before the September Lehman Bros./Commercial Paper collapse and subsequent bailouts.&lt;/p&gt;

&lt;p&gt;Despite the rigors of grad school, I’ve had plenty of time to study up on the causes of this crisis. Having a bus daily 45 minute–1 hour bus commute has given me plenty of time to follow some awesome podcasts. I’ll post about my podcast routine later, but suffice it to say, I feel way more informed about this crisis because of the time I’ve spent listening and studying.&lt;/p&gt;

&lt;p&gt;That doesn’t mean I know everything—or anything—about this crisis. I don’t fully comprehend all the crazy financial machinations that got us here. I can follow the news a bit better, though.&lt;/p&gt;

&lt;p&gt;Here are some of the best resources I’ve found so far:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NPR’s Planet Money&lt;/strong&gt;: Amazing &lt;a href='http://www.npr.org/rss/podcast/podcast_detail.php?siteId=94411890'&gt;podcast&lt;/a&gt; that comes out 3–4 times a week. Excellent reporting. Easy to understand. Awesome. &lt;a href='http://www.npr.org/money'&gt;Their blog rocks, too&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;This American Life&lt;/strong&gt;: Normally their hour long radio shows highlight a variety of interesting stories on random topics and have little to do with news, but they cosponsor Planet Money and have dedicated two entire shows to the economic crisis, &lt;a href='http://www.thisamericanlife.org/Radio_Episode.aspx?sched=1242'&gt;The Giant Pool of Money&lt;/a&gt; and &lt;a href='http://www.thisamericanlife.org/Radio_Episode.aspx?sched=1285'&gt;Bad Bank&lt;/a&gt;. US Treasury Secretary Tim Geithner and Senator Max Baucus even &lt;a href='http://www.npr.org/blogs/money/2009/03/some_doll_house_or_other.html'&gt;praised Bad Bank in front of a joint session of Congress&lt;/a&gt;. It was that good.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Crisis of Credit&lt;/strong&gt;: &lt;a href='http://vimeo.com/3261363'&gt;Brilliant 10 minute animation&lt;/a&gt; inspired by Planet Money.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Inside the Meltdown&lt;/strong&gt;: PBS did a &lt;a href='http://www.pbs.org/wgbh/pages/frontline/meltdown/'&gt;great hour long documentary&lt;/a&gt; on the crisis. Really good, as well.&lt;/p&gt;

&lt;p&gt;So check out those links and get informed. Found any other useful resources out there? Let us know in the comments…&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AndrewHeiss/~4/rvZK4Q2e5f0" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://www.andrewheiss.com/blog/2009/03/15/do-not-succumb-to-economic-stupidity/</feedburner:origLink></entry>
 
 <entry>
   <title>New site launched</title>
   <link href="http://feeds.andrewheiss.com/~r/AndrewHeiss/~3/5Vvh9AjnmKs/" />
   <updated>2009-03-08T00:00:00-07:00</updated>
   <id>http://www.andrewheiss.com/blog/2009/03/08/new-site-launched</id>
   <content type="html">&lt;p&gt;Two years ago I decided that it would be a good idea to start a personal website. I was always disappointed in &lt;a href='http://www.google.com/search?q=Andrew+Heiss'&gt;the Google results for my name&lt;/a&gt;, so I figured having my own web space and domain would help boost my ratings. Yes. I initially started this site for the sole purpose of &lt;a href='http://en.wikipedia.org/wiki/Egosurfing'&gt;egogoogling&lt;/a&gt;. So much has changed since then…&lt;/p&gt;

&lt;p&gt;My first website was ugly. I had just started my foray into web design and barely knew anything—my CSS was rudimentary at best and I used scattered PHP includes to make a pseudo dynamic site. It was a mess.&lt;/p&gt;

&lt;p&gt;&lt;img src='http://www.andrewheiss.com/images/2009/03/screenshot-of-old-site.png' alt='Screenshot of old site' /&gt;&lt;/p&gt;

&lt;p&gt;Ugh. It was pretty embarrassing. I should have just killed it, but I couldn&amp;#8217;t because of &lt;a href='http://www.andrewheiss.com/blog/2007/10/06/populating-a-livecycle-pdf-with-php-and-mysql/'&gt;one tutorial&lt;/a&gt; I posted. That one post drives more than 80% of the traffic to this site, and I get almost daily e-mails with questions about it. My old site couldn&amp;#8217;t handle the community that built up around it.&lt;/p&gt;

&lt;p&gt;Now that I know a thing or two more about design, I&amp;#8217;m finally revealing the newest incarnation of &lt;a href='http://www.andrewheiss.com/'&gt;AndrewHeiss.com&lt;/a&gt;—a fully fledged, Wordpress-based site, with a blog, portfolio, and my general online identity hub.&lt;/p&gt;

&lt;p&gt;The design isn&amp;#8217;t finished yet; there are a few last tweaks that need to get done. Let me know about any issues, problems, or suggestions in the comments.&lt;/p&gt;

&lt;p&gt;Oh, I&amp;#8217;m still the top result for Andrew Heiss. Not that it&amp;#8217;s hard&amp;#8230;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AndrewHeiss/~4/5Vvh9AjnmKs" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://www.andrewheiss.com/blog/2009/03/08/new-site-launched/</feedburner:origLink></entry>
 
 <entry>
   <title>Populating a LiveCycle PDF with PHP and MySQL</title>
   <link href="http://feeds.andrewheiss.com/~r/AndrewHeiss/~3/gQVHHQP6LUU/" />
   <updated>2007-10-06T00:00:00-06:00</updated>
   <id>http://www.andrewheiss.com/blog/2007/10/06/populating-a-livecycle-pdf-with-php-and-mysql</id>
   <content type="html">&lt;p class='confirmation warning'&gt;This tutorial is officially defunct. It is only here for archival purposes. The main script has been consolidated into one PHP class—&lt;a href='http://www.andrewheiss.com/blog/2009/06/19/pdftk-php-officially-released/'&gt;pdftk-php&lt;/a&gt;. Please see &lt;a href='http://www.andrewheiss.com/blog/2009/07/29/installing-pdftk-php/'&gt;the updated tutorial&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I work in the Harold B. Lee Library Multimedia Lab where we check out digital video and still cameras, tripods, external hard drives, digital voice recorders, and let people use $8,000 Quad Core Intel Macs. Expensive stuff…&lt;/p&gt;

&lt;p&gt;To insure a “you break it, you pay for it” system, we require all patrons to fill out a loan agreement that we then keep on file. We&amp;#8217;ve been using this system for several years and now have more than a thousand forms—all completely unorganized and out of date. We have no way of knowing if a patron has graduated. We have no way of seeing if a patron has filled out a form previously.&lt;/p&gt;

&lt;p&gt;So, I volunteered to fix the problem and move the entire loan agreement system to an online database. I had dabbled in LiveCycle and PHP but had never touched MySQL. So I decided to figure it all out.&lt;/p&gt;

&lt;p&gt;I&amp;#8217;m assuming you already have a server set up with PHP and MySQL. If not, you can download &lt;a href='http://www.wampserver.com/en/'&gt;WAMP&lt;/a&gt; or &lt;a href='http://www.mamp.info/en/mamp.html'&gt;MAMP&lt;/a&gt; and set up a local server on your computer for testing.&lt;/p&gt;

&lt;p&gt;I&amp;#8217;m also assuming you have some knowledge of HTML and PHP. If not, search for some PHP tutorials on Google and get a foundation there.&lt;/p&gt;

&lt;h4 id='adobe_livecycle'&gt;Adobe LiveCycle&lt;/h4&gt;

&lt;p&gt;Adobe&amp;#8217;s LiveCycle PDF Form software works great creating fillable PDF forms and then gathering the form data electronically. Collecting the data is relatively easy since LiveCycle uses semi-open file formats for data storage. For example, if you have an e-mail submit button in your LiveCycle form, a specially formatted XML file will be e-mailed to whatever address you set in the button properties. LiveCycle can then input that XML and repopulate an empty form.&lt;/p&gt;

&lt;p&gt;Adobe even sells the LiveCycle Enterprise Suite, which is basically a specialized server made for generating and repopulating PDFs from submitted data. The Enterprise Suite is extremely expensive though&lt;/p&gt;

&lt;h4 id='create_form_in_livecycle'&gt;Create form in LiveCycle&lt;/h4&gt;

&lt;p&gt;Unfortunately LiveCycle Designer does not work like the rest of the Adobe CS3 products. I spend most of my time in InDesign, and from a typographic point of view, Designer is pathetic and a little difficult to work with.&lt;/p&gt;

&lt;p&gt;Creating the form is relatively straightforward, regardless of the limitations. Drag text boxes and image boxes from the Library panel to add static text and images. Drag text input boxes from the Library to make fillable fields. Actually laying out and designing the form is not the scope of this tutorial, so I won&amp;#8217;t go any further with that.&lt;/p&gt;

&lt;h4 id='data_bindings'&gt;Data Bindings&lt;/h4&gt;

&lt;p&gt;What concerns us most is data submission and population with form fields, so we need to set up our fields to work. If you click on a text field, you should have three tabs in the Object panel (if you don&amp;#8217;t have an Object panel, go to Window &amp;#62; Object).&lt;/p&gt;

&lt;p&gt;The Field tab lets you set some basic properties for the field, like whether or not the field can have multiple lines, the line length, the display pattern for phone numbers or other number patterns, the caption, and a plethora of other things. The Value tab allows you to do some scripting for validation of your fields. I tried getting this to work, but since I&amp;#8217;m not a programmer at all and don&amp;#8217;t really know Javascript, I gave up.&lt;/p&gt;

&lt;p&gt;The Binding tab is the most important for our purposes. By default your field will have a basic name like &lt;code&gt;TextField1&lt;/code&gt;. You should change the names of all your fields to a more canonical naming system, like FirstName, LastName, EMail, etc. You can also change the data patterns and formats for text, XHTML, or dates.&lt;/p&gt;

&lt;h4 id='submit_through_http'&gt;Submit Through HTTP&lt;/h4&gt;

&lt;p&gt;For my purposes, I wanted patrons to be able to fill out this PDF from anywhere and then submit it online, regardless of e-mail accounts. To best do this, drag an HTTP Submit Button from the Standard section of your Library. For this button to do anything, you need to set a URL that will receive the data in the form of HTTP POST.&lt;/p&gt;

&lt;h4 id='begin_setting_up_your_web_application'&gt;Begin Setting Up Your Web Application&lt;/h4&gt;

&lt;p&gt;I made several different PHP files in the process of getting this all to work. First I wanted to verify what the HTTP POST values were before I started trying to process them. I adapted this code from &lt;a href='http://blogs.adobe.com/stevex/2006/06/submit_to_php.html'&gt;Steve Tibbett&lt;/a&gt;, an actual Adobe guy.&lt;/p&gt;

&lt;p&gt;&lt;a href='http://www.andrewheiss.com/TutorialFiles/dump.php.txt'&gt;Download text for dump.php&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create a file called dump.php and paste this code into it (or remove the .txt extension). Set your HTTP Submit Button URL to dump.php (in my case it was http://localhost/PDFStuff/dump.php) and preview your PDF in Designer. Submit your data and you&amp;#8217;ll see all the variables and the raw post data. &lt;em&gt;This step is only to verify that the HTTP POST variables actually match up with your Designer field names.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now that we know that the HTTP POST variables are actually working, we need to save them to a database. You&amp;#8217;ll need to first set up a MySQL table or database. Since I had never done this, I followed &lt;a href='http://www.phpeasystep.com/index.php'&gt;some tutorials here&lt;/a&gt;, which were extremely helpful in understanding how to actually use MySQL.&lt;/p&gt;

&lt;p&gt;Use PHPmyadmin and create a new PDFStuff database with a username and password and then create a table in it with the following command (or use the GUI form in PHPmyadmin to create the table—either way works):&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='sql'&gt;&lt;span class='k'&gt;CREATE&lt;/span&gt; &lt;span class='k'&gt;TABLE&lt;/span&gt; &lt;span class='o'&gt;`&lt;/span&gt;&lt;span class='n'&gt;PDF_Loans&lt;/span&gt;&lt;span class='o'&gt;`&lt;/span&gt; &lt;span class='p'&gt;(&lt;/span&gt;
&lt;span class='o'&gt;`&lt;/span&gt;&lt;span class='n'&gt;id&lt;/span&gt;&lt;span class='o'&gt;`&lt;/span&gt; &lt;span class='nb'&gt;int&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='mi'&gt;4&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt; &lt;span class='k'&gt;NOT&lt;/span&gt; &lt;span class='k'&gt;NULL&lt;/span&gt; &lt;span class='n'&gt;auto_increment&lt;/span&gt; &lt;span class='k'&gt;primary&lt;/span&gt; &lt;span class='k'&gt;key&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt;
&lt;span class='o'&gt;`&lt;/span&gt;&lt;span class='n'&gt;FirstName&lt;/span&gt;&lt;span class='o'&gt;`&lt;/span&gt; &lt;span class='nb'&gt;varchar&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='mi'&gt;65&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt; &lt;span class='k'&gt;NOT&lt;/span&gt; &lt;span class='k'&gt;NULL&lt;/span&gt; &lt;span class='k'&gt;default&lt;/span&gt; &lt;span class='s1'&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt;
&lt;span class='o'&gt;`&lt;/span&gt;&lt;span class='n'&gt;LastName&lt;/span&gt;&lt;span class='o'&gt;`&lt;/span&gt; &lt;span class='nb'&gt;varchar&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='mi'&gt;65&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt; &lt;span class='k'&gt;NOT&lt;/span&gt; &lt;span class='k'&gt;NULL&lt;/span&gt; &lt;span class='k'&gt;default&lt;/span&gt; &lt;span class='s1'&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt;
&lt;span class='o'&gt;`&lt;/span&gt;&lt;span class='n'&gt;EMail&lt;/span&gt;&lt;span class='o'&gt;`&lt;/span&gt; &lt;span class='nb'&gt;varchar&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='mi'&gt;65&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt; &lt;span class='k'&gt;NOT&lt;/span&gt; &lt;span class='k'&gt;NULL&lt;/span&gt; &lt;span class='k'&gt;default&lt;/span&gt; &lt;span class='s1'&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt;
&lt;span class='p'&gt;)&lt;/span&gt; &lt;span class='k'&gt;TYPE&lt;/span&gt;&lt;span class='o'&gt;=&lt;/span&gt;&lt;span class='n'&gt;MyISAM&lt;/span&gt; &lt;span class='n'&gt;AUTO_INCREMENT&lt;/span&gt;&lt;span class='o'&gt;=&lt;/span&gt;&lt;span class='mi'&gt;0&lt;/span&gt; &lt;span class='p'&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;You now have a table in your database where we can store our PDF form variables. Paste this code into a file called insert.php and change the PHP variables as necessary, both for your MySQL connection information and your HTTP POST variables (here I just use FirstName, LastName, and Email).&lt;/p&gt;

&lt;p&gt;&lt;a href='http://www.andrewheiss.com/TutorialFiles/insert.php.txt'&gt;Download text for insert.php&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Change the URL of the HTTP POST button to insert.php (again, in my case it&amp;#8217;s http://localhost/PDFStuff/insert.php) and try submitting some data with your PDF form. It should work.&lt;/p&gt;

&lt;h4 id='viewing_data_in_the_database'&gt;Viewing Data in the Database&lt;/h4&gt;

&lt;p&gt;To actually see your submitted data, create a new php file called view.php and paste this code in, changing it as necessary.&lt;/p&gt;

&lt;p&gt;&lt;a href='http://www.andrewheiss.com/TutorialFiles/view.php.txt'&gt;Download text for view.php&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This page will take all the data from your database and display it in a table. You should see one record—the one you just added. There is also a column for a link to view the PDF, although the link is blank for now. Add several more through LiveCycle to make sure it&amp;#8217;s working.&lt;/p&gt;

&lt;h4 id='pdf_madness'&gt;PDF Madness&lt;/h4&gt;

&lt;p&gt;If you&amp;#8217;ve already had PHP/MySQL experience, all of that was easy. Now comes the tricky part—repopulating the PDF form from the MySQL.&lt;/p&gt;

&lt;p&gt;To get this to work, we need to convert the MySQL data into an FDF file, or the Adobe file format for storing form data. We then need to infuse the FDF file into our empty PDF form and allow the user to download it.&lt;/p&gt;

&lt;p&gt;Fortunately, someone else figured out the bulk of this, at &lt;a href='http://www.pdfhacks.com/'&gt;www.pdfhacks.com&lt;/a&gt;. Download &lt;a href='http://www.accesspdf.com/pdftk/'&gt;pdftk&lt;/a&gt; and &lt;a href='http://www.pdfhacks.com/forge_fdf/'&gt;forge_fdf.php&lt;/a&gt; place them in your main site directory. Forge_fdf.php will take your data and transform it into an FDF file while fdftk will insert that FDF into your PDF. All you need to do is add some variables.&lt;/p&gt;

&lt;p&gt;Before creating your variables, you need to discover the real names for all of your fields. If you made your PDF in Acrobat, the field names &lt;em&gt;should&lt;/em&gt; be identical, but if you used Designer, the official code-based names will be much longer. fdftk can discover those names for you and dump them in a text file.&lt;/p&gt;

&lt;p&gt;Place your empty PDF form in your main site folder. Open up a command prompt or terminal and run this command in the site folder, changing file names as necessary:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='sh'&gt;&lt;span class='nv'&gt;$ &lt;/span&gt;pdftk form.pdf dump_data_fields &amp;gt; form.pdf.fields
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Open up the newly created form.pdf.fields file in Notepad and you&amp;#8217;ll see the automatic fdftk output, which will look something like this:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='text'&gt;FieldType: Text
FieldName: form1[0].#subform[0].#area[0].FirstName[0]
FieldNameAlt: First Name:
FieldFlags: 2
FieldJustification: Left
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;The FieldName in this case is long and hairy, but we&amp;#8217;ll need that full name for the data insertion to work.&lt;/p&gt;

&lt;h4 id='dynamic_data_insertion'&gt;Dynamic Data Insertion&lt;/h4&gt;

&lt;p&gt;Now we&amp;#8217;re ready to put all the pieces together. Make a file called viewpdf.php and paste this code in, changing as necessary:&lt;/p&gt;

&lt;p&gt;&lt;a href='http://www.andrewheiss.com/TutorialFiles/viewpdf.php.txt'&gt;Download text for viewpdf.php&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you don&amp;#8217;t want the form flattened (i.e. you want to maintain the form fields), take out the &lt;code&gt; – flatten&lt;/code&gt; command.&lt;/p&gt;

&lt;p&gt;Notice how the long names had to go in to the &lt;code&gt;$fdf_data_strings&lt;/code&gt; array.&lt;/p&gt;

&lt;p&gt;To populate the PDF from your view.php table, you need to pass those long field names into viewpdf.php. Technically you would need to change the links in view.php to include the row id number for each row, so the PDF is generated using only the information from that row. Fortunately, we can have PHP and MySQL write all those links dynamically.&lt;/p&gt;

&lt;p&gt;We originally set up the database so that every time you insert a record, an auto-id number would be assigned. We can reference that id number to view the PDF for that specific row entry.&lt;/p&gt;

&lt;p&gt;You pass the id variable into the viewpdf.php file by adding &lt;code&gt;?id=1&lt;/code&gt; onto the URL (for example, viewing the PDF for record number three would be &lt;code&gt;viewpdf.php?id=3&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;PHP and MySQL can automatically generate that messy link for every record in the table. Just replace &lt;code&gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;View PDF&amp;lt;/a&amp;gt;&lt;/code&gt; in view.php with &lt;code&gt;&amp;lt;a href=&amp;quot;viewpdf.php?id=&amp;lt;?php echo $rows[&amp;#39;id&amp;#39;]; ?&amp;gt;&amp;quot;&amp;gt;View PDF&amp;lt;/a&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Open up view.php and see your dynamically generated table. You should have dynamic links that point to &lt;code&gt;viewpdf.php?id=whatever&lt;/code&gt;. If you click on one of the links, the code in viewpdf.php will be processed for that row and a PDF will be generated and flattened and downloaded.&lt;/p&gt;

&lt;p&gt;Voila!&lt;/p&gt;

&lt;p&gt;I was only able to get this to work with text fields, although it is possible to do this with check boxes and other form elements. You&amp;#8217;ll have to consult the fdftk documentation to see what variables need to be set for other form elements.&lt;/p&gt;

&lt;p&gt;This is a bare bones implementation of PDF population. In real life this is implemented a lot better—i.e. I have my view.php file accessible only after logging in and all the pages are styled with CSS to look nicer.&lt;/p&gt;

&lt;p&gt;Hopefully this all made sense. If you want to view the original tutorials I used for this, visit:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href='http://www.mactech.com/articles/mactech/Vol.20/20.11/FillOnlinePDFFormsUsingHTML/index.html'&gt;MacTech Tutorial&lt;/a&gt;—Explains how to do this using an HTML submission form rather than a PDF form. This was the basis for my tutorial.&lt;/li&gt;

&lt;li&gt;&lt;a href='http://accesspdf.com/html_pdf_form/'&gt;MacTech Example&lt;/a&gt;—Working example of a PDF being populated by HTML.&lt;/li&gt;

&lt;li&gt;&lt;a href='http://www.phpeasystep.com/index.php'&gt;PHPeasy&lt;/a&gt;—Basic PHP/MySQL tutorials.&lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://feeds.feedburner.com/~r/AndrewHeiss/~4/gQVHHQP6LUU" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://www.andrewheiss.com/blog/2007/10/06/populating-a-livecycle-pdf-with-php-and-mysql/</feedburner:origLink></entry>
 
 <entry>
   <title>Using Arabic in InDesign without InDesign ME</title>
   <link href="http://feeds.andrewheiss.com/~r/AndrewHeiss/~3/ipuW5mdF0Y0/" />
   <updated>2007-09-17T00:00:00-06:00</updated>
   <id>http://www.andrewheiss.com/blog/2007/09/17/using-arabic-in-indesign-without-indesign-me</id>
   <content type="html">&lt;p&gt;About a year ago I discovered to my dismay that using Arabic in InDesign was entirely impossible. &lt;!--more--&gt; I wanted to make a type of dictionary for my Arabic 101 students, using an Excel spreadsheet full of Arabic words. When I placed any Arabic text, though, this happened:&lt;/p&gt;

&lt;p&gt;&lt;img src='http://www.andrewheiss.com/images/arabic-indesign/messed-up-text.png' alt='Messed up Arabic text' /&gt;&lt;/p&gt;

&lt;p&gt;While Microsoft and Apple have great right-to-left (RTL) language support built in, Adobe doesn&amp;#8217;t. InDesign and Illustrator &lt;em&gt;cannot&lt;/em&gt; handle RTL text. Adobe has, however, outsourced their code to &lt;a href='http://www.winsoft.eu/'&gt;WinSoft&lt;/a&gt;, who develops the Creative Suite ME (Middle Eastern edition), which &lt;em&gt;does&lt;/em&gt; have excellent RTL support, especially through the use of their &lt;a href='http://www.winsoft.eu/products_solutions/WinSoft-Tasmeem.php'&gt;Tasmeem&lt;/a&gt; typesetting framework, recently highlighted in &lt;a href='http://www.saudiaramcoworld.com/issue/200704/keyboard.calligraphy.htm'&gt;Saudi Aramco Magazine&lt;/a&gt;. However, I don&amp;#8217;t want to buy the ME version for minimal Arabic use.&lt;/p&gt;

&lt;h4 id='typing_backwards'&gt;Typing backwards&lt;/h4&gt;

&lt;p&gt;The only way around this is to type the text in backwards: if you want the word alkitaab, you would have to type baatikla and InDesign &lt;em&gt;should&lt;/em&gt; show it correctly.&lt;/p&gt;

&lt;p&gt;There&amp;#8217;s one big caveat though—Arabic letters have different forms depending on where they show up in the word (initial, medial, final, or isolated).&lt;/p&gt;

&lt;p&gt;This typing-backwards, faux-RTL works great for Hebrew since almost every letter has the same shape no matter where they are in the word. In fact, &lt;a href='http://indesignsecrets.com/free-script-for-hebrew-or-arabic-text-in-regular-version-of-indesign.php'&gt;InDesignSecrets.com mentioned a script&lt;/a&gt; that will take pasted Hebrew characters and reverse them automatically.&lt;/p&gt;

&lt;p&gt;Unfortunately, Arabic is more complex. There is a clunky solution—hunt and peck with the glyphs panel. This workaround is &lt;em&gt;not&lt;/em&gt; useful for large amounts of Arabic text. If you want to design something with a substantial amount of Arabic, buy InDesign ME. (if you&amp;#8217;re desperate, I guess you &lt;em&gt;could&lt;/em&gt; do an entire book like this. It would just take several months to get the text done :) ).&lt;/p&gt;

&lt;h4 id='typing_with_the_glyphs_panel'&gt;Typing with the glyphs panel&lt;/h4&gt;

&lt;p&gt;The glyphs panel is a great and often underused panel in InDesign. It&amp;#8217;s generally used for finding and inserting dingbat characters or other non-standard glyphs in a font. You can even save your most commonly used glyphs for easy access:&lt;/p&gt;

&lt;p&gt;&lt;img src='http://www.andrewheiss.com/images/arabic-indesign/custom-glyphs.png' alt='Custom glyphs' /&gt;&lt;/p&gt;

&lt;p&gt;You can even type with the glyphs panel, which is how we get Arabic working in InDesign. This method also works for Illustrator and any other Adobe program with a glyphs panel.&lt;/p&gt;

&lt;p&gt;To activate the panel, go to Window &amp;#62; Type &amp;#38; Tables &amp;#62; Glyphs. Choose an Arabic font from the list in the bottom left corner of the panel to load that font into the panel. I like working with the &lt;a href='http://www.microsoft.com/typography/fonts/font.aspx?FID=283&amp;amp;amp;FNAME=Arabic+Typesetting'&gt;Arabic Typesetting&lt;/a&gt; font that comes with Office 2007 because of the dozens of alternate glyphs and ligatures that are available. Microsoft has an excellent collection of Arabic fonts as well, found &lt;a href='http://www.microsoft.com/downloads/details.aspx?FamilyID=A83C0E03-8913-47A3-ACB7-8AC357627620&amp;amp;amp;displaylang=AR'&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You should see normal Roman characters in the panel. Scroll down until you get the Arabic glyphs. Double click on a letter to insert it at your cursor.&lt;/p&gt;

&lt;p&gt;&lt;img src='http://www.andrewheiss.com/images/arabic-indesign/arabic-glyphs.png' alt='Arabic glyph panel' /&gt;&lt;/p&gt;

&lt;p&gt;Here&amp;#8217;s where the magic starts. Many of the glyphs will have a black triangle in the bottom right corner of the grid box. This means that there are alternate glyphs for that character—in this case, different positions for the letter. Click and hold one of the boxes with alternate glyphs and you&amp;#8217;ll see all the different possibilities for that letter.&lt;/p&gt;

&lt;p&gt;&lt;img src='http://www.andrewheiss.com/images/arabic-indesign/all-positions.png' alt='All glyph positions' /&gt;&lt;/p&gt;

&lt;p&gt;To type a full Arabic word, insert the appropriately positioned letters in backwards order using the glyphs panel. Here&amp;#8217;s a live example of this in action (sorry for the horrible quality):&lt;/p&gt;
&lt;p&gt;&lt;object height='300' width='400'&gt;&lt;param name='allowfullscreen' value='true' /&gt;&lt;param name='allowscriptaccess' value='always' /&gt;&lt;param name='movie' value='http://vimeo.com/moogaloop.swf?clip_id=3760188&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1' /&gt;&lt;embed src='http://vimeo.com/moogaloop.swf?clip_id=3760188&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1' allowfullscreen='true' type='application/x-shockwave-flash' allowscriptaccess='always' height='300' width='400' /&gt;&lt;/object&gt;&lt;/p&gt;
&lt;p&gt;You can insert alternate glyphs and ligatures too:&lt;/p&gt;

&lt;p&gt;&lt;img src='http://www.andrewheiss.com/images/arabic-indesign/more-alternate-glyphs.png' alt='Alternate glyphs and ligatures' /&gt;&lt;/p&gt;

&lt;p&gt;If you use a decorative Arabic font, like Microsoft&amp;#8217;s Diwani family (found in the &lt;a href='http://www.microsoft.com/downloads/details.aspx?FamilyID=A83C0E03-8913-47A3-ACB7-8AC357627620&amp;amp;amp;displaylang=AR'&gt;arafonts.exe&lt;/a&gt; font package), you can use the decorative swashes as well. You can even change the font after inserting the letters to another Arabic font and maintain the letters.&lt;/p&gt;

&lt;p&gt;In the end, you&amp;#8217;ll have real Arabic text that can be manipulated just like normal InDesign text. It&amp;#8217;s a clunky method, but it works, as seen &lt;a href='http://www.andrewheiss.com/Portfolio?page=Design'&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This could all probably be automated with a script of sorts, but I&amp;#8217;m no programmer.&lt;/p&gt;

&lt;p&gt;If anyone has comments or suggestions (or knows how to make a script for this), leave a comment below…&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AndrewHeiss/~4/ipuW5mdF0Y0" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://www.andrewheiss.com/blog/2007/09/17/using-arabic-in-indesign-without-indesign-me/</feedburner:origLink></entry>
 
 
</feed>

