<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    <title>LornaJane</title>
    <link>http://www.lornajane.net/</link>
    <description></description>
    <dc:language>en</dc:language>
    <admin:errorReportsTo rdf:resource="mailto:noreply@lornajane.net" />
    <generator>Serendipity 1.4.1 - http://www.s9y.org/</generator>
    <pubDate>Thu, 11 Mar 2010 15:41:13 GMT</pubDate>

    <image>
        <url>http://www.lornajane.net/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: LornaJane - </title>
        <link>http://www.lornajane.net/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>PHP London Conference: In Review</title>
    <link>http://www.lornajane.net/posts/2010/PHP-London-Conference-In-Review</link>
            <category>php</category>
    
    <comments>http://www.lornajane.net/posts/2010/PHP-London-Conference-In-Review#comments</comments>
    <wfw:comment>http://www.lornajane.net/wfwcomment.php?cid=580</wfw:comment>

    <slash:comments>6</slash:comments>
    <wfw:commentRss>http://www.lornajane.net/rss.php?version=2.0&amp;type=comments&amp;cid=580</wfw:commentRss>
    

    <author>s9y@lornajane.net (LornaJane)</author>
    <content:encoded>
    I&#039;m really late with this post, but I wanted to write about the &lt;a href=&quot;http://phpconference.co.uk&quot;&gt;PHP London Conference&lt;/a&gt; which was held in London last Friday.  The event was in a great venue and had hoards of people - this was my fourth year in attendance!!  They do, however, have the longest twitter tag in history &lt;a href=&quot;http://search.twitter.com/search?q=phpuk2010&quot;&gt;#phpuk2010&lt;/a&gt;!&lt;br /&gt;
&lt;br /&gt;
This year I had the privilege of speaking at this event, although I was concerned that I had to stay coherent and alert right through to the graveyard slot at 4:30pm (conference organisers take note: I really am much sparklier in the mornings!).  I kept myself awake by attending what I affectionately refer to as the &quot;Ibuildings track&quot; - with 4 speakers at the event, it did feel like a bit of an invasion by myself and my colleagues.  In our defence I can only say that we are a pretty big local PHP employer and, as a developer, I&#039;m happy to be working for someone who sends all their developers to these events, and even happier to be in the company of those other excellent speakers as colleagues!&lt;br /&gt;
&lt;br /&gt;
My talk was entitled &quot;Best Practices in Web Service Design&quot; although perhaps &quot;Things I Wish Web Service Creators Would Consider Before Writing Unclear and Unstable Useless And Frustrating Services&quot; would have been a better title!  I talked about web services in general, a bit about HTTP and the various service types, and also gave some general tips and tricks for writing good, stable services.  In a bit of a break with geeky tradition, I then talked about services as a whole package, and how to deliver and document them in a way that helps users help themselves.  If you are interested the slides are here:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.slideshare.net/lornajane/best-practices-in-web-service-design&quot;&gt;http://www.slideshare.net/lornajane/best-practices-in-web-service-design&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
The experience was overall very positive for me, I haven&#039;t spoken at this conference before and I was very pleased to be included.  My talk went quite smoothly, with my nerves nicely hidden away (I&#039;ve had issues with this lately), and I also avoided falling over either the curtain or the piece of screen that was carefully placed to trip unwary speakers!  I&#039;d like to thank everyone who came and asked questions afterwards, and all those who saw my talk and left comments for me on &lt;a href=&quot;http://joind.in/1460&quot;&gt;my joind.in talk page&lt;/a&gt; - it all helps me to do better next time, thanks and I&#039;ll see you all next year!  
    </content:encoded>

    <pubDate>Fri, 05 Mar 2010 16:19:00 +0000</pubDate>
    <guid isPermaLink="false">http://www.lornajane.net/posts/2010/580</guid>
    <category>conference</category>
<category>php</category>
<category>phplondon</category>
<category>speaking</category>

</item>
<item>
    <title>Simple Database Patching Strategy</title>
    <link>http://www.lornajane.net/posts/2010/Simple-Database-Patching-Strategy</link>
            <category>tech</category>
    
    <comments>http://www.lornajane.net/posts/2010/Simple-Database-Patching-Strategy#comments</comments>
    <wfw:comment>http://www.lornajane.net/wfwcomment.php?cid=577</wfw:comment>

    <slash:comments>11</slash:comments>
    <wfw:commentRss>http://www.lornajane.net/rss.php?version=2.0&amp;type=comments&amp;cid=577</wfw:commentRss>
    

    <author>s9y@lornajane.net (LornaJane)</author>
    <content:encoded>
    One problem that seems to need solving too often is how to keep databases in sync across different platforms, different developers working on a project, and deploying database changes along with code changes.  There are lots of ways of approaching this, none of them are really excellent however and personally I tend to err on the side of simple being better.  Fewer dependencies means a solution more likely to work on every platform (and no additional complications for the live platform).  Usually this means patch files of some kind - here&#039;s an outline of my usual approach.  For the impatient:&lt;ul&gt;&lt;br /&gt;
&lt;li&gt;add a table for meta data to the database, set a database version parameter to 0&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;export structure and any essential data (lookup tables, etc) into an sql file&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;for any changes, create a numbered patch file e.g. patch-1.sql, including the change and an update statement to bring the version meta data to match the patch file&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;store all of the above in source control&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;for bonus points, create another sql file with some nice sample data&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Give the Database Some Version Awareness&lt;/h3&gt;&lt;br /&gt;
&lt;br /&gt;
Naming is completely changeable but mine looks something like this:&lt;br /&gt;
&lt;div class=&quot;sql&quot; style=&quot;text-align: left&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;CREATE&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;TABLE&lt;/span&gt; &lt;span style=&quot;color: #ba0157;&quot;&gt;`meta_data`&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;entry varchar&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;255&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;PRIMARY&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;KEY&lt;/span&gt;, value varchar&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;255&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;INSERT&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;INTO&lt;/span&gt; &lt;span style=&quot;color: #ba0157;&quot;&gt;`meta_data`&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;SET&lt;/span&gt; entry=&lt;span style=&quot;color: #ba0157;&quot;&gt;&quot;version&quot;&lt;/span&gt;, value=&lt;span style=&quot;color: #ba0157;&quot;&gt;&quot;0&quot;&lt;/span&gt;;&lt;br /&gt;&amp;#160;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
This new row will hold information about what patch version the database is up to.  Every patch that is created will update this number so that it is possible to tell which patches have and have not been applied.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Create an Initial Data Structure&lt;/h3&gt;&lt;br /&gt;
&lt;br /&gt;
Firstly create a database directory for all these files to live in.  This should be outside your web root but inside your source control project.&lt;br /&gt;
&lt;br /&gt;
Take your database and dump just the structure of the tables using the --no-data switch to mysqldump like this:&lt;br /&gt;
&lt;div class=&quot;bash&quot; style=&quot;text-align: left&quot;&gt;&lt;br /&gt;mysqldump -u &amp;lt;username&amp;gt; -p &amp;lt;database&amp;gt; --no-data &amp;gt; create.sql&lt;br /&gt;&amp;#160;&lt;/div&gt;&lt;br /&gt;
You will also want to populate tables which hold things like lookup values, country lists, that sort of thing, so that these are set up.  People starting to develop with this project, or if the application needs to be deployed to somewhere new, can use this file as a starting point.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Create Patches for Changes&lt;/h3&gt;&lt;br /&gt;
&lt;br /&gt;
This is where the discipline element comes in - no direct edits on the database are allowed!  Instead, write the SQL for your change and place it in the patch file, then run it against the database.  If that sounds too much like hard work then copy/paste the SQL you use to make changes, or the SQL generated by whatever SQL tool you use, and place it in the file.&lt;br /&gt;
&lt;br /&gt;
Every file must have its own incrementing version number in its file name, e.g. patch-1.sql, patch-2.sql etc.  Within the file the version must also be updated to match, with a statement like:&lt;br /&gt;
&lt;div class=&quot;sql&quot; style=&quot;text-align: left&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;UPDATE&lt;/span&gt; &lt;span style=&quot;color: #ba0157;&quot;&gt;`meta_data`&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;SET&lt;/span&gt; value=&lt;span style=&quot;color: #ba0157;&quot;&gt;&quot;1&quot;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;WHERE&lt;/span&gt; entry = &lt;span style=&quot;color: #ba0157;&quot;&gt;&quot;version&quot;&lt;/span&gt;;&lt;br /&gt;&amp;#160;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Recommended Practice&lt;/h3&gt;&lt;br /&gt;
&lt;br /&gt;
Here are a few pointers on getting the most out of something like this:&lt;ul&gt;&lt;br /&gt;
&lt;li&gt;Under no circumstances is it acceptable to edit a patch file that has been committed to source control.  Someone might have run it already and you&#039;ll confuse everyone completely.&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;Having matching undo scripts alongside the patches can be really useful in case a change gets deployed and needs to be undone.&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;Make a script to look up the database settings in the config file of your application, query the database for what version it is at, and run any outstanding scripts.  This makes life much easier especially if you have large numbers of scripts (I&#039;ve seen the patch numbers hit the hundreds)&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;A possible adaptation of this approach is to create patch files for use for updating a database, but to also update the install.sql file to make it correct at any point in time, this means a much shorter and easier setup time for new deployements/developers.  The version awareness works in the same way regardless&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;Creating a sample database which creates a few records in each table can really help for development purposes - its quicker for people to get set up and attain a working system that they can make progress with.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;br /&gt;
I&#039;m sure there are many improvements and variations on this theme of simple database patching, leave a comment and let me know what works for you and why!&lt;br /&gt;
&lt;br /&gt;
  
    </content:encoded>

    <pubDate>Mon, 01 Mar 2010 08:40:00 +0000</pubDate>
    <guid isPermaLink="false">http://www.lornajane.net/posts/2010/577</guid>
    <category>database</category>
<category>tech</category>

</item>
<item>
    <title>Supermondays: Recap</title>
    <link>http://www.lornajane.net/posts/2010/Supermondays-Recap</link>
            <category>tech</category>
    
    <comments>http://www.lornajane.net/posts/2010/Supermondays-Recap#comments</comments>
    <wfw:comment>http://www.lornajane.net/wfwcomment.php?cid=579</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://www.lornajane.net/rss.php?version=2.0&amp;type=comments&amp;cid=579</wfw:commentRss>
    

    <author>s9y@lornajane.net (LornaJane)</author>
    <content:encoded>
    Last night I travelled to the northeast of England to speak to a thriving technical community up there called &lt;a href=&quot;http://www.supermondays.org/&quot;&gt;Supermondays&lt;/a&gt;.  They contacted me some time ago asking if I could get there to speak one Monday, and last night was the night!  It was a very civilised gathering, with sandwiches and cups of tea, and using a lecture theatre at the university for space.  As a speaker the best thing about this is that its a space designed for addressing people in, unlike most user groups (and indeed conferences!) where two steps away from the lectern sees you standing in the dark, falling off the stage, or getting projected on to.  Last night was a different story with lots of space to wander, slides projected well above me on the wall so everyone could see clearly, and relatively good acoustics despite no amplification.&lt;br /&gt;
&lt;br /&gt;
My talk was entitled &quot;PHP and Web Services: Perfect Partners&quot; - the &lt;a href=&quot;http://www.slideshare.net/lornajane/php-and-web-services-perfect-partners&quot;&gt;slides are on slideshare&lt;/a&gt; if you want to take a look.  There was also a talk about android development by Alex Reid, including a live coding demo which went surprisingly well!  Judging by the various events that were plugged and discussed on the night, at the main event and in the pub afterwards, this is a diverse and vibrant technical community - so if you are in the northeast, get along to Supermondays!  
    </content:encoded>

    <pubDate>Tue, 23 Feb 2010 09:54:00 +0000</pubDate>
    <guid isPermaLink="false">http://www.lornajane.net/posts/2010/579</guid>
    <category>speaking</category>
<category>tech</category>
<category>webservice</category>

</item>
<item>
    <title>Open Office Presenter Console</title>
    <link>http://www.lornajane.net/posts/2010/Open-Office-Presenter-Console</link>
            <category>tech</category>
    
    <comments>http://www.lornajane.net/posts/2010/Open-Office-Presenter-Console#comments</comments>
    <wfw:comment>http://www.lornajane.net/wfwcomment.php?cid=576</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.lornajane.net/rss.php?version=2.0&amp;type=comments&amp;cid=576</wfw:commentRss>
    

    <author>s9y@lornajane.net (LornaJane)</author>
    <content:encoded>
    I&#039;ve been having issues with the presenter console on both my ubuntu machines since upgrading to Karmic (9.10).  One is a Thinkpad T400 running kubuntu and the other is an aspireone netbook running ubuntu netbook remix.  Neither wanted had a working installation after upgrade and I couldn&#039;t get the plugin installed using the open office plugin manager.&lt;br /&gt;
&lt;br /&gt;
I discovered that this plugin is now available through apitude - simply install the package openoffice.org-presenter-console and it should all work splendidly!  I use the presenter console when I am speaking (which is quite often) to show the time and the upcoming slide, its a great tool.  
    </content:encoded>

    <pubDate>Fri, 19 Feb 2010 08:43:00 +0000</pubDate>
    <guid isPermaLink="false">http://www.lornajane.net/posts/2010/576</guid>
    <category>kubuntu</category>
<category>linux</category>
<category>openoffice</category>
<category>tech</category>
<category>ubuntu</category>

</item>
<item>
    <title>An iPhone App for Joind.in</title>
    <link>http://www.lornajane.net/posts/2010/An-iPhone-App-for-Joind.in</link>
            <category>php</category>
    
    <comments>http://www.lornajane.net/posts/2010/An-iPhone-App-for-Joind.in#comments</comments>
    <wfw:comment>http://www.lornajane.net/wfwcomment.php?cid=578</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.lornajane.net/rss.php?version=2.0&amp;type=comments&amp;cid=578</wfw:commentRss>
    

    <author>s9y@lornajane.net (LornaJane)</author>
    <content:encoded>
    Recently I&#039;ve been doing some bits and pieces with the open sourced event feedback site &lt;a href=&quot;http://joind.in&quot;&gt;joind.in&lt;/a&gt;, including some work on its API to facilitate development of an iphone app.  As a conference attendee, speaker and organiser, I use this site a lot for the various events that I am involved with and its a great asset.&lt;br /&gt;
&lt;br /&gt;
My boyfriend Kevin was thinking of developing an iphone app, mostly to find out more about the technology, and I suggested he take a look at the API for joind.in and consider building something on that.  The joind.in project belongs to &lt;a href=&quot;http://twitter.com/enygma&quot;&gt;enygma&lt;/a&gt;, a.k.a. Chris Cornutt from &lt;a href=&quot;http://phpdeveloper.org&quot;&gt;phpdeveloper.org&lt;/a&gt; and he has the code &lt;a href=&quot;http://github.com/enygma/joind.in&quot;&gt;available on github&lt;/a&gt; - so we grabbed it.  The API wasn&#039;t previously used by much so we were able to tidy it up a bit and then consume it from the iphone to suit our needs.  Chris has accepted my alterations to his existing project with grace - even when I&#039;ve totally broken the live site with them!!&lt;br /&gt;
&lt;br /&gt;
The joind.in site is a classic MVC setup and the API already existed within the application.  It is implemented with a separate set of controllers for the various actions supported by the API, which all inherit from a controller which handles the output formats etc for the XML and JSON responses.  It isn&#039;t the world&#039;s best API but its perfectly sufficient for the task at hand - I intend to write some examples for using it but until then you can read this &lt;a href=&quot;http://derickrethans.nl/joindins-api.html&quot;&gt;post from Derick&lt;/a&gt; about how he used the joind.in API to pull in comments on his talks onto his own site.&lt;br /&gt;
&lt;br /&gt;
The app itself has the core functionality of joind.in that an attendee would want in his pocket at an event.  The events and their details are there, along with the talks at each event.  Attendees can leave comments on the various talks and socials, and these can be browsed in the app as well.  To give you a little taste of the app, here are some screenshots:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.flickr.com/photos/lornajane/4356870789/&quot; title=&quot;img_0023 by LornaJane.net, on Flickr&quot;&gt;&lt;img src=&quot;http://farm5.static.flickr.com/4057/4356870789_834b45fdd6_m.jpg&quot; width=&quot;167&quot; height=&quot;240&quot; alt=&quot;img_0023&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.flickr.com/photos/lornajane/4357618830/&quot; title=&quot;img_0024 by LornaJane.net, on Flickr&quot;&gt;&lt;img src=&quot;http://farm5.static.flickr.com/4052/4357618830_327d1dc0b5_m.jpg&quot; width=&quot;167&quot; height=&quot;240&quot; alt=&quot;img_0024&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://www.flickr.com/photos/lornajane/4357619016/&quot; title=&quot;img_0025 by LornaJane.net, on Flickr&quot;&gt;&lt;img src=&quot;http://farm3.static.flickr.com/2748/4357619016_d3221ca8e8_m.jpg&quot; width=&quot;167&quot; height=&quot;240&quot; alt=&quot;img_0025&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
If you have an iphone or ipod touch and you&#039;re attending an event any time soon, then download the app - its under &quot;utilities&quot; in the app store.  Comments, suggestions, bug reports and feature requests are all gratefully received (no promises about fixing/implementing them but we&#039;ll do our best!).  Our app went from submission to approved in 3 days which is very fast - thanks apple!  
    </content:encoded>

    <pubDate>Mon, 15 Feb 2010 08:48:00 +0000</pubDate>
    <guid isPermaLink="false">http://www.lornajane.net/posts/2010/578</guid>
    <category>github</category>
<category>iphone</category>
<category>joind.in</category>
<category>php</category>

</item>
<item>
    <title>PHP and JSON</title>
    <link>http://www.lornajane.net/posts/2010/PHP-and-JSON</link>
            <category>php</category>
    
    <comments>http://www.lornajane.net/posts/2010/PHP-and-JSON#comments</comments>
    <wfw:comment>http://www.lornajane.net/wfwcomment.php?cid=566</wfw:comment>

    <slash:comments>6</slash:comments>
    <wfw:commentRss>http://www.lornajane.net/rss.php?version=2.0&amp;type=comments&amp;cid=566</wfw:commentRss>
    

    <author>s9y@lornajane.net (LornaJane)</author>
    <content:encoded>
    This is a quick outline on working with JSON from PHP, which is actually pretty simple to do.  This post has some examples on how to do it and what the results should look like.  JSON stands for JavaScript Object Notation, and is widely used in many languages (not just JavaScript) for serialisation.  It is particularly popular for use in web services.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Writing JSON From PHP&lt;/h3&gt;&lt;br /&gt;
&lt;br /&gt;
Imagine we have a multidimensional array in PHP that looks something like this:&lt;br /&gt;
&lt;div class=&quot;php&quot; style=&quot;text-align: left&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$menu&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #ba0157;&quot;&gt;&#039;starter&#039;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt; = &lt;a href=&quot;http://www.php.net/array&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #ba0157;&quot;&gt;&quot;prawn cocktail&quot;&lt;/span&gt;,&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #ba0157;&quot;&gt;&quot;soup of the day&quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$menu&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #ba0157;&quot;&gt;&#039;main course&#039;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt; = &lt;a href=&quot;http://www.php.net/array&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #ba0157;&quot;&gt;&quot;roast chicken&quot;&lt;/span&gt;,&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #ba0157;&quot;&gt;&quot;fish &#039;n&#039; chips&quot;&lt;/span&gt;,&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #ba0157;&quot;&gt;&quot;macaroni cheese&quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$menu&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #ba0157;&quot;&gt;&#039;pudding&#039;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt; = &lt;a href=&quot;http://www.php.net/array&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #ba0157;&quot;&gt;&quot;cheesecake&quot;&lt;/span&gt;,&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #ba0157;&quot;&gt;&quot;treacle sponge&quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.php.net/echo&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;echo&lt;/span&gt;&lt;/a&gt; json_encode&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$menu&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;#160;&lt;/div&gt;&lt;br /&gt;
The output of this script looks like this:&lt;br /&gt;
&lt;div style=&quot;text-align: left&quot;&gt;&lt;br /&gt;&lt;br /&gt;{&amp;quot;starter&amp;quot;:[&amp;quot;prawn cocktail&amp;quot;,&amp;quot;soup of the day&amp;quot;],&amp;quot;main course&amp;quot;:[&amp;quot;roast chicken&amp;quot;,&amp;quot;fish &#039;n&#039; chips&amp;quot;,&amp;quot;macaroni cheese&amp;quot;],&amp;quot;pudding&amp;quot;:[&amp;quot;cheesecake&amp;quot;,&amp;quot;treacle sponge&amp;quot;]}&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;
This is pretty typical of a JSON output string - you can see the curly brackets to enclose the whole thing, then some square brackets to show the nesting levels within the key/value formats.  JSON is an ideal format for many applications because it is easy to understand and debug, its quite concise, and many languages have built-in support just like PHP.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Reading JSON Data From PHP&lt;/h3&gt;&lt;br /&gt;
&lt;br /&gt;
Once we&#039;ve serialised the string, we might want to unserialise it again - and the PHP code for that is every bit as simple as the previous example, except that we use the function &lt;b&gt;json_decode()&lt;/b&gt; instead of &lt;b&gt;json_encode()&lt;/b&gt;.  I&#039;ve set the output of the previous script as the input to this one:&lt;br /&gt;
&lt;div class=&quot;php&quot; style=&quot;text-align: left&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$json&lt;/span&gt; = &lt;span style=&quot;color: #ba0157;&quot;&gt;&#039;{&amp;quot;starter&amp;quot;:[&amp;quot;prawn cocktail&amp;quot;,&amp;quot;soup of the day&amp;quot;],&amp;quot;main course&amp;quot;:[&amp;quot;roast chicken&amp;quot;,&amp;quot;fish &lt;span style=&quot;color: #006699;&quot;&gt;\&#039;&lt;/span&gt;n&lt;span style=&quot;color: #006699;&quot;&gt;\&#039;&lt;/span&gt; chips&amp;quot;,&amp;quot;macaroni cheese&amp;quot;],&amp;quot;pudding&amp;quot;:[&amp;quot;cheesecake&amp;quot;,&amp;quot;treacle sponge&amp;quot;]}&#039;&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.php.net/print_r&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;print_r&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;json_decode&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$json&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;#160;&lt;/div&gt;&lt;br /&gt;
This decodes the string and then dumps it using print_r() - the output of my script looked like this:&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
stdClass Object&lt;br /&gt;
(&lt;br /&gt;
    [starter] =&gt; Array&lt;br /&gt;
        (&lt;br /&gt;
            [0] =&gt; prawn cocktail&lt;br /&gt;
            [1] =&gt; soup of the day&lt;br /&gt;
        )&lt;br /&gt;
&lt;br /&gt;
    [main course] =&gt; Array&lt;br /&gt;
        (&lt;br /&gt;
            [0] =&gt; roast chicken&lt;br /&gt;
            [1] =&gt; fish &#039;n&#039; chips&lt;br /&gt;
            [2] =&gt; macaroni cheese&lt;br /&gt;
        )&lt;br /&gt;
&lt;br /&gt;
    [pudding] =&gt; Array&lt;br /&gt;
        (&lt;br /&gt;
            [0] =&gt; cheesecake&lt;br /&gt;
            [1] =&gt; treacle sponge&lt;br /&gt;
        )&lt;br /&gt;
&lt;br /&gt;
)&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
Note that the data isn&#039;t identical to how it looked when it went in - JSON can&#039;t distinguish between arrays and objects, and doesn&#039;t retain information about data types.  So its perfect for a web service where we just want to convey the information, but may be too loose for other applications.&lt;br /&gt;
&lt;br /&gt;
The examples here were taken from a talk I give about consuming web services - you can see all the slides &lt;a href=&quot;http://www.slideshare.net/lornajane/working-with-web-services&quot;&gt;on slideshare&lt;/a&gt;.  If you have any additions or alternatives, leave a comment!&lt;br /&gt;
  
    </content:encoded>

    <pubDate>Wed, 10 Feb 2010 10:21:00 +0000</pubDate>
    <guid isPermaLink="false">http://www.lornajane.net/posts/2010/566</guid>
    <category>json</category>
<category>php</category>
<category>webservice</category>

</item>
<item>
    <title>Word Count</title>
    <link>http://www.lornajane.net/posts/2010/Word-Count</link>
            <category>tech</category>
    
    <comments>http://www.lornajane.net/posts/2010/Word-Count#comments</comments>
    <wfw:comment>http://www.lornajane.net/wfwcomment.php?cid=564</wfw:comment>

    <slash:comments>3</slash:comments>
    <wfw:commentRss>http://www.lornajane.net/rss.php?version=2.0&amp;type=comments&amp;cid=564</wfw:commentRss>
    

    <author>s9y@lornajane.net (LornaJane)</author>
    <content:encoded>
    There&#039;s a little command line utility on *nix which I use a lot - it&#039;s &lt;b&gt;wc&lt;/b&gt; or &quot;word count&quot;.  This is especially useful to because I live in a world where everything is plain text right up until I have to send it to someone else (and sometimes not even then).  Despite its name, word count can count more than just words - it can do characters, words, lines and can tell you the length of the longest line while its at it.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Counting Lines&lt;/h3&gt;&lt;br /&gt;
&lt;br /&gt;
The biggest problem with counting lines is remembering the name of the utility, since its called &quot;word count&quot; and not &quot;line count&quot;.  I tend to use this for doing things like piping grep to wc and counting the lines to give me an idea of how many occurrences of something there are.  I also use it to count errors in weblogs or really anything else that I could do with summarising.  The syntax is something like:&lt;br /&gt;
&lt;div class=&quot;bash&quot; style=&quot;text-align: left&quot;&gt;&lt;br /&gt;grep -R TODO * | wc -l&lt;br /&gt;&amp;#160;&lt;/div&gt;&lt;br /&gt;
Using a count like this is especially good for things like auditing code, where I need to know how prevalent something is - or refactoring, where I&#039;m looking for how many of a particular pattern are outstanding.  Counting lines is also very compatible with my habit of making lists in text files.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Counting Words&lt;/h3&gt;&lt;br /&gt;
&lt;br /&gt;
This is the feature that the utility was originally designed for, and as you can imagine, its pretty good at that.  As with most things, this blog post started life as a text file and when I got to this point I saved it and ran:&lt;br /&gt;
&lt;div class=&quot;bash&quot; style=&quot;text-align: left&quot;&gt;&lt;br /&gt;wc -w wc_article.txt&lt;br /&gt;&amp;#160;&lt;/div&gt;&lt;br /&gt;
It outputs the number of words (272) and the name of the file, which is useful if you&#039;re giving it a pattern to match.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Word Count&lt;/h3&gt;&lt;br /&gt;
&lt;br /&gt;
Its a really convenient and versatile little program; I use it often and I hope others will find it useful too.  
    </content:encoded>

    <pubDate>Mon, 08 Feb 2010 07:31:00 +0000</pubDate>
    <guid isPermaLink="false">http://www.lornajane.net/posts/2010/564</guid>
    <category>linux</category>
<category>tech</category>
<category>wc</category>

</item>
<item>
    <title>PHPBenelux: Recap</title>
    <link>http://www.lornajane.net/posts/2010/PHPBenelux-Recap</link>
            <category>php</category>
    
    <comments>http://www.lornajane.net/posts/2010/PHPBenelux-Recap#comments</comments>
    <wfw:comment>http://www.lornajane.net/wfwcomment.php?cid=575</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://www.lornajane.net/rss.php?version=2.0&amp;type=comments&amp;cid=575</wfw:commentRss>
    

    <author>s9y@lornajane.net (LornaJane)</author>
    <content:encoded>
    Last weekend I was privileged to speak at the inaugural PHPBenelux conference in Antwerp, Belgium. Since Ibuildings is partly a dutch company I combined this with one of my regular trips to meet with the people there, visiting both our offices in the Netherlands and catching up with a bunch of colleagues in both locations before making my way to Belgium for the main event.&lt;br /&gt;
&lt;br /&gt;
The conference itself was very well organised and the venue worked very nicely. I liked the hotel (I&#039;m accustomed to London hotel rooms so European ones always seem huge), which was nice and had an English slant on breakfast since sausages were available alongside the cheese and pastries! The venue itself was just across the car park and had plenty of rooms with an open exhibition space which worked nicely - the two tracks were on opposite sides of this space so the footfall for the exhibitors was hopefully good! Full marks go to the crew:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.flickr.com/photos/lornajane/4321726787/&quot; title=&quot;phpbnl10 crew by LornaJane.net, on Flickr&quot;&gt;&lt;img src=&quot;http://farm5.static.flickr.com/4055/4321726787_ae1a189092_m.jpg&quot; width=&quot;240&quot; height=&quot;180&quot; alt=&quot;phpbnl10 crew&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
I gave my talk &quot;Passing the Joel Test in the PHP World&quot; with some updates since I first gave it at PHPNW09 in Manchester. This is a nice best practices talk and although I didn&#039;t have a lot of people in my talk, this was no surprise since Ivo was speaking in the same slot as me with his &quot;PHP and the Cloud&quot; talk, which I STILL haven&#039;t seen! If you are interested my slides are here: &lt;a href=&quot;http://www.slideshare.net/lornajane/passing-the-joel-test-in-the-php-world-phpbnl10&quot;&gt;http://www.slideshare.net/lornajane/passing-the-joel-test-in-the-php-world-phpbnl10&lt;/a&gt; Thanks to my audience who were great and managed to stay enthusiastic despite my nerves and the late afternoon slot :)&lt;br /&gt;
&lt;br /&gt;
Here&#039;s to PHPBenelux 2011!  
    </content:encoded>

    <pubDate>Wed, 03 Feb 2010 23:17:16 +0000</pubDate>
    <guid isPermaLink="false">http://www.lornajane.net/posts/2010/575</guid>
    <category>conference</category>
<category>php</category>
<category>phpbnl10</category>
<category>speaking</category>

</item>
<item>
    <title>Speaking at SuperMondays</title>
    <link>http://www.lornajane.net/posts/2010/Speaking-at-SuperMondays</link>
            <category>php</category>
    
    <comments>http://www.lornajane.net/posts/2010/Speaking-at-SuperMondays#comments</comments>
    <wfw:comment>http://www.lornajane.net/wfwcomment.php?cid=574</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.lornajane.net/rss.php?version=2.0&amp;type=comments&amp;cid=574</wfw:commentRss>
    

    <author>s9y@lornajane.net (LornaJane)</author>
    <content:encoded>
    I&#039;m delighted to announce that the people at SuperMondays in Newcastle have invited me to speak at their event on 22nd February.  For this I&#039;ll be writing a new talk entitled &quot;PHP and Web Services: Perfect Partners&quot; - looking at how PHP is a good fit for web services and how I&#039;m using it both in my day job and in my hobby projects.  Visit the &lt;a href=&quot;http://www.supermondays.org/2010/02/03/php-and-web-services-perfect-partners/&quot;&gt;event page&lt;/a&gt; itself for the full description, a bit about me, and the arrangements for the night.  I am warned that they have limited capacity so although admission is free, if you want to go you should register for tickets ASAP!&lt;br /&gt;
&lt;br /&gt;
If you are attending, let me know and come and say &quot;hi&quot; to me on the night!  I don&#039;t know this crowd well but so far they are pretty friendly and I&#039;m looking forward to the trip north :)  
    </content:encoded>

    <pubDate>Wed, 03 Feb 2010 22:28:46 +0000</pubDate>
    <guid isPermaLink="false">http://www.lornajane.net/posts/2010/574</guid>
    <category>php</category>
<category>speaking</category>

</item>
<item>
    <title>Stopping CodeIgniter from Escaping SQL</title>
    <link>http://www.lornajane.net/posts/2010/Stopping-CodeIgniter-from-Escaping-SQL</link>
            <category>php</category>
    
    <comments>http://www.lornajane.net/posts/2010/Stopping-CodeIgniter-from-Escaping-SQL#comments</comments>
    <wfw:comment>http://www.lornajane.net/wfwcomment.php?cid=573</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://www.lornajane.net/rss.php?version=2.0&amp;type=comments&amp;cid=573</wfw:commentRss>
    

    <author>s9y@lornajane.net (LornaJane)</author>
    <content:encoded>
    I&#039;m adding some small features to the API for &lt;a href=&quot;http://joind.in&quot;&gt;joind.in&lt;/a&gt; when I have a moment and this is my first experience of working with &lt;a href=&quot;http://codeigniter.com/&quot;&gt;CodeIgniter&lt;/a&gt;.  I&#039;ve been getting increasingly impatient with its tendency to try to escape my SQL code for me - this is a really useful default feature but it seems to assume I don&#039;t know what I&#039;m doing and so it puts backticks all over perfectly acceptable SQL code, very annoying!&lt;br /&gt;
&lt;br /&gt;
One night when I was getting exasperated with it tangling up my SQL expressions, I &lt;a href=&quot;http://twitter.com/lornajane/statuses/8209760483&quot;&gt;tweeted my frustration&lt;/a&gt; in the hope that I was just missing something simple.  A &lt;a href=&quot;http://twitter.com/damiangostomski/statuses/8209882657&quot;&gt;prompt reply&lt;/a&gt; from &lt;a href=&quot;http://twitter.com/damiangostomski&quot;&gt;@damiangostomski&lt;/a&gt; told me that this was indeed the case ... I dug around for the API docs on codeigniter - it&#039;s an established framework and has a good reputation.  I knew it would have API docs even though I hadn&#039;t used the framework before, and I found them:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&lt;b&gt;$this-&gt;db-&gt;select() accepts an optional second parameter. If you set it to FALSE, CodeIgniter will not try to protect your field or table names with backticks. This is useful if you need a compound select statement.&lt;/b&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;br /&gt;
That quote is from &lt;a href=&quot;http://codeigniter.com/user_guide/database/active_record.html#select&quot;&gt;this API docs page&lt;/a&gt; - so a big thankyou to Damian for replying to me on twitter, and to the good people at codeigniter for adding a useful option to their framework and documenting it so nicely :)  
    </content:encoded>

    <pubDate>Thu, 28 Jan 2010 13:28:00 +0000</pubDate>
    <guid isPermaLink="false">http://www.lornajane.net/posts/2010/573</guid>
    <category>codeigniter</category>
<category>joind.in</category>
<category>php</category>

</item>
<item>
    <title>Contributing to Projects on GitHub</title>
    <link>http://www.lornajane.net/posts/2010/Contributing-to-Projects-on-GitHub</link>
            <category>tech</category>
    
    <comments>http://www.lornajane.net/posts/2010/Contributing-to-Projects-on-GitHub#comments</comments>
    <wfw:comment>http://www.lornajane.net/wfwcomment.php?cid=568</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://www.lornajane.net/rss.php?version=2.0&amp;type=comments&amp;cid=568</wfw:commentRss>
    

    <author>s9y@lornajane.net (LornaJane)</author>
    <content:encoded>
    Recently I&#039;ve been contributing to the code project behind &lt;a href=&quot;http://joind.in&quot;&gt;joind.in&lt;/a&gt;, the event information and feedback site.  I rely on joind.in a lot and after putting up with a frankly astonishing volume of feature requests from me, its owner Chris Cornutt very politely suggested that I might like to fix some of them myself.  The project is hosted on &lt;a href=&quot;http://www.github.com&quot;&gt;github&lt;/a&gt; and I haven&#039;t traditionally been much of a git fan, but I wanted to contribute so I set off to work out how to begin.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Register on Github&lt;/h3&gt;&lt;br /&gt;
&lt;br /&gt;
To do anything useful I first needed to &lt;a href=&quot;https://github.com/signup/free&quot;&gt;sign up&lt;/a&gt; for an account.  Github has a range of accounts but I found that with one of their free accounts I would be able to get started and contribute to the project.  This gives me a project space of my own and a user to tie all my activities to.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Set up SSH Key&lt;/h3&gt;&lt;br /&gt;
&lt;br /&gt;
In order to authenticate against the github servers, you need to set up an ssh key and give them your public key so they know you are you.  You&#039;ll then need to tell git to use this key whenever it makes contact with the github servers.  I do quite a bit with ssh and ssh keys myself so I was comfortable with this step.  Even if you are totally new, its still pretty straightforward and they have &lt;a href=&quot;http://help.github.com/linux-key-setup/&quot;&gt;a great howto&lt;/a&gt; on github itself which will help.&lt;br /&gt;
&lt;br /&gt;
I had issues with git not picking up that it needed to use a non-standard ssh key, but I found the answers in this &lt;a href=&quot;http://git.or.cz/gitwiki/GitFaq#HowdoIspecifywhatsshkeygitshoulduse.3F&quot;&gt;entry on the git website&lt;/a&gt;.  In a nutshell, set up an ssh alias, set the key in there and then use the alias instead of the actual URL when giving the repo location to git.  This now works like a charm for me.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Fork the Project&lt;/h3&gt;&lt;br /&gt;
&lt;br /&gt;
Now, github uses &quot;fork&quot; where I might choose to say &quot;checkout&quot; - fork in my world means something else completely.  But in this case you&#039;re just making your own copy of the project repository.  This is where you will commit your changes to and it retains its link with the original repository making it easy for anyone with commit access to that to pull in your changes.  Patch files are nowhere to be seen, and although I was wary at first, this is project collaboration at its most painless, I&#039;m impressed!  Forking was relatively simple and again there was great documentation &lt;a href=&quot;http://help.github.com/forking/&quot;&gt;on the github site&lt;/a&gt;.  In particular I recommend that you take the time to follow the bit about adding an alias for the &quot;upstream&quot; repository - this made committing my changes to the main joind.in repo really easy.&lt;br /&gt;
&lt;br /&gt;
The forking instructions linked above also gave a description of how to actually use git, how to get my changes applied to my local repo, and how to push them to my remote repo on github itself.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Make a Pull Request&lt;/h3&gt;&lt;br /&gt;
&lt;br /&gt;
Once I&#039;d fixed a few things, I was ready to push the code back to the main project so that Chris could consider it for inclusion.  This is done by making a pull request from the main project page - you can add a comment about the changes you are supplying to help the maintainers to manage all the incoming patches.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Go Forth and Contribute&lt;/h3&gt;&lt;br /&gt;
&lt;br /&gt;
It was easier than I expected to get set up to contribute to a project using github, so find something you want to improve and/or be involved with, and do it.  I began by fixing the docs for joind.in, which was a great place to start since it allowed me to make a useful contribution without touching the code in the first instance :)  
    </content:encoded>

    <pubDate>Tue, 26 Jan 2010 09:05:00 +0000</pubDate>
    <guid isPermaLink="false">http://www.lornajane.net/posts/2010/568</guid>
    <category>contribute</category>
<category>git</category>
<category>github</category>
<category>joind.in</category>
<category>tech</category>

</item>
<item>
    <title>Speaking at PHPNW February</title>
    <link>http://www.lornajane.net/posts/2010/Speaking-at-PHPNW-February</link>
            <category>php</category>
    
    <comments>http://www.lornajane.net/posts/2010/Speaking-at-PHPNW-February#comments</comments>
    <wfw:comment>http://www.lornajane.net/wfwcomment.php?cid=572</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.lornajane.net/rss.php?version=2.0&amp;type=comments&amp;cid=572</wfw:commentRss>
    

    <author>s9y@lornajane.net (LornaJane)</author>
    <content:encoded>
    If anyone is able to make it to the PHPNW User Group meet in Manchester next Tuesday 2nd February - I&#039;m the speaker there!  I&#039;ll be giving a talk entitled &quot;Best Practices for Web Service Design&quot;, which covers lots of information about web services and how to write one that your users will love!  Details of the event are &lt;a href=&quot;http://upcoming.yahoo.com/event/5248686/MCR/Manchester/PHPNW-February-2010/Revolution-Deansgate/&quot;&gt;over on upcoming&lt;/a&gt;, you can find out more about the talks, the venue and the group as a whole.  If you&#039;re able to make it then I&#039;ll see you there - its a good crowd :)  
    </content:encoded>

    <pubDate>Mon, 25 Jan 2010 08:45:29 +0000</pubDate>
    <guid isPermaLink="false">http://www.lornajane.net/posts/2010/572</guid>
    <category>php</category>
<category>phpnw</category>
<category>speaking</category>
<category>webservice</category>

</item>
<item>
    <title>Charlie Bag from Burdastyle</title>
    <link>http://www.lornajane.net/posts/2010/Charlie-Bag-from-Burdastyle</link>
            <category>craft</category>
    
    <comments>http://www.lornajane.net/posts/2010/Charlie-Bag-from-Burdastyle#comments</comments>
    <wfw:comment>http://www.lornajane.net/wfwcomment.php?cid=563</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.lornajane.net/rss.php?version=2.0&amp;type=comments&amp;cid=563</wfw:commentRss>
    

    <author>s9y@lornajane.net (LornaJane)</author>
    <content:encoded>
    About a year ago I discovered the BurdaStyle site - where they have open source patterns.  And then over the summer I saw an event organised in NYC where they were making these &lt;a href=&quot;http://www.burdastyle.com/projects/charlie-reusable-grocery-bag&quot;&gt;Charlie Bags&lt;/a&gt; - foldable fabric bags for putting shopping in.  The pattern is free, and came as a PDF.  You print the PDF, and then you cut and stick to make the paper pattern - the bag is bigger than A4.&lt;br /&gt;
&lt;br /&gt;
Once I&#039;d made the pattern, I cut out the bag and followed the instructions.  They have good instructions, step by step with pictures.  The Charlie bag is really simple so you just zig-zag round the shape and leave the handles like that, just unfinished, which is about the only way someone with my sewing abilities is going to make anything with curvy handles :)&lt;br /&gt;
&lt;br /&gt;
I&#039;m really pleased with the result:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.flickr.com/photos/lornajane/4237900471/&quot; title=&quot;Charlie Bag by LornaJane.net, on Flickr&quot;&gt;&lt;img src=&quot;http://farm3.static.flickr.com/2747/4237900471_90217839f0.jpg&quot; width=&quot;375&quot; height=&quot;500&quot; alt=&quot;Charlie Bag&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
This was pretty simple and now I&#039;ve assembled the paper pattern, I might make a few more :)  
    </content:encoded>

    <pubDate>Thu, 21 Jan 2010 22:32:00 +0000</pubDate>
    <guid isPermaLink="false">http://www.lornajane.net/posts/2010/563</guid>
    <category>bag</category>
<category>craft</category>
<category>sewing</category>

</item>
<item>
    <title>Three Ways to Make a POST Request from PHP</title>
    <link>http://www.lornajane.net/posts/2010/Three-Ways-to-Make-a-POST-Request-from-PHP</link>
            <category>php</category>
    
    <comments>http://www.lornajane.net/posts/2010/Three-Ways-to-Make-a-POST-Request-from-PHP#comments</comments>
    <wfw:comment>http://www.lornajane.net/wfwcomment.php?cid=567</wfw:comment>

    <slash:comments>13</slash:comments>
    <wfw:commentRss>http://www.lornajane.net/rss.php?version=2.0&amp;type=comments&amp;cid=567</wfw:commentRss>
    

    <author>s9y@lornajane.net (LornaJane)</author>
    <content:encoded>
    I&#039;ve been doing a lot of work with services and working with them in various ways from PHP.  There are a few different ways to do this, PHP has a &lt;a href=&quot;http://uk.php.net/curl&quot;&gt;curl extension&lt;/a&gt; which is useful, and if you can add PECL extensions then &lt;a href=&quot;http://pecl.php.net/package/pecl_http&quot;&gt;pecl_http&lt;/a&gt; is a better bet but there are a couple of different ways of using it.  This post shows all these side-by-side.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;POSTing from PHP Curl&lt;/h3&gt;&lt;br /&gt;
&lt;br /&gt;
This is pretty straightforward once you get your head around the way the PHP curl extension works, combining various flags with setopt() calls.  In this example I&#039;ve got a variable $xml which holds the XML I have prepared to send - I&#039;m going to post the contents of that to flickr&#039;s test method.&lt;br /&gt;
&lt;div class=&quot;php&quot; style=&quot;text-align: left&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$url&lt;/span&gt; = &lt;span style=&quot;color: #ba0157;&quot;&gt;&#039;http://api.flickr.com/services/xmlrpc/&#039;&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$ch&lt;/span&gt; = curl_init&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$url&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;curl_setopt&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$ch&lt;/span&gt;, CURLOPT_POST, &lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;curl_setopt&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$ch&lt;/span&gt;, CURLOPT_POSTFIELDS, &lt;span style=&quot;color: #0000ff;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;curl_setopt&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$curl&lt;/span&gt;, CURLOPT_RETURNTRANSFER, &lt;span style=&quot;color: #000000;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$response&lt;/span&gt; = curl_exec&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$ch&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;curl_close&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$ch&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;#160;&lt;/div&gt;&lt;br /&gt;
First we initialised the connection, then we set some options using setopt().  These tell PHP that we are making a post request, and that we are sending some data with it, supplying the data.  The CURLOPT_RETURNTRANSFER flag tells curl to give us the output as the return value of curl_exec rather than outputting it.  Then we make the call and close the connection - the result is in $response.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;POSTing from Pecl_Http&lt;/h3&gt;&lt;br /&gt;
&lt;br /&gt;
Pecl_Http has two interfaces - one procedural and one object-oriented; we&#039;ll start by looking at the former.  This is even simpler than in curl, here&#039;s the same script translated for pecl_http:&lt;br /&gt;
&lt;div class=&quot;php&quot; style=&quot;text-align: left&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$url&lt;/span&gt; = &lt;span style=&quot;color: #ba0157;&quot;&gt;&#039;http://api.flickr.com/services/xmlrpc/&#039;&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$response&lt;/span&gt; = http_post_data&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$url&lt;/span&gt;, &lt;span style=&quot;color: #0000ff;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;#160;&lt;/div&gt;&lt;br /&gt;
This extension has a method to expressly post a request, and it can optionally accept data to go with it, very simple and easy.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;POSTing from Pecl_Http: the OO interface&lt;/h3&gt;&lt;br /&gt;
&lt;br /&gt;
Finally let&#039;s see what the OO verison of the extension looks like.  Exactly the same call as both the above examples, but using the alternative interface, means our code looks like this:&lt;br /&gt;
&lt;div class=&quot;php&quot; style=&quot;text-align: left&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$url&lt;/span&gt; = &lt;span style=&quot;color: #ba0157;&quot;&gt;&#039;http://api.flickr.com/services/xmlrpc/&#039;&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$request&lt;/span&gt; = &lt;span style=&quot;color: #000000;&quot;&gt;new&lt;/span&gt; HTTPRequest&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$url&lt;/span&gt;, HTTP_METH_POST&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$request&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;setRawPostData&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$request&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;send&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$response&lt;/span&gt; = &lt;span style=&quot;color: #0000ff;&quot;&gt;$request&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;getResponseBody&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;#160;&lt;/div&gt;&lt;br /&gt;
This example is quite a bit longer than the previous one, and you might think this indicates that this approach is more complicated.  In some senses that is true and its probably overkill for our extremely trivial example.  However it is worth mentioning that the pecl_http extension is extremely flexible and powerful, and can handle some cases that the curl extension can&#039;t.  So even if it looks more complicated here, it can still be an excellent choice to implement.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;In Conclusion&lt;/h3&gt;&lt;br /&gt;
&lt;br /&gt;
That was a very fast round-up of three ways you could make an arbitrary web service call from PHP - hopefully these examples are clear and will help anyone just starting to implement something along these lines.  
    </content:encoded>

    <pubDate>Mon, 18 Jan 2010 09:03:00 +0000</pubDate>
    <guid isPermaLink="false">http://www.lornajane.net/posts/2010/567</guid>
    <category>curl</category>
<category>pecl</category>
<category>php</category>
<category>webservice</category>

</item>
<item>
    <title>Screen in Ubuntu Karmic</title>
    <link>http://www.lornajane.net/posts/2010/Screen-in-Ubuntu-Karmic</link>
            <category>tech</category>
    
    <comments>http://www.lornajane.net/posts/2010/Screen-in-Ubuntu-Karmic#comments</comments>
    <wfw:comment>http://www.lornajane.net/wfwcomment.php?cid=565</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.lornajane.net/rss.php?version=2.0&amp;type=comments&amp;cid=565</wfw:commentRss>
    

    <author>s9y@lornajane.net (LornaJane)</author>
    <content:encoded>
    I have written about &lt;a href=&quot;http://www.gnu.org/software/screen/&quot;&gt;screen&lt;/a&gt; quite often, mostly including my .screenrc file and showing how to have named tabs for the various screen tabs you have open.  When Ubuntu Jaunty came out, I found it had some quite cool enhancements that made the customisations for screen really easy by default - and I &lt;a href=&quot;http://www.lornajane.net/posts/2009/Screen-Profiles-Improved-Screen-in-Ubuntu-Jaunty&quot;&gt;wrote about &lt;/a&gt;these.&lt;br /&gt;
&lt;br /&gt;
In Karmic Koala, Ubuntu 9.10, the packages are still there but they&#039;ve changed names!  So if you want to use screen with Ubuntu Karmic or later, install packages &lt;b&gt;byobu&lt;/b&gt; and &lt;b&gt;byobu-extras&lt;/b&gt;, and uninstall screen-profiles and screen-profiles-extras (they were broken on my system after upgrade anyway) and you should find everything works as expected.  To run screen with the new features, you should run &quot;byobu&quot; instead - although screen commands seem to work to detach and reattach the screens that result, weirdly.&lt;br /&gt;
&lt;br /&gt;
I&#039;m mostly posting about it because I have been very frustrated and there&#039;s no way I could have guessed, or probably ever will remember, what these packages are called.  Apparently a byobu is a japanese room screen ... you learn something new every day!  
    </content:encoded>

    <pubDate>Fri, 15 Jan 2010 09:35:00 +0000</pubDate>
    <guid isPermaLink="false">http://www.lornajane.net/posts/2010/565</guid>
    <category>linux</category>
<category>tech</category>
<category>ubuntu</category>

</item>

</channel>
</rss>