<?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>Karoshi Ethos &#187; PHP</title>
	<atom:link href="http://karoshiethos.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://karoshiethos.com</link>
	<description>Navigating the treacherous waters of interactive technology</description>
	<lastBuildDate>Wed, 09 Jun 2010 19:33:45 +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>Blogger Feed Displayed in Flash Crashing FireFox 3, With Fix</title>
		<link>http://karoshiethos.com/2009/07/25/blogger-feed-displayed-in-flash-crashing-firefox-3-with-fix/</link>
		<comments>http://karoshiethos.com/2009/07/25/blogger-feed-displayed-in-flash-crashing-firefox-3-with-fix/#comments</comments>
		<pubDate>Sun, 26 Jul 2009 03:47:07 +0000</pubDate>
		<dc:creator>Rob Ruchte</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Things that are broken]]></category>
		<category><![CDATA[Blogger]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://karoshiethos.com/?p=420</guid>
		<description><![CDATA[Recently, Blogger began appending a tracking gif to the content of each entry in their Atom feeds. The URL used in the image src uses https, most likely to avoid warnings when it's rendered in a https context. For some reason, when rendering the feed content containing the tracking image, the Flash player can crash, [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, Blogger began appending a tracking gif to the content of each entry in their Atom feeds. The URL used in the image src uses https, most likely to avoid warnings when it's rendered in a https context. For some reason, when rendering the feed content containing the tracking image, the Flash player can crash, taking the browser with it on certain platform/browser combinations. We found the problem in FireFox 3.0 on OSX, but only on PPC Macs. Go figure.</p>
<p>In our case, we are proxying the Atom feed through a PHP script so we can display the feed contents to user agents without the Flash player. This made it fairly easy to  iterate through the entries, and with a simple bit of regex, strip out the offending markup from the contents.</p>
<p>Blogger is wrapping the image tag in a div with a very specific CSS class, which makes our job easy:</p>
<div class="code"><code><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 119, 0);">foreach(</span><span style="color: rgb(0, 0, 187);">$feed</span><span style="color: rgb(0, 119, 0);">-&gt;</span><span style="color: rgb(0, 0, 187);">entries&nbsp;</span><span style="color: rgb(0, 119, 0);">as&nbsp;</span><span style="color: rgb(0, 0, 187);">$currEntry</span><span style="color: rgb(0, 119, 0);">)<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 187);">$currEntry</span><span style="color: rgb(0, 119, 0);">-&gt;</span><span style="color: rgb(0, 0, 187);">content&nbsp;</span><span style="color: rgb(0, 119, 0);">=&nbsp;</span><span style="color: rgb(0, 0, 187);">ereg_replace</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">'&lt;div&nbsp;class=\&quot;blogger-post-footer\&quot;&gt;.*&lt;/div&gt;'</span><span style="color: rgb(0, 119, 0);">,&nbsp;</span><span style="color: rgb(221, 0, 0);">''</span><span style="color: rgb(0, 119, 0);">,&nbsp;</span><span style="color: rgb(0, 0, 187);">$currEntry</span><span style="color: rgb(0, 119, 0);">-&gt;</span><span style="color: rgb(0, 0, 187);">content</span><span style="color: rgb(0, 119, 0);">);<br />
}</span></span></code></div>
<p>Depending on what you're using to parse the feed, you may or may not need to be concerned about decoding and encoding html entities during this process.</p>
]]></content:encoded>
			<wfw:commentRss>http://karoshiethos.com/2009/07/25/blogger-feed-displayed-in-flash-crashing-firefox-3-with-fix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Smarty File Size Modifier</title>
		<link>http://karoshiethos.com/2009/05/02/smarty-file-size-modifier/</link>
		<comments>http://karoshiethos.com/2009/05/02/smarty-file-size-modifier/#comments</comments>
		<pubDate>Sun, 03 May 2009 02:30:59 +0000</pubDate>
		<dc:creator>Rob Ruchte</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Smarty]]></category>

		<guid isPermaLink="false">http://karoshiethos.com/?p=342</guid>
		<description><![CDATA[Here's a simple Smarty modifier that will format an integer that represents the number of bytes in a file as a human readable string.
Usage:
{$fileSizeInBytes&#124;file_size}
Example:
{assign var=fileSizeInBytes value=10485760}
{$fileSizeInBytes&#124;file_size}
{assign var=fileSizeInBytes value= 768000}
{$fileSizeInBytes&#124;file_size}
{assign var=fileSizeInBytes value=303}
{$fileSizeInBytes&#124;file_size}
Output:
10 MB
750 Kb
303 bytes
&#160;
&#60;?php
/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */
&#160;
/**
 * Smarty file_size modifier plugin
 *
 * Type:    [...]]]></description>
			<content:encoded><![CDATA[<p>Here's a simple <a href="http://smarty.net/">Smarty</a> modifier that will format an integer that represents the number of bytes in a file as a human readable string.</p>
<p><strong>Usage:</strong><br />
{$fileSizeInBytes|file_size}</p>
<p><strong>Example:</strong><br />
{assign var=fileSizeInBytes value=10485760}<br />
{$fileSizeInBytes|file_size}</p>
<p>{assign var=fileSizeInBytes value= 768000}<br />
{$fileSizeInBytes|file_size}</p>
<p>{assign var=fileSizeInBytes value=303}<br />
{$fileSizeInBytes|file_size}</p>
<p><strong>Output:</strong><br />
10 MB<br />
750 Kb<br />
303 bytes</p>
<pre class="php">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #808080; font-style: italic;">/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/**
 * Smarty file_size modifier plugin
 *
 * Type:     modifier&lt;br&gt;
 * Name:     file_size&lt;br&gt;
 * Purpose:  format file size represented in bytes into a human readable string&lt;br&gt;
 * Input:&lt;br&gt;
 *         - bytes: input bytes integer
 * @author   Rob Ruchte &lt;rob at thirdpartylabs dot com&gt;
&nbsp;
 * @param integer
 * @return string
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> smarty_modifier_file_size<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bytes</span>=<span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #0000ff;">$mb</span> = <span style="color: #cc66cc;">1024</span>*<span style="color: #cc66cc;">1024</span>;
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bytes</span> &gt; <span style="color: #0000ff;">$mb</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#123;</span>
        <span style="color: #0000ff;">$output</span> = <a href="http://www.php.net/sprintf"><span style="color: #000066;">sprintf</span></a> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;%01.2f&quot;</span>,<span style="color: #0000ff;">$bytes</span>/<span style="color: #0000ff;">$mb</span><span style="color: #66cc66;">&#41;</span> . <span style="color: #ff0000;">&quot; MB&quot;</span>;
    <span style="color: #66cc66;">&#125;</span>
    <span style="color: #b1b100;">elseif</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$bytes</span> &gt;= <span style="color: #cc66cc;">1024</span> <span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#123;</span>
        <span style="color: #0000ff;">$output</span> = <a href="http://www.php.net/sprintf"><span style="color: #000066;">sprintf</span></a> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;%01.0f&quot;</span>,<span style="color: #0000ff;">$bytes</span>/<span style="color: #cc66cc;">1024</span><span style="color: #66cc66;">&#41;</span> . <span style="color: #ff0000;">&quot; Kb&quot;</span>;
    <span style="color: #66cc66;">&#125;</span>
    <span style="color: #b1b100;">else</span>
    <span style="color: #66cc66;">&#123;</span>
        <span style="color: #0000ff;">$output</span> = <span style="color: #0000ff;">$bytes</span> . <span style="color: #ff0000;">&quot; bytes&quot;</span>;
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">$output</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* vim: set expandtab: */</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://karoshiethos.com/2009/05/02/smarty-file-size-modifier/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Installing PDO_MYSQL on CentOS (the easy way)</title>
		<link>http://karoshiethos.com/2008/07/24/installing-pdo_mysql-on-centos/</link>
		<comments>http://karoshiethos.com/2008/07/24/installing-pdo_mysql-on-centos/#comments</comments>
		<pubDate>Thu, 24 Jul 2008 17:14:56 +0000</pubDate>
		<dc:creator>Rob Ruchte</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Carbon]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://karoshiethos.com/?p=37</guid>
		<description><![CDATA[When deploying LAMP projects, quite often we find ourselves being given access to a newly installed server with distribution-specific default configurations, which are usually very stripped down. Our Carbon Content Management Toolkit, which runs on top of the Zend Framework, uses the PDO_MYSQL driver for data access, along with a few other modules that are [...]]]></description>
			<content:encoded><![CDATA[<p>When deploying LAMP projects, quite often we find ourselves being given access to a newly installed server with distribution-specific default configurations, which are usually very stripped down. Our <a href="http://thirdpartylabs.com/services/cms">Carbon Content Management Toolkit</a>, which runs on top of the <a href="http://framework.zend.com/">Zend Framework</a>, uses the <a href="http://pecl.php.net/package/PDO_MYSQL">PDO_MYSQL</a> driver for data access, along with a few other modules that are typically present in commercial hosting environments, but not always included in an OS's default PHP build.</p>
<p>Getting <a href="http://pear.php.net/">PEAR</a>, <a href="http://pecl.php.net/">PECL</a>, and a build environment set up can be a time consuming process if you do it from scratch. Luckily most OSs these days come with easy to use package management systems that take care of downloading, building, and installing the packages you need, and their dependancies.</p>
<p>Check the <a href="http://en.wikipedia.org/wiki/Package_management_system">package management system</a> entry on Wikipedia if you're unsure about which package system your OS uses. Each one works a little bit differently, but the concepts are the same. You're going to need to set up your OS's version of the following packages in order to make your life easy:</p>
<p>php-devel<br />
php-pear<br />
mysql-devel<br />
httpd-devel</p>
<p>The package names will differ a bit for each system. The following example uses the <a href="http://wiki.centos.org/PackageManagement/Yum">Yum package manager</a> in <a href="http://centos.org/">CentOS</a>, and gets PDO_MYSQL up and running in just a few minutes.</p>
<p><code class="console"># yum install php-devel php-pear mysql-devel httpd-devel<br />
# pecl install pdo<br />
# PHP_PDO_SHARED=1 pecl install pdo_mysql</code></p>
<p>Add these lines to php.ini:</p>
<p><code class="console">extension=pdo.so<br />
extension=pdo_mysql.so</code></p>
<p>Now restart Apache, and you should see your PDO modules in phpinfo(), Robert's your father's brother.<br />
<code class="console"># apachectl restart</code></p>
<p>If you need to actually <a href="http://www.php.net/manual/en/install.unix.php">make a custom PHP build</a>, you should have everything you need to do that after installing the devel packages. You still may need to build any dependancies that your custom PHP build requires, but your package system should make that fairly easy.</p>
]]></content:encoded>
			<wfw:commentRss>http://karoshiethos.com/2008/07/24/installing-pdo_mysql-on-centos/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
