<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Thu, 20 Jun 2013 04:01:08 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[DZone.com: Self-Initializing Fakes in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/17211</guid>
      <link>http://www.phpdeveloper.org/news/17211</link>
      <description><![CDATA[<p>
In a new post over on DZone.com <i>Giorgio Sironi</i> shows how to <a href="http://css.dzone.com/articles/self-initializing-fakes-php">create a fake</a>, an interface that mocks the interface to an external tool and provides cached results back to the calling script.
</p>
<blockquote>
We can specialize our Fake in a Self-Initializing Fake, which will provide an alternative implementation with the aid of the real one. In our Google Maps case, the Fake will use the real web service for its first response, and maintain an internal cache. This mechanism provides insurance about out-of-sync responses, and lets you enjoy the speed of unit tests after the initial warmup: if you always use the same data, no duplicate requests will be made to the external resource.
</blockquote>
<p>
He includes example code for creating a test (with <a href="http://phpunit.de">PHPUnit</a>) that loads in the information from the Google Maps web service and caches it into a private variable inside the Fake. His test fails the first time checking for a difference in the time between fetching the real version and the cached version (fails the first time, but passes after the cache is implemented).
</p>]]></description>
      <pubDate>Mon, 05 Dec 2011 10:03:53 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Ian Barber's Blog: Benford's Law]]></title>
      <guid>http://www.phpdeveloper.org/news/16147</guid>
      <link>http://www.phpdeveloper.org/news/16147</link>
      <description><![CDATA[<p>
In a recent post to his blog <i>Ian Barber</i> looks at <a href="http://phpir.com/benfords-law">applying Benford's Law in PHP</a> to determine if the dataset you're working with is "real" or not.
</p>
<blockquote>
Benfords Law is not an exciting new John Nettles based detective show, but an interesting observation about the distribution of the first digit in sets of numbers originating from various processes. It says, roughly, that in a big collection of data you should expect to see a number starting with 1 about 30% of the time, but starting with 9 only about 5% of the time.
</blockquote>
<p>
He pulls data from <a href="http://data.gov.uk/dataset/financial-transactions-data-science-and-technology-facilities-council">the data.uk.gov site</a> to illustrate and includes a simple PHP script to run through the data looking scoring it with a "Benford" rating. He plots these on a graph along side the data to show the (almost exact) match between the data and the Benford numbers. You can find more details on the law <a href="http://en.wikipedia.org/wiki/Benford%27s_law">on Wikipedia</a>.
</p>]]></description>
      <pubDate>Tue, 05 Apr 2011 09:12:46 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Mikko Koppanen's Blog: Fake uploading files]]></title>
      <guid>http://www.phpdeveloper.org/news/12078</guid>
      <link>http://www.phpdeveloper.org/news/12078</link>
      <description><![CDATA[<p>
<i>Mikko Koppanen</i> has <a href="http://valokuva.org/?p=132">posted about</a> an extension he's written up that has only one real purpose - to help with unit testing a script with a file upload involved (making a "fake upload" possible).
</p>
<blockquote>
The extension is doing things that shouldn't be done, it probably doesn't even run anywhere else than on CLI, it is insecure, it might behave incorrectly but in this scenario it worked fine so I decided to share it.
</blockquote>
<p>
This "use at your own risk" extension gives you a new function to use instead of the normal <a href="http://php.net/move_uploaded_file">move_uploaded_file</a>, appropriately named "fakeupload_file". It creates the fake file so that even calls to <a href="http://php.net/is_uploaded_file">is_uploaded_file</a> will see it as if it was correctly on the file system. An <a href="http://php.net/unlink">unlink</a> is all that's needed to remove the "file".
</p>]]></description>
      <pubDate>Fri, 06 Mar 2009 08:44:39 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Alexey Zakhlestin's Blog: FastCGI in PHP - The way it could be.]]></title>
      <guid>http://www.phpdeveloper.org/news/5558</guid>
      <link>http://www.phpdeveloper.org/news/5558</link>
      <description><![CDATA[<p>
<i>Alexey Zakhlestin</i> shares with us in <a href="http://blog.milkfarmsoft.com/?p=4">this new blog post</a>, how the fast-cgi PHP developers think they're using isn't really a true FastCGI.
</p>
<quote>
<i>
Most PHP programmers believe, that PHP has support for FastCGI. They refer to fastcgi-sapi, which is bundled with php since long ago, and which was recently reimplemented for PHP 5.1.3/4. This SAPI really does exist and actually working quite good. But… it is not a real fast-cgi. It is just an imitation of mod_php which is linked against fastcgi api, instead of apache api. So, it's time for you to ask: if it exists and works, then what am I talking here about? Let's start from the basics...
</i>
</quote>
<p>
He <a href="http://blog.milkfarmsoft.com/?p=4">talks about</a> a history of how things go to where they are, starting back with regular CGI scripts, moving up through using server-based APIs, and finally to FastcGI, a method for overcoming a lot of the limitations of its predecessors.
</p>
<p>
With that look back, he turns his attention around and looks to the current situation within PHP. He talks about the sudden appearance fastcgi made in PHP's SAPIs, but that the implementation wasn't true. He suggests that the reasoning behind this "fake" implementation was for the sake of speed. He also notes, however, it's his opinion that true FastCGI support in PHP will be a requirement for future large-scale applications.
</p>]]></description>
      <pubDate>Sun, 11 Jun 2006 13:26:04 -0500</pubDate>
    </item>
  </channel>
</rss>
