<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Planet PHP</title><link rel="alternate" type="text/html" href="http://www.planet-php.net/"/><link rel="self" type="text/html" href="http://www.planet-php.net/atom/"/><subtitle>People blogging about PHP</subtitle><id>http://www.planet-php.net/</id><generator uri="http://planet-php.net/">
            Planet PHP Aggregator
            </generator><updated>2010-03-10T23:28:00Z</updated><link rel="hub" href="http://pubsubhubbub.appspot.com"/><entry><title type="text">Slides from my Confoo.ca talk now online</title><link rel="alternate" type="text/html" href="http://jmertic.wordpress.com/2010/03/10/slides-from-my-confoo-ca-talk-now-online/" title="Slides from my Confoo.ca talk now online"/><link rel="shortlink" type="text/html" href="http://planet-php.org/~jkm" title="Shortlink to http://jmertic.wordpress.com/2010/03/10/slides-from-my-confoo-ca-talk-now-online/"/><author><name>John Mertic</name></author><id>http://jmertic.wordpress.com/?p=77</id><updated>2010-03-10T23:28:00Z</updated><published>2010-03-10T23:28:00Z</published><content type="html"><![CDATA[<p>I’ve just uploaded the slides from my <a href="http://confoo.ca">confoo.ca</a> talk <a href="http://confoo.ca/en/2010/session/making-software-management-tools-work-for-you">“Making software management tools work for you”</a>. You can download the slides from <a href="http://jmertic.files.wordpress.com/2010/03/confoo-ca-2010-making-software-management-tools-for-you.pdf">here</a>.</p>
<p>Thanks again to everyone who attended! Please give me feedback on <a href="http://joind.in/1302">joind.in</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jmertic.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jmertic.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jmertic.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jmertic.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jmertic.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jmertic.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jmertic.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jmertic.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jmertic.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jmertic.wordpress.com/77/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jmertic.wordpress.com&blog=482442&post=77&subd=jmertic&ref=&feed=1" />]]></content></entry><entry><title type="text">Performance tuning a server in less than three minutes while being slashdotted</title><link rel="alternate" type="text/html" href="http://www.stochasticgeometry.ie/2010/03/10/performance-tuning-a-server-in-three-minutes-while-being-slashdotte/" title="Performance tuning a server in less than three minutes while being slashdotted"/><link rel="shortlink" type="text/html" href="http://planet-php.org/~jka" title="Shortlink to http://www.stochasticgeometry.ie/2010/03/10/performance-tuning-a-server-in-three-minutes-while-being-slashdotte/"/><author><name>Mark Dennehy</name></author><id>http://www.stochasticgeometry.ie/?p=690</id><updated>2010-03-10T21:33:00Z</updated><published>2010-03-10T21:33:00Z</published><content type="html"><![CDATA[<img style="vertical-align: top; margin-left: 4px; margin-right: 4px;" src="http://www.stochasticgeometry.ie/wp-content/uploads/2010/03/burning-computer.jpg" alt="Burning Computer" width="249" height="244" />Tuning a webserver in three minutes while it's being slashdotted.]]></content></entry><entry><title type="text">ConFoo - PHP in the Enterprise</title><link rel="alternate" type="text/html" href="http://blog.preinheimer.com/index.php?/archives/352-ConFoo-PHP-in-the-Enterprise.html" title="ConFoo - PHP in the Enterprise"/><link rel="shortlink" type="text/html" href="http://planet-php.org/~jj_" title="Shortlink to http://blog.preinheimer.com/index.php?/archives/352-ConFoo-PHP-in-the-Enterprise.html"/><author><name>Paul Reinheimer</name></author><id>http://blog.preinheimer.com/index.php?/archives/352-guid.html</id><updated>2010-03-10T21:24:00Z</updated><published>2010-03-10T21:24:00Z</published><content type="html"><![CDATA[
    I just finished my PHP in the Enterprise talk at <a href="http://confoo.ca/">ConFoo</a>, Slides are available here: <a href="http://blog.preinheimer.com/talks/PHP in the Enterprise - Confoo March 2010.pdf">PHP in the Enterprise - ConFoo March 2010</a> 
    ]]></content></entry><entry><title type="text">PHP command line progress bar</title><link rel="alternate" type="text/html" href="http://brian.moonspot.net/php-progress-bar" title="PHP command line progress bar"/><link rel="shortlink" type="text/html" href="http://planet-php.org/~jj8" title="Shortlink to http://brian.moonspot.net/php-progress-bar"/><author><name>Brian Moon</name></author><id>http://brian.moonspot.net/php-progress-bar</id><updated>2010-03-10T17:33:00Z</updated><published>2010-03-10T17:33:00Z</published><content type="html"><![CDATA[Was just looking through some code and came across this function I wrote some time ago. If you do a lot of your processing scripts in PHP like we do, you probably need to know what is going on sometimes. So, I made a progress bar for use on the cli. I thought I would share it.  <a href="http://www.screencast.com/users/brianlmoon/folders/Jing/media/822d9970-a6a3-4071-bdc6-1303cce9800a">Here is a video</a> of it in action. And the <a href="http://brian.moonspot.net/status_bar.php.txt">code can be found here</a>.]]></content></entry><entry><title type="text">Introducing phpfarm</title><link rel="alternate" type="text/html" href="http://cweiske.de/tagebuch/Introducing%20phpfarm.htm" title="Introducing phpfarm"/><link rel="shortlink" type="text/html" href="http://planet-php.org/~jj9" title="Shortlink to http://cweiske.de/tagebuch/Introducing%20phpfarm.htm"/><author><name>Christian Weiske</name></author><id>http://cweiske.de/tagebuch/Introducing%20phpfarm.htm</id><updated>2010-03-10T15:58:00Z</updated><published>2010-03-10T15:58:00Z</published><content type="html"><![CDATA[<div >
  <p >
   <a href="http://pear.php.net/">PEAR</a> consists of literally hundreds of
   packages (libraries) that help you to build your PHP applications faster,
   less error-prone and more secure. Millions of web applications use and
   rely on the proper functioning of PEAR packages.
  </p>
  <p >
   To ensure constant quality, many packages utilize <em >phpt</em> or
   <em >PHPUnit</em> tests that are run during development and
   before each release. They help us making sure new features or bug fixes
   do not break existing functionality.
  </p>
  <p >
   One of hard to solve challenges is ensuring that a package's unit tests
   do not only run on the specific PHP version the developers have installed
   on their machines (which often is the latest and greatest, maybe not even
   released version from SVN), but to cover the whole range of supported
   PHP versions. This goal can be achieved in several ways:
  </p>
  <ol >
   <li >Test on different machines with another PHP version on each</li>
   <li >Test on different PHP versions on one machine</li>
  </ol>
  <p >
   Solution number 1 requires either much hardware or at least quite some setup
   time for virtual machines. Besides that, running tests regularly on many
   different machines needs automated deployment tools - you won't ssh into
   the 15th machine manually, let alone setting up database servers and other
   software that might be required.
  </p>
  <p >
   There is no single Linux distribution I know of that supports installing multiple
   versions of PHP beside each other - making solution number 2 similar
   daunting to setup and running as #1. The benefits above #1 are obvious:
   All software on one machine means easier deployment because the software
   to test needs to be setup only once. Software dependencies need to be
   installed only once. Executing the tests is easier if all versions of
   PHP are on this single machine, which means that the cross-version tests
   can be automated really easily.
  </p>
  <p >
   A tool to solve all problems with the multiple-php-versions-on-one-machine
   solution is
   <a href="http://svn.php.net/viewvc/pear/ci/phpfarm/trunk/"><strong >phpfarm</strong></a>.
   The best way to demonstrate its easiness is probably a shellshot:
  </p>
  <pre ><strong >$ svn co http://svn.php.net/repository/pear/ci/phpfarm/trunk/ phpfarm</strong>
<strong >$ cd phpfarm/src</strong>
<strong >$ ./compile 5.3.2</strong>
... fetching sources from php.net
... configuring
... compiling
... installing
... fetching and setting up pyrus
<strong >$ php-5.3.2 --version</strong>
PHP 5.3.2 (cli) (built: Mar 10 2010 18:08:27) (DEBUG)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
<strong >$ pyrus-5.3.2 --version</strong>
Pyrus version 2.0.0a1 SHA-1: 2FDFB5E00A6D707437DBC047AAF9D115C6484D90
Using PEAR installation found at /home/cweiske/Dev/cvs/pear/phpfarm/inst/php-5.3.2/pear
php pyrus.phar version 2.0.0a1.</pre>

  <p >
   That's it. With <em >one single command</em>, you can install each version of
   PHP you like, and you get
   <a href="http://pear2.php.net/"><strong >pyrus</strong></a>, the next-generation
   PEAR installer for free! Let's try it:
  </p>

  <pre ><strong >$ pyrus-5.3.2 channel-discover pear.phpunit.de</strong>
Discovery of channel pear.phpunit.de successful
<strong >$ pyrus-5.3.2 install phpunit/phpunit</strong>
...
Installed pear.phpunit.de/PHPUnit-3.4.11
<strong >$ pyrus-5.3.2 list-packages</strong>
Listing installed packages [/home/cweiske/Dev/cvs/pear/phpfarm/inst/php-5.3.2/pear]:
[channel pear.phpunit.de]:
 PHPUnit</pre>

  <p >
   <em >phpfarm</em> automatically sets up your php.ini with the values you desire.
   It sets your <em >include_path</em>. It lets you specify <em >custom configuration
   options</em>, per patch, minor or major PHP version - just have a look
   at the
   <a href="http://svn.php.net/repository/pear/ci/phpfarm/trunk/README">README</a>.
  </p>
  <p >
   Now everything is ready for you (and us PEAR developers!) to let the unit tests
   run on all the little PHP versions we want to. Did I tell you that
   phpfarm also installs php-cgi versions? My next blog entry will show you how
   to run dozens of php versions simultaneously in apache.
  </p>
  <p >
   If you have questions or suggestions about phpfarm, don't hesitate to ask
   on the <a href="mailto:pear-general@lists.php.net">pear-general</a>
   mailing list
   (<a href="http://pear.php.net/support/lists.php">subscription info</a>)
   or on the <a href="irc://irc.efnet.pl/#pear">#pear</a> IRC channel.
  </p>
  <p >
   Happy testing!
  </p>
 </div>]]></content></entry><entry><title type="text">An intriguing use of lambda functions</title><link rel="alternate" type="text/html" href="http://eliw.wordpress.com/2010/03/10/an-intriguing-use-of-lambda-functions/" title="An intriguing use of lambda functions"/><link rel="shortlink" type="text/html" href="http://planet-php.org/~jj7" title="Shortlink to http://eliw.wordpress.com/2010/03/10/an-intriguing-use-of-lambda-functions/"/><author><name>Eli White</name></author><id>http://eliw.wordpress.com/?p=175</id><updated>2010-03-10T14:47:00Z</updated><published>2010-03-10T14:47:00Z</published><content type="html"><![CDATA[<p>I’ve been working hard on <a href="http://goodsie.com/" title="Goodsie">Goodsie.com</a> lately trying to bring it to launch.  It’s been great being in on a new PHP project from (near) the beginning, as it frees up a number of things.</p>
<p>One of those, is the fact that I can be using PHP 5.3 and all the new features that come with PHP 5.3.  While I’ve used my fair share of the short-cut ternary already (?:), the bigger win for me, are the <a href="http://php.net/functions.anonymous" title="PHP: Anonymous functions - Manual">Lambda functions with scoping (anonymous functions)</a>.</p>
<p>I found a very specific use out of the blue of Lambda functions that I have now used and I see as a great use-case.  Which is specifically passing functions/logic from your Controller to your View.</p>
<p>In the case of Goodsie, I’m using PHP for my templating language and as usual I’m trying to remove as much logic from my View as possible, while still allowing the view to be malleable.</p>
<p>The specific case I had, was a subview that was generating some pagination code for me.  You know, the standard ‘previous, page 1, page 1, next’ section of links.  The basic html template I had, looked looked similar to:</p>
<pre>&lt;div class="pagination">
    &lt;a href="&lt;?= $baseurl . '/page:' . ($page - 1) ?>">&larr; Previous&lt;/a>
    Page &lt;?= $page ?> of &lt;?= $total ?>
    &lt;a href="&lt;?= $baseurl . '/page:' . ($page + 1) ?>">Next &rarr;&lt;/a>
&lt;/div></pre>
<p>Rather straight forward, but I quickly ran into a problem.  The way it worked, as you see, is that you passed in a base URL, and the page number you are currently on, and it generated appropriate forward/back links.  (Ok, there was also some other logic where it determined if you needed the prev/next links at all, but I’ve removed that for clarity)</p>
<p>But I then had a case, where I wanted to reuse this subview in an ajax situation.  Where instead of straight URL’s being passed in, I might want to pass in a javascript function, and have that function be called with the page number as a parameter.  That would be nice as I could use it in both situations.  What pagination looked like, could completely change, and still work on both cases.   Perhaps we’d want to give a full list of all possible pages.  Or show a couple forward/back, etc.  The view could handle all of that without a change to the controller.</p>
<p>But therein lied the problem.  When using a URL based pagination, I wanted to concat the page number onto the end of the URL.  But when using javascript, it wasn’t pure concatenation, it instead needed to wrap the page number with the function call.  Oh the pain a simple ) could cause me.</p>
<p>I started writing code, where I ended up with tons of switch statements and logic inside of the view.  I’d have to pass in two different possible values, a URL or a javascript function.  The view at every point where it would output a link, would need to see which version was being used, and from that decide what type of output to create.  In short, it was a mess.</p>
<p>But then the solution dawned upon me.  A lambda function would work admirably here.  So what I did, is inside of my controller I created a function on the fly, that would generate the appropriate type of link that I was wanting.  It looks something like:</p>
<pre>if ($jsfunc) {
    $url = function ($p) use ($jsfunc) { return "javascript:{$jsfunc}({$p})"; };
} elseif ($baseurl) {
    $url = function ($p) use ($baseurl) { return "{$baseurl}/page:{$p}"; };
}</pre>
<p>Now I could simply rewrite my original template, to use this lambda function <code>$url</code> to generate it’s URLs.  </p>
<pre>&lt;div class="pagination">
    &lt;a href="&lt;?= $url($page - 1) ?>">&larr; Previous&lt;/a>
    Page &lt;?= $page ?> of &lt;?= $total ?>
    &lt;a href="&lt;?= $url($page - 1) ?>">Next &rarr;&lt;/a>
&lt;/div></pre>
<p>Now not only would this work for my specific situation, but ANY controller could reuse this pagination subview and define exactly how it wanted it’s URLs to be formed.  Now, the view could completely change around how the pagination section is displayed, show as many, or as few pages as it wants to, and all that without ever touching the controller.</p>
<p>This is one simple example, but I’ve become enamored of this approach.  Using lambda functions in this way, you are able to have complicated logic represented inside of your view, but encapsulated/created by the controller.  Also of note is the fact that the view is managing to use the <code>$jsfunc</code> and <code>$baseurl</code> values, but without actually having to be granted access to them.  This allows for another level of encapsulation, as I exposed one function,</p><p><i>Truncated by Planet PHP, read more at <a href="http://eliw.wordpress.com/2010/03/10/an-intriguing-use-of-lambda-functions/">the original</a> (another 1389 bytes)</i></p>]]></content></entry><entry><title type="text">Accelerando</title><link rel="alternate" type="text/html" href="http://schlitt.info/opensource/blog/0721_accelerando.html" title="Accelerando"/><link rel="shortlink" type="text/html" href="http://planet-php.org/~jj6" title="Shortlink to http://schlitt.info/opensource/blog/0721_accelerando.html"/><author><name>Tobias Schlitt</name></author><id>http://schlitt.info/opensource/blog/0721_accelerando.html</id><updated>2010-03-10T10:12:00Z</updated><published>2010-03-10T10:12:00Z</published><content type="html"><![CDATA[This is a very unusual blog post for the open source area of my website, since it contains a recommendation for a science fiction book. The reason I've put it here instead of the private section is on the one hand, that it will definitely reach more geek - and therefor probably scifi interested - people here. On the other hand, the book I'm writing about can be found online for free in English language, but the private section is mostly kept in German.I love scifi literature and movies, as most geeks do. But the quality of works in this area varies quite a lot. Beside the style of writing, there is one crucial point, which can make the best novel be a total disaster: Authenticity.
]]></content></entry><entry><title type="text">First year of Qaiku, and a travel writing challenge</title><link rel="alternate" type="text/html" href="http://bergie.iki.fi/blog/first_year_of_qaiku-and_a_travel_writing_challenge/" title="First year of Qaiku, and a travel writing challenge"/><link rel="shortlink" type="text/html" href="http://planet-php.org/~jj2" title="Shortlink to http://bergie.iki.fi/blog/first_year_of_qaiku-and_a_travel_writing_challenge/"/><author><name>Henri Bergius</name></author><id>http://bergie.iki.fi/midcom-permalink-1df2bbebf6658b62bbe11dfb4a947f5df1c12871287</id><updated>2010-03-09T21:00:00Z</updated><published>2010-03-09T21:00:00Z</published><content type="html"><![CDATA[
<p><img src="http://bergie.iki.fi/static/1/1df2bbe864279c02bbe11df8849b307a0df59445944_qaiku-birthday_mascot.gif" border="0" alt="1st birthday of Qaiku" title="1st birthday of Qaiku" style="float:right;" /><a href="http://www.qaiku.com/">Qaiku</a>, the <a href="http://bergie.iki.fi/blog/microblogging-why_qaiku_might_do_what_twitter_and_brightkite_didn-t/">conversational microblogging service</a> that launched a year ago had a refresh that launched today. While it hasn't yet convinced the twittering masses, it has already proven itself as a lot more thoughtful platform for the Finnish online community, and as a valuable <a href="http://bergie.iki.fi/blog/maemo-org_is_testing_workstreaming_with_qaiku/">workstreaming tool</a>.</p>
<p>The new version looks quite nice and fresh. Notice the privacy information on the right-hand side, which is relevant as Qaiku allows channels and profiles that are private or invitation-only:</p>
<p><img src="http://bergie.iki.fi/static/1/1df2bbd3c08f3262bbd11dfb984e5004382fa3ffa3f_qaiku-onmytravels-small.png" border="0" alt="qaiku-onmytravels-small.png" title="qaiku-onmytravels-small.png" /></p>
<p>Technically the new version is also remarkable as it is the first major website to run fully on top of the legacy-free <a href="http://bergie.iki.fi/blog/raise_the_hammer-midgard2_mjolnir_goes_live/">Midgard2 platform</a>. So yes, every entry you see there is a GObject. And D-Bus signals fly when you post.</p>
<h2>On to the challenge, then</h2>
<p>To highlight Qaiku's threading, conversational nature I started a new <a href="http://www.qaiku.com/go/61gu/"><em>"On my travels, I have"</em></a><a href="http://www.qaiku.com/go/61gu/"> thread</a> for sharing your <em>most extraordinary travel experiences</em>. This is not on Twitter or Buzz as with Qaiku it is so easy to keep the conversation together and accessible for the future as well.</p>
<p>To contribute, <a href="http://www.qaiku.com/settings/registration/">sign up on Qaiku</a>, go to <a href="http://www.qaiku.com/go/61gu/">the thread</a> and add your experiences as a comment. If you have a link or picture to include, you can also do so. My first entry was:</p>
<blockquote><a href="http://bergie.iki.fi/blog/african-miracles/">seen</a> ice descend from the heavens and provide us with cold beer on a hot day in Lesotho</blockquote>
<p>Will be interesting to see what comes out of this :-)</p>]]></content></entry><entry><title type="text">Getting started with the Midgard content repository</title><link rel="alternate" type="text/html" href="http://bergie.iki.fi/blog/getting_started_with_the_midgard_content_repository/" title="Getting started with the Midgard content repository"/><link rel="shortlink" type="text/html" href="http://planet-php.org/~jj0" title="Shortlink to http://bergie.iki.fi/blog/getting_started_with_the_midgard_content_repository/"/><author><name>Henri Bergius</name></author><id>http://bergie.iki.fi/midcom-permalink-1df2b937abcafba2b9311df8feac5680ae0b314b314</id><updated>2010-03-09T15:50:00Z</updated><published>2010-03-09T15:50:00Z</published><content type="html"><![CDATA[
<p>I'm doing a talk today in the <a href="http://www.bossaconference.indt.org/">Bossa Conference</a> about using  <a href="http://bergie.iki.fi/blog/raise_the_hammer-midgard2_mjolnir_goes_live/">Midgard</a> as a content repository for mobile applications. As part of my presentation I wrote some simple example code for using the <a href="http://www.midgard-project.org/documentation/python_midgard/">Midgard APIs in Python</a>, and thought they would be good to share to those not attending the event as well.</p>
<p>The <a href="http://bergie.iki.fi/blog/why_you_should_use_a_content_repository_for_your_application/">idea of a content repository</a> is that instead of coming up with new, isolated file formats or database setups for your application you can just work with objects and signals, and let Midgard handle the rest. This is something that lots of people are doing with  <a href="http://couchdb.apache.org/">CouchDB</a> as well, but we feel Midgard, with its light footprint and native APIs for languages like Python, C, Vala and PHP fits better in the mobile applications context.</p>
<h2>Installing Midgard</h2>
<p>Midgard packages are available for many different Linux distributions through the OpenSuse Build Service. To find the right repository for  your setup, go to the <a href="http://download.opensuse.org/repositories/home:/midgardproject:/mjolnir/">OBS project page</a>.  For example, on my Ubuntu Karmic netbook the URL to add to apt <code>sources.list</code> is  <code>deb http://download.opensuse.org/repositories/home:/midgardproject:/mjolnir/xUbuntu_9.10/ ./</code>. Then I just:</p>
<pre>sudo apt-get update
sudo apt-get install python-midgard2
</pre>
<p>Midgard is also available in <a href="http://maemo.org/packages/search/?org_maemo_packages_search%5B1%5D%5Bproperty%5D=name&org_maemo_packages_search%5B1%5D%5Bconstraint%5D=LIKE&org_maemo_packages_search%5B1%5D%5Bvalue%5D=midgard">Maemo extras</a> and for OS X <a href="http://www.macports.org/ports.php?by=name&substr=midgard2">on MacPorts</a>.</p>
<h2>Defining a schema</h2>
<p>The first thing when developing a Midgard application is to define your storage objects. This is done using the  <a href="http://www.midgard-project.org/documentation/mgdschema-file-properties/">MgdSchema XML format</a>. In this case we're doing a simple "attendee" object that amends Midgard's built-in person record with information related to the conference:</p>
<pre>&lt;?xml version="1.0" encoding="UTF-8"?>
&lt;Schema xmlns="http://www.midgard-project.org/repligard/1.4">
    &lt;type name="openbossa_attendee" table="openbossa_attendee">
        &lt;property name="id" type="unsigned integer" primaryfield="id">
            &lt;description>Local non-replication-safe database identifier&lt;/description>
        &lt;/property>
        &lt;property name="person" type="unsigned integer" link="midgard_person:id">
            &lt;description>Person attending the event&lt;/description>
        &lt;/property>
        &lt;property name="registration" type="datetime">
            &lt;description>Registration date of the attendee&lt;/description>
        &lt;/property>
        &lt;property name="likesbeer" type="boolean">
            &lt;description>Whether the attendee likes beer&lt;/description>
        &lt;/property>
    &lt;/type>
&lt;/Schema>
</pre>
<p>Then we just save this XML file into <code>/usr/share/midgard2/schema/</code> so that Midgard will find it.</p>
<h2>Initiating the repository connection</h2>
<p>Once the MgdSchema is in place it is time to <a href="http://xkcd.com/353/">import antigravity</a> and start hacking in Python.  The code works pretty much in the same way in other languages Midgard is available for, but Python is used here for the sake of simplicity. First we load the Midgard extension:</p>
<pre>import _midgard as midgard
</pre>
<p>Then we setup the <a href="http://www.midgard-project.org/api-docs/midgard/core/9.9/midgard-connection.html">repository connection</a>. With these <a href="http://www.midgard-project.org/api-docs/midgard/core/9.9/midgard-config.html">settings</a> we will store our content into an SQLite database located in  <code>~/.midgard2/data/midgardexample.db</code>:</p>
<pre>configuration = midgard.config()
configuration.dbtype = 'SQLite'
configuration.database = 'midgardexample'

# Open a Midgard repository connection with our config
connection = midgard.connection()
connection.open_config(configuration)
</pre>
<p>As this is the first time we're interacting with the repository we need to tell Midgard to  <a href="http://www.midgard-project.org/api-docs/midgard/core/9.9/midgard-storage.html">prepare the storage</a> for itself and also for our new <code>openbossa_attendee</code> class:</p>
<pre>midgard.storage.create_base_storage()
midgard.storage.create_class_storage('midgard_person')
midgard.storage.create_class_storage('midgard_parameter')
midgard.storage.create_class_s</pre><p><i>Truncated by Planet PHP, read more at <a href="http://bergie.iki.fi/blog/getting_started_with_the_midgard_content_repository/">the original</a> (another 2314 bytes)</i></p>]]></content></entry><entry><title type="text">Neural Networks in PHP</title><link rel="alternate" type="text/html" href="http://www.phpclasses.org/blog/post/119-Neural-Networks-in-PHP.html" title="Neural Networks in PHP"/><link rel="shortlink" type="text/html" href="http://planet-php.org/~jjX" title="Shortlink to http://www.phpclasses.org/blog/post/119-Neural-Networks-in-PHP.html"/><author><name>PHP Classes</name></author><id>http://www.phpclasses.org/blog/post/119-Neural-Networks-in-PHP.html</id><updated>2010-03-09T06:26:00Z</updated><published>2010-03-09T06:26:00Z</published><content type="html"><![CDATA[<div style="clear: both">
<div style="margin-top: 1ex"><a href="http://www.phpclasses.org/blog/post/119-Neural-Networks-in-PHP.html">Neural Networks in PHP</a></div>
<div style="margin-top: 1ex">By Louis Stowasser</a></div>
<div style="margin-top: 1ex">Neural networks allow emulating the behavior of a brain in software applications. Neural Networks have always had a too steep learning curve to venture towards, especially in a Web environment.<br />
<br />
Neural Mesh is an open source, pure PHP code based Neural Network manager and framework that makes it easier to work with Neural Networks.<br />
<br />
This article explains how to easily implement Neural Mesh to develop Neural Network applications in PHP.</a></div>
</div>
]]></content></entry></feed>
