<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Common Media, Inc. &#187; Code</title>
	<atom:link href="http://www.commonmediainc.com/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.commonmediainc.com</link>
	<description>Online Communities and Web Development</description>
	<lastBuildDate>Tue, 20 Jul 2010 15:19:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Simple Perl scripts for OS X users using Platypus</title>
		<link>http://www.commonmediainc.com/2010/07/12/simple-perl-scripts-for-os-x-users-using-platypus/</link>
		<comments>http://www.commonmediainc.com/2010/07/12/simple-perl-scripts-for-os-x-users-using-platypus/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 14:31:43 +0000</pubDate>
		<dc:creator>pjmorse</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Mac OS]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://www.commonmediainc.com/?p=195</guid>
		<description><![CDATA[Maybe everyone who&#8217;s ever done anything with Perl has written an email extraction script, but a recent client request asked us to take it one step further: allow the script to function as a Mac OS X &#8220;droplet.&#8221; In other words, the script should be an icon in the Finder, and when files are dragged [...]]]></description>
			<content:encoded><![CDATA[<p>Maybe everyone who&#8217;s ever done anything with Perl has written <a title="XKCD: Regular Expressions" href="http://xkcd.com/208/">an email extraction script</a>, but a recent client request asked us to take it one step further: allow the script to function as a Mac OS X &#8220;droplet.&#8221; In other words, the script should be an icon in the Finder, and when files are dragged and dropped on the icon, it should run the script.</p>
<p>This was easy in the days of Mac OS 9 and MacPerl; because there was no Unix core to the Mac OS, MacPerl was the only Perl environment, and the MacPerl environment took care of things like drag-and-drop file access (after all, that was the only way to provide a filename as an argument to a Perl script on a Mac.) Nowadays, with a standard Unix-y Perl shipping with the Mac OS, MacPerl is no longer needed, but the handy drag-and-drop functions aren&#8217;t there.</p>
<p>Filling the gap is <a title="Platypus makes Mac OS applications by bundling scripts" href="http://www.sveinbjorn.org/platypus">Platypus</a>, a handy little utility which makes application bundles out of Unix scripts. Notice I didn&#8217;t say &#8220;Perl&#8221; there. Platypus plays nicely with shell scripts, Python, PHP, Ruby, and Tcl just as easily as Perl. As the developer describes it, &#8220;this is done by wrapping the script in an application bundle directory  structure along with an executable binary that runs the script.&#8221;</p>
<p>Advanced options allow you to configure how script output is shown, whether to allow dropped files as input (you can also filter which file types are accepted) and what to do at script conclusion.</p>
<p>In the case of our email extraction utility, which originally spat out the addresses it found on <code>STDOUT</code>, we found that displaying the script output in a text window for some reason only read one input file. We adjusted the script to write output to a file, then used the text window to show which files were read and the path to the output file (as well as any errors), and that adjustment allowed for multiple input files.</p>
<p>If you&#8217;ve ever wanted to double-click your scripts rather than running them from the command line, <a href="http://www.sveinbjorn.org/platypus">give Platypus a look</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.commonmediainc.com/2010/07/12/simple-perl-scripts-for-os-x-users-using-platypus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick HTML/CSS demo</title>
		<link>http://www.commonmediainc.com/2010/05/07/quick-htmlcss-demo/</link>
		<comments>http://www.commonmediainc.com/2010/05/07/quick-htmlcss-demo/#comments</comments>
		<pubDate>Fri, 07 May 2010 14:26:44 +0000</pubDate>
		<dc:creator>noah</dc:creator>
				<category><![CDATA[Clients]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[XHTML/CSS]]></category>

		<guid isPermaLink="false">http://www.commonmediainc.com/?p=170</guid>
		<description><![CDATA[People often ask us what we do when a designer sends over a PSD, so I made some screen captures from the early stages of a recent build. Next time we&#8217;ll do a longer one, right through getting all the fonts and images perfect.
Design by our friend Justin Zucco, and I&#8217;ll post a link to [...]]]></description>
			<content:encoded><![CDATA[<p>People often ask us what we do when a designer sends over a PSD, so I made some screen captures from the early stages of a recent build. Next time we&#8217;ll do a longer one, right through getting all the fonts and images perfect.</p>
<p>Design by our friend <a href="http://justinzucco.com/print-portfolio-hb-identity.html" target="_blank">Justin Zucco</a>, and I&#8217;ll post a link to the live site (Balmat Law) when it goes live in a week or two.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="566" height="342" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/mSC84CUx_Uk&amp;hl=en_US&amp;fs=1&amp;rel=0" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="566" height="342" src="http://www.youtube.com/v/mSC84CUx_Uk&amp;hl=en_US&amp;fs=1&amp;rel=0" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><a href="http://www.youtube.com/watch?v=mSC84CUx_Uk">http://www.youtube.com/watch?v=mSC84CUx_Uk</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.commonmediainc.com/2010/05/07/quick-htmlcss-demo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python package trouble? Check your python</title>
		<link>http://www.commonmediainc.com/2009/12/19/python-package-trouble-check-your-python/</link>
		<comments>http://www.commonmediainc.com/2009/12/19/python-package-trouble-check-your-python/#comments</comments>
		<pubDate>Sat, 19 Dec 2009 20:45:36 +0000</pubDate>
		<dc:creator>pjmorse</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.commonmediainc.com/?p=133</guid>
		<description><![CDATA[This is exactly the sort of low-level stuff you&#8217;d think everyone should know, but I searched an error message today and didn&#8217;t get a useful answer. I found one, so here it is for the next searcher.
If you&#8217;re trying to build a Python package (in my case, the ReportLab toolkit), and your build fails with [...]]]></description>
			<content:encoded><![CDATA[<p>This is exactly the sort of low-level stuff you&#8217;d think everyone should know, but I searched an error message today and didn&#8217;t get a useful answer. I found one, so here it is for the next searcher.</p>
<p>If you&#8217;re trying to build a Python package (in my case, <a title="Reportlab Toolkit (in Python)" href="http://www.reportlab.org/oss/rl-toolkit/">the ReportLab toolkit</a>), and your build fails with a string of error messages starting with <code>Python.h: No such file or directory</code>, the problem is that the package includes some amount of code which is written in C. The build is trying to compile that code, and the C compiler is looking for the Python C headers, and for most Linux users (I ran in to this on an Ubuntu system) the C headers aren&#8217;t part of the core Python package. You need the <code>python-dev</code> package. Try this:</p>
<p><code>sudo apt-get install python-dev</code></p>
<p>Then try your build again; I bet it will work.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.commonmediainc.com/2009/12/19/python-package-trouble-check-your-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XSL namespaces for HTML output</title>
		<link>http://www.commonmediainc.com/2009/07/15/xsl-namespaces-for-html-output/</link>
		<comments>http://www.commonmediainc.com/2009/07/15/xsl-namespaces-for-html-output/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 20:30:08 +0000</pubDate>
		<dc:creator>pjmorse</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[namespaces]]></category>
		<category><![CDATA[xhtml]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[xsl]]></category>
		<category><![CDATA[xslt]]></category>

		<guid isPermaLink="false">http://www.commonmediainc.com/?p=114</guid>
		<description><![CDATA[One of our current projects involves an application where certain PHP scripts request XML from a SOAP service, then use XSL templates combined with parameters set by the PHP script to generate XHTML from that XML.  (Follow that? If not, you may be able to safely skip this.) We haven&#8217;t had to cope with setting [...]]]></description>
			<content:encoded><![CDATA[<p>One of our current projects involves an application where certain <abbr title="Hypertext PreProcessor">PHP</abbr> scripts request <abbr title="eXtensible Markup Language">XML</abbr> from a <abbr title="ahh, whatever">SOAP</abbr> service, then use <abbr title="XML Style Language">XSL</abbr> templates combined with parameters set by the PHP script to generate <abbr title="HyperText Markup Language">XHTML</abbr> from that XML.  (Follow that? If not, you may be able to safely skip this.) We haven&#8217;t had to cope with setting up this system, but we did have to update the HTML produced by the <abbr title="XSL Transformation">XSLT</abbr>, if that&#8217;s the proper verb.</p>
<p>The problem we ran in to was getting around Internet Explorer&#8217;s <a href="http://www.quirksmode.org/css/quirksmode.html">quirks mode</a>. The original XSL templates use a bare <code>xsl:output</code> tag with few options, and a bare <code>html</code> tag to start the output code as well, like this:</p>
<pre>&lt;xsl:output method="html" indent="yes"/&gt;
&lt;html&gt;</pre>
<p>This produces HTML with no document type and no <a href="http://www.xml.com/pub/a/2001/04/04/trxml/index.html">XML namespace</a>, which means IE is going to go to Quirks Mode, which we don&#8217;t want because it hurts our carefully-crafted <abbr title="Cascading Style Sheets">CSS</abbr>. We want something more like this:</p>
<pre>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/
xhtml1/DTD/xhtml1-strict.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:
lang="en" lang="en"&gt;</pre>
<p>First, we tried just adding the <code>xmlns</code> attributes to our <code>html</code> tag. This didn&#8217;t really help: it added extraneous <code>xmlns=""</code> attributes to many of the child tags in the output document, which quirkified <abbr title="Internet Explorer">IE</abbr> just as much as not having the tag.</p>
<p>Solving the second part of the first problem (<a href="http://www.xml.com/pub/a/2002/09/04/xslt.html?page=2">producing a document type tag</a>) turned out to also be the solution to the second problem (extraneous <code>xmlns</code> attributes). XSLT will add a document type tag automatically if the appropriate attributes are given to the <code>xsl:output</code> tag. Specifically, we wound up with this:</p>
<pre>&lt;xsl:output method="html" indent="yes" encoding="utf-8"
    doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" /&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;</pre>
<p>Notice the bonus <code>encoding</code>, <code>doctype-public</code> and <code>doctype-system</code> attributes. That got us the <code>DOCTYPE</code> tag shown above, and bailed us out of IE Quirks Mode.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.commonmediainc.com/2009/07/15/xsl-namespaces-for-html-output/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
