<?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>Mon, 20 May 2013 14:01:59 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[PHPMaster.com: Say Hello to Boris: A Better REPL for PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/19397</guid>
      <link>http://www.phpdeveloper.org/news/19397</link>
      <description><![CDATA[<p>
On PHPMaster.com today <i>Shameer C</i> has a new tutorial <a href="http://phpmaster.com/say-hello-to-boris-a-better-repl-for-php/">introducing you to Boris</a>, a REPL (read-eval-print loop tool) that's a bit more enhanced than the basic PHP interactive shell.
</p>
<blockquote>
As web developers, we know the importance of the JavaScript console provided by the browser in testing out code snippets. We don't need to write an entire HTML page and JavaScript code just to verify the functioning or logic of a small routine we wrote. Instead, we simply run the expressions in the console and immediately see the results. Similarly, a REPL (Read-Eval-Print Loop) is the console of a programming language in which we can write code line-by-line and see what it does. [...] PHP's REPL is very good in what it does, although it does have some limitations. [...] And so, Boris tries to solve these problems and other concerns as well. 
</blockquote>
<p>
He walks you through the installation (via a git clone and, later, through Composer) and shows how to run it as well as some sample output. He also shows how to make a custom command-line Boris runner and how to embed it into your application. His example of a tool that would benefit from this is a command-line web service client using Boris and Guzzle.
</p>]]></description>
      <pubDate>Tue, 02 Apr 2013 10:34:00 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[MaltBlue.com: 5 Reasons Coding Standards Are Essential]]></title>
      <guid>http://www.phpdeveloper.org/news/19306</guid>
      <link>http://www.phpdeveloper.org/news/19306</link>
      <description><![CDATA[<p>
<i>Matthew Setter</i> has posted five reasons why he thinks that making a coding standard is an essential part of your development process. <a href="http://www.maltblue.com/software-engineering-2/5-reaons-coding-standards-are-essential">He suggests</a> that "pain avoidance" is one of the key factors, both for new members of the team and for those maintaining it in the future.
</p>
<blockquote>
Whenever you're working on a project, are you consistent? Are you consistent in your coding style, consistent in your documenting, consistent in your database naming conventions? Better yet, do you and your team have a coding standard which you consistently adhere to? If you don't, you're buying yourself and others a world of pain - which is painlessly simple to avoid. Today I'm banging the drum, shouting from the street corner, calling from the cathedral spire, imploring you to do one thing, above all else - pick a coding standard and then BE CONSISTENT!
</blockquote>
<p>His five reasons for implementing (and effectively using) a coding standard are:</p>
<ul>
<li>Poor, Inconsistent Code - Causes You Pain
<li>Your Code is Easier to Read
<li>Your Code is Easier to Understand
<li>Your Code is Easier to Maintain
<li>Your Code is Easier to Collaborate on
</ul>
<p>
Check out <a href="http://www.maltblue.com/software-engineering-2/5-reaons-coding-standards-are-essential">the post</a> for summaries of each point.
</p>]]></description>
      <pubDate>Wed, 13 Mar 2013 10:13:59 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Derick Rethans: Read Preferences wth the MongoDB PHP driver]]></title>
      <guid>http://www.phpdeveloper.org/news/18927</guid>
      <link>http://www.phpdeveloper.org/news/18927</link>
      <description><![CDATA[<p>
<i>Derick Rethans</i> has <a href="http://derickrethans.nl/readpreferences.html">a new post</a> to his site detailing some of the "read" preferences that you can customize in the latest versions of the MongoClient functionality in the MongoDB PHP extension for replica sets and sharing setups.
</p>
<blockquote>
Read Preferences are a new Replica Set and Sharding feature implemented by most <a href="http://mongodb.org/">MongoDB</a> drivers that are supported by <a href="http://10gen.com/">10gen</a>. This functionality requires MongoDB 2.2. In short, Read Preferences allow you to configure from which nodes you prefer the driver reads data from. In a Replica Set environment it is the driver that does the selection of the preferred node, and in a Sharded environment it is the mongos process that routes queries according to the defined Read Preferences.
</blockquote>
<p>
He starts with a look at the read preference types (like "primary", "secondary" and "nearest") how the connection manager works to handle each type. He includes some code samples showing how to configure your MongoClient connections to use these various types of preferences. He also introduces the concept of "tags" for the replica set - aliases to make them a bit easier to identify when making a connection and how to define them in the connection string.
</p>]]></description>
      <pubDate>Thu, 20 Dec 2012 13:41:24 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Eric Holk: How Do We Read Code?]]></title>
      <guid>http://www.phpdeveloper.org/news/18916</guid>
      <link>http://www.phpdeveloper.org/news/18916</link>
      <description><![CDATA[<p>
There's an interesting post on <i>Eric Holk</i>'s blog talking about <a href="http://blog.theincredibleholk.org/blog/2012/12/18/how-do-we-read-code/">how we read code</a> - a look at the results from a psychology experiment that tracked the viewer's eye movement as they scanned through code (complete with <a href="http://www.youtube.com/watch?feature=player_embedded&v=Jc8M9-LoEuo">video</a>).
</p>
<blockquote>
The goal is to figure out some way of measuring what features in programming systems help programmers understand wht they are doing, and how this can be used to make systems that lead to higher quality software. Mike is currently running an experiment where he shows people several short Python programs and asks them to tell the output of the program. The test subject is sitting in front of an eye tracker, so afterwards Mike can see where you were looking at various times during the experiment.
</blockquote>
<p>
The results are pretty interesting and <i>Eric</i> likens it to a sort of "just-in-time compilation" that the mind is doing as it reads through the code, not a straight forward read through. The timing of the read is interesting too, noting that once something is figured out, it's run through faster the following times.
</p>
<blockquote>
One aspect he's interested in is how the approach of inexperienced programmers differs from that of experienced programmers. For example, there seems to be some evidence that following variable naming conventions helps experienced programmers understand the code much quicker, while breaking these conventions leads to a severe penalty. On the other hand, inexperienced programmers seem to take about as long regardless of how the variables are named.
</blockquote>
<p>
This study is still going on and, if you're in the Bloomington, Indiana area and would like to lend your eyes to the cause, send an email over to <a href="mailto:mihansen@indiana.edu">Mike Hansen</a> (more on the subject on his blog <a href="http://synesthesiam.com/?p=218">here</a>).
</p>]]></description>
      <pubDate>Wed, 19 Dec 2012 10:36:28 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[ZetCode.com: PostgreSQL PHP Tutorial]]></title>
      <guid>http://www.phpdeveloper.org/news/17918</guid>
      <link>http://www.phpdeveloper.org/news/17918</link>
      <description><![CDATA[<p>
On the ZetCode.com site there's a <a href="http://zetcode.com/db/postgresqlphp/">five part tutorial</a> posted about getting your PHP application up and running on a PostgreSQL database (updated on the 4th).
</p>
<blockquote>
This is a PHP tutorial for the PostgreSQL database. It covers the basics of PostgreSQL programming with PHP. The examples were created and tested on Linux. [...] PostgreSQL is a powerful, open source object-relational database system. It is a multi-user, multi-threaded database management system. It runs on multiple platforms including Linux, FreeBSD, Solaris, Microsoft Windows and Mac OS X. PostgreSQL is developed by the PostgreSQL Global Development Group.
</blockquote>
<p>The chapters guide you through every step you'll need:</p>
<ul>
<li><a href="http://zetcode.com/db/postgresqlphp/intro/">An introduction to PostgreSQL</a> and getting it and PHP support installed (with the php5-pgsql package)
<li>Example code showing how to <a href="http://zetcode.com/db/postgresqlphp/read/">extract data</a> from your tables
<li><a href="http://zetcode.com/db/postgresqlphp/images/">Working with images</a> and storing their data in a table
<li>Pulling out the <a href="http://zetcode.com/db/postgresqlphp/meta/">metadata from the database</a>, things like number of rows returned and table information
<li><a href="http://zetcode.com/db/postgresqlphp/trans/">Transactions</a> and database-side processing
</ul>]]></description>
      <pubDate>Mon, 07 May 2012 11:14:40 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Anthony Wlodarski's Blog: Node.js and Zend Auth with Sessions stored in the database]]></title>
      <guid>http://www.phpdeveloper.org/news/17637</guid>
      <link>http://www.phpdeveloper.org/news/17637</link>
      <description><![CDATA[<p>
<i>Anthony Wlodarski</i> has <a href="http://anthonyw.net/2012/03/node-js-and-zend-auth-with-sessions-stored-in-the-database/">posted a quick example</a> of how he shared the sessions from <a href="http://framework.zend.com/manual/en/zend.auth.html">Zend_Auth</a> in his Zend Framework application over with a Node.js server/application.
</p>
<blockquote>
Recently on a project I had to make changes to a underlying portion of the sites architecture to move sessions in Zend Framework from file storage to database storage. However this affected a piece of the architecture. Node.js, which manages all our real time interaction, looked at sessions at the file level. This was quite a easy transition for the function as it was abstracted away in a function call so the theory was to just replace the function "guts" with a new component.
</blockquote>
<p>
The post shows the code he came from (which pulled in the PHP session file and extracted the session data manually) over to a new database-based version that selects from the SESSIONS table and pulls out the data. It's based on the table having an "id" column and the Zend_Auth namespace it uses.
</p>]]></description>
      <pubDate>Wed, 07 Mar 2012 09:50:46 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed: Handling File Data with PHP (Reading & Seeking)]]></title>
      <guid>http://www.phpdeveloper.org/news/17196</guid>
      <link>http://www.phpdeveloper.org/news/17196</link>
      <description><![CDATA[<p>
DevShed has posted the fifth part of their "handling files in PHP" tutorial series today (excerpted from the book "Beginning PHP and PostgreSQL 8: From Novice to Professional") with a focus on <a href="http://www.devshed.com/c/a/PHP/Handling-File-Data-with-PHP/">read from multiple places in a file</a> to get to different data.
</p>
<blockquote>
In this fifth part of an eight-part series on working with file and operating systems with PHP, you'll learn how to read data from a file and move the file pointer. 
</blockquote>
<p>
Example code is included showing how to use the <a href="http://php.net/file">file</a>, <a href="http://php.net/file_get_contents">file_get_contents</a>, <a href="http://php.net/fgetc">fgetc</a>, <a href="http://php.net/fgetcsv">fgetcsv</a>, <a href="http://php.net/readfile">readfile</a> and <a href="http://php.net/fscanf">fscanf</a> (among several others). Also included is code showing how to use the <a href="http://php.net/fseek">fseek</a> method to move around in a file.
</p>]]></description>
      <pubDate>Thu, 01 Dec 2011 10:09:14 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Gonzalo Ayuso's Blog: Checking the performance reading arrays with PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/16724</guid>
      <link>http://www.phpdeveloper.org/news/16724</link>
      <description><![CDATA[<p>
While admitting that micro-optimizations aren't usually worth the time that's taken to worry about them, <i>Gonzalo Ayuso</i> has thrown together some <a href="http://gonzalo123.wordpress.com/2011/08/15/checking-the-performance-reading-arrays-with-php/">array read benchmarks</a> to show the difference, if any, in where array values are fetched.
</p>
<blockquote>
Normally our code is coded once and executed thousands of times, and we must keep in mind that CPU time many times means money. We need to balance it (as always). But, WTH. I like micro-optimizations, and here comes another one: Checking the access to arrays with PHP.
</blockquote>
<p>
He sets up three different options and tests the memory consumption and run time for each:
</p>
<ul>
<li>Referencing a value from a large array outside a for loop
<li>Referencing a value from a large array inside a for loop
<li>Echoing out the value from a large array inside a for loop
</ul>
<p>
Not surprisingly, all three approaches yield just about the same results. It probably has more to do with the size of the large array than how it's accessed. The fetch outside the for loop did come in slightly under the others, but not enough to worry about it.
</p>]]></description>
      <pubDate>Tue, 16 Aug 2011 11:46:07 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Sameer Borate's Blog: Read the version of a PDF in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/16621</guid>
      <link>http://www.phpdeveloper.org/news/16621</link>
      <description><![CDATA[<p>
<i>Sameer Borate</i> has a quick post to his blog today with some code that lets you <a href="http://www.codediesel.com/php/read-the-version-of-a-pdf-in-php/">read the version of a PDF document</a> programmatically without a dependency on a PDF extension or library being installed.
</p>
<blockquote>
The following [example] is a very short code to read the version number of a PDF document using PHP. I needed this recently during a PDF processing app developed in PHP. As Adobe uses different compression methods in various versions, it becomes necessary to be able to identify the version of the PDF under work.
</blockquote>
<p>
<a href="http://www.codediesel.com/php/read-the-version-of-a-pdf-in-php/">The code</a> opens the file with a <a href="http://php.net/fopen">fopen</a> and parses a certain line for the major and minor version. The PDF extension for PHP can do something similar with the <a href="http://www.php.net/manual/en/function.pdf-get-value.php">pdf_get_value</a> function passing in either "major" or "minor" as the second parameter.
</p>]]></description>
      <pubDate>Fri, 22 Jul 2011 09:54:18 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Gonzalo Ayuso's Blog: Howto Send/Read SMSs using a GSM modem, AT+ commands and PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/16077</guid>
      <link>http://www.phpdeveloper.org/news/16077</link>
      <description><![CDATA[<p>
<i>Gonzalo Ayuso</i> has a new post to his blog today showing how you can <a href="http://gonzalo123.wordpress.com/2011/03/21/howto-sendread-smss-using-a-gsm-modem-at-commands-and-php/">send and read SMS messages</a> with PHP through a GSM modem. The AT+ commands they use can be sent via a serial (or serial-to-usb) interface directly from your application to a local device. He includes both code and some sample AT commands to get the ball rolling.
</p>
<blockquote>
GSM modems are similar than normal modems. They've got a SIM card and we can do the same things we can do with a mobile phone, but using AT and AT+ commands programmatically. That's means we can send (and read) SMSs and create scripts to perform those operations. [...] The idea is the following one: We are going to create a main class called Sms. It takes in the constructor (via dependency injection) the HTTP wrapper or the serial one (both with the same interface). 
</blockquote>
<p>
His base SMS class provides open, close and read methods that talk with the device set in a child class (in this case "/dev/ttySO"). The sendSMS method is defined to take in the number to send to and the message. The AT command examples show how to send the SMS message, read all of the messages waiting and delete an SMS from the device. You can get the full code <a href="https://github.com/gonzalo123/gam-sms">from github</a>.
</p>]]></description>
      <pubDate>Tue, 22 Mar 2011 08:15:27 -0500</pubDate>
    </item>
  </channel>
</rss>
